using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using System.Data; using HRM.BO; using HRM.DA; namespace HRM.Report { public class rptDigitalServiceBook { public byte[] DigitalServiceBook(int empID, int payrollTypeID, DateTime fromDate, string sEmpIDs, string reportType) { DataSet dSet = new DataSet(); DataRow oDR = null; if (sEmpIDs != null) empID = Convert.ToInt32(sEmpIDs); #region Employee general info DataSet oEmp = new EmployeeService().GetEmpDigitalServiceBook(empID); DataTable dTable = new PayrollDataSet.DigitalServiceBookDataSet.EMPDigitalServiceBookDataTable(); foreach (DataRow oDRow in oEmp.Tables[0].Rows) { oDR = dTable.NewRow(); oDR["EMPLOYEENO"] = oDRow["EMPLOYEENO"]; //oDR["NAME"] = rptDigitalServiceBook.ConvertToBijoy(oDRow["NAME"].ToString()); oDR["NAME"] = oDRow["NAME"]; oDR["FATHERNAME"] = oDRow["FATHERNAME"]; oDR["MOTHERNAME"] = oDRow["MOTHERNAME"]; oDR["SPOUSENAME"] = oDRow["SPOUSENAME"]; oDR["JOININGDATE"] = Convert.ToDateTime(oDRow["JOININGDATE"]).ToString("dd/MM/yyyy"); oDR["DESIGNATION"] = oDRow["DESIGNATION"]; //oDR["DESIGNATION"] = rptDigitalServiceBook.ConvertToBijoy(oDRow["DESIGNATION"].ToString()); oDR["PARMANENTADDRESS"] = oDRow["PARMANENTADDRESS"]; oDR["PRESENTADDRESS"] = oDRow["PRESENTADDRESS"]; oDR["BIRTHDATE"] = Convert.ToDateTime(oDRow["BIRTHDATE"]).ToString("dd/MM/yyyy"); //if (oDRow["PHOTO"] is not DBNull) // oDR["PHOTO"] = Convert.ToBase64String((byte[])oDRow["PHOTO"]); oDR["NIDNO"] = oDRow["NIDNO"]; oDR["HEIGHT"] = oDRow["HEIGHT"]; oDR["BLOODGROUP"] = GlobalExtensions.BloodGroupToFriendlyName((EnumBloodGroup)Enum.Parse(typeof(EnumBloodGroup), Convert.ToInt32(oDRow["BLOODGROUP"]).ToString())); //oDR["BLOODGROUP"] = (EnumBloodGroup)Enum.Parse(typeof(EnumBloodGroup), Convert.ToInt32(oDRow["BLOODGROUP"]).ToString()); oDR["LMDESIGNATION"] = oDRow["LMDESIGNATION"]; //oDR["LMDESIGNATION"] = rptDigitalServiceBook.ConvertToBijoy(oDRow["LMDESIGNATION"].ToString()); oDR["EDUCATIONLEVEL"] = oDRow["EDUCATIONLEVEL"]; oDR["PARMANENTDISTRICT"] = oDRow["PARMANENTDISTRICT"]; oDR["PARMANENTTHANA"] = oDRow["PARMANENTTHANA"]; dTable.Rows.Add(oDR); //count++; } dTable.TableName = "DigitalServiceBookDataSet_EMPDigitalServiceBook"; dSet.Tables.Add(dTable); #endregion #region System info DataSet oSystemInfo = new SystemInformationService().GetSystemInfo(); dTable = new PayrollDataSet.DigitalServiceBookDataSet.SystemInformationDataTable(); foreach (DataRow oDRow in oSystemInfo.Tables[0].Rows) { oDR = dTable.NewRow(); oDR["NAME"] = oDRow["NAME"]; oDR["CORPORATEADDRESS"] = oDRow["CORPORATEADDRESS"]; dTable.Rows.Add(oDR); } dTable.TableName = "DigitalServiceBookDataSet_SystemInformation"; dSet.Tables.Add(dTable); #endregion #region Employee life cycle info //DataSet oEmplifecycle = new EmpLifeCycleService().GetEmpLifecycleServiceRecord(empID); DataTable dtEmplifecycle = new EmployeeGradeSalaryService().GetSalaryHistory(empID); dTable = new PayrollDataSet.DigitalServiceBookDataSet.EMPLifecycleDataTable(); foreach (DataRow oDRow in dtEmplifecycle.Rows) { oDR = dTable.NewRow(); oDR["EFFECTDATE"] = Convert.ToDateTime(oDRow["EFFECTDATE"]).ToString("dd/MM/yyyy"); //Designation Designation = new DesignationService().Get(Convert.ToInt32(oDRow["DESIGNATIONID"])); //oDR["DESIGNATION"] = Designation.NameInBangla; Grade oGrade = new GradeService().Get(Convert.ToInt32(oDRow["GradeID"])); //if (oGrade.NameInBangla == null || oGrade.NameInBangla != "") oDR["DESIGNATION"] = oGrade.NameInBangla; //else // oDR["DESIGNATION"] = oGrade.Name; oDR["BASICSALARY"] = Math.Round(Convert.ToDecimal(oDRow["BASICSALARY"]), 2).ToString("##,##0.00"); oDR["HOUSERENT"] = Math.Round((Convert.ToDecimal(oDRow["GROSSSALARY"]) * 30/100), 2).ToString("##,##0.00"); oDR["MEDICAL"] = Math.Round((Convert.ToDecimal(oDRow["GROSSSALARY"]) * 6 / 100), 2).ToString("##,##0.00"); oDR["BONUS"] = Math.Round((Convert.ToDecimal(oDRow["BASICSALARY"]) * 2), 2).ToString("##,##0.00"); dTable.Rows.Add(oDR); } dTable.TableName = "DigitalServiceBookDataSet_EMPLifecycle"; dSet.Tables.Add(dTable); #endregion #region Employee leave entryInfo info DataSet oLeaveEntry = new LeaveEntryService().GetAnnualLeave(empID); dTable = new PayrollDataSet.DigitalServiceBookDataSet.LeaveEntryDataTable(); foreach (DataRow oDRow in oLeaveEntry.Tables[0].Rows) { oDR = dTable.NewRow(); oDR["FROMDATE"] = Convert.ToDateTime(oDRow["APRFROMDATE"]).ToString("dd/MM/yyyy"); oDR["TODATE"] = Convert.ToDateTime(oDRow["APRTODATE"]).ToString("dd/MM/yyyy"); oDR["TOTALDAYS"] = Convert.ToInt32(oDRow["APRTOTALDAYS"]).ToString(); dTable.Rows.Add(oDR); } dTable.TableName = "DigitalServiceBookDataSet_LeaveEntry"; dSet.Tables.Add(dTable); #endregion #region Complain info DataSet oComplain = new ComplainService().GetAllComplain(empID); dTable = new PayrollDataSet.DigitalServiceBookDataSet.ComplainDataTable(); foreach (DataRow oDRow in oComplain.Tables[0].Rows) { oDR = dTable.NewRow(); oDR["EFFECTDATE"] = Convert.ToDateTime(oDRow["EFFECTDATE"]).ToString("dd/MM/yyyy"); //if (oDRow["DESCRIPTIONINBANGLA"] is DBNull) // oDR["DESCRIPTION"] = oDRow["DESCRIPTION"]; //else oDR["DESCRIPTION"] = oDRow["DESCRIPTIONINBANGLA"]; dTable.Rows.Add(oDR); } dTable.TableName = "DigitalServiceBookDataSet_Complain"; dSet.Tables.Add(dTable); #endregion //ReportProcessor reportProcessor = new ReportProcessor(); return new ReportProcessor().ShowDlgForDigitalServiceBookReport(null, dSet, empID, payrollTypeID); } } }