public void SalesQuotationDetailsAdd(SalesQuotationDetailsInfo infoSalesQuotationDetails) { try { spSalesQuotationDetails.SalesQuotationDetailsAdd(infoSalesQuotationDetails); } catch (Exception ex) { MessageBox.Show("SQBLL5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void SalesQuotationDetailsEdit(SalesQuotationDetailsInfo salesquotationdetailsinfo) { try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("SalesQuotationDetailsEdit", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam13 = new SqlParameter(); sprmparam13 = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.QuotationDetailsId; sprmparam13 = sccmd.Parameters.Add("@quotationMasterId", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.QuotationMasterId; sprmparam13 = sccmd.Parameters.Add("@productId", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.ProductId; sprmparam13 = sccmd.Parameters.Add("@unitId", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.UnitId; sprmparam13 = sccmd.Parameters.Add("@unitConversionId", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.UnitConversionId; sprmparam13 = sccmd.Parameters.Add("@qty", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.Qty; sprmparam13 = sccmd.Parameters.Add("@rate", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.Rate; sprmparam13 = sccmd.Parameters.Add("@amount", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.Amount; sprmparam13 = sccmd.Parameters.Add("@batchId", SqlDbType.Decimal); sprmparam13.Value = salesquotationdetailsinfo.BatchId; sprmparam13 = sccmd.Parameters.Add("@slno", SqlDbType.Int); sprmparam13.Value = salesquotationdetailsinfo.Slno; sprmparam13 = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam13.Value = salesquotationdetailsinfo.Extra1; sprmparam13 = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam13.Value = salesquotationdetailsinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { base.sqlcon.Close(); } }
public SalesQuotationDetailsInfo SalesQuotationDetailsView(decimal quotationDetailsId) { SalesQuotationDetailsInfo salesquotationdetailsinfo = new SalesQuotationDetailsInfo(); SqlDataReader sdrreader = null; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("SalesQuotationDetailsView", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam2 = new SqlParameter(); sprmparam2 = sccmd.Parameters.Add("@quotationDetailsId", SqlDbType.Decimal); sprmparam2.Value = quotationDetailsId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { salesquotationdetailsinfo.QuotationDetailsId = Convert.ToDecimal(((DbDataReader)sdrreader)[0].ToString()); salesquotationdetailsinfo.QuotationMasterId = Convert.ToDecimal(((DbDataReader)sdrreader)[1].ToString()); salesquotationdetailsinfo.ProductId = Convert.ToDecimal(((DbDataReader)sdrreader)[2].ToString()); salesquotationdetailsinfo.UnitId = Convert.ToDecimal(((DbDataReader)sdrreader)[3].ToString()); salesquotationdetailsinfo.UnitConversionId = Convert.ToDecimal(((DbDataReader)sdrreader)[4].ToString()); salesquotationdetailsinfo.Qty = Convert.ToDecimal(((DbDataReader)sdrreader)[5].ToString()); salesquotationdetailsinfo.Rate = Convert.ToDecimal(((DbDataReader)sdrreader)[6].ToString()); salesquotationdetailsinfo.Amount = Convert.ToDecimal(((DbDataReader)sdrreader)[7].ToString()); salesquotationdetailsinfo.Slno = int.Parse(((DbDataReader)sdrreader)[8].ToString()); salesquotationdetailsinfo.Extra1 = ((DbDataReader)sdrreader)[11].ToString(); salesquotationdetailsinfo.Extra2 = ((DbDataReader)sdrreader)[12].ToString(); salesquotationdetailsinfo.BatchId = Convert.ToDecimal(((DbDataReader)sdrreader)[13].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); base.sqlcon.Close(); } return(salesquotationdetailsinfo); }
/// <summary> /// Function to save the sales quatation /// </summary> public void SaveFunction() { SalesQuotationBll bllSalesQuotation = new SalesQuotationBll(); //SalesQuotationBll bllSalesQuotation = new SalesQuotationBll(); SalesQuotationMasterInfo infoSalesQuotationMaster = new SalesQuotationMasterInfo(); SalesQuotationDetailsInfo infoSalesQuotationDetails = new SalesQuotationDetailsInfo(); SettingsBll BllSettings = new SettingsBll(); ProductCreationBll BllProductCreation = new ProductCreationBll(); 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 = bllSalesQuotation.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(bllSalesQuotation.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 = BllProductCreation.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 = bllSalesQuotation.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; bllSalesQuotation.SalesQuotationDetailsAdd(infoSalesQuotationDetails); } Messages.SavedMessage(); if (cbxPrintAfterSave.Checked) { if (dgvProduct.Rows.Count > 0) { if (BllSettings.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); } }
/// <summary> /// Function to fill the grid to edit the details /// </summary> public void SalesQuotationDetailsEditFill() { SalesQuotationBll bllSalesQuotation = new SalesQuotationBll(); SalesQuotationDetailsInfo infoSalesQuotationDetails = new SalesQuotationDetailsInfo(); ProductCreationBll BllProductCreation = new ProductCreationBll(); 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 = BllProductCreation.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 = bllSalesQuotation.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; bllSalesQuotation.SalesQuotationDetailsEdit(infoSalesQuotationDetails); } } catch (Exception ex) { MessageBox.Show("SQ:20" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }