private TSubmitChangesResult StoreManualCode(ref GiftBatchTDS ASubmitChanges, out TVerificationResultCollection AVerificationResult) { TSubmitChangesResult Result; AVerificationResult = null; if (ASubmitChanges.AMotivationDetailFee != null) { // delete any invalid motivation detail fees (i.e. because the motivation detail's name has changed) foreach (DataRowView rv in ASubmitChanges.AMotivationDetailFee.DefaultView) { AMotivationDetailFeeRow Row = (AMotivationDetailFeeRow)rv.Row; if ((Row.RowState == DataRowState.Added) && !FMainDS.AMotivationDetail.Rows.Contains(new object[] { Row.LedgerNumber, Row.MotivationGroupCode, Row.MotivationDetailCode })) { Row.Delete(); } } } Result = TRemote.MFinance.Gift.WebConnectors.SaveMotivationDetails(ref ASubmitChanges); if (Result == TSubmitChangesResult.scrOK) { // needed to reorder the two checked listboxes SelectRowInGrid(FPrevRowChangedRow); // refresh cachaeble table TDataCache.TMFinance.RefreshCacheableFinanceTable(TCacheableFinanceTablesEnum.MotivationList, FLedgerNumber); } return(Result); }
private void ShowDetailsManual(AMotivationDetailRow ARow) { string FeesPayable = string.Empty; string FeesReceivable = string.Empty; if (ARow != null) { FMainDS.AMotivationDetailFee.DefaultView.RowFilter = String.Format("{0}={1} and {2}='{3}' and {4}='{5}'", AMotivationDetailFeeTable.GetLedgerNumberDBName(), ARow.LedgerNumber, AMotivationDetailFeeTable.GetMotivationGroupCodeDBName(), ARow.MotivationGroupCode, AMotivationDetailFeeTable.GetMotivationDetailCodeDBName(), ARow.MotivationDetailCode); foreach (DataRowView rv in FMainDS.AMotivationDetailFee.DefaultView) { AMotivationDetailFeeRow detailFeeRow = (AMotivationDetailFeeRow)rv.Row; if (StringHelper.StrSplit(clbDetailFeesPayable.GetAllStringList(), ",").Contains(detailFeeRow.FeeCode)) { FeesPayable = StringHelper.AddCSV(FeesPayable, detailFeeRow.FeeCode); } else { FeesReceivable = StringHelper.AddCSV(FeesReceivable, detailFeeRow.FeeCode); } } } // set the ORDER column to true if row is checked clbDetailFeesPayable.CheckedColumn = "ORDER"; clbDetailFeesReceivable.CheckedColumn = "ORDER"; clbDetailFeesPayable.SetCheckedStringList(FeesPayable); clbDetailFeesReceivable.SetCheckedStringList(FeesReceivable); // set the CHECKED column to true if row is checked clbDetailFeesPayable.CheckedColumn = "CHECKED"; clbDetailFeesReceivable.CheckedColumn = "CHECKED"; clbDetailFeesPayable.SetCheckedStringList(FeesPayable); clbDetailFeesReceivable.SetCheckedStringList(FeesReceivable); if (FTaxDeductiblePercentageEnabled) { if (ARow.IsTaxDeductibleAccountNull()) { cmbDeductibleAccountCode.SelectedIndex = 0; } else { cmbDeductibleAccountCode.SetSelectedString(ARow.TaxDeductibleAccount); } } }
private void GetDetailDataFromControlsManual(AMotivationDetailRow ARow) { StringCollection TickedFees = StringHelper.StrSplit( StringHelper.ConcatCSV(clbDetailFeesPayable.GetCheckedStringList(), clbDetailFeesReceivable.GetCheckedStringList()), ","); FMainDS.AMotivationDetailFee.DefaultView.RowFilter = String.Format("{0}={1} and {2}='{3}' and {4}='{5}'", AMotivationDetailFeeTable.GetLedgerNumberDBName(), ARow.LedgerNumber, AMotivationDetailFeeTable.GetMotivationGroupCodeDBName(), ARow.MotivationGroupCode, AMotivationDetailFeeTable.GetMotivationDetailCodeDBName(), ARow.MotivationDetailCode); StringCollection ExistingFees = new StringCollection(); foreach (DataRowView rv in FMainDS.AMotivationDetailFee.DefaultView) { AMotivationDetailFeeRow detailFeeRow = (AMotivationDetailFeeRow)rv.Row; if (!TickedFees.Contains(detailFeeRow.FeeCode)) { // delete existing fees that have been unticked detailFeeRow.Delete(); } else { ExistingFees.Add(detailFeeRow.FeeCode); } } // add new fees foreach (string fee in TickedFees) { if (!ExistingFees.Contains(fee)) { AMotivationDetailFeeRow NewRow = FMainDS.AMotivationDetailFee.NewRowTyped(); NewRow.LedgerNumber = ARow.LedgerNumber; NewRow.MotivationGroupCode = ARow.MotivationGroupCode; NewRow.MotivationDetailCode = ARow.MotivationDetailCode; NewRow.FeeCode = fee; FMainDS.AMotivationDetailFee.Rows.Add(NewRow); } } if (FTaxDeductiblePercentageEnabled) { ARow.TaxDeductibleAccount = cmbDeductibleAccountCode.GetSelectedString(); } }
/// <summary> /// Print out the Motivation Details using FastReports template. /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void FilePrint(object sender, EventArgs e) { FastReportsWrapper ReportingEngine = new FastReportsWrapper("Motivation Details"); if (!ReportingEngine.LoadedOK) { ReportingEngine.ShowErrorPopup(); return; } // Add in the Fees applicable for each row: if (!FMainDS.AMotivationDetail.Columns.Contains("Fees")) { FMainDS.AMotivationDetail.Columns.Add("Fees", typeof(String)); FMainDS.AMotivationDetail.Columns.Add("KeyMin", typeof(String)); } foreach (AMotivationDetailRow Row in FMainDS.AMotivationDetail.Rows) { FMainDS.AMotivationDetailFee.DefaultView.RowFilter = String.Format( "a_motivation_group_code_c='{0}' AND a_motivation_detail_code_c='{1}'", Row.MotivationGroupCode, Row.MotivationDetailCode); String Fees = ""; foreach (DataRowView rv in FMainDS.AMotivationDetailFee.DefaultView) { AMotivationDetailFeeRow FeeRow = (AMotivationDetailFeeRow)rv.Row; if (Fees != "") { Fees += ", "; } Fees += FeeRow.FeeCode; } Row["Fees"] = Fees; if (Row.RecipientKey != 0) { String mPartnerShortName; TPartnerClass mPartnerClass; if (TServerLookup.TMPartner.GetPartnerShortName(Row.RecipientKey, out mPartnerShortName, out mPartnerClass, true)) { Row["KeyMin"] = mPartnerShortName; } } } // foreach // // Ensure the proper sorting for the printout: FMainDS.AMotivationDetail.DefaultView.Sort = "a_motivation_group_code_c, a_motivation_detail_code_c"; ReportingEngine.RegisterData(FMainDS.AMotivationDetail.DefaultView.ToTable(), "MotivationDetail"); TRptCalculator Calc = new TRptCalculator(); ALedgerRow LedgerRow = FMainDS.ALedger[0]; Calc.AddParameter("param_ledger_number_i", LedgerRow.LedgerNumber); Calc.AddStringParameter("param_ledger_name", LedgerRow.LedgerName); Calc.AddParameter("param_TD", FTaxDeductiblePercentageEnabled); if (ModifierKeys.HasFlag(Keys.Control)) { ReportingEngine.DesignReport(Calc); } else { ReportingEngine.GenerateReport(Calc); } }