/// <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();
         BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
         infoBonusDeduction = BllBonusDeduction.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 fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         List<DataTable> listBonusDeduction = new List<DataTable>();
         BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
         listBonusDeduction = BllBonusDeduction.BonusDeductionSearch(cmbEmployeeName.Text, Convert.ToDateTime(dtpMonth.Text.ToString()));
         dgvBonusDeduction.DataSource = listBonusDeduction[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("BDR3:" + 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();
             CompanyCreationBll bllCompanyCreation = new CompanyCreationBll();
             List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1);
             ds.Tables.Add(listObjCompany[0]);
             BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
             List<DataTable> listBonusDeduction = BllBonusDeduction.BonusDeductionReportGridFill(dtpFromDate.Text, dtpToDate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction);
             ds.Tables.Add(listBonusDeduction[0]);
             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);
     }
 }
 /// <summary>
 /// Function to fill Datagridview
 /// </summary>
 private void GridFill()
 {
     try
     {
         if (rbtnBonus.Checked)
         {
             strBonusOrDeduction = rbtnBonus.Text;
         }
         else if (rbtnDeduction.Checked)
         {
             strBonusOrDeduction = rbtnDeduction.Text;
         }
         BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
         List<DataTable> listObjDesignation = new List<DataTable>();
         listObjDesignation = BllBonusDeduction.BonusDeductionReportGridFill(txtDate.Text, txtTodate.Text, dtpSalaryMonth.Text, cmbDesignation.Text, cmbEmployee.Text, strBonusOrDeduction);
         dgvBonusDeductionReport.DataSource = listObjDesignation[0];
         dgvBonusDeductionReport.Columns["employeeId"].Visible = false;
     }
     catch (Exception ex)
     {
         MessageBox.Show("BDR:3" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }
 /// <summary>
 /// Function to save
 /// </summary>
 public void SaveFunction()
 {
     try
     {
         BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo();
         BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
         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 (BllBonusDeduction.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>
 /// Function to edit
 /// </summary>
 public void EditFunction()
 {
     try
     {
         BonusDedutionInfo infoBonusDeduction = new BonusDedutionInfo();
         BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
         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;
         BllBonusDeduction.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 delete
 /// </summary>
 public void Deletefunction()
 {
     try
     {
         BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
         if ((BllBonusDeduction.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 fill Datagridview
 /// </summary>
 public void GridFill()
 {
     try
     {
         List<DataTable> listBonusDeduction = new List<DataTable>();
         BonusDeductionBll BllBonusDeduction = new BonusDeductionBll();
         listBonusDeduction = BllBonusDeduction.BonusDeductionSearchForPopUp(txtEmployeeCode.Text, txtEmployeeName.Text);
         dgvEmployee.DataSource = listBonusDeduction[0];
     }
     catch (Exception ex)
     {
         MessageBox.Show("EMPP13:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information);
     }
 }