Exemplo n.º 1
0
 /// <summary>
 /// Function for Voucher Number Generation
 /// </summary>
 public void VoucherNumberGeneration()
 {
     string strPrefix = string.Empty;
     string strSuffix = string.Empty;
     string tableName = "PurchaseReturnMaster";
     string strReturnNo = string.Empty;
     TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill();
     PurchaseReturnMasterSP SPPurchaseReturnMaster = new PurchaseReturnMasterSP();
     try
     {
         if (strVoucherNo == string.Empty)
         {
             strVoucherNo = "0";
         }
         strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseReturnVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
         if (Convert.ToDecimal(strVoucherNo) != SPPurchaseReturnMaster.PurchaseReturnMasterGetMaxPlusOne(decPurchaseReturnVoucherTypeId))
         {
             strVoucherNo = SPPurchaseReturnMaster.PurchaseReturnMasterGetMax(decPurchaseReturnVoucherTypeId).ToString();
             strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseReturnVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
             if (SPPurchaseReturnMaster.PurchaseReturnMasterGetMax(decPurchaseReturnVoucherTypeId) == "0")
             {
                 strVoucherNo = "0";
                 strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseReturnVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName);
             }
         }
         if (isAutomatic)
         {
             SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP();
             SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
             infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decPurchaseReturnVoucherTypeId, dtpDate.Value);
             strPrefix = infoSuffixPrefix.Prefix;
             strSuffix = infoSuffixPrefix.Suffix;
             decPurchaseReturnSuffixPrefixId = infoSuffixPrefix.SuffixprefixId;
             strReturnNo = strPrefix + strVoucherNo + strSuffix;
             txtReturnNo.Text = strReturnNo;
             txtReturnNo.ReadOnly = true;
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("PR:27" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }