public static Boolean CreateRemittanceAdviceAndChequeFormData(TFormLetterFinanceInfo AFormLetterFinanceInfo, ref AccountsPayableTDSAApPaymentTable APaymentTable, Int32 ALedgerNumber, bool AIncludeChequeFormData, out List <TFormData> AFormDataList) { AFormDataList = new List <TFormData>(); TProgressTracker.InitProgressTracker(DomainManager.GClientID.ToString(), Catalog.GetString("Creating Remittance Advice")); TProgressTracker.SetCurrentState(DomainManager.GClientID.ToString(), Catalog.GetString("Starting ..."), 10.0m); // Print in payment number order APaymentTable.DefaultView.Sort = string.Format("{0} ASC", AccountsPayableTDSAApPaymentTable.GetPaymentNumberDBName()); for (int i = 0; i < APaymentTable.DefaultView.Count; i++) { AccountsPayableTDSAApPaymentRow row = (AccountsPayableTDSAApPaymentRow)APaymentTable.DefaultView[i].Row; int paymentNumber = row.PaymentNumber; decimal progress = i / APaymentTable.DefaultView.Count * 100.0m; TProgressTracker.SetCurrentState(DomainManager.GClientID.ToString(), Catalog.GetString(string.Format("Printing payment {0} ...", paymentNumber)), progress); CreateFormDataInternal(ALedgerNumber, paymentNumber, AFormLetterFinanceInfo, AFormDataList, AIncludeChequeFormData, row.ChequeNumber, row.ChequeAmountInWords); } TProgressTracker.FinishJob(DomainManager.GClientID.ToString()); return(true); }
private void FocusedRowChanged(System.Object sender, SourceGrid.RowEventArgs e) { DataRowView[] SelectedGridRow = grdPayments.SelectedDataRowsAsDataRowView; if (SelectedGridRow.Length >= 1) { FSelectedPaymentRow = (AccountsPayableTDSAApPaymentRow)SelectedGridRow[0].Row; if (!FSelectedPaymentRow.IsSupplierKeyNull()) { AApSupplierRow supplier = TFrmAPMain.GetSupplier(FMainDS.AApSupplier, FSelectedPaymentRow.SupplierKey); txtCurrency.Text = supplier.CurrencyCode; if (FCurrencyTable != null) { ACurrencyRow row = (ACurrencyRow)FCurrencyTable.Rows.Find(supplier.CurrencyCode); txtTotalAmount.CurrencyCode = row.CurrencyCode; txtAmountToPay.CurrencyCode = row.CurrencyCode; } /* * decimal CurrentRate = TExchangeRateCache.GetDailyExchangeRate(supplier.CurrencyCode, * FLedgerRow.BaseCurrency, * DateTime.Today, * false); */ txtExchangeRate.NumberValueDecimal = FSelectedPaymentRow.ExchangeRateToBase; cmbPaymentType.SetSelectedString(supplier.PaymentType); if (txtCurrency.Text == FLedgerRow.BaseCurrency) { txtExchangeRate.Enabled = false; btnLookupExchangeRate.Enabled = false; } else { txtExchangeRate.Enabled = true; btnLookupExchangeRate.Enabled = true; } } cmbBankAccount.SetSelectedString(FSelectedPaymentRow.BankAccount, -1); FMainDS.AApDocumentPayment.DefaultView.RowFilter = AccountsPayableTDSAApDocumentPaymentTable.GetPaymentNumberDBName() + " = " + FSelectedPaymentRow.PaymentNumber.ToString(); grdDocuments.DataSource = new DevAge.ComponentModel.BoundDataView(FMainDS.AApDocumentPayment.DefaultView); grdDocuments.Refresh(); grdDocuments.Selection.SelectRow(1, true); FocusedRowChangedDetails(null, null); } }
/// <summary> /// If asked to remove a payment, /// I need to modify the ApPayment to reflect the removed ApDocumentPayment row. /// If there's nothing left to pay, I should remove the ApPayment row. /// </summary> private void RemoveSelectedDocument(Object sender, EventArgs e) { if (FSelectedDocumentRow != null) { FSelectedPaymentRow.Amount -= FSelectedDocumentRow.Amount; FMainDS.AApDocumentPayment.Rows.Remove(FSelectedDocumentRow); FSelectedDocumentRow = null; FocusedRowChangedDetails(null, null); if (FSelectedPaymentRow.Amount <= 0) { FMainDS.AApPayment.Rows.Remove(FSelectedPaymentRow); FSelectedPaymentRow = null; FocusedRowChanged(null, null); } } }
private void FocusedRowChanged(System.Object sender, SourceGrid.RowEventArgs e) { DataRowView[] SelectedGridRow = grdPayments.SelectedDataRowsAsDataRowView; if (SelectedGridRow.Length >= 1) { FSelectedPaymentRow = (AccountsPayableTDSAApPaymentRow)SelectedGridRow[0].Row; if (!FSelectedPaymentRow.IsSupplierKeyNull()) { AApSupplierRow supplier = TFrmAPMain.GetSupplier(FMainDS.AApSupplier, FSelectedPaymentRow.SupplierKey); txtCurrency.Text = supplier.CurrencyCode; decimal CurrentRate = TExchangeRateCache.GetDailyExchangeRate(supplier.CurrencyCode, FLedgerRow.BaseCurrency, DateTime.Now); txtExchangeRate.NumberValueDecimal = CurrentRate; cmbPaymentType.SetSelectedString(supplier.PaymentType); if (txtCurrency.Text == FLedgerRow.BaseCurrency) { txtExchangeRate.Enabled = false; btnLookupExchangeRate.Enabled = false; } else { txtExchangeRate.Enabled = true; btnLookupExchangeRate.Enabled = true; } } cmbBankAccount.SetSelectedString(FSelectedPaymentRow.BankAccount); FMainDS.AApDocumentPayment.DefaultView.RowFilter = AccountsPayableTDSAApDocumentPaymentTable.GetPaymentNumberDBName() + " = " + FSelectedPaymentRow.PaymentNumber.ToString(); grdDocuments.DataSource = new DevAge.ComponentModel.BoundDataView(FMainDS.AApDocumentPayment.DefaultView); grdDocuments.Refresh(); grdDocuments.Selection.SelectRow(1, true); FocusedRowChangedDetails(null, null); } }