1008 lines
50 KiB
C#
1008 lines
50 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Ease.Core.Model;
|
|
using Ease.Core.Utility;
|
|
using HRM.BO;
|
|
using HRM.DA;
|
|
using HRM.Service;
|
|
using Microsoft.Reporting.NETCore;
|
|
using NPOI.SS.Formula.Functions;
|
|
|
|
namespace HRM.Report
|
|
{
|
|
public class rptHnm
|
|
{
|
|
public rptHnm()
|
|
{
|
|
|
|
}
|
|
private DateTime _SalaryMonth;
|
|
string tempEmpID = string.Empty;
|
|
ReportParameter rParam = null;
|
|
int count = 1;
|
|
private List<ReportParameter> reportParameters = new List<ReportParameter>();
|
|
public byte[] OTBankDisbursementHnm(int PayrollTypeID, DateTime Month, string sEmpID, string reportType)
|
|
{
|
|
/*DateTime dOTMonth = _selectedParameter.FromDate.Value;
|
|
string sEmpID = _selectedParameter.ReportItem.INSQL;*/
|
|
DataRow oDR = null;
|
|
DataSet dsOT = null;
|
|
|
|
dsOT = new OTProcessService().GetCostCenterWiseOT(GlobalFunctions.LastDateOfMonth(Month), sEmpID);
|
|
PayrollDataSet.dsCompany.DTOPIDataTable dtOT = new PayrollDataSet.dsCompany.DTOPIDataTable();
|
|
|
|
if (dsOT.Tables.Count > 0)
|
|
{
|
|
foreach (DataRow orr in dsOT.Tables[0].Rows)
|
|
{
|
|
oDR = dtOT.NewRow();
|
|
|
|
oDR["EmpNo"] = orr["EmployeeNo"].ToString();
|
|
oDR["Name"] = orr["EmpName"].ToString();
|
|
oDR["AccountNo"] = orr["ACCOUNTNO"].ToString();
|
|
oDR["Amount"] = GlobalFunctions.Round(Convert.ToDouble(orr["Amount"].ToString()));
|
|
oDR["Designation"] = orr["Designation"].ToString();
|
|
oDR["CostCenter"] = orr["CostCenter"].ToString();
|
|
|
|
dtOT.Rows.Add(oDR);
|
|
}
|
|
|
|
/*if (dtOT.Rows.Count > 0)
|
|
{
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
return reportProcessor.ShowDlgForOTBankDisbursement(null, dtOT, Month, PayrollTypeID, reportType);
|
|
}*/
|
|
}
|
|
rParam = new ReportParameter("Month", Month.ToString());
|
|
reportParameters.Add(rParam);
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
dtOT.TableName = "dsCompany_DTOPI";
|
|
string RDLCName = "HRM.Report.RDLC.OTBankDisbursementHNM.rdlc";
|
|
dsOT.Tables.Add(dtOT);
|
|
|
|
// return reportProcessor.ShowDlgForOTBankDisbursement(null, dtOT, Month, PayrollTypeID, reportType);
|
|
return reportProcessor.CommonReportView(null, RDLCName, dsOT, null, reportParameters, true, PayrollTypeID, reportType);
|
|
}
|
|
public byte[] BonusRegister(int nBonusID, DateTime dBonusMonth, string sEmpID, int payrollTypeId, string reportType)
|
|
{
|
|
Bonus oBonus = new BonusService().Get(nBonusID);
|
|
int count = 1;
|
|
DataRow oDR = null;
|
|
DataSet oBonusRegister = null;
|
|
|
|
oBonusRegister = new BonusProcessService().GetBonusRegisterNew(nBonusID, GlobalFunctions.FirstDateOfMonth(dBonusMonth), sEmpID, payrollTypeId);
|
|
PayrollDataSet.PayrollDataSet.BonusRegisterDataTable dBonusRegData = new PayrollDataSet.PayrollDataSet.BonusRegisterDataTable();
|
|
foreach (DataRow oDRow in oBonusRegister.Tables[0].Rows)
|
|
{
|
|
oDR = dBonusRegData.NewRow();
|
|
oDR["EmpNo"] = oDRow["EMPLOYEENO"];
|
|
oDR["Name"] = oDRow["NAME"];
|
|
oDR["Basic"] = oDRow["BasicSalary"];
|
|
oDR["BonusAmount"] = oDRow["ChangeBonusAmount"];
|
|
oDR["TaxAmount"] = oDRow["ChangeTaxAmount"];
|
|
oDR["Gross"] = oDRow["GROSSSALARY"];
|
|
oDR["JoiningDate"] = oDRow["JOININGDATE"];
|
|
oDR["BonusMonth"] = dBonusMonth;
|
|
oDR["BonusName"] = oBonus.Name;
|
|
oDR["ConfirmDate"] = oDRow["DATEOFCONFIRMATION"];
|
|
//oDR["NetBonus"]=oDRow[""];
|
|
oDR["SLNo"] = count;
|
|
|
|
int serlen = Convert.ToInt32(oDRow["ServiceLength"].ToString()) + 1;
|
|
oDR["ServiceLength"] = serlen;// oDRow["ServiceLength"];
|
|
oDR["AccountNo"] = oDRow["AccountNo"];
|
|
if (serlen >= 25)
|
|
{
|
|
oDR["Percent"] = "200%";
|
|
}
|
|
else if (serlen >= 20)
|
|
{
|
|
oDR["Percent"] = "150%";
|
|
}
|
|
else if (serlen >= 15)
|
|
{
|
|
oDR["Percent"] = "100%";
|
|
}
|
|
else if (serlen >= 10)
|
|
{
|
|
oDR["Percent"] = "50%";
|
|
}
|
|
else if (serlen > 5)
|
|
{
|
|
oDR["Percent"] = "30%";
|
|
}
|
|
|
|
dBonusRegData.Rows.Add(oDR);
|
|
count++;
|
|
}
|
|
string rdlcName = "BonusRegisterHnm.rdlc";
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
return reportProcessor.ShowDlgForBonusRegister(null, dBonusRegData, payrollTypeId, reportType, rdlcName);
|
|
}
|
|
|
|
public byte[] BonusRegisterHNM(int nBonusID, DateTime dBonusMonth, string sEmpID, int payrollTypeId, string reportType)
|
|
{
|
|
|
|
Bonus oBonus = new BonusService().Get(nBonusID);
|
|
int count = 1;
|
|
DataRow oDR = null;
|
|
DataSet oBonusRegister = null;
|
|
|
|
oBonusRegister = new BonusProcessService().GetBonusRegisterNew(nBonusID, GlobalFunctions.FirstDateOfMonth(dBonusMonth), sEmpID, payrollTypeId);
|
|
PayrollDataSet.PayrollDataSet.BonusRegisterDataTable dBonusRegData = new HRM.Report.PayrollDataSet.PayrollDataSet.BonusRegisterDataTable();
|
|
foreach (DataRow oDRow in oBonusRegister.Tables[0].Rows)
|
|
{
|
|
oDR = dBonusRegData.NewRow();
|
|
oDR["EmpNo"] = oDRow["EMPLOYEENO"];
|
|
oDR["Name"] = oDRow["NAME"];
|
|
oDR["Basic"] = oDRow["BasicSalary"];
|
|
oDR["BonusAmount"] = oDRow["ChangeBonusAmount"];
|
|
oDR["TaxAmount"] = oDRow["ChangeTaxAmount"];
|
|
oDR["Gross"] = oDRow["GROSSSALARY"];
|
|
oDR["JoiningDate"] = oDRow["JOININGDATE"];
|
|
oDR["BonusMonth"] = dBonusMonth;
|
|
oDR["BonusName"] = oBonus.Code;
|
|
oDR["ConfirmDate"] = oDRow["DATEOFCONFIRMATION"];
|
|
//oDR["NetBonus"]=oDRow[""];
|
|
oDR["SLNo"] = count;
|
|
if (nBonusID == 1)
|
|
{
|
|
int serlen = Convert.ToInt32(oDRow["ServiceLength"].ToString()) + 1;
|
|
oDR["ServiceLength"] = serlen;// oDRow["ServiceLength"];
|
|
oDR["AccountNo"] = oDRow["AccountNo"];
|
|
if (serlen >= 25)
|
|
{
|
|
oDR["Percent"] = "200%";
|
|
}
|
|
else if (serlen >= 20)
|
|
{
|
|
oDR["Percent"] = "150%";
|
|
}
|
|
else if (serlen >= 15)
|
|
{
|
|
oDR["Percent"] = "100%";
|
|
}
|
|
else if (serlen >= 10)
|
|
{
|
|
oDR["Percent"] = "50%";
|
|
}
|
|
else if (serlen > 5)
|
|
{
|
|
oDR["Percent"] = "30%";
|
|
}
|
|
}
|
|
dBonusRegData.Rows.Add(oDR);
|
|
count++;
|
|
}
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName;
|
|
if (nBonusID == 1)
|
|
{
|
|
return reportProcessor.ShowDlgForLoyaltyBonusRegister(dBonusRegData,payrollTypeId, reportType);
|
|
}
|
|
else
|
|
{
|
|
rdlcName = "BonusRegisterHnm.rdlc";
|
|
return reportProcessor.ShowDlgForBonusRegister(null, dBonusRegData, payrollTypeId, reportType, rdlcName);
|
|
}
|
|
|
|
}
|
|
public byte[] ShowNewBankDisbursmentReport(int payrollTypeId, DateTime SalaryMonth, string sEmpID, int BankId, string reportType)
|
|
{
|
|
|
|
DateTime salaryMonth = SalaryMonth.LastDateOfMonth();
|
|
int count = 1;
|
|
DataRow oDR = null;
|
|
Bank oBank = new BankService().Get(BankId);
|
|
|
|
|
|
|
|
DataSet oEmpBankAcc = new EmployeeBankAccountService().GetEmpBankAdvice(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
|
|
|
|
PayrollDataSet.dsCompany.BankAdviceDataTable bankAdvice = new PayrollDataSet.dsCompany.BankAdviceDataTable();
|
|
|
|
double nTotal = 0.0;
|
|
foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
|
|
{
|
|
oDR = bankAdvice.NewRow();
|
|
oDR["EmpNo"] = oDRow["EMPLOYEENO"];
|
|
oDR["EmpName"] = oDRow["NAME"]; //Beneficiary Name(120)
|
|
oDR["AccountNo"] = oDRow["ACCOUNTNO"]; //Beneficiary Account Number
|
|
oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"])); //Payment Amount
|
|
oDR["SalaryMonth"] = salaryMonth; //Reason(140)
|
|
oDR["PaymentDate"] = oDRow["PAYMENTDATE"]; //Payment Date(DD/MM/YYYY)
|
|
oDR["Email"] = oDRow["EMAILADDRESS"]; //Beneficiary Email ID(Optional)
|
|
oDR["SLNo"] = count;
|
|
|
|
//if(oDRow["EMAILADDRESS"] != null)
|
|
//{
|
|
// oDR["Email"] = oDRow["EMAILADDRESS"];
|
|
//}
|
|
//oDR["CostCenter"] = oDRow["CostCenter"].ToString();
|
|
bankAdvice.Rows.Add(oDR);
|
|
nTotal += Convert.ToDouble(oDR["Amount"]);
|
|
count++;
|
|
}
|
|
|
|
// bankAdvice.TableName = "dsCompany_BankAdvice";
|
|
// resultDataSet.Tables.Add(bankAdvice);
|
|
|
|
//string RDLCName = "HRM.Report.RDLC.SalaryBankDisbursement.rdlc";
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "BankAdviceSalary.rdlc";
|
|
return reportProcessor.ShowDlgForNewBankDisbursment(null, bankAdvice, reportType, payrollTypeId, rdlcName, SalaryMonth);
|
|
//return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, null, true, payrollTypeId, reportType);
|
|
}
|
|
|
|
public byte[] BonusBankAdvice(int nBonusID, DateTime dBonusMonth, string sEmpID, int payrollTypeId, string reportType)
|
|
{
|
|
int count = 1;
|
|
DataRow oDR = null;
|
|
DataSet oBonusBankAdvice = null;
|
|
|
|
oBonusBankAdvice = new BonusProcessService().GetBonusBankAdvice(nBonusID, GlobalFunctions.LastDateOfMonth(dBonusMonth), sEmpID, payrollTypeId);
|
|
PayrollDataSet.dsCompany.BonusBankAdviceDataTable dBonusBankData = new PayrollDataSet.dsCompany.BonusBankAdviceDataTable();
|
|
foreach (DataRow oDRow in oBonusBankAdvice.Tables[0].Rows)
|
|
{
|
|
oDR = dBonusBankData.NewRow();
|
|
oDR["EmpNo"] = oDRow["EMPLOYEENO"];
|
|
oDR["Name"] = oDRow["NAME"];
|
|
//oDR["BonusAmount"] = Math.Round(Convert.ToDouble(oDRow["BonusAmount"]));
|
|
oDR["BonusAmount"] = GlobalFunctions.TakaFormat(Convert.ToDouble(oDRow["BonusAmount"]));
|
|
oDR["AccountNo"] = oDRow["ACCOUNTNO"];
|
|
oDR["EmailAddress"] = oDRow["EMAILADDRESS"];
|
|
oDR["BonusMonth"] = dBonusMonth;
|
|
oDR["SLNo"] = count;
|
|
dBonusBankData.Rows.Add(oDR);
|
|
count++;
|
|
}
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "BonusBankAdviceHnm.rdlc";
|
|
return reportProcessor.ShowDlgForBankRegister(null, dBonusBankData, payrollTypeId, reportType, rdlcName);
|
|
}
|
|
public byte[] LeaveEncashmentSeparation(string sEmpID, string reportType, DateTime encashDate, int payrollTypeId)
|
|
{
|
|
DataRow dr = null;
|
|
DataSet leaveApprover = new DataSet();
|
|
string sDatecheck = string.Empty;
|
|
Leave oleave = new Leave();
|
|
|
|
List<Leave> oLeaves = new LeaveService().Get();
|
|
List<Employee> oemps = new EmployeeService().GetByEmpIDs(sEmpID);
|
|
LeaveYear oLeaveYear = new LeaveYearService().GetCurrentYear(payrollTypeId);
|
|
List<EmpLeaveStatus> oCurrYearStatus = new LeaveProcessService().CurrentYearStatusForEncash(oemps, oLeaveYear, EnumLeaveStatus.Approved, encashDate, payrollTypeId);
|
|
string empID = string.Empty;
|
|
int count = 1;
|
|
PayrollDataSet.dsEmpLeaveLedger.LeaveEncashDataTable mulLeaveBalance = new PayrollDataSet.dsEmpLeaveLedger.LeaveEncashDataTable();
|
|
foreach (EmpLeaveStatus olevestatus in oCurrYearStatus)
|
|
{
|
|
if (olevestatus.LeaveId == 1)
|
|
{
|
|
int ndate = 0;
|
|
Employee oemp = oemps.Find(delegate (Employee oem) { return oem.ID == olevestatus.EmpId; });
|
|
oleave = oLeaves.FirstOrDefault(x => x.ID == olevestatus.LeaveId);
|
|
dr = mulLeaveBalance.NewRow();
|
|
|
|
dr["EmpNo"] = oemp.EmployeeNo;
|
|
dr["Name"] = oemp.Name;
|
|
dr["LastDay"] = encashDate.ToString("dd MMM yyyy");
|
|
TimeSpan ts = encashDate - PayrollGlobalFunctions.FirstDateOfYear(encashDate);
|
|
|
|
double dd = Math.Round(Convert.ToDouble(((olevestatus.OpeningBalance - olevestatus.CFDays) / 365) * ts.Days));
|
|
dr["EntitledDays"] = dd;
|
|
dr["CFDays"] = olevestatus.CFDays;
|
|
dr["Taken"] = olevestatus.LeaveAvailed;
|
|
dr["Applied"] = olevestatus.ApplyDays;
|
|
dr["Balance"] = (dd + olevestatus.CFDays) - (olevestatus.LeaveAvailed + olevestatus.ApplyDays);
|
|
double ddl = Convert.ToDouble(dr["Balance"]);
|
|
dr["Encashed"] = Math.Round((oemp.GrossSalary * 12 * Convert.ToDouble(dr["Balance"])) / 365);
|
|
|
|
mulLeaveBalance.Rows.Add(dr);
|
|
}
|
|
}
|
|
DataSet dSet = new DataSet();
|
|
mulLeaveBalance.TableName = "dsEmpLeaveLedger_LeaveEncash";
|
|
dSet.Tables.Add(mulLeaveBalance);
|
|
|
|
//form.ShowEmpLeaveEncashBalance(null, dSet, "Payroll.Report.RDLC.rptLeaveEncashmentReport.rdlc");
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "rptLeaveEncashmentReport.rdlc";
|
|
return reportProcessor.CommonReportViewForReports(null, dSet, null, rdlcName, null, true, payrollTypeId, reportType);
|
|
}
|
|
public byte[] CCWisePFNewMemberWithAmount(int locationID, string reportType, DateTime pfMonth, int payrollTypeId)
|
|
{
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
int crgID = 0;
|
|
DataRow oDR = null;
|
|
DataSet dsPF = null;
|
|
DataSet dsPFEx = null;
|
|
string sLocation = string.Empty;
|
|
DataTable dtCRG1 = new DataTable();
|
|
|
|
dsPFEx =new PFExceptionService().Get(GlobalFunctions.LastDateOfMonth(pfMonth));
|
|
string spfexEmpIds = string.Empty;
|
|
|
|
foreach (DataRow dr in dsPFEx.Tables[0].Rows)
|
|
{
|
|
if (spfexEmpIds == string.Empty)
|
|
{
|
|
spfexEmpIds = dr["EmployeeID"].ToString();
|
|
}
|
|
else
|
|
{
|
|
spfexEmpIds = spfexEmpIds + "," + dr["EmployeeID"].ToString();
|
|
}
|
|
}
|
|
|
|
dsPF = new MiscellaneousDatasetService().GetEmployeesPF(GlobalFunctions.LastDateOfMonth(pfMonth), locationID, spfexEmpIds);
|
|
HRM.Report.PayrollDataSet.dsCompany.DTMonthlyPFDataTable dtMonthlyPF = new HRM.Report.PayrollDataSet.dsCompany.DTMonthlyPFDataTable();
|
|
HRM.Report.PayrollDataSet.dsCompany.DtCostCenterTotalDataTable dtCRG = new HRM.Report.PayrollDataSet.dsCompany.DtCostCenterTotalDataTable();
|
|
|
|
if (dsPF.Tables.Count > 0)
|
|
{
|
|
foreach (DataRow orr in dsPF.Tables[0].Rows)
|
|
{
|
|
oDR = dtMonthlyPF.NewRow();
|
|
|
|
oDR["EmployeeNo"] = orr["EmployeeNo"].ToString();
|
|
oDR["Name"] = orr["Name"].ToString();
|
|
DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
|
|
oDR["Doj"] = dtJoin.ToString("dd MMM yyyy");
|
|
oDR["Designation"] = orr["Designation"].ToString();
|
|
oDR["Department"] = orr["Department"].ToString();
|
|
oDR["CostCenter"] = orr["CostCenter"].ToString();
|
|
oDR["CPF"] = Convert.ToDouble(orr["CPF"].ToString());
|
|
oDR["EPF"] = Convert.ToDouble(orr["EPF"].ToString());
|
|
oDR["Location"] = orr["Location"].ToString();
|
|
sLocation = orr["Location"].ToString();
|
|
oDR["CRGID"] = orr["CRGID"].ToString();
|
|
|
|
if (Convert.ToDouble(orr["EPF"].ToString()) == 0 && Convert.ToDouble(orr["CPF"].ToString()) == 0)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
dtMonthlyPF.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow orr in dsPF.Tables[1].Rows)
|
|
{
|
|
oDR = dtMonthlyPF.NewRow();
|
|
|
|
oDR["EmployeeNo"] = orr["EmployeeNo"].ToString();
|
|
oDR["Name"] = orr["Name"].ToString();
|
|
DateTime dtJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
|
|
oDR["Doj"] = dtJoin.ToString("dd MMM yyyy");
|
|
oDR["Designation"] = orr["Designation"].ToString();
|
|
oDR["Department"] = orr["Department"].ToString();
|
|
oDR["CostCenter"] = orr["CostCenter"].ToString();
|
|
oDR["TotalGross"] = Convert.ToDouble(orr["TotalGross"].ToString());
|
|
oDR["CPF"] = Convert.ToDouble(orr["CPF"].ToString());
|
|
oDR["EPF"] = Convert.ToDouble(orr["EPF"].ToString());
|
|
oDR["Location"] = orr["Location"].ToString();
|
|
sLocation = orr["Location"].ToString();
|
|
oDR["CRGID"] = orr["CRGID"].ToString();
|
|
|
|
if (Convert.ToDouble(orr["EPF"].ToString()) == 0 && Convert.ToDouble(orr["CPF"].ToString()) == 0)
|
|
{
|
|
continue;
|
|
}
|
|
|
|
dtMonthlyPF.Rows.Add(oDR);
|
|
}
|
|
|
|
DataView dv = dtMonthlyPF.DefaultView;
|
|
dv.Sort = "CRGID";
|
|
dtCRG1 = dv.ToTable();
|
|
|
|
foreach (DataRow drr in dtCRG1.Rows)
|
|
{
|
|
if (crgID != Convert.ToInt32(drr["CRGID"]))
|
|
{
|
|
oDR = dtCRG.NewRow();
|
|
crgID = Convert.ToInt32(drr["CRGID"]);
|
|
double dTotalEpf = Convert.ToDouble(dtCRG1.AsEnumerable().Where(x => Convert.ToInt32(x["CRGID"]) == crgID).Sum(x => Convert.ToDouble(x["EPF"])));
|
|
double dTotalCPF = Convert.ToDouble(dtCRG1.AsEnumerable().Where(x => Convert.ToInt32(x["CRGID"]) == crgID).Sum(x => Convert.ToDouble(x["CPF"])));
|
|
|
|
oDR["CRGName"] = drr["CostCenter"].ToString();
|
|
oDR["TotalEPF"] = dTotalEpf;
|
|
oDR["TotalCPF"] = dTotalCPF;
|
|
oDR["TotalEPFCPF"] = dTotalEpf + dTotalCPF;
|
|
dtCRG.Rows.Add(oDR);
|
|
}
|
|
}
|
|
}
|
|
return reportProcessor.ShowMonthlyPFReport(GlobalFunctions.LastDateOfMonth(pfMonth), dtMonthlyPF, dtCRG, sLocation, reportType, payrollTypeId);
|
|
}
|
|
public byte[] CCWiseSalarySummary(int payrollTypeId, string reportType, bool nonexpat, DateTime salaryMonth)
|
|
{
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
DataRow dr = null;
|
|
PayrollDataSet.dsEmpLeaveLedger.CCWiseSalarySummaryDataTable mulLeaveBalance = new HRM.Report.PayrollDataSet.dsEmpLeaveLedger.CCWiseSalarySummaryDataTable();
|
|
DataTable dt = null;
|
|
string rdlc = string.Empty;
|
|
if (nonexpat)
|
|
{
|
|
dt = new LeaveEncashmentService().GetSalaryData(GlobalFunctions.LastDateOfMonth(salaryMonth));
|
|
foreach (DataRow dr1 in dt.Rows)
|
|
{
|
|
dr = mulLeaveBalance.NewRow();
|
|
dr["Name"] = dr1[1].ToString();
|
|
dr["Gross"] = Convert.ToDouble(dr1[2].ToString());
|
|
dr["PF"] = Convert.ToDouble(dr1[3].ToString());
|
|
dr["PFLoan"] = Convert.ToDouble(dr1[4].ToString());
|
|
dr["PFLoaninterest"] = Convert.ToDouble(dr1[5].ToString());
|
|
dr["Deduction"] = Convert.ToDouble(dr1[5].ToString()) + Convert.ToDouble(dr1[3].ToString()) + Convert.ToDouble(dr1[4].ToString());
|
|
dr["NetPay"] = Convert.ToDouble(dr1[6].ToString());
|
|
dr["HR"] = Convert.ToDouble(dr1[7].ToString());
|
|
dr["Convence"] = Convert.ToDouble(dr1[8].ToString());
|
|
dr["Medical"] = Convert.ToDouble(dr1[9].ToString());
|
|
dr["Basic"] = Convert.ToDouble(dr1[10].ToString());
|
|
mulLeaveBalance.Rows.Add(dr);
|
|
}
|
|
rdlc = "HRM.Report.RDLC.rptCCWiseSalarySummary.rdlc";
|
|
}
|
|
else
|
|
{
|
|
dt = new LeaveEncashmentService().GetSalaryDataExpat(GlobalFunctions.LastDateOfMonth(salaryMonth));
|
|
foreach (DataRow dr1 in dt.Rows)
|
|
{
|
|
dr = mulLeaveBalance.NewRow();
|
|
|
|
dr["Name"] = dr1["CostCenter"].ToString();
|
|
dr["Basic"] = Convert.ToDouble(dr1["Basic"].ToString());
|
|
dr["MonthlyLocationAllowanceEURO"] = Convert.ToDouble(dr1["MonthlyLocationAllowanceEURO"].ToString());
|
|
dr["ActualGross"] = Convert.ToDouble(dr1["ActualGross"].ToString());
|
|
dr["Gross"] = Convert.ToDouble(dr1["TotalGross"].ToString());
|
|
dr["ChildDeductionEURO"] = Convert.ToDouble(dr1["ChildDeductionEURO"].ToString());
|
|
dr["HousingDeductionEURO"] = Convert.ToDouble(dr1["HousingDeductionEURO"].ToString());
|
|
dr["Deduction"] = Convert.ToDouble(dr1["TotalDeduction"].ToString());
|
|
dr["NetPay"] = Convert.ToDouble(dr1["NetPay"].ToString());
|
|
mulLeaveBalance.Rows.Add(dr);
|
|
}
|
|
rdlc = "HRM.Report.RDLC.rptCCWiseSalarySummaryExpat.rdlc";
|
|
}
|
|
|
|
DataSet dSet = new DataSet();
|
|
mulLeaveBalance.TableName = "dsEmpLeaveLedger_CCWiseSalarySummary";
|
|
dSet.Tables.Add(mulLeaveBalance);
|
|
|
|
return reportProcessor.ShowEmpLeaveEncashBalance(null, dSet, rdlc,reportType,payrollTypeId);
|
|
}
|
|
public byte[] OpiBankDisbursementHnm(int payrollTypeId, DateTime SalaryMonth, string sEmpID, int BankId, string reportType)
|
|
{
|
|
int count = 1;
|
|
DataRow oDR = null;
|
|
Bank oBank;
|
|
|
|
DataSet oEmpBankAcc = new EmployeeBankAccountService().GetHNMOPIEmpBankAdvice(PayrollGlobalFunctions.PayrollLastDateOfMonth(SalaryMonth), sEmpID);
|
|
|
|
PayrollDataSet.PayrollDataSet.BankAdviceHNMDataTable bankAdvice = new PayrollDataSet.PayrollDataSet.BankAdviceHNMDataTable();
|
|
PayrollDataSet.PayrollDataSet.BankAdviceLetterDataTable bankAdviceLetter = new PayrollDataSet.PayrollDataSet.BankAdviceLetterDataTable();
|
|
foreach (DataRow oDRow in oEmpBankAcc.Tables[0].Rows)
|
|
{
|
|
//DataRow[] oEmpExpAmount = oEmpExpenseAmount.Tables[0].Select("EmployeeNo='" + oDRow["EMPLOYEENO"].ToString() + "'");
|
|
oDR = bankAdvice.NewRow();
|
|
oDR["EmpNo"] = oDRow["EMPLOYEENO"];
|
|
oDR["EmpName"] = oDRow["NAME"];
|
|
oDR["AccountNo"] = oDRow["ACCOUNTNO"];
|
|
oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["Amount"]));
|
|
oDR["CostCenter"] = oDRow["CostCenter"];
|
|
////}
|
|
//oDR["Email"] = oDRow["EMAILADDRESS"];
|
|
oDR["SalaryMonth"] = SalaryMonth;
|
|
oDR["SLNo"] = count;
|
|
bankAdvice.Rows.Add(oDR);
|
|
//nTotal += Convert.ToDouble(oDR["Amount"]);
|
|
count++;
|
|
}
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "OPIBankDisbursement.rdlc";
|
|
DataSet dSet = new DataSet();
|
|
bankAdvice.TableName = "PayrollDataSet_BankAdvice";
|
|
dSet.Tables.Add(bankAdvice);
|
|
|
|
return reportProcessor.CommonReportViewForReports(null, dSet, null, rdlcName, null, true, payrollTypeId, reportType); ;
|
|
}
|
|
public byte[] CostCenterWiseOpi(string reportType, DateTime fromDate, int opiItemCode, int payrollTypeID)
|
|
{
|
|
DataSet _dsCCWiseOPISummary = new DataSet();
|
|
DataSet _dsCCWiseOPI = new DataSet();
|
|
List<OpiItem> _deductions = new List<OpiItem>();
|
|
|
|
|
|
_dsCCWiseOPISummary = new SalaryMonthlyService().GetCCWiseOPISummary(PayrollGlobalFunctions.PayrollLastDateOfMonth(fromDate), opiItemCode);
|
|
_dsCCWiseOPISummary.Tables[0].Columns.Add("month", typeof(string));
|
|
foreach (DataRow row in _dsCCWiseOPISummary.Tables[0].Rows)
|
|
{
|
|
row["month"] = fromDate.ToString("MMMM yyyy");
|
|
}
|
|
_dsCCWiseOPI = new SalaryMonthlyService().GetCCWiseOPI(PayrollGlobalFunctions.PayrollLastDateOfMonth(fromDate), opiItemCode);
|
|
_dsCCWiseOPI.Tables[0].Columns.Add("month", typeof(string));
|
|
|
|
foreach (DataRow row in _dsCCWiseOPI.Tables[0].Rows)
|
|
{
|
|
row["month"] = fromDate.ToString("MMMM yyyy");
|
|
}
|
|
DataSet dSet = new DataSet();
|
|
_dsCCWiseOPISummary.Tables[0].TableName = "dsCompany_CCWiseDeductSummary";
|
|
dSet.Tables.Add(_dsCCWiseOPISummary.Tables[0].Copy());
|
|
_dsCCWiseOPI.Tables[0].TableName = "dsCompany_CCWiseDeduction";
|
|
dSet.Tables.Add(_dsCCWiseOPI.Tables[0].Copy());
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
|
|
string rdlcName = "CCWiseOPISummary.rdlc";
|
|
return reportProcessor.CommonReportViewForReports(null, dSet, null, rdlcName, null, true, payrollTypeID, reportType);
|
|
}
|
|
public byte[] CostCenterWiseBonusSummary(string reportType, DateTime fromDate, string bonusTypeName, int payrollTypeID)
|
|
{
|
|
DataSet _dsCCWiseBonusSummary = new DataSet();
|
|
DataSet _dsCCWiseBonus = new DataSet();
|
|
_dsCCWiseBonusSummary = new BonusService().GetCCWiseBonusSummary(GlobalFunctions.LastDateOfMonth(fromDate), bonusTypeName);
|
|
_dsCCWiseBonusSummary.Tables[0].Columns.Add("month", typeof(string));
|
|
foreach (DataRow row in _dsCCWiseBonusSummary.Tables[0].Rows)
|
|
{
|
|
row["month"] = fromDate.ToString("MMMM yyyy");
|
|
}
|
|
|
|
_dsCCWiseBonus = new BonusService().GetCCWiseBonus(GlobalFunctions.LastDateOfMonth(fromDate), bonusTypeName);
|
|
_dsCCWiseBonus.Tables[0].Columns.Add("month", typeof(string));
|
|
foreach (DataRow row in _dsCCWiseBonus.Tables[0].Rows)
|
|
{
|
|
row["month"] = fromDate.ToString("MMMM yyyy");
|
|
}
|
|
|
|
DataSet dSet = new DataSet();
|
|
_dsCCWiseBonusSummary.Tables[0].TableName = "dsCompany_CCWiseBonusSummary";
|
|
dSet.Tables.Add(_dsCCWiseBonusSummary.Tables[0].Copy());
|
|
|
|
_dsCCWiseBonus.Tables[0].TableName = "dsCompany_CCWiseBonus";
|
|
dSet.Tables.Add(_dsCCWiseBonus.Tables[0].Copy());
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
string rdlcName = "CCWiseBonusSummary.rdlc";
|
|
return reportProcessor.CommonReportViewForReports(null, dSet, null, rdlcName, null, true, payrollTypeID, reportType);
|
|
}
|
|
public byte[] OpiRegisterForTotalValue(int payrollTypeID, DateTime fromDate, DateTime toDate, string sEmpIDs, int itemId, string reportType)
|
|
{
|
|
int count = 1;
|
|
DataRow oDR = null;
|
|
DataSet oOPIRegister = null;
|
|
|
|
oOPIRegister = new OPIProcessService().GetOPITotalValueRegister(PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromDate), PayrollGlobalFunctions.PayrollLastDateOfMonth(toDate), itemId, sEmpIDs) ;
|
|
PayrollDataSet.PayrollDataSet.OPITotalValueRegisterDataTable ddOPIRegData = new PayrollDataSet.PayrollDataSet.OPITotalValueRegisterDataTable();
|
|
foreach (DataRow oDRow in oOPIRegister.Tables[0].Rows)
|
|
{
|
|
oDR = ddOPIRegData.NewRow();
|
|
oDR["OPIMonth"] = Convert.ToDateTime(oDRow["OPIMonth"]).ToString("MMM yyyy");
|
|
oDR["EmployeeId"] = oDRow["EmployeeId"];
|
|
oDR["EmployeeNo"] = oDRow["EmployeeNo"];
|
|
oDR["EmpName"] = oDRow["EmpName"];
|
|
oDR["Amount"] = (GlobalFunctions.Round(Convert.ToDouble(oDRow["Amount"]))).ToString();
|
|
oDR["SLNo"] = count;
|
|
ddOPIRegData.Rows.Add(oDR);
|
|
count++;
|
|
}
|
|
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
|
|
|
|
return reportProcessor.ShowDlgForOPITotalValueRegister(reportType, ddOPIRegData, PayrollGlobalFunctions.PayrollFirstDateOfMonth(fromDate), PayrollGlobalFunctions.PayrollLastDateOfMonth(toDate), payrollTypeID, itemId);
|
|
|
|
}
|
|
double balance = 0.00;
|
|
public byte[] GetPFLedger(int sEmpID, string reportType, DateTime FromDate, DateTime toDate, int payrollTypeID)
|
|
{
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
|
|
DataRow oDR = null;
|
|
DataSet oPFLedger = null;
|
|
double opening = 0.00;
|
|
|
|
Employee employee = new EmployeeService().Get(sEmpID);
|
|
oPFLedger = new EmployeeService().GetPFLedger(sEmpID.ToString(), FromDate, toDate);
|
|
PayrollDataSet.PayrollDataSet.PFLedgerDataTable dTPFLedger = new PayrollDataSet.PayrollDataSet.PFLedgerDataTable();
|
|
|
|
foreach (DataRow source in oPFLedger.Tables[0].Rows)
|
|
{
|
|
oDR = dTPFLedger.NewRow();
|
|
oDR["Description"] = source["Description"];
|
|
oDR["OpeningBalance"] = source["PFAmount"];
|
|
opening = Convert.ToDouble(oDR["OpeningBalance"]);
|
|
balance = Convert.ToDouble(oDR["OpeningBalance"]) + Convert.ToDouble(oDR["OpeningBalance"]);
|
|
oDR["TotalBalance"] = balance;
|
|
source["PFAmount"] = source["PFAmount"];
|
|
source["CPFAmount"] = source["CPFAmount"];
|
|
dTPFLedger.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oPFLedger.Tables[1].Rows)
|
|
{
|
|
oDR = dTPFLedger.NewRow();
|
|
this.CopyInd(oDR, source);
|
|
dTPFLedger.Rows.Add(oDR);
|
|
}
|
|
dTPFLedger.Rows.RemoveAt(0);
|
|
return reportProcessor.ShowPFLedger(dTPFLedger, reportType, sEmpID.ToString(), FromDate, toDate, employee.Name, employee.EmployeeNo, opening, payrollTypeID);
|
|
|
|
}
|
|
public void CopyInd(DataRow source, DataRow destination)
|
|
{
|
|
DateTime date = Convert.ToDateTime(destination["Description"]);
|
|
source["Description"] = date.ToString("MMMM,yyyy");
|
|
source["PFAmount"] = destination["PFAmount"];
|
|
source["CPFAmount"] = destination["CPFAmount"];
|
|
balance = balance + Convert.ToDouble(source["PFAmount"]) + Convert.ToDouble(source["CPFAmount"]);
|
|
source["TotalBalance"] = balance;
|
|
}
|
|
|
|
public byte[] getPFExceptionReport(string sEmpID, string reportType, int payrollTypeID)
|
|
{
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
//ObjectsTemplate<PFException> pfExceptions = new ObjectsTemplate<PFException>();
|
|
DataTable dtCRG1 = new DataTable();
|
|
DataSet ds = new DataSet();
|
|
int crgID = 0;
|
|
DataRow oDR = null;
|
|
// pfExceptions = PFException.Get();
|
|
List<PFException> _pfExceptions = new List<PFException>();
|
|
_pfExceptions = new PFExceptionService().Get();
|
|
ds = new MiscellaneousDatasetService().GetEmpCostCenter(sEmpID);
|
|
List<Designation> designations = new DesignationService().GetAll();
|
|
List<Department> departments = new DepartmentService().GetAll();
|
|
List<Employee> oEmployees = new EmployeeService().GetAllEmps();
|
|
HRM.Report.PayrollDataSet.dsCompany.DTMonthlyPFDataTable dtMonthlyPF = new HRM.Report.PayrollDataSet.dsCompany.DTMonthlyPFDataTable();
|
|
HRM.Report.PayrollDataSet.dsCompany.DtCostCenterTotalDataTable dtCRG = new HRM.Report.PayrollDataSet.dsCompany.DtCostCenterTotalDataTable();
|
|
|
|
for (int i = 0; i < _pfExceptions.Count; i++)
|
|
{
|
|
Employee oEmp = oEmployees.FirstOrDefault(x => x.ID == _pfExceptions[i].EmployeeID);
|
|
oDR = dtMonthlyPF.NewRow();
|
|
|
|
oDR["EmployeeNo"] = oEmp.EmployeeNo;
|
|
oDR["Name"] = oEmp.Name;
|
|
oDR["Doj"] = oEmp.JoiningDate.ToString("dd.MM.yyyy");
|
|
oDR["Designation"] = designations.Find(x => x.ID == oEmp.DesignationID).Name;
|
|
oDR["Department"] = departments.Find(x => x.ID == oEmp.DepartmentID).Name;
|
|
oDR["EPF"] = _pfExceptions[i].EPFAmount + _pfExceptions[i].CPFAmount;
|
|
oDR["CRGID"] = ds.Tables[0].AsEnumerable().Where(x => Convert.ToInt32(x["EMPLOYEEID"]) == oEmp.ID).Select(x => Convert.ToInt32(x["CRGID"])).FirstOrDefault();
|
|
oDR["CostCenter"] = ds.Tables[0].AsEnumerable().Where(x => Convert.ToInt32(x["EMPLOYEEID"]) == oEmp.ID).Select(x => Convert.ToString(x["CostCenter"])).FirstOrDefault();
|
|
dtMonthlyPF.Rows.Add(oDR);
|
|
}
|
|
|
|
DataView dv = dtMonthlyPF.DefaultView;
|
|
dv.Sort = "CRGID";
|
|
dtCRG1 = dv.ToTable();
|
|
|
|
foreach (DataRow drr in dtCRG1.Rows)
|
|
{
|
|
if (crgID != Convert.ToInt32(drr["CRGID"]))
|
|
{
|
|
oDR = dtCRG.NewRow();
|
|
crgID = Convert.ToInt32(drr["CRGID"]);
|
|
double dTotalEpf = Convert.ToDouble(dtCRG1.AsEnumerable().Where(x => Convert.ToInt32(x["CRGID"]) == crgID).Sum(x => Convert.ToDouble(x["EPF"])));
|
|
oDR["CRGName"] = drr["CostCenter"].ToString();
|
|
oDR["TotalEPF"] = dTotalEpf;
|
|
|
|
dtCRG.Rows.Add(oDR);
|
|
}
|
|
}
|
|
|
|
return reportProcessor.ShowPFExceptionReport(reportType, dtMonthlyPF, dtCRG, payrollTypeID);
|
|
}
|
|
|
|
public byte[] ShowSalarySheetReportByCC( int PayrollTypeID, DateTime fromDate, string sEmpIDs, string reportType, int nReportID)
|
|
{
|
|
ReportProcessor reportProcessor = new ReportProcessor();
|
|
_SalaryMonth = GlobalFunctions.LastDateOfMonth(fromDate);
|
|
//ID nReportID = _selectedParameter.ReportItem.ReportID;
|
|
//string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
|
|
oSalarySheets = new SalaryMonthlyService().GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(fromDate), sEmpIDs);
|
|
PayrollDataSet.PayrollDataSet.CCWiseSalarySheetNewDataTable dTSalarySheet = new HRM.Report.PayrollDataSet.PayrollDataSet.CCWiseSalarySheetNewDataTable();
|
|
|
|
List<string> components = new List<string>() { "Basic", "Allowance", "Deduction" };
|
|
List<string> basics = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -101).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
List<string> deductions = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 3).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
//string sIncome = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 5 && x.Field<Int32>("ItemCode") != -132).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).FirstOrDefault();
|
|
//List<string> deductions = new List<string>();
|
|
//deductions.Add(sIncome);
|
|
//deductions.AddRange(oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 3).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList());//&& x.Field<Int32>("ItemCode") != -118
|
|
|
|
oSalarySheets.Tables[0].Columns.Add("SequenceNo");
|
|
oSalarySheets.Tables[1].Columns.Add("SequenceNo");
|
|
oSalarySheets.Tables[2].Columns.Add("SequenceNo");
|
|
oSalarySheets.Tables[3].Columns.Add("SequenceNo");
|
|
oSalarySheets.Tables[4].Columns.Add("SequenceNo");
|
|
oSalarySheets.Tables[5].Columns.Add("SequenceNo");
|
|
oSalarySheets.Tables[6].Columns.Add("SequenceNo");
|
|
oSalarySheets.Tables[7].Columns.Add("SequenceNo");
|
|
oSalarySheets.Tables[8].Columns.Add("SequenceNo");
|
|
int seq = 0;
|
|
foreach (string comp in components)
|
|
{
|
|
switch (comp)
|
|
{
|
|
case "Basic":
|
|
foreach (string id in basics)
|
|
{
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -101 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 8 && x.Field<Int32>("ItemCode") == -101 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
}
|
|
|
|
break;
|
|
case "Allowance":
|
|
|
|
foreach (string allwid in allowances)
|
|
{
|
|
seq++;
|
|
// dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
|
|
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID").ToString() == allwid))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 8 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID").ToString() == allwid))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave) && x.Field<string>("Description") == "Unauthorized Leave"))
|
|
{
|
|
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["ActualGross"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["TotalGross"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
break;
|
|
case "Deduction":
|
|
|
|
foreach (string id in deductions)
|
|
{
|
|
//seq++;
|
|
//foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 5 && x.Field<Int32>("ItemCode") == -129 && x.Field<Int32>("ItemID").ToString() == id))
|
|
//{
|
|
// dr["SequenceNo"] = seq;
|
|
//}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -128 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 2))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -118 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -119 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -115 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
}
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["TotalDeduction"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["NetPay"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["CPF"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
break;
|
|
|
|
default:
|
|
break;
|
|
}
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
foreach (DataRow source in oSalarySheets.Tables["ActualGross"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
//foreach (DataRow source in oSalarySheets.Tables["AttendenceDays"].Rows)
|
|
//{
|
|
// oDR = dTSalarySheet.NewRow();
|
|
// this.Copy(oDR, source);
|
|
// dTSalarySheet.Rows.Add(oDR);
|
|
//}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyDeduct(oDR, source, oSalarySheets.Tables["DeductItem"]);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["CPF"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
|
|
DataTable dtt = dTSalarySheet.Copy();
|
|
DataView dv = dtt.DefaultView;
|
|
dv.Sort = "SequenceNo";
|
|
dtt = dv.ToTable();
|
|
dTSalarySheet = new HRM.Report.PayrollDataSet.PayrollDataSet.CCWiseSalarySheetNewDataTable();
|
|
dTSalarySheet.Merge(dtt);
|
|
|
|
return reportProcessor.ShowDlgForSalarySheetNew(reportType, dTSalarySheet, nReportID, PayrollTypeID);
|
|
}
|
|
private void Copy(DataRow source, DataRow destination)
|
|
{
|
|
if (tempEmpID == string.Empty)
|
|
{
|
|
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
|
|
source["SLNo"] = destination["sequenceno"];
|
|
count++;
|
|
}
|
|
if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
|
|
{
|
|
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
|
|
source["SLNo"] = destination["sequenceno"];
|
|
count++;
|
|
}
|
|
source["RowSequence"] = Convert.ToInt32(destination["sequenceno"]);
|
|
source["EmpNo"] = destination["EMPLOYEENO"];
|
|
source["EmpName"] = destination["Name"];
|
|
source["Department"] = destination["Department"];
|
|
source["Designation"] = destination["DESIGNATION"];
|
|
source["CCDes"] = destination["COSTCENTER"];
|
|
source["Grade"] = destination["GName"];
|
|
//source["Department"] = destination["DName"];
|
|
source["Description"] = destination["Description"];
|
|
source["Amount"] = destination["Amount"];
|
|
source["SalaryMonth"] = _SalaryMonth;
|
|
source["JoiningDate"] = destination["JoiningDate"];
|
|
source["SequenceNo"] = Convert.ToInt32(destination["SequenceNo"]);
|
|
//source["SLNo"] = destination["EMPLOYEEID"];
|
|
}
|
|
private void CopyDeduct(DataRow source, DataRow destination, DataTable oDt)
|
|
{
|
|
if (tempEmpID == string.Empty)
|
|
{
|
|
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
|
|
source["SLNo"] = count;
|
|
count++;
|
|
}
|
|
if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
|
|
{
|
|
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
|
|
source["SLNo"] = count;
|
|
count++;
|
|
}
|
|
source["RowSequence"] = Convert.ToInt32(destination["sequenceno"]);
|
|
//source["SLNo"] = destination["sequenceno"];
|
|
// double nCurrLoanInterstAmount = 0;
|
|
//if (Convert.ToInt16(destination["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment)
|
|
//{
|
|
// DataRow[] odrosAmount = oDt.Select(" ItemCode='" + (int)EnumSalaryItemCode.Loan_Monthly_Interest + "' AND EMPLOYEENO='" + destination["EMPLOYEENO"].ToString() + "'" + " AND ItemID='" + Convert.ToInt16(destination["ItemID"]) + "'");
|
|
// source["EmpNo"] = destination["EMPLOYEENO"];
|
|
// source["Grade"] = destination["GName"];
|
|
// source["EmpName"] = destination["Name"];
|
|
// source["Grade"] = destination["GName"];
|
|
// source["Department"] = destination["DName"];
|
|
// source["Description"] = destination["Description"];
|
|
|
|
// if (odrosAmount.Length > 0)
|
|
// {
|
|
// nCurrLoanInterstAmount = 0;
|
|
// DataRow oRowLoanInterest = odrosAmount[0];
|
|
// nCurrLoanInterstAmount = Convert.ToDouble(oRowLoanInterest["Amount"]);
|
|
// }
|
|
|
|
// source["Amount"] = Convert.ToDouble(destination["Amount"]) + nCurrLoanInterstAmount;
|
|
// source["SalaryMonth"] = _SalaryMonth;
|
|
// source["JoiningDate"] = destination["JoiningDate"];
|
|
//}
|
|
//else
|
|
//{
|
|
source["EmpNo"] = destination["EMPLOYEENO"];
|
|
source["Grade"] = destination["GName"];
|
|
source["EmpName"] = destination["Name"];
|
|
source["Department"] = destination["Department"];
|
|
source["Designation"] = destination["DESIGNATION"];
|
|
source["CCDes"] = destination["COSTCENTER"];
|
|
source["Grade"] = destination["GName"];
|
|
//source["Department"] = destination["DName"];
|
|
source["Description"] = destination["Description"];
|
|
source["Amount"] = destination["Amount"];
|
|
source["SalaryMonth"] = _SalaryMonth;
|
|
source["JoiningDate"] = destination["JoiningDate"];
|
|
source["SequenceNo"] = Convert.ToInt32(destination["SequenceNo"]);
|
|
//source["SLNo"] = destination["EMPLOYEEID"];
|
|
//}
|
|
}
|
|
|
|
|
|
}
|
|
}
|