/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="strVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal strVoucherTypeId, string strVoucherTypeName) { try { strPaymentVoucherTypeId = strVoucherTypeId.ToString(); decPaymentVoucherTypeId = strVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(Convert.ToDecimal(strVoucherTypeId.ToString())); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(Convert.ToDecimal(strPaymentVoucherTypeId), dtpDate.Value); decPaymentSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; this.Text = strVoucherTypeName; base.Show(); if (isAutomatic) { txtDate.Focus(); } else { txtAdvanceVoucherNo.Focus(); } } catch (Exception ex) { MessageBox.Show("AP11:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to generate Voucher number as per settings /// </summary> public void VoucherNumberGeneration() { SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); TransactionsGeneralFillBll TransactionGenerateFillObj = new TransactionsGeneralFillBll(); DeliveryNoteBll bllDeliveryNote = new DeliveryNoteBll(); 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) != bllDeliveryNote.DeliveryNoteMasterGetMaxPlusOne(decDeliveryNoteVoucherTypeId)) { strVoucherNo = bllDeliveryNote.DeliveryNoteMasterMax1(decDeliveryNoteVoucherTypeId).ToString(); strVoucherNo = TransactionGenerateFillObj.VoucherNumberAutomaicGeneration(decDeliveryNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (bllDeliveryNote.DeliveryNoteMasterMax1(decDeliveryNoteVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = TransactionGenerateFillObj.VoucherNumberAutomaicGeneration(decDeliveryNoteVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); } } if (isAutomatic) { infoSuffixPrefix = new SuffixPrefixSettingsBll().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); } }
// Invoked from frmVoucherTypeSelection form /// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decServiceVoucherTypeId"></param> /// <param name="strServiceVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decServiceVoucherTypeId, string strServiceVoucherTypeName) { try { DecServicetVoucherTypeId = decServiceVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(DecServicetVoucherTypeId); // Checking voucher number is automatic or not SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(DecServicetVoucherTypeId, dtpVoucherDate.Value); decServiceSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strServiceVoucherTypeName; base.Show(); } catch (Exception ex) { MessageBox.Show("SV 13 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// save function /// </summary> public void SaveFunction() { try { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix.FromDate = Convert.ToDateTime(txtFromDate.Text.ToString()); infoSuffixPrefix.ToDate = Convert.ToDateTime(txtToDate.Text.ToString()); String strvouchertype = (cmbVoucherType.SelectedValue.ToString()); infoSuffixPrefix.VoucherTypeId = Convert.ToDecimal(strvouchertype.ToString()); infoSuffixPrefix.Suffix = txtSufix.Text.Trim(); infoSuffixPrefix.Prefix = txtPrefix.Text.Trim(); infoSuffixPrefix.StartIndex = Convert.ToDecimal(txtStartIndex.Text.ToString()); if (cbxPrefillWithZero.Checked) { infoSuffixPrefix.PrefillWithZero = true; infoSuffixPrefix.WidthOfNumericalPart = Convert.ToInt32(txtWidthofNumericalPart.Text.ToString()); } else { infoSuffixPrefix.PrefillWithZero = false; infoSuffixPrefix.WidthOfNumericalPart = 0; } infoSuffixPrefix.Narration = txtNarration.Text.Trim(); infoSuffixPrefix.Extra1 = string.Empty; infoSuffixPrefix.Extra2 = string.Empty; if (BllSuffixPrefixSettings.SuffixPrefixCheckExistenceForAdd(txtFromDate.Text.ToString(), txtToDate.Text.ToString(), Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), 0) == false) { if (BllSuffixPrefixSettings.SuffixPrefixAddWithId(infoSuffixPrefix)) { Messages.SavedMessage(); Clear(); } } else { Messages.InformationMessage("Voucher type already exist for dates"); cmbVoucherType.Focus(); } } catch (Exception ex) { MessageBox.Show("SPS4" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// voucherType combofill for search function /// </summary> public void VoucherTypeComboFillSearch() { try { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); List<DataTable> list = new List<DataTable>(); list = BllSuffixPrefixSettings.VoucherTypeViewAllInSuffixPrefix(); DataRow dr = list[0].NewRow(); dr[0] = 0; dr[1] = "All"; list[0].Rows.InsertAt(dr, 0); cmbVoucherTypeSearch.DataSource = list[0]; cmbVoucherTypeSearch.ValueMember = "voucherTypeId"; cmbVoucherTypeSearch.DisplayMember = "voucherTypeName"; cmbVoucherTypeSearch.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("SPS2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Voucher no generation function based on the settings /// </summary> public void VoucherNumberGeneration() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); PDCRecivebleBll BllPdcRecieveble = new PDCRecivebleBll(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCReceivableVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName); if (Convert.ToDecimal(strVoucherNo) != BllPdcRecieveble.PDCReceivableMaxUnderVoucherTypePlusOne(decPDCReceivableVoucherTypeId)) { strVoucherNo = BllPdcRecieveble.PDCReceivableMaxUnderVoucherType(decPDCReceivableVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCReceivableVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName); if (BllPdcRecieveble.PDCReceivableMaxUnderVoucherType(decPDCReceivableVoucherTypeId).ToString() == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPDCReceivableVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, strtableName); } } if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPDCReceivableVoucherTypeId, dtpVoucherDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decSufixprefixPdcReceivableID = infoSuffixPrefix.SuffixprefixId; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.Text = strInvoiceNo; txtVoucherNo.ReadOnly = true; txtVoucherNo.Enabled = false; lblVoucherNoManualValidator.Visible = false; } else { txtVoucherNo.ReadOnly = false; txtVoucherNo.Text = string.Empty; lblVoucherNoManualValidator.Visible = true; strInvoiceNo = txtVoucherNo.Text.Trim(); } } catch (Exception ex) { MessageBox.Show("PR17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// delete function /// </summary> public void DeleteFunction() { try { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); if (BllSuffixPrefixSettings.SuffixPrefixSettingsDeleting(decSuffixPrefixId) == -1) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); Clear(); } } catch (Exception ex) { MessageBox.Show("SPS7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { decsalesQuotationTypeId = decVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decsalesQuotationTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo InfoSuffixPrefix = new SuffixPrefixInfo(); InfoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decsalesQuotationTypeId, dtpSalesQuotationDate.Value); decSalesQuotationPreffixSuffixId = InfoSuffixPrefix.SuffixprefixId; this.Text = strVoucherTypeName; base.Show(); if (isAutomatic) { txtSalesQuotationDate.Focus(); } } catch (Exception ex) { MessageBox.Show("SQ:14" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to reset the form to create new sales quatation /// </summary> public void Clear() { TransactionsGeneralFillBll transactionGeneralFillObj = new TransactionsGeneralFillBll(); SalesQuotationBll bllSalesQuotation = new SalesQuotationBll(); try { if (isAutomatic) { strSalesQuotationNo = bllSalesQuotation.SalesQuotationMasterGetMax(decsalesQuotationTypeId).ToString(); if (strSalesQuotationNo == string.Empty) { strSalesQuotationNo = " 0"; } strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName); if (Convert.ToDecimal(strSalesQuotationNo) != bllSalesQuotation.SalesQuotationMaxGetPlusOne(decsalesQuotationTypeId)) { strSalesQuotationNo = Convert.ToString(bllSalesQuotation.SalesQuotationMaxGetPlusOne(decsalesQuotationTypeId)); strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName); if (bllSalesQuotation.SalesQuotationMasterGetMax(decsalesQuotationTypeId) == 0) { strSalesQuotationNo = "0"; strSalesQuotationNo = transactionGeneralFillObj.VoucherNumberAutomaicGeneration(decsalesQuotationTypeId, Convert.ToDecimal(strSalesQuotationNo), dtpSalesQuotationDate.Value, tableName); } } if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.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); } }
/// <summary> /// Function to clear the fields /// </summary> public void clear() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); JournalVoucherBll bllJournalVoucher = new JournalVoucherBll(); //-----------------------------------VoucherNo automatic generation-------------------------------------------// if (strVoucherNo == string.Empty) { strVoucherNo = "0"; //strMax; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decJournalVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != bllJournalVoucher.JournalMasterGetMaxPlusOne(decJournalVoucherTypeId)) { strVoucherNo = bllJournalVoucher.JournalMasterGetMax(decJournalVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decJournalVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (bllJournalVoucher.JournalMasterGetMax(decJournalVoucherTypeId).ToString() == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decJournalVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); } } //===================================================================================================================// if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.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> /// To reset the form here and Generate the voucher no generation /// </summary> public void Clear() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); if (btnSave.Text == "Update") { if (frmPaymentRegisterObj != null) { frmPaymentRegisterObj.Close(); } } if (isAutomatic) { SalaryVoucherBll BllSalaryVoucher = new SalaryVoucherBll(); //PaymentMasterSP SpPaymentMaster = new PaymentMasterSP(); PaymentVoucherBll BllPaymentVoucher = new PaymentVoucherBll(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != BllPaymentVoucher.PaymentMasterMax(decPaymentVoucherTypeId) + 1) { strVoucherNo = BllPaymentVoucher.PaymentMasterMax(decPaymentVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (BllPaymentVoucher.PaymentMasterMax(decPaymentVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); } } SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.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> /// It is a function for vouchertypeselection form to select perticular voucher and open the form under the vouchertype /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { decJournalVoucherTypeId = decVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decJournalVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); //SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decJournalVoucherTypeId, dtpVoucherDate.Value); decJournalSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strVoucherTypeName; base.Show(); clear(); } catch (Exception ex) { MessageBox.Show("JV1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for Voucher Number Generation /// </summary> public void VoucherNumberGeneration() { string strPrefix = string.Empty; string strSuffix = string.Empty; string tableName = "PurchaseReturnMaster"; string strReturnNo = string.Empty; TransactionsGeneralFillBll TransactionGeneralFillObj = new TransactionsGeneralFillBll(); PurchaseReturnBll BllPurchaseReturn = new PurchaseReturnBll(); try { if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseReturnVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != BllPurchaseReturn.PurchaseReturnMasterGetMaxPlusOne(decPurchaseReturnVoucherTypeId)) { strVoucherNo = BllPurchaseReturn.PurchaseReturnMasterGetMax(decPurchaseReturnVoucherTypeId).ToString(); strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseReturnVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (BllPurchaseReturn.PurchaseReturnMasterGetMax(decPurchaseReturnVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseReturnVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); } } if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPurchaseReturnVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decPurchaseReturnSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strReturnNo = strPrefix + strVoucherNo + strSuffix; txtReturnNo.Text = strReturnNo; txtReturnNo.ReadOnly = true; } } catch (Exception ex) { MessageBox.Show("PR:27" + 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> /// These function for generating the voucher no automatically if its automatic with preffix and sufix /// </summary> public void VoucherNumberGeneration() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); //ContraMasterSP spContraMaster = new ContraMasterSP(); ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(DecContraVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpContraVoucherDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != bllContraVoucherDetails.ContraVoucherMasterGetMaxPlusOne(DecContraVoucherTypeId)) { strVoucherNo = bllContraVoucherDetails.ContraVoucherMasterGetMax(DecContraVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(DecContraVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpContraVoucherDate.Value, tableName); if (bllContraVoucherDetails.ContraVoucherMasterGetMax(DecContraVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(DecContraVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpContraVoucherDate.Value, tableName); } } if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(DecContraVoucherTypeId, dtpContraVoucherDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decContraSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.Text = strInvoiceNo; txtVoucherNo.ReadOnly = true; } } catch (Exception ex) { MessageBox.Show("CV:08" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Voucher no generation function based on settings /// </summary> public void VoucherNumberGeneration() { try { //PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP(); PhysicalStockBll BllPhysicalStock = new PhysicalStockBll(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPhysicalStockVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName); if (Convert.ToDecimal(strVoucherNo) != (BllPhysicalStock.PhysicalStockMasterVoucherMax(decPhysicalStockVoucherTypeId))) { strVoucherNo = BllPhysicalStock.PhysicalStockMasterVoucherMax(decPhysicalStockVoucherTypeId).ToString(); strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPhysicalStockVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName); if (BllPhysicalStock.PhysicalStockMasterVoucherMax(decPhysicalStockVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPhysicalStockVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName); } } if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPhysicalStockVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decPhysicalStockSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; txtVoucherNo.Text = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.ReadOnly = true; } } catch (Exception ex) { MessageBox.Show("PS:18" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// its a function for vouchertype selection form to select purticular voucher and open the form under the vouchertype /// </summary> /// <param name="decDailyContraVoucherTypeId"></param> /// <param name="strVoucherTypeNames1"></param> public void CallFromVoucherTypeSelection(decimal decDailyContraVoucherTypeId, string strVoucherTypeNames1) { try { DecContraVoucherTypeId = decDailyContraVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(DecContraVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(DecContraVoucherTypeId, dtpContraVoucherDate.Value); decContraSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strVoucherTypeNames1; base.Show(); Clear(); } catch (Exception ex) { MessageBox.Show("CV:10" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="DecPhysicalStockVoucherType"></param> /// <param name="strPhysicalStockVouchertypeName"></param> public void CallFromVoucherTypeSelection(decimal DecPhysicalStockVoucherType, string strPhysicalStockVouchertypeName) { try { decPhysicalStockVoucherTypeId = DecPhysicalStockVoucherType; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decPhysicalStockVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPhysicalStockVoucherTypeId, dtpDate.Value); decDailySuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strPhysicalStockVouchertypeName; base.Show(); } catch (Exception ex) { MessageBox.Show("PS:9" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { decPDCReceivableVoucherTypeId = decVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decPDCReceivableVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPDCReceivableVoucherTypeId, dtpVoucherDate.Value); decSufixprefixPdcReceivableID = infoSuffixPrefix.SuffixprefixId; this.Text = strVoucherTypeName; base.Show(); if (isAutomatic) { txtVoucherDate.Focus(); } else { txtVoucherNo.Focus(); } ClearFunction(); } catch (Exception ex) { MessageBox.Show("PR15:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Cleare function and Generate the voucher no based on settings /// </summary> public void Clear() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); //SalesMasterSP spSalesMaster = new SalesMasterSP(); SalesInvoiceBll BllSalesInvoice = new SalesInvoiceBll(); if (isAutomatic) { if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecSalesInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, "SalesMaster"); if (Convert.ToDecimal(strVoucherNo) != (BllSalesInvoice.SalesMasterVoucherMax(DecSalesInvoiceVoucherTypeId))) { strVoucherNo = BllSalesInvoice.SalesMasterVoucherMax(DecSalesInvoiceVoucherTypeId).ToString(); strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecSalesInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, "SalesMaster"); if (BllSalesInvoice.SalesMasterVoucherMax(DecSalesInvoiceVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecSalesInvoiceVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, "SalesMaster"); } } SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); // SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.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> /// grid fill function /// </summary> public void GridFill() { try { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); List<DataTable> list = new List<DataTable> (); list = BllSuffixPrefixSettings.VoucherTypeSearchInSuffixPrefix(cmbVoucherTypeSearch.Text); dgvSuffixPrefixSettings.DataSource = list[0]; } catch (Exception ex) { MessageBox.Show("SPS3" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to generate Voucher number as per settings /// </summary> public void VoucherNumberGeneration() { try { if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecPOSVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName); if (Convert.ToDecimal(strVoucherNo) != (BllSalesInvoice.SalesMasterVoucherMax(DecPOSVoucherTypeId))) { strVoucherNo = BllSalesInvoice.SalesMasterVoucherMax(DecPOSVoucherTypeId).ToString(); strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecPOSVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName); if (BllSalesInvoice.SalesMasterVoucherMax(DecPOSVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(DecPOSVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, strTableName); } } if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(DecPOSVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decPOSSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; txtVoucherNo.Text = strPrefix + strVoucherNo + strSuffix; txtVoucherNo.ReadOnly = true; } else { txtVoucherNo.ReadOnly = false; txtVoucherNo.Text = string.Empty; strVoucherNo = string.Empty; } } catch (Exception ex) { MessageBox.Show("POS : 05" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// vouchertype conbofill function /// </summary> public void VoucherTypeComboFill() { try { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); List<DataTable> list = new List<DataTable>(); list = BllSuffixPrefixSettings.VoucherTypeViewAllInSuffixPrefix(); cmbVoucherType.DataSource = list[0]; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("SPS1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Clear function and voucherno generation based on settings /// </summary> public void Clear() { try { PurchaseOrderBll BllPurchaseOrder = new PurchaseOrderBll(); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); SettingsBll BllSettings = new SettingsBll(); if (isAutomatic) { strVoucherNo = BllPurchaseOrder.PurchaseOrderVoucherMasterMax(decPurchaseOrderTypeId).ToString(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (strVoucherNo != BllPurchaseOrder.PurchaseOrderVoucherMasterMax(decPurchaseOrderTypeId).ToString()) { strVoucherNo = BllPurchaseOrder.PurchaseOrderVoucherMasterMax(decPurchaseOrderTypeId).ToString(); strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); if (BllPurchaseOrder.PurchaseOrderVoucherMasterMax(decPurchaseOrderTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = TransactionGeneralFillObj.VoucherNumberAutomaicGeneration(decPurchaseOrderTypeId, Convert.ToDecimal(strVoucherNo), dtpDate.Value, tableName); } } infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPurchaseOrderTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decPurchaseSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strOrderNo = strPrefix + strVoucherNo + strSuffix; txtOrderNo.Text = strOrderNo; txtOrderNo.ReadOnly = true; txtDate.Focus(); } else { txtOrderNo.Text = string.Empty; txtOrderNo.ReadOnly = false; txtOrderNo.Focus(); } dtpDate.Value = PublicVariables._dtCurrentDate; dtpDate.MinDate = PublicVariables._dtFromDate; dtpDate.MaxDate = PublicVariables._dtToDate; dtpDueDate.Value = PublicVariables._dtCurrentDate; this.txtDueDate.Text = this.dtpDueDate.Value.ToString("dd-MMM-yyyy"); dtpDueDate.MinDate = PublicVariables._dtFromDate; dtpDueDate.MaxDate = PublicVariables._dtToDate; txtDueDays.Text = "0"; CashOrPartyComboFill(); if (!ShowProductCode()) { this.dgvPurchaseOrder.Columns["dgvtxtProductCode"].Visible = false; } if (!ShowBarcode()) { this.dgvPurchaseOrder.Columns["dgvtxtBarcode"].Visible = false; } if (BllSettings.SettingsStatusCheck("ShowUnit") == "Yes") { dgvPurchaseOrder.Columns["dgvcmbUnit"].Visible = true; } else { dgvPurchaseOrder.Columns["dgvcmbUnit"].Visible = false; } if (PrintAfetrSave()) { cbxPrintAfterSave.Checked = true; } else { cbxPrintAfterSave.Checked = false; } txtNarration.Text = string.Empty; btnSave.Text = "Save"; btnDelete.Enabled = false; cbxCancel.Enabled = true; cbxCancel.Checked = false; dgvPurchaseOrder.Rows.Clear(); txtTotalAmount.Text = string.Empty; } catch (Exception ex) { MessageBox.Show("PO28:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// grid double click fill the items in controll for edit /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSuffixPrefixSettings_CellDoubleClick(object sender, DataGridViewCellEventArgs e) { try { if (e.RowIndex != -1) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.SuffixPrefixView(Convert.ToDecimal(dgvSuffixPrefixSettings.Rows[e.RowIndex].Cells["dgvtxtSuffixPrefixId"].Value.ToString())); decSuffixPrefixId = Convert.ToDecimal(dgvSuffixPrefixSettings.Rows[e.RowIndex].Cells["dgvtxtSuffixPrefixId"].Value.ToString()); txtFromDate.Text = infoSuffixPrefix.FromDate.ToString("dd-MMM-yyyy"); txtToDate.Text = infoSuffixPrefix.ToDate.ToString("dd-MMM-yyyy"); cmbVoucherType.SelectedValue = infoSuffixPrefix.VoucherTypeId.ToString(); txtStartIndex.Text = infoSuffixPrefix.StartIndex.ToString(); txtStartIndex.Enabled = false; txtSufix.Text = infoSuffixPrefix.Suffix; txtPrefix.Text = infoSuffixPrefix.Prefix; if (infoSuffixPrefix.PrefillWithZero == true) { cbxPrefillWithZero.Checked = true; txtWidthofNumericalPart.Text = infoSuffixPrefix.WidthOfNumericalPart.ToString(); } else { cbxPrefillWithZero.Checked = false; txtWidthofNumericalPart.Text = infoSuffixPrefix.WidthOfNumericalPart.ToString(); } txtNarration.Text = infoSuffixPrefix.Narration; btnSave.Text = "Update"; btnDelete.Enabled = true; txtFromDate.Focus(); txtWidthofNumericalPart.Enabled = true; if (cbxPrefillWithZero.Checked == true) { txtWidthofNumericalPart.Enabled = true; } else { txtWidthofNumericalPart.Enabled = false; } } } catch (Exception ex) { MessageBox.Show("SPS20" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from VoucherType Selection form /// </summary> /// <param name="decDailySalaryVoucherTypeId"></param> /// <param name="strVoucherTypeNames1"></param> public void CallFromVoucherTypeSelection(decimal decDailySalaryVoucherTypeId, string strVoucherTypeNames1) { try { decDailyVoucherTypeId = decDailySalaryVoucherTypeId; VoucherTypeBll BllVoucherType = new VoucherTypeBll(); isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decDailyVoucherTypeId); SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); // SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decDailyVoucherTypeId, dtpDate.Value); decDailySuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; this.Text = strVoucherTypeNames1; base.Show(); if (isAutomatic) { txtDate.Focus(); } else { txtVoucherNo.Focus(); } } catch (Exception ex) { MessageBox.Show("DSV3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call These form from vouchertype Selection form /// </summary> /// <param name="decVoucherTypeId"></param> /// <param name="strVoucherTypeName"></param> public void CallFromVoucherTypeSelection(decimal decVoucherTypeId, string strVoucherTypeName) { try { VoucherTypeBll BllVoucherType = new VoucherTypeBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); decDeliveryNoteVoucherTypeId = decVoucherTypeId; isAutomatic = BllVoucherType.CheckMethodOfVoucherNumbering(decDeliveryNoteVoucherTypeId); infoSuffixPrefix = new SuffixPrefixSettingsBll().GetSuffixPrefixDetails(decDeliveryNoteVoucherTypeId, dtpDate.Value); decDeliveryNoteSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; this.Text = strVoucherTypeName; base.Show(); if (isAutomatic) { txtDate.Focus(); } else { txtDeliveryNoteNo.Focus(); } } catch (Exception ex) { MessageBox.Show("DN07:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to generate the voucher number as per settings /// </summary> public void voucherNumberGeneration() { try { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); SalaryVoucherBll BllSalaryVoucher = new SalaryVoucherBll(); //-----------------------------------------Voucher number Automatic generation ------------------------------------------------// if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decMonthlyVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != BllSalaryVoucher.SalaryVoucherMasterGetMaxPlusOne(decMonthlyVoucherTypeId)) { strVoucherNo = BllSalaryVoucher.SalaryVoucherMasterGetMax(decMonthlyVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decMonthlyVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (BllSalaryVoucher.SalaryVoucherMasterGetMax(decMonthlyVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decMonthlyVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); } } if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.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> /// Function to reset the form to make new service voucher /// </summary> public void Clear() { try { /*Automatic invoice number generation*/ TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); VoucherDate(); if (isAutomatic) // Checking voucher number generation is automatic or not { ServicesBll BllService = new ServicesBll(); ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(DecServicetVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (Convert.ToDecimal(strVoucherNo) != (BllService.ServiceMasterGetMax(DecServicetVoucherTypeId)) + 1) { strVoucherNo = BllService.ServiceMasterGetMax(DecServicetVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(DecServicetVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); if (BllService.ServiceMasterGetMax(DecServicetVoucherTypeId) == 0) { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(DecServicetVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpVoucherDate.Value, tableName); } } SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(DecServicetVoucherTypeId, dtpVoucherDate.Value); // Getting suffix-prefix settings strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; decServiceSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; // Generating invoice number with suffix and prefix txtInvoiceNumber.Text = strInvoiceNo; txtInvoiceNumber.ReadOnly = true; txtVoucherDate.Select(); } else { txtInvoiceNumber.Text = string.Empty; txtInvoiceNumber.ReadOnly = false; } ServiceAcoountComboFill(); GridParticularComboFill(); SalesmanComboFill(); CashOrPartyComboFill(); isEditMode = false; txtDiscount.Text = "0"; txtTotalAmount.Text = "0"; txtGrandTotal.Text = "0"; txtCreditPeriod.Text = "0"; txtCustomer.Text = string.Empty; txtNarration.Text = string.Empty; PrintCheck(); int inCount = dgvServiceVoucher.RowCount; for (int i = 0; i < inCount; i++) { dgvServiceVoucher.Rows[i].Cells["dgvcmbParticulars"].Value = null; dgvServiceVoucher.Rows[i].Cells["dgvtxtMeasure"].Value = null; dgvServiceVoucher.Rows[i].Cells["dgvtxtAmount"].Value = null; } dgvServiceVoucher.ClearSelection(); btnDelete.Enabled = false; btnSave.Text = "Save"; dgvServiceVoucher.Rows.Clear(); } catch (Exception ex) { MessageBox.Show("SV 04 : " + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to generate Voucher number as per settings /// </summary> public void VoucherNoGeneration() { TransactionsGeneralFillBll obj = new TransactionsGeneralFillBll(); AdvancePaymentBll bllAdvancePayment = new AdvancePaymentBll(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpSalaryMonth.Value, strAdvancePayment); if (Convert.ToDecimal(strVoucherNo) != bllAdvancePayment.AdvancePaymentGetMaxPlusOne(decPaymentVoucherTypeId)) { strVoucherNo = bllAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpSalaryMonth.Value, strAdvancePayment); if (bllAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpSalaryMonth.Value, strAdvancePayment); } } if (isAutomatic) { SuffixPrefixSettingsBll BllSuffixPrefixSettings = new SuffixPrefixSettingsBll(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = BllSuffixPrefixSettings.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtAdvanceVoucherNo.Text = strInvoiceNo; txtAdvanceVoucherNo.Enabled = false; } }