private void btnOKPayroll_Click(object sender, EventArgs e) { if (dtpCODF1.Value > dtpCODT1.Value) { MessageBox.Show("Invalid date range.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); dtpCODF1.Select(); return; } if (dtpCODF2.Value > dtpCODT2.Value) { MessageBox.Show("Invalid date range.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); dtpCODF2.Select(); return; } pnlPayroll.Visible = false; DTRRpt rptTA = new DTRRpt(); rptTA.WindowState = FormWindowState.Maximized; if (cboReports.Text == "Payroll Time Attendance") { rptTA.rptName = "PayrollTA"; rptTA.rptLabel = "PAYROLL TIME ATTENDANCE"; rptTA.rptLogDate = "PAY PERIOD: " + dtpCODF1.Value.ToShortDateString() + " - " + dtpCODT2.Value.ToShortDateString(); rptTA.rptDateFrom = dtpCODF1.Value.ToShortDateString(); rptTA.rptDateTo = dtpCODT1.Value.ToShortDateString(); rptTA.rptDateFrom2 = dtpCODF2.Value.ToShortDateString(); rptTA.rptDateTo2 = dtpCODT2.Value.ToShortDateString(); } rptTA.Show(); }
private void btnPrint_Click(object sender, EventArgs e) { if (cboReports.Text == "") { MessageBox.Show("Please select report name.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } if (cboReports.Text != "Payroll Time Attendance" && cboReports.Text != "Daily Time Attendance") { if (dtpFrom.Value > dtpTo.Value) { MessageBox.Show("Invalid date range.", Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Exclamation); return; } } pnlPeriod.Visible = false; pnlPayroll.Visible = false; DTRRpt rptTA = new DTRRpt(); rptTA.WindowState = FormWindowState.Maximized; if (cboReports.Text == "Daily Time Attendance") { rptTA.rptName = "DTA"; rptTA.rptLabel = "DAILY TIME ATTENDANCE"; rptTA.rptLogDate = dtpLogDate.Value.ToShortDateString(); } else if (cboReports.Text == "Periodic Time Attendance") { rptTA.rptName = "PTA"; rptTA.rptLabel = "PERIODIC TIME ATTENDANCE"; rptTA.rptLogDate = "PERIOD: " + dtpFrom.Value.ToShortDateString() + " - " + dtpTo.Value.ToShortDateString(); rptTA.rptDateFrom = dtpFrom.Value.ToShortDateString(); rptTA.rptDateTo = dtpTo.Value.ToShortDateString(); } else if (cboReports.Text == "Time Attendance Summary") { rptTA.rptName = "PTASummary"; rptTA.rptLabel = "PERIODIC TIME ATTENDANCE SUMMARY"; rptTA.rptLogDate = "PERIOD: " + dtpFrom.Value.ToShortDateString() + " - " + dtpTo.Value.ToShortDateString(); rptTA.rptDateFrom = dtpFrom.Value.ToShortDateString(); rptTA.rptDateTo = dtpTo.Value.ToShortDateString(); } else if (cboReports.Text == "Employee Time Attendance") { string strEmpID = ((Label)dtrDTR.CurrentItem.Controls["lblEmpID"]).Text; rptTA.rptName = "EmpPTA"; rptTA.rptEmpID = Convert.ToInt16(strEmpID); rptTA.rptLabel = "EMPLOYEE TIME ATTENDANCE HISTORY"; rptTA.rptLogDate = "PERIOD: " + dtpFrom.Value.ToShortDateString() + " - " + dtpTo.Value.ToShortDateString(); rptTA.rptDateFrom = dtpFrom.Value.ToShortDateString(); rptTA.rptDateTo = dtpTo.Value.ToShortDateString(); } else if (cboReports.Text == "Payroll Time Attendance") { btnOKPayroll_Click(null, null); return; } rptTA.Show(); }