/// <summary> /// show ledger and batch number /// </summary> private void ShowDataManual() { try { FPetraUtilsObject.SuppressChangeDetection = true; if (FLedgerNumber != -1) { txtLedgerNumber.Text = TFinanceControls.GetLedgerNumberAndName(FLedgerNumber); txtBatchNumber.Text = FBatchNumber.ToString(); } if (FPreviouslySelectedDetailRow != null) { txtDebit.NumberValueDecimal = FPreviouslySelectedDetailRow.JournalDebitTotal; txtCredit.NumberValueDecimal = FPreviouslySelectedDetailRow.JournalCreditTotal; txtControl.NumberValueDecimal = FPreviouslySelectedDetailRow.JournalDebitTotal - FPreviouslySelectedDetailRow.JournalCreditTotal; } } finally { FPetraUtilsObject.SuppressChangeDetection = false; } }
/// <summary> /// /// </summary> /// <param name="ALedgerNumber"></param> public void InitialiseLedger(int ALedgerNumber) { FLedgerNumber = ALedgerNumber; FLedgerRow = ((ALedgerTable)TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerDetails, FLedgerNumber))[0]; txtLedger.Text = TFinanceControls.GetLedgerNumberAndName(FLedgerNumber); TFinanceControls.InitialiseAvailableEndOfYearsList(ref cmbPeriodYear, FLedgerNumber); cmbPeriodYear.SelectedIndex = 0; TFinanceControls.InitialiseAvailableEndOfYearsList(ref cmbQuarterYear, FLedgerNumber); cmbQuarterYear.SelectedIndex = 0; TFinanceControls.InitialiseAvailableEndOfYearsList(ref cmbBreakdownYear, FLedgerNumber); cmbBreakdownYear.SelectedIndex = 0; TFinanceControls.InitialiseAccountHierarchyList(ref cmbAccountHierarchy, FLedgerNumber); cmbAccountHierarchy.SelectedIndex = 0; // if there is only one hierarchy, disable the control // cmbAccountHierarchy.Enabled = (cmbAccountHierarchy.Count > 1); /* select the latest year TODO ??? */ // if (this.CbB_AvailableYears.Items.Count > 0) // { // this.CbB_AvailableYears.SelectedIndex = 0; /// first item is the most current year // } }
/// delete ledger public static void DeleteLedger(Form AMainWindow, Int32 ALedgerNumber) { string LedgerNameAndNumber = TFinanceControls.GetLedgerNumberAndName(ALedgerNumber); if (MessageBox.Show(Catalog.GetString("Please save a backup of your database first!!!") + Environment.NewLine + string.Format(Catalog.GetString("Do you REALLY want to delete ledger '{0}'?"), LedgerNameAndNumber), Catalog.GetString("Delete Ledger"), MessageBoxButtons.YesNoCancel, MessageBoxIcon.Warning, MessageBoxDefaultButton.Button3 ) == DialogResult.Yes) { // ledger cannot be deleted if there are any transactions existing for it if (TRemote.MFinance.Setup.WebConnectors.ContainsTransactions(ALedgerNumber)) { MessageBox.Show( string.Format(Catalog.GetString("There are still transactions associated with Ledger '{0}'. \r\n\r\nNothing has been done."), LedgerNameAndNumber), Catalog.GetString("Deletion not possible"), MessageBoxButtons.OK, MessageBoxIcon.Error); } else { Thread t = new Thread(() => ProcessDeletion(AMainWindow, ALedgerNumber, LedgerNameAndNumber)); using (TProgressDialog dialog = new TProgressDialog(t)) { dialog.AllowCancellation = false; dialog.ShowDialog(); } // reload list of Ledger names TDataCache.TMFinance.RefreshCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerNameList); // reload navigation // Setting the "CurrentLedger" to -1 isn't strictly needed, but it eradicates the Ledger // we have presently deleted to make sure the Main Menu isn't working any further with a // Ledger that doesn't exist anymore. PropertyInfo CurrentLedgerProperty = AMainWindow.GetType().GetProperty("CurrentLedger"); CurrentLedgerProperty.SetValue(AMainWindow, -1, null); MethodInfo method = AMainWindow.GetType().GetMethod("LoadNavigationUI"); if (method != null) { method.Invoke(AMainWindow, new object[] { false }); method = AMainWindow.GetType().GetMethod("SelectFinanceFolder"); method.Invoke(AMainWindow, new object[] { }); } } } }
private void ShowDataManual() { txtLedgerNumber.Text = TFinanceControls.GetLedgerNumberAndName(FLedgerNumber); txtBatchNumber.Text = FBatchNumber.ToString(); txtJournalNumber.Text = FJournalNumber.ToString(); txtTransactionNumber.Text = FTransactionNumber.ToString(); cmbDetailAnalysisAttributeValue.Items.Clear(); // These details controls may be set by txtReadonlyAnalysisTypeCode.Text = ""; // ShowDetailsManual, below - or they may not... txtReadonlyDescription.Text = ""; cmbDetailAnalysisAttributeValue.SetSelectedString(""); CheckFCacheInitialised(); }
/// <summary> /// Load the supplier and all the transactions (invoices and payments) that relate to it. /// </summary> /// <param name="ALedgerNumber"></param> /// <param name="APartnerKey"></param> public void LoadSupplier(Int32 ALedgerNumber, Int64 APartnerKey) { this.Cursor = Cursors.WaitCursor; FLedgerNumber = ALedgerNumber; FPartnerKey = APartnerKey; FMainDS = TRemote.MFinance.AP.WebConnectors.LoadAApSupplier(ALedgerNumber, APartnerKey); FSupplierRow = FMainDS.AApSupplier[0]; txtFilteredBalance.CurrencyCode = FSupplierRow.CurrencyCode; txtSupplierBalance.CurrencyCode = FSupplierRow.CurrencyCode; txtTaggedBalance.CurrencyCode = FSupplierRow.CurrencyCode; lblExcludedItems.Text = string.Format(lblExcludedItems.Text, FSupplierRow.CurrencyCode); // Get our AP ledger settings and enable/disable the corresponding search option on the filter panel TFrmLedgerSettingsDialog settings = new TFrmLedgerSettingsDialog(this, ALedgerNumber); FRequireApprovalBeforePosting = settings.APRequiresApprovalBeforePosting; Control rbtForApproval = FFilterAndFindObject.FilterPanelControls.FindControlByName("rbtForApproval"); rbtForApproval.Enabled = FRequireApprovalBeforePosting; // // Transactions older than DateTime AgedOlderThan = DateTime.Now; if (!FSupplierRow.IsPreferredScreenDisplayNull()) { AgedOlderThan = AgedOlderThan.AddMonths(0 - FSupplierRow.PreferredScreenDisplay); } FAgedOlderThan = AgedOlderThan.ToString("u"); txtSupplierName.Text = FMainDS.PPartner[0].PartnerShortName; txtSupplierCurrency.Text = FSupplierRow.CurrencyCode; FFindObject = TRemote.MFinance.AP.UIConnectors.Find(); FFindObject.FindSupplierTransactions(FLedgerNumber, FPartnerKey); // Start thread that checks for the end of the search operation on the PetraServer FKeepUpSearchFinishedCheck = true; Thread FinishedCheckThread = new Thread(new ThreadStart(SearchFinishedCheckThread)); FinishedCheckThread.Start(); this.Text = Catalog.GetString("Supplier Transactions") + " - " + TFinanceControls.GetLedgerNumberAndName(FLedgerNumber); }
private void ShowDataManual() { AccountsPayableTDSAApDocumentRow DocumentRow = FMainDS.AApDocument[0]; FDocumentLedgerNumber = DocumentRow.LedgerNumber; // This will involve a trip to the server to access GLSetupTDS TFrmLedgerSettingsDialog settings = new TFrmLedgerSettingsDialog(this, FDocumentLedgerNumber); FRequireApprovalBeforePosting = settings.APRequiresApprovalBeforePosting; txtTotalAmount.CurrencyCode = DocumentRow.CurrencyCode; txtDetailAmount.CurrencyCode = DocumentRow.CurrencyCode; dtpDateDue.Date = DocumentRow.DateIssued.AddDays(Convert.ToDouble(nudCreditTerms.Value)); this.Text += " - " + TFinanceControls.GetLedgerNumberAndName(FDocumentLedgerNumber); FLedgerRow = ((ALedgerTable)TDataCache.TMFinance.GetCacheableFinanceTable(TCacheableFinanceTablesEnum.LedgerDetails, FDocumentLedgerNumber))[0]; txtDetailBaseAmount.CurrencyCode = FLedgerRow.BaseCurrency; //txtExchangeRateToBase.SetControlProperties(10); // // If this document's currency is that of my own ledger, // I need to disable the rate of exchange field. if (DocumentRow.CurrencyCode == FLedgerRow.BaseCurrency) { txtExchangeRateToBase.Enabled = false; btnLookupExchangeRate.Enabled = false; } if ((FMainDS.AApDocumentDetail == null) || (FMainDS.AApDocumentDetail.Rows.Count == 0)) // When the document is new, I need to create the first detail line. { NewDetail(null, null); } FMainDS.AApDocumentDetail.DefaultView.Sort = AApDocumentDetailTable.GetDetailNumberDBName(); // Create Text description of Anal Attribs for each DetailRow.. foreach (AccountsPayableTDSAApDocumentDetailRow DetailRow in FMainDS.AApDocumentDetail.Rows) { UpdateAttributeLabel(DetailRow); } EnableControls(); }
/// <summary> /// show ledger and batch number /// </summary> private void ShowDataManual() { if (FLedgerNumber != -1) { txtLedgerNumber.Text = TFinanceControls.GetLedgerNumberAndName(FLedgerNumber); txtBatchNumber.Text = FBatchNumber.ToString(); } if (FPreviouslySelectedDetailRow != null) { txtDebit.NumberValueDecimal = FPreviouslySelectedDetailRow.JournalDebitTotal; txtCredit.NumberValueDecimal = FPreviouslySelectedDetailRow.JournalCreditTotal; txtControl.NumberValueDecimal = FPreviouslySelectedDetailRow.JournalDebitTotal - FPreviouslySelectedDetailRow.JournalCreditTotal; } }
/// <summary> /// The screen has been shown /// </summary> private void RunOnceOnActivationManual() { FActiveTab = tpgLedger; // See if we were launched with an initial tab set?? if (FInitialTab == "AP") { tabAllSettings.SelectedTab = tpgAccountsPayable; FActiveTab = tpgAccountsPayable; } ALedgerRow ledgerRow = (ALedgerRow)FMainDS.ALedger.Rows[0]; this.Text = this.Text + String.Format(" - {0}", TFinanceControls.GetLedgerNumberAndName(ledgerRow.LedgerNumber)); FPetraUtilsObject.DataSaved += new TDataSavedHandler(FPetraUtilsObject_DataSaved); }