public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { SalarySheetReport rpt = new SalarySheetReport(); rpt.Site = this.Site; return(rpt); }
private void btnQuery_Click(object sender, RoutedEventArgs e) { int year = Convert.ToInt32(txtYear.Text); int month = Convert.ToInt32(txtMonth.Text); Guid deptId = (Guid)cmbDepts.SelectedValue; SalarySheetDAL sheetDAL = new SalarySheetDAL(); if (sheetDAL.IsExists(year, month, deptId) == false) { MessageBox.Show("还未生成工资!"); return; } SalarySheetItem[] items = sheetDAL.GetSalarySheetItems(year, month, deptId); SalarySheetItemRpt[] rptItems = new SalarySheetItemRpt[items.Length]; for (int i = 0; i < items.Length; i++) { SalarySheetItem item = items[i]; SalarySheetItemRpt rptItem = new SalarySheetItemRpt(); rptItem.BaseSalary = item.BaseSalary; rptItem.Bonus = item.Bonus; rptItem.Fine = item.Fine; rptItem.Other = item.Other; //select emp.Name join T_employee rptItem.EmployeeName = new EmployeeDAL().GetById(item.EmployeeId).Name; rptItems[i] = rptItem; } SalarySheetReport report = new SalarySheetReport(); report.SetDataSource(rptItems); report.SetParameterValue("年", year); report.SetParameterValue("月", month); report.SetParameterValue("部门名称", cmbDepts.Text); reportsViewerItems.ViewerCore.ReportSource = report; }
private void btnQuery_Click(object sender, RoutedEventArgs e) { int year = Convert.ToInt32(txtYear.Text); int month = Convert.ToInt32(txtMonth.Text); Guid deptId = (Guid)cmbDepts.SelectedValue; SalarySheetDAL sheetDAL = new SalarySheetDAL(); if (sheetDAL.IsExists(year, month, deptId) == false) { MessageBox.Show("还未生成工资!"); return; } SalarySheetItem[] items = sheetDAL.GetSalarySheetItems(year, month, deptId); SalarySheetItemRpt[] rptItems = new SalarySheetItemRpt[items.Length]; for (int i = 0; i < items.Length;i++ ) { SalarySheetItem item = items[i]; SalarySheetItemRpt rptItem = new SalarySheetItemRpt(); rptItem.BaseSalary = item.BaseSalary; rptItem.Bonus = item.Bonus; rptItem.Fine = item.Fine; rptItem.Other = item.Other; //select emp.Name join T_employee rptItem.EmployeeName = new EmployeeDAL().GetById(item.EmployeeId).Name; rptItems[i] = rptItem; } SalarySheetReport report = new SalarySheetReport(); report.SetDataSource(rptItems); report.SetParameterValue("年",year); report.SetParameterValue("月", month); report.SetParameterValue("部门名称", cmbDepts.Text); reportsViewerItems.ViewerCore.ReportSource = report; }
public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { SalarySheetReport rpt = new SalarySheetReport(); rpt.Site = this.Site; return rpt; }