public void VoucherNoGeneration(DateTime salaryMonth) { TransactionsGeneralFill obj = new TransactionsGeneralFill(); AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment); if (Convert.ToDecimal(strVoucherNo) != spAdvancePayment.AdvancePaymentGetMaxPlusOne(decPaymentVoucherTypeId)) { strVoucherNo = spAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment); if (spAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment); } } if (isAutomatic) { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffixPrefix.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate); string strPrefix = infoSuffixPrefix.Prefix; string strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; } }
public string AdvancePaymentGetMax(decimal decVoucherTypeId) { string Max = "0"; try { Max = spAdvancePayment.AdvancePaymentGetMax(decVoucherTypeId); } catch (Exception ex) { MessageBox.Show("AP8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(Max); }