CEL_Payroll/Payroll.Report/Class/rptTraining.cs

1259 lines
52 KiB
C#
Raw Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Payroll.BO;
using Ease.CoreV35.Model;
using System.Data;
using Microsoft.Reporting.WinForms;
namespace Payroll.Report
{
public class rptTraining
{
#region Declaration & Construction
ObjectsTemplate<Department> _Departments = new ObjectsTemplate<Department>();
ObjectsTemplate<Designation> _Designations = new ObjectsTemplate<Designation>();
ObjectsTemplate<Branch> _Branches = new ObjectsTemplate<Branch>();
ObjectsTemplate<Location> _Locations = new ObjectsTemplate<Location>();
ObjectsTemplate<Employee> _Employees = new ObjectsTemplate<Employee>();
ObjectsTemplate<Institution> _Institution = new ObjectsTemplate<Institution>();
public String SearchCriteria { get; set; }
public rptTraining()
{
_Designations = Designation.Get(EnumStatus.Regardless);
_Branches = Branch.Get(EnumStatus.Regardless);
_Locations = Location.Get();
_Departments = Department.Get();
_Employees = Employee.Get();
_Institution = Institution.Get();
SearchCriteria = string.Empty;
}
#endregion
#region Public Functions
public void ShowTrainingSummaryReport(ObjectsTemplate<SearchEmployee> Employees, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int trainingID, int deptID, int instituteID)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
int Sl = 1;
string temp = string.Empty;
DataSet oEmpDetails = Training.GetEmployeeWiseTrainingSummary(Employees, fromDate, toDate, tNature, tTrainingType, trainingID, deptID, instituteID);
if (oEmpDetails.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtTrainingSummeryDataTable dTEmpDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTrainingSummeryDataTable();
foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows)
{
dr = dTEmpDetail.NewRow();
dr["EmployeeNo"] = oDRow["EMPLOYEENO"];
dr["EmployeeName"] = oDRow["EmployeeName"];
dr["DesignationCode"] = oDRow["DCode"];
dr["Designation"] = oDRow["Designation"];
Department oD = _Departments.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"])).Single();
if (oD.Tier == 1)
{
dr["Division"] = "";
dr["Department"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["Division"] = oD.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 3)
{
dr["Division"] = oD.Parent.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 4)
{
dr["Division"] = oD.Parent.Parent.Name;
dr["Department"] = oD.Parent.Name;
//dr["DivisionID"] = oD.Parent.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else
{
dr["Division"] = "";
dr["Department"] = "";
}
dr["Branch"] = oDRow["Branch"];
dr["NameOfTrainingTopic"] = oDRow["TrainingName"];
dr["TrainingType"] = oDRow["TrainingType"];
dr["TrainingNature"] = oDRow["TrainingNature"];
dr["TrainingOrganization"] = oDRow["Institute"];
dr["Date"] = Convert.ToDateTime(oDRow["StartDate"]).ToString("dd MMM yyyy");
dr["EndDate"] = Convert.ToDateTime(oDRow["EndDate"]).ToString("dd MMM yyyy");
dr["Venue"] = oDRow["Venue"];
dr["TrainingHour"] = oDRow["TrainingHour"];
dr["TrainingMinutes"] = oDRow["TotalTrainingMinutes"];
dr["Costing"] = oDRow["TrainingCost"];
dr["Sl"] = Sl.ToString();
dTEmpDetail.Rows.Add(dr);
if (temp != oDRow["EMPLOYEENO"].ToString())
{
Sl++;
}
temp = oDRow["EMPLOYEENO"].ToString();
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
DataSet dSet = new DataSet();
dTEmpDetail.TableName = "TrainingDataset_dtTrainingSummery";
dSet.Tables.Add(dTEmpDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter prm = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(prm);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.EmployeeTrainingSummeryReport.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
public void ShowTrainingWiseReport(ObjectsTemplate<SearchEmployee> Employees, Training otraining, DateTime fromDate, DateTime toDate, int nNatureID, int nTypeID, int ndeptID, int instituteID)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
string temp = string.Empty;
int Sl = 1;
DataSet trainingds = Training.GetTrainingWiseReport(Employees,otraining != null ? otraining.ID : null, fromDate, toDate, nTypeID, nNatureID, ndeptID, instituteID);
if (trainingds.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtTrainingWiseReportDataTable dTTraining = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTrainingWiseReportDataTable();
int TotalEmp = 0;
foreach (DataRow oDRow in trainingds.Tables[0].Rows)
{
dr = dTTraining.NewRow();
if (temp != oDRow["Name"].ToString())
{
Sl = 1;
}
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"]))
.Single();
if (oD.Tier == 1)
{
dr["Division"] = "";
dr["Department"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["Division"] = oD.Name;
//dr["DivisionID"] = oD.ID.Integer;
dr["DepartmentID"] = oD.ID.Integer;
dr["Department"] = oD.Name;
}
else if (oD.Tier == 3)
{
dr["Division"] = oD.Parent.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.Parent.ID.Integer;
dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 4)
{
dr["Division"] = oD.Parent.Parent.Name;
dr["Department"] = oD.Parent.Name;
//dr["DivisionID"] = oD.Parent.Parent.ID.Integer;
dr["DepartmentID"] = oD.Parent.ID.Integer;
}
else
{
dr["Division"] = "";
dr["Department"] = "";
}
dr["NoOfAttendee"] = oDRow["EmpCount"];
//dr["DepartmentalAttendee"] = (Convert.ToDouble(oDRow["EmpCount"].ToString()) / Convert.ToDouble(oDRow["ttlPrsEmpCount"].ToString()) * 100).ToString("#.##");
dr["DepartmentalAttendee"] = oDRow["ttlPrsEmpCount"];
//if (temp != oDRow["Name"].ToString())
//{
// Sl = 1;
//}
//else
// Sl++;
//dr["Sl"] = Sl.ToString();
dr["Sl"] = Sl.ToString();
temp = oDRow["Name"].ToString();
dr["TrainingName"] = oDRow["Name"];
TotalEmp += Convert.ToInt32(oDRow["EmpCount"]);
dTTraining.Rows.Add(dr);
Sl++;
}
//DataView view2 = new DataView(dTTraining);
//DataTable distinctEmps = view2.ToTable(true, "EmpNo");
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
List<PayrollDataSet.TrainingDataset.dtTrainingWiseReportRow> rows = dTTraining.AsEnumerable().OrderBy(odr => odr["TrainingName"]).ThenBy(odr => odr["Division"]).ThenBy(odr => odr["Department"]).ToList();
DataTable dTTraining2 = rows.CopyToDataTable();
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("TrainingName", otraining.Name);
parameters.Add(parameter);
parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
parameter = new ReportParameter("EmpCount", "Total Employee: " + TotalEmp.ToString());
parameters.Add(parameter);
DataSet dSet = new DataSet();
dTTraining2.TableName = "TrainingDataset_dtTrainingWiseReport";
dSet.Tables.Add(dTTraining2);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.EmployeeTrainingWiseReport.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
public void ShowDeptWiseTrainingReport(int dptid, DateTime fromDate, DateTime toDate, int tNatureID, int tTrainingTypeID, int instituteID, int trainingID)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
string temp = string.Empty;
int Sl = 1;
// Department oDepartment = Department.Get(ID.FromInteger(dptid));
DataSet trainingds = Training.GetDeptWiseTrainingReport(dptid, fromDate, toDate, tNatureID, tTrainingTypeID, instituteID, trainingID);
if (trainingds.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtTrainingAttendeeByDepartmentDataTable dTTraining = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTrainingAttendeeByDepartmentDataTable();
PayrollDataSet.TrainingDataset.dtTrainingAttendeeByDepartmentDataTable dTTrainingSorted = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTrainingAttendeeByDepartmentDataTable();
foreach (DataRow oDRow in trainingds.Tables[0].Rows)
{
dr = dTTraining.NewRow();
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DepartmentID"]))
.Single();
if (oD.Tier == 1)
{
//dr["Division"] = "";
//dr["DepartmentName"] = "";
dr["DepartmentName"] = oD.Name;
}
else if (oD.Tier == 2)
{
//dr["Division"] = oD.Name;
//dr["DivisionID"] = oD.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
dr["DepartmentName"] = oD.Name;
}
else if (oD.Tier == 3)
{
//dr["Division"] = oD.Parent.Name;
dr["DepartmentName"] = oD.Name;
//dr["DivisionID"] = oD.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 4)
{
//dr["Division"] = oD.Parent.Parent.Name;
dr["DepartmentName"] = oD.Parent.Name;
//dr["DivisionID"] = oD.Parent.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else
{
// dr["Division"] = "";
dr["DepartmentName"] = "";
}
dr["DeptID"] = oDRow["DepartmentID"];
// dr["DepartmentName"] = oDRow["DeptName"];
dr["TrainingName"] = oDRow["NAME"];
dr["TrainingNature"] = oDRow["Nature"];
dr["TrainingType"] = oDRow["TrainingType"];
dr["NoOfAttedenee"] = oDRow["EmpCount"];
dr["PercentOfTotalAttendee"] = (Convert.ToDouble(oDRow["EmpCount"].ToString()) / Convert.ToDouble(oDRow["ttlPrsEmpCount"].ToString())).ToString("0.##");
dTTraining.Rows.Add(dr);
}
foreach (DataRow item in dTTraining.AsEnumerable().OrderBy(o=>o["DepartmentName"].ToString()).ToList())
{
if (temp != item["DeptID"].ToString())
{
Sl = 1;
}
DataRow newRow = dTTrainingSorted.NewRow();
newRow["DeptID"] = item["DeptID"].ToString();
newRow["DepartmentName"] = item["DepartmentName"];
newRow["TrainingName"] = item["TrainingName"];
newRow["TrainingNature"] = item["TrainingNature"];
newRow["TrainingType"] = item["TrainingType"];
newRow["NoOfAttedenee"] = item["NoOfAttedenee"];
newRow["PercentOfTotalAttendee"] = item["PercentOfTotalAttendee"];
newRow["Sl"] = Sl;
dTTrainingSorted.Rows.Add(newRow);
Sl++;
temp = item["DeptID"].ToString();
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
//List<ReportParameter> parameters = new List<ReportParameter>();
//ReportParameter parameter = new ReportParameter("DepartmentName", oDepartment.Name);
//parameters.Add(parameter);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
DataSet dSet = new DataSet();
dTTrainingSorted.TableName = "TrainingDataset_dtTrainingAttendeeByDepartment";
dSet.Tables.Add(dTTrainingSorted);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.TrainingAttendeeByDept.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
//No Date Range
public void ShowTNAStatusReport(int year)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
//Department oDepartment = Department.Get(ID.FromInteger(dptid));
//DataSet trainingds = Training.GetDeptWiseTrainingReport(oDepartment.ID);
ObjectsTemplate<TrainingNeedAnalysis> trainNeedAnalysises = TrainingNeedAnalysis.GetByYear(year);
if (trainNeedAnalysises != null)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtTNAReportDataTable dTTNA = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTNAReportDataTable();
foreach (TrainingNeedAnalysis oTNA in trainNeedAnalysises)
{
dr = dTTNA.NewRow();
if (oTNA.TrainingID > 0)
{
ObjectsTemplate<TrainingSchedule> oTrainingSch = TrainingSchedule.Get(oTNA.TrainingID, oTNA.ID.Integer);
dr["SchedulePrepared"] = oTrainingSch.Count;
dr["ScheduleCompleted"] = (oTrainingSch.Where(obj => obj.ScheduleStatus == false).ToList()).Count;
dr["ScheduleNotPrepared"] = oTNA.TrainingNdAnalysisTimeSchs.Count - oTrainingSch.Count;
}
else
{
dr["SchedulePrepared"] = "0";
dr["ScheduleCompleted"] = "0";
dr["ScheduleNotPrepared"] = oTNA.TrainingNdAnalysisTimeSchs.Count.ToString();
}
dr["ProposedTraningName"] = oTNA.Name;
dr["ScheduleProposed"] = oTNA.TrainingNdAnalysisTimeSchs.Count.ToString();
dr["ScheduleApproved"] = "";
dr["TrainingYear"] = oTNA.TrainingYear;
dTTNA.Rows.Add(dr);
}
DataSet dSet = new DataSet();
dTTNA.TableName = "TrainingDataset_dtTNAReport";
dSet.Tables.Add(dTTNA);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.TNAReport.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
//No Date Range
public void ShowEmployeeWiseTrainingReport(ObjectsTemplate<SearchEmployee> Employees, int nNatureID, int tTrainingTypeID, int ndeptID, int instituteID,int year)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
DataSet oEmpDetails = Training.GetEmployeeWiseTrainingReport(Employees, nNatureID, tTrainingTypeID, ndeptID, instituteID, year);
if (oEmpDetails.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtEmployeeWiseTraningDataTable dTEmpDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtEmployeeWiseTraningDataTable();
foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows)
{
dr = dTEmpDetail.NewRow();
dr["Name"] = oDRow["EmployeeName"];
//dr["DesignationCode"] = oDRow["DCode"];
dr["Designation"] = oDRow["Designation"];
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"]))
.Single();
if (oD.Tier == 1)
{
dr["Division"] = "";
dr["Department"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["Division"] = oD.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 3)
{
dr["Division"] = oD.Parent.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 4)
{
dr["Division"] = oD.Parent.Parent.Name;
dr["Department"] = oD.Parent.Name;
//dr["DivisionID"] = oD.Parent.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else
{
dr["Division"] = "";
dr["Department"] = "";
}
dr["DOJ"] = Convert.ToDateTime(oDRow["JOININGDATE"]).ToString("dd MMM yyyy");
dr["TotalTraningReceivedLastYear"] = oDRow["ReceivedLastYear"];
dr["TraningAssigned"] = oDRow["Assigned"];
dr["TraningReceived"] = oDRow["Received"];
dr["TotalTraningReceivedTillDate"] = oDRow["ReceivedTillDate"];
dr["TraningOutStanding"] = Convert.ToInt32(oDRow["Assigned"]) - Convert.ToInt32(oDRow["Received"]);
dTEmpDetail.Rows.Add(dr);
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("CurrentYear", year.ToString());
parameters.Add(parameter);
parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
DataSet dSet = new DataSet();
dTEmpDetail.TableName = "TrainingDataset_dtEmployeeWiseTraning";
dSet.Tables.Add(dTEmpDetail);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.EmployeeWiseTrainingStatus.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
public void ShowTrainingAttendenceReport(ObjectsTemplate<SearchEmployee> Employees, Training otraining, DateTime dStartDate, DateTime dEndDate, int tTrainingTypeID, int nNatureID, int instituteID, int nScheduleID)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
DataSet trainingds = Training.GetTrainingAttendenceReport(Employees,otraining.ID,dStartDate,dEndDate, tTrainingTypeID, nNatureID, instituteID, nScheduleID);
if (trainingds.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtAttendenceRecordDataTable dTTrainingAttn =
new Payroll.Report.PayrollDataSet.TrainingDataset.dtAttendenceRecordDataTable();
foreach (DataRow oDRow in trainingds.Tables[0].Rows)
{
dr = dTTrainingAttn.NewRow();
dr["Name"] = oDRow["Name"];
dr["EmpNo"] = oDRow["EmployeeNo"];
dr["Branch"] = oDRow["BranchName"];
dr["Designation"] = oDRow["DesignationName"];
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"]))
.Single();
//Employee oEmp = _Employees
// .Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["BranchID"]))
// .Single();
//dr["Designation"] = oEmp.Designation.Name;
if (oD.Tier == 1)
{
dr["Division"] = "";
dr["Department"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["Division"] = oD.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 3)
{
dr["Division"] = oD.Parent.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 4)
{
dr["Division"] = oD.Parent.Parent.Name;
dr["Department"] = oD.Parent.Name;
//dr["DivisionID"] = oD.Parent.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else
{
dr["Division"] = "";
dr["Department"] = "";
}
//dr["Branch"] = oEmp.Location.Name;
dr["Attendence"] = oDRow["Atteddence"];
dr["AttnStatus"] = Convert.ToInt32(oDRow["ScheduleEmpStatus"])==2?"":((EnumTSStatus)Convert.ToInt32(oDRow["ScheduleEmpStatus"])).ToString();
dTTrainingAttn.Rows.Add(dr);
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
DataSet dSet = new DataSet();
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("TrainingName", otraining.Name);
parameters.Add(parameter);
parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
dTTrainingAttn.TableName = "TrainingDataset_dtAttendenceRecord";
dSet.Tables.Add(dTTrainingAttn);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.TraningAttendenceReport.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
public void ShowTrainingDetailsReport(ObjectsTemplate<SearchEmployee> Employees, DateTime dStartDate, DateTime dEndDate, int nNatureID, int nTypeID, int instituteID)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
int Sl = 1;
string temp = string.Empty;
DataSet oEmpDetails = Training.GetEmployeeWiseTrainingDetails(Employees,dStartDate,dEndDate,nTypeID,nNatureID, instituteID);
if (oEmpDetails.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtTrainingDetailsDataTable dTEmpDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTrainingDetailsDataTable();
foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows)
{
dr = dTEmpDetail.NewRow();
dr["EmpNo"] = oDRow["EMPLOYEENO"];
dr["EmpName"] = oDRow["EmployeeName"];
dr["DesignationCode"] = oDRow["Code"];
dr["Designation"] = oDRow["Designation"];
dr["DOJ"] = Convert.ToDateTime(oDRow["JoiningDate"]).ToString("dd MMM yyyy");
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"]))
.Single();
Institution oIns = _Institution.Where(oo => oo.ID.Integer == Convert.ToInt32(oDRow["InstituteID"].ToString())).SingleOrDefault();
if (oD.Tier == 1)
{
dr["Division"] = "";
dr["Department"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["Division"] = oD.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 3)
{
dr["Division"] = oD.Parent.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 4)
{
dr["Division"] = oD.Parent.Parent.Name;
dr["Department"] = oD.Parent.Name;
//dr["DivisionID"] = oD.Parent.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else
{
dr["Division"] = "";
dr["Department"] = "";
}
dr["Sl"] = Sl.ToString();
dr["Branch"] = oDRow["Branch"];
dr["TrainingName"] = oDRow["TrainingName"];
dr["TrainingType"] = oDRow["TrainingType"];
dr["TrainingNature"] = oDRow["TrainingNature"];
dr["OrganizerVenue"] = oDRow["Venue"];
dr["Year"] = oDRow["Year"];
dr["TrainingDate"] = Convert.ToDateTime(oDRow["StartDate"]).ToString("dd MMM yyyy");
dr["EndDate"] = Convert.ToDateTime(oDRow["EndDate"]).ToString("dd MMM yyyy");
dr["TrainingHour"] = oDRow["TrainingHour"];
//dr["TrainingMinutes"] = oDRow["TotalTrainingMinutes"];
dr["PerPersonCost"] = oDRow["TrainingCost"];
dr["Ins"] = oIns!=null? oIns.Name:"";
dTEmpDetail.Rows.Add(dr);
if (temp != oDRow["EMPLOYEENO"].ToString())
{
Sl++;
}
temp = oDRow["EMPLOYEENO"].ToString();
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
DataSet dSet = new DataSet();
dTEmpDetail.TableName = "TrainingDataset_dtTrainingDetails";
dSet.Tables.Add(dTEmpDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.TrainingDetailsReport.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
public void ShowTrainingNameWiseDetailsReport(ObjectsTemplate<SearchEmployee> Employees, DateTime dStartDate, DateTime dEndDate, int nNatureID, int nTyprID, int instituteID, int trainingID)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
int sl = 1;
string temp = string.Empty;
DataSet oEmpDetails = Training.GetTrainingNameWiseDetails(Employees,dStartDate,dEndDate, nTyprID, nNatureID, instituteID, trainingID);
if (oEmpDetails.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtTrainingNameWiseReportDataTable dTEmpDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTrainingNameWiseReportDataTable();
foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows)
{
dr = dTEmpDetail.NewRow();
dr["Sl"] = sl.ToString();
dr["EmpNo"] = oDRow["EMPLOYEENO"];
dr["EmpName"] = oDRow["Name"];
//dr["DesignationCode"] = oDRow["Code"];
dr["Designation"] = oDRow["Designation"];
//dr["DOJ"] = Convert.ToDateTime(oDRow["JoiningDate"]).ToString("dd MMM yyyy");
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"]))
.Single();
Institution oIns = _Institution.Where(oo => oo.ID.Integer == Convert.ToInt32(oDRow["InstituteID"].ToString())).SingleOrDefault();
if (oD.Tier == 1)
{
//dr["Division"] = "";
dr["Department"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["Department"] = oD.Name;
//dr["Division"] = oD.Name;
//dr["DivisionID"] = oD.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 3)
{
//dr["Division"] = oD.Parent.Name;
dr["Department"] = oD.Name;
//dr["DivisionID"] = oD.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else if (oD.Tier == 4)
{
//dr["Division"] = oD.Parent.Parent.Name;
dr["Department"] = oD.Parent.Name;
//dr["DivisionID"] = oD.Parent.Parent.ID.Integer;
//dr["DepartmentID"] = oD.ID.Integer;
}
else
{
dr["Division"] = "";
dr["Department"] = "";
}
//dr["Branch"] = oDRow["Branch"];
dr["TrainingName"] = oDRow["TrainingName"];
dr["ManHour"] = oDRow["TrainingHour"];
//dr["TrainingType"] = oDRow["TrainingType"];
//dr["TrainingNature"] = oDRow["TrainingNature"];
dr["OrganizerVenue"] = oDRow["Venue"];
dr["Year"] = oDRow["Year"];
//dr["TrainingDate"] = Convert.ToDateTime(oDRow["StartDate"]).ToString("dd MMM yyyy");
dr["StartDate"] = Convert.ToDateTime(oDRow["StartDate"]).ToString("dd MMM yyyy");
dr["EndDate"] = Convert.ToDateTime(oDRow["EndDate"]).ToString("dd MMM yyyy");
dr["TotalCost"] = oDRow["TrainingCost"];
dr["Ins"] = oIns.Name;
if (temp!=oDRow["TrainingName"].ToString())
{
sl++;
}
dTEmpDetail.Rows.Add(dr);
temp = oDRow["TrainingName"].ToString();
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
DataSet dSet = new DataSet();
dTEmpDetail.TableName = "TrainingDataset_dtTrainingNameWiseReport";
dSet.Tables.Add(dTEmpDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.TrainingNameWiseDetailsReport.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
//No Date Range
public void ShowDepartmentWiseTrainingExpense(ObjectsTemplate<SearchEmployee> Employees, int nNatureID, int nTrainingTypeID, int instituteID, int year)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
DataSet oEmpDetails = Training.GetDepartmentWiseTrainingExpense(Employees, nNatureID, nTrainingTypeID, instituteID, year);
if (oEmpDetails.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtDepartmentWiseTraningExpenseDataTable dTEmpDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtDepartmentWiseTraningExpenseDataTable();
foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows)
{
dr = dTEmpDetail.NewRow();
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"]))
.Single();
if (oD.Tier == 1)
{
//dr["DepartmentName"] = "";
dr["DepartmentName"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["DepartmentName"] = oD.Name;
}
else if (oD.Tier == 3)
{
dr["DepartmentName"] = oD.Name;
}
else if (oD.Tier == 4)
{
dr["DepartmentName"] = oD.Parent.Name;
}
else
{
dr["DepartmentName"] = "";
}
dr["NoOfParticipants"] = oDRow["EmpCount"];
dr["TotalTrainingMinutes"] = oDRow["TotalTrainingMinutes"];
dr["ManHour"] = oDRow["TrainingHour"];
dr["TotalCost"] = oDRow["Cost"];
dTEmpDetail.Rows.Add(dr);
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
DataSet dSet = new DataSet();
dTEmpDetail.TableName = "TrainingDataset_dtDepartmentWiseTraningExpense";
dSet.Tables.Add(dTEmpDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
parameter = new ReportParameter("CurrentYear", year.ToString());
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.DepartmentWiseTraningExpense.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
public void ShowTrainingConductedByDepartment(int dptid, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int trainingID, int instituteID)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
string temp = string.Empty;
int Sl = 1;
DataSet oDeptDetails = Training.GetTrainingConductedByDeptReport(dptid, fromDate, toDate, tNature, tTrainingType, trainingID != 0 ? trainingID : 0, instituteID);
if (oDeptDetails.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtTrainingConductedByDeptDataTable dTDeptDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTrainingConductedByDeptDataTable();
foreach (DataRow oDRow in oDeptDetails.Tables[0].Rows)
{
dr = dTDeptDetail.NewRow();
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"]))
.Single();
if (oD.Tier == 1)
{
dr["DepartmentName"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["DepartmentName"] = oD.Name;
}
else if (oD.Tier == 3)
{
dr["DepartmentName"] = oD.Name;
}
else if (oD.Tier == 4)
{
dr["DepartmentName"] = oD.Parent.Name;
}
else
{
dr["DepartmentName"] = "";
}
dr["DeptID"] = oDRow["DepartmentID"];
//dr["DepartmentName"] = oDRow["Description"];
dr["TrainingName"] = oDRow["Training"];
dr["TrainingNature"] = oDRow["Nature"];
dr["TrainingType"] = oDRow["TrainingType"];
dr["TotalConductedTrainingSession"] = oDRow["NoOfSession"];
dr["ParcentOfTotalTraining"] = Convert.ToDouble(oDRow["NoOfSession"].ToString()) / Convert.ToDouble(oDRow["TotalSchedule"].ToString());
//dr["TrainingName"] = oDRow["Training"];
dr["Sl"] = Sl.ToString();
if (temp != oDRow["Training"].ToString())
{
Sl = 1;
}
dTDeptDetail.Rows.Add(dr);
Sl++;
temp = oDRow["Training"].ToString();
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
//List<ReportParameter> parameters = new List<ReportParameter>();
//ReportParameter parameter = new ReportParameter("Department", Department.Get(ID.FromInteger(dptid)).Name);
//parameters.Add(parameter);
DataSet dSet = new DataSet();
dTDeptDetail.TableName = "TrainingDataset_dtTrainingConductedByDept";
dSet.Tables.Add(dTDeptDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.TrainingConductedByDept.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
//No Date Range
public void ShowEntityWiseTrainingSummery(ObjectsTemplate<SearchEmployee> Employees, DateTime fromDate, DateTime toDate, int tNature, int tTrainingType, int instituteID)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
DataSet oTrainingDetails = Training.GetEntityWiseTrainingSummery(Employees, fromDate, toDate, tNature, tTrainingType, instituteID);
if (oTrainingDetails.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtEntityWiseTrainingSummeryDataTable dTTrainingDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtEntityWiseTrainingSummeryDataTable();
foreach (DataRow oDRow in oTrainingDetails.Tables[0].Rows)
{
dr = dTTrainingDetail.NewRow();
dr["NameOfTheEntity"] = oDRow["Description"];
dr["NatureOfTraining"] = oDRow["TrainingType"];
dr["NoOfTraining"] = oDRow["NoOfTrainings"];
dr["NoOfParticipants"] = oDRow["NoOfParticipants"];
dr["ManHourSpent"] = oDRow["TrainingHour"];
dr["ManHourSpent"] = oDRow["TrainingHour"];
dr["TotalTrainingMinutes"] = oDRow["TotalTrainingMinutes"];
dr["TotalCost"] = oDRow["Cost"];
dTTrainingDetail.Rows.Add(dr);
}
DataSet dSet = new DataSet();
dTTrainingDetail.TableName = "TrainingDataset_dtEntityWiseTrainingSummery";
dSet.Tables.Add(dTTrainingDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.EntityWiseTrainingSummery.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
// No chinta now
public void ShowTrainingCostDetailsReport(ObjectsTemplate<SearchEmployee> Employees)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
DataSet oEmpDetails = Training.GetTrainingCostDetailsReport(Employees);
PayrollDataSet.TrainingDataset.dtTraningCostDetailsDataTable dTEmpDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTraningCostDetailsDataTable();
string temp = string.Empty;
foreach (DataRow oDRow in oEmpDetails.Tables[0].Rows)
{
if (temp!=oDRow["EMPLOYEEID"].ToString())
{
dr = dTEmpDetail.NewRow();
dr["EmpNo"] = oDRow["EMPLOYEENO"];
dr["Name"] = oDRow["Name"];
dr["EmpNo"] = oDRow["EMPLOYEENO"];
dr["Designation"] = oDRow["Designation"];
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DEPARTMENTID"]))
.Single();
if (oD.Tier == 1)
{
dr["Department"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["Department"] = oD.Name;
}
else if (oD.Tier == 3)
{
dr["Department"] = oD.Name;
}
else if (oD.Tier == 4)
{
dr["Department"] = oD.Parent.Name;
}
else
{
dr["Department"] = "";
}
dr["TopicsName"] = oDRow["TrainingTopics"];
dr["OrganizerAndVenue"] = oDRow["Venue"];
dr["Duration"] = oDRow["StartDate"] + " To " + oDRow["EndDate"];
dr["NoOfParticipants"] = oDRow["TotalEmployee"];
dr["NoOfTraningDays"] = oDRow["DiffDate"];
dr["TotalTrainingHours"] = oDRow["DiffHour"];
}
if (oDRow["TrainingCostHeadID"].ToString() == "1")
{
dr["AirFare"] = oDRow["Amount"];
}
else if (oDRow["TrainingCostHeadID"].ToString() == "2")
{
dr["VisaAndOthers"] = oDRow["Amount"];
}
else if (oDRow["TrainingCostHeadID"].ToString() == "3")
{
dr["TrainingAndRegistration"] = oDRow["Amount"];
}
else if (oDRow["TrainingCostHeadID"].ToString() == "4")
{
dr["BankCharges"] = oDRow["Amount"];
}
if (temp != oDRow["EMPLOYEEID"].ToString())
{
dTEmpDetail.Rows.Add(dr);
temp = oDRow["EMPLOYEEID"].ToString();
}
//else if (temp == oDRow["EMPLOYEEID"].ToString())
//{
// //else if (oDRow["TrainingCostHeadID"].ToString() == "5")
// //{
// // dr["Allowences"] = oDRow["Amount"];
// // dTEmpDetail.Rows.Add(dr);
// //}
//}
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
DataSet dSet = new DataSet();
dTEmpDetail.TableName = "TrainingDataset_dtTraningCostDetails";
dSet.Tables.Add(dTEmpDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.TrainingCostDetails.rdlc", parameters);
}
public void ShowTrainingCostingInfoReport(ObjectsTemplate<SearchEmployee> Employees, DateTime dFromDate, DateTime dToDate, int tNature, int instituteID, int tTrainingType)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
DataSet oDeptDetails = Training.GetTrainingCostingInfoReport(Employees, dFromDate, dToDate, tNature, instituteID, tTrainingType);
if (oDeptDetails.Tables[0].Rows.Count > 0)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.dtTrainingCostInfoDataTable dTDeptDetail = new Payroll.Report.PayrollDataSet.TrainingDataset.dtTrainingCostInfoDataTable();
foreach (DataRow oDRow in oDeptDetails.Tables[0].Rows)
{
dr = dTDeptDetail.NewRow();
Department oD = _Departments
.Where(dd => dd.ID.Integer == Convert.ToInt32(oDRow["DepartmentID"]))
.Single();
if (oD.Tier == 1)
{
dr["Department"] = oD.Name;
}
else if (oD.Tier == 2)
{
dr["Department"] = oD.Name;
}
else if (oD.Tier == 3)
{
dr["Department"] = oD.Name;
}
else if (oD.Tier == 4)
{
dr["Department"] = oD.Parent.Name;
}
else
{
dr["Department"] = "";
}
dr["NoOfInHouseProgramme"] = oDRow["localNoOfTraining"];
dr["InHouseNoOfParticipants"] = oDRow["locEmpCount"];
dr["InHouseCostInMillion"] = oDRow["locCost"];
dr["ForeignTraningProgramme"] = oDRow["forNoOfTraining"];
dr["ForeignNoOfParticipants"] = oDRow["forEmpCount"];
dr["ForeignCostInMillion"] = oDRow["forCost"];
dTDeptDetail.Rows.Add(dr);
}
//form.ShowDlgForTrainingSummaryReport(dTEmpDetail);
DataSet dSet = new DataSet();
dTDeptDetail.TableName = "TrainingDataset_dtTrainingCostInfo";
dSet.Tables.Add(dTDeptDetail);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.TrainingCostingInformation.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
internal void ShowProposedTNA(int year)
{
fReportViewer form = new fReportViewer();
DataRow dr = null;
//Department oDepartment = Department.Get(ID.FromInteger(dptid));
//DataSet trainingds = Training.GetDeptWiseTrainingReport(oDepartment.ID);
ObjectsTemplate<TrainingNeedAnalysis> trainNeedAnalysises = TrainingNeedAnalysis.GetByYear(year);
ObjectsTemplate<Department> dpt=Department.Get();
if (trainNeedAnalysises != null)
{
GlobalFunctions.bDataFound = true;
PayrollDataSet.TrainingDataset.ProposedTNADataTable dTTNA = new Payroll.Report.PayrollDataSet.TrainingDataset.ProposedTNADataTable();
ObjectsTemplate<Training> tr = Training.Get();
ObjectsTemplate<NatureOfTraining> trNature = NatureOfTraining.Get();
foreach (TrainingNeedAnalysis oTNA in trainNeedAnalysises)
{
dr = dTTNA.NewRow();
if (oTNA.TrainingID > 0)
{
ObjectsTemplate<TrainingSchedule> oTrainingSch = TrainingSchedule.Get(oTNA.TrainingID, oTNA.ID.Integer);
dr["TraiingType"] = tr.Where(oj => oj.ID.Integer == oTNA.TrainingID).FirstOrDefault().TrainingType.Name;
if (oTrainingSch.Count > 0)
{
dr["TraiingNature"] = trNature.Where(o => o.ID == oTrainingSch[0].TrainingNatureID).FirstOrDefault().Name;
}
else
{
dr["TraiingNature"] = "";
}
}
else
{
dr["TraiingType"] = "";
dr["TraiingNature"] = "";
}
dr["TrainingName"] = oTNA.Name;
dr["Description"] = oTNA.Description;
string reqDep = "";
foreach (TrainingDepartment item in oTNA.TrainingDepartments)
{
reqDep = reqDep + ", " + dpt.Where(o => o.ID == item.DepartmentID).FirstOrDefault().Name;
}
reqDep = reqDep.Trim(',');
dr["RequiredByDepartment"] = reqDep;
dr["ConductedByDept"] = dpt.Where(o => o.ID.Integer == oTNA.DepartmentID).FirstOrDefault().Name;
string sch = "";
int count = 0;
string remark = "";
foreach (TrainingNdAnalysisTimeSch item in oTNA.TrainingNdAnalysisTimeSchs)
{
sch = sch + ", " + item.Month.ToString() +" " +oTNA.TrainingYear;
remark = remark + ", " + item.Remarks;
count = count + item.Participent;
}
sch = sch.Trim(',');
remark = remark.Trim(',');
dr["ProposedTimeSchedule"] = sch;
dr["NoOfAttendeee"] = count;
dr["Remarks"] = remark;
dr["TrainingYear"] = oTNA.TrainingYear;
dTTNA.Rows.Add(dr);
}
DataSet dSet = new DataSet();
dTTNA.TableName = "TrainingDataset_ProposedTNA";
dSet.Tables.Add(dTTNA);
List<ReportParameter> parameters = new List<ReportParameter>();
ReportParameter parameter = new ReportParameter("FilterCriteria", SearchCriteria);
parameters.Add(parameter);
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.ProposedTNAReport.rdlc", parameters);
}
else
GlobalFunctions.bDataFound = false;
}
#endregion
}
}