public void PurchaseReturnBilltaxAdd(PurchaseReturnBilltaxInfo purchasereturnbilltaxinfo) { try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PurchaseReturnBilltaxAdd", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam6 = new SqlParameter(); sprmparam6 = sccmd.Parameters.Add("@purchaseReturnMasterId", SqlDbType.Decimal); sprmparam6.Value = purchasereturnbilltaxinfo.PurchaseReturnMasterId; sprmparam6 = sccmd.Parameters.Add("@taxId", SqlDbType.Decimal); sprmparam6.Value = purchasereturnbilltaxinfo.TaxId; sprmparam6 = sccmd.Parameters.Add("@taxAmount", SqlDbType.Decimal); sprmparam6.Value = purchasereturnbilltaxinfo.TaxAmount; sprmparam6 = sccmd.Parameters.Add("@extra1", SqlDbType.VarChar); sprmparam6.Value = purchasereturnbilltaxinfo.Extra1; sprmparam6 = sccmd.Parameters.Add("@extra2", SqlDbType.VarChar); sprmparam6.Value = purchasereturnbilltaxinfo.Extra2; sccmd.ExecuteNonQuery(); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { base.sqlcon.Close(); } }
/// <summary> /// Function to insert values to PurchaseReturnBilltax Table /// </summary> /// <param name="purchasereturnbilltaxinfo"></param> public void PurchaseReturnBilltaxAdd(PurchaseReturnBilltaxInfo purchasereturnbilltaxinfo) { PurchaseReturnBilltaxSP SPPurchaseReturnBilltax = new PurchaseReturnBilltaxSP(); try { SPPurchaseReturnBilltax.PurchaseReturnBilltaxAdd(purchasereturnbilltaxinfo); } catch (Exception ex) { MessageBox.Show("PrBll 1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public PurchaseReturnBilltaxInfo PurchaseReturnBilltaxView(decimal purchaseReturnBillTaxId) { PurchaseReturnBilltaxInfo purchasereturnbilltaxinfo = new PurchaseReturnBilltaxInfo(); SqlDataReader sdrreader = null; try { if (base.sqlcon.State == ConnectionState.Closed) { base.sqlcon.Open(); } SqlCommand sccmd = new SqlCommand("PurchaseReturnBilltaxView", base.sqlcon); sccmd.CommandType = CommandType.StoredProcedure; SqlParameter sprmparam2 = new SqlParameter(); sprmparam2 = sccmd.Parameters.Add("@purchaseReturnBillTaxId", SqlDbType.Decimal); sprmparam2.Value = purchaseReturnBillTaxId; sdrreader = sccmd.ExecuteReader(); while (sdrreader.Read()) { purchasereturnbilltaxinfo.PurchaseReturnBillTaxId = decimal.Parse(((DbDataReader)sdrreader)[0].ToString()); purchasereturnbilltaxinfo.PurchaseReturnMasterId = decimal.Parse(((DbDataReader)sdrreader)[1].ToString()); purchasereturnbilltaxinfo.TaxId = decimal.Parse(((DbDataReader)sdrreader)[2].ToString()); purchasereturnbilltaxinfo.TaxAmount = decimal.Parse(((DbDataReader)sdrreader)[3].ToString()); purchasereturnbilltaxinfo.Extra1 = ((DbDataReader)sdrreader)[4].ToString(); purchasereturnbilltaxinfo.Extra2 = ((DbDataReader)sdrreader)[5].ToString(); purchasereturnbilltaxinfo.ExtraDate = DateTime.Parse(((DbDataReader)sdrreader)[6].ToString()); } } catch (Exception ex) { MessageBox.Show(ex.ToString()); } finally { sdrreader.Close(); base.sqlcon.Close(); } return(purchasereturnbilltaxinfo); }
/// <summary> /// Function for Save and Edit /// </summary> public void SaveOrEdit() { try { PurchaseInvoiceBll BllPurchaseInvoice = new PurchaseInvoiceBll(); PurchaseReturnBll BllPurchaseReturn = new PurchaseReturnBll(); PurchaseReturnDetailsInfo infoPurchaseReturnDetails = new PurchaseReturnDetailsInfo(); StockPostingInfo infoStockPosting = new StockPostingInfo(); //StockPostingSP spStockPosting = new StockPostingSP(); StockPostingBll BllStockPosting = new StockPostingBll(); UnitConvertionBll BllUnitConvertion = new UnitConvertionBll(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo(); ExchangeRateBll BllExchangeRate = new ExchangeRateBll(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); PartyBalanceInfo infoPartyBalance = new PartyBalanceInfo(); AccountLedgerInfo infoAccountLedger = new AccountLedgerInfo(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); PurchaseReturnBilltaxInfo infoPurchaseReturnBillTax = new PurchaseReturnBilltaxInfo(); SettingsBll BllSettings = new SettingsBll(); UnitBll bllUnit = new UnitBll(); List<DataTable> ListObj = new List<DataTable>(); string strAgainstVoucherNo = string.Empty; string strAgainstInvoiceNo = string.Empty; decimal decPurchaseReturnMasterIds = 0; decimal decPurchaseMasterId = 0; decimal decDiscount = 0; decimal decExchangeRate = 0; decimal decDis = 0; if (isAutomatic) { if (strVoucherNo != string.Empty) { infoPurchaseReturnMaster.VoucherNo = strVoucherNo; } if (txtReturnNo.Text != string.Empty) { infoPurchaseReturnMaster.InvoiceNo = txtReturnNo.Text; } } else { infoPurchaseReturnMaster.VoucherNo = strVoucherNo; infoPurchaseReturnMaster.InvoiceNo = txtReturnNo.Text; } if (decPurchaseReturnVoucherTypeId != 0) { infoPurchaseReturnMaster.VoucherTypeId = decPurchaseReturnVoucherTypeId; } infoPurchaseReturnMaster.SuffixPrefixId = (decPurchaseReturnSuffixPrefixId != 0) ? decPurchaseReturnSuffixPrefixId : 0; infoPurchaseReturnMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()); infoPurchaseReturnMaster.PurchaseAccount = Convert.ToDecimal(cmbPurchaseAccount.SelectedValue.ToString()); if (cmbInvoiceNo.SelectedValue != null && cmbInvoiceNo.Visible == true) { infoPurchaseReturnMaster.PurchaseMasterId = Convert.ToDecimal((cmbInvoiceNo.SelectedValue.ToString())); decPurchaseMasterId = Convert.ToDecimal((cmbInvoiceNo.SelectedValue.ToString())); } else { infoPurchaseReturnMaster.PurchaseMasterId = 0; } infoPurchaseReturnMaster.ExchangeRateId = (cmbCurrency.SelectedValue != null) ? Convert.ToDecimal(cmbCurrency.SelectedValue.ToString()) : 0; infoPurchaseReturnMaster.Narration = txtNarration.Text.Trim(); infoPurchaseReturnMaster.UserId = PublicVariables._decCurrentUserId; infoPurchaseReturnMaster.LrNo = txtLrlNo.Text.Trim(); infoPurchaseReturnMaster.TransportationCompany = txtTransportationCompany.Text.Trim(); infoPurchaseReturnMaster.Date = Convert.ToDateTime(txtDate.Text); infoPurchaseReturnMaster.TotalAmount = (txtTotalAmount.Text != string.Empty) ? Convert.ToDecimal(txtTotalAmount.Text) : 0; infoPurchaseReturnMaster.TotalTax = (lblTaxAmount.Text != string.Empty) ? Convert.ToDecimal(lblTaxAmount.Text) : 0; infoPurchaseReturnMaster.Discount = (txtBillDiscount.Text != string.Empty) ? Convert.ToDecimal(txtBillDiscount.Text) : 0; infoPurchaseReturnMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoPurchaseReturnMaster.Extra1 = string.Empty; infoPurchaseReturnMaster.Extra2 = string.Empty; infoPurchaseReturnMaster.ExtraDate = DateTime.Now; infoPurchaseReturnMaster.GrandTotal = (txtGrandTotal.Text != string.Empty) ? Convert.ToDecimal(txtGrandTotal.Text) : 0; if (btnSave.Text == "Save") { decPurchaseReturnMasterIds = BllPurchaseReturn.PurchaseReturnMasterAddWithReturnIdentity(infoPurchaseReturnMaster); } else { infoPurchaseReturnMaster.PurchaseReturnMasterId = decPurchaseReturnMasterId; decExchangeRate = BllExchangeRate.ExchangeRateViewByExchangeRateId(infoPurchaseReturnMaster.ExchangeRateId); BllPurchaseReturn.PurchaseReturnMasterEdit(infoPurchaseReturnMaster); infoPurchaseMaster = BllPurchaseInvoice.PurchaseMasterView(infoPurchaseReturnMaster.PurchaseMasterId); BllLedgerPosting.LedgerPostDelete(strVoucherNo, decPurchaseReturnVoucherTypeId); bllAccountLedger.PartyBalanceDeleteByVoucherTypeVoucherNoAndReferenceType(strVoucherNo, decPurchaseReturnVoucherTypeId); } infoLedgerPosting.Date = infoPurchaseReturnMaster.Date; infoLedgerPosting.VoucherTypeId = infoPurchaseReturnMaster.VoucherTypeId; infoLedgerPosting.VoucherNo = infoPurchaseReturnMaster.VoucherNo; infoLedgerPosting.ChequeNo = string.Empty; infoLedgerPosting.ChequeDate = DateTime.Now; infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.InvoiceNo = infoPurchaseReturnMaster.InvoiceNo; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; infoLedgerPosting.LedgerId = infoPurchaseReturnMaster.PurchaseAccount; infoLedgerPosting.Debit = 0; if (btnSave.Text == "Save") { infoLedgerPosting.Credit = TotalNetAmountCalculation() * BllExchangeRate.ExchangeRateViewByExchangeRateId(Convert.ToDecimal(cmbCurrency.SelectedValue.ToString())); infoLedgerPosting.ExtraDate = DateTime.Now; } else { infoLedgerPosting.Credit = TotalNetAmountCalculation(); } BllLedgerPosting.LedgerPostingAdd(infoLedgerPosting); infoLedgerPosting.LedgerId = infoPurchaseReturnMaster.LedgerId; if (btnSave.Text == "Save") { infoLedgerPosting.Debit = Convert.ToDecimal(txtGrandTotal.Text) * BllExchangeRate.ExchangeRateViewByExchangeRateId(Convert.ToDecimal(cmbCurrency.SelectedValue.ToString())); infoLedgerPosting.ExtraDate = DateTime.Now; } else { infoLedgerPosting.Debit = Convert.ToDecimal(txtGrandTotal.Text); } infoLedgerPosting.Credit = 0; BllLedgerPosting.LedgerPostingAdd(infoLedgerPosting); foreach (DataGridViewRow dgvrow in dgvPurchaseReturnTax.Rows) { if (dgvrow.Cells["dgvtxtTaxId"].Value != null && dgvrow.Cells["dgvtxtTaxId"].Value.ToString() != string.Empty) { infoLedgerPosting.LedgerId = Convert.ToDecimal(dgvrow.Cells["dgvtxtledgerId"].Value.ToString()); infoLedgerPosting.Credit = (dgvrow.Cells["dgvtxtAmounts"].Value == null) ? 0 : Convert.ToDecimal(dgvrow.Cells["dgvtxtAmounts"].Value.ToString()); infoLedgerPosting.Debit = 0; infoLedgerPosting.ExtraDate = DateTime.Now; BllLedgerPosting.LedgerPostingAdd(infoLedgerPosting); } } if (txtBillDiscount.Text.Trim() != string.Empty) { decDis = Convert.ToDecimal(txtBillDiscount.Text); } if (decDis >= 0) { infoLedgerPosting.Debit = 0; infoLedgerPosting.Credit = decDis; infoLedgerPosting.LedgerId = 9; infoLedgerPosting.ExtraDate = DateTime.Now; BllLedgerPosting.LedgerPostingAdd(infoLedgerPosting); } if (btnSave.Text == "Update") { infoPurchaseReturnMaster = BllPurchaseReturn.PurchaseReturnMasterView(decPurchaseReturnMasterId); if (infoPurchaseReturnMaster.PurchaseMasterId == 0) { BllStockPosting.StockPostingDeleteByagainstVoucherTypeIdAndagainstVoucherNoAndVoucherNoAndVoucherType(0, "NA", infoPurchaseReturnMaster.VoucherNo, infoPurchaseReturnMaster.VoucherTypeId); } if (infoPurchaseReturnMaster.PurchaseMasterId != 0) { infoPurchaseMaster = BllPurchaseInvoice.PurchaseMasterView(infoPurchaseReturnMaster.PurchaseMasterId); BllStockPosting.StockPostingDeleteByagainstVoucherTypeIdAndagainstVoucherNoAndVoucherNoAndVoucherType(infoPurchaseMaster.VoucherTypeId, strInvoiceNo, strVoucherNo, infoPurchaseReturnMaster.VoucherTypeId); } } foreach (DataGridViewRow dgvrow in dgvPurchaseReturn.Rows) { if (dgvrow.Cells["dgvtxtProductId"].Value != null && dgvrow.Cells["dgvtxtProductId"].Value.ToString() != string.Empty) { infoPurchaseReturnDetails.ExtraDate = DateTime.Now; infoPurchaseReturnDetails.Extra1 = string.Empty; infoPurchaseReturnDetails.Extra2 = string.Empty; infoPurchaseReturnDetails.PurchaseReturnMasterId = (btnSave.Text == "Save") ? decPurchaseReturnMasterIds : decPurchaseReturnMasterId; infoPurchaseReturnDetails.ProductId = Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvtxtproductId"].Value)); infoPurchaseReturnDetails.Qty = Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvtxtqty"].Value)); infoPurchaseReturnDetails.Rate = Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvtxtrate"].Value)); if (btnSave.Text == "Save") { infoPurchaseReturnDetails.UnitId = Convert.ToDecimal(dgvrow.Cells["dgvcmbUnit"].Value.ToString()); infoPurchaseReturnDetails.UnitConversionId = BllUnitConvertion.UnitconversionIdViewByUnitIdAndProductId(infoPurchaseReturnDetails.UnitId, infoPurchaseReturnDetails.ProductId); } else { if (Convert.ToDecimal(dgvrow.Cells["dgvtxtPurchaseReturnDetailsId"].Value) == 0) { try { infoPurchaseReturnDetails.UnitId = Convert.ToDecimal(dgvrow.Cells["dgvcmbUnit"].Value.ToString()); } catch { infoPurchaseReturnDetails.UnitId = bllUnit.UnitIdByUnitName(Convert.ToString(dgvrow.Cells["dgvcmbUnit"].Value.ToString())); } infoPurchaseReturnDetails.UnitConversionId = BllUnitConvertion.UnitconversionIdViewByUnitIdAndProductId(infoPurchaseReturnDetails.UnitId, infoPurchaseReturnDetails.ProductId); } else { try { infoPurchaseReturnDetails.UnitId = Convert.ToDecimal(dgvrow.Cells["dgvcmbUnit"].Value.ToString()); } catch { infoPurchaseReturnDetails.UnitId = bllUnit.UnitIdByUnitName(Convert.ToString(dgvrow.Cells["dgvcmbUnit"].Value.ToString())); } } infoPurchaseReturnDetails.UnitConversionId = Convert.ToDecimal(dgvrow.Cells["dgvtxtUnitConversionId"].Value); } infoPurchaseReturnDetails.Discount = Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvtxtdiscount"].Value)); if (dgvrow.Cells["dgvcmbTax"].Value != null && Convert.ToString(dgvrow.Cells["dgvcmbTax"].Value) != string.Empty && dgvrow.Cells["dgvcmbTax"].Value as string != "NA") { infoPurchaseReturnDetails.TaxId = Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvcmbTax"].Value)); if (strTaxComboFill != string.Empty) { infoPurchaseReturnDetails.TaxAmount = Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvtxtTaxAmount"].Value)); } } else { infoPurchaseReturnDetails.TaxId = 0; } if (dgvrow.Cells["dgvcmbBatch"].Value != null && Convert.ToString(dgvrow.Cells["dgvcmbBatch"].Value) != string.Empty) { infoPurchaseReturnDetails.BatchId = Convert.ToDecimal(dgvrow.Cells["dgvcmbBatch"].Value); } else { infoPurchaseReturnDetails.GodownId = 0; } if (dgvrow.Cells["dgvcmbGodown"].Value != null && Convert.ToString(dgvrow.Cells["dgvcmbGodown"].Value) != string.Empty) { infoPurchaseReturnDetails.GodownId = Convert.ToDecimal(dgvrow.Cells["dgvcmbGodown"].Value); } else { infoPurchaseReturnDetails.RackId = 0; } if (dgvrow.Cells["dgvcmbRack"].Value != null && Convert.ToString(dgvrow.Cells["dgvcmbRack"].Value) != string.Empty) { infoPurchaseReturnDetails.RackId = Convert.ToDecimal(dgvrow.Cells["dgvcmbRack"].Value); } infoPurchaseReturnDetails.GrossAmount = Convert.ToDecimal(dgvrow.Cells["dgvtxtgrossValue"].Value.ToString()); infoPurchaseReturnDetails.NetAmount = Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvtxtNetAmount"].Value)); infoPurchaseReturnDetails.Amount = Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvtxtAmount"].Value)); infoPurchaseReturnDetails.SlNo = Convert.ToInt32(Convert.ToString(dgvrow.Cells["dgvtxtSlNo"].Value)); infoPurchaseReturnDetails.PurchaseDetailsId = (dgvrow.Cells["dgvtxtPurchaseDetailsId"].Value != null) ? Convert.ToDecimal(Convert.ToString(dgvrow.Cells["dgvtxtPurchaseDetailsId"].Value)) : 0; if (dgvrow.Cells["dgvtxtPurchaseReturnDetailsId"].Value != null) { if (dgvrow.Cells["dgvtxtPurchaseReturnDetailsId"].Value.ToString() == "0" || dgvrow.Cells["dgvtxtPurchaseReturnDetailsId"].Value.ToString() == string.Empty) { BllPurchaseReturn.PurchaseReturnDetailsAddWithReturnIdentity(infoPurchaseReturnDetails); } else { infoPurchaseReturnDetails.PurchaseReturnDetailsId = Convert.ToDecimal(dgvrow.Cells["dgvtxtPurchaseReturnDetailsId"].Value.ToString()); BllPurchaseReturn.PurchaseReturnDetailsEdit(infoPurchaseReturnDetails); } } else { BllPurchaseReturn.PurchaseReturnDetailsAddWithReturnIdentity(infoPurchaseReturnDetails); } if (btnSave.Text == "Save") { infoPurchaseMaster = BllPurchaseInvoice.PurchaseMasterView(infoPurchaseReturnMaster.PurchaseMasterId); } infoStockPosting.Date = infoPurchaseReturnMaster.Date; infoStockPosting.ProductId = infoPurchaseReturnDetails.ProductId; infoStockPosting.BatchId = infoPurchaseReturnDetails.BatchId; infoStockPosting.UnitId = infoPurchaseReturnDetails.UnitId; infoStockPosting.GodownId = infoPurchaseReturnDetails.GodownId; infoStockPosting.RackId = infoPurchaseReturnDetails.RackId; decimal decConversionId = BllUnitConvertion.UnitConversionRateByUnitConversionId(infoPurchaseReturnDetails.UnitConversionId); //infoStockPosting.OutwardQty = infoPurchaseReturnDetails.Qty / (decConversionId == 0 ? 1 : decConversionId); infoStockPosting.OutwardQty = infoPurchaseReturnDetails.Qty; infoStockPosting.InwardQty = 0; infoStockPosting.Rate = infoPurchaseReturnDetails.Rate; infoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoStockPosting.Extra1 = string.Empty; infoStockPosting.Extra2 = string.Empty; if (infoPurchaseReturnDetails.PurchaseDetailsId != 0) { infoStockPosting.AgainstVoucherTypeId = infoPurchaseMaster.VoucherTypeId; infoStockPosting.AgainstVoucherNo = infoPurchaseMaster.VoucherNo; infoStockPosting.AgainstInvoiceNo = infoPurchaseMaster.InvoiceNo; infoStockPosting.VoucherNo = strVoucherNo; infoStockPosting.InvoiceNo = txtReturnNo.Text.Trim(); infoStockPosting.VoucherTypeId = decPurchaseReturnVoucherTypeId; decAgainstVoucherTypeId = infoStockPosting.VoucherTypeId; } else { infoStockPosting.AgainstVoucherTypeId = 0; infoStockPosting.AgainstVoucherNo = "NA"; infoStockPosting.AgainstInvoiceNo = "NA"; infoStockPosting.VoucherNo = infoPurchaseReturnMaster.VoucherNo; infoStockPosting.InvoiceNo = infoPurchaseReturnMaster.InvoiceNo; infoStockPosting.VoucherTypeId = decPurchaseReturnVoucherTypeId; decAgainstVoucherTypeId = 0; } BllStockPosting.StockPostingAdd(infoStockPosting); } } if (btnSave.Text == "Update") { removePurchaseReturnDetails(); } infoAccountLedger = bllAccountLedger.AccountLedgerView(infoPurchaseReturnMaster.LedgerId); if (infoAccountLedger.BillByBill == true) { infoPartyBalance.Date = infoPurchaseReturnMaster.Date; infoPartyBalance.LedgerId = infoPurchaseReturnMaster.LedgerId; if (decAgainstVoucherTypeId != 0) { infoPartyBalance.VoucherTypeId = infoPurchaseMaster.VoucherTypeId; infoPartyBalance.VoucherNo = infoPurchaseMaster.VoucherNo; infoPartyBalance.InvoiceNo = infoPurchaseMaster.InvoiceNo; infoPartyBalance.AgainstVoucherTypeId = infoPurchaseReturnMaster.VoucherTypeId; infoPartyBalance.AgainstVoucherNo = infoPurchaseReturnMaster.VoucherNo; infoPartyBalance.AgainstInvoiceNo = infoPurchaseReturnMaster.InvoiceNo; infoPartyBalance.ReferenceType = "Against"; } else { infoPartyBalance.VoucherTypeId = infoPurchaseReturnMaster.VoucherTypeId; infoPartyBalance.VoucherNo = infoPurchaseReturnMaster.VoucherNo; infoPartyBalance.InvoiceNo = infoPurchaseReturnMaster.InvoiceNo; infoPartyBalance.AgainstVoucherTypeId = 0; infoPartyBalance.AgainstVoucherNo = "NA"; infoPartyBalance.AgainstInvoiceNo = "NA"; infoPartyBalance.ReferenceType = "New"; } infoPartyBalance.Debit = infoPurchaseReturnMaster.TotalAmount; infoPartyBalance.Credit = 0; infoPartyBalance.CreditPeriod = 0; infoPartyBalance.ExchangeRateId = infoPurchaseReturnMaster.ExchangeRateId; infoPartyBalance.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoPartyBalance.Extra1 = string.Empty; infoPartyBalance.Extra2 = string.Empty; BllPartyBalance.PartyBalanceAdd(infoPartyBalance); } foreach (DataGridViewRow item in dgvPurchaseReturnTax.Rows) { if (item.Cells["dgvtxtTaxId"].Value != null) { if (Convert.ToDecimal(item.Cells["dgvtxtAmounts"].Value.ToString()) > 0) { infoPurchaseReturnBillTax.PurchaseReturnMasterId = (btnSave.Text == "Save") ? decPurchaseReturnMasterIds : decPurchaseReturnMasterIds; infoPurchaseReturnBillTax.TaxId = Convert.ToDecimal(item.Cells["dgvtxtTaxId"].Value.ToString()); infoPurchaseReturnBillTax.TaxAmount = (item.Cells["dgvtxtAmounts"].Value == null) ? 0 : Convert.ToDecimal(item.Cells["dgvtxtAmounts"].Value.ToString()); infoPurchaseReturnBillTax.Extra1 = string.Empty; infoPurchaseReturnBillTax.Extra2 = string.Empty; BllPurchaseReturn.PurchaseReturnBilltaxAdd(infoPurchaseReturnBillTax); } } } if (btnSave.Text == "Save") { Messages.SavedMessage(); if (cbxPrintAfterSave.Checked) { if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decPurchaseReturnMasterIds); } else { Print(decPurchaseReturnMasterIds); } } Clear(); } else { decDiscount = Convert.ToDecimal(txtBillDiscount.Text); Messages.UpdatedMessage(); if (cbxPrintAfterSave.Checked) { if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decPurchaseReturnMasterId); } else { Print(decPurchaseReturnMasterId); } } if (frmPurchaseReturnRegisterObj != null) { frmPurchaseReturnRegisterObj.GridFill(); frmPurchaseReturnRegisterObj.Enabled = true; } if (ObjPurchaseReturnReport != null) { ObjPurchaseReturnReport.PurchaseReturnReportGridFill(); ObjPurchaseReturnReport.Enabled = true; } if (frmLedgerDetailsObj != null) { frmLedgerDetailsObj.LedgerDetailsView(); frmLedgerDetailsObj.Enabled = true; } this.Close(); } } catch (Exception ex) { MessageBox.Show("PR:49" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }