コード例 #1
0
 /// <summary>
 /// Function to Update values in SalesQuotationDetails Table
 /// </summary>
 /// <param name="salesquotationdetailsinfo"></param>
 public void SalesQuotationDetailsEdit(SalesQuotationDetailsInfo salesquotationdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesQuotationDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam       = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.QuotationDetailsId;
         sprmparam       = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.QuotationMasterId;
         sprmparam       = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.ProductId;
         sprmparam       = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.UnitId;
         sprmparam       = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.UnitConversionId;
         sprmparam       = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Qty;
         sprmparam       = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Rate;
         sprmparam       = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Amount;
         sprmparam       = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.BatchId;
         sprmparam       = sccmd.Parameters.Add("@slno", SqlDbType.Int);
         sprmparam.Value = salesquotationdetailsinfo.Slno;
         sprmparam       = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salesquotationdetailsinfo.Extra1;
         sprmparam       = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salesquotationdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
コード例 #2
0
 /// <summary>
 /// Function to Update values in SalesQuotationDetails Table
 /// </summary>
 /// <param name="salesquotationdetailsinfo"></param>
 public void SalesQuotationDetailsEdit(SalesQuotationDetailsInfo salesquotationdetailsinfo)
 {
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesQuotationDetailsEdit", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.QuotationDetailsId;
         sprmparam = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.QuotationMasterId;
         sprmparam = sccmd.Parameters.Add("@productId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.ProductId;
         sprmparam = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.UnitId;
         sprmparam = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.UnitConversionId;
         sprmparam = sccmd.Parameters.Add("@qty", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Qty;
         sprmparam = sccmd.Parameters.Add("@rate", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Rate;
         sprmparam = sccmd.Parameters.Add("@amount", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.Amount;
         sprmparam = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal);
         sprmparam.Value = salesquotationdetailsinfo.BatchId;
         sprmparam = sccmd.Parameters.Add("@slno", SqlDbType.Int);
         sprmparam.Value = salesquotationdetailsinfo.Slno;
         sprmparam = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar);
         sprmparam.Value = salesquotationdetailsinfo.Extra1;
         sprmparam = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar);
         sprmparam.Value = salesquotationdetailsinfo.Extra2;
         sccmd.ExecuteNonQuery();
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sqlcon.Close();
     }
 }
コード例 #3
0
        /// <summary>
        /// Function to get particular values from SalesQuotationDetails Table based on the parameter
        /// </summary>
        /// <param name="quotationDetailsId"></param>
        /// <returns></returns>
        public SalesQuotationDetailsInfo SalesQuotationDetailsView(decimal quotationDetailsId)
        {
            SalesQuotationDetailsInfo salesquotationdetailsinfo = new SalesQuotationDetailsInfo();
            SqlDataReader             sdrreader = null;

            try
            {
                if (sqlcon.State == ConnectionState.Closed)
                {
                    sqlcon.Open();
                }
                SqlCommand sccmd = new SqlCommand("SalesQuotationDetailsView", sqlcon);
                sccmd.CommandType = CommandType.StoredProcedure;
                SqlParameter sprmparam = new SqlParameter();
                sprmparam       = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal);
                sprmparam.Value = quotationDetailsId;
                sdrreader       = sccmd.ExecuteReader();
                while (sdrreader.Read())
                {
                    salesquotationdetailsinfo.QuotationDetailsId = Convert.ToDecimal(sdrreader[0].ToString());
                    salesquotationdetailsinfo.QuotationMasterId  = Convert.ToDecimal(sdrreader[1].ToString());
                    salesquotationdetailsinfo.ProductId          = Convert.ToDecimal(sdrreader[2].ToString());
                    salesquotationdetailsinfo.UnitId             = Convert.ToDecimal(sdrreader[3].ToString());
                    salesquotationdetailsinfo.UnitConversionId   = Convert.ToDecimal(sdrreader[4].ToString());
                    salesquotationdetailsinfo.Qty     = Convert.ToDecimal(sdrreader[5].ToString());
                    salesquotationdetailsinfo.Rate    = Convert.ToDecimal(sdrreader[6].ToString());
                    salesquotationdetailsinfo.Amount  = Convert.ToDecimal(sdrreader[7].ToString());
                    salesquotationdetailsinfo.Slno    = int.Parse(sdrreader[8].ToString());
                    salesquotationdetailsinfo.Extra1  = sdrreader[11].ToString();
                    salesquotationdetailsinfo.Extra2  = sdrreader[12].ToString();
                    salesquotationdetailsinfo.BatchId = Convert.ToDecimal(sdrreader[13].ToString());
                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
            finally
            {
                sdrreader.Close();
                sqlcon.Close();
            }
            return(salesquotationdetailsinfo);
        }
コード例 #4
0
 /// <summary>
 /// Function to fill the grid to edit the details
 /// </summary>
 public void SalesQuotationDetailsEditFill()
 {
     SalesQuotationDetailsSP SpSalesQuotationDetails = new SalesQuotationDetailsSP();
     SalesQuotationDetailsInfo infoSalesQuotationDetails = new SalesQuotationDetailsInfo();
     ProductSP SpProduct = new ProductSP();
     ProductInfo infoproduct = new ProductInfo();
     try
     {
         for (int inI = 0; inI < dgvProduct.Rows.Count - 1; inI++)
         {
             infoSalesQuotationDetails.QuotationMasterId = decSalesquotationMasterId;
             infoSalesQuotationDetails.QuotationDetailsId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQuotationDetailsId"].Value);
             infoproduct = SpProduct.ProductViewByCode(dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
             infoSalesQuotationDetails.ProductId = infoproduct.ProductId;
             infoSalesQuotationDetails.Qty = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
             if (Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQuotationDetailsId"].Value) == 0)
             {
                 infoSalesQuotationDetails.UnitId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value.ToString());
             }
             else
             {
                 DGVUnitComboFill();
                 infoSalesQuotationDetails.UnitId = Convert.ToDecimal((dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value.ToString()));
             }
             decimal unitConversion = SpSalesQuotationDetails.UnitconversionIdViewByUnitIdAndProductId(infoSalesQuotationDetails.UnitId, infoSalesQuotationDetails.ProductId);
             infoSalesQuotationDetails.UnitConversionId = unitConversion;
             infoSalesQuotationDetails.BatchId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value);
             infoSalesQuotationDetails.Rate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value);
             infoSalesQuotationDetails.Amount = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtAmount"].Value);
             infoSalesQuotationDetails.Slno = Convert.ToInt32(dgvProduct.Rows[inI].Cells["dgvtxtSlNo"].Value);
             infoSalesQuotationDetails.Extra1 = string.Empty;
             infoSalesQuotationDetails.Extra2 = string.Empty;
             SpSalesQuotationDetails.SalesQuotationDetailsEdit(infoSalesQuotationDetails);
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQ:20" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #5
0
 /// <summary>
 /// Function to save the sales quatation
 /// </summary>
 public void SaveFunction()
 {
     SalesQuotationDetailsSP SpSalesQuotationDetails = new SalesQuotationDetailsSP();
     SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP();
     SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo();
     SalesQuotationDetailsInfo infoSalesQuotationDetails = new SalesQuotationDetailsInfo();
     SettingsSP spSettings = new SettingsSP();
     ProductSP spProduct = new ProductSP();
     ProductInfo infoproduct = new ProductInfo();
     try
     {
         infoSalesQuotationMaster.Date = Convert.ToDateTime(txtSalesQuotationDate.Text);
         infoSalesQuotationMaster.PricinglevelId = Convert.ToDecimal(cmbPricinglevel.SelectedValue.ToString());
         infoSalesQuotationMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString());
         infoSalesQuotationMaster.EmployeeId = Convert.ToDecimal(cmbSalesman.SelectedValue.ToString());
         if (isAutomatic)
         {
             infoSalesQuotationMaster.SuffixPrefixId = decSalesQuotationPreffixSuffixId;
             infoSalesQuotationMaster.VoucherNo = strSalesQuotationNo;
         }
         else
         {
             infoSalesQuotationMaster.SuffixPrefixId = 0;
             infoSalesQuotationMaster.VoucherNo = SpSalesQuotationMaster.VoucherNoMax(decsalesQuotationTypeId);
         }
         infoSalesQuotationMaster.VoucherTypeId = decsalesQuotationTypeId;
         infoSalesQuotationMaster.InvoiceNo = txtQuotationNo.Text;
         infoSalesQuotationMaster.EmployeeId = Convert.ToDecimal(cmbSalesman.SelectedValue.ToString());
         infoSalesQuotationMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId;
         infoSalesQuotationMaster.userId = PublicVariables._decCurrentUserId;
         infoSalesQuotationMaster.TotalAmount = Convert.ToDecimal(txtTotal.Text);
         infoSalesQuotationMaster.Narration = txtNarration.Text.Trim();
         infoSalesQuotationMaster.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue.ToString());
         infoSalesQuotationMaster.Extra1 = string.Empty;
         infoSalesQuotationMaster.Extra2 = string.Empty;
         if (cbxApproved.Checked)
         {
             infoSalesQuotationMaster.Approved = true;
         }
         else
         {
             infoSalesQuotationMaster.Approved = false;
         }
         decSalesQuotationmasterIdentity = Convert.ToDecimal(SpSalesQuotationMaster.SalesQuotationMasterAdd(infoSalesQuotationMaster));
         int inRowcount = dgvProduct.Rows.Count;
         for (int inI = 0; inI < inRowcount - 1; inI++)
         {
             infoSalesQuotationDetails.QuotationMasterId = decSalesQuotationmasterIdentity;
             if (dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value != null && dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString() != string.Empty)
             {
                 infoproduct = spProduct.ProductViewByCode(dgvProduct.Rows[inI].Cells["dgvtxtProductCode"].Value.ToString());
                 infoSalesQuotationDetails.ProductId = infoproduct.ProductId;
             }
             if (dgvProduct.Rows[inI].Cells["dgvtxtQty"].Value != null && dgvProduct.Rows[inI].Cells["dgvtxtQty"].Value.ToString() != string.Empty)
             {
                 infoSalesQuotationDetails.Qty = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtQty"].Value.ToString());
             }
             if (dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value != null && dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value.ToString() != string.Empty)
             {
                 infoSalesQuotationDetails.UnitId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbUnit"].Value.ToString());
                 decimal unitConversion = SpSalesQuotationDetails.UnitconversionIdViewByUnitIdAndProductId(infoSalesQuotationDetails.UnitId, infoSalesQuotationDetails.ProductId);
                 infoSalesQuotationDetails.UnitConversionId = unitConversion;
             }
             if (dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value.ToString() != string.Empty)
             {
                 infoSalesQuotationDetails.BatchId = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvcmbBatch"].Value);
             }
             else
             {
                 infoSalesQuotationDetails.BatchId = 0;
             }
             infoSalesQuotationDetails.Rate = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtRate"].Value.ToString());
             infoSalesQuotationDetails.Amount = Convert.ToDecimal(dgvProduct.Rows[inI].Cells["dgvtxtAmount"].Value.ToString());
             infoSalesQuotationDetails.Slno = Convert.ToInt32(dgvProduct.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString());
             infoSalesQuotationDetails.Extra1 = string.Empty;
             infoSalesQuotationDetails.Extra2 = string.Empty;
             SpSalesQuotationDetails.SalesQuotationDetailsAdd(infoSalesQuotationDetails);
         }
         Messages.SavedMessage();
         if (cbxPrintAfterSave.Checked)
         {
             if (dgvProduct.Rows.Count > 0)
             {
                 if (spSettings.SettingsStatusCheck("Printer") == "Dot Matrix")
                 {
                     PrintForDotMatrix(decSalesQuotationmasterIdentity);
                 }
                 else
                 {
                     Print(decSalesQuotationmasterIdentity);
                 }
             }
             else
             {
                 Messages.InformationMessage("No data found");
             }
         }
         Clear();
     }
     catch (Exception ex)
     {
         MessageBox.Show("SQ:32" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
コード例 #6
0
 /// <summary>
 /// Function to get particular values from SalesQuotationDetails Table based on the parameter
 /// </summary>
 /// <param name="quotationDetailsId"></param>
 /// <returns></returns>
 public SalesQuotationDetailsInfo SalesQuotationDetailsView(decimal quotationDetailsId)
 {
     SalesQuotationDetailsInfo salesquotationdetailsinfo = new SalesQuotationDetailsInfo();
     SqlDataReader sdrreader = null;
     try
     {
         if (sqlcon.State == ConnectionState.Closed)
         {
             sqlcon.Open();
         }
         SqlCommand sccmd = new SqlCommand("SalesQuotationDetailsView", sqlcon);
         sccmd.CommandType = CommandType.StoredProcedure;
         SqlParameter sprmparam = new SqlParameter();
         sprmparam = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal);
         sprmparam.Value = quotationDetailsId;
         sdrreader = sccmd.ExecuteReader();
         while (sdrreader.Read())
         {
             salesquotationdetailsinfo.QuotationDetailsId = Convert.ToDecimal(sdrreader[0].ToString());
             salesquotationdetailsinfo.QuotationMasterId = Convert.ToDecimal(sdrreader[1].ToString());
             salesquotationdetailsinfo.ProductId = Convert.ToDecimal(sdrreader[2].ToString());
             salesquotationdetailsinfo.UnitId = Convert.ToDecimal(sdrreader[3].ToString());
             salesquotationdetailsinfo.UnitConversionId = Convert.ToDecimal(sdrreader[4].ToString());
             salesquotationdetailsinfo.Qty = Convert.ToDecimal(sdrreader[5].ToString());
             salesquotationdetailsinfo.Rate = Convert.ToDecimal(sdrreader[6].ToString());
             salesquotationdetailsinfo.Amount = Convert.ToDecimal(sdrreader[7].ToString());
             salesquotationdetailsinfo.Slno = int.Parse(sdrreader[8].ToString());
             salesquotationdetailsinfo.Extra1 = sdrreader[11].ToString();
             salesquotationdetailsinfo.Extra2 = sdrreader[12].ToString();
             salesquotationdetailsinfo.BatchId = Convert.ToDecimal(sdrreader[13].ToString());
         }
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.ToString());
     }
     finally
     {
         sdrreader.Close();
         sqlcon.Close();
     }
     return salesquotationdetailsinfo;
 }