//, string credit, string debit, string closing) public void ExportExcel(DataGridView dgv, string rptName, int inFirstRow, int inFirstCol, string Format, object dtFromDate, object dtToDate, string header) { try { if (CheckWhetherOfficeInstalled()) { int inColN = 1; Cursor.Current = Cursors.WaitCursor; string strName = "", strAddress = "", strPhone = ""; Excel.Range range = null; Excel.Application excel = new Excel.Application(); Excel.Workbook wb = excel.Workbooks.Add(Excel.XlSheetType.xlWorksheet); Excel.Worksheet ws = (Excel.Worksheet)excel.ActiveSheet; //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); //BranchInfo InfoBranch = new BranchInfo(); //BranchSP SpBranch = new BranchSP(); // InfoBranch = SpBranch.BranchView(PublicVariables._branchId); strAddress = listObjCompany[0].Rows[0].ItemArray[3].ToString().Replace("\r\n", " "); strPhone = listObjCompany[0].Rows[0].ItemArray[4].ToString(); strName = listObjCompany[0].Rows[0].ItemArray[1].ToString(); //BranchInfo InfoBranch = new BranchInfo(); //BranchSP SpBranch = new BranchSP(); //InfoBranch = SpBranch.BranchView(PublicVariables._branchId); //strAddress = InfoBranch.Address.Replace("\r\n", " "); //if (InfoBranch.PhoneNo == "") //{ // strPhone = InfoBranch.Mobile; //} //else //{ // strPhone = InfoBranch.PhoneNo; //} //strName = InfoBranch.BranchName; //**************Report Header *************************************** //range = (Excel.Range)ws.Cells[1, 1]; range = ws.get_Range("A1", "I1"); range.MergeCells = true; range.Font.Size = 15; range.RowHeight = 27; range.Interior.Color = ColorTranslator.ToWin32(Color.LightGray); range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; range.Cells.VerticalAlignment = Excel.XlVAlign.xlVAlignCenter; range.Value2 = strName; range = ws.get_Range("A2", "I2"); range.MergeCells = true; range.Font.Size = 10; range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; range.Value2 = strAddress; range = ws.get_Range("A3", "I3"); range.MergeCells = true; range.Font.Size = 10; range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; range.Value2 = "Phone No :" + strPhone; range = ws.get_Range("A5", "G5"); range.MergeCells = true; range.Font.Size = 11; range.Value2 = rptName; range.Font.Underline = true; range.Font.Bold = true; range.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; range = ws.get_Range("A6", "G6"); range.MergeCells = true; //range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; range.Font.Size = 11; if (dtFromDate != null && dtToDate != null) { range.Value2 = "(" + DateTime.Parse(dtFromDate.ToString()).Date.ToString("dd-MMM-yyyy") + " To " + DateTime.Parse(dtToDate.ToString()).Date.ToString("dd-MMM-yyyy") + ")"; } else if (dtFromDate != null) { range.Value2 = DateTime.Parse(dtFromDate.ToString()).Date.ToString("dd-MMM-yyyy"); } range.Cells.HorizontalAlignment = Excel.XlHAlign.xlHAlignCenter; range.MergeCells = true; range.Font.Bold = true; range = ws.get_Range("H5", "H5"); range.Value2 = "Date :"; range.Font.Bold = true; range = ws.get_Range("I5", "I5"); range.Value2 = PublicVariables._dtCurrentDate.Date.ToString("dd-MMM-yyyy"); range.Font.Bold = true; int inNewRow = 0; inNewRow = inFirstRow; for (int inRow = inFirstRow; inRow < dgv.Rows.Count; inRow++) { if (dgv.Rows[inRow].Visible != false) { for (int inCol = inFirstCol; inCol < dgv.Columns.Count; inCol++) { if (inRow == 0) { if (dgv.Columns[inCol].Visible == true) { range = (Excel.Range)ws.Cells[inNewRow + 8, inColN]; range.Font.Bold = true; range.Interior.Color = ColorTranslator.ToWin32(Color.LightGray); range.Value2 = dgv.Columns[inCol].HeaderText; } } range = (Excel.Range)ws.Cells[inNewRow + 9, inColN]; if (dgv[inCol, inRow].Style.Font != null) { if (dgv[inCol, inRow].Style.Font.Bold) { range.Font.Bold = true; } } if (dgv.Rows[inRow].DefaultCellStyle.BackColor == Color.LightSkyBlue) { range.Font.Bold = true; range.Interior.Color = ColorTranslator.ToWin32(Color.LightGray); } if (dgv.Rows[inRow].DefaultCellStyle.ForeColor == Color.Red) { range.Font.Bold = true; range.Interior.Color = ColorTranslator.ToWin32(Color.LightGray); } //if (dgv.Rows[inRow].Visible != false) //{ if (dgv.Columns[inCol].Visible == true) { range.BorderAround(Excel.XlLineStyle.xlContinuous, Excel.XlBorderWeight.xlHairline, Excel.XlColorIndex.xlColorIndexAutomatic, 1); if (dgv[inCol, inRow].Value != null) { string str = dgv[inCol, inRow].Value.ToString(); try { if (dgv.Columns[inCol].HeaderText.Replace(" ", "").ToLower() == "phoneno" || dgv.Columns[inCol].HeaderText.Replace(" ", "").ToLower() == "phonenumber") range.NumberFormat = "@"; else { decimal.Parse(str); decimal dc = Math.Round(decimal.Parse(str), 2); str = dc.ToString(); if (dgv.Columns[inCol].Name.ToLower() == "debit" || dgv.Columns[inCol].Name.ToLower() == "credit") range.NumberFormat = "#00.00#"; else range.NumberFormat = "General"; } } catch (Exception) { try { DateTime.Parse(str); range.NumberFormat = "dd-MMM-yyyy"; range.NumberFormat = "General"; } catch (Exception) { range.NumberFormat = "@"; } } if (str.Contains("Dr") || str.Contains("Cr")) range.HorizontalAlignment = Microsoft.Office.Interop.Excel.XlHAlign.xlHAlignRight; //try //{ // if (dgv.Columns[inCol].HeaderText.Replace(" ", "").ToLower() == "phoneno" || dgv.Columns[inCol].HeaderText.Replace(" ", "").ToLower() == "phonenumber") // range.NumberFormat = "@"; // else // { // decimal.Parse(str); // decimal dc = Math.Round(decimal.Parse(str), 2); // str = dc.ToString(); // } //} //catch (Exception) //{ // try // { // DateTime.Parse(str); // range.NumberFormat = "dd-MMM-yyyy"; // range.NumberFormat = "General"; // } // catch (Exception) // { // //range.NumberFormat = "@"; // range.NumberFormat = "General"; // } //} //------------------------------------ //------------------------------------ range.Value2 = str;// dgv[inCol, inRow].Value; } inColN++; } //} } inColN = 1; inNewRow++; } } inNewRow = inNewRow + 10; ws.Columns.AutoFit(); if (Format == "Excel") { excel.Visible = true; } //else if (Format == "Html") //{ // //***********Deleting all format************* // ws.Columns.AutoFit(); // FileInfo infoHtml = new FileInfo(Application.StartupPath + "\\Report.html"); // if (infoHtml.Exists) // { // infoHtml.Delete(); // } // //******************************************* // ws.SaveAs(Application.StartupPath + "\\Report.html", Excel.XlFileFormat.xlHtml, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value, System.Reflection.Missing.Value); // excel.Quit(); // System.Diagnostics.Process.Start("IExplore.exe", Application.StartupPath + "\\Report.html"); //} Cursor.Current = Cursors.Default; } else { MessageBox.Show("Install office", "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show(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> /// 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(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); ds.Tables.Add(listObjCompany[0]); AdvancePaymentBll bllAdvancePayment = new AdvancePaymentBll(); List<DataTable> listObj = new List<DataTable>(); listObj = bllAdvancePayment.AdvancePaymentViewAllForAdvancePaymentReport(dtpFrmDate.Value, dtpToDate.Value, cmbEmployeeCode.Text, DateTime.Parse(dtpSalaryMonth.Text.ToString())); ds.Tables.Add(listObj[0]); 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); } }
/// <summary> /// On print button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvPriceList.Rows.Count > 0) { frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; DataTable dtblOption = new DataTable(); dtblOption.Columns.Add("PurchaseRate", typeof(String)); dtblOption.Columns.Add("SalesRate", typeof(String)); dtblOption.Columns.Add("LastSalesRate", typeof(String)); dtblOption.Columns.Add("StandardRate", typeof(String)); dtblOption.Columns.Add("MRP", typeof(String)); dtblOption.Columns.Add("Price", typeof(String)); DataRow dr = dtblOption.NewRow(); dr["PurchaseRate"] = cbxPurchaseRate.Checked ? "True" : "False"; dr["SalesRate"] = cbxSalesRate.Checked ? "True" : "False"; dr["LastSalesRate"] = cbxlastSalesRate.Checked ? "True" : "False"; dr["StandardRate"] = CbxStandardRate.Checked ? "True" : "False"; dr["MRP"] = cbxMrp.Checked ? "True" : "False"; dr["Price"] = "True"; dtblOption.Rows.Add(dr); DataSet ds = new DataSet(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> listObjPriceList = BllPriceList.PriceListReportPrint(decGroupId, strProductName, decSizeId, decModelId, decPricingLevelId); List<DataTable> listObjCompanyReport = bllCompanyCreation.CompanyViewDataTable(1); DataTable dtblPriceListGridFill = listObjPriceListReport[0].Copy(); ds.Tables.Add(listObjCompanyReport[0]); ds.Tables.Add(listObjPriceList[0]); ds.Tables.Add(dtblOption); frmReport.MdiParent = formMDI.MDIObj; frmReport.PriceListReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show(" RPL17:" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <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 (dgvEmployeeAddressBook.Rows.Count > 0) { DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); ds.Tables.Add(listObjCompany[0]); EmployeeCreationBll BllEmployeeCreation = new EmployeeCreationBll(); List<DataTable> listEmployee = BllEmployeeCreation.EmployeeViewAllForEmployeeAddressBook(cmbEmployeeCode.Text, txtMobile.Text, txtPhone.Text, txtEmail.Text); ds.Tables.Add(listEmployee[0]); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.EmployeeAddressBookPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("EMP8 " + 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 { DataSet dsSalesOrderReport = new DataSet(); // CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); DataTable dtblDetails = new DataTable(); dtblDetails = ListObj[0].Copy(); if (ListObj[0].Rows.Count > 0) { dsSalesOrderReport.Tables.Add(listObjCompany[0]); dsSalesOrderReport.Tables.Add(dtblDetails); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.SalesOrderReportPrinting(dsSalesOrderReport, txtTotalAmount.Text); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("SORP16:" + ex.Message, "OpenMiracle", 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 /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvContraReport.RowCount > 0) { DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); frmReport reportobj = new frmReport(); //ContraMasterSP spContraMaster = new ContraMasterSP(); ContraVoucherDetailsBll bllContraVoucherDetails = new ContraVoucherDetailsBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); List<DataTable> listObjCotraReport = bllContraVoucherDetails.ContraReport(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text, cmbCashOrBank.Text, strType); ds.Tables.Add(listObjCompany[0]); ds.Tables.Add(listObjCotraReport[0]); reportobj.MdiParent = formMDI.MDIObj; reportobj.ContraVoucherReport(ds); } else { MessageBox.Show("No data found", "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } } catch (Exception ex) { MessageBox.Show("CRT:12" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click for print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvMonthlySalary.Rows.Count > 0) { DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); ds.Tables.Add(listObjCompany[0]); MonthlySalaryVoucherBll BllMonthlySalary = new MonthlySalaryVoucherBll(); List<DataTable> ListMonthlySalary = BllMonthlySalary.MonthlySalryViewAllForMonthlySalaryReports(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbDesignation.Text, cmbEmployeeCode.Text, Convert.ToDateTime(dtpSalaryMonth.Value.ToString())); ds.Tables.Add(ListMonthlySalary[0]); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.MonthlySalaryReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("MSR:9" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Print button click /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click_1(object sender, EventArgs e) { try { //PhysicalStockMasterSP spPhysicalStockMaster = new PhysicalStockMasterSP(); PhysicalStockBll BllPhysicalStock = new PhysicalStockBll(); if (dgvPhysicalStockReport.RowCount > 0) { DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); frmReport reportobj = new frmReport(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); List<DataTable> listObjPhysicalStockReport = BllPhysicalStock.PhysicalStockReportFill(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), txtVoucherNo.Text.Trim(), txtProductName.Text.Trim(), Convert.ToDecimal(cmbProductCode.SelectedValue), Convert.ToDecimal(cmbVoucherType.SelectedValue)); ds.Tables.Add(listObjCompany[0]); ds.Tables.Add(listObjPhysicalStockReport[0]); reportobj.MdiParent = formMDI.MDIObj; reportobj.PhysicalStockReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("PSRT:6" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// On 'Print' button click to print the data /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvPurchaseReturnReport.Rows.Count > 0) { if (dgvPurchaseReturnReport.Rows.Count > 0) { DataSet dsPurchaseReturnReport = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); DataTable dtblGrid = ListObjReg[0].Copy(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); dsPurchaseReturnReport.Tables.Add(dtblGrid); dsPurchaseReturnReport.Tables.Add(listObjCompany[0]); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.PurchaseReturnReportPrinting(dsPurchaseReturnReport, txtTotalAmount.Text); } } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("PRRT:13" + ex.Message, "OpenMiracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// on "print' button click for print /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void btnPrint_Click(object sender, EventArgs e) { try { if (dgvServiceReport.RowCount > 0) { DataSet dsServiceVoucherReport = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); frmReport reportobj = new frmReport(); ServicesBll BllService = new ServicesBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); List<DataTable> listServiceVoucherReport = BllService.ServiceReport(Convert.ToDateTime(dtpFromDate.Value.ToString()), Convert.ToDateTime(dtpToDate.Value.ToString()), cmbVoucherType.Text, cmbCashOrParty.Text, cmbSalesman.Text); dsServiceVoucherReport.Tables.Add(listObjCompany[0]); dsServiceVoucherReport.Tables.Add(listServiceVoucherReport[0]); reportobj.MdiParent = formMDI.MDIObj; reportobj.ServiceVoucherReport(dsServiceVoucherReport); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("SVRT 15 : " + 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 { DateTime FromDate = this.dtpFromDate.Value; DateTime ToDate = this.dtpToDate.Value; DataSet ds = new DataSet(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); DataTable dtblProduct = listObj[0].Copy(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); if (dgvProductBatch.Rows.Count > 0) { DataTable dtblNew = listObj[0].Copy(); ds.Tables.Add(listObjCompany[0]); ds.Tables.Add(dtblProduct); frmReport frmReport = new frmReport(); frmReport.MdiParent = formMDI.MDIObj; frmReport.ProductBatchReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show(" PVSBR:9" + ex.Message, "OpenMiracle", 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 (dgvDailySalary.RowCount > 0) { DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); EmployeeCreationBll BllEmployeeCreation = new EmployeeCreationBll(); List<DataTable> listEmployee = BllEmployeeCreation.EmployeeViewAllForDailySalaryReport(cmbEmployeeCode.Text, cmbDesignation.Text, Convert.ToDateTime(dtpFromDate.Text.ToString()), Convert.ToDateTime(dtpToDate.Text.ToString()), cmbStatus.Text); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); ds.Tables.Add(listObjCompany[0]); ds.Tables.Add(listEmployee[0]); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.DailySalaryReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("DSR9 " + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <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 (dgvMonthlyAttendance.Rows.Count > 0) { DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> dlistObjCompany = bllCompanyCreation.CompanyViewDataTable(1); ds.Tables.Add(dlistObjCompany[0]); DataTable dtblMonthlyAttendance = new DataTable(); dtblMonthlyAttendance.Columns.Add("SlNo", typeof(Int32)); dtblMonthlyAttendance.Columns.Add("employeeCode", typeof(string)); dtblMonthlyAttendance.Columns.Add("employeeName", typeof(string)); dtblMonthlyAttendance.Columns.Add("Present", typeof(string)); dtblMonthlyAttendance.Columns.Add("Absent", typeof(string)); foreach (DataGridViewRow dgvrow in dgvMonthlyAttendance.Rows) { dtblMonthlyAttendance.Rows.Add(); dtblMonthlyAttendance.Rows[dgvrow.Index]["SlNo"] = dgvrow.Cells["SlNo"].Value; dtblMonthlyAttendance.Rows[dgvrow.Index]["employeeCode"] = dgvrow.Cells["employeeCode"].Value; dtblMonthlyAttendance.Rows[dgvrow.Index]["employeeName"] = dgvrow.Cells["employeeName"].Value; dtblMonthlyAttendance.Rows[dgvrow.Index]["Present"] = dgvrow.Cells["Present"].Value; dtblMonthlyAttendance.Rows[dgvrow.Index]["Absent"] = dgvrow.Cells["Absent"].Value; } ds.Tables.Add(dtblMonthlyAttendance); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.MonthlyAttendancePrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("MAR15 " + 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 (dgvDailyAttendanceReport.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]); AttendanceBll BllAttendanceMaster = new AttendanceBll(); List<DataTable> ListAttendance = BllAttendanceMaster.DailyAttendanceViewForDailyAttendanceReport(dtpDate.Text.Trim(), cmbStatus.Text.Trim(), cmbEmployee.Text.Trim(), cmbDesignation.Text.Trim()); ds.Tables.Add(ListAttendance[0]); frmReport frmReportObj = new frmReport(); frmReportObj.MdiParent = formMDI.MDIObj; frmReportObj.DailyAttendanceReportPrinting(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("DAR:8" + ex.Message, "Open Miracle", MessageBoxButtons.OK, MessageBoxIcon.Information); } }
/// <summary> /// Function to print partyaddress book /// </summary> public void Print() { try { if (dvgPartyAddressBook.RowCount > 0) { DataSet ds = new DataSet(); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); frmReport reportobj = new frmReport(); AccountLedgerBll bllAccountLedger = new AccountLedgerBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); List < DataTable > ListObj= bllAccountLedger.PartyAddressBookPrint(cmbAccountGroup.Text, txtMobile.Text, txtPhone.Text, txtEmail.Text, txtLedgerName.Text); ds.Tables.Add(listObjCompany[0]); ds.Tables.Add(ListObj[0]); reportobj.MdiParent = formMDI.MDIObj; reportobj.PartyAddressBookPrint(ds); } } catch (Exception ex) { MessageBox.Show("PAB:3" + ex.Message, "OpenMiracle", 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 (dgvPayHead.RowCount > 0) { DataSet ds = new DataSet(); PayHeadBll BllPayHead = new PayHeadBll(); List<DataTable> listObj = BllPayHead.PayHeadViewAllForPayHeadReport(cmbPayHead.Text, cmbType.Text); //CompanySP spCompany = new CompanySP(); CompanyCreationBll bllCompanyCreation = new CompanyCreationBll(); List<DataTable> listObjCompany = bllCompanyCreation.CompanyViewDataTable(1); frmReport frmreport = new frmReport(); frmreport.MdiParent = formMDI.MDIObj; ds.Tables.Add(listObj[0]); ds.Tables.Add(listObjCompany[0]); frmreport.PayHeadReport(ds); } else { Messages.InformationMessage("No data found"); } } catch (Exception ex) { MessageBox.Show("PHR:7 " + 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); } }