void LoadDataForReport() { statementList.Clear(); var visibleRows = dgDebtorTranOpenGrid.GetVisibleRows() as IEnumerable <DebtorTransPayment>; if (visibleRows.Count() > 0) { string currentItem = null; DebtorPaymentStatementList masterDbPymtStatement = null; List <DebtorTransPayment> dbTransClientChildList = null; double SumAmount = 0d, SumAmountCur = 0d, CollectionAmount = 0d, SumFee = 0d; var listOpenTrans = visibleRows.OrderBy(p => p.Account); foreach (var trans in listOpenTrans) { if (trans.Account != currentItem) { currentItem = trans.Account; var dbt = (Debtor)accountCache.Get(currentItem); masterDbPymtStatement = new DebtorPaymentStatementList(); masterDbPymtStatement.AccountNumber = dbt._Account; masterDbPymtStatement.Name = dbt._Name; dbTransClientChildList = new List <DebtorTransPayment>(); masterDbPymtStatement.ChildRecords = dbTransClientChildList; statementList.Add(masterDbPymtStatement); SumAmount = SumAmountCur = CollectionAmount = SumFee = 0d; } SumAmount += trans._AmountOpen; trans._SumAmount = SumAmount; masterDbPymtStatement._SumAmount = SumAmount; SumFee += trans._FeeAmount; masterDbPymtStatement._sumFeeAmount = SumFee; CollectionAmount += (trans._AmountOpen + trans._FeeAmount); masterDbPymtStatement._collectionAmount = CollectionAmount; SumAmountCur += trans._AmountOpenCur; trans._SumAmount = SumAmountCur; masterDbPymtStatement._SumAccountCur = SumAmountCur; dbTransClientChildList.Insert(0, trans); } } }
async private Task PrintDebtorPaymentStatementPage(CompanyClient companyClient, byte[] logo, DebtorPaymentStatementList selectedItem, string emailType) { int indexDebtorEmailType = AppEnums.DebtorEmailType.IndexOf(emailType); var debtorEmailType = (DebtorEmailType)indexDebtorEmailType; var dbClientTotal = selectedItem.ChildRecords.FirstOrDefault(); if (dbClientTotal != null) { var debtorClient = new DebtorClient(); StreamingManager.Copy(dbClientTotal.Debtor, debtorClient); var lan = UtilDisplay.GetLanguage(debtorClient, companyClient); if (lastMessage == null || messageLanguage != lan) { messageLanguage = lan; var res = await Utility.GetDebtorMessageClient(api, lan, debtorEmailType); if (res != null) { lastMessage = res._Text; } else { lastMessage = string.Empty; } } var dbStatementCustomPrint = new DebtorPaymentStatementCustPrint(api, selectedItem, companyClient, debtorClient, txtDateFrm.DateTime, txtDateTo.DateTime, logo, debtorEmailType.ToString(), this.AddInterest, lastMessage); object[] obj = new object[1]; obj[0] = dbStatementCustomPrint as CustomPrintTemplateData; AddDockItem(TabControls.DebtorPaymentStatementPrintPage, obj, true, string.Format("{0}: {1},{2}", Uniconta.ClientTools.Localization.lookup("PrintPreview"), selectedItem.Name, selectedItem.AccountNumber)); } }
async private Task <DebtorCollectionReportClient> GenerateStandardCollectionReport(CompanyClient companyClient, DateTime dueDate, DebtorPaymentStatementList selectedItem, byte[] logo, DebtorEmailType debtorEmailType) { var dbClientTotal = selectedItem.ChildRecords.FirstOrDefault(); var debtorType = Uniconta.Reports.Utilities.ReportUtil.GetUserType(typeof(DebtorClient), api.CompanyEntity); var debtorClient = Activator.CreateInstance(debtorType) as DebtorClient; StreamingManager.Copy(dbClientTotal.Debtor, debtorClient); var lan = UtilDisplay.GetLanguage(debtorClient, companyClient); if (lastMessage == null || messageLanguage != lan) { messageLanguage = lan; var res = await Utility.GetDebtorMessageClient(api, lan, debtorEmailType); if (res != null) { lastMessage = res._Text; } else { lastMessage = string.Empty; } } debtorClient.OpenTransactions = selectedItem.ChildRecords.ToArray(); string _reportName = StandardReportUtility.GetLocalizedReportName(debtorClient, companyClient, debtorEmailType.ToString()); return(new DebtorCollectionReportClient(companyClient, debtorClient, dueDate, logo, this.AddInterest, _reportName, lastMessage)); }
void LoadDataForReport() { statementList.Clear(); var visibleRows = dgDebtorTranOpenGrid.GetVisibleRows() as ICollection <DebtorTransPayment>; if (visibleRows.Count > 0) { string currentItem = null; DebtorPaymentStatementList masterDbPymtStatement = null; List <DebtorTransPayment> dbTransClientChildList = new List <DebtorTransPayment>(20); double SumAmount = 0d, SumAmountCur = 0d, CollectionAmount = 0d, SumFee = 0d; Uniconta.ClientTools.Localization debtLocalize = null; var listOpenTrans = visibleRows.OrderBy(p => p.Account); foreach (var trans in listOpenTrans) { if (trans.Account != currentItem) { if (masterDbPymtStatement != null && CollectionAmount > 0) { masterDbPymtStatement.ChildRecords = dbTransClientChildList.ToArray(); statementList.Add(masterDbPymtStatement); } else { foreach (var rec in dbTransClientChildList) { rec._FeeAmount = 0d; } } currentItem = trans.Account; var dbt = (Debtor)accountCache.Get(currentItem); var lan = UtilDisplay.GetLanguage(dbt, api.CompanyEntity); debtLocalize = Uniconta.ClientTools.Localization.GetLocalization(lan); masterDbPymtStatement = new DebtorPaymentStatementList(); if (dbt != null) { masterDbPymtStatement.AccountNumber = dbt._Account; masterDbPymtStatement.Name = dbt._Name; } SumAmount = SumAmountCur = CollectionAmount = SumFee = 0d; dbTransClientChildList.Clear(); } trans.Trans.LocOb = debtLocalize; SumAmount += trans._AmountOpen; trans._SumAmount = SumAmount; masterDbPymtStatement._SumAmount = SumAmount; SumFee += trans._FeeAmount; masterDbPymtStatement._sumFeeAmount = SumFee; CollectionAmount += (trans._AmountOpen + trans._FeeAmount); masterDbPymtStatement._collectionAmount = CollectionAmount; SumAmountCur += trans._AmountOpenCur; trans._SumAmount = SumAmountCur; masterDbPymtStatement._SumAccountCur = SumAmountCur; dbTransClientChildList.Add(trans); } if (masterDbPymtStatement != null && CollectionAmount > 0) { masterDbPymtStatement.ChildRecords = dbTransClientChildList.ToArray(); statementList.Add(masterDbPymtStatement); } } }
async private Task <DebtorCollectionReportClient> GenerateStandardCollectionReport(CompanyClient companyClient, DateTime dueDate, DebtorPaymentStatementList selectedItem, byte[] logo, DebtorEmailType debtorEmailType) { DebtorCollectionReportClient debtorCollectionReportClient = null; var dbClientTotal = selectedItem.ChildRecords.FirstOrDefault(); var debtorType = Uniconta.Reports.Utilities.ReportUtil.GetUserType(typeof(DebtorClient), api.CompanyEntity); var debtorClient = Activator.CreateInstance(debtorType) as DebtorClient; StreamingManager.Copy(dbClientTotal.Debtor, debtorClient); var debtorMessageClient = await Utility.GetDebtorMessageClient(api, debtorClient._Language, debtorEmailType); var debtorTransOpen = selectedItem.ChildRecords.Cast <DebtorTransOpenClient>().ToList(); debtorClient.OpenTransactions = debtorTransOpen; string _reportName = StandardReportUtility.GetLocalizedReportName(debtorClient, companyClient, debtorEmailType.ToString()); debtorCollectionReportClient = new DebtorCollectionReportClient(companyClient, debtorClient, dueDate, logo, this.AddInterest, _reportName, debtorMessageClient); return(debtorCollectionReportClient); }