private void ValidateDataDetailsManual(AFeesPayableRow ARow) { TVerificationResultCollection VerificationResultCollection = FPetraUtilsObject.VerificationResultCollection; TSharedFinanceValidation_GLSetup.ValidateAdminGrantPayable(this, ARow, ref VerificationResultCollection, FPetraUtilsObject.ValidationControlsDict); // Need to check the Fee Code has not been used in FeesReceivable ValidateFeeCode(ARow.FeeCode, VerificationResultCollection); }
private void ShowDetailsManual(AFeesPayableRow ARow) { if (ARow == null) { return; } bool isNotIctOrGif = (ARow.FeeCode != "GIF" && ARow.FeeCode != "ICT"); txtDetailFeeDescription.Enabled = isNotIctOrGif; cmbDetailChargeOption.Enabled = isNotIctOrGif; txtDetailChargePercentage.ReadOnly = !isNotIctOrGif; cmbDetailCostCentreCode.Enabled = isNotIctOrGif; }
// // Called before row deletion. I return true unless this row should not be deleted. private Boolean PreDeleteManual(AFeesPayableRow ARow, ref String ADeletionQuestion) { if ((ARow.FeeCode == "ICT") || (ARow.FeeCode == "GIF")) { MessageBox.Show( Catalog.GetString("Fees ICT and GIF are protected and cannot be deleted."), Catalog.GetString("Delete Fees"), MessageBoxButtons.OK, MessageBoxIcon.Error); return(false); } return(true); }
/// <summary> /// /// </summary> /// <param name="AContext"></param> /// <param name="ARow"></param> /// <param name="AVerificationResultCollection"></param> /// <param name="AValidationControlsDict"></param> public static void ValidateAdminGrantPayable(object AContext, AFeesPayableRow ARow, ref TVerificationResultCollection AVerificationResultCollection, TValidationControlsDict AValidationControlsDict) { // ChargeOption = { "Minimum", "Maximum", "Fixed", "Percentage" } // Don't validate deleted DataRows if (ARow.RowState == DataRowState.Deleted) { return; } if (ARow.ChargeOption == "Percentage") { DataColumn ValidationColumn = ARow.Table.Columns[AFeesPayableTable.ColumnChargePercentageId]; TValidationControlsData ValidationControlsData; if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { decimal enteredValue = (ARow.IsChargePercentageNull() ? -1 : ARow.ChargePercentage); // If the user has cleared the value in the control, I'll treat it as -1. TVerificationResult VerificationResult = TNumericalChecks.IsPositiveDecimal(enteredValue, ValidationControlsData.ValidationControlLabel, AContext, ValidationColumn, ValidationControlsData.ValidationControl); // Handle addition to/removal from TVerificationResultCollection AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn); } } else // the ChargeOption relates to an amount { DataColumn ValidationColumn = ARow.Table.Columns[AFeesPayableTable.ColumnChargeAmountId]; TValidationControlsData ValidationControlsData; if (AValidationControlsDict.TryGetValue(ValidationColumn, out ValidationControlsData)) { decimal enteredValue = (ARow.IsChargeAmountNull() ? -1 : ARow.ChargeAmount); // If the user has cleared the value in the control, I'll treat it as -1. TVerificationResult VerificationResult = TNumericalChecks.IsPositiveDecimal(enteredValue, ValidationControlsData.ValidationControlLabel, AContext, ValidationColumn, ValidationControlsData.ValidationControl); // Handle addition to/removal from TVerificationResultCollection AVerificationResultCollection.Auto_Add_Or_AddOrRemove(AContext, VerificationResult, ValidationColumn); } } }
private void NewRowManual(ref AFeesPayableRow ARow) { ARow.LedgerNumber = FLedgerNumber; string newName = Ict.Common.Catalog.GetString("NEWCODE"); Int32 countNewDetail = 0; if (FMainDS.AFeesPayable.Rows.Find(new object[] { FLedgerNumber, newName }) != null) { while (FMainDS.AFeesPayable.Rows.Find(new object[] { FLedgerNumber, newName + countNewDetail.ToString() }) != null) { countNewDetail++; } newName += countNewDetail.ToString(); } ARow.FeeCode = newName; ARow.AccountCode = MFinanceConstants.ADMIN_FEE_INCOME_ACCT.ToString(); ARow.DrAccountCode = MFinanceConstants.ADMIN_FEE_EXPENSE_ACCT.ToString(); }
partial void ValidateFeesReceivableListManual(ref TVerificationResultCollection AVerificationResult, TTypedDataTable ASubmitTable) { Type DataTableType; AFeesPayableTable otherTable = (AFeesPayableTable)TCacheableTablesManager.GCacheableTablesManager.GetCachedDataTable("FeesPayableList", out DataTableType); otherTable.DefaultView.Sort = String.Format("{0}, {1} ASC", AFeesPayableTable.GetLedgerNumberDBName(), AFeesPayableTable.GetFeeCodeDBName()); for (int i = 0; i < ASubmitTable.Rows.Count; i++) { DataRow row = ASubmitTable.Rows[i]; if ((row.RowState == DataRowState.Added) || (row.RowState == DataRowState.Modified)) { string feeCode = row[AFeesReceivableTable.ColumnFeeCodeId].ToString(); int ledgerNumber = Convert.ToInt32(row[AFeesReceivableTable.ColumnLedgerNumberId]); int otherRowNum = otherTable.DefaultView.Find(new object[] { ledgerNumber, feeCode }); if (otherRowNum >= 0) { AFeesPayableRow otherRow = (AFeesPayableRow)(otherTable.DefaultView[otherRowNum].Row); string otherUser = otherRow.CreatedBy; if (!String.IsNullOrEmpty(otherRow.ModifiedBy)) { otherUser = otherRow.ModifiedBy; } // The message text doesn't get back to the user - but maybe one day it will throw new EDBConcurrencyException(String.Format(Catalog.GetString( "While you were editing this screen another user created a fee code '{0}' for the Grants Payable screen. You will have to close and re-open the Grants Receivable screen and make your changes again."), feeCode), "write", otherTable.TableName, otherUser, otherRow.ModificationId); } } } }
/// <summary> /// /// </summary> /// <param name="AParameters"></param> public void SetControls(TParameterList AParameters) { // // If LedgerNumber hasn't been set yet, do nothing: if (FLedgerNumber < 0) { return; } AFeesReceivableTable FeesReceivable = new AFeesReceivableTable(); Type DataTableType; DataTable CacheDT = TDataCache.GetSpecificallyFilteredCacheableDataTableFromCache("FeesReceivableList", "Ledger", FLedgerNumber, out DataTableType); FeesReceivable.Merge(CacheDT); Array.Resize(ref FUnselectedFees, FeesReceivable.Rows.Count); for (Int32 Idx = 0; Idx < FeesReceivable.Rows.Count; Idx++) { AFeesReceivableRow Row = FeesReceivable[Idx]; FUnselectedFees[Idx] = Row.FeeCode; } AFeesPayableTable FeesPayable = new AFeesPayableTable(); CacheDT = TDataCache.GetSpecificallyFilteredCacheableDataTableFromCache("FeesPayableList", "Ledger", FLedgerNumber, out DataTableType); FeesPayable.Merge(CacheDT); Array.Resize(ref FUnselectedFees, FUnselectedFees.Length + FeesPayable.Rows.Count); for (Int32 Idx = 0; Idx < FeesPayable.Rows.Count; Idx++) { AFeesPayableRow Row = FeesPayable[Idx]; FUnselectedFees[FeesReceivable.Rows.Count + Idx] = Row.FeeCode; } String FeeStr = AParameters.Get("param_fee_codes").ToString(); // // If there's no fees selected, it's perhaps because the installation is new. // Add all the fees from the "Don't Print" box, up to the maximum number allowed. if (FeeStr == "") { Array.Resize(ref FSelectedFees, lstDontPrint.Items.Count); lstDontPrint.Items.CopyTo(FSelectedFees, 0); if (lstDontPrint.Items.Count > MAX_FEE_COUNT) { Array.Resize(ref FSelectedFees, MAX_FEE_COUNT); } } else { FSelectedFees = FeeStr.Split(','); } // Now I want to remove the selected items from the FSelectedFees list: for (Int32 Idx = 0; Idx < FSelectedFees.Length; Idx++) { Int32 pos = ((IList)FUnselectedFees).IndexOf(FSelectedFees[Idx]); if (pos >= 0) { Int32 NewLength = FUnselectedFees.Length - 1; for (Int32 i = pos; i < NewLength; i++) { FUnselectedFees[i] = FUnselectedFees[i + 1]; } Array.Resize(ref FUnselectedFees, NewLength); } } RefreshLists(); }