Пример #1
0
 /// <summary>
 /// Function to reset the form to create new sales quatation
 /// </summary>
 public void Clear()
 {
     TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill();
     SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP();
     try
     {
         if (isAutomatic)
         {
             strSalesQuotationNo = SpSalesQuotationMaster.SalesQuotationMasterGetMax(decsalesQuotationTypeId).ToString();
             if (strSalesQuotationNo == string.Empty)
             {
                 strSalesQuotationNo = " 0";
             }
             strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName);
             if (Convert.ToDecimal(strSalesQuotationNo) != SpSalesQuotationMaster.SalesQuotationMaxGetPlusOne(decsalesQuotationTypeId))
             {
                 strSalesQuotationNo = Convert.ToString(SpSalesQuotationMaster.SalesQuotationMaxGetPlusOne(decsalesQuotationTypeId));
                 strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName);
                 if (SpSalesQuotationMaster.SalesQuotationMasterGetMax(decsalesQuotationTypeId) == "0")
                 {
                     strSalesQuotationNo = "0";
                     strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName);
                 }
             }
             if (isAutomatic)
             {
                 SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP();
                 SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo();
                 infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decsalesQuotationTypeId, dtpSalesQuotationDate.Value);
                 strPrefix = infoSuffixPrefix.Prefix;
                 strSuffix = infoSuffixPrefix.Suffix;
                 decSalesQuotationPreffixSuffixId = infoSuffixPrefix.SuffixprefixId;
                 strInvoiceNo = strPrefix + strSalesQuotationNo + strSuffix;
                 txtQuotationNo.Text = strInvoiceNo;
                 txtQuotationNo.ReadOnly = true;
             }
         }
         else
         {
             txtQuotationNo.Text = string.Empty;
         }
         salesQuotationDatefill();
         if (!ShowProductCode())
         {
             this.dgvProduct.Columns["dgvtxtProductCode"].Visible = false;
         }
         if (!ShowBarcode())
         {
             this.dgvProduct.Columns["dgvtxtBarcode"].Visible = false;
         }
         if (PrintAfetrSave())
         {
             cbxPrintAfterSave.Checked = true;
         }
         else
         {
             cbxPrintAfterSave.Checked = false;
         }
         dgvProduct.Rows.Clear();
         txtNarration.Text = string.Empty;
         txtTotal.Text = string.Empty;
         btnSave.Text = "Save";
         btnDelete.Enabled = false;
         cbxApproved.Checked = false;
         ComboCurrencyFill();
         ComboPricingLevelFill();
         ComboSalesManFill();
         CashOrPartyCombofill();
         FillProducts(false, null);
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQ:31" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }