public void VoucherNoGeneration(DateTime salaryMonth) { TransactionsGeneralFill obj = new TransactionsGeneralFill(); AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment); if (Convert.ToDecimal(strVoucherNo) != spAdvancePayment.AdvancePaymentGetMaxPlusOne(decPaymentVoucherTypeId)) { strVoucherNo = spAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment); if (spAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), salaryMonth, strAdvancePayment); } } if (isAutomatic) { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffixPrefix.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate); string strPrefix = infoSuffixPrefix.Prefix; string strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; } }
/// <summary> /// Edit function /// </summary> public void EditFunction() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); 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.Prefix = txtPrefix.Text.Trim(); infoSuffixPrefix.Suffix = txtSufix.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; infoSuffixPrefix.SuffixprefixId = decSuffixPrefixId; if (spSuffixPrefix.SuffixPrefixCheckExistenceForAdd(txtFromDate.Text.ToString(), txtToDate.Text.ToString(), Convert.ToDecimal(cmbVoucherType.SelectedValue.ToString()), decSuffixPrefixId) == false) { if (spSuffixPrefix.SuffixPrefixSettingsEdit(infoSuffixPrefix)) { Messages.UpdatedMessage(); Clear(); } else { Messages.ReferenceExistsMessageForUpdate(); cmbVoucherType.Focus(); } } else { Messages.InformationMessage("Voucher type already exist for dates"); cmbVoucherType.Focus(); } } catch (Exception ex) { MessageBox.Show("SPS5" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// grid fill function /// </summary> public void GridFill() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); DataTable dtbl = new DataTable(); dtbl = spSuffixPrefix.VoucherTypeSearchInSuffixPrefix(cmbVoucherTypeSearch.Text); dgvSuffixPrefixSettings.DataSource = dtbl; } catch (Exception ex) { MessageBox.Show("SPS3" + 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) { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffixPrefix.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> /// vouchertype conbofill function /// </summary> public void VoucherTypeComboFill() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); DataTable dtbl = new DataTable(); dtbl = spSuffixPrefix.VoucherTypeViewAllInSuffixPrefix(); cmbVoucherType.DataSource = dtbl; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; cmbVoucherType.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("SPS1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public string voucherNumberGeneration(decimal decMonthlyVoucherTypeId, string strVoucherNo, string dptVoucherDate) { try { //TransactionsGeneralFill obj = new TransactionsGeneralFill(); SalaryVoucherMasterSP spMaster = new SalaryVoucherMasterSP(); if (strVoucherNo == string.Empty || strVoucherNo == null) { strVoucherNo = "0"; } string tableName = "SalaryVoucherMaster"; //-----------------------------------------Voucher number Automatic generation ------------------------------------------------// //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), dptVoucherDate.Value, tableName); } } VoucherTypeSP spVoucherType = new VoucherTypeSP(); //var isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(decMonthlyVoucherTypeId); //if (isAutomatic) { SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(decMonthlyVoucherTypeId, Convert.ToDateTime(dptVoucherDate)); var strPrefix = infoSuffixPrefix.Prefix; var strSuffix = infoSuffixPrefix.Suffix; var strInvoiceNo = strPrefix + strVoucherNo + strSuffix; return(strInvoiceNo); //txtVoucherNo.ReadOnly = true; } //return string.Empty; } catch (Exception ex) { //MessageBox.Show("MSV14:" + ex.Message, "Masterfine", MessageBoxButtons.OK, MessageBoxIcon.Information); } return(string.Empty); }
public void CallFromVoucherTypeSelection() { VoucherTypeSP spVoucherType = new VoucherTypeSP(); DataTable dtblVouchetType = new DataTable(); dtblVouchetType = spVoucherType.VoucherTypeSelectionComboFill(strVoucherType); decimal decVoucherTypeId = (decimal)dtblVouchetType.Rows[0][0]; decPaymentVoucherTypeId = decVoucherTypeId; strPaymentVoucherTypeId = decVoucherTypeId.ToString(); isAutomatic = spVoucherType.CheckMethodOfVoucherNumbering(Convert.ToDecimal(decVoucherTypeId.ToString())); SuffixPrefixSP spSuffisprefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffisprefix.GetSuffixPrefixDetails(Convert.ToDecimal(strPaymentVoucherTypeId), dtpDate); decPaymentSuffixPrefixId = infoSuffixPrefix.SuffixprefixId; }
/// <summary> /// delete function /// </summary> public void DeleteFunction() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); if (spSuffixPrefix.SuffixPrefixSettingsDeleting(decSuffixPrefixId) == -1) { Messages.ReferenceExistsMessage(); } else { Messages.DeletedMessage(); Clear(); } } catch (Exception ex) { MessageBox.Show("SPS7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// voucherType combofill for search function /// </summary> public void VoucherTypeComboFillSearch() { try { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); DataTable dtbl = new DataTable(); dtbl = spSuffixPrefix.VoucherTypeViewAllInSuffixPrefix(); DataRow dr = dtbl.NewRow(); dr[0] = 0; dr[1] = "All"; dtbl.Rows.InsertAt(dr, 0); cmbVoucherTypeSearch.DataSource = dtbl; cmbVoucherTypeSearch.ValueMember = "voucherTypeId"; cmbVoucherTypeSearch.DisplayMember = "voucherTypeName"; cmbVoucherTypeSearch.SelectedIndex = 0; } catch (Exception ex) { MessageBox.Show("SPS2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }