Example #1
0
 /// <summary>
 /// Function to edit the SalesQuatation
 /// </summary>
 public void EditFunction()
 {
     SalesQuotationDetailsSP SpSalesQuotationDetails = new SalesQuotationDetailsSP();
     SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo();
     SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP();
     SettingsSP spSettings = new SettingsSP();
     try
     {
         for (int inI = 0; inI < dgvProduct.Rows.Count - 1; inI++)
         {
             if (Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtquotationDetailsId"].Value) != 0)
             {
                 isEditDetails = Convert.ToString(SpSalesQuotationDetails.SalesQuotationRefererenceCheckForEditDetails(Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtquotationDetailsId"].Value)));
             }
         }
         isEditMaster = Convert.ToString(SpSalesQuotationMaster.SalesQuotationRefererenceCheckForEditMaster(decSalesquotationMasterId));
         if (isEditMaster == "False" && isEditDetails == "False")
         {
             infoSalesQuotationMaster.QuotationMasterId = decSalesquotationMasterId;
             infoSalesQuotationMaster.Date = Convert.ToDateTime(txtSalesQuotationDate.Text);
             infoSalesQuotationMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
             infoSalesQuotationMaster.SuffixPrefixId = Convert.ToDecimal(decSalesQuotationPreffixSuffixId);
             infoSalesQuotationMaster.VoucherNo = strVoucherNo;
             infoSalesQuotationMaster.VoucherTypeId = decSalesQuotationVoucherId;
             infoSalesQuotationMaster.InvoiceNo = txtQuotationNo.Text;
             infoSalesQuotationMaster.userId = PublicVariables._decCurrentUserId;//by default current userid used as current user id
             infoSalesQuotationMaster.EmployeeId = Convert.ToDecimal(cmbSalesman.SelectedValue.ToString());
             infoSalesQuotationMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
             infoSalesQuotationMaster.Narration = txtNarration.Text.Trim();
             infoSalesQuotationMaster.TotalAmount = Convert.ToDecimal(txtTotal.Text);
             infoSalesQuotationMaster.PricinglevelId = Convert.ToDecimal(cmbPricinglevel.SelectedValue.ToString());
             infoSalesQuotationMaster.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
             if (cbxApproved.Checked)
             {
                 infoSalesQuotationMaster.Approved = true;
             }
             else
             {
                 infoSalesQuotationMaster.Approved = false;
             }
             infoSalesQuotationMaster.Extra1 = string.Empty;
             infoSalesQuotationMaster.Extra2 = string.Empty;
             SpSalesQuotationMaster.SalesQuotationMasterEdit(infoSalesQuotationMaster);
             RemoveSalesQuotationDetails();
             NewRowAddedToSalesQuotationDetails();
             SalesQuotationDetailsEditFill();
             Messages.UpdatedMessage();
             if (frmSalesQuotationRegisterObj != null)
             {
                 if (cbxPrintAfterSave.Checked)
                 {
                     if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesquotationMasterId);
                     }
                     else
                     {
                         Print(decSalesquotationMasterId);
                     }
                 }
                 this.Close();
                 frmSalesQuotationRegisterObj.GridFill();
             }
             if (frmSalesQuotationReportObj != null)
             {
                 if (cbxPrintAfterSave.Checked)
                 {
                     if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesquotationMasterId);
                     }
                     else
                     {
                         Print(decSalesquotationMasterId);
                     }
                 }
                 this.Close();
                 frmSalesQuotationReportObj.GridFill();
             }
             if (frmDayBookObj != null)
             {
                 if (cbxPrintAfterSave.Checked)
                 {
                     if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesquotationMasterId);
                     }
                     else
                     {
                         Print(decSalesquotationMasterId);
                     }
                 }
                 this.Close();
             }
             if (objfrmVoucherSearch != null)
             {
                 if (cbxPrintAfterSave.Checked)
                 {
                     if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesquotationMasterId);
                     }
                     else
                     {
                         Print(decSalesquotationMasterId);
                     }
                 }
                 this.Close();
             }
             if (objVoucherSearch != null)
             {
                 if (cbxPrintAfterSave.Checked)
                 {
                     if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                     {
                         PrintForDotMatrix(decSalesquotationMasterId);
                     }
                     else
                     {
                         Print(decSalesquotationMasterId);
                     }
                 }
                 this.Close();
             }
             
         }
         else
         {
             Messages.ReferenceExistsMessageForUpdate();
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQ:33" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }