116 lines
3.5 KiB
C#
116 lines
3.5 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using BeWo.Data.Access;
|
|
using BeWo.Data.Entities;
|
|
using BeWo.Report.ReportObjects;
|
|
using BeWo.Report;
|
|
using DevExpress.XtraReports.UI;
|
|
using System.Data;
|
|
using BS.Shared;
|
|
|
|
namespace BeWoHeinsberg
|
|
{
|
|
public partial class QuittierungsbelegLvr : DevExpress.XtraReports.UI.XtraReport, IBeWoReport<QueryRO>
|
|
{
|
|
public QuittierungsbelegLvr()
|
|
{
|
|
InitializeComponent();
|
|
|
|
}
|
|
|
|
public void SetReportDataSource(QueryRO pRO)
|
|
{
|
|
InitTable(pRO);
|
|
this.bindingSource1.DataSource = pRO;
|
|
}
|
|
|
|
private void InitTable(QueryRO ro)
|
|
{
|
|
DateTime startMonat = DateTime.MinValue;
|
|
DateTime endMonat = DateTime.MinValue;
|
|
|
|
long c2sOid = 0;
|
|
|
|
foreach (BeWo.Report.ReportObjects.QueryRO.Row row in ro.Rows)
|
|
{
|
|
if (startMonat == DateTime.MinValue)
|
|
{
|
|
startMonat = DateTime.Parse(row.Field1.ToString());
|
|
}
|
|
|
|
|
|
long oid = 0;
|
|
//if (Int64.TryParse(row.Field3.ToString(), out oid))
|
|
//{
|
|
// var emp = DAOFactory.GenericDAO.LoadByID<Employee>(oid);
|
|
|
|
// lblMitarbeiter.Text = String.Format("{0} {1}", emp.Person.FirstName, emp.Person.LastName);
|
|
//}
|
|
|
|
//oid = 0;
|
|
if (Int64.TryParse(row.Field2.ToString(), out oid))
|
|
{
|
|
c2sOid = oid;
|
|
|
|
//lblKlient.Text = String.Format("{0} {1}", cust.Person.FirstName, cust.Person.LastName);
|
|
}
|
|
|
|
}
|
|
|
|
List<CostBearer2SupportConcept> c2sList = new List<CostBearer2SupportConcept>();
|
|
|
|
if (c2sOid > 0)
|
|
{
|
|
var c2s = DAOFactory.GenericDAO.LoadByID<CostBearer2SupportConcept>(c2sOid);
|
|
c2sList.Add(c2s);
|
|
}
|
|
else
|
|
{
|
|
var all = DAOFactory.GenericDAO.GetAllActive<CostBearer2SupportConcept>();
|
|
foreach (var c2s in all)
|
|
{
|
|
if (c2s.SupportConcept.IsActive == ActivationTypeId.Active &&
|
|
c2s.SupportConcept.Customer.IsActive == ActivationTypeId.Active)
|
|
{
|
|
if (c2s.CostBearer.Organisation.Name == "LVR")
|
|
{
|
|
if (c2s.StartDate < startMonat.AddDays(1) && c2s.EndDate >= startMonat)
|
|
{
|
|
c2sList.Add(c2s);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
ro.Rows.Clear();
|
|
|
|
foreach (var c in c2sList)
|
|
{
|
|
var customerRow = new QueryRO.Row();
|
|
customerRow.ChildRows1 = new List<QueryRO.Row>();
|
|
ro.Rows.Add(customerRow);
|
|
|
|
customerRow.Field1 = String.Format("{0:MMMM yyyy}", startMonat);
|
|
customerRow.Field2 = String.Format("{0} {1}", c.SupportConcept.Customer.Person.FirstName, c.SupportConcept.Customer.Person.LastName);
|
|
customerRow.Field3 = String.Format("{0}", c.CustomerReferenceNumber);
|
|
customerRow.Field4 = String.Format("{0} {1}", c.SupportConcept.Customer.Person.LastName, c.SupportConcept.Customer.Person.FirstName);
|
|
|
|
for (int i = 1; i <= 20; i++)
|
|
{
|
|
var dayRow = new QueryRO.Row();
|
|
|
|
|
|
customerRow.ChildRows1.Add(dayRow);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
ro.Rows.Sort((a, b) => a.Field4.ToString().CompareTo(b.Field4));
|
|
}
|
|
|
|
}
|
|
|
|
}
|