/// <summary> /// On 'Print' button click to take print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvAdvancePayment.Rows.Count > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); DataTable dtblAdvancePayment = new DataTable(); dtblAdvancePayment = spAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, DateTime.Parse(dtpSalaryMonth.Text.ToString())); ds.Tables.Add(dtblAdvancePayment); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.AdvancePaymentReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "APR:8 " + ex.Message; } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); DataTable dtbl = spAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, dtpSalaryMonth.Value); dgvAdvancePayment.DataSource = dtbl; TotalAmount(); } catch (Exception ex) { MessageBox.Show("APR:1 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DataTable dtblAdvancePayment = new DataTable(); AdvancePaymentSP spAdvanceRegister = new AdvancePaymentSP(); dtblAdvancePayment = spAdvanceRegister.AdvanceRegisterSearch(txtAdvanceVoucher.Text, txtEmployeeCode.Text, txtEmployeeName.Text, dtpSalaryMonth.Text, cmbVoucherType.Text); dgvAdvanceRegister.DataSource = dtblAdvancePayment; } catch (Exception ex) { MessageBox.Show("AR1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); DataTable dtbl = spAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, dtpSalaryMonth.Value); dgvAdvancePayment.DataSource = dtbl; TotalAmount(); } catch (Exception ex) { formMDI.infoError.ErrorString = "APR:1 " + ex.Message; } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DataTable dtblAdvancePayment = new DataTable(); AdvancePaymentSP spAdvanceRegister = new AdvancePaymentSP(); dtblAdvancePayment = spAdvanceRegister.AdvanceRegisterSearch(txtAdvanceVoucher.Text, txtEmployeeCode.Text, txtEmployeeName.Text, dtpSalaryMonth.Text, cmbVoucherType.Text); dgvAdvanceRegister.DataSource = dtblAdvancePayment; } catch (Exception ex) { formMDI.infoError.ErrorString = "AR1:" + ex.Message; } }
/// <summary> /// Function to fill cmbVoucherType combobox /// </summary> public void VoucherTypeNameComboFill() { try { AdvancePaymentSP spAdvancePaymentSP = new AdvancePaymentSP(); DataTable dtblVoucherTypeName = new DataTable(); dtblVoucherTypeName = spAdvancePaymentSP.VoucherTypeNameComboFillAdvanceRegister(); DataRow dr = dtblVoucherTypeName.NewRow(); dr[1] = "All"; dtblVoucherTypeName.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtblVoucherTypeName; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; } catch (Exception ex) { formMDI.infoError.ErrorString = "AR2:" + ex.Message; } }
/// <summary> /// Function to fill cmbVoucherType combobox /// </summary> public void VoucherTypeNameComboFill() { try { AdvancePaymentSP spAdvancePaymentSP = new AdvancePaymentSP(); DataTable dtblVoucherTypeName = new DataTable(); dtblVoucherTypeName = spAdvancePaymentSP.VoucherTypeNameComboFillAdvanceRegister(); DataRow dr = dtblVoucherTypeName.NewRow(); dr[1] = "All"; dtblVoucherTypeName.Rows.InsertAt(dr, 0); cmbVoucherType.DataSource = dtblVoucherTypeName; cmbVoucherType.ValueMember = "voucherTypeId"; cmbVoucherType.DisplayMember = "voucherTypeName"; } catch (Exception ex) { MessageBox.Show("AR2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to delete /// </summary> public void DeleteFunction() { try { MonthlySalarySP spMonthlySalary = new MonthlySalarySP(); if (!spMonthlySalary.CheckSalaryStatusForAdvancePayment(Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()), dtpSalaryMonth.Value)) { AdvancePaymentInfo infoAdvancepayment = new AdvancePaymentInfo(); AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); LedgerPostingSP spLedgerPosting = new LedgerPostingSP(); spAdvancePayment.AdvancePaymentDelete(Convert.ToDecimal(decAdvancePaymentEditId.ToString())); spLedgerPosting.LedgerPostDelete(txtAdvanceVoucherNo.Text.Trim(), decAdvancePaymentEditId); Messages.DeletedMessage(); txtAdvanceVoucherNo.Focus(); Clear(); this.Close(); } else { Messages.ReferenceExistsMessage(); dtpSalaryMonth.Focus(); } } catch (Exception ex) { MessageBox.Show("AP14:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to edit /// </summary> public void EditFunction() { try { MonthlySalarySP spMonthlySalary = new MonthlySalarySP(); if (!spMonthlySalary.CheckSalaryStatusForAdvancePayment(Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()), dtpSalaryMonth.Value)) { AdvancePaymentSP spAdvancepayment = new AdvancePaymentSP(); AdvancePaymentInfo infoAdvancepayment = new AdvancePaymentInfo(); LedgerPostingSP spLedgerPosting = new LedgerPostingSP(); if (spAdvancepayment.CheckSalaryAlreadyPaidOrNot(Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()), dtpSalaryMonth.Value)) { txtAmount.ReadOnly = true; } infoAdvancepayment.AdvancePaymentId = (Convert.ToDecimal(decAdvancePaymentEditId.ToString())); infoAdvancepayment.EmployeeId = Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()); infoAdvancepayment.SalaryMonth = Convert.ToDateTime(dtpSalaryMonth.Text.ToString()); infoAdvancepayment.Chequenumber = txtCheckNo.Text.ToString(); infoAdvancepayment.Date = Convert.ToDateTime(txtDate.Text.ToString()); infoAdvancepayment.Amount = Convert.ToDecimal(txtAmount.Text.ToString()); if (CheckAdvanceAmount()) { if (isAutomatic) { infoAdvancepayment.VoucherNo = strVoucherNo; } else { infoAdvancepayment.VoucherNo = txtAdvanceVoucherNo.Text.Trim(); } if (isAutomatic) { infoAdvancepayment.InvoiceNo = strInvoiceNo; } else { infoAdvancepayment.InvoiceNo = txtAdvanceVoucherNo.Text.Trim(); } infoAdvancepayment.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString()); infoAdvancepayment.ChequeDate = Convert.ToDateTime(txtChequeDate.Text.ToString()); infoAdvancepayment.Narration = txtNarration.Text.Trim(); infoAdvancepayment.ExtraDate = Convert.ToDateTime(DateTime.Now.ToString()); infoAdvancepayment.Extra1 = string.Empty; infoAdvancepayment.Extra2 = string.Empty; infoAdvancepayment.VoucherTypeId = decPaymentVoucherTypeId; infoAdvancepayment.SuffixPrefixId = decPaymentSuffixPrefixId; infoAdvancepayment.FinancialYearId = PublicVariables._decCurrentFinancialYearId; spAdvancepayment.AdvancePaymentEdit(infoAdvancepayment); LedgerUpdate(); Messages.UpdatedMessage(); txtAdvanceVoucherNo.Focus(); this.Close(); } } else { Messages.ReferenceExistsMessageForUpdate(); dtpSalaryMonth.Focus(); } } catch (Exception ex) { MessageBox.Show("AP3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call save or edit /// </summary> public void SaveOrEdit() { try { AdvancePaymentSP spAdvancepayment = new AdvancePaymentSP(); if (txtAdvanceVoucherNo.Text.Trim() == string.Empty) { Messages.InformationMessage("Enter advance voucher no"); txtAdvanceVoucherNo.Focus(); } else if (txtDate.Text == string.Empty) { Messages.InformationMessage("Select date"); } else if (cmbEmployee.Text == string.Empty) { Messages.InformationMessage("Select employee"); cmbEmployee.Focus(); } else if (txtAmount.Text.TrimEnd() == string.Empty) { Messages.InformationMessage("Select amount"); txtAmount.Focus(); } else if (cmbCashOrBank.Text == string.Empty) { Messages.InformationMessage("Select Cash/Bank/ac"); cmbCashOrBank.Focus(); } else { if (btnAdvancePaymentSave.Text == "Save") { if (PublicVariables.isMessageAdd) { if (Messages.SaveMessage()) { if (!isAutomatic) { if (!spAdvancepayment.AdvancePaymentCheckExistence(txtAdvanceVoucherNo.Text.Trim(), decPaymentVoucherTypeId, 0)) { SaveFunction(); } else { Messages.InformationMessage("Advance voucher number already exist"); txtAdvanceVoucherNo.Focus(); } } else { SaveFunction(); } } } else { if (!isAutomatic) { if (!spAdvancepayment.AdvancePaymentCheckExistence(txtAdvanceVoucherNo.Text.Trim(), decPaymentVoucherTypeId, 0)) { SaveFunction(); } else { Messages.InformationMessage("Advance voucher number already exist"); txtAdvanceVoucherNo.Focus(); } } else { SaveFunction(); } } } else { if (btnAdvancePaymentSave.Text == "Update") { if (PublicVariables.isMessageEdit) { bool EditMessage = Messages.UpdateMessage(); if (EditMessage) { if (!isAutomatic) { if (!spAdvancepayment.AdvancePaymentCheckExistence(txtAdvanceVoucherNo.Text.Trim(), decPaymentVoucherTypeId, decAdvancePaymentEditId)) { EditFunction(); } else { Messages.InformationMessage("Advance voucher number already exist"); txtAdvanceVoucherNo.Focus(); } } else { EditFunction(); } } } else { if (!isAutomatic) { if (!spAdvancepayment.AdvancePaymentCheckExistence(txtAdvanceVoucherNo.Text.Trim(), decPaymentVoucherTypeId, decAdvancePaymentEditId)) { EditFunction(); } else { Messages.InformationMessage("Advance voucher number already exist"); txtAdvanceVoucherNo.Focus(); } } else { EditFunction(); } } } } } } catch (Exception ex) { MessageBox.Show("AP4:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function for Ledger Posting /// </summary> /// <param name="decLedgerPostingId"></param> /// <param name="decAdvancePaymentId"></param> public void LedgerPosting(decimal decLedgerPostingId, decimal decAdvancePaymentId) { try { AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); AdvancePaymentInfo infoAdvancePayment = new AdvancePaymentInfo(); LedgerPostingSP spLedgerPosting = new LedgerPostingSP(); LedgerPostingInfo infoLedgerPosting = new LedgerPostingInfo(); infoLedgerPosting.VoucherTypeId = decPaymentVoucherTypeId; if (isAutomatic) { infoLedgerPosting.VoucherNo = strVoucherNo; } else { infoLedgerPosting.VoucherNo = txtAdvanceVoucherNo.Text.Trim(); } infoLedgerPosting.Date = PublicVariables._dtCurrentDate; infoLedgerPosting.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString()); infoLedgerPosting.DetailsId = decAdvancePaymentId; if (isAutomatic) { infoLedgerPosting.InvoiceNo = strInvoiceNo; } else { infoLedgerPosting.InvoiceNo = txtAdvanceVoucherNo.Text.Trim(); } infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.Debit = 0; infoLedgerPosting.Credit = Convert.ToDecimal(txtAmount.Text.ToString()); infoLedgerPosting.ChequeNo = string.Empty; infoLedgerPosting.ChequeDate = DateTime.Now; infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; spLedgerPosting.LedgerPostingAdd(infoLedgerPosting); infoLedgerPosting.VoucherTypeId = decPaymentVoucherTypeId; if (isAutomatic) { infoLedgerPosting.VoucherNo = strVoucherNo; } else { infoLedgerPosting.VoucherNo = txtAdvanceVoucherNo.Text.Trim(); } infoLedgerPosting.Date = PublicVariables._dtCurrentDate; infoLedgerPosting.LedgerId = 3; infoLedgerPosting.DetailsId = decAdvancePaymentId; if (isAutomatic) { infoLedgerPosting.InvoiceNo = strInvoiceNo; } else { infoLedgerPosting.InvoiceNo = txtAdvanceVoucherNo.Text.Trim(); } infoLedgerPosting.YearId = PublicVariables._decCurrentFinancialYearId; infoLedgerPosting.Debit = Convert.ToDecimal(txtAmount.Text.ToString()); infoLedgerPosting.Credit = 0; infoLedgerPosting.ChequeNo = string.Empty; infoLedgerPosting.ChequeDate = DateTime.Now; infoLedgerPosting.ExtraDate = PublicVariables._dtCurrentDate; infoLedgerPosting.Extra1 = string.Empty; infoLedgerPosting.Extra2 = string.Empty; spLedgerPosting.LedgerPostingAdd(infoLedgerPosting); } catch (Exception ex) { MessageBox.Show("AP6:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill controls for update /// </summary> public void fillFunction() { try { AdvancePaymentSP spadvance = new AdvancePaymentSP(); AdvancePaymentInfo infoadvance = new AdvancePaymentInfo(); VoucherTypeSP spvouchertype = new VoucherTypeSP(); infoadvance = spadvance.AdvancePaymentView(decAdvancePaymentEditId); strVoucherNo = infoadvance.VoucherNo; txtAdvanceVoucherNo.Text = infoadvance.InvoiceNo; strInvoiceNo = infoadvance.InvoiceNo; cmbEmployee.SelectedValue = infoadvance.EmployeeId.ToString(); dtpSalaryMonth.Value = Convert.ToDateTime(infoadvance.SalaryMonth.ToString()); txtDate.Text = infoadvance.Date.ToString("dd-MMM-yyyy"); txtChequeDate.Text = infoadvance.Date.ToString("dd-MMM-yyyy"); cmbCashOrBank.SelectedValue = infoadvance.LedgerId.ToString(); txtCheckNo.Text = infoadvance.Chequenumber; txtAmount.Text = infoadvance.Amount.ToString(); txtNarration.Text = infoadvance.Narration; btnAdvancePaymentSave.Text = "Update"; btnAdvancePaymentDelete.Enabled = true; decAdvancePaymentsId = decAdvancePaymentId; decPaymentVoucherTypeId = infoadvance.VoucherTypeId; decPaymentSuffixPrefixId = infoadvance.SuffixPrefixId; isAutomatic = spvouchertype.CheckMethodOfVoucherNumbering(decPaymentVoucherTypeId); if (isAutomatic) { txtAdvanceVoucherNo.Enabled = false; } else { txtAdvanceVoucherNo.Enabled = true; } } catch (Exception ex) { MessageBox.Show("AP8:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
public void SaveFunction() { try { AdvancePaymentSP spAdvancepayment = new AdvancePaymentSP(); AdvancePaymentInfo infoAdvancepayment = new AdvancePaymentInfo(); LedgerPostingSP spLedgerPosting = new LedgerPostingSP(); MonthlySalarySP spMonthlySalary = new MonthlySalarySP(); if (CheckAdvanceAmount()) { if (!spMonthlySalary.CheckSalaryAlreadyPaidOrNotForAdvancePayment(Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()), dtpSalaryMonth.Value)) { if (!spAdvancepayment.CheckSalaryAlreadyPaidOrNot(Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()), dtpSalaryMonth.Value)) { if (isAutomatic == true) { infoAdvancepayment.VoucherNo = strVoucherNo; } else { infoAdvancepayment.VoucherNo = txtAdvanceVoucherNo.Text.Trim(); } infoAdvancepayment.EmployeeId = Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()); infoAdvancepayment.SalaryMonth = Convert.ToDateTime(dtpSalaryMonth.Text.ToString()); infoAdvancepayment.Chequenumber = txtCheckNo.Text.ToString(); infoAdvancepayment.Date = Convert.ToDateTime(txtDate.Text.ToString()); infoAdvancepayment.Amount = Convert.ToDecimal(txtAmount.Text.ToString()); if (isAutomatic) { infoAdvancepayment.InvoiceNo = strInvoiceNo; } else { infoAdvancepayment.InvoiceNo = txtAdvanceVoucherNo.Text.Trim(); } infoAdvancepayment.LedgerId = Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString()); infoAdvancepayment.ChequeDate = Convert.ToDateTime(txtChequeDate.Text.ToString()); infoAdvancepayment.Narration = txtNarration.Text.Trim(); infoAdvancepayment.ExtraDate = Convert.ToDateTime(DateTime.Now.ToString()); infoAdvancepayment.Extra1 = string.Empty; infoAdvancepayment.Extra2 = string.Empty; infoAdvancepayment.VoucherTypeId = decPaymentVoucherTypeId; infoAdvancepayment.SuffixPrefixId = decPaymentSuffixPrefixId; infoAdvancepayment.FinancialYearId = PublicVariables._decCurrentFinancialYearId; if (btnAdvancePaymentSave.Text == "Save") { if (decAdvancePaymentsId != -1) { DataTable dtbl = new DataTable(); dtbl = spAdvancepayment.AdvancePaymentAddWithIdentity(infoAdvancepayment, isAutomatic); foreach (DataRow dr in dtbl.Rows) { decAdvancePaymentId = Convert.ToDecimal(dr.ItemArray[0].ToString()); strUpdatedVoucherNumber = dr.ItemArray[1].ToString(); strUpdatedInvoiceNumber = dr.ItemArray[2].ToString(); } if (!isAutomatic) { strVoucherNo = txtAdvanceVoucherNo.Text.Trim(); } if (isAutomatic) { if (Convert.ToDecimal(strUpdatedVoucherNumber) != Convert.ToDecimal(strVoucherNo)) { Messages.InformationMessage("Voucher number changed from " + strInvoiceNo + " to " + strUpdatedInvoiceNumber); strVoucherNo = strUpdatedVoucherNumber.ToString(); strInvoiceNo = strUpdatedInvoiceNumber; } } txtAdvanceVoucherNo.Focus(); } LedgerPosting(Convert.ToDecimal(cmbCashOrBank.SelectedValue.ToString()), decAdvancePaymentId); Messages.SavedMessage(); Clear(); } } else { Messages.InformationMessage(" Advance already paid for this month"); dtpSalaryMonth.Focus(); } } else { Messages.InformationMessage("Cant pay advance for this month,Salary already paid"); dtpSalaryMonth.Focus(); } } } catch (Exception ex) { MessageBox.Show("AP1:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Employee combobox /// </summary> public void EmployeeComboFill() { try { AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); DataTable dtblspAdvancePayment = new DataTable(); dtblspAdvancePayment = spAdvancePayment.AdvancePaymentEmployeeComboFill(); cmbEmployee.DataSource = dtblspAdvancePayment; cmbEmployee.ValueMember = "EmployeeId"; cmbEmployee.DisplayMember = "EmployeeName"; cmbEmployee.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("AP12:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to generate Voucher number as per settings /// </summary> public void VoucherNoGeneration() { TransactionsGeneralFill obj = new TransactionsGeneralFill(); AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); if (strVoucherNo == string.Empty) { strVoucherNo = "0"; } strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpSalaryMonth.Value, strAdvancePayment); if (Convert.ToDecimal(strVoucherNo) != spAdvancePayment.AdvancePaymentGetMaxPlusOne(decPaymentVoucherTypeId)) { strVoucherNo = spAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId).ToString(); strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpSalaryMonth.Value, strAdvancePayment); if (spAdvancePayment.AdvancePaymentGetMax(decPaymentVoucherTypeId) == "0") { strVoucherNo = "0"; strVoucherNo = obj.VoucherNumberAutomaicGeneration(decPaymentVoucherTypeId, Convert.ToDecimal(strVoucherNo), dtpSalaryMonth.Value, strAdvancePayment); } } if (isAutomatic) { SuffixPrefixSP spSuffixPrefix = new SuffixPrefixSP(); SuffixPrefixInfo infoSuffixPrefix = new SuffixPrefixInfo(); infoSuffixPrefix = spSuffixPrefix.GetSuffixPrefixDetails(decPaymentVoucherTypeId, dtpDate.Value); strPrefix = infoSuffixPrefix.Prefix; strSuffix = infoSuffixPrefix.Suffix; strInvoiceNo = strPrefix + strVoucherNo + strSuffix; txtAdvanceVoucherNo.Text = strInvoiceNo; txtAdvanceVoucherNo.Enabled = false; } }
/// <summary> /// Function to check wheteher the advance amount given exceeds the limit for that employee or not /// </summary> /// <returns></returns> public bool CheckAdvanceAmount() { bool Cancel = true; try { decimal decEmployeeId = 0; AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); decimal decEmployeesalary = 0; if (cmbEmployee.SelectedValue != null) { decEmployeeId = Convert.ToDecimal(cmbEmployee.SelectedValue.ToString()); } decEmployeesalary = spAdvancePayment.AdvancePaymentAmountchecking(decEmployeeId); decimal txtamountvalue = 0; if (txtAmount.Text != string.Empty) { txtamountvalue = Convert.ToDecimal(txtAmount.Text.ToString()); } if (txtamountvalue > decEmployeesalary) { MessageBox.Show("Advance of this month exceeds than amount set for the employee", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); txtAmount.Focus(); Cancel = false; } } catch (Exception ex) { MessageBox.Show("AP16:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } return Cancel; }
/// <summary> /// On 'Print' button click to take print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvAdvancePayment.Rows.Count > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); AdvancePaymentSP spAdvancePayment = new AdvancePaymentSP(); DataTable dtblAdvancePayment = new DataTable(); dtblAdvancePayment = spAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, DateTime.Parse(dtpSalaryMonth.Text.ToString())); ds.Tables.Add(dtblAdvancePayment); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.AdvancePaymentReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("APR:8" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }