Exemplo n.º 1
0
 /// <summary>
 /// Function to use the voucherno Automatic generation
 /// </summary>
 public void VoucherNumberGeneration()
 {
     string strTableName = "SalesOrderMaster";
     string strPrefix = string.Empty;
     string strSuffix = string.Empty;
     string strInvoiceNo = string.Empty;
     try
     {
         SalesOrderMasterSP spSalesOrderMaster = new SalesOrderMasterSP();
         TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill();
         if (isAutomatic)
         {
             strVoucherNo = "0";
             if (strVoucherNo == string.Empty)
             {
                 strVoucherNo = "0"; //strMax;
             }
             strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decSalesOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName);
             if (Convert.ToDecimal(strVoucherNo) != spSalesOrderMaster.SalesOrderVoucherMasterMaxPlusOne(decSalesOrderTypeId))
             {
                 strVoucherNo = spSalesOrderMaster.SalesOrderVoucherMasterMax(decSalesOrderTypeId).ToString();
                 strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decSalesOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName);
                 if (spSalesOrderMaster.SalesOrderVoucherMasterMax(decSalesOrderTypeId).ToString() == "0")
                 {
                     strVoucherNo = "0";
                     strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decSalesOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName);
                 }
             }
             if (isAutomatic)
             {
                 SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP();
                 SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
                 infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decSalesOrderTypeId, dtpDate.Value);
                 strPrefix = infoSuffixPrefix.Prefix;
                 strSuffix = infoSuffixPrefix.Suffix;
                 strInvoiceNo = strPrefix + strVoucherNo + strSuffix;
                 txtOrderNo.Text = strInvoiceNo;
                 txtOrderNo.ReadOnly = true;
             }
             else
             {
                 txtOrderNo.ReadOnly = false;
                 txtOrderNo.Text = string.Empty;
                 strInvoiceNo = txtOrderNo.Text.Trim();
             }
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SO40:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }