/// <summary> /// Function to edit /// </summary> public void EditFunction() { try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction.Date = Convert.ToDateTime(dtpDate.Text.ToString()); infoBonusDeduction.EmployeeId = Convert.ToDecimal(cmbEmployeeCode.SelectedValue.ToString()); infoBonusDeduction.Month = Convert.ToDateTime(dtpMonth.Text.ToString()); infoBonusDeduction.BonusAmount = Convert.ToDecimal(txtBonusAmount.Text.ToString()); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(txtDeductionAmount.Text.ToString()); infoBonusDeduction.Narration = txtNarration.Text; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; infoBonusDeduction.BonusDeductionId = decBonusId; spBonusDeduction.BonusDedutionEdit(infoBonusDeduction); Messages.UpdatedMessage(); btnSave.Text = "Save"; btnDelete.Enabled = false; dtpDate.Focus(); if (frmBonusDeductionRegisterObj != null) { frmBonusDeductionRegisterObj.Show(); this.Close(); } } catch (Exception ex) { MessageBox.Show("BD3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to call this form from frmBonusDeductionRegister for updation /// </summary> /// <param name="decBonusDeductionId"></param> /// <param name="frm"></param> public void CallFromBonusDeductionRegister(decimal decBonusDeductionId, frmBonusDeductionRegister frm) { try { base.Show(); BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction = spBonusDeduction.BonusDeductionViewForUpdate(decBonusDeductionId); dtpDate.Text = infoBonusDeduction.Date.ToString(); cmbEmployeeCode.SelectedValue = infoBonusDeduction.EmployeeId; decEmployeeIdForEdit = infoBonusDeduction.EmployeeId; dtpMonth.Text = infoBonusDeduction.Month.ToString(); dtMonth = infoBonusDeduction.Month; txtBonusAmount.Text = infoBonusDeduction.BonusAmount.ToString(); txtDeductionAmount.Text = infoBonusDeduction.DeductionAmount.ToString(); txtNarration.Text = infoBonusDeduction.Narration; btnSave.Text = "Update"; dtpMonth.Enabled = false; cmbEmployeeCode.Enabled = false; btnDelete.Enabled = true; txtDate.Focus(); decBonusId = decBonusDeductionId; frmBonusDeductionRegisterObj = frm; frm.Enabled = false; } catch (Exception ex) { MessageBox.Show("BD9:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to delete /// </summary> public void Deletefunction() { try { BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); if ((spBonusDeduction.BonusDeductionReferenceDelete(decEmployeeIdForEdit, dtMonth)) == -1) { MessageBox.Show("Can't delete,reference exist", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } else { Messages.DeletedMessage(); btnSave.Text = "Save"; btnDelete.Enabled = false; this.Close(); if (frmBonusDeductionRegisterObj != null) { frmBonusDeductionRegisterObj.Show(); } } } catch (Exception ex) { MessageBox.Show("BD7:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to save /// </summary> public void SaveFunction() { try { BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); infoBonusDeduction.Date = Convert.ToDateTime(dtpDate.Text.ToString()); infoBonusDeduction.EmployeeId = Convert.ToDecimal(cmbEmployeeCode.SelectedValue.ToString()); infoBonusDeduction.Month = Convert.ToDateTime(dtpMonth.Text.ToString()); infoBonusDeduction.BonusAmount = Convert.ToDecimal(txtBonusAmount.Text.ToString()); infoBonusDeduction.DeductionAmount = Convert.ToDecimal(txtDeductionAmount.Text.ToString()); infoBonusDeduction.Narration = txtNarration.Text; infoBonusDeduction.Extra1 = string.Empty; infoBonusDeduction.Extra2 = string.Empty; if (spBonusDeduction.BonusDeductionAddIfNotExist(infoBonusDeduction)) { Messages.SavedMessage(); Clear(); } else { Messages.InformationMessage(" Employee bonus deduction already exist"); cmbEmployeeCode.Focus(); } } catch (Exception ex) { MessageBox.Show("BD2:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvBonusDeductionReport.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); DataTable dtblBonusDeduction = spBonusDeduction.BonusDeductionReportGridFill(dtpFromDate.Text, dtpToDate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction); ds.Tables.Add(dtblBonusDeduction); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.BonusDeductionReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { formMDI.infoError.ErrorString = "BDR:8" + ex.Message; } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DataTable dtblBonusDeduction = new DataTable(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); dtblBonusDeduction = spBonusDeduction.BonusDeductionSearch(cmbEmployeeName.Text, Convert.ToDateTime(dtpMonth.Text.ToString())); dgvBonusDeduction.DataSource = dtblBonusDeduction; } catch (Exception ex) { formMDI.infoError.ErrorString = "BDR3:" + ex.Message; } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DataTable dtblBonusDeduction = new DataTable(); BonusDedutionSP spBonus = new BonusDedutionSP(); dtblBonusDeduction = spBonus.BonusDeductionSearchForPopUp(txtEmployeeCode.Text, txtEmployeeName.Text); dgvEmployee.DataSource = dtblBonusDeduction; } catch (Exception ex) { MessageBox.Show("EMPP13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DataTable dtblBonusDeduction = new DataTable(); BonusDedutionSP spBonus = new BonusDedutionSP(); dtblBonusDeduction = spBonus.BonusDeductionSearchForPopUp(txtEmployeeCode.Text, txtEmployeeName.Text); dgvEmployee.DataSource = dtblBonusDeduction; } catch (Exception ex) { formMDI.infoError.ErrorString = "EMPP14:" + ex.Message; } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { DataTable dtblBonusDeduction = new DataTable(); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); dtblBonusDeduction = spBonusDeduction.BonusDeductionSearch(cmbEmployeeName.Text, Convert.ToDateTime(dtpMonth.Text.ToString())); dgvBonusDeduction.DataSource = dtblBonusDeduction; } catch (Exception ex) { MessageBox.Show("BDR3:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> private void GridFill() { try { if (rbtnBonus.Checked) { strBonusOrDeduction = rbtnBonus.Text; } else if (rbtnDeduction.Checked) { strBonusOrDeduction = rbtnDeduction.Text; } BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); dgvBonusDeductionReport.DataSource = spBonusDeduction.BonusDeductionReportGridFill(txtDate.Text, txtTodate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction); dgvBonusDeductionReport.Columns["employeeId"].Visible = false; } catch (Exception ex) { formMDI.infoError.ErrorString = "BDR:3" + ex.Message; } }
/// <summary> /// Function to fill Datagridview /// </summary> private void GridFill() { try { if (rbtnBonus.Checked) { strBonusOrDeduction = rbtnBonus.Text; } else if (rbtnDeduction.Checked) { strBonusOrDeduction = rbtnDeduction.Text; } BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); dgvBonusDeductionReport.DataSource = spBonusDeduction.BonusDeductionReportGridFill(txtDate.Text, txtTodate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction); dgvBonusDeductionReport.Columns["employeeId"].Visible = false; } catch (Exception ex) { MessageBox.Show("BDR:3" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvBonusDeductionReport.RowCount > 0) { DataSet ds = new DataSet(); CompanySP spCompany = new CompanySP(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); BonusDedutionSP spBonusDeduction = new BonusDedutionSP(); DataTable dtblBonusDeduction = spBonusDeduction.BonusDeductionReportGridFill(dtpFromDate.Text, dtpToDate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction); ds.Tables.Add(dtblBonusDeduction); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.BonusDeductionReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("BDR:8" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }