EchoTex_Payroll/HRM.Report/ReportProcessor.cs
2024-10-14 10:01:49 +06:00

4807 lines
194 KiB
C#

using System;
using System.Collections.Generic;
using System.Data;
using HRM.BO;
using HRM.DA;
using System.IO;
using System.Linq;
using System.Net.Mime;
using Microsoft.Reporting.NETCore;
using HRM.Report.PayrollDataSet;
using static System.Net.Mime.MediaTypeNames;
using static iTextSharp.text.pdf.AcroFields;
using static NPOI.HSSF.Util.HSSFColor;
namespace HRM.Report
{
public class ReportProcessor
{
private string folderPath = "";
private string photoPath = "";
private string signaturePath = "";
//= @"D:\LOCAL\cel.hrm\branches\SanofiNew\HRM.Report\RDLC"; //Niloy
//string folderPath = @"D:\SVN\Synovia\HRM.Report\RDLC"; //Tanvir
//string folderPath = @"C:\inetpub\wwwroot\synovia\RDLC"; //37
LocalReport _localReport = new LocalReport();
string _rdlcName = string.Empty;
ReportParameter rParam = null;
DataSet _oSubReportDataSet = null;
private List<ReportParameter> reportParameters = new List<ReportParameter>();
SystemInformation sf = null;
string _PATH = string.Empty;
public ReportProcessor()
{
folderPath = System.IO.Path.Combine(System.Environment.CurrentDirectory + @"\RDLC");
photoPath = Path.Combine(folderPath, "reportlogo.png");
signaturePath = Path.Combine(folderPath, "signature.png");
//CreateTempDirectory();
sf = new SystemInformationService().Get();
}
ReportItem _item = null;
DataSet _subreportDataSet = null;
#region CommonReportView
public byte[] CommonReportView(ReportItem reportItem, DataSet dSet, DataSet dSubReportDataSet, string reportName, List<ReportParameter> parameters, bool defaultParameterNeeded, int payrollTypeId, string reportType)
{
byte[] bytes = null;
_rdlcName = reportName;
_oSubReportDataSet = dSubReportDataSet;
_localReport.DataSources.Clear();
_localReport.EnableExternalImages = true;
_item = reportItem;
string filePath = Path.Combine(folderPath, reportName);
string RDLC = filePath;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
_localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
if (_oSubReportDataSet != null)
{
_localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
}
_localReport.ReportPath = RDLC;
if (defaultParameterNeeded)
{
GetParameters(payrollTypeId);
}
if (parameters != null)
{
foreach (ReportParameter parItem in parameters)
{
reportParameters.Add(parItem);
}
}
if (reportParameters != null && reportParameters.Count > 0)
_localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = _localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] CommonReportViewer(ReportItem item, string rdlcName, DataSet dSet, List<ReportParameter> reportParameters, bool isBasicParametersNeeded, string reportType = "PDF")
{
string filePath = Path.Combine(folderPath, rdlcName);
string RDLC = filePath;
byte[] bytes = null;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
localReport.ReportPath = RDLC;
if (isBasicParametersNeeded)
GetBasicParameters();
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] CommonReportViewer(ReportItem item, string rdlcName, DataSet dSet, List<ReportParameter> PReportParameters, int payrollTypeId, string reportType = "PDF")
{
string filePath = Path.Combine(folderPath, rdlcName);
string RDLC = filePath;
byte[] bytes = null;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
localReport.ReportPath = RDLC;
GetParameters(payrollTypeId);
if (PReportParameters != null && PReportParameters.Count > 0)
{
reportParameters.AddRange(PReportParameters);
}
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] CommonReportViewer(ReportItem item, string rdlcName, DataSet dSet, DataSet dSubReportDataSet, List<ReportParameter> PReportParameters, int payrollTypeId, string reportType = "PDF")
{
string filePath = Path.Combine(folderPath, rdlcName);
string RDLC = filePath;
byte[] bytes = null;
_rdlcName = filePath;
_item = item;
_oSubReportDataSet = dSubReportDataSet;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.ReportEmbeddedResource = RDLC; // important
//localReport.ReportPath = rdlcName;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
if (dSubReportDataSet != null)
{
localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
}
localReport.ReportPath = RDLC;
GetParameters(payrollTypeId);
if (PReportParameters != null && PReportParameters.Count > 0)
{
reportParameters.AddRange(PReportParameters);
}
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
internal byte[] ShowMonthlyPFReport(DateTime dateTime, DataTable dtMonthlyPF, DataTable dtCRGTotal, string sLocation, string reportType, int payrollTypeId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string RDLC;
dtMonthlyPF.TableName = "dsCompany_DTMonthlyPF";
dtCRGTotal.TableName = "dsCompany_DtCostCenterTotal";
RDLC = "HRM.Report.RDLC.MonthlyPFAmount.rdlc";
dSet.Tables.Add(dtMonthlyPF);
dSet.Tables.Add(dtCRGTotal);
LocalReport localReport = new LocalReport();
//_PATH = Application.StartupPath + @"\Logo.jpg";
//ReportViewer.Refresh();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("Month", dateTime.ToString("MMM yyyy"));
reportParameters.Add(rParam);
rParam = new ReportParameter("Location", sLocation);
reportParameters.Add(rParam);
//this.ReportParams = _parameters;
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] CommonReportView(ReportItem item, string rdlcName, DataSet dSet, DataSet dSubReportDataSet, List<ReportParameter> PReportParameters, bool isBasicParametersNeeded, int payrollTypeId, string reportType = "PDF")
{
// for embeded RDLC
// Place RDLC inside HRM.Report & change the Build Action as Embeded from the properties of the RDLC file
byte[] bytes = null;
_item = item;
_rdlcName = rdlcName;
_oSubReportDataSet = dSubReportDataSet;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.ReportEmbeddedResource = rdlcName; // important
//localReport.ReportPath = rdlcName;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
if (dSubReportDataSet != null)
{
localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
}
if (isBasicParametersNeeded)
{
GetParameters(payrollTypeId);
}
//if (reportParameters != null && reportParameters.Count > 0)
//{
// reportParameters = new List<ReportParameter>();
if (PReportParameters != null && PReportParameters.Count > 0)
{
reportParameters.AddRange(PReportParameters);
}
localReport.SetParameters(reportParameters);
//}
bytes = localReport.Render(reportType, null, out string mimeType, out string encoding, out string filenameExtension, out string[] streamids, out Warning[] warnings);
//bytes = localReport.Render(reportType, null, out string mimeType, out string encoding, out string filenameExtension, out string[] streamids, out Warning[] warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] CommonReportViewForReports(ReportItem reportItem, DataSet dSet, DataSet dSubReportDataSet, string reportName, List<ReportParameter> parameters, bool defaultParameterNeeded, int payrollTypeId, string reportType)
{
byte[] bytes = null;
_rdlcName = reportName;
_oSubReportDataSet = dSubReportDataSet;
_localReport.DataSources.Clear();
_localReport.EnableExternalImages = true;
_localReport.ReportEmbeddedResource = "HRM.Report.RDLC" + "." + reportName;
_item = reportItem;
//string filePath = Path.Combine(folderPath, reportName);
string filePath = "HRM.Report.RDLC" + "." + reportName;
string RDLC = filePath;
//ReportAuthorization oReportAuthorization = null;
//oReportAuthorization = new ReportAuthorizationService().Get(nReportID);
//oFinalDT.TableName = "PayrollDataSet_SalarySheet";
//dSet.Tables.Add(oFinalDT);
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
if (dSubReportDataSet != null)
{
//localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessingHRMReport);
}
//_localReport.ReportPath = RDLC;
localReport.ReportEmbeddedResource = RDLC;
if (defaultParameterNeeded)
{
GetParameters(payrollTypeId);
}
//if (parameters != null)
//{
// foreach (ReportParameter parItem in parameters)
// {
// reportParameters.Add(parItem);
// }
//}
if (parameters != null && parameters.Count > 0)
{
reportParameters.AddRange(parameters);
}
if (reportParameters != null && reportParameters.Count > 0)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] AttendanceReportsView(ReportItem reportItem, DataSet dSet, DataSet dSubReportDataSet, string reportName, List<ReportParameter> parameters, bool defaultParameterNeeded, int payrollTypeId, string reportType)
{
byte[] bytes = null;
_rdlcName = reportName;
_oSubReportDataSet = dSubReportDataSet;
_localReport.DataSources.Clear();
_localReport.EnableExternalImages = true;
_localReport.ReportEmbeddedResource = "HRM.Report.Attendence.RDLC" + "." + reportName;
_item = reportItem;
//string filePath = Path.Combine(folderPath, reportName);
string filePath = "HRM.Report.Attendence.RDLC" + "." + reportName;
string RDLC = filePath;
//ReportAuthorization oReportAuthorization = null;
//oReportAuthorization = new ReportAuthorizationService().Get(nReportID);
//oFinalDT.TableName = "PayrollDataSet_SalarySheet";
//dSet.Tables.Add(oFinalDT);
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
if (dSubReportDataSet != null)
{
//localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessingHRMReport);
}
//_localReport.ReportPath = RDLC;
localReport.ReportEmbeddedResource = RDLC;
if (defaultParameterNeeded)
{
GetParameters(payrollTypeId);
}
//if (parameters != null)
//{
// foreach (ReportParameter parItem in parameters)
// {
// reportParameters.Add(parItem);
// }
//}
if (parameters != null && parameters.Count > 0)
{
reportParameters.AddRange(parameters);
}
if (reportParameters != null && reportParameters.Count > 0)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
#endregion
#region Sub_Report Processing
private void LocalReport_SubreportProcessing(object sender, SubreportProcessingEventArgs e)
{
LocalReport lReport = _localReport;
if (lReport != null)
{
string[] tempReportName = _rdlcName.Split('.');
string sederReportName = tempReportName[tempReportName.Length - 2];
if (sederReportName == "PaySlipForGT")
{
if (e.ReportPath == "PaySlipIncomeTaxForGT")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTax", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTax"]));
}
else if (e.ReportPath == "PaySlipIncomeTaxSlabForGT")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTaxSlab", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTaxSlab"]));
}
else if (e.ReportPath == "PaySlipIncomTaxOtherForGT")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTaxOther", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTaxOther"]));
}
else if (e.ReportPath == "PaySlipSubReportForGT")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_Payslip", _oSubReportDataSet.Tables["PayrollDataSet_Payslip"]));
}
}
if (sederReportName == "MultipleLeaveLedger")
{
if (e.ReportPath == "MultipleLeaveLedger2")
{
e.DataSources.Add(new ReportDataSource("dsEmpLeaveLedger_LeaveBalance", _oSubReportDataSet.Tables["dsEmpLeaveLedger_LeaveBalance"]));
}
else if (e.ReportPath == "MultipleLeaveLedger3")
{
e.DataSources.Add(new ReportDataSource("dsEmpLeaveLedger_EmpLeaveLedger", _oSubReportDataSet.Tables["dsEmpLeaveLedger_EmpLeaveLedger"]));
}
}
if (sederReportName == "PaySlipForGT2")
{
if (e.ReportPath == "PaySlipSubReportForGT")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_Payslip", _oSubReportDataSet.Tables["PayrollDataSet_Payslip"]));
}
}
if (sederReportName == "PaySlipForAnwar")
{
if (e.ReportPath == "PayslipGrossForAnwar")
{
e.DataSources.Add(new ReportDataSource("SalaryMonthlysGross", _oSubReportDataSet.Tables["SalaryMonthlysGross"]));
}
else
{
e.DataSources.Add(new ReportDataSource("RemainingLoanforPayslip", _oSubReportDataSet.Tables["RemainingLoanforPayslip"]));
}
}
else if (sederReportName == "PaySlipNew")
{
if (e.ReportPath == "PayslipGross")
{
e.DataSources.Add(new ReportDataSource("SalaryMonthlysGross", _oSubReportDataSet.Tables["SalaryMonthlysGross"]));
}
else
{
e.DataSources.Add(new ReportDataSource("RemainingLoanforPayslip", _oSubReportDataSet.Tables["RemainingLoanforPayslip"]));
}
}
else if (sederReportName == "PaySlipNewNMGT")
{
if (e.ReportPath == "PayslipGross")
{
e.DataSources.Add(new ReportDataSource("SalaryMonthlysGross", _oSubReportDataSet.Tables["SalaryMonthlysGross"]));
}
else
{
e.DataSources.Add(new ReportDataSource("RemainingLoanforPayslip", _oSubReportDataSet.Tables["RemainingLoanforPayslip"]));
}
}
else if (sederReportName == "DateRangeMultipleJobCard")
{
e.DataSources.Add(new ReportDataSource(_oSubReportDataSet.Tables[0].TableName, _oSubReportDataSet.Tables[0]));
}
else if (sederReportName == "DateRangeMultipleJobCardNew")
{
e.DataSources.Add(new ReportDataSource(_oSubReportDataSet.Tables[0].TableName, _oSubReportDataSet.Tables[0]));
}
else if (sederReportName == "DateRangeMultipleJobCardNewLiFung")
{
e.DataSources.Add(new ReportDataSource(_oSubReportDataSet.Tables[0].TableName, _oSubReportDataSet.Tables[0]));
}
else if (sederReportName == "LeaveLedgers")
{
if (e.ReportPath == "LeaveLedgersType")
{
e.DataSources.Add(new ReportDataSource("TeamLeaveType", _oSubReportDataSet.Tables["TeamLeaveType"]));
}
else if (e.ReportPath == "LeaveLedgersDetails")
{
e.DataSources.Add(new ReportDataSource("TeamLeaveDetails", _oSubReportDataSet.Tables["TeamLeaveDetails"]));
}
}
else if (sederReportName == "MultipleJobCard")
{
e.DataSources.Add(new ReportDataSource("AttendenceDataSet_EmpDailyAttn", _oSubReportDataSet.Tables["AttendenceDataSet_EmpDailyAttn"]));
}
else if (sederReportName == "LeaveLedgerNmgtMultiple")
{
if (e.ReportPath == "LeaveLedgerNmgtLeaveType")
{
e.DataSources.Add(new ReportDataSource("dsEmpLeaveLedger_LeaveBalance", _oSubReportDataSet.Tables["dsEmpLeaveLedger_LeaveBalance"]));
}
else if (e.ReportPath == "LeaveLedgerNmgtDetails")
{
e.DataSources.Add(new ReportDataSource("dsEmpLeaveLedger_EmpLeaveLedger", _oSubReportDataSet.Tables["dsEmpLeaveLedger_EmpLeaveLedger"]));
}
}
}
}
public void LocalReport_SubreportProcessingHRMReport(object sender, SubreportProcessingEventArgs e)
{
LocalReport lReport = _localReport;
if (lReport != null)
{
string sederReportName = lReport.ReportEmbeddedResource.Split('.').Last(x => x != "rdlc");
if (sederReportName == "BanglaPSlip")
{
if (e.ReportPath == "BanglaPSlipSub")
{
e.DataSources.Add(new ReportDataSource(_oSubReportDataSet.Tables[0].TableName, _oSubReportDataSet.Tables[0]));
}
else if (e.ReportPath == "BanglaPSlipBonus")
{
e.DataSources.Add(new ReportDataSource(_oSubReportDataSet.Tables[1].TableName, _oSubReportDataSet.Tables[1]));
}
}
else if (sederReportName == "BanglaPSlipMay2020")
{
if (e.ReportPath == "BanglaPSlipSub")
{
e.DataSources.Add(new ReportDataSource(_subreportDataSet.Tables[0].TableName, _subreportDataSet.Tables[0]));
}
else if (e.ReportPath == "BanglaPSlipBonus")
{
e.DataSources.Add(new ReportDataSource(_subreportDataSet.Tables[1].TableName, _subreportDataSet.Tables[1]));
}
}
else if (sederReportName == "rptEmployeeEvaluation")
{
if (e.ReportPath == "rptEmpEvaluationSalarySub")
{
e.DataSources.Add(new ReportDataSource("EmpEvaluationSalaryIncrement", _subreportDataSet.Tables["EmpEvaluationSalaryIncrement"]));
}
else if (e.ReportPath == "rptEmpEvaluationLeaveSub")
{
e.DataSources.Add(new ReportDataSource("EmpEvaluationleave", _subreportDataSet.Tables["EmpEvaluationleave"]));
}
}
else if (sederReportName == "MultipleJobCard")
{
e.DataSources.Add(new ReportDataSource(_subreportDataSet.Tables[0].TableName, _subreportDataSet.Tables[0]));
}
else if (sederReportName == "DateRangeMultipleJobCard")
{
e.DataSources.Add(new ReportDataSource(_subreportDataSet.Tables[0].TableName, _subreportDataSet.Tables[0]));
}
else if (sederReportName == "NewTaxCard")
{
if (e.ReportPath == "NewIncomeTax")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTax", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTax"]));
}
else if (e.ReportPath == "NewIncomeTaxSlab")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTaxSlab", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTaxSlab"]));
}
else if (e.ReportPath == "NewIncomeTaxRebate")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_TaxRebeatInvestment", _oSubReportDataSet.Tables["PayrollDataSet_TaxRebeatInvestment"]));
e.DataSources.Add(new ReportDataSource("PayrollDataSet_TaxChallan", _oSubReportDataSet.Tables["PayrollDataSet_TaxChallan"]));
}
else if (e.ReportPath == "NewIncomeTaxOther")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTaxOther", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTaxOther"]));
}
}
else if (sederReportName == "PrevTaxCard")
{
if (e.ReportPath == "PrevIncomeTax")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTax", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTax"]));
}
else if (e.ReportPath == "PrevTaxSlab")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTaxSlab", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTaxSlab"]));
}
else if (e.ReportPath == "NewIncomeTaxRebate")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_TaxRebeatInvestment", _oSubReportDataSet.Tables["PayrollDataSet_TaxRebeatInvestment"]));
e.DataSources.Add(new ReportDataSource("PayrollDataSet_TaxChallan", _oSubReportDataSet.Tables["PayrollDataSet_TaxChallan"]));
}
else if (e.ReportPath == "NewIncomeTaxOther")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTaxOther", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTaxOther"]));
}
else if (e.ReportPath == "PrevTaxChallan")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_TaxChallan", _oSubReportDataSet.Tables["PayrollDataSet_TaxChallan"]));
}
}
else if (sederReportName == "PrevTaxCardNew")
{
if (e.ReportPath == "PrevIncomeTaxNew")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTax", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTax"]));
}
else if (e.ReportPath == "PrevTaxSlab")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTaxSlab", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTaxSlab"]));
}
else if (e.ReportPath == "NewIncomeTaxRebate")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_TaxRebeatInvestment", _oSubReportDataSet.Tables["PayrollDataSet_TaxRebeatInvestment"]));
e.DataSources.Add(new ReportDataSource("PayrollDataSet_TaxChallan", _oSubReportDataSet.Tables["PayrollDataSet_TaxChallan"]));
}
else if (e.ReportPath == "NewIncomeTaxOther")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_IncomeTaxOther", _oSubReportDataSet.Tables["PayrollDataSet_IncomeTaxOther"]));
}
else if (e.ReportPath == "PrevTaxChallan")
{
e.DataSources.Add(new ReportDataSource("PayrollDataSet_TaxChallan", _oSubReportDataSet.Tables["PayrollDataSet_TaxChallan"]));
}
}
//else if (sederReportName == "LeaveLedgerNmgtMultiple")
//{
// if (e.ReportPath == "LeaveLedgerNmgtLeaveType")
// {
// e.DataSources.Add(new ReportDataSource("dsEmpLeaveLedger_LeaveBalance", _oSubReportDataSet.Tables["dsEmpLeaveLedger_LeaveBalance"]));
// }
// else if (e.ReportPath == "LeaveLedgerNmgtDetails")
// {
// e.DataSources.Add(new ReportDataSource("dsEmpLeaveLedger_EmpLeaveLedger", _oSubReportDataSet.Tables["dsEmpLeaveLedger_EmpLeaveLedger"]));
// }
//}
}
}
#endregion
#region GetReportParameters
public void GetBasicParameters()
{
//reportParameters = new List<ReportParameter>();
SystemInformation systemInfo = new SystemInformation(); // Payroll.BO.SystemInformation.Get();
if (reportParameters == null)
{
reportParameters = new List<ReportParameter>();
}
List<PayrollType> oPRTypes = new List<PayrollType>(); // PayrollType.Get();
PayrollType oPT = new PayrollType(); //oPRTypes.Find(delegate (PayrollType oItemPT) { return oItemPT.ID == Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID; });
//_PATH = Application.StartupPath + @"\Resource\Logo.png";
//if (!File.Exists(_PATH))
//{
// //_PATH = Application.StartupPath + @"\Logo.png";
// if (oPT != null)
// {
// if (oPT.ID == ID.FromInteger(1))
// {excel
// _PATH = Application.StartupPath + @"\HNOKIA.png";//HNOKIA.png
// }
// else if (oPT.ID == ID.FromInteger(2))
// {
// _PATH = Application.StartupPath + @"\HImsLogo.png";
// }
// else if (oPT.ID == ID.FromInteger(3))
// {
// _PATH = Application.StartupPath + @"\Hapll.png";
// }
// }
//}
ReportParameter rParam = new ReportParameter("Logo", "");
reportParameters.Add(rParam);
// rParam = new ReportParameter("CompanyInfo", oPT.Description.ToString());
rParam = new ReportParameter("CompanyInfo", "");
reportParameters.Add(rParam);
rParam = new ReportParameter("Address", "");
reportParameters.Add(rParam);
rParam = new ReportParameter("Phone", "");
reportParameters.Add(rParam);
//rParam = new ReportParameter("Fax", "");
//reportParameters.Add(rParam);
rParam = new ReportParameter("Email", "");
reportParameters.Add(rParam);
}
public void GetParameters(int payrollTypeId)
{
PayrollType payrollType = new PayrollTypeService().Get(payrollTypeId);
SystemInformation systemInformation = new SystemInformationService().Get();
if (reportParameters == null)
{
reportParameters = new List<ReportParameter>();
}
if (payrollTypeId == 1)
{
photoPath = Path.Combine(folderPath, "reportlogo.png");
}
else if (payrollTypeId == 2)
{
photoPath = Path.Combine(folderPath, "reportlogo1.png");
}
else if (payrollTypeId == 3)
{
photoPath = Path.Combine(folderPath, "reportlogo2.png");
}
else if (payrollTypeId == 4)
{
photoPath = Path.Combine(folderPath, "reportlogo3.png");
}
else if (payrollTypeId == 5)
{
photoPath = Path.Combine(folderPath, "reportlogo4.png");
}
else
{
photoPath = Path.Combine(folderPath, "reportlogo.png");
}
ReportParameter rParam = new ReportParameter("Logo", photoPath);
reportParameters.Add(rParam);
// rParam = new ReportParameter("CompanyInfo", oPT.Description.ToString());
rParam = new ReportParameter("CompanyInfo", payrollType != null ? payrollType.CompanyName : string.Empty);
reportParameters.Add(rParam);
rParam = new ReportParameter("SearchCriteria", "");
reportParameters.Add(rParam);
rParam = new ReportParameter("Address", payrollType != null ? payrollType.Address : string.Empty);
reportParameters.Add(rParam);
rParam = new ReportParameter("Phone", systemInformation != null ? (systemInformation.TelephoneNo != string.Empty ? "Tel : " + systemInformation.TelephoneNo : string.Empty) : string.Empty);
reportParameters.Add(rParam);
}
private void GetParametersForLoanPaymentDue(int payrollTypeId, string LoanMonth)
{
GetParameters(payrollTypeId);
rParam = new ReportParameter("LoanMonth", LoanMonth);
reportParameters.Add(rParam);
}
private void GetParametersForLoanIssue(string EmpName, string EmpNo, double LAmount, double IntRate, int noOfInstalment, DateTime dFromDate, DateTime dToDate, string LoanName, DateTime dIssueDate, int payrollTypeId)
{
GetParameters(payrollTypeId);
rParam = new ReportParameter("Name", EmpName);
reportParameters.Add(rParam);
rParam = new ReportParameter("EmpNo", EmpNo);
reportParameters.Add(rParam);
rParam = new ReportParameter("Amount", Convert.ToString(LAmount));
reportParameters.Add(rParam);
rParam = new ReportParameter("InterestRate", Convert.ToString(IntRate));
reportParameters.Add(rParam);
rParam = new ReportParameter("NoOfInstallment", Convert.ToString(noOfInstalment));
reportParameters.Add(rParam);
rParam = new ReportParameter("IssueDate", dIssueDate.ToString("dd MMM yyyy"));
reportParameters.Add(rParam);
rParam = new ReportParameter("FromDate", dIssueDate.ToString("MMM-yyyy"));
reportParameters.Add(rParam);
rParam = new ReportParameter("ToDate", dToDate.ToString("MMM-yyyy"));
reportParameters.Add(rParam);
rParam = new ReportParameter("LoanName", LoanName);
reportParameters.Add(rParam);
}
public void GetParametersForGeneralReport()
{
HRM.BO.SystemInformation _systemInfo = new SystemInformationService().Get();
reportParameters = new List<ReportParameter>();
List<PayrollType> oPRTypes = new PayrollTypeService().Get();
PayrollType
oPT = new PayrollType(); // oPRTypes.Find(delegate (PayrollType oItemPT) { return oItemPT.ID == SystemInformation.CurrentSysInfo.PayrollTypeID; });
string _PATH = string.Empty; // Application.StartupPath + @"\Resource\Logo.png";
if (!File.Exists(_PATH))
{
//_PATH = Application.StartupPath + @"\Logo.png";
if (oPT != null)
{
}
}
ReportParameter rParam = new ReportParameter("Logo", _PATH);
reportParameters.Add(rParam);
//rParam = new ReportParameter("CompanyInfo", oPT.Description.ToString());
// rParam = new ReportParameter("CompanyInfo", _systemInfo.name.ToString()+", "+ oPT.Description.ToString());
//rParam = new ReportParameter("CompanyInfo", "Employee General Information Report For " + oPT.Name.ToString());
rParam = new ReportParameter("CompanyInfo", string.Empty);
reportParameters.Add(rParam);
//if (_item != null)
//{
// rParam = new ReportParameter("SearchCriteria", " ", _item.IsSearchCriteria);
// reportParameters.Add(rParam);
//}
//else
//{
// rParam = new ReportParameter("SearchCriteria", "", false);
// reportParameters.Add(rParam);
//}
//rParam = new ReportParameter("SearchCriteria", " ", false);
//reportParameters.Add(rParam);
// rParam = new ReportParameter("Address", _systemInfo.corporateAddress.ToString());
rParam = new ReportParameter("Address", string.Empty);
//rParam = new ReportParameter("Address", "6th-9th Floors ,Noor Tower,110, Bir Uttam C.R Dattta Road, Dhaka-1205");
reportParameters.Add(rParam);
rParam = new ReportParameter("Phone", string.Empty);
//rParam = new ReportParameter("Phone", "0124232323");
reportParameters.Add(rParam);
//rParam = new ReportParameter("Fax", "++03423232323");
//reportParameters.Add(rParam);
//rParam = new ReportParameter("Email", _systemInfo.webAddress);
//reportParameters.Add(rParam);
}
public void GetParametersForEmployeeDetail()
{
SystemInformation _systemInfo = new SystemInformationService().Get();
reportParameters = new List<ReportParameter>();
List<PayrollType> oPRTypes = new PayrollTypeService().Get();
PayrollType
oPT = new PayrollType(); // oPRTypes.Find(delegate (PayrollType oItemPT) { return oItemPT.ID == Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID; });
string _PATH = string.Empty; // Application.StartupPath + @"\Resource\Logo.png";
if (!File.Exists(_PATH))
{
//_PATH = Application.StartupPath + @"\Logo.png";
if (oPT != null)
{
}
}
ReportParameter rParam = new ReportParameter("Logo", _PATH);
reportParameters.Add(rParam);
//rParam = new ReportParameter("CompanyInfo", oPT.Description.ToString());
rParam = new ReportParameter("CompanyInfo", string.Empty);
reportParameters.Add(rParam);
//if (_item != null)
//{
// rParam = new ReportParameter("SearchCriteria", " ", _item.IsSearchCriteria);
// reportParameters.Add(rParam);
//}
//else
//{
// rParam = new ReportParameter("SearchCriteria", "", false);
// reportParameters.Add(rParam);
//}
//rParam = new ReportParameter("SearchCriteria", " ", false);
//reportParameters.Add(rParam);
rParam = new ReportParameter("Address", string.Empty);
//rParam = new ReportParameter("Address", "6th-9th Floors ,Noor Tower,110, Bir Uttam C.R Dattta Road, Dhaka-1205");
reportParameters.Add(rParam);
rParam = new ReportParameter("Phone", _systemInfo.TelephoneNo.ToString());
//rParam = new ReportParameter("Phone", "0124232323");
reportParameters.Add(rParam);
//rParam = new ReportParameter("Fax", "++03423232323");
//reportParameters.Add(rParam);
//rParam = new ReportParameter("Email", _systemInfo.webAddress);
//reportParameters.Add(rParam);
}
private void GetParametersNew(int PayrollTypeID)
{
if (reportParameters == null)
{
reportParameters = new List<ReportParameter>();
}
GetImageFromPayrollType(PayrollTypeID);
ReportParameter rParam = new ReportParameter("Logo", photoPath.Contains("jpg") ? photoPath : "");
reportParameters.Add(rParam);
rParam = new ReportParameter("CompanyInfo", sf != null ? sf.name : "");
reportParameters.Add(rParam);
rParam = new ReportParameter("SearchCriteria", "");
reportParameters.Add(rParam);
rParam = new ReportParameter("Address", sf != null ? sf.corporateAddress : "");
reportParameters.Add(rParam);
rParam = new ReportParameter("Phone", sf != null ? sf.TelephoneNo : "");
reportParameters.Add(rParam);
}
#endregion
public byte[] ShowDlgForSalarySheetNonMngt(ReportItem item, DataTable oFinalDT, int nReportID, int payrollTypeId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "SalarySheetForNonMngnt.rdlc");
string RDLC = filePath;
ReportAuthorization oReportAuthorization = null;
oReportAuthorization = new ReportAuthorizationService().Get(nReportID);
oFinalDT.TableName = "PayrollDataSet_SalarySheet";
dSet.Tables.Add(oFinalDT);
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
string name = string.Empty;
int authorizePersionId = new ReportAuthorizationService().Get(nReportID, 1).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("PreparedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("PreparedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 2).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CheckedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CheckedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 3).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("HeadofHRApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("HeadofHRApprovedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 4).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CCOApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CCOApprovedBy", "");
reportParameters.Add(rParam);
}
//rParam = new ReportParameter("DynamicGroup",DynamicGroup);
//reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
internal byte[] ShowDlgForEmployeeConfirmation(DataSet dSet, string RDLCName, DateTime dConfirmationMonth, int payrollType)
{
byte[] bytes = null;
string filePath = Path.Combine(folderPath, RDLCName);
string RDLC = filePath;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollType);
rParam = new ReportParameter("ConfirmationMonth", dConfirmationMonth.ToString("MMMM yyyy"));
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForAnnualIncomeCertificate(ReportItem reportItem, DataTable oSalary, string TaxPeriod, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "AnnualIncomeCertificate.rdlc");
string RDLC = filePath;
oSalary.TableName = "PayrollDataSet_AnnualIncomeCertificate";
dSet.Tables.Add(oSalary);
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
//DateTime formDate = GlobalFunctions.FirstDateOfMonth(FromDate);
//int fromYear = FromDate.Year;
//rParam = new ReportParameter("FormDate", formDate.ToString("MMMM dd, yyyy"));
//reportParameters.Add(rParam);
//rParam = new ReportParameter("FormYear", fromYear.ToString());
//reportParameters.Add(rParam);
//DateTime _toDate = GlobalFunctions.LastDateOfMonth(toDate);
//int toYear = toDate.Year;
//rParam = new ReportParameter("ToDate", _toDate.ToString("MMMM dd, yyyy"));
//reportParameters.Add(rParam);
//rParam = new ReportParameter("ToYear", toYear.ToString());
//reportParameters.Add(rParam);
rParam = new ReportParameter("TaxPeriod", TaxPeriod);
reportParameters.Add(rParam);
List<AuthorizedPerson> authPersons = new AuthorizedPersonService().Get();
AuthorizedPerson authPerson = null;
//byte[] signature = null;
if (authPersons.Count > 0)
{
authPerson = new AuthorizedPersonService().Get(authPersons[0].ID);
signaturePath = Convert.ToBase64String(authPerson.Signature);
}
rParam = new ReportParameter("signature", signaturePath);
reportParameters.Add(rParam);
rParam = new ReportParameter("authName", authPerson != null ? authPerson.Name : null);
reportParameters.Add(rParam);
rParam = new ReportParameter("authDesignation", authPerson != null ? authPerson.Designation : null);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForBankRegister(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType, string rdlcName)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, rdlcName);
string RDLC = filePath;
oFinalDT.TableName = "dsCompany_BonusBankAdvice";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
bool isRoundOff = false;
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
if (companyName == "SGS Bangladesh Limited")
{
isRoundOff = true;
}
else
{
isRoundOff = false;
}
rParam = new ReportParameter("isRoundOff", isRoundOff.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForBonusPaySlip(ReportItem item, DataTable oFinalDT, int payrollTypeId, string bonusName, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "BonusPayslp.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_BonusPaySlip";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
rParam = new ReportParameter("BonusName", bonusName);
reportParameters.Add(rParam);
bool isRoundOff = false;
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
if (companyName == "SGS Bangladesh Limited")
{
isRoundOff = true;
}
else
{
isRoundOff = false;
}
rParam = new ReportParameter("isRoundOff", isRoundOff.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForBonusRegister(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType, string rdlcName)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, rdlcName);
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_BonusRegister";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
bool isRoundOff = false;
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
if (companyName == "SGS Bangladesh Limited")
{
isRoundOff = true;
}
else
{
isRoundOff = false;
}
rParam = new ReportParameter("isRoundOff", isRoundOff.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForLoyaltyBonusRegister(DataTable oFinalDT, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string RDLC;
oFinalDT.TableName = "PayrollDataSet_BonusRegister";
RDLC = "HRM.Report.RDLC.rptLoyaltyBonusRegister.rdlc";
dSet.Tables.Add(oFinalDT);
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportEmbeddedResource = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
internal byte[] ShowDlgForSalaryReconcilSummary(ReportItem reportItem, DataTable oFinalDT, DataTable _salaryReconDecuction, string FirstMonth, string Nextmonth, string CurrMonEmp, string PrevMonEmp, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "SalaryReconciliationSummary.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_SalaryReconciliationSummary";
_salaryReconDecuction.TableName = "PayrollDataSet_SalaryReconDeduction";
dSet.Tables.Add(oFinalDT);
dSet.Tables.Add(_salaryReconDecuction);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = reportItem;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("FirstMonth", FirstMonth);
reportParameters.Add(rParam);
rParam = new ReportParameter("Nextmonth", Nextmonth);
reportParameters.Add(rParam);
rParam = new ReportParameter("CurrmonthEmp", CurrMonEmp);
reportParameters.Add(rParam);
rParam = new ReportParameter("PrevmonthEmp", PrevMonEmp);
reportParameters.Add(rParam);
bool isRoundOff = false;
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
if (companyName == "SGS Bangladesh Limited")
{
isRoundOff = true;
}
else
{
isRoundOff = false;
}
rParam = new ReportParameter("isRoundOff", isRoundOff.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForSalaryReconcilNew(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "SalaryReconciliationNew.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_SalaryReconNew";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowItemWiseSalary(ReportItem reportItem, DataTable oSalary, DateTime _SalaryMonth, DateTime toDate, int payrollTypeId, string reportType)
{
// DataSet dSet = new DataSet();
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "ItemWiseSalary.rdlc");
string RDLC = filePath;
oSalary.TableName = "PayrollDataSet_EmpItemWiseSalary";
dSet.Tables.Add(oSalary);
_item = reportItem;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
PayrollType oPT = new PayrollTypeService().Get(payrollTypeId);
string payrollType = oPT.Description;
rParam = new ReportParameter("FormDate", _SalaryMonth.ToString("MMM yyyy"));
reportParameters.Add(rParam);
rParam = new ReportParameter("ToDate", toDate.ToString("MMM yyyy"));
reportParameters.Add(rParam);
rParam = new ReportParameter("ItemName", "");
reportParameters.Add(rParam);
//rParam = new ReportParameter("PayrollType", payrollType);
//reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
// this.ShowDialog();
}
public byte[] ShowDlgForCCWiswSalarySummary(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "CCWSSummary.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_CCWSaSummary";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForSalarySheetByCC(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "CCWiseSalarySheet.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "dsCompany_SalarySheet";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension, out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowReportForSchedular(ReportItem item, string rdlcName, DataSet dSet, List<ReportParameter> PReportParameters, bool isBasicParametersNeeded, string reportTitle, string reportType = "PDF", bool hideColumn = false)
{
byte[] bytes = null;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.ReportEmbeddedResource = rdlcName; // important
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
if (isBasicParametersNeeded)
{
GetBasicParameters();
}
if (reportTitle.Trim() != string.Empty)
{
rParam = new ReportParameter("ReportTitle", reportTitle.Trim());
reportParameters.Add(rParam);
}
if (hideColumn)
{
rParam = new ReportParameter("HideColumn", hideColumn.ToString());
reportParameters.Add(rParam);
}
if (reportParameters != null && reportParameters.Count > 0)
{
localReport.SetParameters(reportParameters);
if (PReportParameters != null && PReportParameters.Count > 0)
{
reportParameters.AddRange(PReportParameters);
}
}
bytes = localReport.Render(reportType, null, out string mimeType, out string encoding, out string filenameExtension, out string[] streamids, out Warning[] warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] LatestIndividualLoanReport(ReportItem item, DataSet dSet, string RDLC, string EmpName, string EmpNo, double LAmount, double IntRate, int noOfInstalment, DateTime dFromDate, DateTime dToDate, string LoanName, DateTime dIssueDate, int payrollTypeId, string reportType = "PDF")
{
byte[] bytes = null;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.ReportEmbeddedResource = RDLC;
_item = item;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
GetParametersForLoanIssue(EmpName, EmpNo, LAmount, IntRate, noOfInstalment, dFromDate, dToDate, LoanName, dIssueDate, payrollTypeId);
if (reportParameters != null && reportParameters.Count > 0)
{
localReport.SetParameters(reportParameters);
}
bytes = localReport.Render(reportType, null, out string mimeType, out string encoding, out string filenameExtension, out string[] streamids, out Warning[] warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] MonthlyLoanReport(ReportItem item, DataSet dSet, string RDLC, string LoanMonth, int payrollTypeId, string locantionName, string reportType = "PDF")
{
byte[] bytes = null;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.ReportEmbeddedResource = RDLC;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
}
GetParametersForLoanPaymentDue(payrollTypeId, LoanMonth);
rParam = new ReportParameter("Location", locantionName);
reportParameters.Add(rParam);
if (reportParameters != null && reportParameters.Count > 0)
{
localReport.SetParameters(reportParameters);
}
bytes = localReport.Render(reportType, null, out string mimeType, out string encoding, out string filenameExtension, out string[] streamids, out Warning[] warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForReport108(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType, string AssessmentYear)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "Report108New_2022.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_Report108";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
ReportParameter rParam = new ReportParameter("AssessmentYear", AssessmentYear);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForReport177(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType, string SalaryMonth)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
//string filePath = Path.Combine(folderPath, "Report108New_2022.rdlc");
string filePath = Path.Combine(folderPath, "Report177.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_Report108";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
ReportParameter rParam = new ReportParameter("AssessmentYear", SalaryMonth);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForPaySlipOverAllSummary(ReportItem item, DataTable oFinalDT, string reportType, int payrollTypeId)
{
string sCurrentDirectory = AppDomain.CurrentDomain.BaseDirectory;
string
sCurrentDirectory2 =
System.Environment
.CurrentDirectory; // System.IO.Path.Combine(System.Environment.CurrentDirectory + @"\ClientApp\src\assets\resource\UserRecordConfig.xml");
byte[] bytes = null;
DataSet dSet = new DataSet();
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
string RDLCName = null;
if (companyName == "SGS Bangladesh Limited")
{
RDLCName = "OverAllSummarySGS.rdlc";
}
else
{
RDLCName = "OverAllSummary.rdlc";
}
string filePath = Path.Combine(folderPath, RDLCName);
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_OverAllSummary";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
//_ArrearExit = IsArrear;
//_UnAuthorizedExit = IsUnAuthorized;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForSalarySheetWithoutCostcenter(ReportItem item, DataTable oFinalDT, int nReportID, string reportType, int payrollTypeId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "SalarySheetWithoutCostcenter.rdlc");
string RDLC = filePath;
ReportAuthorization oReportAuthorization = null;
oReportAuthorization = new ReportAuthorizationService().Get(nReportID);
oFinalDT.TableName = "PayrollDataSet_SalarySheet";
dSet.Tables.Add(oFinalDT);
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
string name = string.Empty;
int authorizePersionId = new ReportAuthorizationService().Get(nReportID, 1).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("PreparedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("PreparedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 2).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CheckedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CheckedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 3).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("HeadofHRApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("HeadofHRApprovedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 4).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CCOApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CCOApprovedBy", "");
reportParameters.Add(rParam);
}
//rParam = new ReportParameter("DynamicGroup",DynamicGroup);
//reportParameters.Add(rParam);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForSalarySheet(ReportItem item, DataTable oFinalDT, int nReportID, string reportType, int payrollTypeId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "SalarySheet.rdlc");
string RDLC = filePath;
ReportAuthorization oReportAuthorization = null;
oReportAuthorization = new ReportAuthorizationService().Get(nReportID);
oFinalDT.TableName = "PayrollDataSet_SalarySheet";
dSet.Tables.Add(oFinalDT);
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
string name = string.Empty;
int authorizePersionId = new ReportAuthorizationService().Get(nReportID, 1).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("PreparedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("PreparedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 2).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CheckedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CheckedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 3).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("HeadofHRApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("HeadofHRApprovedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 4).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CCOApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CCOApprovedBy", "");
reportParameters.Add(rParam);
}
//rParam = new ReportParameter("DynamicGroup",DynamicGroup);
//reportParameters.Add(rParam);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForSalarySheetWithoutCostCenterOT(ReportItem item, DataTable oFinalDT, int nReportID, string reportType, int payrollTypeId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
//string filePath = Path.Combine(folderPath, "SalarySheetWithoutCostCenterOT.rdlc");
string filePath = Path.Combine(folderPath, "ExtendedSalarySheet.rdlc");
//string filePath = "HRM.Report.RDLC.ExtendedSalarySheet.rdlc";
string RDLC = filePath;
ReportAuthorization oReportAuthorization = null;
oReportAuthorization = new ReportAuthorizationService().Get(nReportID);
oFinalDT.TableName = "PayrollDataSet_SalarySheet";
dSet.Tables.Add(oFinalDT);
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
//localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeId);
string name = string.Empty;
int authorizePersionId = new ReportAuthorizationService().Get(nReportID, 1).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("PreparedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("PreparedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 2).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CheckedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CheckedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 3).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("HeadofHRApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("HeadofHRApprovedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 4).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CCOApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CCOApprovedBy", "");
reportParameters.Add(rParam);
}
//rParam = new ReportParameter("DynamicGroup",DynamicGroup);
//reportParameters.Add(rParam);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForBankDisbursment(ReportItem item, DataTable oFinalDT, string reportType, int payrollTypeId)
{
DataSet dSet = new DataSet();
byte[] bytes = null;
string filePath = Path.Combine(folderPath, "SalaryBankDisbursement.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "dsCompany_BankAdvice";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForNewBankDisbursment(ReportItem item, DataTable oFinalDT, string reportType, int payrollTypeId, string rdlcName, DateTime SalaryMonth)
{
DataSet dSet = new DataSet();
byte[] bytes = null;
//string filePath = Path.Combine(folderPath, "Bank Advice.rdlc");
string filePath = "HRM.Report.RDLC." + rdlcName;
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
if (companyName == "SGS Bangladesh Limited")
filePath = "HRM.Report.RDLC.BankAdviceSGS.rdlc";
if (companyName == "HNM")
filePath = "HRM.Report.RDLC.BankAdviceSalaryHnm.rdlc";
string RDLC = filePath;
oFinalDT.TableName = "dsCompany_BankAdvice";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
//localReport.ReportPath = RDLC;
localReport.ReportEmbeddedResource = RDLC;
}
//rParam = new ReportParameter("ReportType", reportType);
//reportParameters.Add(rParam);
GetParameters(payrollTypeId);
bool isRoundOff = false;
if (companyName == "SGS Bangladesh Limited")
isRoundOff = true;
rParam = new ReportParameter("isRoundOff", isRoundOff.ToString());
reportParameters.Add(rParam);
rParam = new ReportParameter("Month", SalaryMonth.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
internal byte[] ShowEmpServiceBook(ReportItem item, DataSet dSet, string empPicPath, int payrollTypeID)
{
byte[] bytes = null;
_rdlcName = "EmpInfoReport.rdlc";
_item = item;
string RDLC = Path.Combine(folderPath, _rdlcName);
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
//GetParametersNew(payrollTypeID);
// extra property for emp picture
reportParameters.Add(new ReportParameter("EmpPic", empPicPath));
if (reportParameters != null)
localReport.SetParameters(reportParameters);
bytes = localReport.Render("PDF", null, out string mimeType, out string encoding, out string filenameExtension, out string[] streamids, out Warning[] warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForEmpBasic(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
DataSet dSet = new DataSet();
string RDLC;
byte[] bytes = null;
oFinalDT.TableName = "PayrollDataSet_EmployeeInfo";
RDLC = "HRM.Report.RDLC.EmployeeInfo.rdlc";
dSet.Tables.Add(oFinalDT);
string _PATH = string.Empty; // Application.StartupPath + @"\Logo.png";
ReportItem _item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportEmbeddedResource = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForNewPaySlip(ReportItem item, DataTable oFinalDT, DataSet oDS, int payrollTypeId)
{
DataSet dSet = new DataSet();
byte[] bytes = null;
_rdlcName = "PaySlipNew.rdlc";
string filePath = Path.Combine(folderPath, "PaySlipNew.rdlc");
string RDLC = filePath;
_oSubReportDataSet = oDS;
string _PATH = String.Empty; // Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
//if (oDS != null && oDS.Tables.Count > 0)
//{
// foreach (DataTable table in oDS.Tables)
// {
localReport.DataSources.Add(new ReportDataSource(oFinalDT.TableName, oFinalDT));
//}
localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
//localReport.ReportEmbeddedResource = RDLC;
localReport.ReportPath = RDLC;
//}
GetParameters(payrollTypeId);
rParam = new ReportParameter("isBold", false.ToString());
reportParameters.Add(rParam);
bool isRoundOff = false;
bool isHnM = false;
string addressLine1 = null;
string addressLine2 = null;
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
if (companyName == "SGS Bangladesh Limited")
{
isRoundOff = true;
}
else
{
isRoundOff = false;
}
rParam = new ReportParameter("isRoundOff", isRoundOff.ToString());
reportParameters.Add(rParam);
//new added fro H&M
if (companyName == "HNM")
{
PayrollType payrollType = new PayrollTypeService().Get(payrollTypeId);
string[] words = payrollType.Address.Split(' ');
int lastWordIndex = words.Length - 1;
// Extract the last word
string lastWord = words[lastWordIndex];
// Join the remaining words except the last one
string firstPart = string.Join(" ", words, 0, lastWordIndex);
// Create an array to store the first part and the last word
string[] result = { firstPart, lastWord };
isHnM = true;
addressLine1 = result[0];
addressLine2 = result[1];
}
else
{
isHnM = false;
addressLine1 = null;
addressLine2 = null;
}
rParam = new ReportParameter("isHnM", isHnM.ToString());
reportParameters.Add(rParam);
rParam = new ReportParameter("addressLine1", addressLine1);
reportParameters.Add(rParam);
rParam = new ReportParameter("addressLine2", addressLine2);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] GetPayslipReport(ReportItem item, DataSet oDS, int payrollTypeId)
{
DataSet dSet = new DataSet();
byte[] bytes = null;
string filePath = Path.Combine(folderPath, "PaySlipNew.rdlc");
string RDLC = filePath;
string _PATH = String.Empty; // Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (oDS != null && oDS.Tables.Count > 0)
{
foreach (DataTable table in oDS.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
//localReport.ReportEmbeddedResource = RDLC;
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("isBold", false.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ReportViewForEmployeeDetails(ReportItem reportItem, DataSet dSet, string reportName,
List<ReportParameter> parameters)
{
byte[] bytes = null;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
_item = reportItem;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
string folderPath = @"E:\Local SVN\SanofiNew\HRM.Report\RDLC";
localReport.ReportPath = Path.Combine(folderPath, reportName);
}
GetParametersForEmployeeDetail();
if (parameters != null)
{
foreach (ReportParameter parItem in parameters)
{
reportParameters.Add(parItem);
}
}
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForTaxCard(ReportItem item, DataSet dSet, string EmpName, string EmpNo, string TINNo,
string AssYear, string FisYear, int payrollTypeId, bool ITStatus, string reportType, TaxParameter oTaxparam)
{
// _PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
byte[] bytes = null;
//string filePath = "";// ITStatus ? Path.Combine(folderPath, "IncomeTax.rdlc") : Path.Combine(folderPath, "ITCertificate.rdlc");
string filePath = ITStatus ? Path.Combine(folderPath, "IncomeTax.rdlc") :
(oTaxparam.FiscalyearDatefrom < new DateTime(2022, 7, 1) ? Path.Combine(folderPath, "ITCertificate.rdlc") : Path.Combine(folderPath, "ITCertificatePrev.rdlc"));
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
//if (ITStatus)
//{
// filePath = Path.Combine(folderPath, "IncomeTax.rdlc");
//}
//else
//{
// if (oTaxparam.FiscalyearDatefrom < new DateTime(2022, 7, 1))
// {
// filePath = Path.Combine(folderPath, "ITCertificate.rdlc");
// }
// else
// {
// filePath = Path.Combine(folderPath, "ITCertificatePrev.rdlc");
// }
//}
//if (companyName == "SGS Bangladesh Limited")
//{
// filePath = ITStatus ? Path.Combine(folderPath, "IncomeTax.rdlc") :
// (oTaxparam.FiscalyearDatefrom < new DateTime(2022, 7, 1) ? Path.Combine(folderPath, "ITCertificateSGS.rdlc") : Path.Combine(folderPath, "ITCertificatePrevSGS.rdlc"));
//}
string RDLC = filePath;
// = IsArrear;
//_UnAuthorizedExit = IsUnAuthorized;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.EnableHyperlinks = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//localReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
bool otherInvestment = false;
if (companyName == "SGS Bangladesh Limited")
otherInvestment = true;
GetParameters(payrollTypeId);
ReportParameter rParam = new ReportParameter("EmpName", EmpName);
reportParameters.Add(rParam);
rParam = new ReportParameter("EmpNo", EmpNo);
reportParameters.Add(rParam);
rParam = new ReportParameter("TINNo", TINNo);
reportParameters.Add(rParam);
rParam = new ReportParameter("AssesmentYear", AssYear);
reportParameters.Add(rParam);
rParam = new ReportParameter("FiscalYear", FisYear);
reportParameters.Add(rParam);
rParam = new ReportParameter("OtherInvestment", otherInvestment.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowMultipleEmpLeaveBalance(ReportItem reportItem, DataSet dSet, string reportName,
string leaveYear, int payrollTypeId, string reportType)
{
byte[] bytes = null;
string filePath = Path.Combine(folderPath, "MultipleLeaveEmp.rdlc");
string RDLC = filePath;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
// this.ReportParams = reportParameters;
ReportParameter parameter = new ReportParameter("LeaveYear", leaveYear);
reportParameters.Add(parameter);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
//internal byte[] ShowMultipleEmpLeaveRegister(ReportItem reportItem, DataSet dSet, string reportName, string leaveYear, int payrollTypeId, string reportType)
//{
// //DataSet dSet = new DataSet();
// byte[] bytes = null;
// string filePath = Path.Combine(folderPath, reportName);
// string RDLC = filePath;
// LocalReport localReport = new LocalReport();
// localReport.DataSources.Clear();
// localReport.EnableExternalImages = true;
// try
// {
// if (dSet != null && dSet.Tables.Count > 0)
// {
// foreach (DataTable table in dSet.Tables)
// {
// localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
// }
// localReport.ReportPath = RDLC;
// }
// GetParameters(payrollTypeId);
// // this.ReportParams = reportParameters;
// ReportParameter parameter = new ReportParameter("LeaveYear", leaveYear);
// reportParameters.Add(parameter);
// if (reportParameters != null)
// localReport.SetParameters(reportParameters);
// Warning[] warnings;
// string[] streamids;
// string mimeType;
// string encoding;
// string filenameExtension;
// bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
// out streamids, out warnings);
// }
// catch (Exception ex)
// {
// throw new Exception(ex.Message, ex);
// }
// return bytes;
//}
public byte[] ShowCashAdviceReport(ReportItem reportItem, DataTable oFinalDT, int payrollTypeId, string reportType)
{
DataSet dSet = new DataSet();
byte[] bytes = null;
string filePath = Path.Combine(folderPath, "CashAdviceNew.rdlc");
string RDLC = filePath;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
oFinalDT.TableName = "dsCompany_BankAdvice";
dSet.Tables.Add(oFinalDT);
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
bool isRoundOff = false;
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
if (companyName == "SGS Bangladesh Limited")
{
isRoundOff = true;
}
else
{
isRoundOff = false;
}
rParam = new ReportParameter("isRoundOff", isRoundOff.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowLeaveBalanceNew(List<ReportDataSource> dataSource, string embeddedResource, string caption,
int payrollTypeId, string reportType)
{
byte[] bytes = null;
string filePath = Path.Combine(folderPath, "LeaveLedgerNmgt.rdlc");
_rdlcName = "LeaveLedgerNmgt.rdlc";
string RDLC = filePath;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
//_oSubReportDataSet = dataSource;
DataTable cInformation = null;
//dtEmp.TableName = "dsEmpLeaveLedger_EmpInformation";
cInformation = new PayrollDataSet.dsCompany.ComapnyInformationDataTable();
DataRow row = cInformation.NewRow();
row["Name"] = "sysInfo.name";
row["Address"] = "sysInfo.corporateAddress";
row["Email"] = "sysInfo.email";
row["Web"] = "sysInfo.webAddress";
cInformation.Rows.Add(row);
dataSource.Add(new ReportDataSource("CompanyInformation_ComapnyInformation", cInformation));
localReport.Refresh();
try
{
foreach (ReportDataSource source in dataSource)
{
localReport.DataSources.Add(source);
}
localReport.ReportEmbeddedResource = embeddedResource;
localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
localReport.ReportPath = RDLC;
// GetParametersForLeave();
GetParameters(payrollTypeId);
//ReportParameter parameter = new ReportParameter();
//localReport.SetParameters(parameter);
//this.ReportParams = reportParameters;
//if (reportParameters != null)
// ReportViewer.LocalReport.SetParameters(reportParameters);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowLeaveLedger(DataTable dtEmp, DataSet dataSource, string embeddedResource, string caption, int payrollTypeId, string reportType)
{
byte[] bytes = null;
string filePath = Path.Combine(folderPath, "MultipleLeaveLedger.rdlc");
_rdlcName = "MultipleLeaveLedger.rdlc";
string RDLC = filePath;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
_oSubReportDataSet = dataSource;
DataTable cInformation = null;
dtEmp.TableName = "dsEmpLeaveLedger_EmpInformation";
cInformation = new PayrollDataSet.dsCompany.ComapnyInformationDataTable();
DataRow row = cInformation.NewRow();
row["Name"] = "sysInfo.name";
row["Address"] = "sysInfo.corporateAddress";
row["Email"] = "sysInfo.email";
row["Web"] = "sysInfo.webAddress";
cInformation.Rows.Add(row);
// dataSource.Add(new ReportDataSource("CompanyInformation_ComapnyInformation", cInformation));
localReport.Refresh();
try
{
localReport.DataSources.Add(new ReportDataSource(dtEmp.TableName, dtEmp));
localReport.SubreportProcessing += new SubreportProcessingEventHandler(LocalReport_SubreportProcessing);
localReport.ReportPath = RDLC;
// GetParametersForLeave();
GetParameters(payrollTypeId);
//ReportParameter parameter = new ReportParameter();
//localReport.SetParameters(parameter);
//this.ReportParams = reportParameters;
//if (reportParameters != null)
// ReportViewer.LocalReport.SetParameters(reportParameters);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
return bytes;
}
public byte[] ShowDlgForMonthlyOTSheet(ReportItem item, DataTable oFinalDT, DateTime ProcessMonth, int PayrollTypeID, string reportType)
{
bool fixedotmonth = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "overtime", "fixedotmonth");
byte[] bytes = null;
DataSet dSet = new DataSet();
oFinalDT.TableName = "PayrollDataSet_OTMonthlySheet";
dSet.Tables.Add(oFinalDT);
if (fixedotmonth)
_rdlcName = "OTMonthlySheet.rdlc";
else
_rdlcName = "OTMonthlySheetWithMonth.rdlc";
_item = item;
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
localReport.DataSources.Add(new ReportDataSource(oFinalDT.TableName, oFinalDT));
localReport.ReportPath = RDLC;
// GetParametersNew(PayrollTypeID);
GetParameters(PayrollTypeID);
rParam = new ReportParameter("ProcessMonth", ProcessMonth.ToString());
reportParameters.Add(rParam);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
if (reportParameters != null)
{
localReport.SetParameters(reportParameters);
}
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
return bytes;
}
public byte[] ShowDlgForOTBankDisbursement(ReportItem item, DataTable oFinalDT, DateTime OTMonth, int PayrollTypeID, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
oFinalDT.TableName = "dsCompany_DTOPI";
dSet.Tables.Add(oFinalDT);
_rdlcName = "OTBankDisbursement.rdlc";
_item = item;
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
localReport.DataSources.Add(new ReportDataSource(oFinalDT.TableName, oFinalDT));
localReport.ReportPath = RDLC;
// GetParametersNew(PayrollTypeID);
GetParameters(PayrollTypeID);
rParam = new ReportParameter("Month", OTMonth.ToString());
reportParameters.Add(rParam);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
if (reportParameters != null)
{
localReport.SetParameters(reportParameters);
}
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
return bytes;
}
//public byte[] OTCostCenter(ReportItem item, DataSet dSet, DateTime OTMonth, int PayrollTypeID, string reportType)
//{
// byte[] bytes = null;
// _rdlcName = "CCWiseOTSummary.rdlc";
// _item = item;
// string filePath = Path.Combine(folderPath, _rdlcName);
// string RDLC = filePath;
// LocalReport localReport = new LocalReport();
// localReport.DataSources.Clear();
// localReport.EnableExternalImages = true;
// localReport.Refresh();
// try
// {
// if (dSet != null && dSet.Tables.Count > 0)
// {
// foreach (DataTable table in dSet.Tables)
// {
// localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
// }
// }
// localReport.ReportPath = RDLC;
// // GetParametersNew(PayrollTypeID);
// GetParameters(PayrollTypeID);
// }
// catch (Exception ex)
// {
// throw new Exception(ex.Message, ex);
// }
// if (reportParameters != null)
// {
// localReport.SetParameters(reportParameters);
// }
// Warning[] warnings;
// string[] streamids;
// string mimeType;
// string encoding;
// string filenameExtension;
// bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
// out streamids, out warnings);
// return bytes;
//}
public byte[] ShowForEmpJoiningExceptionReport(ReportItem item, DataTable oFinalDT, string dSalaryMonth, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
_rdlcName = "EmployeeJoiningInfo.rdlc";
oFinalDT.TableName = "PayrollDataSet_EmpJoining4Novartis";
dSet.Tables.Add(oFinalDT);
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
// localReport.ReportEmbeddedResource = RDLC;
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
ReportParameter parameter = new ReportParameter("ExceptionMonth", dSalaryMonth);
reportParameters.Add(parameter);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowForDiscontinueExceptionReport(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
oFinalDT.TableName = "PayrollDataSet_EmployeeHistory";
_rdlcName = "EmployeeHistory.rdlc";
dSet.Tables.Add(oFinalDT);
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowForBasicAndGradeReport(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
oFinalDT.TableName = "PayrollDataSet_EmpGradeBasic";
_rdlcName = "EmpBasicGrade.rdlc";
dSet.Tables.Add(oFinalDT);
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowForDesignationExceptionReport(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
oFinalDT.TableName = "PayrollDataSet_EmpDesCatChange";
_rdlcName = "DesignationChange.rdlc";
dSet.Tables.Add(oFinalDT);
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowForEmpAllowDeduct(ReportItem item, DataTable oFinalDT, DateTime fromDate, DateTime toDate, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
oFinalDT.TableName = "PayrollDataSet_EmpAllowDeduct";
_rdlcName = "EmpAllowDeduct.rdlc";
dSet.Tables.Add(oFinalDT);
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportPath = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
ReportParameter oReportParameter = new ReportParameter("FromDate", fromDate.ToString("MMM yyyy"));
reportParameters.Add(oReportParameter);
oReportParameter = new ReportParameter("ToDate", toDate.ToString("MMM yyyy"));
reportParameters.Add(oReportParameter);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
internal byte[] ShowFSSReport(DataTable dtFSS, DataTable dtItems, string sAmount, int payrollTypeId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "rptNewFSS.rdlc");
string RDLC = filePath;
dtFSS.TableName = "dsCompany_DTFSS";
dtItems.TableName = "dsCompany_DTFSSItems";
dSet.Tables.Add(dtFSS);
dSet.Tables.Add(dtItems);
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("ReportType", "PDF");
reportParameters.Add(rParam);
rParam = new ReportParameter("Amount", sAmount);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForBankAdvice(ReportItem item, DataTable oFinalDT, int nReportID, string reportType, int payrollTypeId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "SalarySheet.rdlc");
string RDLC = filePath;
ReportAuthorization oReportAuthorization = null;
oReportAuthorization = new ReportAuthorizationService().Get(nReportID);
oFinalDT.TableName = "PayrollDataSet_BankAdvice";
dSet.Tables.Add(oFinalDT);
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
string name = string.Empty;
int authorizePersionId = new ReportAuthorizationService().Get(nReportID, 1).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("PreparedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("PreparedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 2).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CheckedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CheckedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 3).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("HeadofHRApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("HeadofHRApprovedBy", "");
reportParameters.Add(rParam);
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 4).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CCOApprovedBy", name);
reportParameters.Add(rParam);
}
}
else
{
rParam = new ReportParameter("CCOApprovedBy", "");
reportParameters.Add(rParam);
}
//rParam = new ReportParameter("DynamicGroup",DynamicGroup);
//reportParameters.Add(rParam);
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForSettlementAdvice(ReportItem item, DataTable oFinalDT, string reportType, int payrollTypeId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string filePath = Path.Combine(folderPath, "SettlementAdviceSheetNew.rdlc");
string RDLC = filePath;
oFinalDT.TableName = "PayrollDataSet_SettlementAdvice";
dSet.Tables.Add(oFinalDT);
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
string name = string.Empty;
rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
//public byte[] ShowDlgForAssetAcknowledgement(ReportItem item, DataTable oFinalDT, string reportType, int payrollTypeId)
//{
// byte[] bytes = null;
// DataSet dSet = new DataSet();
// string filePath = Path.Combine(folderPath, "AssetSerial.rdlc");//change
// string RDLC = filePath;
// oFinalDT.TableName = "PayrollDataSet_AssetAcknowledgement";//change
// dSet.Tables.Add(oFinalDT);
// _item = item;
// LocalReport localReport = new LocalReport();
// localReport.DataSources.Clear();
// localReport.EnableExternalImages = true;
// try
// {
// if (dSet != null && dSet.Tables.Count > 0)
// {
// foreach (DataTable table in dSet.Tables)
// {
// localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
// }
// localReport.ReportPath = RDLC;
// }
// GetParameters(payrollTypeId);
// string name = string.Empty;
// rParam = new ReportParameter("ReportType", reportType);
// reportParameters.Add(rParam);
// if (reportParameters != null)
// localReport.SetParameters(reportParameters);
// Warning[] warnings;
// string[] streamids;
// string mimeType;
// string encoding;
// string filenameExtension;
// bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
// out streamids, out warnings);
// }
// catch (Exception ex)
// {
// throw new Exception(ex.Message, ex);
// }
// return bytes;
//}
public byte[] ShowDlgForOPITotalValueRegister(string item, DataTable oFinalDT, DateTime sFromOPIMonth, DateTime sToOPIMonth, int payrollTypeId, int itemId)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
string RDLC;
oFinalDT.TableName = "PayrollDataSet_OPITotalValueRegister";
RDLC = "HRM.Report.RDLC.OPITotalValueRegister.rdlc";
dSet.Tables.Add(oFinalDT);
OpiItem opiItem = null;
if (itemId != null)
{
List<OpiItem> opiItems = new OpiItemService().Get();
opiItem = opiItems.Where(x => x.ID == itemId).FirstOrDefault();
}
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
//ReportViewer.Refresh();
//ReportViewer.LocalReport.DataSources.Clear();
//ReportViewer.LocalReport.EnableExternalImages = true;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeId);
//List<ReportParameter> reportParameters = new List<ReportParameter>();
ReportParameter rParam1 = new ReportParameter("FromOPIMonth", sFromOPIMonth.ToString());
reportParameters.Add(rParam1);
ReportParameter rParam2 = new ReportParameter("ToOPIMonth", sToOPIMonth.ToString());
reportParameters.Add(rParam2);
ReportParameter rParam3 = new ReportParameter("OPIitem", opiItem.Name);
reportParameters.Add(rParam3);
//this.ReportParams = _parameters;
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(item, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
internal byte[] ShowDlgForDigitalServiceBookReport(ReportItem item, DataSet dSet, int empId, int payrollTypeId)
{
byte[] bytes = null;
string RDLC = "HRM.Report.RDLC.AllDigitalServiceBook.rdlc";
//string filePath = Path.Combine(folderPath, "../HRM.Report/RDLC/DigitalServiceBook.rdlc");
//string RDLC = filePath;
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
//localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
////GetImageFromEmpFileUpload(empId);
rParam = new ReportParameter("Photo", _PATH);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render("PDF", null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
private void GetImageFromPayrollType(int PayrollTypeID)
{
photoPath += @"\PayrollTypeLogo_" + PayrollTypeID.ToString() + ".jpg";
if (!Directory.Exists(photoPath))
{
File.WriteAllBytes(photoPath, new PayrollTypeService().GetCompanyImage(PayrollTypeID));
}
}
private void CreateTempDirectory()
{
if (!Directory.Exists(photoPath))
{
Directory.CreateDirectory(photoPath);
}
}
public byte[] ShowDlgForEmpPosting(DataTable oFinalDT, int payrollTypeId, string reportType)
{
DataSet dSet = new DataSet();
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
byte[] bytes = null;
string RDLC;
oFinalDT.TableName = "PayrollDataSet_PostingDetails";
RDLC = "HRM.Report.RDLC.EmpPostingDetails.rdlc";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
//ReportViewer.Refresh();
//ReportViewer.LocalReport.DataSources.Clear();
//ReportViewer.LocalReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportEmbeddedResource = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
//this.ReportParams = _parameters;
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForCCWReport(string item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
DataSet dSet = new DataSet();
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
byte[] bytes = null;
string RDLC;
oFinalDT.TableName = "PayrollDataSet_CCWReport";
RDLC = "HRM.Report.RDLC.CCWReport.rdlc";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
//ReportViewer.Refresh();
//ReportViewer.LocalReport.DataSources.Clear();
//ReportViewer.LocalReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForCCDetailWReport(string item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
DataSet dSet = new DataSet();
LocalReport localReport = new LocalReport();
byte[] bytes = null;
string RDLC;
oFinalDT.TableName = "PayrollDataSet_CCDetailReport";
RDLC = "HRM.Report.RDLC.CCDetailReport.rdlc";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForUpCommingEmpForRekit(string reportType, DataTable oFinalDT, int payrollTypeId)
{
DataSet dSet = new DataSet();
string RDLC;
oFinalDT.TableName = "PayrollDataSet_UpCommingEmp";
RDLC = "HRM.Report.RDLC.UpCommingEmp.rdlc";
dSet.Tables.Add(oFinalDT);
byte[] bytes = null;
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
localReport.ReportEmbeddedResource = RDLC;
}
//ReportViewer.LocalReport.ReportEmbeddedResource = "Payroll.Report.RDLC.Payslip.rdlc";
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForMRange(string reportType, DataTable oFinalDT, int payrollTypeId)
{
LocalReport localReport = new LocalReport();
byte[] bytes = null;
DataSet dSet = new DataSet();
string RDLC;
oFinalDT.TableName = "PayrollDataSet_OTMonthRange";
RDLC = "HRM.Report.RDLC.OTMonthRange.rdlc";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForBranchWOT(string reportType, DataTable oFinalDT, int payrollTypeID)
{
byte[] bytes = null;
LocalReport localReport = new LocalReport();
DataSet dSet = new DataSet();
string RDLC;
oFinalDT.TableName = "PayrollDataSet_BranchWiseOT";
RDLC = "HRM.Report.RDLC.BranchWiseOT.rdlc";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeID);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForDivisionWOT(string reportType, DataTable oFinalDT, int payrollTypeID)
{
byte[] bytes = null;
LocalReport localReport = new LocalReport();
DataSet dSet = new DataSet();
string RDLC;
oFinalDT.TableName = "PayrollDataSet_DivisionWiseOT";
RDLC = "HRM.Report.RDLC.DivisionWiseOT.rdlc";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeID);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowShowAllPFandDetails(string reportType, DataSet dSet, int payrollTypeID)
{
LocalReport localReport = new LocalReport();
string RDLC;
byte[] bytes = null;
RDLC = "HRM.Report.RDLC.ShowITPfAndOtherDetails.rdlc";
//_PATH = Application.StartupPath + @"\Logo.jpg";
//ReportViewer.Refresh();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeID);
ReportItem ritm = new ReportItem();
//_parameters.Add(
//this.ReportParams = _parameters;
//this.ReportParams =
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowPFLedger(DataTable dTPFLedger, string reportType, string sEmpID, DateTime FromDate, DateTime toDate, string sEmpName, string sEmpNo, double opening, int payrollTypeID)
{
DataSet dSet = new DataSet();
LocalReport localReport = new LocalReport();
string RDLC;
dTPFLedger.TableName = "PayrollDataSet_PFLedger";
RDLC = "HRM.Report.RDLC.PFLedger.rdlc";
dSet.Tables.Add(dTPFLedger);
byte[] bytes = null;
//_PATH = Application.StartupPath + @"\Logo.png";
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeID);
rParam = new ReportParameter("FromDate", FromDate.ToString("dd-MMM-yyyy"));
reportParameters.Add(rParam);
rParam = new ReportParameter("ToDate", toDate.ToString("dd-MMM-yyyy"));
reportParameters.Add(rParam);
rParam = new ReportParameter("EmpName", sEmpName);
reportParameters.Add(rParam);
rParam = new ReportParameter("EmpNo", sEmpNo);
reportParameters.Add(rParam);
rParam = new ReportParameter("Opening", opening.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowPFExceptionReport(string reportType, DataTable dtMonthlyPF, DataTable dtCRG, int payrollTypeID)
{
DataSet dSet = new DataSet();
LocalReport localReport = new LocalReport();
string RDLC;
dtMonthlyPF.TableName = "dsCompany_DTMonthlyPF";
dtCRG.TableName = "dsCompany_DtCostCenterTotal";
RDLC = "HRM.Report.RDLC.PFExceptionNew.rdlc";
dSet.Tables.Add(dtMonthlyPF);
dSet.Tables.Add(dtCRG);
byte[] bytes = null;
//_PATH = Application.StartupPath + @"\Logo.jpg";
//ReportViewer.Refresh();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(payrollTypeID);
//this.reportParameters = _parameters;
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowForCandidateInfoReport(ReportItem item, DataTable oFinalDT, string sessionDate, string sessionTime, string positionName, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
_rdlcName = "CandidateAssesmentDetails.rdlc";
oFinalDT.TableName = "PayrollDataset_CandidateInformation";
dSet.Tables.Add(oFinalDT);
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
//ReportViewer.LocalReport.DataSources.Add(new ReportDataSource("", table));
}
// localReport.ReportEmbeddedResource = RDLC;
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
ReportParameter parameter = new ReportParameter("SessionDate", sessionDate);
ReportParameter parameter1 = new ReportParameter("SessionTime", sessionTime);
ReportParameter parameter3 = new ReportParameter("PositionName", positionName);
reportParameters.Add(parameter);
reportParameters.Add(parameter1);
reportParameters.Add(parameter3);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForSalarySheetNew(string reportType, DataTable oFinalDT, int nReportID, int PayrollTypeID)
{
LocalReport localReport = new LocalReport();
DataSet dSet = new DataSet();
string RDLC;
ReportAuthorization oReportAuthorization = null;
oReportAuthorization = new ReportAuthorizationService().Get(nReportID);
oFinalDT.TableName = "PayrollDataSet_CCWiseSalarySheetNew";
RDLC = "HRM.Report.RDLC.NewCCWiseSalarySheet.rdlc";
dSet.Tables.Add(oFinalDT);
byte[] bytes = null;
//_PATH = Application.StartupPath + @"\Logo.jpg";
//_item = item;
//ReportViewer.Refresh();
//ReportViewer.LocalReport.DataSources.Clear();
//ReportViewer.LocalReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = RDLC;
}
GetParameters(PayrollTypeID);
string name = string.Empty;
int authorizePersionId = new ReportAuthorizationService().Get(nReportID, 1).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("PreparedBy", name);
reportParameters.Add(rParam);
}
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 2).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CheckedBy", name);
reportParameters.Add(rParam);
}
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 3).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("HeadofHRApprovedBy", name);
reportParameters.Add(rParam);
}
}
authorizePersionId = new ReportAuthorizationService().Get(nReportID, 4).AuthorizePersionId;
if (authorizePersionId != 0)
{
name = new AuthorizedPersonService().Get(authorizePersionId).Name;
if (name != "")
{
rParam = new ReportParameter("CCOApprovedBy", name);
reportParameters.Add(rParam);
}
}
//rParam = new ReportParameter("DynamicGroup",DynamicGroup);
//_parameters.Add(rParam);
//this.ReportParams = reportParameters;
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
internal byte[] ShowEmpLeaveEncashBalance(ReportItem reportItem, DataSet dSet, string reportName, string reportType, int payrollTypeId)
{
LocalReport localReport = new LocalReport();
byte[] bytes = null;
//ReportViewer.Refresh();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
//_item = reportItem;
//_PATH = Application.StartupPath + @"\Logo.jpg";
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportEmbeddedResource = reportName;
}
GetParameters(payrollTypeId);
//this.ReportParams = _parameters;
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowPerquisiteReport(DataTable oDatatable, string salaryMonth, string salaryMonth2, int payrollTypeId, string reportType)
{
DataSet dSet = new DataSet();
byte[] bytes = null;
oDatatable.TableName = "dsCompany_dtPerquisite";
string filePath = Path.Combine(folderPath, "TaxPerquisite.rdlc");
string RDLC = filePath;
dSet.Tables.Add(oDatatable);
List<PayrollType> oPRTypes = new PayrollTypeService().Get();
PayrollType oPT = oPRTypes.Find(delegate (PayrollType oItemPT) { return oItemPT.ID == payrollTypeId; });
string payrollType = oPT.Description;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
rParam = new ReportParameter("SalaryMonth", salaryMonth);
reportParameters.Add(rParam);
rParam = new ReportParameter("SalaryMonth2", salaryMonth2);
reportParameters.Add(rParam);
rParam = new ReportParameter("EmpParam", payrollType);
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
bytes = localReport.Render(reportType, null, out string mimeType, out string encoding, out string filenameExtension, out string[] streamids, out Warning[] warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] getAttendanceReport(ReportItem item, DataTable oFinalDT, int payrollTypeId, string reportType)
{
byte[] bytes = null;
DataSet dSet = new DataSet();
_rdlcName = "EmployeeAttendance.rdlc";
oFinalDT.TableName = "PayrollDataSet_EmpAttendance";
dSet.Tables.Add(oFinalDT);
string filePath = Path.Combine(folderPath, _rdlcName);
string RDLC = filePath;
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
localReport.Refresh();
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
localReport.ReportPath = RDLC;
}
GetParameters(payrollTypeId);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
public byte[] ShowDlgForBankDisbursmentWithRoutingNo(ReportItem item, DataTable oFinalDT, string reportType, int payrollTypeId, string rdlcName, DateTime SalaryMonth)
{
DataSet dSet = new DataSet();
byte[] bytes = null;
//string filePath = Path.Combine(folderPath, "Bank Advice.rdlc");
string filePath = "HRM.Report.RDLC." + rdlcName;
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
string companyName = Convert.ToString(companyNameObj);
//if (companyName == "SGS Bangladesh Limited")
// filePath = "HRM.Report.RDLC.BankAdviceSGS.rdlc";
//if (companyName == "HNM")
// filePath = "HRM.Report.RDLC.BankAdviceSalaryHnm.rdlc";
string RDLC = filePath;
oFinalDT.TableName = "dsCompany_BankAdviceWithRoutingNo";
dSet.Tables.Add(oFinalDT);
//_PATH = Application.StartupPath + @"\Logo.jpg";
_item = item;
LocalReport localReport = new LocalReport();
localReport.DataSources.Clear();
localReport.EnableExternalImages = true;
try
{
if (dSet != null && dSet.Tables.Count > 0)
{
foreach (DataTable table in dSet.Tables)
{
localReport.DataSources.Add(new ReportDataSource(table.TableName, table));
}
//localReport.ReportPath = RDLC;
localReport.ReportEmbeddedResource = RDLC;
}
//rParam = new ReportParameter("ReportType", reportType);
//reportParameters.Add(rParam);
GetParameters(payrollTypeId);
bool isRoundOff = false;
if (companyName == "SGS Bangladesh Limited")
isRoundOff = true;
rParam = new ReportParameter("isRoundOff", isRoundOff.ToString());
reportParameters.Add(rParam);
rParam = new ReportParameter("Month", SalaryMonth.ToString());
reportParameters.Add(rParam);
if (reportParameters != null)
localReport.SetParameters(reportParameters);
Warning[] warnings;
string[] streamids;
string mimeType;
string encoding;
string filenameExtension;
bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
out streamids, out warnings);
}
catch (Exception ex)
{
throw new Exception(ex.Message, ex);
}
return bytes;
}
}
}