FaC: Quittierungsbeleg für Lisa Wöller GmbH mit Klientenunterschrift und -datum versehen. Quittierungsbeleg von Club 74 mit Quittierungsbelegunterschriften versehen.
129 lines
4.7 KiB
C#
129 lines
4.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.IO;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report;
|
|
using BeWo.Report.ReportObjects;
|
|
using BS.Shared.Core;
|
|
using DevExpress.XtraReports.UI;
|
|
|
|
namespace Akgg
|
|
{
|
|
public class CustomReportCreator : DefaultReportCreator
|
|
{
|
|
public override XtraReport CreateQueryReport(long queryOid, string queryReportId)
|
|
{
|
|
if (queryOid == 200)
|
|
return CreateKilometerbeleg(queryOid, queryReportId);
|
|
|
|
return base.CreateQueryReport(queryOid, queryReportId);
|
|
}
|
|
|
|
private XtraReport CreateKilometerbeleg(long queryOid, string queryReportId)
|
|
{
|
|
var query = DAOFactory.GenericDAO.LoadByID<Query>(queryOid);
|
|
|
|
if (query == null)
|
|
return new XtraReport();
|
|
|
|
var path = Path.Combine(TempPath, queryReportId + ".xml");
|
|
var table = Utils.XMLDeserialize<DataTable>(path);
|
|
var qro = QueryRO.Create(query, table);
|
|
|
|
|
|
if (qro.Rows.Count > 0)
|
|
{
|
|
DateTime dt = DateTime.Now;
|
|
DateTime.TryParse(qro.Rows[0].Field1.ToString(), out dt);
|
|
dt = dt.AddMonths(1).AddDays(-1);
|
|
DateTime dtStart = new DateTime(dt.Year, dt.Month, 1);
|
|
|
|
long? customerOid = null;
|
|
if (qro.Rows[0].Field2 != null && qro.Rows[0].Field2.ToString() != "0")
|
|
{
|
|
customerOid = Int64.Parse(qro.Rows[0].Field2.ToString());
|
|
//var customer = DAOFactory.GenericDAO.LoadByID<Customer>(customerOid.Value);
|
|
var ro = ServicesOverviewRO.Create(customerOid.Value, dt.Month, dt.Year, false, 0, 0, 1, dt.Day, null);
|
|
var druck = new Akgg.Kilometerbeleg();
|
|
druck.SetReportDataSource(ro);
|
|
return druck;
|
|
}
|
|
if (customerOid == null)
|
|
{
|
|
XtraReport masterReport = new XtraReport();
|
|
masterReport.CreateDocument();
|
|
|
|
var customerList = DAOFactory.GenericDAO.GetAllActive<Customer>();
|
|
foreach (var c in customerList)
|
|
{
|
|
var cRo = ServicesOverviewRO.Create(c.Oid.Value, dt.Month, dt.Year, false, 0, 0, 1, dt.Day, null);
|
|
var seite1 = new Akgg.Kilometerbeleg();
|
|
seite1.SetReportDataSource(cRo);
|
|
seite1.CreateDocument();
|
|
masterReport.Pages.AddRange(seite1.Pages);
|
|
}
|
|
return masterReport;
|
|
}
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
public override XtraReport CreateServiceOverviewAllCustomersReport(int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
|
|
{
|
|
List<ServicesOverviewRO> lROs = ServicesOverviewRO.Create(month, year, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
|
|
|
|
if (lROs.Count > 0)
|
|
{
|
|
|
|
var rootReport = CreateServicesOverviewReportForRo(lROs[0], serviceCategoryOid);
|
|
rootReport.CreateDocument();
|
|
|
|
for (int i = 1; i < lROs.Count; i++)
|
|
{
|
|
var lNext = CreateServicesOverviewReportForRo(lROs[i], serviceCategoryOid);
|
|
lNext.CreateDocument();
|
|
rootReport.Pages.AddRange(lNext.Pages);
|
|
}
|
|
|
|
return rootReport;
|
|
}
|
|
return new XtraReport();
|
|
}
|
|
|
|
public override XtraReport CreateServiceOverviewSingleCustomerReport(long customerOid, int month, int year, long orgaOid, long empOid, long? serviceCategoryOid, int startDay, int endDay)
|
|
{
|
|
var ro = ServicesOverviewRO.Create(customerOid, month, year, false, orgaOid, empOid, startDay, endDay, serviceCategoryOid);
|
|
return CreateServicesOverviewReportForRo(ro, serviceCategoryOid);
|
|
}
|
|
|
|
private XtraReport CreateServicesOverviewReportForRo(ServicesOverviewRO ro, long? serviceCategoryOid)
|
|
{
|
|
IBeWoReport<ServicesOverviewRO> report = null;
|
|
String kt = "";
|
|
if (!String.IsNullOrWhiteSpace(ro.Costbearer))
|
|
kt = ro.Costbearer.Trim();
|
|
|
|
String function = "";
|
|
if (ro.CostBearer2SupportConceptList != null)
|
|
{
|
|
foreach (var c2s in ro.CostBearer2SupportConceptList)
|
|
{
|
|
if (c2s.CostBearer.Organisation.Function != null && !String.IsNullOrWhiteSpace(ro.Costbearer) && c2s.CostBearer.Organisation.Name == ro.Costbearer)
|
|
function = c2s.CostBearer.Organisation.Function.Value;
|
|
}
|
|
}
|
|
|
|
if (function == "Leistungsnachweis PK")
|
|
report = new Akgg.QuittierungsbelegPK();
|
|
|
|
if (report == null)
|
|
report = new Akgg.Quittierungsbeleg();
|
|
report.SetReportDataSource(ro);
|
|
|
|
return report as XtraReport;
|
|
}
|
|
}
|
|
}
|