/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { SalaryPackageCreationBll bllSalaryPackage = new SalaryPackageCreationBll(); List<DataTable> ListObj= bllSalaryPackage.SalaryPackageViewAllForSalaryPackageReport(cmbPackageName.Text, cmbStatus.Text); dgvSalaryPackage.DataSource = ListObj[0]; } catch (Exception ex) { MessageBox.Show("SPD:2 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { string strCmbName = string.Empty; try { SalaryPackageCreationBll bllSalaryPackage = new SalaryPackageCreationBll(); List<DataTable> ListObj = new List<DataTable>(); if (cmbStatus.Text == "Yes") { strCmbName = "True"; } else if (cmbStatus.Text == "No") { strCmbName = "False"; } else { strCmbName = "All"; } ListObj = bllSalaryPackage.SalaryPackageregisterSearch(txtPackageName.Text.Trim(), strCmbName); dgvSalaryPackageRegister.DataSource = ListObj[0]; int inRowCount = dgvSalaryPackageRegister.RowCount; for (int i = 0; i < inRowCount; i++) { if (dgvSalaryPackageRegister.Rows[i].Cells["dgvtxtActive"].Value.ToString() == "1") { dgvSalaryPackageRegister.Rows[i].Cells["dgvtxtActive"].Value = "Yes"; } if (dgvSalaryPackageRegister.Rows[i].Cells["dgvtxtActive"].Value.ToString() == "0") { dgvSalaryPackageRegister.Rows[i].Cells["dgvtxtActive"].Value = "No"; } } } catch (Exception ex) { MessageBox.Show("SPR1" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Datagridview /// </summary> public void GridFill() { try { SalaryPackageCreationBll bllSalaryPackageDetails = new SalaryPackageCreationBll(); List<DataTable> ListObj = bllSalaryPackageDetails.SalaryPackageDetailsForSalaryPackageDetailsReport(cmbSalaryPackage.Text); dgvSalaryPackageDetails.DataSource = ListObj; decCountAdditon = 0; decCountDeduction = 0; decTotalAmount = 0; foreach (DataGridViewRow dgvRaw in dgvSalaryPackageDetails.Rows) { if (dgvRaw.Cells["dgvtxttype"].Value.ToString() == "Addition") { decimal decAmt = Convert.ToDecimal(dgvRaw.Cells["txtAmount"].Value.ToString()); decCountAdditon = decCountAdditon + decAmt; } else { decimal decAmt = Convert.ToDecimal(dgvRaw.Cells["txtAmount"].Value.ToString()); decCountDeduction = decCountDeduction + decAmt; } if (dgvRaw.Cells["txtAmount"].Value != null && dgvRaw.Cells["txtAmount"].Value.ToString() != "") { decimal decAmt = Convert.ToDecimal(dgvRaw.Cells["txtAmount"].Value.ToString()); decTotalAmount = decTotalAmount + decAmt; } } txttotalReduction.Text = Math.Round(decCountDeduction, PublicVariables._inNoOfDecimalPlaces).ToString(); txttotalAddition.Text = Math.Round(decCountAdditon, PublicVariables._inNoOfDecimalPlaces).ToString(); //Convert.ToString(decCountAdditon); txtTotal.Text = Math.Round(decTotalAmount, PublicVariables._inNoOfDecimalPlaces).ToString(); //Convert.ToString(decTotalAmount); } catch (Exception ex) { MessageBox.Show("SPDR:1" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Fills the PayHead type and calculates the salary amount on cellvalue changed /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void dgvSalaryPackage_CellValueChanged(object sender, DataGridViewCellEventArgs e) { SalaryPackageCreationBll BllSalaryPackageCreation = new SalaryPackageCreationBll(); try { if (e.RowIndex != -1 && e.ColumnIndex != -1) { if (e.ColumnIndex == dgvSalaryPackage.Columns["dgvcmbPayHead"].Index) { if (dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvcmbPayHead"].Value != null && dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvcmbPayHead"].Value.ToString() != string.Empty) { string strPayHeadType = BllSalaryPackageCreation.PayHeadTypeView(Convert.ToDecimal(dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvcmbPayHead"].Value.ToString())); if (strPayHeadType != string.Empty) { dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvtxtType"].Value = strPayHeadType; } } } bool isStatus = true; if (dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvtxtSlNo"].Value != null && dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvtxtSlNo"].Value.ToString() != string.Empty) { if (dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvcmbPayHead"].Value != null && dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvcmbPayHead"].Value.ToString() != string.Empty) { if (dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value != null && dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value.ToString() != string.Empty) { isStatus = true; } else { isStatus = false; } } else { isStatus = false; } } else { isStatus = false; } if (isStatus) { dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvtxtStatus"].Value = "Complete"; } else { dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvtxtStatus"].Value = string.Empty; } decimal decGrandTotal = 0; if (dgvSalaryPackage.RowCount > 1) { if (dgvSalaryPackage.Rows[e.RowIndex].Cells["dgvtxtAmount"].Value != null) { foreach (DataGridViewRow drRow in dgvSalaryPackage.Rows) { if (!dgvSalaryPackage.CurrentRow.IsNewRow) { if (!drRow.IsNewRow) { if (drRow.Cells["dgvtxtAmount"].Value != null && drRow.Cells["dgvtxtType"].Value != null) { if (drRow.Cells["dgvtxtType"].Value.ToString() != "Deduction") { decGrandTotal += Convert.ToDecimal(drRow.Cells["dgvtxtAmount"].Value.ToString()); lblSalaryAmount.Text = decGrandTotal.ToString(); } else { decGrandTotal -= Convert.ToDecimal(drRow.Cells["dgvtxtAmount"].Value.ToString()); lblSalaryAmount.Text = decGrandTotal.ToString(); } } } } } } } } } catch (Exception ex) { MessageBox.Show("SPC14" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Defaultpackage combobox /// </summary> public void DefaultPackageComboFill() { try { SalaryPackageCreationBll bllSalaryPackage = new SalaryPackageCreationBll(); List<DataTable> ListObj = new List<DataTable>(); ListObj = bllSalaryPackage.SalaryPackageViewAllForActive(); cmbDefaultPackage.DataSource = ListObj[0]; cmbDefaultPackage.ValueMember = "salaryPackageId"; cmbDefaultPackage.DisplayMember = "salaryPackageName"; cmbDefaultPackage.SelectedIndex = -1; } catch (Exception ex) { MessageBox.Show("EC7" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill Package combobox in Datagridview /// </summary> public void SalaryPackageComboFill() { try { List<DataTable> ListObj = new List<DataTable>(); SalaryPackageCreationBll bllSalaryPackage = new SalaryPackageCreationBll(); ListObj = bllSalaryPackage.SalaryPackageViewAllForMonthlySalarySettings(); DataRow dr = ListObj[0].NewRow(); dr[0] = "0"; dr[1] = "--Select--"; ListObj[0].Rows.InsertAt(dr, 0); dgvcmbPackage.DataSource = ListObj[0]; dgvcmbPackage.ValueMember = "salaryPackageId"; dgvcmbPackage.DisplayMember = "salaryPackageName"; } catch (Exception ex) { MessageBox.Show("MSS2" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to fill PackageName combobox /// </summary> public void PackageNameComboFill() { try { SalaryPackageCreationBll bllSalaryPackage = new SalaryPackageCreationBll(); List<DataTable> ListObj = bllSalaryPackage.SalaryPackageViewAll(); DataRow dr = ListObj[0].NewRow(); dr[1] = "All"; ListObj[0].Rows.InsertAt(dr, 0); cmbPackageName.DataSource = ListObj[0]; cmbPackageName.ValueMember = "salaryPackageId"; cmbPackageName.DisplayMember = "salaryPackageName"; } catch (Exception ex) { MessageBox.Show("SPD:1 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click to print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvSalaryPackage.RowCount > 0) { frmReport frmreport = new frmReport(); DataSet ds = new DataSet(); SalaryPackageCreationBll bllSalaryPackage = new SalaryPackageCreationBll(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> ListObj = bllSalaryPackage.SalaryPackageViewAllForSalaryPackageReport(cmbPackageName.Text, cmbStatus.Text); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); ds.Tables.Add(ListObj[0]); ds.Tables.Add(listObjCompany[0]); frmreport.MdiParent = formMDI.MDIObj; frmreport.SalaryPackageReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("SPD:9 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click to Print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvSalaryPackageDetails.RowCount > 0) { DataTable dtblOther = new DataTable(); frmReport frmreport = new frmReport(); DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); SalaryPackageCreationBll bllSalaryPackageDetails = new SalaryPackageCreationBll(); List<DataTable> ListObj = bllSalaryPackageDetails.SalaryPackageDetailsForSalaryPackageDetailsReport(cmbSalaryPackage.Text); ds.Tables.Add(listObjCompany[0]); ds.Tables.Add(ListObj[0]); ds.Tables.Add(dtblOther); DataColumn dc = new DataColumn("Addition", typeof(decimal)); dtblOther.Columns.Add(dc); dc = new DataColumn("Deduction", typeof(decimal)); dtblOther.Columns.Add(dc); DataRow dr = dtblOther.NewRow(); dr[0] = decCountAdditon; dr[1] = decCountDeduction; dtblOther.Rows.InsertAt(dr, 0); frmreport.MdiParent = formMDI.MDIObj; frmreport.SalaryPackageDetailsReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("SPDR:7" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }