protected override void SyncEntityMasterRowChanged(UnicontaBaseEntity args) { if (args is DebtorOrderLineClient) { var orderLine = args as DebtorOrderLineClient; if (orderLine._Item == null) { return; } var argsArray = new object[1]; argsArray[0] = args; globalEvents.OnRefresh(NameOfControl, argsArray); } if (args is CreditorOrderLineClient) { var orderLine = args as DCOrderLineClient; if (orderLine._Item == null) { return; } var item = (InvItem)itemCache.Get(orderLine._Item); if (!item._UseSerialBatch) { return; } var argsArray = new object[1]; argsArray[0] = args; globalEvents.OnRefresh(NameOfControl, argsArray); } SetupMaster(args); SetHeader(args); InitQuery(); }
private void Editrow_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var rec = sender as GLDailyJournalClient; var prop = e.PropertyName; if (prop == "TransType") { if (string.IsNullOrEmpty(rec.Account)) { var glTransTYpe = (Uniconta.DataModel.GLTransType)GLTransTypeCache?.Get(rec._TransType); if (rec._DefaultAccountType == glTransTYpe?._AccountType) { rec._Account = glTransTYpe._Account; rec.NotifyPropertyChanged("Account"); } } if (string.IsNullOrEmpty(rec.OffsetAccount)) { var glTransTYpe = (Uniconta.DataModel.GLTransType)GLTransTypeCache?.Get(rec._TransType); if (rec._DefaultOffsetAccountType == glTransTYpe?._OffsetAccountType) { rec._OffsetAccount = glTransTYpe._OffsetAccount; rec.NotifyPropertyChanged("OffsetAccount"); } } } }
public int Compare(ProjectTransInvoiceClient x, ProjectTransInvoiceClient y) { var prx = (PrCategory)CategoryCache.Get(x._PrCategory); var pry = (PrCategory)CategoryCache.Get(y._PrCategory); int c; if (prx != null && pry != null) { c = prx._Sorting - pry._Sorting; if (c != 0) { return(c); } } c = DateTime.Compare(x._Date, y._Date); if (c != 0) { return(c); } c = string.Compare(prx?.KeyStr, pry?.KeyStr); if (c != 0) { return(c); } return(x._LineNumber - y._LineNumber); }
async private void OpenOutlook() { try { busyIndicator.IsBusy = true; busyIndicator.BusyContent = Uniconta.ClientTools.Localization.lookup("LaunchingWaitMsg"); var selectedAccount = ((DebtorTransPayment)dgDebtorTranOpenGrid.SelectedItem).Account; byte[] logo = await UtilDisplay.GetLogo(api); var Comp = api.CompanyEntity; var companyClient = Comp.CreateUserType <CompanyClient>(); StreamingManager.Copy(Comp, companyClient); lastMessage = null; // just to reload message in case it has changed LoadDataForReport(); int indexDebtorEmailType = 0; if (string.IsNullOrEmpty(collectionType)) { indexDebtorEmailType = SelectCollectionType(); } else { indexDebtorEmailType = AppEnums.DebtorEmailType.IndexOf(collectionType); } if (indexDebtorEmailType == -1) { return; } var debtor = accountCache.Get(selectedAccount) as Uniconta.DataModel.Debtor; var debtorEmailType = (DebtorEmailType)indexDebtorEmailType; var date = BasePage.GetSystemDefaultDate(); var selectedAccountstatementList = statementList.Where(p => p.AccountNumber == selectedAccount); var paymentStandardReport = await GeneratePrintReport(selectedAccountstatementList, companyClient, date, logo, debtorEmailType); if (paymentStandardReport != null && paymentStandardReport.Count() == 1) { InvoicePostingPrintGenerator.OpenReportInOutlook(api, paymentStandardReport.First(), debtor, debtorEmailType); //Update Last dateTime UpdateDate(date, selectedAccountstatementList.FirstOrDefault()?.ChildRecords, debtorEmailType == DebtorEmailType.InterestNote ? true : false); } } catch (Exception ex) { UnicontaMessageBox.Show(ex.Message, Uniconta.ClientTools.Localization.lookup("Exception")); } finally { busyIndicator.IsBusy = false; } }
void InitPage(UnicontaBaseEntity master) { InitializeComponent(); dcorderlineMaster = master as DCOrderLineClient; Comp = api.CompanyEntity; api.AllowBackgroundCrud = true; itemCache = Comp.GetCache(typeof(InvItem)); invItemMaster = itemCache.Get(dcorderlineMaster._Item) as InvItem; SetRibbonControl(localMenu, dgLinkedGrid); dgLinkedGrid.invItemMaster = invItemMaster; dgLinkedGrid.dcorderlineMaster = dcorderlineMaster; dgLinkedGrid.api = api; dgUnlinkedGrid.api = api; dgLinkedGrid.BusyIndicator = busyIndicator; dgUnlinkedGrid.BusyIndicator = busyIndicator; dgLinkedGrid.SelectedItemChanged += DgLinkedGrid_SelectedItemChanged; localMenu.OnItemClicked += localMenu_OnItemClicked; if (dcorderlineMaster.__DCType() != 2) { RemoveMenuItem(); } if (Comp.Warehouse) { warehouse = Comp.GetCache(typeof(InvWarehouse)); } ribbonControl.lowerSearchGrid = dgUnlinkedGrid; ribbonControl.UpperSearchNullText = Uniconta.ClientTools.Localization.lookup("Link"); ribbonControl.LowerSearchNullText = Uniconta.ClientTools.Localization.lookup("Unlinked"); }
public const string TRANSTYPE_ERH400 = "ERH400"; //Foreign Transaction public static bool GenerateFile(IEnumerable <CreditorTransPayment> paymentList, Company company, CreditorPaymentFormat paymentFormat, SQLCache bankAccountCache, SQLCache creditorCache, bool glJournalGenerated = false) { var bankStatement = (BankStatement)bankAccountCache.Get(paymentFormat._BankAccount); var fileFormat = new CreateBECFileFormatBase(); var listofBankProperties = new List <DanishFormatFieldBase>(); foreach (var tran in paymentList) { var creditor = (Uniconta.DataModel.Creditor)creditorCache.Get(tran.Account); if (tran.Paid || tran.OnHold || tran.ErrorInfo != BaseDocument.VALIDATE_OK) { continue; } var newProp = fileFormat.CreateFormatField(tran, paymentFormat, bankStatement, creditor, company, glJournalGenerated); if (newProp != null) { listofBankProperties.Add(newProp); } } if (listofBankProperties.Count > 0) { var sfd = UtilDisplay.LoadSaveFileDialog; sfd.Filter = UtilFunctions.GetFilteredExtensions(FileextensionsTypes.CSV); var userClickedSave = sfd.ShowDialog(); if (userClickedSave != true) { return(false); } try { #if !SILVERLIGHT using (var stream = File.Create(sfd.FileName)) #else using (var stream = sfd.OpenFile()) #endif { using (var sw = new StreamWriter(stream, Encoding.GetEncoding(1252))) { fileFormat.StreamToFile(listofBankProperties, sw); } stream.Close(); } return(true); } catch (Exception ex) { UnicontaMessageBox.Show(ex); } } else { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("NoRecords"), Uniconta.ClientTools.Localization.lookup("Message")); } return(false); }
static public double CalcVat(string VatId, double Amount, DateTime Date, bool RoundTo100, SQLCache VatCache) { if (VatId == null || VatCache == null || Amount == 0d) { return(0d); } var vatpost = (Uniconta.DataModel.GLVat)VatCache.Get(VatId); if (vatpost == null) { return(0d); } double ret; if ((vatpost._Account != null || vatpost._FollowAccount) && vatpost._OffsetAccount == null) { ret = vatpost.VatAmount1(Amount, Date, RoundTo100, null); } else { ret = 0d; } if ((vatpost._AccountRate2 != null || vatpost._FollowAccount2) && vatpost._OffsetAccountRate2 == null) { ret += vatpost.VatAmount2(Amount, Date, RoundTo100, null); } return(ret); }
bool GenerateJournalLines() { string fileOption = Convert.ToString(cbImportOption.SelectedItem); Uniconta.DataModel.GLDailyJournal journal = null; var journalText = Convert.ToString(lookupJournal.EditValue); if (!string.IsNullOrEmpty(journalText)) { journal = JournalCache.Get(journalText) as Uniconta.DataModel.GLDailyJournal; } string filePath = browseFile.FilePath; if (string.IsNullOrEmpty(fileOption) || journal == null || string.IsNullOrEmpty(filePath)) { return(false); } switch (fileOption) { case "NETS Norge": NETSNorge.GenerateJournalLines(Capi, journal, filePath); break; } return(true); }
private async void SetFields() { if (debtorCache == null) { debtorCache = api.CompanyEntity.GetCache(typeof(Uniconta.DataModel.Debtor)) ?? await api.CompanyEntity.LoadCache(typeof(Uniconta.DataModel.Debtor), api); } if (paymentFormatCache == null) { paymentFormatCache = api.CompanyEntity.GetCache(typeof(Uniconta.DataModel.DebtorPaymentFormat)) ?? await api.CompanyEntity.LoadCache(typeof(Uniconta.DataModel.DebtorPaymentFormat), api); } var debtor = (DebtorClient)debtorCache.Get(editrow._DCAccount); var paymentFormat = (DebtorPaymentFormatClient)paymentFormatCache.Get(debtor?.PaymentFormat); if (paymentFormat != null && paymentFormat._ExportFormat == (byte)Uniconta.DataModel.DebtorPaymFormatType.SEPA) { cmbMandateStatus.IsReadOnly = false; cmbMandateStatus.IsEnabled = true; deActivationDate.IsReadOnly = false; deActivationDate.IsEnabled = true; deCancellationDate.IsReadOnly = false; deCancellationDate.IsEnabled = true; grpSEPA.Visibility = Visibility.Visible; } }
private void leFollows_GotFocus(object sender, RoutedEventArgs e) { if (editrow?._Project != null) { var selected = (ProjectClient)ProjectCache.Get(editrow._Project); setTask(selected); } }
void SetDefaults(CreditorOrderCostLineClient rec) { var grp = (Uniconta.DataModel.CreditorOrderCost)CostGroups?.Get(rec._CostGroup); if (grp != null) { rec.SetDefaults(grp); } }
private void OKButton_Click(object sender, RoutedEventArgs e) { if (string.IsNullOrWhiteSpace(Journal)) { UnicontaMessageBox.Show(string.Format(Uniconta.ClientTools.Localization.lookup("MandatoryField"), (Uniconta.ClientTools.Localization.lookup("Journal"))), Uniconta.ClientTools.Localization.lookup("Warning")); return; } GlDailyJournal = (Uniconta.DataModel.GLDailyJournal)JournalCache?.Get(Journal); this.DialogResult = true; }
public override void RowPasted(UnicontaBaseEntity rec) { var orderLine = (DCOrderLineClient)rec; if (orderLine._Item != null) { var selectedItem = (InvItem)items.Get(orderLine._Item); if (selectedItem != null) { PriceLookup?.SetPriceFromItem(orderLine, selectedItem); orderLine.SetItemValues(selectedItem, 0, true); TableField.SetUserFieldsFromRecord(selectedItem, orderLine); } else { orderLine._Item = null; } } }
private void Task_GotFocus(object sender, RoutedEventArgs e) { var selectedItem = dgProjectBudgetLinePageGrid.SelectedItem as ProjectBudgetLineLocal; if (selectedItem?._Project != null) { var selected = (ProjectClient)ProjectCache.Get(selectedItem._Project); setTask(selected, selectedItem); } }
private async void BindGrid() { localMenu.EnableButtons(new string[] { "Aggregate", "GenerateInvoice", "MarkAsInvoice" }); mainList = null; cbxItem.IsEnabled = true; cbxCategory.IsEnabled = true; cbxEmployee.IsEnabled = true; await Filter(); var source = dgProjectTransClientInvoiceGrid.ItemsSource as ICollection <ProjectTransInvoiceClient>; var removeList = new List <ProjectTransInvoiceClient>(); if (source != null) { SQLCache categoryCache = this.CategoryCache; foreach (var pti in source) { pti._SalesAmountAgr = pti._SalesAmount; pti._CostAmountAgr = pti._CostAmount; var category = categoryCache.Get(pti.PrCategory) as PrCategory; if (category == null) { continue; } if (category._CatType == CategoryType.Revenue || category._CatType == CategoryType.Sum || category._CatType == CategoryType.OnAccountInvoicing || category._CatType == CategoryType.Header) { removeList.Add(pti); } else if (string.IsNullOrEmpty(pti.Item)) { pti.Item = category._Item; } } } if (removeList.Count > 0) { foreach (var item in removeList) { source.Remove(item); } } if (source != null && source.Count > 0) { var arr = source.ToArray(); mainList = arr; dgProjectTransClientInvoiceGrid.SetSource(arr); } else { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("zeroRecords"), Uniconta.ClientTools.Localization.lookup("Warning")); } }
async void GetItemFromSerailNumber(ProjectJournalLineLocal rec) { var reportApi = new Uniconta.API.Inventory.ReportAPI(api); busyIndicator.IsBusy = true; var rowId = await reportApi.GetItemFromSerialNumber(rec.SerieBatch); busyIndicator.IsBusy = false; if (rowId == 0) { return; } var item = (InvItem)ItemsCache.Get((int)rowId); if (item != null) { rec.Item = item._Item; rec.NotifyPropertyChanged("Item"); } }
private void SaveButton_Click(object sender, RoutedEventArgs e) { if (folderCache == null) { return; } DocumentFolder folder = null; if (FolderName != null) { folder = folderCache.Get(FolderName) as DocumentFolder; } FolderName = txtFolder.Text; if (_validateFolderName && Utilities.Utility.HasSpecialCharacters(FolderName)) { UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup("Invalid"), Uniconta.ClientTools.Localization.lookup("Error")); return; } ErrorCodes result = ErrorCodes.NoSucces; switch (Action) { case 0: var folderClient = new DocumentFolderClient(); folderClient._Name = FolderName; result = api.Insert(folderClient).GetAwaiter().GetResult(); break; case 1: if (folder != null) { folder._Name = FolderName; result = api.Update(folder).GetAwaiter().GetResult(); } break; case 2: if (folder != null) { result = api.Delete(folder).GetAwaiter().GetResult(); } break; } if (result != ErrorCodes.Succes) { Uniconta.ClientTools.Util.UtilDisplay.ShowErrorCode(result); } this.DialogResult = true; }
private void InvSerieBatch_Changed(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var rec = (InvSerieBatchClient)sender; switch (e.PropertyName) { case "Warehouse": if (warehouseCache != null && rec._Warehouse != null) { var selected = (InvWarehouse)warehouseCache.Get(rec._Warehouse); SetLocation(selected, rec); } break; case "Location": if (string.IsNullOrEmpty(rec._Warehouse)) { rec._Location = null; } break; } }
private void DgInventoryItemsGrid_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var rec = sender as InvItemClient; switch (e.PropertyName) { case "Warehouse": if (warehouse != null) { var selected = (InvWarehouse)warehouse.Get(rec._Warehouse); setLocation(selected, rec); } break; case "Location": if (string.IsNullOrEmpty(rec._Warehouse)) { rec._Location = null; } break; } }
private async void LoadInv() { busyIndicator.IsBusy = true; var list = await api.LoadCache(typeof(Uniconta.DataModel.InvItem)); inventoryItemList = new List <InvItemClient>(); foreach (var rec in (Uniconta.DataModel.InvItem[])list.GetNotNullArray) { if (rec._ItemType >= 2) { var inv = new InvItemClient(); StreamingManager.Copy(rec, inv); inventoryItemList.Add(inv); } } var cache = new SQLCache(inventoryItemList.ToArray(), true); var invBomLst = await api.Query <InvBOMClient>(); InvItemClient master = null; foreach (var invBom in invBomLst) { if (invBom._ItemMaster != master?._Item) { master = (InvItemClient)cache.Get(invBom._ItemMaster); } if (master != null) { List <InvBOMClient> bomLst; if (master.BOMs != null) { bomLst = (List <InvBOMClient>)master.BOMs; } else { master.BOMs = bomLst = new List <InvBOMClient>(); } bomLst.Add(invBom); } } if (inventoryItemList.Count > 0) { dgInvItem.ItemsSource = null; dgInvItem.ItemsSource = inventoryItemList; } dgInvItem.Visibility = Visibility.Visible; busyIndicator.IsBusy = false; }
string testAccount(string ac, int AccLen) { if (ac == null || ac.Length == 0) { return(null); } if (ac.Length <= AccLen) { var rec = GLAccCache.Get(ac); if (rec != null) { return(rec.KeyStr); } if (ac.Length < AccLen) { rec = GLAccCache.Get(ac.PadLeft(AccLen, '0')); if (rec != null) { return(rec.KeyStr); } } } else { var rec = DebtorCache.Get(ac); if (rec != null) { return(rec.KeyStr); } rec = CreditorCache.Get(ac); if (rec != null) { return(rec.KeyStr); } } faultyAccounts.Add(ac); return(ac); }
private void txtAccount_LostFocus(object sender, RoutedEventArgs e) { var s = sender as TextEditor; if (s != null && s.IsLoaded && debtorCache != null) { var debtor = debtorCache.Get(s.Text); if (debtor != null && debtor?.RowId != editrow.RowId) { UnicontaMessageBox.Show(string.Format("{0} {1} ", Uniconta.ClientTools.Localization.lookup("AccountNumber"), string.Format(Uniconta.ClientTools.Localization.lookup("AlreadyExistOBJ"), s.Text)) , Uniconta.ClientTools.Localization.lookup("Information")); } } }
private void OKButton_Click(object sender, RoutedEventArgs e) { Journal = leJournal.Text; Jour = (Uniconta.DataModel.GLDailyJournal)glDlJournalCache.Get(Journal); Date = date.DateTime; AddVoucherNumber = (bool)chkAddVouNo.IsChecked; TransType = leTransType.Text; DebtorAccount = leDebtorAccount.Text; DebtorOffset = leDebtorOffset.Text; CreditorAccount = leCreditorAccount.Text; CreditorOffset = leCreditorOffset.Text; LedgerOffset = leLedgerOffset.Text; this.DialogResult = true; }
private void lePayType_EditValueChanged(object sender, DevExpress.Xpf.Editors.EditValueChangedEventArgs e) { string id = Convert.ToString(e.NewValue); PayType = id; if (PayType != null) { payrollCache = payrollCache ?? crudApi.GetCache(typeof(Uniconta.DataModel.EmpPayrollCategory)); catMileage = (Uniconta.DataModel.EmpPayrollCategory)payrollCache.Get(PayType); internalProject = catMileage?._InternalProject; RegistrationProject = internalProject ?? Project; } }
void selectedItem_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var rec = sender as BankStatementLineGridClient; switch (e.PropertyName) { case "AccountType": SetAccountSource(rec); break; case "Invoice": if (rec._Invoice != null) { GLJournalAccountType type = rec._AmountCent > 0 ? GLJournalAccountType.Debtor : GLJournalAccountType.Creditor; rec.AccountType = AppEnums.GLAccountType.ToString((int)type); GetSearchOpenInvoice(rec, type); } break; case "Account": if (rec._AccountType != (byte)GLJournalAccountType.Finans) { var dc = copyDCAccount(rec, (GLJournalAccountType)rec._AccountType, rec._Account); if (dc != null) { rec.Vat = null; rec.VatOperation = null; } } else { var Acc = (GLAccount)LedgerCache.Get(rec._Account); if (Acc != null) { if (Acc._IsDCAccount || Acc._MandatoryTax == VatOptions.NoVat) { rec.Vat = null; rec.VatOperation = null; } else { rec.Vat = Acc._Vat; rec.VatOperation = Acc._VatOperation; } } } break; } }
private void PART_Editor_GotFocus(object sender, RoutedEventArgs e) { if (warehouse == null) { return; } var selectedItem = dgLinkedGrid.SelectedItem as SerialToOrderLineClient; if (selectedItem?._Warehouse != null) { var selected = (InvWarehouse)warehouse.Get(selectedItem._Warehouse); SetLocation(selected, selectedItem); } }
/// <summary> /// Pre-validate general settings before generating the payment file in the XML format Credit Transfer ISO20022 pain003. /// </summary> /// <param name="xxx">xxx.</param> /// <param name="xxx">xxx.</param> /// <returns>An XML payment file</returns> public XMLDocumentGenerateResult PreValidateISO20022(Company company, SQLCache bankAccountCache, CreditorPaymentFormat credPaymFormat, bool glJournalGenerated = false, bool schemaValidation = true) { XmlDocument dummyDoc = new XmlDocument(); if (bankAccountCache.Count == 0 || credPaymFormat._BankAccount == null) { PreCheckErrors.Add(new PreCheckError(String.Format("There need to be specified a bank in Creditor Payment Format setup for '{0}'.", credPaymFormat._Format))); } else { var bankAccount = (BankStatement)bankAccountCache.Get(credPaymFormat._BankAccount); if (bankAccount == null) { PreCheckErrors.Add(new PreCheckError(String.Format("There need to be specified a bank in Creditor Payment Format setup for '{0}'.", credPaymFormat._Format))); } else { CompanyBank(credPaymFormat); var paymentformat = (ExportFormatType)credPaymFormat._ExportFormat; formatTypeISO = paymentformat == ExportFormatType.ISO20022_DK || paymentformat == ExportFormatType.ISO20022_NL || paymentformat == ExportFormatType.ISO20022_NO || paymentformat == ExportFormatType.ISO20022_DE || paymentformat == ExportFormatType.ISO20022_SE || paymentformat == ExportFormatType.ISO20022_UK || paymentformat == ExportFormatType.ISO20022_LT || paymentformat == ExportFormatType.ISO20022_CH; if (glJournalGenerated && formatTypeISO) { PreCheckErrors.Add(new PreCheckError(string.Format("Payment format '{0}' is not available for GL Journal generated payments", credPaymFormat._ExportFormat))); //TODO:Opret label } CompanyBankName(paymentformat); CustomerIdentificationId(bankAccount._BankCompanyId, paymentformat); BankIdentificationId(bankAccount._ContractId, paymentformat); CompanySWIFT(bankAccount._SWIFT, paymentformat); CompanyIBAN(bankAccount._IBAN, paymentformat); //For ISO20022 only validate BBAN if IBAN/SWIFT are not available if (formatTypeISO && (!IBANok || !SWIFTok) || !formatTypeISO) { CompanyBBANRegNum(bankAccount._BankAccountPart1, paymentformat); CompanyBBAN(bankAccount._BankAccountPart2, paymentformat); } } } return(new XMLDocumentGenerateResult(dummyDoc, PreCheckErrors.Count > 0, 0, PreCheckErrors)); }
private void InvItemStorageClientGrid_PropertyChanged(object sender, System.ComponentModel.PropertyChangedEventArgs e) { var rec = sender as InvItemStorageCount; if (rec == null) { return; } if (rec.CompanyId == 0) { rec.SetMaster(api.CompanyEntity); } switch (e.PropertyName) { case "Item": var selectedItem = (Uniconta.DataModel.InvItem)items?.Get(rec._Item); if (selectedItem != null) { rec.NotifyPropertyChanged("ItemType"); rec.NotifyPropertyChanged("Unit"); rec.NotifyPropertyChanged("ItemGroup"); rec.NotifyPropertyChanged("ItemLocation"); rec.NotifyPropertyChanged("PurchaseAccount"); rec.SetItemValues(selectedItem, api.CompanyEntity._OrderLineStorage); } break; case "Warehouse": var selected = (InvWarehouse)warehouse?.Get(rec._Warehouse); if (selected != null) { setLocation(selected, rec); } break; case "Location": if (string.IsNullOrEmpty(rec._Warehouse)) { rec._Location = null; } break; case "EAN": FindOnEAN(rec, this.items, api); break; } }
internal async void LoadPayments(IEnumerable <DebtorTransDirectDebit> lst) { if (lst == null) { return; } var today = BasePage.GetSystemDefaultDate().Date; var company = api.CompanyEntity; var invoiceLineWhere = string.Empty; PaymentFormatCache = await company.LoadCache(typeof(Uniconta.DataModel.DebtorPaymentFormat), api); foreach (var rec in lst) { var debtor = (Debtor)DebtorCache.Get(rec.Account); DebtorPaymentFormat paymFormatClient = null; if (rec.PaymentFormat == null && debtor._PaymentFormat != null) { rec.PaymentFormat = debtor._PaymentFormat; } if (rec.PaymentFormat != null) { paymFormatClient = (DebtorPaymentFormat)PaymentFormatCache.Get(rec.PaymentFormat); } if (rec.PaymentDate < today && rec._PaymentStatus == PaymentStatusLevel.None) { var paymDate = rec._PaymentDate == DateTime.MinValue ? rec._DueDate : rec._PaymentDate; rec.PaymentDate = today > paymDate ? today : paymDate; if (paymFormatClient != null && paymFormatClient._PaymentAction != NoneBankDayAction.None) { rec.PaymentDate = Common.AdjustToNextBankDay(company._CountryId, rec._PaymentDate, paymFormatClient._PaymentAction == NoneBankDayAction.After ? true : false); } } if (paymFormatClient != null && paymFormatClient._ExportFormat == (byte)DebtorPaymFormatType.NetsBS && (rec._PaymentStatus == PaymentStatusLevel.None || rec._PaymentStatus == PaymentStatusLevel.Resend || rec._PaymentStatus == PaymentStatusLevel.StopPayment)) { rec.TransactionText = await Uniconta.DirectDebitPayment.Common.GetInvoiceText(api, rec, PaymentFormatCache); } } }
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); } } }