/// <summary> /// Function to reset form /// </summary> public void Clear() { try { txtVoucherDateFrom.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); txtVoucherDateTo.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); dtpVoucherDateFrom.Value = PublicVariables._dtCurrentDate; dtpVoucherDateFrom.MinDate = PublicVariables._dtFromDate; dtpVoucherDateFrom.MaxDate = PublicVariables._dtToDate; dtpVoucherDateTo.Value = PublicVariables._dtCurrentDate; dtpVoucherDateTo.MinDate = PublicVariables._dtFromDate; dtpVoucherDateTo.MaxDate = PublicVariables._dtToDate; dtpSalaryMonth.Value = PublicVariables._dtCurrentDate; dtpSalaryMonth.MinDate = PublicVariables._dtFromDate; dtpSalaryMonth.MaxDate = PublicVariables._dtToDate; txtVoucherNo.Clear(); cmbVoucherTypeName.SelectedIndex = -1; VoucherTypeNameComboFill(); TransactionsGeneralFill obj = new TransactionsGeneralFill(); obj.CashOrBankComboFill(cmbCashBankAC, false); cmbCashBankAC.SelectedIndex = -1; GridFill(); } catch (Exception ex) { MessageBox.Show("MSR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to reset form /// </summary> public void Clear() { try { txtVoucherDateFrom.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); txtVoucherDateTo.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); dtpVoucherDateFrom.Value = PublicVariables._dtCurrentDate; dtpVoucherDateFrom.MinDate = PublicVariables._dtFromDate; dtpVoucherDateFrom.MaxDate = PublicVariables._dtToDate; dtpVoucherDateTo.Value = PublicVariables._dtCurrentDate; dtpVoucherDateTo.MinDate = PublicVariables._dtFromDate; dtpVoucherDateTo.MaxDate = PublicVariables._dtToDate; dtpSalaryMonth.Value = PublicVariables._dtCurrentDate; dtpSalaryMonth.MinDate = PublicVariables._dtFromDate; dtpSalaryMonth.MaxDate = PublicVariables._dtToDate; txtVoucherNo.Clear(); cmbVoucherTypeName.SelectedIndex = -1; VoucherTypeNameComboFill(); TransactionsGeneralFill obj = new TransactionsGeneralFill(); obj.CashOrBankComboFill(cmbCashBankAC, false); cmbCashBankAC.SelectedIndex = -1; GridFill(); } catch (Exception ex) { formMDI.infoError.ErrorString = "MSR3:" + ex.Message; } }
/// <summary> /// Function to fill Accountledger combobox /// </summary> private void AccountLedgerComboFill() { try { TransactionsGeneralFill TransactionsGeneralFillObj = new TransactionsGeneralFill(); TransactionsGeneralFillObj.CashOrPartyComboFill(cmbAccountLedger, true); } catch (Exception ex) { formMDI.infoError.ErrorString = "ODPO:1" + ex.Message; } }
/// <summary> /// Function to fill Cash/Party combobox /// </summary> public void CashOrPartyComboFill() { try { TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); TransactionGeneralFillObj.CashOrPartyUnderSundryDrComboFill(cmbCashOrParty, true); } catch (Exception ex) { MessageBox.Show("SVR 3 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill CashOrParty combobox /// </summary> public void CashOrPartyComboFill() { try { TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); TransactionGeneralFillObj.CashOrPartyComboFill(cmbCashOrParty, true); } catch (Exception ex) { formMDI.infoError.ErrorString = "PIREP2:" + ex.Message; } }
/// <summary> /// Combofill function of Cash or Bank /// </summary> /// <param name="cmbBankOrcash"></param> public void BankOrCashComboFill(ComboBox cmbBankOrcash) { try { TransactionsGeneralFill Obj = new TransactionsGeneralFill(); Obj.CashOrBankComboFill(cmbBankOrcash, false); } catch (Exception ex) { MessageBox.Show("CV:01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill CashOrParty combobox /// </summary> public void CashOrPartyComboFill() { try { TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); TransactionGeneralFillObj.CashOrPartyComboFill(cmbCashOrParty, true); } catch (Exception ex) { MessageBox.Show("PIREP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Accountledger combobox /// </summary> private void AccountLedgerComboFill() { try { TransactionsGeneralFill TransactionsGeneralFillObj = new TransactionsGeneralFill(); TransactionsGeneralFillObj.CashOrPartyComboFill(cmbAccountLedger, true); } catch (Exception ex) { MessageBox.Show("ODPO:1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// BankOrCashComboFill function /// </summary> private void BankOrCashComboFill() { try { TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); TransactionGeneralFillObj.CashOrBankComboFill(cmbCashOrBank, true); } catch (Exception ex) { MessageBox.Show("RV1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Cash/Party combobox /// </summary> public void CashOrPartyComboFill() { try { TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); TransactionGeneralFillObj.CashOrPartyUnderSundryDrComboFill(cmbCashOrParty, true); cmbCashOrParty.SelectedValue = 0; } catch (Exception ex) { MessageBox.Show("SVRT 7 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void VoucherTypeComboFill() { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); try { transactionGeneralFillObj.VoucherTypeComboFill(cmbVoucherType, "Rejection In", true); } catch (Exception ex) { MessageBox.Show("RIRgstr:03" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Cash/Party combobox /// </summary> /// <param name="cmbCashorParty"></param> public void CashOrPartyComboFill() { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); try { transactionGeneralFillObj.CashOrPartyUnderSundryDrComboFill(cmbCashorParty, true); } catch (Exception ex) { MessageBox.Show("RIRgstr:02" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Salesman combobox /// </summary> public void salesmancombofill() { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); try { transactionGeneralFillObj.SalesmanViewAllForComboFill(cmbSalesMan, true); } catch (Exception ex) { formMDI.infoError.ErrorString = "RIReport3:" + ex.Message; } }
/// <summary> /// Function to fill Salesman combobox /// </summary> public void salesmancombofill() { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); try { transactionGeneralFillObj.SalesmanViewAllForComboFill(cmbSalesMan, true); } catch (Exception ex) { MessageBox.Show("RIReport:03" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fetch ladger Name Cash/Party ComboBox /// </summary> public void CashOrPartyComboFill() { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); try { transactionGeneralFillObj.CashOrPartyUnderSundryDrComboFill(cmbCashorParty, true); } catch (Exception ex) { formMDI.infoError.ErrorString = "RIReport2:" + ex.Message; } }
public void VoucherTypeComboFill() { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); try { transactionGeneralFillObj.VoucherTypeComboFill(cmbVoucherType, "Rejection In", true); } catch (Exception ex) { formMDI.infoError.ErrorString = "RIREG3:" + ex.Message; } }
/// <summary> /// Function to fill Cash/Party combobox /// </summary> public void CashOrPartyComboFill() { try { TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); TransactionGeneralFillObj.CashOrPartyUnderSundryDrComboFill(cmbCashOrParty, true); cmbCashOrParty.SelectedValue = 0; } catch (Exception ex) { formMDI.infoError.ErrorString = "SVRT7:" + ex.Message; } }
/// <summary> /// Function to fill Cash Or Party combobox /// </summary> public void CashOrPartyComboFill() { try { TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); isDontExecuteCashorParty = true; TransactionGeneralFillObj.CashOrPartyComboFill(cmbCashOrParty, true); isDontExecuteCashorParty = false; } catch (Exception ex) { MessageBox.Show("MRR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Cash Or Party combobox /// </summary> public void CashOrPartyComboFill() { try { TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); isDontExecuteCashorParty = true; TransactionGeneralFillObj.CashOrPartyComboFill(cmbCashOrParty, true); isDontExecuteCashorParty = false; } catch (Exception ex) { formMDI.infoError.ErrorString = "MRREP3:" + ex.Message; } }
/// <summary> /// BankAccount Combobox fill function /// </summary> public void bankAccountComboFill() { try { DataTable dtbl = new DataTable(); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); TransactionsGeneralFill obj = new TransactionsGeneralFill(); dtbl = obj.BankComboFill(); cmbBankAccount.DataSource = dtbl; cmbBankAccount.ValueMember = "ledgerId"; cmbBankAccount.DisplayMember = "ledgerName"; cmbBankAccount.SelectedIndex = -1; } catch (Exception ex) { formMDI.infoError.ErrorString = "BR2:" + ex.Message; } }
/// <summary> /// BankAccount Combobox fill function /// </summary> public void bankAccountComboFill() { try { DataTable dtbl = new DataTable(); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); TransactionsGeneralFill obj = new TransactionsGeneralFill(); dtbl = obj.BankComboFill(); cmbBankAccount.DataSource = dtbl; cmbBankAccount.ValueMember = "ledgerId"; cmbBankAccount.DisplayMember = "ledgerName"; cmbBankAccount.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("BR:2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmLedgerPopup form to select and view ledgers /// </summary> /// <param name="frmLedgerPopup"></param> /// <param name="decId"></param> public void CallFromLedgerPopup(frmLedgerPopup frmLedgerPopup, decimal decId) //PopUp { try { base.Show(); this.frmLedgerPopupObj = frmLedgerPopup; TransactionsGeneralFill obj = new TransactionsGeneralFill(); obj.CashOrBankComboFill(cmbCashBankAC, false); cmbCashBankAC.SelectedValue = decId; cmbCashBankAC.Focus(); frmLedgerPopupObj.Close(); frmLedgerPopupObj = null; } catch (Exception ex) { MessageBox.Show("MSR4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmLedgerPopup form to select and view ledgers /// </summary> /// <param name="frmLedgerPopup"></param> /// <param name="decId"></param> public void CallFromLedgerPopup(frmLedgerPopup frmLedgerPopup, decimal decId) //PopUp { try { base.Show(); this.frmLedgerPopupObj = frmLedgerPopup; TransactionsGeneralFill obj = new TransactionsGeneralFill(); obj.CashOrBankComboFill(cmbCashBankAC, false); cmbCashBankAC.SelectedValue = decId; cmbCashBankAC.Focus(); frmLedgerPopupObj.Close(); frmLedgerPopupObj = null; } catch (Exception ex) { formMDI.infoError.ErrorString = "MSR4:" + ex.Message; } }
/// <summary> /// Function to fill AccountyLedger combobox /// </summary> public void LedgerComboFill() { try { DataTable dtbl = new DataTable(); TransactionsGeneralFill obj = new TransactionsGeneralFill(); dtbl = obj.AccountLedgerComboFill(); DataRow dr = dtbl.NewRow(); dr[0] = 0; dr[2] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbAccountLedger.DataSource = dtbl; cmbAccountLedger.DisplayMember = "ledgerName"; cmbAccountLedger.ValueMember = "ledgerId"; } catch (Exception ex) { formMDI.infoError.ErrorString = "RR2:" + ex.Message; } }
/// <summary> /// Function to fill AccountyLedger combobox /// </summary> public void LedgerComboFill() { try { DataTable dtbl = new DataTable(); TransactionsGeneralFill obj = new TransactionsGeneralFill(); dtbl = obj.AccountLedgerComboFill(); DataRow dr = dtbl.NewRow(); dr[0] = 0; dr[2] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbAccountLedger.DataSource = dtbl; cmbAccountLedger.DisplayMember = "ledgerName"; cmbAccountLedger.ValueMember = "ledgerId"; } catch (Exception ex) { MessageBox.Show("RR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Cash Or Bank combobox /// </summary> public void CashOrBankComboFill() { try { DataTable dtbl = new DataTable(); TransactionsGeneralFill Obj = new TransactionsGeneralFill(); dtbl = Obj.BankOrCashComboFill(false); DataRow dr = dtbl.NewRow(); dr[1] = 0; dr[0] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbCashOrBank.DataSource = dtbl; cmbCashOrBank.ValueMember = "ledgerId"; cmbCashOrBank.DisplayMember = "ledgerName"; cmbCashOrBank.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("RRP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill CashOrBank combobox /// </summary> public void CashOrBankComboFill() { try { DataTable dtbl = new DataTable(); TransactionsGeneralFill Obj = new TransactionsGeneralFill(); dtbl = Obj.BankOrCashComboFill(false); DataRow dr = dtbl.NewRow(); dr[1] = 0; dr[0] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbBankOrCash.DataSource = dtbl; cmbBankOrCash.ValueMember = "ledgerId"; cmbBankOrCash.DisplayMember = "ledgerName"; cmbBankOrCash.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("PRP2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Bank/Cash combobox /// </summary> public void BankOrCashComboFill() { try { DataTable dtbl = new DataTable(); TransactionsGeneralFill Obj = new TransactionsGeneralFill(); dtbl = Obj.BankOrCashComboFill(false); DataRow dr = dtbl.NewRow(); dr[1] = 0; dr[0] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbBankOrCash.DataSource = dtbl; cmbBankOrCash.ValueMember = "ledgerId"; cmbBankOrCash.DisplayMember = "ledgerName"; cmbBankOrCash.SelectedIndex = 0; } catch (Exception ex) { formMDI.infoError.ErrorString = "CR1:" + ex.Message; } }
/// <summary> /// grid CellValueChanged for do the basic calculation and unit selection /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProductBOM_CellValueChanged(object sender, DataGridViewCellEventArgs e) { try { CheckInvalidEntries(e); ProductSP spProduct = new ProductSP(); TransactionsGeneralFill trstGnFill = new TransactionsGeneralFill(); if (e.RowIndex > -1) { if (e.ColumnIndex == dgvProductBOM.Columns["dgvcmbRawMaterial"].Index) { if (dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbRawMaterial"] != null) { dgvProductBOM.Rows[e.RowIndex].Cells["dgvtxtUnit"].Value = spProduct.ProductUnit(Convert.ToDecimal(dgvProductBOM.Rows[e.RowIndex].Cells[1].Value)); DataTable dtblunitconversionViewAll = new DataTable(); decimal decProductId = Convert.ToDecimal(dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbRawMaterial"].Value); dtblunitconversionViewAll = trstGnFill.UnitViewAllByProductId(dgvProductBOM, decProductId.ToString(), e.RowIndex); DataRow drow = dtblunitconversionViewAll.NewRow(); drow["unitName"] = string.Empty; drow["unitId"] = 0; dtblunitconversionViewAll.Rows.InsertAt(drow, 0); DataGridViewComboBoxCell cell = (DataGridViewComboBoxCell)(dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbUnit"]); cell.DataSource = dtblunitconversionViewAll; cell.ValueMember = "unitId"; cell.DisplayMember = "unitName"; if (dtblunitconversionViewAll.Rows[0][4] != null && dtblunitconversionViewAll.Rows[0][4] != DBNull.Value) { dgvProductBOM.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtblunitconversionViewAll.Rows[0][4].ToString()); } } } } } catch (Exception ex) { formMDI.infoError.ErrorString = "PB:21" + ex.Message; } }
/// <summary> /// To reset the form here and Generate the voucher no generation /// </summary> public void Clear() { try { TransactionsGeneralFill obj = new TransactionsGeneralFill(); if (btnSave.Text == "Update") { if (frmPaymentRegisterObj != null) { frmPaymentRegisterObj.Close(); } } if (isAutomatic) { SalaryVoucherMasterSP spMaster = new SalaryVoucherMasterSP(); PaymentMasterSP SpPaymentMaster = new PaymentMasterSP(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != SpPaymentMaster.PaymentMasterMax(decPaymentVoucherTypeId) + 1) { strVoucherNo = SpPaymentMaster.PaymentMasterMax(decPaymentVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (SpPaymentMaster.PaymentMasterMax(decPaymentVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); } } SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.Text = strInvoiceNo; txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.Text = string.Empty; txtVoucherNo.ReadOnly = false; } dtpDate.MinDate = PublicVariables._dtFromDate; dtpDate.MaxDate = PublicVariables._dtToDate; dtpDate.Value = PublicVariables._dtCurrentDate; cmbBankorCash.SelectedIndex = -1; txtNarration.Text = string.Empty; txtTotal.Text = string.Empty; dgvPaymentVoucher.ClearSelection(); dgvPaymentVoucher.Rows.Clear(); btnSave.Text = "Save"; btnDelete.Enabled = false; cbxPrintafterSave.Checked = false; dtblPartyBalance.Clear(); if (isAutomatic) { txtDate.Select(); } else { txtVoucherNo.Select(); } PrintCheck(); } catch (Exception ex) { MessageBox.Show("PV9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to generate Voucher number as per settings /// </summary> public void VoucherNumberGeneration() { SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); TransactionsGeneralFill TransactionGenerateFillObj = new TransactionsGeneralFill(); DeliveryNoteMasterSP spDeliveryNoteMaster = new DeliveryNoteMasterSP(); string tableName = "DeliveryNoteMaster"; string strPrefix = string.Empty; string strSuffix = string.Empty; try { strVoucherNo = "0"; if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGenerateFillObj.VoucherNumberAutomaicGeneration(decDeliveryNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != spDeliveryNoteMaster.DeliveryNoteMasterGetMaxPlusOne(decDeliveryNoteVoucherTypeId)) { strVoucherNo = spDeliveryNoteMaster.DeliveryNoteMasterMax1(decDeliveryNoteVoucherTypeId).ToString(); strVoucherNo = TransactionGenerateFillObj.VoucherNumberAutomaicGeneration(decDeliveryNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (spDeliveryNoteMaster.DeliveryNoteMasterMax1(decDeliveryNoteVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = TransactionGenerateFillObj.VoucherNumberAutomaicGeneration(decDeliveryNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); } } if (isAutomatic) { infoSuffixPrefix = new SuffixPrefixSP().GetSuffixPrefixDetails(decDeliveryNoteVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decDeliveryNoteSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strDeliveryNoteNo = strPrefix + strVoucherNo + strSuffix; txtDeliveryNoteNo.Text = strDeliveryNoteNo; txtDeliveryNoteNo.ReadOnly = true; } else { txtDeliveryNoteNo.Text = string.Empty; strDeliveryNoteNo = txtDeliveryNoteNo.Text.Trim(); } } catch (Exception ex) { MessageBox.Show("DN09:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill cashorbank combobox /// </summary> public void CashOrBankComboFill() { try { TransactionsGeneralFill TransactionsGeneralFillObj = new TransactionsGeneralFill(); TransactionsGeneralFillObj.CashOrBankComboFill(cmbCashOrBank, false); } catch (Exception ex) { MessageBox.Show("SJ:28" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call frmLedgerPopup form to select and view Ledger /// </summary> /// <param name="frmLedgerPopup"></param> /// <param name="decId"></param> /// <param name="strComboTypes"></param> public void CallFromLedgerPopup(frmLedgerPopup frmLedgerPopup, decimal decId, string strComboTypes) //PopUp { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); try { base.Show(); this.frmLedgerPopUpObj = frmLedgerPopup; if (strComboTypes == "CashOrSundryDeptors") { transactionGeneralFillObj.CashOrPartyUnderSundryDrComboFill(cmbCashOrParty, false); cmbCashOrParty.SelectedValue = decId; } frmLedgerPopUpObj.Close(); frmLedgerPopUpObj = null; } catch (Exception ex) { MessageBox.Show("SQ:15" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Currency combo fill /// </summary> public void ComboCurrencyFill() { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); SettingsSP SpSettings = new SettingsSP(); try { DataTable dtbl = new DataTable(); dtbl = transactionGeneralFillObj.CurrencyComboByDate(Convert.ToDateTime(txtSalesQuotationDate.Text)); cmbCurrency.DataSource = dtbl; cmbCurrency.DisplayMember = "currencyName"; cmbCurrency.ValueMember = "exchangeRateId"; cmbCurrency.SelectedValue = 1m; DataRow dr = dtbl.NewRow(); if (SpSettings.SettingsStatusCheck("MultiCurrency") == "Yes") { cmbCurrency.Enabled = true; } else { cmbCurrency.Enabled = false; } } catch (Exception ex) { MessageBox.Show("SQ:13" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill currency combobox /// </summary> public void CurrencyComboFill() { SettingsSP spSettings = new SettingsSP(); TransactionsGeneralFill TransactionGeneralFillObj = new TransactionsGeneralFill(); DataTable dtbl = new DataTable(); try { dtbl = TransactionGeneralFillObj.CurrencyComboByDate(dtpDate.Value); cmbCurrency.DataSource = dtbl; cmbCurrency.DisplayMember = "currencyName"; cmbCurrency.ValueMember = "exchangeRateId"; cmbCurrency.SelectedValue = 1m; if (spSettings.SettingsStatusCheck("MultiCurrency") == "Yes") { cmbCurrency.Enabled = true; } else { cmbCurrency.Enabled = false; } } catch (Exception ex) { MessageBox.Show("SJ:51" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from frmLedgerPopup to view details /// </summary> /// <param name="frmLedgerPopup"></param> /// <param name="decId"></param> public void CallFromLedgerPopup(frmLedgerPopup frmLedgerPopup, decimal decId) //PopUp { try { base.Show(); this.frmLedgerPopupObj = frmLedgerPopup; TransactionsGeneralFill Obj = new TransactionsGeneralFill(); Obj.CashOrBankComboFill(cmbCashOrBankAcc, false); cmbCashOrBankAcc.SelectedValue = decId; cmbCashOrBankAcc.Focus(); frmLedgerPopupObj.Close(); frmLedgerPopupObj = null; } catch (Exception ex) { MessageBox.Show("MSV12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill cash/Bank combobox while return from AccountLedger when creating new ledger /// </summary> /// <param name="decId"></param> public void ReturnFromAccountLedgerForm(decimal decId) { try { TransactionsGeneralFill Obj = new TransactionsGeneralFill(); Obj.CashOrBankComboFill(cmbCashOrBankAcc, false); cmbCashOrBankAcc.SelectedValue = decId.ToString(); this.Enabled = true; cmbCashOrBankAcc.Focus(); } catch (Exception ex) { MessageBox.Show("MSV17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On cellendedit of dgvProduct /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvProduct_CellEndEdit(object sender, DataGridViewCellEventArgs e) { ProductSP SpProduct = new ProductSP(); try { if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtProductName") { if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value.ToString().Trim() != string.Empty) { string strProductName = Convert.ToString(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value); ProductInfo infoProduct = SpProduct.ProductViewByName(strProductName); if (infoProduct.ProductCode != null && infoProduct.ProductCode != string.Empty) { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP(); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = infoProduct.ProductCode; dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value = infoProduct.ProductId; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.SalesRate); DefaultRate = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces); dtblUnitViewAll = transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, infoProduct.ProductId.ToString(), e.RowIndex); dtblbatchViewAll = SpSalesQuotationMaster.SalesQuotationMasterBatchFill(dgvProduct, infoProduct.ProductId, e.RowIndex); BatchSP spBatch = new BatchSP(); decimal decBatchId = spBatch.BatchIdViewByProductId(infoProduct.ProductId); dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value = decBatchId; dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; if (infoProduct.PartNo != string.Empty) { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = infoProduct.PartNo; } else { if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value.ToString() != string.Empty) { decBatchId = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = SpProduct.BarcodeViewByBatchId(decBatchId); } } IsDoAfterFill = true; UnitConvertionSP SpUnitConvertion = new UnitConvertionSP(); DataTable dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value.ToString()); if (dtblUnitByProduct.Rows.Count > 0) { foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows) { if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString()); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString()); if (IsDoAfterFill) { decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString()); decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate,PublicVariables._inNoOfDecimalPlaces); } } } } decimal decStandardRate = SpProduct.SalesInvoiceProductRateForSales(infoProduct.ProductId, PublicVariables._dtCurrentDate, decBatchId, Convert.ToDecimal(cmbPricinglevel.SelectedValue), PublicVariables._inNoOfDecimalPlaces); if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString() != string.Empty) { if (decStandardRate != 0 && Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value) != 0) { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces); } } } else { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value = string.Empty; } AmountCalculation("dgvtxtQty", e.RowIndex); TotalAmountCalculation(); } else { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = string.Empty; } } if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtBarcode") { if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value.ToString().Trim() != string.Empty) { DataTable dtblProductdDetails = new DataTable(); string strBarcode = (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value.ToString()); dtblProductdDetails = SpProduct.ProductDetailsCoreespondingToBarcode(strBarcode); if (dtblProductdDetails.Rows.Count > 0) { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP(); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = dtblProductdDetails.Rows[0]["productCode"].ToString(); dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value = dtblProductdDetails.Rows[0]["productId"].ToString(); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value = dtblProductdDetails.Rows[0]["productName"].ToString(); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(Convert.ToDecimal(dtblProductdDetails.Rows[0]["SalesRate"].ToString())); DefaultRate = Math.Round(Convert.ToDecimal(dtblProductdDetails.Rows[0]["purchaseRate"].ToString()), PublicVariables._inNoOfDecimalPlaces); dtblUnitViewAll = transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, dtblProductdDetails.Rows[0]["productId"].ToString(), e.RowIndex); dtblbatchViewAll = SpSalesQuotationMaster.SalesQuotationMasterBatchFill(dgvProduct, Convert.ToDecimal(dtblProductdDetails.Rows[0]["productId"].ToString()), e.RowIndex); dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value = Convert.ToDecimal(dtblProductdDetails.Rows[0]["batchId"].ToString()); dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = Convert.ToDecimal(dtblProductdDetails.Rows[0]["unitId"].ToString()); IsDoAfterFill = true; UnitConvertionSP SpUnitConvertion = new UnitConvertionSP(); DataTable dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value.ToString()); if (dtblUnitByProduct.Rows.Count > 0) { foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows) { if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString()); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString()); if (IsDoAfterFill) { decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString()); decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, PublicVariables._inNoOfDecimalPlaces); } } } } decimal decStandardRate = SpProduct.SalesInvoiceProductRateForSales(Convert.ToDecimal(dtblProductdDetails.Rows[0]["productId"].ToString()), PublicVariables._dtCurrentDate, decBatchId, Convert.ToDecimal(cmbPricinglevel.SelectedValue), PublicVariables._inNoOfDecimalPlaces); if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString() != string.Empty) { if (decStandardRate != 0 && Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value) != 0) { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces); } } } else { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value = string.Empty; } AmountCalculation("dgvtxtQty", e.RowIndex); TotalAmountCalculation(); } else { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = string.Empty; } } else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtProductCode") { if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString().Trim() != string.Empty) { ProductInfo infoProduct = new ProductInfo(); string strProductCode = dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value.ToString(); infoProduct = SpProduct.ProductViewByCode(strProductCode); if (infoProduct.ProductId != 0) { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP(); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value = infoProduct.ProductName; dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value = infoProduct.ProductId; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(infoProduct.SalesRate, PublicVariables._inNoOfDecimalPlaces); DefaultRate = Math.Round(infoProduct.PurchaseRate, PublicVariables._inNoOfDecimalPlaces); dtblUnitViewAll = transactionGeneralFillObj.UnitViewAllByProductId(dgvProduct, infoProduct.ProductId.ToString(), e.RowIndex); dtblbatchViewAll = SpSalesQuotationMaster.SalesQuotationMasterBatchFill(dgvProduct, infoProduct.ProductId, e.RowIndex); BatchSP spBatch = new BatchSP(); decimal decBatchId = spBatch.BatchIdViewByProductId(infoProduct.ProductId); dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value = decBatchId; dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = infoProduct.UnitId; if (infoProduct.PartNo != string.Empty) { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = infoProduct.PartNo; } else { if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value.ToString() != string.Empty) { decBatchId = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = SpProduct.BarcodeViewByBatchId(decBatchId); } } IsDoAfterFill = true; UnitConvertionSP SpUnitConvertion = new UnitConvertionSP(); DataTable dtblUnitByProduct = SpUnitConvertion.UnitConversionIdAndConRateViewallByProductId(dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value.ToString()); if (dtblUnitByProduct.Rows.Count > 0) { foreach (DataRow drUnitByProduct in dtblUnitByProduct.Rows) { if (dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value.ToString() == drUnitByProduct.ItemArray[0].ToString()) { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtUnitConversionId"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[2].ToString()); dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = Convert.ToDecimal(drUnitByProduct.ItemArray[3].ToString()); if (IsDoAfterFill) { decimal decNewConversionRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString()); decimal decNewRate = (decCurrentRate * decCurrentConversionRate) / decNewConversionRate; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decNewRate, PublicVariables._inNoOfDecimalPlaces); } } } } decimal decStandardRate = SpProduct.SalesInvoiceProductRateForSales(infoProduct.ProductId, PublicVariables._dtCurrentDate, decBatchId, Convert.ToDecimal(cmbPricinglevel.SelectedValue), PublicVariables._inNoOfDecimalPlaces); if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value.ToString() != string.Empty) { if (decStandardRate != 0 && Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value) != 0) { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = Math.Round(decStandardRate / Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value), PublicVariables._inNoOfDecimalPlaces); } } } else { dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductName"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtProductCode"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtBarcode"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvcmbUnit"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtQty"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvcmbBatch"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["dgvtxtConversionRate"].Value = string.Empty; dgvProduct.Rows[e.RowIndex].Cells["ProductId"].Value = string.Empty; } AmountCalculation("dgvtxtQty", e.RowIndex); TotalAmountCalculation(); } } else if (dgvProduct.Columns[e.ColumnIndex].Name == "dgvtxtRate") { if (dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value != null && dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value.ToString() != string.Empty) { DefaultRate = Convert.ToDecimal(dgvProduct.Rows[e.RowIndex].Cells["dgvtxtRate"].Value); } } CheckInvalidEntriesInDataGridProduct(e); } catch (Exception ex) { MessageBox.Show("SQ:56" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Pricing Level Combo Fill /// </summary> public void PricingLevelComboFill() { TransactionsGeneralFill TransactionGenerateFillObj = new TransactionsGeneralFill(); try { DataTable dtblPricing = new DataTable(); dtblPricing = TransactionGenerateFillObj.PricingLevelViewAll(cmbPricingLevel, true); } catch (Exception ex) { MessageBox.Show("DN06: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// SalesMan Combofill Function /// </summary> public void SalesManComboFill() { TransactionsGeneralFill TransactionGenerateFillObj = new TransactionsGeneralFill(); try { DataTable dtblSalesMan = new DataTable(); dtblSalesMan = TransactionGenerateFillObj.SalesmanViewAllForComboFill(cmbSalesMan, false); } catch (Exception ex) { MessageBox.Show("DN05: " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Cleare function and Generate the voucher no based on settings /// </summary> public void Clear() { try { TransactionsGeneralFill obj = new TransactionsGeneralFill(); SalesMasterSP spSalesMaster = new SalesMasterSP(); if (isAutomatic) { if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecSalesInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, "SalesMaster"); if (Convert.ToDecimal(strVoucherNo) != (spSalesMaster.SalesMasterVoucherMax(DecSalesInvoiceVoucherTypeId))) { strVoucherNo = spSalesMaster.SalesMasterVoucherMax(DecSalesInvoiceVoucherTypeId).ToString(); strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecSalesInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, "SalesMaster"); if (spSalesMaster.SalesMasterVoucherMax(DecSalesInvoiceVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecSalesInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, "SalesMaster"); } } SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(DecSalesInvoiceVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtInvoiceNo.Text = strInvoiceNo; txtInvoiceNo.ReadOnly = true; decSalseInvoiceSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; } else { txtInvoiceNo.ReadOnly = false; txtInvoiceNo.Text = string.Empty; strVoucherNo = string.Empty; strInvoiceNo = strVoucherNo; } if (PrintAfetrSave()) { cbxPrintAfterSave.Checked = true; } else { cbxPrintAfterSave.Checked = false; } cmbPricingLevel.SelectedIndex = 0; cmbSalesAccount.SelectedIndex = 0; cmbCashOrParty.SelectedIndex = 0; cmbSalesMan.SelectedIndex = 0; cmbSalesMode.SelectedIndex = 0; cmbDrorCr.SelectedIndex = 0; cmbCashOrbank.SelectedIndex = 0; cmbCurrency.Enabled = true; txtCustomer.Text = cmbCashOrParty.Text; txtTransportCompany.Text = string.Empty; txtVehicleNo.Text = string.Empty; txtNarration.Text = string.Empty; txtCreditPeriod.Text = "0"; txtTotalAmount.Text = "0.00"; txtBillDiscount.Text = "0"; txtGrandTotal.Text = "0.00"; lblTaxTotalAmount.Text = "0.00"; lblLedgerTotalAmount.Text = "0.00"; btnSave.Text = "Save"; btnDelete.Enabled = false; dtpDate.MinDate = PublicVariables._dtFromDate; dtpDate.MaxDate = PublicVariables._dtToDate; dtpDate.Value = PublicVariables._dtCurrentDate; txtDate.Text = dtpDate.Value.ToString("dd-MMM-yyyy"); dgvSalesInvoiceLedger.Rows.Clear(); isFromEditMode = false; if (dgvSalesInvoice.DataSource != null) { ((DataTable)dgvSalesInvoice.DataSource).Rows.Clear(); } else { dgvSalesInvoice.Rows.Clear(); } gridCombofill(); if (dgvSalesInvoiceTax.DataSource != null) { ((DataTable)dgvSalesInvoiceTax.DataSource).Rows.Clear(); } else { dgvSalesInvoiceTax.Rows.Clear(); } taxGridFill(); if (!txtInvoiceNo.ReadOnly) { txtInvoiceNo.Focus(); } else { txtDate.Select(); } txtTotalAmount.Text = "0.00"; txtGrandTotal.Text = "0.00"; lblTotalQuantitydisplay.Text = "0"; } catch (Exception ex) { MessageBox.Show("SI : 01" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Load /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void frmMonthlySalaryVoucher_Load(object sender, EventArgs e) { try { lblCashOrBankIndicator.Visible = true; lblVoucherDateIndicator.Visible = true; lblVoucherNoIndicator.Visible = true; TransactionsGeneralFill Obj = new TransactionsGeneralFill(); Obj.CashOrBankComboFill(cmbCashOrBankAcc, false); dtpMonth.Value = PublicVariables._dtCurrentDate; dtpMonth.MinDate = PublicVariables._dtFromDate; dtpMonth.MaxDate = PublicVariables._dtToDate; dtpVoucherDate.Value = PublicVariables._dtCurrentDate; dtpVoucherDate.MinDate = PublicVariables._dtFromDate; dtpVoucherDate.MaxDate = PublicVariables._dtToDate; dtpVoucherDate.CustomFormat = "dd-MMMM-yyyy"; if (isEditMode == false) { Clear(); } GridFill(isEditMode); } catch (Exception ex) { MessageBox.Show("MSV19:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to clear the fields /// </summary> public void clear() { try { TransactionsGeneralFill obj = new TransactionsGeneralFill(); JournalMasterSP spMaster = new JournalMasterSP(); //-----------------------------------VoucherNo automatic generation-------------------------------------------// if (strVoucherNo == string.Empty) { strVoucherNo = "0"; //strMax; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decJournalVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != spMaster.JournalMasterGetMaxPlusOne(decJournalVoucherTypeId)) { strVoucherNo = spMaster.JournalMasterGetMax(decJournalVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decJournalVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (spMaster.JournalMasterGetMax(decJournalVoucherTypeId).ToString() == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decJournalVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); } } //===================================================================================================================// if (isAutomatic) { SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decJournalVoucherTypeId, dtpVoucherDate.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(); } dgvJournalVoucher.Rows.Clear(); VoucherDate(); dtpVoucherDate.Text = PublicVariables._dtCurrentDate.ToString("dd-MMM-yyyy"); txtDebitTotal.Text = string.Empty; txtCreditTotal.Text = string.Empty; txtNarration.Text = string.Empty; btnSave.Text = "Save"; btnDelete.Enabled = false; isEditMode = false; dtblPartyBalance.Clear();//to clear party balance entries to clear the dgvpatybalance PrintCheck(); if (!txtVoucherNo.ReadOnly) { txtVoucherNo.Focus(); } else { txtDate.Select(); } } catch (Exception ex) { MessageBox.Show("JV2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to generate the voucher number as per settings /// </summary> public void voucherNumberGeneration() { try { TransactionsGeneralFill obj = new TransactionsGeneralFill(); SalaryVoucherMasterSP spMaster = new SalaryVoucherMasterSP(); //-----------------------------------------Voucher number Automatic generation ------------------------------------------------// if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decMonthlyVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != spMaster.SalaryVoucherMasterGetMaxPlusOne(decMonthlyVoucherTypeId)) { strVoucherNo = spMaster.SalaryVoucherMasterGetMax(decMonthlyVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decMonthlyVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (spMaster.SalaryVoucherMasterGetMax(decMonthlyVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decMonthlyVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); } } if (isAutomatic) { SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decMonthlyVoucherTypeId, dtpVoucherDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.Text = strInvoiceNo; txtVoucherNo.ReadOnly = true; } } catch (Exception ex) { MessageBox.Show("MSV14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Currency Combofill function /// </summary> public void GridCurrencyComboFill() { try { DataTable dtbl = new DataTable(); TransactionsGeneralFill Obj = new TransactionsGeneralFill(); dtbl = Obj.CurrencyComboByDate(Convert.ToDateTime(txtDate.Text)); DataRow dr = dtbl.NewRow(); dr["exchangeRateId"] = "0"; dr["currencyName"] = string.Empty; dtbl.Rows.InsertAt(dr, 0); dgvcmbCurrency.DataSource = dtbl; dgvcmbCurrency.DisplayMember = "currencyName"; dgvcmbCurrency.ValueMember = "exchangeRateId"; SettingsSP spSettings = new SettingsSP(); if (spSettings.SettingsStatusCheck("MultiCurrency") == "Yes") { dgvcmbCurrency.ReadOnly = false; } else { dgvcmbCurrency.ReadOnly = true; } } catch (Exception ex) { MessageBox.Show("PV5:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill BankorCash combobox while return from Ledger creation when creating new ledger /// </summary> /// <param name="decId"></param> /// <param name="str"></param> public void ReturnFromAccountLedgerForm(decimal decId, string str) { try { if (str == "CashOrBank") { if (decId != 0) { TransactionsGeneralFill Obj = new TransactionsGeneralFill(); Obj.CashOrBankComboFill(cmbBankorCash, false); cmbBankorCash.SelectedValue = decId.ToString(); } cmbBankorCash.Focus(); } else { if (decId != 0) { int inCurrentRowIndex = dgvPaymentVoucher.CurrentRow.Index; if (inCurrentRowIndex == dgvPaymentVoucher.Rows.Count - 1) { dgvPaymentVoucher.Rows.Add(); } dgvPaymentVoucher.CurrentRow.HeaderCell.Value = "X"; dgvPaymentVoucher.CurrentRow.HeaderCell.Style.ForeColor = Color.Red; DataTable dtbl = new DataTable(); AccountLedgerSP spAccountLedger = new AccountLedgerSP(); dtbl = spAccountLedger.AccountLedgerViewAll(); DataGridViewComboBoxCell dgvccCashOrBank = (DataGridViewComboBoxCell)dgvPaymentVoucher[dgvPaymentVoucher.Columns["dgvcmbAccountLedger"].Index, dgvPaymentVoucher.Rows[inCurrentRowIndex].Index]; DataRow dr = dtbl.NewRow(); dr["ledgerId"] = "0"; dr["ledgerName"] = string.Empty; dtbl.Rows.InsertAt(dr, 0); dgvccCashOrBank.DataSource = dtbl; dgvccCashOrBank.ValueMember = "ledgerId"; dgvccCashOrBank.DisplayMember = "ledgerName"; dgvPaymentVoucher.Rows[inCurrentRowIndex].Cells["dgvcmbAccountLedger"].Value = decId; dgvPaymentVoucher.Rows[inCurrentRowIndex].Cells["dgvcmbAccountLedger"].Selected = true; } } this.Enabled = true; this.BringToFront(); } catch (Exception ex) { MessageBox.Show("PV29:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Cash or bank combofill /// </summary> public void CashOrBankComboFill() { try { DataTable dtbl = new DataTable(); TransactionsGeneralFill Obj = new TransactionsGeneralFill(); dtbl = Obj.BankOrCashComboFill(false); cmbBankorCash.DataSource = dtbl; cmbBankorCash.ValueMember = "ledgerId"; cmbBankorCash.DisplayMember = "ledgerName"; cmbBankorCash.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("PV30:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to check the print after save settings status /// </summary> /// <returns></returns> public bool PrintAfetrSave() { TransactionsGeneralFill TransactionsGeneralFillObj = new TransactionsGeneralFill(); bool isTick = false; try { isTick = TransactionsGeneralFillObj.StatusOfPrintAfterSave(); } catch (Exception ex) { MessageBox.Show("SJ:54" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return isTick; }
/// <summary> /// Function to call frmLedgerPopup form to select and view Ledger /// </summary> /// <param name="frmLedgerPopup"></param> /// <param name="decId"></param> /// <param name="str"></param> public void CallFromLedgerPopup(frmLedgerPopup frmLedgerPopup, decimal decId, string str) { try { this.Enabled = true; if (str == "CashOrBank") { TransactionsGeneralFill obj = new TransactionsGeneralFill(); obj.CashOrBankComboFill(cmbBankorCash, false); cmbBankorCash.SelectedValue = decId; cmbBankorCash.Focus(); } else { dgvPaymentVoucher.CurrentRow.Cells["dgvcmbAccountLedger"].Value = decId; dgvPaymentVoucher.Focus(); } frmLedgerPopupObj.Close(); frmLedgerPopupObj = null; } catch (Exception ex) { MessageBox.Show("PV6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to clear the fields /// </summary> public void Clear() { try { TransactionsGeneralFill obj = new TransactionsGeneralFill(); StockJournalMasterSP spMaster = new StockJournalMasterSP(); if (isAutomatic) { if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); if (Convert.ToDecimal(strVoucherNo) != spMaster.StockJournalMasterMaxPlusOne(decVoucherTypeId)) { strVoucherNo = spMaster.StockJournalMasterMax(decVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); if (spMaster.StockJournalMasterMax(decVoucherTypeId).ToString() == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, TableName); } } SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.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; //AutoCompleteProducts(); 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 reset the form to create new sales quatation /// </summary> public void Clear() { TransactionsGeneralFill transactionGeneralFillObj = new TransactionsGeneralFill(); SalesQuotationMasterSP SpSalesQuotationMaster = new SalesQuotationMasterSP(); try { if (isAutomatic) { strSalesQuotationNo = SpSalesQuotationMaster.SalesQuotationMasterGetMax(decsalesQuotationTypeId).ToString(); if (strSalesQuotationNo == string.Empty) { strSalesQuotationNo = " 0"; } strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName); if (Convert.ToDecimal(strSalesQuotationNo) != SpSalesQuotationMaster.SalesQuotationMaxGetPlusOne(decsalesQuotationTypeId)) { strSalesQuotationNo = Convert.ToString(SpSalesQuotationMaster.SalesQuotationMaxGetPlusOne(decsalesQuotationTypeId)); strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName); if (SpSalesQuotationMaster.SalesQuotationMasterGetMax(decsalesQuotationTypeId) == "0") { strSalesQuotationNo = "0"; strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName); } } if (isAutomatic) { SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decsalesQuotationTypeId, dtpSalesQuotationDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decSalesQuotationPreffixSuffixId = infoSuffixPrefix.SuffixprefixId; strInvoiceNo = strPrefix + strSalesQuotationNo + strSuffix; txtQuotationNo.Text = strInvoiceNo; txtQuotationNo.ReadOnly = true; } } else { txtQuotationNo.Text = string.Empty; } salesQuotationDatefill(); if (!ShowProductCode()) { this.dgvProduct.Columns["dgvtxtProductCode"].Visible = false; } if (!ShowBarcode()) { this.dgvProduct.Columns["dgvtxtBarcode"].Visible = false; } if (PrintAfetrSave()) { cbxPrintAfterSave.Checked = true; } else { cbxPrintAfterSave.Checked = false; } dgvProduct.Rows.Clear(); txtNarration.Text = string.Empty; txtTotal.Text = string.Empty; btnSave.Text = "Save"; btnDelete.Enabled = false; cbxApproved.Checked = false; ComboCurrencyFill(); ComboPricingLevelFill(); ComboSalesManFill(); CashOrPartyCombofill(); FillProducts(false, null); } catch (Exception ex) { MessageBox.Show("SQ:31" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }