CEL_Payroll/Payroll.Report/UI/rptEmpLifeCycle.cs

95 lines
3.5 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Payroll.BO;
using Ease.CoreV35.Model;
using Ease.CoreV35;
using Microsoft.Reporting.WinForms;
using Ease.CoreV35.DataAccess;
namespace Payroll.Report
{
public partial class rptEmpLifeCycle : Form
{
private ReportItem _reportitem = null;
ObjectsTemplate<EmployeeStatus> _employeeStatuss = new ObjectsTemplate<EmployeeStatus>();
private EnumReportType _reportType = EnumReportType.None;
private EnumReportType _Type = EnumReportType.None;
HREmployee _oEmployee = null;
public rptEmpLifeCycle()
{
InitializeComponent();
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
public void ShowDlg()
{
this.ShowDialog();
}
public EnumReportType Type
{
set
{
_Type = value;
}
}
private void btnPreview_Click(object sender, EventArgs e)
{
DataTable oBody = new Payroll.Report.PayrollDataSet.PayrollDataSet.EmpLifeCycleDataTable();
List<ReportDataSource> dataSource;
ObjectsTemplate<EmpLifeCycle> oHistories = new ObjectsTemplate<EmpLifeCycle>();
oHistories = EmpLifeCycle.GetByEmpID(_oEmployee.ID);
foreach (EmpLifeCycle oItem in oHistories)
{
try
{
EmployeeStatus oStatus = _employeeStatuss.Find(delegate(EmployeeStatus oSts) { return oSts.ID == oItem.StatusDetailID; });
oBody.Rows.Add(_oEmployee.EmployeeNo, _oEmployee.Name, oItem.Description, oItem.EffectDate.ToString("dd MMM yyyy"), oStatus.Description, _oEmployee.Designation == null ? "" : _oEmployee.DescriptionText, _oEmployee.Department==null?"":_oEmployee.Department.Name,
_oEmployee.Grade==null?"": _oEmployee.Grade.Name, _oEmployee.Location==null?"": _oEmployee.Location.Name, _oEmployee.JoiningDate.ToString("dd MMM yyyy"), _oEmployee.BasicSalary,_oEmployee.Function==null?"": _oEmployee.Function.Name,_oEmployee.Category==null?"": _oEmployee.Category.Name);
}
catch (Exception exp)
{
}
}
string embeddedResource = "Payroll.Report.RDLC.EmpLifeCycle.rdlc";
string caption = "Employee History";
dataSource = new List<ReportDataSource>();
dataSource.Add(new ReportDataSource("PayrollDataSet_EmpLifeCycle", oBody));
Cursor.Current = Cursors.WaitCursor;
fReportViewer fViewer = new fReportViewer();
fViewer.PreviewReport(_reportitem, dataSource, embeddedResource, caption);
}
private void rptEmpLifeCycle_Load(object sender, EventArgs e)
{
_employeeStatuss = EmployeeStatus.Get();
this._reportType = _Type;
_reportitem = ReportItem.Get(ID.FromInteger(Convert.ToInt32(_reportType)));
}
private void ctlEmployee_ItemChanged()
{
try
{
if (ctlEmployee.SelectedEmployee != null)
{
_oEmployee = new HREmployee();
_oEmployee = ctlEmployee.SelectedEmployee.HREmployee;
}
}
catch
{
}
}
}
}