/// <summary> /// Function to update the details /// </summary> public void EditFunction() { try { ExchangeRateBll BllExchangeRate = new ExchangeRateBll(); InfoSalesMaster.SalesMasterId = decSalesMasterId; InfoSalesMaster.InvoiceNo = txtVoucherNo.Text.Trim(); InfoSalesMaster.AdditionalCost = 0; InfoSalesMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()); InfoSalesMaster.BillDiscount = Convert.ToDecimal(txtBillDiscount.Text); InfoSalesMaster.CounterId = Convert.ToDecimal(cmbCounter.SelectedValue.ToString()); InfoSalesMaster.CreditPeriod = 0; InfoSalesMaster.CustomerName = ""; InfoSalesMaster.Date = Convert.ToDateTime(txtDate.Text.Trim()); InfoSalesMaster.DeliveryNoteMasterId = 0; if (cmbSalesMan.SelectedValue.ToString() != null) { InfoSalesMaster.EmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString()); } else { InfoSalesMaster.EmployeeId = 0; } decimal decExachangeRateId = BllExchangeRate.ExchangerateViewByCurrencyId(PublicVariables._decCurrencyId); InfoSalesMaster.ExchangeRateId = decExachangeRateId; InfoSalesMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; InfoSalesMaster.GrandTotal = Convert.ToDecimal(txtGrandTotal.Text.Trim()); InfoSalesMaster.LrNo = string.Empty; InfoSalesMaster.Narration = txtNarration.Text.Trim(); InfoSalesMaster.OrderMasterId = 0; InfoSalesMaster.POS = true; InfoSalesMaster.PricinglevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString()); InfoSalesMaster.QuotationMasterId = 0; InfoSalesMaster.SalesAccount = Convert.ToDecimal(cmbSalesAccount.SelectedValue.ToString()); InfoSalesMaster.TaxAmount = Convert.ToDecimal(lblTaxTotalAmount.Text); InfoSalesMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text); InfoSalesMaster.TransportationCompany = ""; InfoSalesMaster.UserId = PublicVariables._decCurrentUserId; InfoSalesMaster.VoucherTypeId = DecPOSVoucherTypeId; if (isAutomatic) { InfoSalesMaster.SuffixPrefixId = decPOSSuffixPrefixId; } else { InfoSalesMaster.SuffixPrefixId = 0; } if (isAutomatic) { InfoSalesMaster.VoucherNo = strVoucherNo; } else { InfoSalesMaster.VoucherNo = txtVoucherNo.Text.Trim(); } InfoSalesMaster.ExtraDate = DateTime.Now; InfoSalesMaster.Extra1 = string.Empty; InfoSalesMaster.Extra2 = string.Empty; BllSalesInvoice.SalesMasterEdit(InfoSalesMaster); decimal dcAgainstVopucherTypeId = 0; string strAgainstVoucherNo = "NA"; BllStockPosting.StockPostingDeleteByagainstVoucherTypeIdAndagainstVoucherNoAndVoucherNoAndVoucherType(dcAgainstVopucherTypeId, strAgainstVoucherNo, strVoucherNo, InfoSalesMaster.VoucherTypeId); BllLedgerPosting.LedgerPostDelete(InfoSalesMaster.VoucherNo, InfoSalesMaster.VoucherTypeId); removeSalesInvoiceDetails(); SalesInvoiceDetailsEdit(); Messages.UpdatedMessage(); if (objfrmSalesInvoiceRegister != null) { if (cbxPrintAfterSave.Checked) { SettingsBll BllSettings = new SettingsBll(); if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decSalesMasterId); } else { Print(decSalesMasterId); } } objfrmSalesInvoiceRegister.gridFill(); } if (frmSalesReportObj != null) { if (cbxPrintAfterSave.Checked) { SettingsBll BllSettings = new SettingsBll(); if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decSalesMasterId); } else { Print(decSalesMasterId); } } frmSalesReportObj.gridFill(); } this.Close(); } catch (Exception ex) { MessageBox.Show("POS: 50" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save An items to table /// </summary> public void SaveFunction() { LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); UnitConvertionBll bllUnitConversion = new UnitConvertionBll(); ExchangeRateBll BllExchangeRate = new ExchangeRateBll(); try { InfoSalesMaster.InvoiceNo = txtVoucherNo.Text.Trim(); InfoSalesMaster.AdditionalCost = 0; InfoSalesMaster.LedgerId = Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()); InfoSalesMaster.BillDiscount = Convert.ToDecimal(txtBillDiscount.Text); if (cmbCounter.SelectedIndex > -1) { InfoSalesMaster.CounterId = Convert.ToDecimal(cmbCounter.SelectedValue.ToString()); } else { InfoSalesMaster.CounterId = 0; } InfoSalesMaster.CreditPeriod = 0; InfoSalesMaster.CustomerName = string.Empty; InfoSalesMaster.Date = Convert.ToDateTime(txtDate.Text); InfoSalesMaster.DeliveryNoteMasterId = 0; if (cmbSalesMan.SelectedValue.ToString() != null) { InfoSalesMaster.EmployeeId = Convert.ToDecimal(cmbSalesMan.SelectedValue.ToString()); } else { InfoSalesMaster.EmployeeId = 0; } decimal decExachangeRateId = BllExchangeRate.ExchangerateViewByCurrencyId(PublicVariables._decCurrencyId); InfoSalesMaster.ExchangeRateId = decExachangeRateId; InfoSalesMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; InfoSalesMaster.GrandTotal = Convert.ToDecimal(txtGrandTotal.Text.Trim()); InfoSalesMaster.LrNo = string.Empty; InfoSalesMaster.Narration = txtNarration.Text.Trim(); InfoSalesMaster.OrderMasterId = 0; InfoSalesMaster.POS = true; if (cmbPricingLevel.SelectedValue.ToString() != null) { InfoSalesMaster.PricinglevelId = Convert.ToDecimal(cmbPricingLevel.SelectedValue.ToString()); } else { InfoSalesMaster.PricinglevelId = 0; } InfoSalesMaster.QuotationMasterId = 0; InfoSalesMaster.SalesAccount = Convert.ToDecimal(cmbSalesAccount.SelectedValue.ToString()); InfoSalesMaster.TaxAmount = Convert.ToDecimal(lblTaxTotalAmount.Text.ToString()); InfoSalesMaster.TotalAmount = Convert.ToDecimal(txtTotalAmount.Text); InfoSalesMaster.TransportationCompany = string.Empty; InfoSalesMaster.UserId = PublicVariables._decCurrentUserId; InfoSalesMaster.VoucherTypeId = DecPOSVoucherTypeId; if (isAutomatic) { InfoSalesMaster.SuffixPrefixId = decPOSSuffixPrefixId; InfoSalesMaster.VoucherNo = strVoucherNo; } else { InfoSalesMaster.SuffixPrefixId = 0; InfoSalesMaster.VoucherNo = txtVoucherNo.Text; } InfoSalesMaster.ExtraDate = DateTime.Now; InfoSalesMaster.Extra1 = string.Empty; InfoSalesMaster.Extra2 = string.Empty; decSalesMasterId = BllSalesInvoice.SalesMasterAdd(InfoSalesMaster); int inRowCount = dgvPointOfSales.RowCount; InfoSalesDetails.SalesMasterId = decSalesMasterId; InfoSalesDetails.ExtraDate = DateTime.Now; InfoSalesDetails.Extra1 = string.Empty; InfoSalesDetails.Extra2 = string.Empty; for (int inI = 0; inI < inRowCount; inI++) { if (dgvPointOfSales.Rows[inI].Cells["dgvtxtProductName"].Value != null && dgvPointOfSales.Rows[inI].Cells["dgvtxtProductName"].Value.ToString() != string.Empty) { if (dgvPointOfSales.Rows[inI].Cells["dgvtxtQuantity"].Value != null && dgvPointOfSales.Rows[inI].Cells["dgvtxtQuantity"].Value.ToString() != string.Empty) { InfoSalesDetails.SlNo = Convert.ToInt32(dgvPointOfSales.Rows[inI].Cells["dgvtxtSlNo"].Value.ToString()); InfoSalesDetails.ProductId = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtProductId"].Value.ToString()); InfoSalesDetails.Qty = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtQuantity"].Value.ToString()); InfoSalesDetails.Rate = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtRate"].Value.ToString()); InfoSalesDetails.UnitId = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtUnitId"].Value.ToString()); InfoSalesDetails.UnitConversionId = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtunitconversionId"].Value.ToString()); InfoSalesDetails.Discount = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtDiscount"].Value.ToString()); InfoSalesDetails.TaxId = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxttaxid"].Value.ToString()); InfoSalesDetails.BatchId = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtBatchId"].Value.ToString()); InfoSalesDetails.GodownId = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtGodownId"].Value.ToString()); InfoSalesDetails.RackId = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtRackId"].Value.ToString()); InfoSalesDetails.TaxAmount = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtTaxAmount"].Value.ToString()); InfoSalesDetails.GrossAmount = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtGrossValue"].Value.ToString()); InfoSalesDetails.NetAmount = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtNetAmount"].Value.ToString()); InfoSalesDetails.Amount = Convert.ToDecimal(dgvPointOfSales.Rows[inI].Cells["dgvtxtTotalAmount"].Value.ToString()); BllSalesInvoice.SalesDetailsAdd(InfoSalesDetails); infoStockPosting.Date = InfoSalesMaster.Date; infoStockPosting.VoucherTypeId = DecPOSVoucherTypeId; infoStockPosting.VoucherNo = strVoucherNo; infoStockPosting.InvoiceNo = txtVoucherNo.Text.Trim(); infoStockPosting.AgainstVoucherTypeId = 0; infoStockPosting.AgainstVoucherNo = "NA"; infoStockPosting.AgainstInvoiceNo = "NA"; infoStockPosting.ProductId = InfoSalesDetails.ProductId; infoStockPosting.BatchId = InfoSalesDetails.BatchId; infoStockPosting.UnitId = InfoSalesDetails.UnitId; infoStockPosting.GodownId = InfoSalesDetails.GodownId; infoStockPosting.RackId = InfoSalesDetails.RackId; infoStockPosting.InwardQty = 0; infoStockPosting.OutwardQty = InfoSalesDetails.Qty / bllUnitConversion.UnitConversionRateByUnitConversionId(InfoSalesDetails.UnitConversionId); ; infoStockPosting.Rate = InfoSalesDetails.Rate; infoStockPosting.FinancialYearId = InfoSalesMaster.FinancialYearId; infoStockPosting.Extra1 = string.Empty; infoStockPosting.Extra2 = string.Empty; BllStockPosting.StockPostingAdd(infoStockPosting); } } } int inTaxRowCount = dgvPOSTax.RowCount; InfoSalesBillTax.SalesMasterId = decSalesMasterId; InfoSalesBillTax.ExtraDate = DateTime.Now; InfoSalesBillTax.Extra1 = string.Empty; InfoSalesBillTax.Extra2 = string.Empty; for (int inI = 0; inI < inTaxRowCount; inI++) { if (dgvPOSTax.Rows[inI].Cells["dgvtxttax"].Value != null && dgvPOSTax.Rows[inI].Cells["dgvtxttax"].Value.ToString() != string.Empty) { if (dgvPOSTax.Rows[inI].Cells["dgvtxtTaxAmt"].Value != null && dgvPOSTax.Rows[inI].Cells["dgvtxtTaxAmt"].Value.ToString() != string.Empty) { InfoSalesBillTax.TaxId = Convert.ToInt32(dgvPOSTax.Rows[inI].Cells["dgvtxttax"].Value.ToString()); InfoSalesBillTax.TaxAmount = Convert.ToDecimal(dgvPOSTax.Rows[inI].Cells["dgvtxtTaxAmt"].Value.ToString()); BllSalesInvoice.SalesBillTaxAdd(InfoSalesBillTax); } } } ledgerPostingAdd(); if (BllSalesInvoice.SalesInvoiceInvoicePartyCheckEnableBillByBillOrNot(Convert.ToDecimal(cmbCashOrParty.SelectedValue.ToString()))) { partyBalanceAdd(); } Messages.SavedMessage(); if (cbxPrintAfterSave.Checked) { SettingsBll BllSettings = new SettingsBll(); if (BllSettings.SettingsStatusCheck("Printer") == "Dot Matrix") { PrintForDotMatrix(decSalesMasterId); } else { Print(decSalesMasterId); } } ClearFunctions(); } catch (Exception ex) { MessageBox.Show("POS:44" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save values to partyBalance table /// </summary> public void partyBalance() { try { PartyBalanceInfo infoPatryBalance = new PartyBalanceInfo(); PartyBalanceBll BllPartyBalance = new PartyBalanceBll(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); ExchangeRateBll BllExchangeRate = new ExchangeRateBll(); if (decOpeningBlnc > 0) { if (cmbBillbyBill.Text == "Yes") { infoPatryBalance.Date = PublicVariables._dtFromDate; infoPatryBalance.LedgerId = decledgerid; infoPatryBalance.VoucherTypeId = 1; infoPatryBalance.VoucherNo = decledgerid.ToString(); infoPatryBalance.AgainstVoucherTypeId = 0; infoPatryBalance.AgainstVoucherNo = "0"; infoPatryBalance.ReferenceType = "New"; if (cmbDrorCr.Text == "Dr") { infoPatryBalance.Debit = decOpeningBlnc; infoPatryBalance.Credit = 0; } else { infoPatryBalance.Debit = 0; infoPatryBalance.Credit = decOpeningBlnc; } infoPatryBalance.InvoiceNo = decledgerid.ToString(); infoPatryBalance.AgainstInvoiceNo = "0"; infoPatryBalance.CreditPeriod = 0; infoPatryBalance.ExchangeRateId = BllExchangeRate.ExchangerateViewByCurrencyId(PublicVariables._decCurrencyId); infoPatryBalance.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoPatryBalance.Extra1 = string.Empty; infoPatryBalance.Extra2 = string.Empty; } BllPartyBalance.PartyBalanceAdd(infoPatryBalance); } } catch (Exception ex) { MessageBox.Show("Cus15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }