/// <summary> /// Function to fill the details while calling from register or report /// </summary> public void FillRegisterOrReport() { StockJournalBll BllStockJournal = new StockJournalBll(); StockJournalMasterInfo infoStockJournalMaster = new StockJournalMasterInfo(); StockJournalDetailsInfo infoStockJournalDetails = new StockJournalDetailsInfo(); AditionalCostBll bllAdditionalCost = new AditionalCostBll(); VoucherTypeBll BllVoucherType = new VoucherTypeBll(); try { isFillMode = true; btnSave.Text = "Update"; cmbFinishedGoods.Enabled = false; txtQty.Enabled = false; btnAdd.Enabled = false; dgvConsumption.Rows.Clear(); dgvProduction.Rows.Clear(); dgvAdditionalCost.Rows.Clear(); List<DataTable> listObjMaster = BllStockJournal.StockJournalMasterFillForRegisterOrReport(decStockJournalMasterIdForEdit); StockJournalVoucherTypeId = Convert.ToDecimal(listObjMaster[0].Rows[0]["voucherTypeId"].ToString()); VoucherTypeInfo infoVoucherType = new VoucherTypeInfo(); infoVoucherType = BllVoucherType.VoucherTypeView(StockJournalVoucherTypeId); this.Text = infoVoucherType.VoucherTypeName; txtDate.Text = listObjMaster[0].Rows[0]["date"].ToString(); strVoucherNo = listObjMaster[0].Rows[0]["voucherNo"].ToString(); decSuffixPrefixId = Convert.ToDecimal(listObjMaster[0].Rows[0]["suffixPrefixId"].ToString()); decVoucherTypeId = Convert.ToDecimal(listObjMaster[0].Rows[0]["voucherTypeId"].ToString()); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(StockJournalVoucherTypeId); dtpDate.Value = Convert.ToDateTime(txtDate.Text); txtNarration.Text = listObjMaster[0].Rows[0]["narration"].ToString(); cmbCurrency.SelectedValue = Convert.ToDecimal(listObjMaster[0].Rows[0]["exchangeRateId"].ToString()); if (listObjMaster[0].Rows[0]["extra1"].ToString() == "Manufacturing") { rbtnManufacturing.Checked = true; } if (listObjMaster[0].Rows[0]["extra1"].ToString() == "Transfer") { rbtnTransfer.Checked = true; } if (listObjMaster[0].Rows[0]["extra1"].ToString() == "Stock Out") { rbtnStockOut.Checked = true; } txtVoucherNo.Text = listObjMaster[0].Rows[0]["invoiceNo"].ToString(); DataSet dsDetails = BllStockJournal.StockJournalDetailsForRegisterOrReport(decStockJournalMasterIdForEdit); DataTable dtblConsumption = dsDetails.Tables[0]; if (dsDetails.Tables[0].Rows.Count > 0) { for (int i = 0; i < dtblConsumption.Rows.Count; i++) { dgvConsumption.Rows.Add(); dgvConsumption.Rows[i].HeaderCell.Value = string.Empty; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionStockJournalDetailsId"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["stockJournalDetailsId"].ToString()); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionSlNo"].Value = dtblConsumption.Rows[i]["slno"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionBarcode"].Value = dtblConsumption.Rows[i]["barcode"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].Value = dtblConsumption.Rows[i]["productCode"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductName"].Value = dtblConsumption.Rows[i]["productName"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductId"].Value = dtblConsumption.Rows[i]["productId"].ToString(); IsSetGridValueChange = true; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionQty"].Value = dtblConsumption.Rows[i]["qty"].ToString(); IsSetGridValueChange = false; dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["godownId"].ToString()); dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["rackId"].ToString()); if (dtblConsumption.Rows[i]["batchId"] != null && dtblConsumption.Rows[i]["batchId"].ToString() != "0") { dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["batchId"].ToString()); } else { dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value = string.Empty; } IsSetGridValueChange = true; dgvConsumption.Rows[i].Cells["dgvcmbConsumptionunitId"].Value = Convert.ToDecimal(dtblConsumption.Rows[i]["unitId"].ToString()); IsSetGridValueChange = false; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionUnitConversionId"].Value = dtblConsumption.Rows[i]["unitConversionId"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionBarcode"].ReadOnly = true; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductCode"].ReadOnly = true; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductName"].ReadOnly = true; dgvConsumption.Rows[i].Cells["dgvtxtConsumptionRate"].Value = dtblConsumption.Rows[i]["rate"].ToString(); dgvConsumption.Rows[i].Cells["dgvtxtConsumptionAmount"].Value = dtblConsumption.Rows[i]["amount"].ToString(); dgvConsumption.Rows[i].HeaderCell.Value = ""; } } DataTable dtblProduction = dsDetails.Tables[1]; for (int i = 0; i < dtblProduction.Rows.Count; i++) { dgvProduction.Rows.Add(); dgvProduction.Rows[i].HeaderCell.Value = string.Empty; dgvProduction.Rows[i].Cells["dgvtxtProductionStockJournalDetailsId"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["stockJournalDetailsId"].ToString()); dgvProduction.Rows[i].Cells["dgvtxtProductionSlNo"].Value = dtblProduction.Rows[i]["slno"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionBarcode"].Value = dtblProduction.Rows[i]["barcode"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].Value = dtblProduction.Rows[i]["productCode"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionProductName"].Value = dtblProduction.Rows[i]["productName"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value = dtblProduction.Rows[i]["productId"].ToString(); IsSetGridValueChange = true; dgvProduction.Rows[i].Cells["dgvtxtProductionQty"].Value = dtblProduction.Rows[i]["qty"].ToString(); IsSetGridValueChange = false; if (rbtnManufacturing.Checked) { cmbFinishedGoods.SelectedValue = dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value; if (cmbFinishedGoods.SelectedValue != null) { cmbFinishedGoods.Enabled = true; txtQty.Enabled = true; btnAdd.Enabled = true; txtQty.Text = dtblProduction.Rows[i]["qty"].ToString(); } } dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["godownId"].ToString()); dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["rackId"].ToString()); if (dtblProduction.Rows[i]["batchId"] != null && dtblProduction.Rows[i]["batchId"].ToString() != string.Empty) { dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["batchId"].ToString()); } else { dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value = string.Empty; } IsSetGridValueChange = true; dgvProduction.Rows[i].Cells["dgvcmbProductionunitId"].Value = Convert.ToDecimal(dtblProduction.Rows[i]["unitId"].ToString()); IsSetGridValueChange = false; dgvProduction.Rows[i].Cells["dgvtxtProductionUnitConversionId"].Value = dtblProduction.Rows[i]["unitConversionId"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionBarcode"].ReadOnly = true; dgvProduction.Rows[i].Cells["dgvtxtProductionProductCode"].ReadOnly = true; dgvProduction.Rows[i].Cells["dgvtxtProductionProductName"].ReadOnly = true; dgvProduction.Rows[i].Cells["dgvtxtProductionRate"].Value = dtblProduction.Rows[i]["rate"].ToString(); dgvProduction.Rows[i].Cells["dgvtxtProductionAmount"].Value = dtblProduction.Rows[i]["amount"].ToString(); } DataSet dsAdditionalCost = bllAdditionalCost.StockJournalAdditionalCostForRegisteOrReport(strVoucherNo, decVoucherTypeId); if (dsAdditionalCost.Tables[0].Rows.Count > 0) { DataTable dtblCashOrBank = dsAdditionalCost.Tables[0]; cmbCashOrBank.SelectedValue = Convert.ToDecimal(dtblCashOrBank.Rows[0]["ledgerId"]); } if (dsAdditionalCost.Tables[1].Rows.Count > 0) { DataTable dtblIndirectExpenses = dsAdditionalCost.Tables[1]; int inRowIndexAdditional = 0; for (int i = 0; i < dtblIndirectExpenses.Rows.Count; i++) { dgvAdditionalCost.Rows.Add(); dgvAdditionalCost.Rows[i].HeaderCell.Value = string.Empty; dgvAdditionalCost.Rows[i].Cells["dgvtxtAdditionalCostSlNo"].Value = ++inRowIndexAdditional; dgvAdditionalCost.Rows[i].Cells["dgvcmbAdditionalCostLedger"].Value = Convert.ToDecimal(dtblIndirectExpenses.Rows[i]["ledgerId"].ToString()); dgvAdditionalCost.Rows[i].Cells["dgvtxtAdditionalCostAmount"].Value = dtblIndirectExpenses.Rows[i]["debit"].ToString(); } } grandTotalAmountCalculationConsumption(); grandTotalAmountCalculationProduction(); TotalAdditionalCostAmount(); btnDelete.Enabled = true; if (isAutomatic) { txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; } gbxTransactionType.Enabled = false; isFillMode = false; } catch (Exception ex) { MessageBox.Show("SJ:50" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click to print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvStockJournalReport.RowCount > 0) { frmReport frmReportObj = new frmReport(); frmReport frmReportOpen = Application.OpenForms["frmReport"] as frmReport; DataSet ds = new DataSet(); FinancialStatementBll bllFinancialStatement = new FinancialStatementBll(); StockJournalBll BllStockJournal = new StockJournalBll(); List<DataTable> listCompany = new List<DataTable>(); List<DataTable> listObjStockJournal = new List<DataTable>(); listCompany = bllFinancialStatement.DayBookReportPrintCompany(); listObjStockJournal = BllStockJournal.StockJournalReportGrideFill(Convert.ToDateTime(txtFromDate.Text), Convert.ToDateTime(txtToDate.Text), Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), txtVoucherNo.Text, txtProductCode.Text, txtProductName.Text); ds.Tables.Add(listCompany[0]); ds.Tables.Add(listObjStockJournal[0]); if (frmReportOpen == null) { frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.StockJournalReportPrint(ds); } else { frmReportOpen.MdiParent = formMDI.MDIObj; frmReportOpen.StockJournalReportPrint(ds); if (frmReportOpen.WindowState == FormWindowState.Minimized) { frmReportOpen.WindowState = FormWindowState.Normal; } } } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("SRR10:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to clear the fields /// </summary> public void Clear() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); StockJournalBll BllStockJournal = new StockJournalBll(); if (isAutomatic) { if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); if (Convert.ToDecimal(strVoucherNo) != BllStockJournal.StockJournalMasterMaxPlusOne(decVoucherTypeId)) { strVoucherNo = BllStockJournal.StockJournalMasterMax(decVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); if (BllStockJournal.StockJournalMasterMax(decVoucherTypeId).ToString() == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); } } SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.Text = strInvoiceNo; txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; txtVoucherNo.Text = string.Empty; strInvoiceNo = txtVoucherNo.Text.Trim(); } if (PrintAfetrSave()) { cbxPrintAfterSave.Checked = true; } else { cbxPrintAfterSave.Checked = false; } btnDelete.Enabled = false; btnSave.Text = "Save"; gbxTransactionType.Enabled = true; cmbFinishedGoods.Enabled = true; txtQty.Enabled = true; btnAdd.Enabled = true; VoucherDate(); dgvConsumption.Rows.Clear(); dgvProduction.Rows.Clear(); dgvAdditionalCost.Rows.Clear(); cmbFinishedGoods.Text = string.Empty; txtQty.Text = String.Empty; txtNarration.Text = string.Empty; lblAdditionalCostAmount.Text = "0.00"; lblConsumptionAmount.Text = "0.00"; lblProductionAmount.Text = "0.00"; } catch (Exception ex) { MessageBox.Show("SJ:29" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to delete stock journal /// </summary> public void DeleteFunction() { StockJournalBll BllStockJournal = new StockJournalBll(); try { BllStockJournal.StockJournalDeleteAllTables(decStockJournalMasterIdForEdit, decVoucherTypeId, strVoucherNo); Messages.DeletedMessage(); if (frmStockJournalRegisterObj != null) { this.Close(); frmStockJournalRegisterObj.Enabled = true; } else if (frmStockJournelReportObj != null) { this.Close(); frmStockJournelReportObj.Enabled = true; } else if (objVoucherSearch != null) { this.Close(); objVoucherSearch.GridFill(); } else if (frmDayBookObj != null) { this.Close(); } else { Clear(); } } catch (Exception ex) { MessageBox.Show("SJ:35" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call save or edit function /// </summary> public void SaveOrEdit() { bool Isexit = false; StockJournalBll BllStockJournal = new StockJournalBll(); try { dgvConsumption.ClearSelection(); dgvProduction.ClearSelection(); dgvAdditionalCost.ClearSelection(); int inRowConsumption = dgvConsumption.RowCount; int inRowProduction = dgvProduction.RowCount; if (txtVoucherNo.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter voucher number"); txtVoucherNo.Focus(); } else if (BllStockJournal.StockJournalInvoiceNumberCheckExistence(txtVoucherNo.Text.Trim(), 0, decVoucherTypeId) == true && btnSave.Text == "Save") { Messages.InformationMessage("Invoice number already exist"); txtVoucherNo.Focus(); } else if (txtDate.Text.Trim() == string.Empty) { Messages.InformationMessage("Select a date in between financial year"); txtDate.Focus(); } else if (cmbCurrency.SelectedIndex == -1) { Messages.InformationMessage("Select any currency"); cmbCurrency.Focus(); } else { if (rbtnManufacturing.Checked) { if (inRowConsumption - 1 == 0) { Messages.InformationMessage("Can't save Stock Journal without atleast one product with complete details"); dgvConsumption.Focus(); goto Exit; } if (inRowProduction - 1 == 0) { Messages.InformationMessage("Can't save Stock Journal without atleast one product with complete details"); dgvProduction.Focus(); goto Exit; } } if (rbtnTransfer.Checked) { int indgvRowsConsumption = dgvConsumption.Rows.Count; int indgvRowsProduction = dgvProduction.Rows.Count; if (inRowConsumption - 1 == 0) { Messages.InformationMessage("Can't save Stock Journal without atleast one product with complete details"); dgvConsumption.Focus(); goto Exit; } if (inRowProduction - 1 == 0) { Messages.InformationMessage("Can't save Stock Journal without atleast one product with complete details"); dgvProduction.Focus(); goto Exit; } if (indgvRowsConsumption != indgvRowsProduction) { Messages.InformationMessage("Please Tranfer the details"); goto Exit; } for (int i = 0; i < dgvProduction.Rows.Count - 1; i++) { decimal dcConsumption = 0; decimal dcProduction = 0; dcConsumption = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionQty"].Value); dcProduction = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionQty"].Value); if (dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value == null || dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value.ToString() == "1") { Messages.InformationMessage("Rows Contains Invalid entries please fill the Godown Details"); goto Exit; } if (dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value.ToString() == dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value.ToString()) { Messages.InformationMessage(" The Godown should be different"); dgvProduction.Focus(); Isexit = true; break; } if (dcConsumption != dcProduction) { Messages.InformationMessage("The Quantity Should be Same"); goto Exit; } } } if (rbtnStockOut.Checked) { if (inRowConsumption - 1 == 0) { Messages.InformationMessage("Can't save Stock Journal without atleast one product with complete details"); dgvConsumption.Focus(); goto Exit; } } if (!Isexit) { if (RemoveIncompleteRowsFromConsumptionGrid()) { if (!rbtnStockOut.Checked) { if (RemoveIncompleteRowsFromProductionGrid()) { if (dgvConsumption.Rows[0].Cells["dgvtxtConsumptionProductName"].Value == null && dgvConsumption.Rows[0].Cells["dgvtxtConsumptionQty"].Value == null || dgvProduction.Rows[0].Cells["dgvtxtProductionProductName"].Value == null && dgvProduction.Rows[0].Cells["dgvtxtProductionQty"].Value == null) { MessageBox.Show("Can't save Stock Journal without atleast one product with complete details", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); dgvConsumption.ClearSelection(); dgvConsumption.Focus(); goto Exit; } else { if (btnSave.Text == "Save") { if (Messages.SaveConfirmation()) { grandTotalAmountCalculationConsumption(); grandTotalAmountCalculationProduction(); Save(); } } if (btnSave.Text == "Update") { if (Messages.UpdateConfirmation()) { grandTotalAmountCalculationConsumption(); grandTotalAmountCalculationProduction(); Save(); } } } } } else { if (dgvConsumption.Rows[0].Cells["dgvtxtConsumptionProductName"].Value == null || dgvConsumption.Rows[0].Cells["dgvtxtConsumptionProductName"].Value.ToString() == string.Empty && dgvConsumption.Rows[0].Cells["dgvtxtConsumptionQty"].Value == null) { MessageBox.Show("Can't save Stock Journals without atleast one product with complete details", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); dgvConsumption.ClearSelection(); dgvConsumption.Focus(); goto Exit; } if (btnSave.Text == "Save") { if (Messages.SaveConfirmation()) { grandTotalAmountCalculationConsumption(); Save(); } } if (btnSave.Text == "Update") { if (Messages.UpdateConfirmation()) { grandTotalAmountCalculationConsumption(); Save(); } } } } } } Exit: ; } catch (Exception ex) { MessageBox.Show("SJ:40" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save stockjournal /// </summary> public void Save() { try { StockJournalMasterInfo infoStockJournalMaster = new StockJournalMasterInfo(); StockJournalDetailsInfo infoStockJournalDetails = new StockJournalDetailsInfo(); StockJournalBll BllStockJournal = new StockJournalBll(); LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo(); LedgerPostingBll BllLedgerPosting = new LedgerPostingBll(); AdditionalCostInfo infoAdditionalCost = new AdditionalCostInfo(); AditionalCostBll bllAdditionalCost = new AditionalCostBll(); UnitConvertionBll bllUnitConvertion = new UnitConvertionBll(); if (isAutomatic == true) { infoStockJournalMaster.SuffixPrefixId = decSuffixPrefixId; infoStockJournalMaster.VoucherNo = strVoucherNo; } else { infoStockJournalMaster.SuffixPrefixId = 0; infoStockJournalMaster.VoucherNo = strVoucherNo; } infoStockJournalMaster.ExtraDate = DateTime.Now; infoStockJournalMaster.InvoiceNo = txtVoucherNo.Text.Trim(); infoStockJournalMaster.Date = Convert.ToDateTime(txtDate.Text); infoStockJournalMaster.AdditionalCost = Convert.ToDecimal(lblAdditionalCostAmount.Text); infoStockJournalMaster.VoucherNo = strVoucherNo; infoStockJournalMaster.VoucherTypeId = decVoucherTypeId; infoStockJournalMaster.Narration = txtNarration.Text.Trim(); infoStockJournalMaster.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoStockJournalMaster.ExchangeRateId = Convert.ToDecimal(cmbCurrency.SelectedValue); if (rbtnManufacturing.Checked) { infoStockJournalMaster.Extra1 = "Manufacturing"; } if (rbtnTransfer.Checked) { infoStockJournalMaster.Extra1 = "Transfer"; } if (rbtnStockOut.Checked) { infoStockJournalMaster.Extra1 = "Stock Out"; } infoStockJournalMaster.Extra2 = string.Empty; if (btnSave.Text == "Save") { decStockMasterId = BllStockJournal.StockJournalMasterAdd(infoStockJournalMaster); } else { infoStockJournalMaster.StockJournalMasterId = decStockJournalMasterIdForEdit; BllStockJournal.StockJournalMasterEdit(infoStockJournalMaster); RemoveRowStockJournalConsumptionDetails(); RemoveRowStockJournalProductionDetails(); RemoveRowStockJournalAdditionalCostDetails(); BllStockPosting.DeleteStockPostingForStockJournalEdit(strVoucherNo, decVoucherTypeId); } if (dgvConsumption.Rows.Count > 0) { int inCount = dgvConsumption.Rows.Count; for (int i = 0; i < inCount - 1; i++) { if (btnSave.Text == "Save") { infoStockJournalDetails.StockJournalMasterId = decStockMasterId; } else { infoStockJournalMaster.StockJournalMasterId = decStockJournalMasterIdForEdit; } infoStockJournalDetails.Extra1 = string.Empty; infoStockJournalDetails.Extra2 = string.Empty; infoStockJournalDetails.ExtraDate = DateTime.Now; infoStockJournalDetails.ProductId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductId"].Value); infoStockJournalDetails.Qty = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionQty"].Value); infoStockJournalDetails.Rate = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionRate"].Value); infoStockJournalDetails.UnitId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionunitId"].Value); infoStockJournalDetails.UnitConversionId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionunitConversionId"].Value); if (btnSave.Text == "Update") { infoStockJournalDetails.StockJournalMasterId = decStockJournalMasterIdForEdit; if (dgvConsumption.Rows[i].Cells["dgvtxtConsumptionStockJournalDetailsId"].Value == null || dgvConsumption.Rows[i].Cells["dgvtxtConsumptionStockJournalDetailsId"].Value.ToString() == string.Empty) { if (dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value != null && dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value.ToString() != string.Empty) { infoStockJournalDetails.BatchId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value); } else { infoStockJournalDetails.BatchId = 0; } if (dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value != null && dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value.ToString() != string.Empty) { infoStockJournalDetails.GodownId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value); } else { infoStockJournalDetails.GodownId = 0; } if (dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value != null && dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value.ToString() != string.Empty) { infoStockJournalDetails.RackId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value); } else { infoStockJournalDetails.RackId = 0; } infoStockJournalDetails.Amount = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionAmount"].Value); infoStockJournalDetails.ConsumptionOrProduction = "Consumption"; infoStockJournalDetails.Slno = Convert.ToInt32(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionSlNo"].Value); BllStockJournal.StockJournalDetailsAdd(infoStockJournalDetails); } else { infoStockJournalDetails.StockJournalDetailsId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionStockJournalDetailsId"].Value); if (dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value != null && dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value.ToString() != string.Empty) { infoStockJournalDetails.BatchId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value); } else { infoStockJournalDetails.BatchId = 0; } if (dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value != null && dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value.ToString() != string.Empty) { infoStockJournalDetails.GodownId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value); } else { infoStockJournalDetails.GodownId = 0; } if (dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value != null && dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value.ToString() != string.Empty) { infoStockJournalDetails.RackId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value); } else { infoStockJournalDetails.RackId = 0; } infoStockJournalDetails.Amount = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionAmount"].Value); infoStockJournalDetails.ConsumptionOrProduction = "Consumption"; infoStockJournalDetails.Slno = Convert.ToInt32(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionSlNo"].Value); BllStockJournal.StockJournalDetailsEdit(infoStockJournalDetails); } } else { infoStockJournalDetails.BatchId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value); infoStockJournalDetails.GodownId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value); infoStockJournalDetails.RackId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value); infoStockJournalDetails.Amount = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionAmount"].Value); infoStockJournalDetails.ConsumptionOrProduction = "Consumption"; infoStockJournalDetails.Slno = Convert.ToInt32(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionSlNo"].Value); BllStockJournal.StockJournalDetailsAdd(infoStockJournalDetails); } //Stock Posting Add if (btnSave.Text == "Update") { infoStockPosting.BatchId = infoStockJournalDetails.BatchId; infoStockPosting.Date = Convert.ToDateTime(txtDate.Text); infoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoStockPosting.GodownId = infoStockJournalDetails.GodownId; infoStockPosting.InwardQty = 0; infoStockPosting.OutwardQty = infoStockJournalDetails.Qty / bllUnitConvertion.UnitConversionRateByUnitConversionId(infoStockJournalDetails.UnitConversionId); infoStockPosting.ProductId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductId"].Value); infoStockPosting.RackId = infoStockJournalDetails.RackId; infoStockPosting.Rate = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionRate"].Value); infoStockPosting.UnitId = infoStockJournalDetails.UnitId; infoStockPosting.InvoiceNo = txtVoucherNo.Text.Trim(); infoStockPosting.VoucherNo = strVoucherNo; infoStockPosting.VoucherTypeId = decVoucherTypeId; infoStockPosting.AgainstVoucherTypeId = 0; infoStockPosting.AgainstInvoiceNo = "NA"; infoStockPosting.AgainstVoucherNo = "NA"; infoStockPosting.Extra1 = string.Empty; infoStockPosting.Extra2 = string.Empty; BllStockPosting.StockPostingAdd(infoStockPosting); } else { infoStockPosting.BatchId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionBatch"].Value); infoStockPosting.Date = Convert.ToDateTime(txtDate.Text); infoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoStockPosting.GodownId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionGodown"].Value); infoStockPosting.InwardQty = 0; infoStockPosting.OutwardQty = infoStockJournalDetails.Qty / bllUnitConvertion.UnitConversionRateByUnitConversionId(infoStockJournalDetails.UnitConversionId); infoStockPosting.ProductId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionProductId"].Value); infoStockPosting.RackId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionRack"].Value); infoStockPosting.Rate = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvtxtConsumptionRate"].Value); infoStockPosting.UnitId = Convert.ToDecimal(dgvConsumption.Rows[i].Cells["dgvcmbConsumptionunitId"].Value); infoStockPosting.InvoiceNo = txtVoucherNo.Text.Trim(); infoStockPosting.VoucherNo = strVoucherNo; infoStockPosting.VoucherTypeId = decVoucherTypeId; infoStockPosting.AgainstVoucherTypeId = 0; infoStockPosting.AgainstInvoiceNo = "NA"; infoStockPosting.AgainstVoucherNo = "NA"; infoStockPosting.Extra1 = string.Empty; infoStockPosting.Extra2 = string.Empty; BllStockPosting.StockPostingAdd(infoStockPosting); } } } if (dgvProduction.Rows.Count > 0) { int inCount = dgvProduction.Rows.Count; for (int i = 0; i < inCount - 1; i++) { if (btnSave.Text == "Update") { infoStockJournalMaster.StockJournalMasterId = decStockJournalMasterIdForEdit; } else { infoStockJournalDetails.StockJournalMasterId = decStockMasterId; } infoStockJournalDetails.Extra1 = string.Empty; infoStockJournalDetails.Extra2 = string.Empty; infoStockJournalDetails.ExtraDate = DateTime.Now; infoStockJournalDetails.ProductId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value); infoStockJournalDetails.Qty = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionQty"].Value); infoStockJournalDetails.Rate = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionRate"].Value); infoStockJournalDetails.UnitId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionunitId"].Value); infoStockJournalDetails.UnitConversionId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionunitConversionId"].Value); if (btnSave.Text == "Update") { infoStockJournalDetails.StockJournalMasterId = decStockJournalMasterIdForEdit; if (dgvProduction.Rows[i].Cells["dgvtxtProductionStockJournalDetailsId"].Value == null || dgvProduction.Rows[i].Cells["dgvtxtProductionStockJournalDetailsId"].Value.ToString() == string.Empty) { if (dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value != null && dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value.ToString() != string.Empty) { infoStockJournalDetails.BatchId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value); } else { infoStockJournalDetails.BatchId = 0; } if (dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value != null && dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value.ToString() != string.Empty) { infoStockJournalDetails.GodownId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value); } else { infoStockJournalDetails.GodownId = 0; } if (dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value != null && dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value.ToString() != string.Empty) { infoStockJournalDetails.RackId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value); } else { infoStockJournalDetails.RackId = 0; } infoStockJournalDetails.Amount = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionAmount"].Value); infoStockJournalDetails.ConsumptionOrProduction = "Production"; infoStockJournalDetails.Slno = Convert.ToInt32(dgvProduction.Rows[i].Cells["dgvtxtProductionSlNo"].Value); BllStockJournal.StockJournalDetailsAdd(infoStockJournalDetails); } else { infoStockJournalDetails.StockJournalDetailsId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionStockJournalDetailsId"].Value); if (dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value != null && dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value.ToString() != string.Empty) { infoStockJournalDetails.BatchId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value); } else { infoStockJournalDetails.BatchId = 0; } if (dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value != null && dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value.ToString() != string.Empty) { infoStockJournalDetails.GodownId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value); } else { infoStockJournalDetails.GodownId = 0; } if (dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value != null && dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value.ToString() != string.Empty) { infoStockJournalDetails.RackId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value); } else { infoStockJournalDetails.RackId = 0; } infoStockJournalDetails.Amount = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionAmount"].Value); infoStockJournalDetails.ConsumptionOrProduction = "Production"; infoStockJournalDetails.Slno = Convert.ToInt32(dgvProduction.Rows[i].Cells["dgvtxtProductionSlNo"].Value); BllStockJournal.StockJournalDetailsEdit(infoStockJournalDetails); } } else { infoStockJournalDetails.BatchId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value); infoStockJournalDetails.GodownId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value); infoStockJournalDetails.RackId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value); infoStockJournalDetails.Amount = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionAmount"].Value); infoStockJournalDetails.ConsumptionOrProduction = "Production"; infoStockJournalDetails.Slno = Convert.ToInt32(dgvProduction.Rows[i].Cells["dgvtxtProductionSlNo"].Value); BllStockJournal.StockJournalDetailsAdd(infoStockJournalDetails); } //Stock Posting Add if (btnSave.Text == "Save") { infoStockPosting.BatchId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionBatch"].Value); infoStockPosting.Date = Convert.ToDateTime(txtDate.Text); infoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoStockPosting.GodownId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionGodown"].Value); infoStockPosting.InwardQty = infoStockJournalDetails.Qty / bllUnitConvertion.UnitConversionRateByUnitConversionId(infoStockJournalDetails.UnitConversionId); infoStockPosting.OutwardQty = 0; infoStockPosting.ProductId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value); infoStockPosting.RackId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionRack"].Value); infoStockPosting.Rate = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionRate"].Value); infoStockPosting.UnitId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvcmbProductionunitId"].Value); infoStockPosting.InvoiceNo = txtVoucherNo.Text.Trim(); infoStockPosting.VoucherNo = strVoucherNo; infoStockPosting.VoucherTypeId = decVoucherTypeId; infoStockPosting.AgainstVoucherTypeId = 0; infoStockPosting.AgainstInvoiceNo = "NA"; infoStockPosting.AgainstVoucherNo = "NA"; infoStockPosting.Extra1 = string.Empty; infoStockPosting.Extra2 = string.Empty; BllStockPosting.StockPostingAdd(infoStockPosting); } else { infoStockPosting.BatchId = infoStockJournalDetails.BatchId; infoStockPosting.Date = Convert.ToDateTime(txtDate.Text); infoStockPosting.FinancialYearId = PublicVariables._decCurrentFinancialYearId; infoStockPosting.GodownId = infoStockJournalDetails.GodownId; infoStockPosting.InwardQty = infoStockJournalDetails.Qty / bllUnitConvertion.UnitConversionRateByUnitConversionId(infoStockJournalDetails.UnitConversionId); infoStockPosting.OutwardQty = 0; infoStockPosting.ProductId = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionProductId"].Value); infoStockPosting.RackId = infoStockJournalDetails.RackId; infoStockPosting.Rate = Convert.ToDecimal(dgvProduction.Rows[i].Cells["dgvtxtProductionRate"].Value); infoStockPosting.UnitId = infoStockJournalDetails.UnitId; infoStockPosting.InvoiceNo = txtVoucherNo.Text.Trim(); infoStockPosting.VoucherNo = strVoucherNo; infoStockPosting.VoucherTypeId = decVoucherTypeId; infoStockPosting.AgainstVoucherTypeId = 0; infoStockPosting.AgainstInvoiceNo = "NA"; infoStockPosting.AgainstVoucherNo = "NA"; infoStockPosting.Extra1 = string.Empty; infoStockPosting.Extra2 = string.Empty; BllStockPosting.StockPostingAdd(infoStockPosting); } } } //....Additional Cost Add...//// if (btnSave.Text == "Update") { BllLedgerPosting.DeleteLedgerPostingForStockJournalEdit(strVoucherNo, decVoucherTypeId);//Delete bllAdditionalCost.DeleteAdditionalCostForStockJournalEdit(strVoucherNo, decVoucherTypeId);//Delete } decimal decGrandTotal = 0; decimal decRate = 0; ExchangeRateBll BllExchangeRate = new ExchangeRateBll(); if (dgvAdditionalCost.Rows.Count > 1) { infoAdditionalCost.Credit = Convert.ToDecimal(lblAdditionalCostAmount.Text); infoAdditionalCost.Debit = 0; infoAdditionalCost.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue); infoAdditionalCost.VoucherNo = strVoucherNo; infoAdditionalCost.VoucherTypeId = decVoucherTypeId; infoAdditionalCost.Extra1 = string.Empty; infoAdditionalCost.Extra2 = string.Empty; infoAdditionalCost.ExtraDate = DateTime.Now; bllAdditionalCost.AdditionalCostAdd(infoAdditionalCost); //....Ledger Posting Add.../// //------------------- Currency Conversion----------------------------- decGrandTotal = Convert.ToDecimal(lblAdditionalCostAmount.Text.Trim()); decRate = BllExchangeRate.ExchangeRateViewByExchangeRateId(Convert.ToDecimal(cmbCurrency.SelectedValue.ToString())); decGrandTotal = decGrandTotal * decRate; //--------------------------------------------------------------- infoLedgerPosting.Credit = decGrandTotal; infoLedgerPosting.Debit = 0; infoLedgerPosting.Date = Convert.ToDateTime(PublicVariables._dtCurrentDate); infoLedgerPosting.DetailsId = 0; infoLedgerPosting.InvoiceNo = txtVoucherNo.Text.Trim(); infoLedgerPosting.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue); infoLedgerPosting.VoucherNo = strVoucherNo; infoLedgerPosting.VoucherTypeId = decVoucherTypeId; infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.ChequeDate = DateTime.Now; infoLedgerPosting.ChequeNo = string.Empty; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; if (btnSave.Text == "Save") { infoLedgerPosting.ExtraDate = DateTime.Now; } BllLedgerPosting.LedgerPostingAdd(infoLedgerPosting); foreach (DataGridViewRow dgvrow in dgvAdditionalCost.Rows) { if (dgvrow.Cells["dgvcmbAdditionalCostLedger"].Value != null) { if (dgvrow.Cells["dgvcmbAdditionalCostLedger"].Value.ToString() != string.Empty) { /*-----------------------------------------Additional Cost Add----------------------------------------------------*/ infoAdditionalCost.Credit = 0; infoAdditionalCost.Debit = Convert.ToDecimal(dgvrow.Cells["dgvtxtAdditionalCostAmount"].Value.ToString()); infoAdditionalCost.LedgerId = Convert.ToDecimal(dgvrow.Cells["dgvcmbAdditionalCostLedger"].Value.ToString()); infoAdditionalCost.VoucherNo = strVoucherNo; infoAdditionalCost.VoucherTypeId = decVoucherTypeId; infoAdditionalCost.Extra1 = string.Empty; infoAdditionalCost.Extra2 = string.Empty; infoAdditionalCost.ExtraDate = DateTime.Now; bllAdditionalCost.AdditionalCostAdd(infoAdditionalCost); /*-----------------------------------------Additional Cost Ledger Posting----------------------------------------------------*/ decimal decTotal = 0; //------------------- Currency Conversion------------------------ decTotal = Convert.ToDecimal(infoAdditionalCost.Debit); decRate = BllExchangeRate.ExchangeRateViewByExchangeRateId(Convert.ToDecimal(cmbCurrency.SelectedValue.ToString())); decTotal = decTotal * decRate; //--------------------------------------------------------------- infoLedgerPosting.Credit = 0; infoLedgerPosting.Debit = decTotal; infoLedgerPosting.Date = Convert.ToDateTime(PublicVariables._dtCurrentDate); infoLedgerPosting.DetailsId = 0; infoLedgerPosting.InvoiceNo = txtVoucherNo.Text.Trim(); infoLedgerPosting.LedgerId = Convert.ToDecimal(dgvrow.Cells["dgvcmbAdditionalCostLedger"].Value.ToString()); infoLedgerPosting.VoucherNo = strVoucherNo; infoLedgerPosting.VoucherTypeId = decVoucherTypeId; infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.ChequeDate = DateTime.Now; infoLedgerPosting.ChequeNo = string.Empty; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; infoLedgerPosting.ExtraDate = DateTime.Now; BllLedgerPosting.LedgerPostingAdd(infoLedgerPosting); } } } } if (btnSave.Text == "Save") { Messages.SavedMessage(); if (cbxPrintAfterSave.Checked) { Print(decStockMasterId); } Clear(); } else { Messages.UpdatedMessage(); if (cbxPrintAfterSave.Checked) { Print(decStockJournalMasterIdForEdit); } this.Close(); } } catch (Exception ex) { MessageBox.Show("SJ:36" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to Remove Row from StockJournalProductionDetails /// </summary> public void RemoveRowStockJournalProductionDetails() { StockJournalBll BllStockJournal = new StockJournalBll(); try { foreach (var strDetailsId in ArrlstOfProductionRemove) { decimal decDeleteId = Convert.ToDecimal(strDetailsId); BllStockJournal.StockJournalDetailsDelete(decDeleteId); } } catch (Exception ex) { MessageBox.Show("SJ:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill product details for production /// </summary> public void ProductDetailsFillProduction(string strProduct, int inRowIndex, string strFillMode) { try { StockJournalBll BllStockJournal = new StockJournalBll(); List<DataTable> listObj = new List<DataTable>(); BatchComboFill(); GodownComboFill(); RackComboFill(); UnitComboFill(); if (strFillMode == "ProductCode") { listObj = BllStockJournal.StockJournalDetailsByProductCode(decVoucherTypeId, strProduct); } else if (strFillMode == "ProductName") { listObj = BllStockJournal.StockJournalDetailsByProductName(decVoucherTypeId, strProduct); } else if (strFillMode == "Barcode") { listObj = BllStockJournal.StockJournalDetailsViewByBarcode(decVoucherTypeId, strProduct); } if (listObj[0].Rows.Count != 0) { dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionProductId"].Value = listObj[0].Rows[0]["productId"]; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionBarcode"].Value = listObj[0].Rows[0]["barcode"]; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionProductCode"].Value = listObj[0].Rows[0]["productCode"]; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionProductName"].Value = listObj[0].Rows[0]["productName"]; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionunitConversionId"].Value = listObj[0].Rows[0]["unitConversionId"]; dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionunitId"].Value = Convert.ToDecimal(listObj[0].Rows[0]["unitId"].ToString()); dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionGodown"].Value = listObj[0].Rows[0]["godownId"]; dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionRack"].Value = listObj[0].Rows[0]["rackId"]; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionRate"].Value = listObj[0].Rows[0]["salesRate"]; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionConversionRate"].Value = listObj[0].Rows[0]["conversionRate"]; dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionBatch"].Value = listObj[0].Rows[0]["batchId"]; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionQty"].Value = string.Empty; if (strFillMode == "Barcode") { dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionBatch"].Value = listObj[0].Rows[0]["batchId"]; } dgvProduction.Rows[inRowIndex].HeaderCell.Value = "X"; dgvProduction.Rows[inRowIndex].HeaderCell.Style.ForeColor = Color.Red; } else { if (dgvProduction.CurrentRow.Index < dgvProduction.RowCount - 1) { dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionBarcode"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionStockJournalDetailsId"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionProductCode"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionProductId"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionProductName"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionConversionRate"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionQty"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionunitId"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionunitConversionId"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionGodown"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionRack"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvcmbProductionBatch"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionRate"].Value = string.Empty; dgvProduction.Rows[inRowIndex].Cells["dgvtxtProductionAmount"].Value = string.Empty; } } } catch (Exception ex) { MessageBox.Show("SJ:18" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to print stock journal /// </summary> /// <param name="decMasterId"></param> public void Print(decimal decMasterId) { StockJournalBll BllStockJournal = new StockJournalBll(); try { DataSet dsStockJournal = BllStockJournal.StockJournalPrinting(decMasterId); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.StockJournalPrinting(dsStockJournal); } catch (Exception ex) { MessageBox.Show("SJ: 53" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }