/// <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(); DataTable dtblCompany = spCompany.CompanyViewDataTable(1); ds.Tables.Add(dtblCompany); 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) { formMDI.infoError.ErrorString = "MAR15 " + ex.Message; } }