/// <summary> /// Function for voucher number generation /// </summary> public void VoucherNumberGeneration() { try { PurchaseMasterSP spPurchaseMaster = new PurchaseMasterSP(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strTableName); if (Convert.ToDecimal(strVoucherNo) != (spPurchaseMaster.PurchaseMasterVoucherMax(decPurchaseInvoiceVoucherTypeId))) { strVoucherNo = spPurchaseMaster.PurchaseMasterVoucherMax(decPurchaseInvoiceVoucherTypeId).ToString(); strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strTableName); if (spPurchaseMaster.PurchaseMasterVoucherMax(decPurchaseInvoiceVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strTableName); } } if (isAutomatic) { SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decPurchaseInvoiceVoucherTypeId, dtpVoucherDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decPurchaseInvoiceSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; txtVoucherNo.Text = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.ReadOnly = true; } } catch (Exception ex) { MessageBox.Show("PI8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }