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

9326 lines
478 KiB
C#

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using Payroll.BO;
using Ease.CoreV35;
using Ease.Core.Model;
using Ease.Core.Utility;
using System.Windows.Forms;
using HRM.BO;
using HRM.DA;
using System.IO;
using Microsoft.Reporting.NETCore;
using Org.BouncyCastle.Ocsp;
namespace HRM.Report
{
public class rptSalarySheet
{
private DateTime _SalaryMonth;
string tempEmpID = string.Empty;
private int TotalEmp = 0;
int count = 1;
DataTable dtNetPay = new DataTable();
private PayrollDataSet.PayrollDataSet.SalaryReconNewDataTable _salaryReconNew;
private PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable _salaryReconGross;
private PayrollDataSet.PayrollDataSet.SalaryReconDeductionDataTable _salaryReconDecuction;
List<EmployeeCostCenter> _empCostCenters = null;
List<Costcenter> _costCenters = null;
List<Employee> _employees = null;
ReportParameter rParam = null;
private List<ReportParameter> reportParameters = new List<ReportParameter>();
#region CashRegisterReport
public byte[] ShowCashRegisterReport(DateTime salaryMonth, string empIds, int payrollTypeId, string reportType)
{
int count = 1;
DataRow oDR = null;
EmployeeBankAccountService employeeBankAccountService = new EmployeeBankAccountService();
DataSet oEmpBankAcc = employeeBankAccountService.GetEmpCashAdvice(salaryMonth, empIds);
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"];
//oDR["Amount"] = Math.Round(Convert.ToDouble(oDRow["CHANGEDAMOUNT"]));
oDR["Amount"] = GlobalFunctions.TakaFormat(Convert.ToDouble(oDRow["CHANGEDAMOUNT"]));
oDR["Email"] = oDRow["EMAILADDRESS"];
oDR["SalaryMonth"] = salaryMonth;
oDR["SLNo"] = count;
bankAdvice.Rows.Add(oDR);
nTotal += Convert.ToDouble(oDR["Amount"]);
count++;
}
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowCashAdviceReport(null, bankAdvice, payrollTypeId, reportType);
}
#endregion
#region ReportForManagement
public byte[] ShowreportForManagement(DateTime fromDate, string sEmpID, int payrollTypeID, string reportType)
{
//if (payrollTypeID == 1)
//{
return ShowReportWithArreaForManagement(fromDate, sEmpID, payrollTypeID, reportType);
//}
//else
//{
// return ShowReportWithArrearForNonManagement(fromDate, sEmpID, payrollTypeID);
//}
}
public byte[] ShowReportWithArreaForManagement(DateTime fromDate, string sEmpID, int payrollTypeId, string reportType)
{
_costCenters = new CostcenterService().Get();
_empCostCenters = new EmployeeCostCenterService().Get();
_employees = new EmployeeService().Get();
_SalaryMonth = fromDate;
DataRow oDR = null;
DataSet oSalarySheets = null;
List<SalaryMonthly> sMonthly = new SalaryMonthlyService().Get(sEmpID, _SalaryMonth, payrollTypeId);
oSalarySheets = new SalaryMonthlyService().GetEmpSalarySheetForManagement(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -113).GroupBy(y => Convert.ToDouble(y["ItemID"].ToString())).Select(o => o.Key.ToString()).ToList();
List<string> OTs = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -103).GroupBy(y => Convert.ToDouble(y["ItemID"].ToString())).Select(o => o.Key.ToString()).ToList();
List<string> deductions = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDouble(x["ItemCode"].ToString()) != -118).GroupBy(y => Convert.ToDouble(y["ItemID"].ToString())).Select(o => o.Key.ToString()).ToList();
List<string> Loans = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDouble(x["ItemCode"].ToString()) == -118).GroupBy(y => Convert.ToDouble(y["ItemID"].ToString())).Select(o => o.Key.ToString()).ToList();
oSalarySheets.Tables["TotalGross"].Columns.Add("SequenceNo");
oSalarySheets.Tables["TotalDeduction"].Columns.Add("SequenceNo");
//oSalarySheets.Tables["NetPay"].Columns.Add("SequenceNo");
int seq = 1;
foreach (string comp in components)
{
switch (comp)
{
case "Basic":
//dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -101);
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 4 && Convert.ToDouble(x["ItemCode"].ToString()) == -101 && Convert.ToDouble(x["ItemID"].ToString()) == -101))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -101 && Convert.ToDouble(x["ItemID"].ToString()) == -101))
{
dr["SequenceNo"] = seq;
}
seq++;
//dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 8 && Convert.ToDouble(x["ItemCode") == -101).CopyToDataTable();
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 8 && Convert.ToDouble(x["ItemCode"].ToString()) == -101 && Convert.ToDouble(x["ItemID"].ToString()) == -101))
{
dr["SequenceNo"] = seq;
}
break;
case "Allowance":
foreach (string allwid in allowances)
{
seq++;
// dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -113 && Convert.ToDouble(x["ItemID").ToString() == allwid).CopyToDataTable();
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -113 && Convert.ToDouble(x["ItemID"].ToString()).ToString() == allwid))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 8 && Convert.ToDouble(x["ItemCode"].ToString()) == -113 && Convert.ToDouble(x["ItemID"].ToString()).ToString() == allwid))
{
dr["SequenceNo"] = seq;
}
}
break;
case "OT":
foreach (string id in OTs)
{
// dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -113 && Convert.ToDouble(x["ItemID").ToString() == allwid).CopyToDataTable();
seq++;
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -103 && x["ItemID"].ToString() == id))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 8 && Convert.ToDouble(x["ItemCode"].ToString()) == -103 && x["ItemID"].ToString() == id))
{
dr["SequenceNo"] = seq;
}
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDecimal(x["ItemGroup"].ToString()) == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave)))
{
dr["SequenceNo"] = seq;
dr["DESCRIPTION"] = "Leave Adj.";
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["TotalGross"].Rows)
{
dr["SequenceNo"] = seq;
}
break;
case "Deduction":
foreach (string id in deductions)
{
// dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -113 && Convert.ToDouble(x["ItemID").ToString() == allwid).CopyToDataTable();
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDouble(x["ItemCode"].ToString()) != -118 && x["ItemID"].ToString() == id))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 8 && Convert.ToDouble(x["ItemCode"].ToString()) != -118 && x["ItemID"].ToString() == id))
{
dr["SequenceNo"] = seq;
}
}
break;
case "Loan":
foreach (string id in Loans)
{
// dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -113 && Convert.ToDouble(x["ItemID").ToString() == allwid).CopyToDataTable();
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDecimal(x["ItemCode"].ToString()) == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && x["ItemID"].ToString() == id))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDecimal(x["ItemCode"].ToString()) == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x["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;
}
break;
default:
break;
}
}
#region Loop Start
foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
#region Unused Code
//foreach (DataRow source in oSalarySheets.Tables["TotalAllowance"].Rows)
//{
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
//}
//foreach (DataRow source in oSalarySheets.Tables["TotalIncome"].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["LeaveDays"].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["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);
//}
#endregion
#endregion
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowDlgForSalarySheet(null, dTSalarySheet, 0, reportType, payrollTypeId);
//Pivot pvt = new Pivot(dTSalarySheet);
//DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
}
#endregion
#region ReportWithArrearForNonManagement
public byte[] ShowReportWithArrearForNonManagement(DateTime fromDate, string sEmpID, int payrollTypeId)
{
_SalaryMonth = fromDate;
int nReportID = 0;
DataRow oDR = null;
DataSet oSalarySheets = null;
List<SalaryMonthly> sMonthly = new SalaryMonthlyService().Get(sEmpID, _SalaryMonth, payrollTypeId);
oSalarySheets = new SalaryMonthlyService().GetEmpSalarySheetForNonManagement(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
List<string> OTs = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -103).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
List<string> deductions = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") != -118).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
List<string> Loans = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == -118).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
oSalarySheets.Tables["TotalGross"].Columns.Add("SequenceNo");
oSalarySheets.Tables["TotalDeduction"].Columns.Add("SequenceNo");
//oSalarySheets.Tables["NetPay"].Columns.Add("SequenceNo");
int seq = 1;
foreach (string comp in components)
{
switch (comp)
{
case "Basic":
//dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101);
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 4 && x.Field<decimal>("ItemCode") == -101))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101))
{
dr["SequenceNo"] = seq;
}
seq++;
//dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101).CopyToDataTable();
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101))
{
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<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid))
{
dr["SequenceNo"] = seq;
}
}
break;
case "OT":
foreach (string id in OTs)
{
// dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
seq++;
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -103 && x.Field<decimal>("ItemID").ToString() == id))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -103 && x.Field<decimal>("ItemID").ToString() == id))
{
dr["SequenceNo"] = seq;
}
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave)))
{
dr["SequenceNo"] = seq;
dr["Description"] = "Leave Adj.";
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["TotalGross"].Rows)
{
dr["SequenceNo"] = seq;
}
break;
case "Deduction":
foreach (string id in deductions)
{
// dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") != -118 && x.Field<decimal>("ItemID").ToString() == id))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") != -118 && x.Field<decimal>("ItemID").ToString() == id))
{
dr["SequenceNo"] = seq;
}
}
break;
case "Loan":
foreach (string id in Loans)
{
// dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && x.Field<decimal>("ItemID").ToString() == id))
{
dr["SequenceNo"] = seq;
}
seq++;
foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x.Field<decimal>("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;
}
break;
default:
break;
}
}
#region Loop Start
foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithArrear(oDR, source, payrollTypeId);
dTSalarySheet.Rows.Add(oDR);
}
#endregion
ReportProcessor reportProcessor = new ReportProcessor();
//dTSalarySheet = (Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable)(dTSalarySheet.AsEnumerable().OrderBy(x => x.Field<string>("EmpNo")).ThenBy(y => y.Field<int>("SequenceNo")).CopyToDataTable());
return reportProcessor.ShowDlgForSalarySheetNonMngt(null, dTSalarySheet, nReportID, payrollTypeId);
//Pivot pvt = new Pivot(dTSalarySheet);
//DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
}
#endregion
#region ReconciliationSummary
public byte[] SalaryReconciliationSummary(DateTime salaryMonth, DateTime salaryNextMonth, string sEmpID, int payrollTypeId, string reportType)
{
string[] sEmp = sEmpID.Split(new char[] { ',' });
int nTotalEmp = sEmp.Count();
// int nCount = 0;
double totCurrGr = 0;
double totPrevGR = 0;
string FirstMonth = salaryMonth.ToString("MMM yyyy");
string NextMonth = salaryNextMonth.ToString("MMM yyyy");
int SimilerEmp = 0;
int DisimilerEmp = 0;
#region GetTotalEmp
DateTime dtFirstDateSalaryMonth = GlobalFunctions.FirstDateOfMonth(salaryMonth);
DateTime dtLastDateSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth);
DateTime dtFirstDateSalaryNextMonth = GlobalFunctions.FirstDateOfMonth(salaryNextMonth);
DateTime dtLastDateSalaryNextMonth = GlobalFunctions.LastDateOfMonth(salaryNextMonth);
List<SalaryMonthly> oCurrMonthlies = new SalaryMonthlyService().GetByDateRange(dtFirstDateSalaryMonth, dtLastDateSalaryMonth, payrollTypeId);
List<SalaryMonthly> oNextMonthlies = new SalaryMonthlyService().GetByDateRange(dtFirstDateSalaryNextMonth, dtLastDateSalaryNextMonth, payrollTypeId);
// bool Check = true;
string countCurrMonth = salaryMonth.ToString("MMM") + " : " + Convert.ToString(oCurrMonthlies.Count.ToString());
string countNextMonth = salaryNextMonth.ToString("MMM") + " : " + oNextMonthlies.Count.ToString();
foreach (SalaryMonthly oMonth in oCurrMonthlies)
{
SalaryMonthly oMonthly = oNextMonthlies.Find(delegate (SalaryMonthly oM) { return oM.EmployeeID == oMonth.EmployeeID; });
if (oMonthly != null && oMonthly.ID != 0)
{
SimilerEmp++;
}
else
{
DisimilerEmp++;
}
}
foreach (SalaryMonthly oPMonth in oNextMonthlies)
{
SalaryMonthly oMonthly = oCurrMonthlies.Find(delegate (SalaryMonthly oM) { return oM.EmployeeID == oPMonth.EmployeeID; });
if (oMonthly != null && oMonthly.ID != 0)
{
}
else
{
DisimilerEmp++;
}
}
#endregion
//DataRow oRow = null;
DataSet oSalaryMonthlys = new SalaryMonthlyService().GetEmpSalaryReconciliationSummary(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
DataSet oSalaryNextMonthlys = new SalaryMonthlyService().GetEmpSalaryReconciliationSummary(GlobalFunctions.LastDateOfMonth(salaryNextMonth), sEmpID);
PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable dTCSalarySheet = new PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable dTPSalarySheet = new PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
_salaryReconGross = new PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
//_salaryReconGrosstemp = new PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
_salaryReconDecuction = new PayrollDataSet.PayrollDataSet.SalaryReconDeductionDataTable();
foreach (DataRow source in oSalaryNextMonthlys.Tables[0].Rows)
this.CopyGross(source, false);
foreach (DataRow source in oSalaryMonthlys.Tables[0].Rows)
this.CopyGross(source, true);
//DataRow oDRow = null;
int countGR = 0;
foreach (DataRow DR in _salaryReconGross.Rows)
{
if (DR["CurrAmount"].ToString() != "")
{
totCurrGr = totCurrGr + Convert.ToDouble(DR["CurrAmount"]);
}
if (DR["PrevAmount"].ToString() != "")
{
totPrevGR = totPrevGR + Convert.ToDouble(DR["PrevAmount"]);
}
countGR++;
}
//if (countGR == _salaryRecon.Rows.Count)
//{
// oDRow = _salaryRecon.NewRow();
// oDRow["Description"] = "Total Gross ";
// oDRow["CurrAmount"] = totCurrGr;
// oDRow["PrevAmount"] = totPrevGR;
// _salaryRecon.Rows.Add(oDRow);
//}
//DataView dv = new DataView(_salaryReconGross);
//dv.Sort=""
//_salaryReconGrosstemp = _salaryReconGross.OrderBy(x=>x)
foreach (DataRow source in oSalaryNextMonthlys.Tables[1].Rows)
this.CopyDeduction(source, false);
foreach (DataRow source in oSalaryMonthlys.Tables[1].Rows)
this.CopyDeduction(source, true);
// DataRow oDR = null;
double totCurrDe = 0;
double totPrevDe = 0;
int count = 0;
foreach (DataRow DR in _salaryReconDecuction.Rows)
{
//oDR = _salaryRecon.NewRow();
//oDR["Description"] = DR["Description"];
//oDR["CurrAmount"] = DR["CurrAmount"];
if (DR["CurrAmount"].ToString() != "")
{
totCurrDe = totCurrDe + Convert.ToDouble(DR["CurrAmount"]);
}
//oDR["PrevAmount"] = DR["PrevAmount"];
if (DR["PrevAmount"].ToString() != "")
{
totPrevDe = totPrevDe + Convert.ToDouble(DR["PrevAmount"]);
}
//_salaryRecon.Rows.Add(oDR);
count++;
if (count == _salaryReconDecuction.Rows.Count)
{
//oDR = _salaryRecon.NewRow();
//oDR["Description"] = "Total Deduction";
//oDR["CurrAmount"] = totCurrDe;
//oDR["PrevAmount"] = totPrevDe;
//_salaryRecon.Rows.Add(oDR);
//oDR = _salaryReconDecuction.NewRow();
//oDR["Description"] = "Net Pay ";
DR["NetAmountCurr"] = totCurrGr - totCurrDe;
DR["NetAmountPrev"] = totPrevGR - totPrevDe;
//_salaryReconDecuction.Rows.Add(oDR);
}
}
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowDlgForSalaryReconcilSummary(null, _salaryReconGross, _salaryReconDecuction, FirstMonth, NextMonth, countCurrMonth, countNextMonth, payrollTypeId, reportType);
}
#endregion
#region ShowReport
public byte[] ShowReport(int payrollTypeId, DateTime salaryMonth, int reportId, string sEmpID, string reportType)
{
_SalaryMonth = salaryMonth.LastDateOfMonth();
int nReportID = reportId;
DataRow oDR = null;
DataSet oSalarySheets = null;
oSalarySheets = new SalaryMonthlyService().GetEmpSalarySheet(_SalaryMonth, sEmpID);
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
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 || x.Field<Int32>("ItemCode") == -103)).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.Gross) && (x.Field<string>("Description") == "Over Time" || x.Field<string>("Description") == "OT")))
{
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["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.Deductions) && x.Field<string>("Description") == "Income Tax"))
{
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 PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
dTSalarySheet.Merge(dtt);
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowDlgForSalarySheet(null, dTSalarySheet, nReportID, reportType, payrollTypeId);
}
#endregion
#region ReportWithoutCostCenterOT
public byte[] ShowReportWithoutCostCenterOT(int payrollTypeId, DateTime salaryMonth, int reportId, string sEmpID, string reportType)
{
_SalaryMonth = salaryMonth.LastDateOfMonth();
int nReportID = reportId;
DataRow oDR = null;
DataSet oSalarySheets = null;
oSalarySheets = new SalaryMonthlyService().GetEmpSalarySheetWithoutCostCenterOT(_SalaryMonth, sEmpID);
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
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 || x.Field<Int32>("ItemCode") == -103)).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.Gross) && (x.Field<string>("Description") == "Over Time" || x.Field<string>("Description") == "OT")))
{
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["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.Deductions) && x.Field<string>("Description") == "Income Tax"))
{
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.CopyWithoutCostCenterOT(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.CopyWithoutCostCenterOT(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.CopyDeductWithoutCostCenterOT(oDR, source, oSalarySheets.Tables["DeductItem"]);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithoutCostCenterOT(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithoutCostCenterOT(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["CPF"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithoutCostCenterOT(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
DataTable dtt = dTSalarySheet.Copy();
DataView dv = dtt.DefaultView;
dv.Sort = "SequenceNo";
dtt = dv.ToTable();
dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
dTSalarySheet.Merge(dtt);
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowDlgForSalarySheetWithoutCostCenterOT(null, dTSalarySheet, nReportID, reportType, payrollTypeId);
}
#endregion
#region ReportWithoutCostcenter
public byte[] ShowReportWithoutCostcenter(int payrollTypeId, DateTime salaryMonth, int reportId, string sEmpID, string reportType)
{
_SalaryMonth = salaryMonth.LastDateOfMonth();
int nReportID = reportId;
DataRow oDR = null;
DataSet oSalarySheets = null;
oSalarySheets = new SalaryMonthlyService().GetEmpSalarySheetWithoutCostcenter(_SalaryMonth, sEmpID);
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
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 || x.Field<Int32>("ItemCode") == -103 || x.Field<Int32>("ItemCode") == -107)).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>("ItemCode") == -103 || x.Field<Int32>("ItemCode") == -107) && 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>("ItemCode") == -103 || x.Field<Int32>("ItemCode") == -107) && 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.Gross) && (x.Field<string>("Description") == "Over Time" || x.Field<string>("Description") == "OT")))
{
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["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.Deductions) && x.Field<string>("Description") == "Income Tax"))
{
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.CopyWithoutCostcenter(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.CopyWithoutCostcenter(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.CopyDeductWithoutCostcenter(oDR, source, oSalarySheets.Tables["DeductItem"]);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithoutCostcenter(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithoutCostcenter(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables["CPF"].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyWithoutCostcenter(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
DataTable dtt = dTSalarySheet.Copy();
DataView dv = dtt.DefaultView;
dv.Sort = "SequenceNo";
dtt = dv.ToTable();
dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
dTSalarySheet.Merge(dtt);
dTSalarySheet.TableName = "PayrollDataSet_SalarySheet";
DataSet resultDataSet = new DataSet();
resultDataSet.Tables.Add(dTSalarySheet);
string RDLCName = "HRM.Report.RDLC.SalarySheetWithoutCostcenter.rdlc";
List<ReportParameter> extraParams = GetParameterForReportWithoutCostcenter(nReportID, reportType);
ReportProcessor reportProcessor = new ReportProcessor();
//return reportProcessor.ShowDlgForSalarySheetWithoutCostcenter(null, dTSalarySheet, nReportID, reportType, payrollTypeId);
return reportProcessor.CommonReportView(null, RDLCName, resultDataSet, null, extraParams, true, payrollTypeId, reportType);
}
#endregion
#region SalaryReconNew
public byte[] ShowSalaryReconNew(DateTime dToDate, DateTime dFDate, string sEmpID, int payrollTypeId, string reportType)
{
ReportProcessor form = new ReportProcessor();
string RDLCName = "HRM.Report.RDLC.SalaryReconciliationNew.rdlc";
string[] sEmp = sEmpID.Split(',');
TotalEmp = sEmp.Length;
DataTable dtSalaryRecon = SalaryReconNewDT(dToDate, dFDate, sEmpID);
dtSalaryRecon.TableName = "PayrollDataSet_SalaryReconNew";
DataSet resultDataSet = new DataSet();
resultDataSet.Tables.Add(dtSalaryRecon);
_salaryReconNew = new HRM.Report.PayrollDataSet.PayrollDataSet.SalaryReconNewDataTable();
List<ReportParameter> reportParameters = new List<ReportParameter>();
ReportParameter rParam = new ReportParameter("ReportType", reportType);
reportParameters.Add(rParam);
//return form.ShowDlgForSalaryReconcilNew(null, _salaryReconNew, payrollTypeId, reportType);
return form.CommonReportView(null, RDLCName, resultDataSet, null, reportParameters, true, payrollTypeId, reportType);
}
#endregion
#region ItemWiseSalary
public byte[] ItemWiseSalary(DateTime salaryMonth, DateTime toDate, List<PayrollComponentList> payrollComponentList, string sEmpID, int payrollTypeId, string reportType)
{
_SalaryMonth = salaryMonth;
toDate = toDate.LastDateOfMonth();
//int nReportID = reportId;
DataRow oDR = null;
DataSet oSalarySheets = null;
string sSQL = string.Empty;
string itemName = string.Empty;
DataSet oDset = null;
#region SqlParam
if (payrollComponentList.Count() > 0)
{
foreach (PayrollComponentList oDetail in payrollComponentList)
{
if (oDetail.ComponentType == enumPayrollComponentType.Basic_salary)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Gross + "," + Convert.ToString((int)EnumSalaryGroup.Arrear)) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Basic_Salary) + ") AND ItemID in(" + Convert.ToString(((int)EnumSalaryItemCode.Basic_Salary)) + ")";
itemName = oDetail.Name;
}
if (oDetail.ComponentType == enumPayrollComponentType.Ordinary_Hour)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Gross + "," + Convert.ToString((int)EnumSalaryGroup.Arrear)) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Basic_Salary) + ") AND ItemID in(" + Convert.ToString(((int)EnumSalaryItemCode.Basic_Salary)) + ")";
itemName = oDetail.Name;
}
if (oDetail.ComponentType == enumPayrollComponentType.Allowance)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Gross + "," + Convert.ToString((int)EnumSalaryGroup.Arrear)) + ")";
if (oDetail.ItemID == (int)EnumSalaryItemCode.Basic_Salary)
{
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Basic_Salary) + ") AND ItemID in(" + Convert.ToString(oDetail.ItemID) + ")";
}
else
{
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Allowance) + ") AND ItemID in(" + Convert.ToString(oDetail.ItemID) + ")";
}
itemName = oDetail.Name;
}
else if (oDetail.ComponentType == enumPayrollComponentType.Deduction)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Deductions) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Deduction) + ") AND ItemID in(" + Convert.ToString(oDetail.ItemID) + ")";
itemName = oDetail.Name;
}
else if (oDetail.ComponentType == enumPayrollComponentType.Loan)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Deductions) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Loan_Monthly_Installment) + ") AND ItemID in(" + Convert.ToString(oDetail.ItemID) + ")";
itemName = oDetail.Name;
}
else if (oDetail.ComponentType == enumPayrollComponentType.LoanInterest)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Deductions) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Loan_Monthly_Interest) + ") AND ItemID in(" + Convert.ToString(oDetail.ItemID) + ")";
itemName = oDetail.Name;
}
else if (oDetail.ComponentType == enumPayrollComponentType.PF)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Deductions) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.PF_Contribution) + ") AND ItemID in(" + Convert.ToString((int)EnumSalaryItemCode.PF_Contribution) + ")";
itemName = oDetail.Name;
}
else if (oDetail.ComponentType == enumPayrollComponentType.CPF)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Deductions) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.PF_Contribution) + ") AND ItemID in(" + Convert.ToString((int)EnumSalaryItemCode.PF_Contribution) + ")";
itemName = oDetail.Name;
}
else if (oDetail.ComponentType == enumPayrollComponentType.IncomeTax)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Deductions) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Inc_Tax_Deduction) + ") AND ItemID in(" + Convert.ToString((int)-129) + ")";
itemName = oDetail.Name;
}
else if (oDetail.ComponentType == enumPayrollComponentType.Net_pay)
{
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.OtherItem) + ")";
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Net_Payable) + ") AND ItemID in(" + Convert.ToString((int)EnumSalaryItemCode.Net_Payable) + ")";
itemName = oDetail.Name;
}
}
}
#endregion
oDset = new MiscellaneousDatasetService().GetItemWiseSalary(sEmpID, _SalaryMonth, toDate, sSQL);
PayrollDataSet.PayrollDataSet.EmpItemWiseSalaryDataTable oSalary = new PayrollDataSet.PayrollDataSet.EmpItemWiseSalaryDataTable();
if (oDset != null)
{
foreach (DataRow oRow in oDset.Tables[0].Rows)
{
oDR = oSalary.NewRow();
oDR["EmpNo"] = oRow["EmployeeNo"];
oDR["Name"] = oRow["Name"];
oDR["Month"] = Convert.ToDateTime(oRow["SalaryMonth"]).ToString("MMM yy");
oDR["Amount"] = Convert.ToDouble(oRow["Amount"]);
oSalary.Rows.Add(oDR);
}
//form.ShowItemWiseSalary(_selectedParameter.ReportItem, oSalary, _SalaryMonth, toDate, itemName);
DataTable dtt = oSalary.Copy();
DataView dv = dtt.DefaultView;
//dv.Sort = "SequenceNo";
dtt = dv.ToTable();
oSalary = new PayrollDataSet.PayrollDataSet.EmpItemWiseSalaryDataTable();
oSalary.Merge(dtt);
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowItemWiseSalary(null, oSalary, _SalaryMonth, toDate, payrollTypeId, reportType);
}
else
{
throw new ServiceException("No Data Found !!!");
}
}
#endregion
#region SalaryReconSGS
public byte[] ShowSalaryReconSGS(DateTime dFDate, DateTime dToDate, string sEmpID, int payrollTypeId, string reportType)
{
ReportProcessor form = new ReportProcessor();
string RDLCName = "HRM.Report.RDLC.SalaryReconciliationSGS.rdlc";
string[] sEmp = sEmpID.Split(',');
TotalEmp = sEmp.Length;
DataTable dtSalaryRecon = ShowSalaryReconSGS(dFDate, dToDate, sEmpID);
dtSalaryRecon.TableName = "PayrollDataSet_SalaryReconsilation";
DataSet resultDataSet = new DataSet();
resultDataSet.Tables.Add(dtSalaryRecon);
PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable _salaryRecon = new HRM.Report.PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
List<ReportParameter> reportParameters = new List<ReportParameter>();
ReportParameter rParam = new ReportParameter("EmployeeNumber", "");
reportParameters.Add(rParam);
//return form.ShowDlgForSalaryReconcilNew(null, _salaryReconNew, payrollTypeId, reportType);
return form.CommonReportView(null, RDLCName, resultDataSet, null, reportParameters, true, payrollTypeId, reportType);
}
public DataTable ShowSalaryReconSGS(DateTime dFDate, DateTime dToDate, string sEmpID)
{
DataSet _currentSMonthly = new SGSExceptionReportService().GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(dToDate), sEmpID);
DataSet _prvSMonthly = new SGSExceptionReportService().GetEmpPrevDataForSRecon(GlobalFunctions.LastDateOfMonth(dFDate), sEmpID);
PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable dTCSalarySheet = new HRM.Report.PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable dTPSalarySheet = new HRM.Report.PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable dTFSalarySheet = new HRM.Report.PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
DataRow oDRC = null;
DataRow oDRP = null;
foreach (DataRow source in _currentSMonthly.Tables[0].Rows)
{
if (Convert.ToInt32(source["ItemID"]) == -101 || Convert.ToInt32(source["ItemID"]) == 2
|| Convert.ToInt32(source["ItemID"]) == 1 || Convert.ToInt32(source["ItemID"]) == 10)
{
oDRC = dTCSalarySheet.NewRow();
this.CopyForCSM(oDRC, source);
dTCSalarySheet.Rows.Add(oDRC);
}
}
foreach (DataRow source in _currentSMonthly.Tables[1].Rows)
{
oDRC = dTCSalarySheet.NewRow();
this.CopyForCSM(oDRC, source);
dTCSalarySheet.Rows.Add(oDRC);
}
foreach (DataRow source in _currentSMonthly.Tables[0].Rows)
{
if ((Convert.ToInt32(source["ItemID"]) == -101 && Convert.ToInt32(source["ItemCode"]) == -101) ||
(Convert.ToInt32(source["ItemID"]) == 2 && Convert.ToInt32(source["ItemCode"]) == -113) ||
(Convert.ToInt32(source["ItemID"]) == 1 && Convert.ToInt32(source["ItemCode"]) == -113) ||
(Convert.ToInt32(source["ItemID"]) == 10 && Convert.ToInt32(source["ItemCode"]) == -113) ||
(Convert.ToInt32(source["ItemID"]) == 1 && Convert.ToInt32(source["ItemCode"]) == -103))
{
continue;
}
//if (Convert.ToInt32(source["ItemID"]) != -101 || Convert.ToInt32(source["ItemID"]) != 2 || Convert.ToInt32(source["ItemID"]) != 1 || Convert.ToInt32(source["ItemID"]) != 10)
else
{
oDRC = dTCSalarySheet.NewRow();
this.CopyForCSM(oDRC, source);
dTCSalarySheet.Rows.Add(oDRC);
}
}
foreach (DataRow source in _currentSMonthly.Tables[2].Rows)
{
oDRC = dTCSalarySheet.NewRow();
this.CopyForCSM(oDRC, source);
dTCSalarySheet.Rows.Add(oDRC);
}
foreach (DataRow source in _currentSMonthly.Tables[3].Rows)
{
oDRC = dTCSalarySheet.NewRow();
this.CopyForCSM(oDRC, source);
dTCSalarySheet.Rows.Add(oDRC);
}
foreach (DataRow source in _currentSMonthly.Tables[5].Rows)
{
oDRC = dTCSalarySheet.NewRow();
this.CopyForCSM(oDRC, source);
dTCSalarySheet.Rows.Add(oDRC);
}
foreach (DataRow source in _currentSMonthly.Tables[4].Rows)
{
oDRC = dTCSalarySheet.NewRow();
this.CopyForCSM(oDRC, source);
dTCSalarySheet.Rows.Add(oDRC);
}
foreach (DataRow source in _currentSMonthly.Tables[6].Rows)
{
oDRC = dTCSalarySheet.NewRow();
this.CopyForCSM(oDRC, source);
dTCSalarySheet.Rows.Add(oDRC);
}
foreach (DataRow source in _prvSMonthly.Tables[0].Rows)
{
if ((Convert.ToInt32(source["ItemID"]) == -101 && Convert.ToInt32(source["ItemCode"]) == -101)
|| (Convert.ToInt32(source["ItemID"]) == 2 && Convert.ToInt32(source["ItemCode"]) == -113)
|| (Convert.ToInt32(source["ItemID"]) == 1 && Convert.ToInt32(source["ItemCode"]) == -113)
|| (Convert.ToInt32(source["ItemID"]) == 10 && Convert.ToInt32(source["ItemCode"]) == -113)
|| (Convert.ToInt32(source["ItemID"]) == 1 && Convert.ToInt32(source["ItemCode"]) == -103)
)
{
oDRP = dTPSalarySheet.NewRow();
this.CopyForPSM(oDRP, source);
dTPSalarySheet.Rows.Add(oDRP);
}
}
foreach (DataRow source in _prvSMonthly.Tables[1].Rows)
{
oDRP = dTPSalarySheet.NewRow();
this.CopyForPSM(oDRP, source);
dTPSalarySheet.Rows.Add(oDRP);
}
//Change it
foreach (DataRow source in _prvSMonthly.Tables[0].Rows)
{
if ((Convert.ToInt32(source["ItemID"]) == -101 && Convert.ToInt32(source["ItemCode"]) == -101) ||
(Convert.ToInt32(source["ItemID"]) == 2 && Convert.ToInt32(source["ItemCode"]) == -113) ||
(Convert.ToInt32(source["ItemID"]) == 1 && Convert.ToInt32(source["ItemCode"]) == -113) ||
(Convert.ToInt32(source["ItemID"]) == 10 && Convert.ToInt32(source["ItemCode"]) == -113) ||
(Convert.ToInt32(source["ItemID"]) == 1 && Convert.ToInt32(source["ItemCode"]) == -103))
{
continue;
}
else
{
oDRP = dTPSalarySheet.NewRow();
this.CopyForPSM(oDRP, source);
dTPSalarySheet.Rows.Add(oDRP);
}
}
foreach (DataRow source in _prvSMonthly.Tables[2].Rows)
{
oDRP = dTPSalarySheet.NewRow();
this.CopyForPSM(oDRP, source);
dTPSalarySheet.Rows.Add(oDRP);
}
foreach (DataRow source in _prvSMonthly.Tables[3].Rows)
{
oDRP = dTPSalarySheet.NewRow();
this.CopyForPSM(oDRP, source);
dTPSalarySheet.Rows.Add(oDRP);
}
foreach (DataRow source in _prvSMonthly.Tables[5].Rows)
{
oDRP = dTPSalarySheet.NewRow();
this.CopyForPSM(oDRP, source);
dTPSalarySheet.Rows.Add(oDRP);
}
foreach (DataRow source in _prvSMonthly.Tables[4].Rows)
{
oDRP = dTPSalarySheet.NewRow();
this.CopyForPSM(oDRP, source);
dTPSalarySheet.Rows.Add(oDRP);
}
foreach (DataRow source in _prvSMonthly.Tables[6].Rows)
{
oDRP = dTPSalarySheet.NewRow();
this.CopyForPSM(oDRP, source);
dTPSalarySheet.Rows.Add(oDRP);
}
DataTable oHighestT = null;
DataTable oLoewstT = null;
bool checkHighest = false;
bool checkLowest = false;
if (dTCSalarySheet.Rows.Count >= dTPSalarySheet.Rows.Count)
{
checkHighest = true;
oHighestT = dTCSalarySheet;
oLoewstT = dTPSalarySheet;
}
else
{
checkLowest = true;
oHighestT = dTPSalarySheet;
oLoewstT = dTCSalarySheet;
}
try
{
if (checkHighest)
{
int countEmployee = 0;
foreach (DataRow oCRow in oHighestT.Rows)
{
DataRow[] oEmp = oLoewstT.Select("EmpNo='" + oCRow["EmpNo"].ToString() + "'" + "AND ColDes='" + oCRow["ColDes"].ToString().Replace("'", "''") + "'");
if (oEmp != null && oEmp.Length > 0)
{
DataRow oNewRow = dTFSalarySheet.NewRow();
oNewRow["EmpNo"] = oEmp[0]["EmpNo"];
oNewRow["Name"] = oEmp[0]["Name"];
oNewRow["ColDes"] = oEmp[0]["ColDes"];
oNewRow["ColValue1"] = oEmp[0]["ColValue1"];
oNewRow["ColValue2"] = oCRow["ColValue2"];
oNewRow["SalaryMonth1"] = dToDate;
oNewRow["SalaryMonth2"] = dFDate;
oNewRow["TotalEmp"] = countEmployee.ToString();
dTFSalarySheet.Rows.Add(oNewRow);
}
else
{
DataRow oNewRow = dTFSalarySheet.NewRow();
oNewRow["EmpNo"] = oCRow["EmpNo"];
oNewRow["Name"] = oCRow["Name"];
oNewRow["ColDes"] = oCRow["ColDes"];
oNewRow["ColValue1"] = oCRow["ColValue1"];
oNewRow["ColValue2"] = oCRow["ColValue2"];
oNewRow["SalaryMonth1"] = dToDate;
oNewRow["SalaryMonth2"] = dFDate;
oNewRow["TotalEmp"] = countEmployee.ToString();
dTFSalarySheet.Rows.Add(oNewRow);
}
}
foreach (DataRow oCRow in oLoewstT.Rows)
{
DataRow[] oEmp = dTFSalarySheet.Select("EmpNo='" + oCRow["EmpNo"].ToString() + "'" + "AND ColDes='" + oCRow["ColDes"].ToString().Replace("'", "''") + "'");
if (oEmp != null && oEmp.Length > 0)
{
continue;
}
else
{
DataRow oNewRow = dTFSalarySheet.NewRow();
oNewRow["EmpNo"] = oCRow["EmpNo"];
oNewRow["Name"] = oCRow["Name"];
oNewRow["ColDes"] = oCRow["ColDes"];
oNewRow["ColValue1"] = oCRow["ColValue1"];
oNewRow["ColValue2"] = oCRow["ColValue2"];
oNewRow["SalaryMonth1"] = dToDate;
oNewRow["SalaryMonth2"] = dFDate;
oNewRow["TotalEmp"] = countEmployee.ToString();
dTFSalarySheet.Rows.Add(oNewRow);
}
}
}
else if (checkLowest)
{
int countEmployee = 0;
foreach (DataRow oCRow in oHighestT.Rows)
{
DataRow[] oEmp = oLoewstT.Select("EmpNo='" + oCRow["EmpNo"].ToString() + "'" + "AND ColDes='" + oCRow["ColDes"].ToString().Replace("'", "''") + "'");
if (oEmp != null && oEmp.Length > 0)
{
DataRow oNewRow = dTFSalarySheet.NewRow();
oNewRow["EmpNo"] = oEmp[0]["EmpNo"];
oNewRow["Name"] = oEmp[0]["Name"];
oNewRow["ColDes"] = oEmp[0]["ColDes"];
oNewRow["ColValue1"] = oCRow["ColValue1"];
oNewRow["ColValue2"] = oEmp[0]["ColValue2"];
oNewRow["SalaryMonth1"] = dToDate;
oNewRow["SalaryMonth2"] = dFDate;
oNewRow["TotalEmp"] = countEmployee.ToString();
dTFSalarySheet.Rows.Add(oNewRow);
}
else
{
DataRow oNewRow = dTFSalarySheet.NewRow();
oNewRow["EmpNo"] = oCRow["EmpNo"];
oNewRow["Name"] = oCRow["Name"];
oNewRow["ColDes"] = oCRow["ColDes"];
oNewRow["ColValue1"] = oCRow["ColValue1"];
oNewRow["ColValue2"] = oCRow["ColValue2"];
oNewRow["SalaryMonth1"] = dToDate;
oNewRow["SalaryMonth2"] = dFDate;
oNewRow["TotalEmp"] = countEmployee.ToString();
dTFSalarySheet.Rows.Add(oNewRow);
}
}
foreach (DataRow oCRow in oLoewstT.Rows)
{
DataRow[] oEmp = dTFSalarySheet.Select("EmpNo='" + oCRow["EmpNo"].ToString() + "'" + "AND ColDes='" + oCRow["ColDes"].ToString().Replace("'", "''") + "'");
if (oEmp != null && oEmp.Length > 0)
{
continue;
}
else
{
DataRow oNewRow = dTFSalarySheet.NewRow();
oNewRow["EmpNo"] = oCRow["EmpNo"];
oNewRow["Name"] = oCRow["Name"];
oNewRow["ColDes"] = oCRow["ColDes"];
oNewRow["ColValue1"] = oCRow["ColValue1"];
oNewRow["ColValue2"] = oCRow["ColValue2"];
oNewRow["SalaryMonth1"] = dToDate;
oNewRow["SalaryMonth2"] = dFDate;
oNewRow["TotalEmp"] = countEmployee.ToString();
dTFSalarySheet.Rows.Add(oNewRow);
}
}
}
}
catch (Exception ex)
{
throw new Exception(ex.Message);
}
#region Old Code
//int count = 0;
//foreach (DataRow oCRow in dTCSalarySheet)
//{
// try
// {
// //employee exist in both month
// //employee not exist in current month, amount should be negative
// //employee join in current month, amount should be positive
// if (oCRow["EmpNo"].ToString() != string.Empty && oCRow["ColDes"].ToString() != string.Empty)
// {
// DataRow[] oEmp = dTPSalarySheet.Select("EmpNo='" + oCRow["EmpNo"].ToString() + "'" + "AND ColDes='" + oCRow["ColDes"].ToString().Replace("'", "''") + "'");
// if (oEmp != null && oEmp.Length > 0)
// {
// // oCRow["SLNo"] = count;
// oCRow["ColValue1"] = oEmp[0]["ColValue1"];
// oCRow["SalaryMonth1"] = dToDate;
// oCRow["SalaryMonth2"] = dFDate;
// count++;
// }
// else
// {
// // oCRow["SLNo"] = count;
// oCRow["SalaryMonth1"] = dToDate;
// oCRow["SalaryMonth2"] = dFDate;
// count++;
// }
// }
// }
// catch (Exception ex)
// {
// throw new Exception(ex.Message);
// }
//}
//foreach (DataRow oPRow in dTPSalarySheet)
//{
// // int count = dTCSalarySheet.Rows.Count;
// try
// {
// //employee exist in both month
// //employee not exist in current month, amount should be negative
// //employee join in current month, amount should be positive
// DataRow[] oEmp = dTCSalarySheet.Select("EmpNo='" + oPRow["EmpNo"].ToString() + "'" + "AND ColDes='" + oPRow["ColDes"].ToString().Replace("'", "''") + "'");
// if (oEmp == null || oEmp.Length == 0)
// {
// DataRow oNewRow = dTCSalarySheet.NewRow();
// oNewRow["EmpNo"] = oPRow["EmpNo"];
// oNewRow["Name"] = oPRow["Name"];
// if (oPRow["ColDes"].ToString().Contains("'"))
// {
// oNewRow["ColDes"] = oPRow["ColDes"].ToString().Replace("'", "\'");
// }
// else
// {
// oNewRow["ColDes"] = oPRow["ColDes"];
// }
// oNewRow["ColValue1"] = oPRow["ColValue1"];
// oNewRow["SalaryMonth1"] = dToDate;
// oNewRow["SalaryMonth2"] = dFDate;
// dTCSalarySheet.Rows.Add(oNewRow);
// }
// }
// catch (Exception ex)
// {
// throw new Exception(ex.Message);
// }
//}
#endregion
return dTFSalarySheet;
}
private void CopyForCSM(DataRow source, DataRow destination)
{
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["EmpNo"] = destination["EMPLOYEENO"];
source["Name"] = destination["Name"];
string sCheck = destination["Description"].ToString();
if (destination["Description"].ToString().Contains("'"))
{
source["ColDes"] = destination["Description"].ToString().Replace("'", "\'");
}
else
{
source["ColDes"] = destination["Description"];
}
source["ColValue2"] = destination["Amount"];
//source["SLNo"] = destination["EMPLOYEEID"];
}
private void CopyForPSM(DataRow source, DataRow destination)
{
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["EmpNo"] = destination["EMPLOYEENO"];
source["Name"] = destination["Name"];
if (destination["Description"].ToString().Contains("'"))
{
source["ColDes"] = destination["Description"].ToString().Replace("'", "\'");
}
else
{
source["ColDes"] = destination["Description"];
}
source["ColValue1"] = destination["Amount"];
//source["SLNo"] = destination["EMPLOYEEID"];
}
#endregion
#region ExtendedSaharySheet
public byte[] ShowExtendedSalarySheet(int payrollTypeId, DateTime salaryMonth, int reportId, string sEmpID, string reportType)
{
ReportProcessor form = new ReportProcessor();
string RDLCName = "HRM.Report.RDLC.ExtendedSalarySheet.rdlc";
//string RDLCName = "HRM.Report.RDLC.ExtendedSalarySheet-Test.rdlc";
string[] sEmp = sEmpID.Split(',');
TotalEmp = sEmp.Length;
DataTable dtExtendedSalarySheet = ExtendedSalarySheet(salaryMonth, sEmpID);
dtExtendedSalarySheet.TableName = "PayrollDataSet_ExtendedSalarySheet";
PayrollDataSet.PayrollDataSet.ExtendedSalarySheetDataTable _extendedSalarySheet;
DataSet resultDataSet = new DataSet();
resultDataSet.Tables.Add(dtExtendedSalarySheet);
_extendedSalarySheet = new PayrollDataSet.PayrollDataSet.ExtendedSalarySheetDataTable();
List<ReportParameter> reportParameters = new List<ReportParameter>();
//ReportParameter rParam = new ReportParameter("ReportType", reportType);
//reportParameters.Add(rParam);
return form.CommonReportView(null, RDLCName, resultDataSet, null, reportParameters, true, payrollTypeId, reportType);
}
public DataTable ExtendedSalarySheet(DateTime dSalaryMonth, string sEmpID)
{
_SalaryMonth = dSalaryMonth;
DataRow oDR = null;
DataSet oExtendedSalarySheets = null;
oExtendedSalarySheets = new SalaryMonthlyService().GetExtendedSalarySheet(dSalaryMonth, sEmpID);
PayrollDataSet.PayrollDataSet.ExtendedSalarySheetDataTable dTExtendedSalarySheet = new PayrollDataSet.PayrollDataSet.ExtendedSalarySheetDataTable();
foreach (DataRow source in oExtendedSalarySheets.Tables[0].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oExtendedSalarySheets.Tables[1].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oExtendedSalarySheets.Tables[2].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oExtendedSalarySheets.Tables[3].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oExtendedSalarySheets.Tables[4].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oExtendedSalarySheets.Tables[5].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oExtendedSalarySheets.Tables[6].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oExtendedSalarySheets.Tables[7].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oExtendedSalarySheets.Tables[8].Rows)
{
oDR = dTExtendedSalarySheet.NewRow();
this.CopyForExtendedSSheet(oDR, source);
dTExtendedSalarySheet.Rows.Add(oDR);
}
return dTExtendedSalarySheet;
}
#endregion
private List<ReportParameter> GetParameterForReportWithoutCostcenter(int nReportID, string reportType)
{
ReportParameter rParam = null;
List<ReportParameter> reportParameters = new List<ReportParameter>();
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("ReportType", reportType);
reportParameters.Add(rParam);
return reportParameters;
}
private DataTable SalaryReconNewDT(DateTime dFDate, DateTime dToDate, string sEmpID)
{
DataSet dsDiff = new SalaryMonthlyService().GetEmpSalaryDifference(GlobalFunctions.LastDateOfMonth(dFDate), GlobalFunctions.LastDateOfMonth(dToDate), sEmpID);
_salaryReconNew = new HRM.Report.PayrollDataSet.PayrollDataSet.SalaryReconNewDataTable();
bool isEchoTex = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "attendence", "echotexprocess");
if (isEchoTex == true)
{
dtNetPay = dsDiff.Tables[4].AsEnumerable().Where(x => x.Field<Double>("Amount") == 0).Any() ? dsDiff.Tables[4].AsEnumerable().Where(x => x.Field<Double>("Amount") == 0).CopyToDataTable() : new DataTable();
}
else
{
dtNetPay = dsDiff.Tables[4].AsEnumerable().Where(x => x.Field<Decimal>("Amount") == 0).Any() ? dsDiff.Tables[4].AsEnumerable().Where(x => x.Field<Decimal>("Amount") == 0).CopyToDataTable() : new DataTable();
}
//dtNetPay = dsDiff.Tables[4].AsEnumerable().Where(x => x.Field<Double>("Amount") == 0).Any() ? dsDiff.Tables[4].AsEnumerable().Where(x => x.Field<Double>("Amount") == 0).CopyToDataTable() : new DataTable();
foreach (DataRow source in dsDiff.Tables[0].Rows)
this.CopyRecon(source, dFDate, dToDate);
foreach (DataRow source in dsDiff.Tables[1].Rows)
this.CopyRecon(source, dFDate, dToDate);
foreach (DataRow source in dsDiff.Tables[2].Rows)
this.CopyRecon(source, dFDate, dToDate);
foreach (DataRow source in dsDiff.Tables[3].Rows)
this.CopyRecon(source, dFDate, dToDate);
foreach (DataRow source in dsDiff.Tables[4].Rows)
this.CopyRecon(source, dFDate, dToDate);
return _salaryReconNew;
}
private void CopyWithArrear(DataRow source, DataRow destination, int payrollTypeId)
{
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++;
}
Employee emp = _employees.Where(o => o.EmployeeNo == destination["EMPLOYEENO"].ToString().Trim()).FirstOrDefault();
EmployeeCostCenter empCostCenter = _empCostCenters.Where(o => o.EmployeeID == emp.ID).FirstOrDefault();
int costCenterID = empCostCenter == null ? 0 : empCostCenter.CostCenterID;
Costcenter cCenter = _costCenters.Where(o => o.ID == costCenterID).FirstOrDefault();
source["EmpNo"] = destination["EMPLOYEENO"];
source["CCDes"] = cCenter == null ? "" : cCenter.Name;
source["EmpName"] = destination["Name"];
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"] = destination["SequenceNo"];
//if (payrollTypeId != 1)
//{
// source["CC"] = destination["CCName"];
// source["OrdBasic"] = destination["THISMONTHBASIC"];
//}
}
private void CopyDeduction(DataRow destination, bool IsPrv)
{
DataRow oDR = null;
//if (_salaryReconDecuction.Rows.Count == 0)
//{
// oDR = _salaryReconDecuction.NewRow();
// oDR["Description"] = "Deduction";
// _salaryReconDecuction.Rows.Add(oDR);
//}
oDR = _salaryReconDecuction.NewRow();
oDR["Description"] = destination["DESCRIPTION"];
if (IsPrv == false)
{
//oDR = _salaryReconDecuction.NewRow();
//oDR["Description"] = destination["DESCRIPTION"];
oDR["CurrAmount"] = destination["Amount"];
}
if (IsPrv == true)
{
DataRow[] oRows = _salaryReconDecuction.Select("Description='" + destination["Description"].ToString() + "'");
if (oRows != null && oRows.Length > 0)
{
oRows[0]["PrevAmount"] = destination["Amount"];
}
else
{
oRows = _salaryReconDecuction.Select("Description='" + destination["Description"].ToString() + "'");
oDR = _salaryReconDecuction.NewRow();
oDR["Description"] = destination["DESCRIPTION"];
oDR["PrevAmount"] = destination["Amount"];
_salaryReconDecuction.Rows.Add(oDR);
}
}
else _salaryReconDecuction.Rows.Add(oDR);
}
private void CopyGross(DataRow destination, bool IsPrv)
{
DataRow oDR = null;
//if (_salaryRecon.Rows.Count == 0)
//{
// oDR = _salaryRecon.NewRow();
// oDR["Description"] = "Gross Item";
// _salaryRecon.Rows.Add(oDR);
//}
oDR = _salaryReconGross.NewRow();
oDR["Description"] = destination["DESCRIPTION"];
if (IsPrv == false)
{
oDR["CurrAmount"] = destination["Amount"];
}
if (IsPrv == true)
{
//string characters = Regex.Replace(destination["Description"].ToString(), "'", "");
//DataRow[] oRows = _salaryReconGross.Select("Description='" + characters + "'");
DataRow[] oRows = _salaryReconGross
.Where(x => x.Description.ToString() == destination["Description"].ToString())
.ToArray();
if (oRows != null && oRows.Length > 0)
{
oRows[0]["PrevAmount"] = destination["Amount"];
}
else
{
oRows = _salaryReconGross
.Where(x => x.Description.ToString() == destination["Description"].ToString())
.ToArray();
oDR = _salaryReconGross.NewRow();
oDR["Description"] = destination["DESCRIPTION"];
oDR["PrevAmount"] = destination["Amount"];
_salaryReconGross.Rows.Add(oDR);
}
}
else _salaryReconGross.Rows.Add(oDR);
}
private void CopyRecon(DataRow destination, DateTime fromDate, DateTime toDate)
{
DataTable dtTemp = new DataTable();
if (dtNetPay.Rows.Count > 0)
{
var temp = dtNetPay.AsEnumerable().Where(x => x.Field<int>("EMPLOYEENO").ToString() == destination["EMPLOYEENO"].ToString());
if (temp.Any())
{
dtTemp = temp.CopyToDataTable();
}
}
if (dtTemp.Rows.Count <= 0)
{
DataRow oDR = null;
oDR = _salaryReconNew.NewRow();
if (destination["Description"].ToString().Trim() == "Basic")
{
oDR["RowSequence"] = 1;
}
else
{
oDR["RowSequence"] = 2;
}
oDR["SalaryMonth2"] = fromDate;
oDR["SalaryMonth1"] = toDate;
oDR["EmpNo"] = destination["EMPLOYEENO"];
oDR["EmpName"] = destination["Name"];
oDR["Description"] = destination["Description"];
oDR["Amount"] = destination["Amount"];
oDR["Serial"] = destination["Serial"];
oDR["SequenceNo"] = destination["SequenceNo"];
oDR["SalaryMonth"] = destination["SalaryMonth"];
_salaryReconNew.Rows.Add(oDR);
}
_salaryReconNew.TableName = "dsCompany_DTOPI";
}
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 CopyWithoutCostCenterOT(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["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"];
//}
}
private void CopyDeductWithoutCostCenterOT(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"];
//}
}
private void CopyWithoutCostcenter(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 CopyDeductWithoutCostcenter(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["RowSequence"] = destination["sequenceno"] != null ? Convert.ToInt32(destination["sequenceno"]) : 0;
//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"];
//}
}
public byte[] CCWiseSalarySummary(int payrollTypeId, DateTime sMonth, string sEmpID, string reportType)
{
DateTime salaryMonth = GlobalFunctions.LastDateOfMonth(sMonth);
DataSet dsCCWiseSS = new SalaryMonthlyService().GetCCWiseSalarySheet(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
PayrollDataSet.PayrollDataSet.CCWSaSummaryDataTable dCCWSSummary = new PayrollDataSet.PayrollDataSet.CCWSaSummaryDataTable();
int count = 1;
foreach (DataRow oDR in dsCCWiseSS.Tables[0].Rows)
{
DataRow oD = dCCWSSummary.NewRow();
oD["SLNo"] = count;
oD["CCCode"] = oDR["Code"];
oD["InvolveAmount"] = oDR["GrossAmount"];
oD["PFAmount"] = 0;
dCCWSSummary.Rows.Add(oD);
count++;
}
//foreach (DataRow oDR in dsCCWiseSS.Tables[1].Rows)
//{
// DataRow[] dRows = dCCWSSummary.Select("CCCode='" + oDR["Code"].ToString() + "'");
// if (dRows.Length > 0)
// {
// dRows[0]["InvolveAmount"] = Convert.ToDouble(dRows[0]["InvolveAmount"]) + Convert.ToDouble(oDR["GrossArrear"]);
// }
//}
foreach (DataRow oDR in dsCCWiseSS.Tables[1].Rows)
{
DataRow[] dRows = dCCWSSummary.Select("CCCode='" + oDR["Code"].ToString() + "'");
if (dRows.Length > 0)
{
dRows[0]["PFAmount"] = oDR["PFAmount"];
}
}
//form.ShowDlgForCCWiswSalarySummary(_selectedParameter.ReportItem, dCCWSSummary, salaryMonth);\
DataTable dtt = dCCWSSummary.Copy();
DataView dv = dtt.DefaultView;
//dv.Sort = "SequenceNo";
dtt = dv.ToTable();
dCCWSSummary = new PayrollDataSet.PayrollDataSet.CCWSaSummaryDataTable();
dCCWSSummary.Merge(dtt);
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowDlgForCCWiswSalarySummary(null, dCCWSSummary, payrollTypeId, reportType);
}
public byte[] ShowDetailSalarySheetByCC(int payrollTypeId, DateTime salaryMonth, string sEmpID, string reportType)
{
SalaryMonthly oSM = new SalaryMonthly();
_SalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth);
DataRow oDR = null;
DataSet oSalarySheets = null;
oSalarySheets = new SalaryMonthlyService().GetEmpSalarySheetByCC(_SalaryMonth, sEmpID);
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new HRM.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
foreach (DataRow source in oSalarySheets.Tables[0].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyForCC(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables[1].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyForCC(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables[2].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyForCC(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables[3].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyForCC(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables[4].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyForCC(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables[5].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyForCC(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
foreach (DataRow source in oSalarySheets.Tables[6].Rows)
{
oDR = dTSalarySheet.NewRow();
this.CopyForCC(oDR, source);
dTSalarySheet.Rows.Add(oDR);
}
DataTable dtt = dTSalarySheet.Copy();
DataView dv = dtt.DefaultView;
dv.Sort = "SequenceNo";
dtt = dv.ToTable();
dTSalarySheet = new PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
dTSalarySheet.Merge(dtt);
ReportProcessor reportProcessor = new ReportProcessor();
return reportProcessor.ShowDlgForSalarySheetByCC(null, dTSalarySheet, payrollTypeId, reportType);
}
private void CopyForCC(DataRow source, DataRow destination)
{
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["EmpNo"] = destination["EMPLOYEENO"];
source["EmpName"] = destination["Name"];
source["Grade"] = destination["GName"];
source["GCode"] = destination["GCode"];
source["Department"] = destination["DName"];
source["Description"] = destination["Description"];
source["Amount"] = destination["Amount"];
source["SalaryMonth"] = _SalaryMonth;
source["CCDes"] = destination["CRGDes"];
//source["AccountNo"] = destination["AccountNo"];
//source["SLNo"] = destination["EMPLOYEEID"];
}
private void CopyForExtendedSSheet(DataRow source, DataRow destination)
{
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["EmpNo"] = destination["EMPLOYEENO"];
source["EmpName"] = destination["Name"];
source["Grade"] = destination["GName"];
source["Department"] = destination["DName"];
if (destination["Description"].ToString() == "PF")
{
source["Description"] = "PF Deduction";
}
else if (destination["Description"].ToString() == "Income Tax")
{
source["Description"] = "Income Tax Deduction";
}
else if (destination["Description"].ToString() == "PF Loan")
{
source["Description"] = "PF Loan Deduction";
}
else if (destination["Description"].ToString() == "Over Time")
{
source["Description"] = "Over Time Amount";
}
else if (destination["Description"].ToString() == "Over Time hour")
{
source["Description"] = "Over Time Hour";
}
else
{
source["Description"] = destination["Description"];
}
//source["Description"] = destination["Description"];
source["Amount"] = destination["Amount"];
source["SalaryMonth"] = _SalaryMonth;
source["Designation"] = destination["DGName"];
source["DOJ"] = destination["JOININGDATE"];
source["DOB"] = destination["BIRTHDATE"];
source["DOC"] = destination["DATEOFCONFIRMATION"];
source["Resource"] = destination["CDescription"];
//source["SLNo"] = destination["EMPLOYEEID"];
}
}
}
//namespace Payroll.Report
//{
// public class rptSalarySheet
// {
// private ReportSetup _selectedParameter;
// private DateTime _SalaryMonth;
// string tempEmpID = string.Empty;
// private DateTime _todate;
// int count = 1;
// private int TotalEmp = 0;
// DataSet _currentSMonthly = null;
// DataSet _prvSMonthly = null;
// private DateTime _SalaryMonth2;
// string paramSqlbank = "";
// string paramSqlCategory = "";
// string paramSqlDepartment = "";
// string paramSqlGrade = "";
// string paramSqlGradeSegment = "";
// string paramSqlLocation = "";
// string paramsqlReligion = "";
// string paramSqlCostCenter = "";
// string paramSqlBranch = "";
// string paramDesignation = "";
// string paramSqlParameter = "";
// string costcenterID = "";
// string _sDivision = "";
// string _sDepartment = "";
// string _sUnit = "";
// string _sBranch = "";
// string _sLocation = "";
// private PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable _salaryRecon;
// double deductAmonut = 0.00;
// //DataSet _currentSMonthly = null;
// //DataSet _prvSMonthly = null;
// private PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable _salaryReconGross;
// private PayrollDataSet.PayrollDataSet.SalaryReconDeductionDataTable _salaryReconDecuction;
// ObjectsTemplate<EmployeeCostCenter> _empCostCenters = null;
// ObjectsTemplate<Costcenter> _costCenters = null;
// ObjectsTemplate<Employee> _employees = null;
// public ReportSetup SelectedParameter
// {
// set
// {
// _selectedParameter = value;
// }
// }
// public rptSalarySheet()
// {
// }
// private void CopyNonManagement(DataRow source, DataRow destination)
// {
// 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++;
// }
// Employee emp = _employees.Where(o => o.EmployeeNo == destination["EMPLOYEENO"].ToString().Trim()).FirstOrDefault();
// EmployeeCostCenter empCostCenter = _empCostCenters.Where(o => o.EmployeeID == emp.ID).FirstOrDefault();
// ID costCenterID = empCostCenter == null ? ID.FromInteger(0): empCostCenter.CostCenterID;
// Costcenter cCenter = _costCenters.Where(o => o.ID == costCenterID).FirstOrDefault();
// source["EmpNo"] = destination["EMPLOYEENO"];
// source["EmpName"] = destination["Name"];
// source["Grade"] = destination["GName"];
// source["Department"] = destination["DName"];
// source["Description"] = destination["Description"];
// source["Amount"] = destination["Amount"];
// source["CCDes"] = cCenter == null ? "" : cCenter.Name;
// source["SalaryMonth"] = _SalaryMonth;
// source["JoiningDate"] = destination["JoiningDate"];
// //source["SLNo"] = destination["EMPLOYEEID"];
// }
// private void Copy(DataRow source, DataRow destination)
// {
// int seqenceNo = 0;
// 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["EmpNo"] = destination["EMPLOYEENO"];
// source["EmpName"] = destination["Name"];
// source["Grade"] = destination["GName"];
// source["Department"] = destination["DName"];
// source["SequenceNo"] = destination["SequenceNo"];
// source["Description"] = destination["Description"];
// //string str = destination["Description"].ToString();
// //if ((destination["Description"]) != DBNull.Value)
// //{
// // if (str == "Total Gross")
// // {
// // source["Description"] = destination["Description"]; //Total Gross
// // seqenceNo = 40;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToString(destination["Description"]) == "Total Deduction")
// // {
// // source["Description"] = destination["Description"]; //Total Deduction
// // seqenceNo = 75;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ITEMCODE"]) == Convert.ToInt16(EnumSalaryItemCode.Basic_Salary) && Convert.ToInt16(destination["ITEMGROUP"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ITEMID"])== -101)
// // {
// // source["Description"] = destination["Description"]; //Basic Salary
// // seqenceNo = 1;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Basic_Salary) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == -101)
// // {
// // source["Description"] = destination["Description"]; // Basic Salry Arrear
// // seqenceNo = 2;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"])==Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 1)
// // {
// // source["Description"] = destination["Description"]; //House Rent
// // seqenceNo = 3;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == 1)
// // {
// // source["Description"] = destination["Description"]; //House Rent Arrear
// // seqenceNo = 4;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Bonus) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 39)
// // {
// // source["Description"] = destination["Description"]; //Management Corporate Bonus
// // seqenceNo = 5;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 2)
// // {
// // source["Description"] = destination["Description"]; //Transport Allowance
// // seqenceNo = 6;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == 2)
// // {
// // source["Description"] = destination["Description"];//Transport Allowance arrear
// // seqenceNo = 7;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 142)
// // {
// // source["Description"] = destination["Description"]; // Medical
// // seqenceNo = 8;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == 142)
// // {
// // source["Description"] = destination["Description"]; // Medical Arrear
// // seqenceNo = 9;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 28)
// // {
// // source["Description"] = destination["Description"]; //Outstation Allowance
// // seqenceNo = 10;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == 28)
// // {
// // source["Description"] = destination["Description"];//Outstation Allowance arrear
// // seqenceNo = 11;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 22)
// // {
// // source["Description"] = destination["Description"]; // Business Conveyance
// // seqenceNo = 12;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == 22)
// // {
// // source["Description"] = destination["Description"]; //Business Conveyance Arrear
// // seqenceNo = 13;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 74)
// // {
// // source["Description"] = destination["Description"]; //Transportation Allowance
// // seqenceNo = 14;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == 74)
// // {
// // source["Description"] = destination["Description"]; // Transportation Allowance Arrear
// // seqenceNo = 15;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 79)
// // {
// // source["Description"] = destination["Description"];//Leave Fare Assistance Allowance
// // seqenceNo = 16;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == 79)
// // {
// // source["Description"] = destination["Description"]; // Leave Fare Assistance Allowance Arrear
// // seqenceNo = 17;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 80)
// // {
// // source["Description"] = destination["Description"]; //Festival Bonus
// // seqenceNo = 18;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == 80)
// // {
// // source["Description"] = destination["Description"]; //Festival Bonus Arrear
// // seqenceNo = 19;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 36)
// // {
// // source["Description"] = destination["Description"];//Pp Medical Expense
// // seqenceNo = 20;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 70)
// // {
// // source["Description"] = destination["Description"]; //Reward Recognition
// // seqenceNo = 21;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 26)
// // {
// // source["Description"] = destination["Description"]; //Shift Allowance
// // seqenceNo = 22;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 5)
// // {
// // source["Description"] = destination["Description"]; //Leave Allowance
// // seqenceNo = 23;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 144)
// // {
// // source["Description"] = destination["Description"]; // Medical Clame
// // seqenceNo = 24;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 5)
// // {
// // source["Description"] = destination["Description"]; //Leave Allowance
// // seqenceNo = 25;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 5)
// // {
// // source["Description"] = destination["Description"]; // Leave Allowance Arrear
// // seqenceNo = 26;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 19)
// // {
// // source["Description"] = destination["Description"]; //DSBS
// // seqenceNo = 27;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 165)
// // {
// // source["Description"] = destination["Description"]; //SCI
// // seqenceNo = 28;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 35)
// // {
// // source["Description"] = destination["Description"]; //IT refund
// // seqenceNo = 29;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 164)
// // {
// // source["Description"] = destination["Description"]; //Sign On
// // seqenceNo = 30;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 64)
// // {
// // source["Description"] = destination["Description"]; //Arrear Basic Allo
// // seqenceNo = 31;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ITEMGROUP"]) == Convert.ToInt16(EnumSalaryGroup.UnauthLeave) && Convert.ToInt16(destination["ItemID"]) == -101)
// // {
// // source["Description"] = "Leave Adj."; //Unauthorized Leave
// // seqenceNo = 39;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.PF_Contribution) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == -128)
// // {
// // source["Description"] = destination["Description"]; // PF
// // seqenceNo = 41;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.PF_Contribution) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == -128)
// // {
// // source["Description"] = destination["Description"]; // Pf Arrear
// // seqenceNo = 42;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Inc_Tax_Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == -129)
// // {
// // source["Description"] = destination["Description"]; // Income Tax
// // seqenceNo = 43;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 117)
// // {
// // source["Description"] = destination["Description"]; // Sci- Mobile
// // seqenceNo = 44;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 1)
// // {
// // source["Description"] = destination["Description"];//House Rent Advance
// // seqenceNo = 45;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 2)
// // {
// // source["Description"] = destination["Description"];// Religious
// // seqenceNo = 46;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToString(destination["Description"]) == "Religious Interest")
// // {
// // source["Description"] = destination["Description"]; //Religious Interest
// // seqenceNo = 47;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 122)
// // {
// // source["Description"] = destination["Description"]; //Sci- Others
// // seqenceNo = 48;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 134)
// // {
// // source["Description"] = destination["Description"];//Recognitio Reward ( Gift Card)
// // seqenceNo = 49;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Installment) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 4)
// // {
// // source["Description"] = destination["Description"];//House Building
// // seqenceNo = 50;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 4)
// // {
// // source["Description"] = destination["Description"];//House Building Interest
// // seqenceNo = 51;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 148)
// // {
// // source["Description"] = destination["Description"]; //Shift Allowance Adj
// // seqenceNo = 52;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Net_Payable) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.OtherItem) && Convert.ToInt16(destination["ItemID"]) == -132)
// // {
// // source["Description"] = destination["Description"]; //Net Pay
// // seqenceNo = 76;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else
// // {
// // source["Description"] = destination["Description"];
// // seqenceNo = 74;
// // source["SequenceNo"] = seqenceNo;
// // }
// //}
// //source["Description"] = destination["Description"];
// //if (Convert.ToInt32(destination["Amount"]) <=0)
// //{
// // source["Amount"] = 0.0;
// //}
// //else
// //{
// source["Amount"] = destination["Amount"];
// //}
// source["SalaryMonth"] = _SalaryMonth;
// source["JoiningDate"] = destination["JoiningDate"];
// //source["SLNo"] = destination["EMPLOYEEID"];
// }
// private void CopyWithArrear(DataRow source, DataRow destination)
// {
// 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++;
// }
// Employee emp = _employees.Where(o => o.EmployeeNo == destination["EMPLOYEENO"].ToString().Trim()).FirstOrDefault();
// EmployeeCostCenter empCostCenter = _empCostCenters.Where(o => o.EmployeeID == emp.ID).FirstOrDefault();
// ID costCenterID = empCostCenter == null ? ID.FromInteger(0) : empCostCenter.CostCenterID;
// Costcenter cCenter = _costCenters.Where(o => o.ID == costCenterID).FirstOrDefault();
// source["EmpNo"] = destination["EMPLOYEENO"];
// source["CCDes"] = cCenter == null ? "" : cCenter.Name;
// source["EmpName"] = destination["Name"];
// 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"] = destination["SequenceNo"];
// if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer != 1)
// {
// source["CC"] = destination["CCName"];
// source["OrdBasic"] = destination["THISMONTHBASIC"];
// }
// #region Old
// //int seqenceNo = 0;
// //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["EmpNo"] = destination["EMPLOYEENO"];
// //source["EmpName"] = destination["Name"];
// //source["Grade"] = destination["GName"];
// //source["Department"] = destination["DName"];
// // string str = destination["Description"].ToString();
// //if ((destination["Description"]) != DBNull.Value)
// //{
// // if (str == "Total Gross")
// // {
// // source["Description"] = destination["Description"]; //Total Gross
// // seqenceNo = 26;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToString(destination["Description"]) == "Total Deduction")
// // {
// // source["Description"] = destination["Description"]; //Total Deduction
// // seqenceNo = 51;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Basic_Salary) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToUInt16(EnumSalaryGroup.Miscellaneous) && Convert.ToInt16(destination["ItemID"]) == -101)
// // {
// // source["Description"] = destination["Description"]; //Ordinary Hour
// // seqenceNo = 1;
// // source["SequenceNo"] = destination["SequenceNo"] ;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Basic_Salary) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToUInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == -101)
// // {
// // source["Description"] = destination["Description"];
// // seqenceNo = 2;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ITEMCODE"]) == Convert.ToInt16(EnumSalaryItemCode.Basic_Salary) && Convert.ToInt16(destination["ITEMGROUP"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ITEMID"]) == -101)
// // {
// // source["Description"] = destination["Description"]; //Basic Salary
// // seqenceNo = 3;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Basic_Salary) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToInt16(destination["ItemID"]) == -101)
// // {
// // source["Description"] = destination["Description"]; // Basic Salry Arrear
// // seqenceNo = 4;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 1)
// // {
// // source["Description"] = destination["Description"]; //House Rent
// // seqenceNo = 5;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear) && Convert.ToString(destination["Description"]) == "House Rent Arrear")
// // {
// // source["Description"] = destination["Description"]; //House Rent Arrear
// // seqenceNo = 6;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 6)
// // {
// // source["Description"] = destination["Description"]; // Family Medical All
// // seqenceNo = 7;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 3)
// // {
// // source["Description"] = destination["Description"]; // Entertainment Allowance
// // seqenceNo = 8;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 11)
// // {
// // source["Description"] = destination["Description"]; // City Allowance
// // seqenceNo = 9;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 12)
// // {
// // source["Description"] = destination["Description"]; // Uniform Washing Allowance
// // seqenceNo = 10;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 15)
// // {
// // source["Description"] = destination["Description"]; // Smooking Allowance
// // seqenceNo = 11;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 16)
// // {
// // source["Description"] = destination["Description"]; // Fourth Shift Allowance
// // seqenceNo = 12;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 89)
// // {
// // source["Description"] = destination["Description"]; // General Allowance
// // seqenceNo = 13;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 14)
// // {
// // source["Description"] = destination["Description"]; // Meal Assistance Allowance
// // seqenceNo = 14;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 10)
// // {
// // source["Description"] = destination["Description"]; // Child Education Allowance
// // seqenceNo = 15;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 13)
// // {
// // source["Description"] = destination["Description"]; // Tea Allowance
// // seqenceNo = 16;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 145)
// // {
// // source["Description"] = destination["Description"]; // Hill Allowance
// // seqenceNo = 17;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 93 )
// // {
// // source["Description"] = destination["Description"]; // Technical Allowance
// // seqenceNo = 18;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 105)
// // {
// // source["Description"] = destination["Description"]; // Acting Allowance
// // seqenceNo = 19;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 107)
// // {
// // source["Description"] = destination["Description"]; // T-Shift Allowance
// // seqenceNo = 20;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 106)
// // {
// // source["Description"] = destination["Description"]; // D-Shift Allowance
// // seqenceNo = 21;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 31)
// // {
// // source["Description"] = destination["Description"]; // One Off Allowance
// // seqenceNo = 22;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 14)
// // {
// // source["Description"] = destination["Description"]; // Meal Assistance Allowance
// // seqenceNo = 23;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 144)
// // {
// // source["Description"] = destination["Description"]; // Medical Clame
// // seqenceNo = 24;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Allowance) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Gross) && Convert.ToInt16(destination["ItemID"]) == 82)
// // {
// // source["Description"] = destination["Description"]; // Conveyance
// // seqenceNo = 25;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.PF_Contribution) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions))
// // {
// // source["Description"] = destination["Description"]; // PF
// // seqenceNo = 27;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.PF_Contribution) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Arrear))
// // {
// // source["Description"] = destination["Description"]; // Pf Arrear
// // seqenceNo = 28;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Inc_Tax_Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions))
// // {
// // source["Description"] = destination["Description"]; // Income Tax
// // seqenceNo = 29;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 117)
// // {
// // source["Description"] = destination["Description"]; // Sci- Mobile
// // seqenceNo = 30;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Installment) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 1)
// // {
// // source["Description"] = destination["Description"];//House Rent Advance
// // seqenceNo = 31;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 1)
// // {
// // source["Description"] = destination["Description"];//House Rent Advance interest
// // seqenceNo = 32;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Installment) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 2)
// // {
// // source["Description"] = destination["Description"];// Religious
// // seqenceNo = 33;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 2)
// // {
// // source["Description"] = destination["Description"];// Religious Interest
// // seqenceNo = 34;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 122)
// // {
// // source["Description"] = destination["Description"]; //Sci- Others
// // seqenceNo = 35;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 134)
// // {
// // source["Description"] = destination["Description"];//Recognitio Reward ( Gift Card)
// // seqenceNo = 36;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Installment) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 4)
// // {
// // source["Description"] = destination["Description"];//House Building
// // seqenceNo = 37;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 4)
// // {
// // source["Description"] = destination["Description"];//House Building Interest
// // seqenceNo = 38;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 148)
// // {
// // source["Description"] = destination["Description"]; //Shift Allowance Adj
// // seqenceNo = 39;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Installment) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "House Building-PF Loan (Installment)")
// // {
// // source["Description"] = destination["Description"]; //House Building-PF Loan Installment
// // seqenceNo = 40;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "House Building-PF Loan (Interest)")
// // {
// // source["Description"] = destination["Description"]; //House Building-PF Loan Interest
// // seqenceNo = 41;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Installment) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "Co-Operative-General Loan (Installment)")
// // {
// // source["Description"] = destination["Description"]; //Co-Operative-General Loan Installment
// // seqenceNo = 42;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "Co-Operative-General Loan (Interest)")
// // {
// // source["Description"] = destination["Description"]; //Co-Operative-General Loan Interest
// // seqenceNo = 43;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Installment) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "Religious-PF Loan (Installment)")
// // {
// // source["Description"] = destination["Description"]; //Religious-PF Loan Loan Installment
// // seqenceNo = 44;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "Religious-PF Loan (Interest)")
// // {
// // source["Description"] = destination["Description"]; //Religious-PF Loan Loan Interest
// // seqenceNo = 45;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Installment) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "House Rent Advance Installment(House Building)")
// // {
// // source["Description"] = destination["Description"]; //House Rent Advance Installment
// // seqenceNo = 46;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Loan_Monthly_Interest) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "House Rent Advance Interest(House Building)")
// // {
// // source["Description"] = destination["Description"]; //House Rent Advance Interest
// // seqenceNo = 47;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToInt16(destination["ItemID"]) == 160)
// // {
// // source["Description"] = destination["Description"]; //Out Station Installment
// // seqenceNo = 48;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "Union Subscription")
// // {
// // source["Description"] = destination["Description"]; //Union Subscription
// // seqenceNo = 49;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Deduction) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.Deductions) && Convert.ToString(destination["Description"]) == "Vehicle Deduction")
// // {
// // source["Description"] = destination["Description"]; //Vehical Deduction
// // seqenceNo = 50;
// // source["SequenceNo"] = seqenceNo;
// // }
// // else if (Convert.ToInt16(destination["ItemCode"]) == Convert.ToInt16(EnumSalaryItemCode.Net_Payable) && Convert.ToInt16(destination["ItemGroup"]) == Convert.ToInt16(EnumSalaryGroup.OtherItem) && Convert.ToInt16(destination["ItemID"]) == -132)
// // {
// // source["Description"] = destination["Description"]; //Net Pay
// // seqenceNo = 52;
// // source["SequenceNo"] = seqenceNo;
// // }
// //}
// //source["Description"] = destination["Description"];
// //if (Convert.ToInt32(destination["Amount"]) <= 0)
// //{
// // source["Amount"] = 0.0;
// //}
// //else
// //{
// // source["Amount"] = destination["Amount"];
// //}
// //source["SalaryMonth"] = _SalaryMonth;
// //source["JoiningDate"] = destination["JoiningDate"];
// //source["CC"] = destination["CCName"];
// //source["OrdBasic"] = destination["THISMONTHBASIC"];
// #endregion
// //source["SLNo"] = destination["EMPLOYEEID"];
// }
// private void CopyForCasual(DataRow source, DataRow destination)
// {
// //source["JoiningDate"] = destination["JoiningDate"];
// //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++;
// }
// 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["Grade"] = destination["GName"];
// source["Department"] = destination["DName"];
// source["Description"] = destination["Description"];
// source["Amount"] = destination["Amount"];
// source["SalaryMonth"] = _SalaryMonth;
// //source["JoiningDate"] = destination["JoiningDate"];
// //source["SLNo"] = destination["EMPLOYEEID"];
// //}
// }
// private void CopySalary(DataRow source, DataRow destination)
// {
// 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["EmpNo"] = destination["EMPLOYEENO"];
// source["EmpName"] = destination["Name"];
// source["Grade"] = destination["GName"];
// source["Designation"] = destination["DName"];
// source["Department"] = destination["Dept"];
// source["Description"] = destination["Description"];
// source["JoiningDate"] = destination["JoiningDate"];
// source["Amount"] = GlobalFunctions.Round(Convert.ToDouble(destination["Amount"]));
// source["SalaryMonth"] = _SalaryMonth;
// }
// private void CopySalaryContra(DataRow source, DataRow destination)
// {
// 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["EmpNo"] = destination["EMPLOYEENO"];
// source["EmpName"] = destination["Name"];
// source["Grade"] = destination["GName"];
// source["Designation"] = destination["DName"];
// source["Department"] = destination["Dept"];
// source["Description"] = "";
// source["JoiningDate"] = destination["JoiningDate"];
// source["Amount"] = -GlobalFunctions.Round(Convert.ToDouble(destination["Amount"]));
// source["SalaryMonth"] = _SalaryMonth;
// }
// public void ShowreportForManagement()
// {
// int payrollTypeID = BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer;
// if (payrollTypeID == 1)
// {
// ShowReportWithArreaForManagement();
// }
// else
// {
// ShowReportWithArrearForNonManagement();
// }
// }
// public void ShowReportWithArreaForManagement()
// {
// _costCenters = Costcenter.Get();
// _empCostCenters = EmployeeCostCenter.Get();
// _employees = Employee.Get();
// fReportViewer form = new fReportViewer();
// _SalaryMonth = _selectedParameter.FromDate.Value;
// ID nReportID = _selectedParameter.ReportItem.ReportID;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// ObjectsTemplate<SalaryMonthly> sMonthly = SalaryMonthly.Get(sEmpID, _SalaryMonth);
// oSalarySheets = SalaryMonthly.GetEmpSalarySheetForManagement(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
// List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -113).GroupBy(y => Convert.ToDouble(y["ItemID"].ToString())).Select(o => o.Key.ToString()).ToList();
// List<string> OTs = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -103).GroupBy(y => Convert.ToDouble(y["ItemID"].ToString())).Select(o => o.Key.ToString()).ToList();
// List<string> deductions = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDouble(x["ItemCode"].ToString()) != -118).GroupBy(y => Convert.ToDouble(y["ItemID"].ToString())).Select(o => o.Key.ToString()).ToList();
// List<string> Loans = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDouble(x["ItemCode"].ToString()) == -118).GroupBy(y => Convert.ToDouble(y["ItemID"].ToString())).Select(o => o.Key.ToString()).ToList();
// oSalarySheets.Tables["TotalGross"].Columns.Add("SequenceNo");
// oSalarySheets.Tables["TotalDeduction"].Columns.Add("SequenceNo");
// //oSalarySheets.Tables["NetPay"].Columns.Add("SequenceNo");
// int seq = 1;
// foreach (string comp in components)
// {
// switch (comp)
// {
// case "Basic":
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -101);
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 4 && Convert.ToDouble(x["ItemCode"].ToString()) == -101 && Convert.ToDouble(x["ItemID"].ToString()) == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -101 && Convert.ToDouble(x["ItemID"].ToString()) == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 8 && Convert.ToDouble(x["ItemCode") == -101).CopyToDataTable();
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 8 && Convert.ToDouble(x["ItemCode"].ToString()) == -101 && Convert.ToDouble(x["ItemID"].ToString()) == -101))
// {
// dr["SequenceNo"] = seq;
// }
// break;
// case "Allowance":
// foreach (string allwid in allowances)
// {
// seq++;
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -113 && Convert.ToDouble(x["ItemID").ToString() == allwid).CopyToDataTable();
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -113 && Convert.ToDouble(x["ItemID"].ToString()).ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 8 && Convert.ToDouble(x["ItemCode"].ToString()) == -113 && Convert.ToDouble(x["ItemID"].ToString()).ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "OT":
// foreach (string id in OTs)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -113 && Convert.ToDouble(x["ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 1 && Convert.ToDouble(x["ItemCode"].ToString()) == -103 && x["ItemID"].ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 8 && Convert.ToDouble(x["ItemCode"].ToString()) == -103 && x["ItemID"].ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDecimal(x["ItemGroup"].ToString()) == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave)))
// {
// dr["SequenceNo"] = seq;
// dr["DESCRIPTION"] = "Leave Adj.";
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["TotalGross"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// break;
// case "Deduction":
// foreach (string id in deductions)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -113 && Convert.ToDouble(x["ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDouble(x["ItemCode"].ToString()) != -118 && x["ItemID"].ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 8 && Convert.ToDouble(x["ItemCode"].ToString()) != -118 && x["ItemID"].ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "Loan":
// foreach (string id in Loans)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup") == 1 && Convert.ToDouble(x["ItemCode") == -113 && Convert.ToDouble(x["ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDecimal(x["ItemCode"].ToString()) == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && x["ItemID"].ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => Convert.ToDouble(x["ItemGroup"].ToString()) == 3 && Convert.ToDecimal(x["ItemCode"].ToString()) == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x["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;
// }
// break;
// default:
// break;
// }
// }
// #region Loop Start
// foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// #region Unused Code
// //foreach (DataRow source in oSalarySheets.Tables["TotalAllowance"].Rows)
// //{
// // oDR = dTSalarySheet.NewRow();
// // this.Copy(oDR, source);
// // dTSalarySheet.Rows.Add(oDR);
// //}
// //foreach (DataRow source in oSalarySheets.Tables["TotalIncome"].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["LeaveDays"].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["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);
// //}
// #endregion
// #endregion
// form.ShowDlgForSalarySheet(_selectedParameter.ReportItem, dTSalarySheet, nReportID);
// Pivot pvt = new Pivot(dTSalarySheet);
// DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
// }
// public void ShowReportWithArrearForNonManagement()
// {
// fReportViewer form = new fReportViewer();
// _SalaryMonth = _selectedParameter.FromDate.Value;
// ID nReportID = _selectedParameter.ReportItem.ReportID;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// ObjectsTemplate<SalaryMonthly> sMonthly = SalaryMonthly.Get(sEmpID, _SalaryMonth);
// oSalarySheets = SalaryMonthly.GetEmpSalarySheetForNonManagement(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan"};
// List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> OTs = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -103).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> deductions = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") != -118).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> Loans = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == -118).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// oSalarySheets.Tables["TotalGross"].Columns.Add("SequenceNo");
// oSalarySheets.Tables["TotalDeduction"].Columns.Add("SequenceNo");
// //oSalarySheets.Tables["NetPay"].Columns.Add("SequenceNo");
// int seq = 1;
// foreach (string comp in components)
// {
// switch (comp)
// {
// case "Basic":
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101);
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 4 && x.Field<decimal>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101).CopyToDataTable();
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101))
// {
// 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<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "OT":
// foreach (string id in OTs)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -103 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -103 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave) ))
// {
// dr["SequenceNo"] = seq;
// dr["Description"] = "Leave Adj.";
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["TotalGross"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// break;
// case "Deduction":
// foreach (string id in deductions)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") != -118 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") != -118 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "Loan":
// foreach (string id in Loans)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x.Field<decimal>("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;
// }
// break;
// default:
// break;
// }
// }
// #region Loop Start
// foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// #endregion
// //dTSalarySheet = (Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable)(dTSalarySheet.AsEnumerable().OrderBy(x => x.Field<string>("EmpNo")).ThenBy(y => y.Field<int>("SequenceNo")).CopyToDataTable());
// form.ShowDlgForSalarySheetNonMngt(_selectedParameter.ReportItem, dTSalarySheet, nReportID);
// Pivot pvt = new Pivot(dTSalarySheet);
// DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
// }
// public void ShowReportForNonManagement()
// {
// fReportViewer form = new fReportViewer();
// _SalaryMonth = _selectedParameter.FromDate.Value;
// ID nReportID = _selectedParameter.ReportItem.ReportID;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// ObjectsTemplate<SalaryMonthly> sMonthly = SalaryMonthly.Get(sEmpID, _SalaryMonth);
// _costCenters = Costcenter.Get();
// _empCostCenters = EmployeeCostCenter.Get();
// _employees = Employee.Get();
// oSalarySheets = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave)))
// {
// //dr["SequenceNo"] = seq;
// dr["Description"] = "Leave Adj.";
// }
// #region Loop Start
// foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
// {
// if (source["ItemGroup"].ToString() != "4")
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyNonManagement(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyNonManagement(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyNonManagement(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyNonManagement(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyNonManagement(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// #endregion
// //return dTSalarySheet;
// form.ShowDlgForSalarySheet(_selectedParameter.ReportItem, dTSalarySheet, nReportID);
// Pivot pvt = new Pivot(dTSalarySheet);
// DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
// //_reportSetup.FromDate.Value, _reportitem.ReportID, sEmpID
// }
// public void ShowReport()
// {
// ShowReportForNonManagement();
// }
// public DataTable GetReport(DateTime dMonth,ID nRepID,string sEmpIDs)
// {
// fReportViewer form = new fReportViewer();
// _SalaryMonth = dMonth;
// ID nReportID = nRepID;
// string sEmpID = sEmpIDs;
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// ObjectsTemplate<SalaryMonthly> sMonthly = SalaryMonthly.Get(sEmpID, _SalaryMonth);
// oSalarySheets = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
// List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> OTs = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -103).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> deductions = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") != -118).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> Loans = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == -118).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// oSalarySheets.Tables["TotalGross"].Columns.Add("SequenceNo");
// oSalarySheets.Tables["TotalDeduction"].Columns.Add("SequenceNo");
// oSalarySheets.Tables["NetPay"].Columns.Add("SequenceNo");
// int seq = 1;
// foreach (string comp in components)
// {
// switch (comp)
// {
// case "Basic":
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101);
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 4 && x.Field<decimal>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101).CopyToDataTable();
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101))
// {
// 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<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "OT":
// foreach (string id in OTs)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -103 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -103 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave)))
// {
// dr["SequenceNo"] = seq;
// dr["Description"] = "Leave Adj.";
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["TotalGross"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// break;
// case "Deduction":
// foreach (string id in deductions)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") != -118 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") != -118 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "Loan":
// foreach (string id in Loans)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x.Field<decimal>("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;
// }
// break;
// default:
// break;
// }
// }
// #region Loop Start
// foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
// {
// if (source["ItemGroup"].ToString() != "4")
// {
// 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["DeductItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// 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);
// }
// #endregion
// //DataTable dt = dTSalarySheet.AsEnumerable().OrderBy(x => x.Field<int>("SequenceNo")).CopyToDataTable();
// var itemsTable = dTSalarySheet.AsEnumerable().OrderBy(x=>x.Field<int>("SequenceNo")).Select(x => new { ColumnName = x.Field<string>("Description")}).Distinct().ToList();
// Pivot pvt = new Pivot(dTSalarySheet);
// DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
// DataTable dt = new DataTable();
// DataRow row = null;
// dt.Columns.Add("EmpNo");
// foreach (var item in itemsTable)
// {
// dt.Columns.Add(item.ColumnName);
// }
// foreach (DataRow old in ddt.Rows)
// {
// row = dt.NewRow();
// foreach (DataColumn item in ddt.Columns)
// {
// row[item.ColumnName] = old[item.ColumnName];
// }
// dt.Rows.Add(row);
// }
// return dt;
// }
// public DataTable GetReportWithArear(DateTime dMonth, ID nRepID, string sEmpIDs)
// {
// _SalaryMonth = dMonth;
// ID nReportID = nRepID;
// string sEmpID = sEmpIDs;
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// ObjectsTemplate<SalaryMonthly> sMonthly = SalaryMonthly.Get(sEmpID, _SalaryMonth);
// int payrollTypeID = BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer;
// if (payrollTypeID == 1)
// {
// oSalarySheets = SalaryMonthly.GetEmpSalarySheetForManagement(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// }
// else
// {
// oSalarySheets = SalaryMonthly.GetEmpSalarySheetForNonManagement(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// }
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
// List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> OTs = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -103).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> deductions = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") != -118).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> Loans = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == -118).GroupBy(y => y.Field<decimal>("ItemID")).Select(o => o.Key.ToString()).ToList();
// oSalarySheets.Tables["TotalGross"].Columns.Add("SequenceNo");
// oSalarySheets.Tables["TotalDeduction"].Columns.Add("SequenceNo");
// oSalarySheets.Tables["NetPay"].Columns.Add("SequenceNo");
// int seq = 1;
// foreach (string comp in components)
// {
// switch (comp)
// {
// case "Basic":
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101);
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 4 && x.Field<decimal>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101).CopyToDataTable();
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101))
// {
// 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<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "OT":
// foreach (string id in OTs)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -103 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -103 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave)))
// {
// dr["SequenceNo"] = seq;
// dr["Description"] = "Leave Adj.";
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["TotalGross"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// break;
// case "Deduction":
// foreach (string id in deductions)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") != -118 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") != -118 && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "Loan":
// foreach (string id in Loans)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && x.Field<decimal>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 3 && x.Field<decimal>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x.Field<decimal>("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;
// }
// break;
// default:
// break;
// }
// }
// #region Loop Start
// foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyWithArrear(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// #endregion
// Pivot pvt = new Pivot(dTSalarySheet);
// DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
// var itemsTable = dTSalarySheet.AsEnumerable().OrderBy(x=>x.Field<int>("SequenceNo")).Select(x => new { ColumnName = x.Field<string>("Description")}).Distinct().ToList();
// DataTable dt = new DataTable();
// DataRow row = null;
// dt.Columns.Add("EmpNo");
// foreach (var item in itemsTable)
// {
// dt.Columns.Add(item.ColumnName);
// }
// foreach (DataRow old in ddt.Rows)
// {
// row = dt.NewRow();
// foreach (DataColumn item in ddt.Columns)
// {
// row[item.ColumnName] = old[item.ColumnName];
// }
// dt.Rows.Add(row);
// }
// return dt;
// }
// public void ShowSalarySheetReportNew()
// {
// fReportViewer form = new fReportViewer();
// _SalaryMonth = _selectedParameter.FromDate.Value;
// ID nReportID = _selectedParameter.ReportItem.ReportID;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// DataRow oDR = null;
// DataSet oPaySlips = new DataSet();
// double dnetPay = 0;
// List<SalaryMonthly> oSalaryMonthlys = SalaryMonthly.Get(sEmpID, _SalaryMonth.LastDateOfMonth());
// List<Department> oDepartments = Department.Get();
// List<Grade> oGrades = Grade.Get(EnumStatus.Regardless);
// List<SalaryMonthly> tempBasicItem = new List<SalaryMonthly>();
// List<SalaryMonthly> tempDeductItem = new List<SalaryMonthly>();
// DataSet dset = null;
// DataRow dr = null;
// int nGross = 0;
// int nDeduct = 0;
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// double totalGross = 0;
// double deductTotal = 0;
// int n = 0;
// oSalaryMonthlys = oSalaryMonthlys.OrderByDescending(o => o.Details.Count).ToList();
// foreach (SalaryMonthly itemMonthly in oSalaryMonthlys)
// {
// int gg = 0;
// int dd = 0;
// totalGross = 0;
// deductTotal = 0;
// int medical = itemMonthly.Details.Where(o => o.itemGroupCode == EnumSalaryGroup.Gross && o.ItemCode == EnumSalaryItemCode.Allowance && o.ItemID == 142).Count();
// nGross = itemMonthly.Details.Where(o => o.itemGroupCode == EnumSalaryGroup.Gross).Count();
// nDeduct = itemMonthly.Details.Where(o => o.itemGroupCode == EnumSalaryGroup.Deductions).Count();
// var temp = itemMonthly.Details.OrderBy(o => o.itemGroupCode == EnumSalaryGroup.OtherItem).ThenBy(o => o.itemGroupCode == EnumSalaryGroup.Deductions).ThenBy(o => o.itemGroupCode == EnumSalaryGroup.Miscellaneous).ThenBy(o => o.itemGroupCode == EnumSalaryGroup.OtherItem).ThenBy(o => o.itemGroupCode == EnumSalaryGroup.UnauthLeave).ThenBy(o => o.itemGroupCode == EnumSalaryGroup.Gross);
// foreach (SalaryMonthlyDetail oDetail in temp)
// {
// if (oDetail.itemGroupCode == EnumSalaryGroup.Gross)
// {
// gg++;
// }
// if (oDetail.itemGroupCode == EnumSalaryGroup.Deductions)
// {
// dd++;
// }
// if ((oDetail.itemGroupCode == EnumSalaryGroup.Gross) && gg <= nGross)
// {
// dr = dTSalarySheet.NewRow();
// dr["EmpName"] = itemMonthly.Employee.Name;
// dr["JoiningDate"] = itemMonthly.Employee.JoiningDate.ToString("dd MMM yyyy");
// dr["EmpNo"] = itemMonthly.Employee.EmployeeNo;
// Department dept = oDepartments.Find(x => x.ID == itemMonthly.Employee.DepartmentID);
// if (dept != null)
// {
// dr["Department"] = dept.Name;
// }
// Grade grd = oGrades.Find(x => x.ID == itemMonthly.Employee.GradeID);
// if (grd != null)
// {
// dr["Grade"] = grd.Name;
// }
// dr["SalaryMonth"] = _SalaryMonth.LastDateOfMonth();
// dr["Amount"] = oDetail.ChangedAmount;
// totalGross += Convert.ToDouble(dr["Amount"]);
// dr["Description"] = oDetail.Description;
// dTSalarySheet.Rows.Add(dr);
// }
// if (medical == 0)
// {
// dr = dTSalarySheet.NewRow();
// dr["EmpName"] = itemMonthly.Employee.Name;
// dr["JoiningDate"] = itemMonthly.Employee.JoiningDate.ToString("dd MMM yyyy");
// dr["EmpNo"] = itemMonthly.Employee.EmployeeNo;
// Department dept = oDepartments.Find(x => x.ID == itemMonthly.Employee.DepartmentID);
// if (dept != null)
// {
// dr["Department"] = dept.Name;
// }
// Grade grd = oGrades.Find(x => x.ID == itemMonthly.Employee.GradeID);
// if (grd != null)
// {
// dr["Grade"] = grd.Name;
// }
// dr["SalaryMonth"] = _SalaryMonth.LastDateOfMonth();
// dr["Amount"] = 0;
// //totalGross += Convert.ToDouble(dr["Amount"]);
// dr["Description"] = "Medical";
// dTSalarySheet.Rows.Add(dr);
// }
// if (oDetail.itemGroupCode == EnumSalaryGroup.Gross && gg == nGross)
// {
// dr = dTSalarySheet.NewRow();
// dr["EmpName"] = itemMonthly.Employee.Name;
// dr["JoiningDate"] = itemMonthly.Employee.JoiningDate.ToString("dd MMM yyyy");
// dr["EmpNo"] = itemMonthly.Employee.EmployeeNo;
// Department dept = oDepartments.Find(x => x.ID == itemMonthly.Employee.DepartmentID);
// if (dept != null)
// {
// dr["Department"] = dept.Name;
// }
// Grade grd = oGrades.Find(x => x.ID == itemMonthly.Employee.GradeID);
// if (grd != null)
// {
// dr["Grade"] = grd.Name;
// }
// dr["SalaryMonth"] = _SalaryMonth.LastDateOfMonth();
// dr["Amount"] = totalGross;
// //totalGross += Convert.ToDouble(dr["Amount"]);
// dr["Description"] = "Total Gross";
// dTSalarySheet.Rows.Add(dr);
// }
// //grs++;
// if (oDetail.itemGroupCode == EnumSalaryGroup.Deductions && dd <= nDeduct)
// {
// dr = dTSalarySheet.NewRow();
// dr["EmpName"] = itemMonthly.Employee.Name;
// dr["JoiningDate"] = itemMonthly.Employee.JoiningDate.ToString("dd MMM yyyy");
// dr["EmpNo"] = itemMonthly.Employee.EmployeeNo;
// Department dept = oDepartments.Find(x => x.ID == itemMonthly.Employee.DepartmentID);
// if (dept != null)
// {
// dr["Department"] = dept.Name;
// }
// Grade grd = oGrades.Find(x => x.ID == itemMonthly.Employee.GradeID);
// if (grd != null)
// {
// dr["Grade"] = grd.Name;
// }
// dr["SalaryMonth"] = _SalaryMonth.LastDateOfMonth();
// dr["Amount"] = oDetail.ChangedAmount;
// deductTotal += Convert.ToDouble(dr["Amount"]);
// dr["Description"] = oDetail.Description;
// dTSalarySheet.Rows.Add(dr);
// }
// if (oDetail.itemGroupCode == EnumSalaryGroup.Deductions && dd == nDeduct)
// {
// dr = dTSalarySheet.NewRow();
// dr["EmpName"] = itemMonthly.Employee.Name;
// dr["JoiningDate"] = itemMonthly.Employee.JoiningDate.ToString("dd MMM yyyy");
// dr["EmpNo"] = itemMonthly.Employee.EmployeeNo;
// Department dept = oDepartments.Find(x => x.ID == itemMonthly.Employee.DepartmentID);
// if (dept != null)
// {
// dr["Department"] = dept.Name;
// }
// Grade grd = oGrades.Find(x => x.ID == itemMonthly.Employee.GradeID);
// if (grd != null)
// {
// dr["Grade"] = grd.Name;
// }
// dr["SalaryMonth"] = _SalaryMonth.LastDateOfMonth();
// dr["Amount"] = deductTotal;
// //totalGross += Convert.ToDouble(dr["Amount"]);
// dr["Description"] = "Total Deduct";
// dTSalarySheet.Rows.Add(dr);
// }
// if (oDetail.itemGroupCode == EnumSalaryGroup.OtherItem && oDetail.ItemCode == EnumSalaryItemCode.Net_Payable)
// {
// dr = dTSalarySheet.NewRow();
// dr["EmpName"] = itemMonthly.Employee.Name;
// dr["JoiningDate"] = itemMonthly.Employee.JoiningDate.ToString("dd MMM yyyy");
// dr["EmpNo"] = itemMonthly.Employee.EmployeeNo;
// Department dept = oDepartments.Find(x => x.ID == itemMonthly.Employee.DepartmentID);
// if (dept != null)
// {
// dr["Department"] = dept.Name;
// }
// Grade grd = oGrades.Find(x => x.ID == itemMonthly.Employee.GradeID);
// if (grd != null)
// {
// dr["Grade"] = grd.Name;
// }
// dr["SalaryMonth"] = _SalaryMonth.LastDateOfMonth();
// dr["Amount"] = oDetail.ChangedAmount;
// dr["Description"] = "Net pay";
// dTSalarySheet.Rows.Add(dr);
// }
// }
// }
// form.ShowDlgForSalarySheet(_selectedParameter.ReportItem, dTSalarySheet, nReportID);
// }
// public void ShowCasualWorkSheetReport()
// {
// fReportViewer form = new fReportViewer();
// _SalaryMonth = _selectedParameter.FromDate.Value;
// ID nReportID = _selectedParameter.ReportItem.ReportID;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// ObjectsTemplate<Employee> emps = Employee.GetByEmpIDs(sEmpID);
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// oSalarySheets = SalaryMonthly.GetCasualSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// PayrollDataSet.PayrollDataSet.CasualSalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.CasualSalarySheetDataTable();
// ObjectsTemplate<ADParameterEmployee> indvAllowances = ADParameterEmployee.Get(
// GlobalFunctions.FirstDateOfMonth(_SalaryMonth),
// GlobalFunctions.LastDateOfMonth(_SalaryMonth));
// double total = 0;
// foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
// {
// if (tempEmpID == string.Empty)
// {
// oDR = dTSalarySheet.NewRow();
// tempEmpID = Convert.ToString(source["EMPLOYEENO"]);
// oDR["SLNo"] = count;
// oDR["EmpNo"] = source["EMPLOYEENO"];
// oDR["EmpName"] = source["Name"];
// oDR["Grade"] = source["GName"];
// oDR["Department"] = source["DName"];
// oDR["Designation"] = source["DegName"];
// oDR["SalaryMonth"] = _SalaryMonth;
// count++;
// total = 0;
// }
// if (tempEmpID != Convert.ToString(source["EMPLOYEENO"]))
// {
// dTSalarySheet.Rows.Add(oDR);
// oDR = dTSalarySheet.NewRow();
// tempEmpID = Convert.ToString(source["EMPLOYEENO"]);
// oDR["SLNo"] = count;
// oDR["EmpNo"] = source["EMPLOYEENO"];
// oDR["EmpName"] = source["Name"];
// oDR["Grade"] = source["GName"];
// oDR["Department"] = source["DName"];
// oDR["Designation"] = source["DegName"];
// oDR["SalaryMonth"] = _SalaryMonth;
// count++;
// total = 0;
// }
// ADParameterEmployee adEmp = indvAllowances.FirstOrDefault(x => x.EmployeeID.Integer == Convert.ToInt32(source["EMPLOYEEID"]) && x.ADEmpType == EnumADEmpType.AppliedToIndividual &&
// x.AllowDeductID.Integer == Convert.ToInt32(source["ItemID"]));
// string des = source["Description"].ToString();
// switch (des)
// {
// case "Salary":
// oDR["Amount"] = source["Amount"];
// total += Convert.ToDouble(source["Amount"]);
// break;
// case "Working hour":
// oDR["WorkingHour"] = source["Amount"];
// break;
// case "Overnight Allow (Casual)":
// oDR["NoofNight"] = adEmp.MonthlyAmount;
// oDR["OverNightAmount"] = source["Amount"];
// total += Convert.ToDouble(source["Amount"]);
// break;
// case "Entertainment Allow (Casual)":
// oDR["FEnt"] = adEmp.MonthlyAmount;
// oDR["EntertainmentAmount"] = source["Amount"];
// total += Convert.ToDouble(source["Amount"]);
// break;
// case "Arrear":
// oDR["Arrear"] = source["Amount"];
// total += Convert.ToDouble(source["Amount"]);
// break;
// case "Bonus":
// oDR["Bonus"] = source["Amount"];
// total += Convert.ToDouble(source["Amount"]);
// break;
// default:
// break;
// }
// //source["RatePerHr"] = destination["Amount"];
// //source["NoofNight"] = destination["Amount"];
// // source["FEnt"] = destination["Amount"];
// oDR["Total"] = total;
// }
// dTSalarySheet.Rows.Add(oDR);
// foreach (Employee emp in emps)
// {
// DataRow dr = dTSalarySheet.AsEnumerable().FirstOrDefault(x => x["EmpNo"].ToString() == emp.EmployeeNo);
// if (dr != null)
// {
// dr["RatePerHr"] = Convert.ToDouble(dr["Amount"]) / Convert.ToDouble(dr["WorkingHour"]);
// }
// }
// // dr = dTSalarySheet.AsEnumerable().FirstOrDefault(x => x["EmpNo"].ToString() == emp.EmployeeNo && x["Description"].ToString() == "Overnight Allow (Casual)");
// // if(dr!=null)
// // {
// // ADParameterEmployee adEmp =indvAllowances.FirstOrDefault(x=>x.EmployeeID.Integer == emp.ID.Integer && x.ADEmpType == EnumADEmpType.AppliedToIndividual &&
// // x.AllowDeductID.Integer==Convert.ToInt32(dr["ItemID"]));
// // if (adEmp != null)
// // {
// // oDR = dTSalarySheet.NewRow();
// // oDR["SLNo"] = dr["SLNo"];
// // oDR["EmpNo"] = dr["EmpNo"];
// // oDR["EmpName"] = dr["EmpName"];
// // oDR["Grade"] = dr["Grade"];
// // oDR["Department"] = dr["Department"];
// // oDR["Designation"] = dr["Designation"];
// // oDR["ItemID"] = dr["ItemID"];
// // oDR["Description"] = "No. of Night (Total)";
// // oDR["Amount"] = adEmp.MonthlyAmount;
// // oDR["SalaryMonth"] = dr["SalaryMonth"];
// // dTSalarySheet.Rows.Add(oDR);
// // }
// // }
// // dr = dTSalarySheet.AsEnumerable().FirstOrDefault(x => x["EmpNo"].ToString() == emp.EmployeeNo && x["Description"].ToString() == "Entertainment Allow (Casual)");
// // if (dr != null)
// // {
// // ADParameterEmployee adEmp = indvAllowances.FirstOrDefault(x => x.EmployeeID.Integer == emp.ID.Integer && x.ADEmpType == EnumADEmpType.AppliedToIndividual &&
// // x.AllowDeductID.Integer == Convert.ToInt32(dr["ItemID"]));
// // //ADParameterEmployee items = indvAllowances.FindAll(delegate(ADParameterEmployee item)
// // //{
// // // return item.EmployeeID.Integer == emp.ID.Integer && item.ADEmpType == EnumADEmpType.AppliedToIndividual &&
// // // item.AllowDeductID==;
// // //});
// // if (adEmp != null)
// // {
// // oDR = dTSalarySheet.NewRow();
// // oDR["SLNo"] = dr["SLNo"];
// // oDR["EmpNo"] = dr["EmpNo"];
// // oDR["EmpName"] = dr["EmpName"];
// // oDR["ItemID"] = dr["ItemID"];
// // oDR["Grade"] = dr["Grade"];
// // oDR["Department"] = dr["Department"];
// // oDR["Designation"] = dr["Designation"];
// // oDR["Description"] = "F Ent.(Total)";
// // oDR["Amount"] = adEmp.MonthlyAmount;
// // oDR["SalaryMonth"] = dr["SalaryMonth"];
// // dTSalarySheet.Rows.Add(oDR);
// // }
// // }
// // oDR = dTSalarySheet.NewRow();
// // oDR["SLNo"] = dr["SLNo"];
// // oDR["EmpNo"] = dr["EmpNo"];
// // oDR["EmpName"] = dr["EmpName"];
// // oDR["ItemID"] = dr["ItemID"];
// // oDR["Grade"] = dr["Grade"];
// // oDR["Department"] = dr["Department"];
// // oDR["Designation"] = dr["Designation"];
// // oDR["Description"] = "Received By";
// // oDR["SalaryMonth"] = dr["SalaryMonth"];
// // dTSalarySheet.Rows.Add(oDR);
// // oDR = dTSalarySheet.NewRow();
// // oDR["SLNo"] = dr["SLNo"];
// // oDR["EmpNo"] = dr["EmpNo"];
// // oDR["EmpName"] = dr["EmpName"];
// // oDR["ItemID"] = dr["ItemID"];
// // oDR["Grade"] = dr["Grade"];
// // oDR["Department"] = dr["Department"];
// // oDR["Designation"] = dr["Designation"];
// // oDR["Description"] = "BIO-DATA Signature";
// // oDR["SalaryMonth"] = dr["SalaryMonth"];
// // dTSalarySheet.Rows.Add(oDR);
// //}
// //return dTSalarySheet;
// form.ShowDlgForCasualSalarySheet(_selectedParameter.ReportItem, dTSalarySheet, nReportID);
// }
// public void ShowReportSalarySheetStatic()
// {
// fReportViewer form = new fReportViewer();
// _SalaryMonth = _selectedParameter.FromDate.Value;
// ID nReportID = _selectedParameter.ReportItem.ReportID;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// DataRow oDR = null;
// DataSet oSalarySheets = new DataSet();
// List<SalaryMonthly> oSalaryMonthlys = SalaryMonthly.Get(_SalaryMonth.LastDateOfMonth());
// List<Employee> oEmployees = Employee.GetAllEmps();
// List<Designation> oDesignations = Designation.Get(EnumStatus.Regardless);
// List<Grade> oGrades = Grade.Get(EnumStatus.Regardless);
// List<Department> oDepartments = Department.Get();
// List<Leave> oLeaves = Leave.Get();
// List<AllowanceDeduction> oAllDeducts = AllowanceDeduction.Get(EnumStatus.Regardless);
// PayrollDataSet.PayrollDataSet.SalarySheetStaticDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetStaticDataTable();
// foreach (SalaryMonthly itemMonthly in oSalaryMonthlys)
// {
// DataRow dr = dTable.NewRow();
// Employee oEmp = oEmployees.FirstOrDefault(x => x.ID.Integer == itemMonthly.EmployeeID.Integer);
// dr["Name"] = oEmp.Name;
// dr["JoiningDate"] = oEmp.JoiningDate.ToString("dd MMM yyyy");
// dr["EmpNo"] = oEmp.EmployeeNo;
// Designation oDesig = oDesignations.FirstOrDefault(x => x.ID.Integer == oEmp.DesignationID.Integer);
// if (oDesig != null)
// dr["Designation"] = oDesig.Name;
// // find if employee is assigned to line
// Department dpt = oDepartments.FirstOrDefault(x => x.ID == oEmp.DepartmentID && x.Tier == 5);
// if (dpt != null)
// dr["Line"] = dpt.Name;
// Grade grd = oGrades.FirstOrDefault(x => x.ID.Integer == oEmp.GradeID.Integer);
// if (grd != null)
// dr["Grade"] = grd.Name;
// dr["GroosSalary"] = oEmp.GrossSalary;
// dr["Basic"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Basic_Salary).Sum(x => x.ChangedAmount)
// + itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Basic_Salary).Sum(x => x.ChangedAmount);
// // House rent code: 001
// AllowanceDeduction oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "001");
// if (oAllDeduct != null)
// dr["HouseRent"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount)
// + itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount);
// else
// dr["HouseRent"] = 0;
// // medical code: 003
// oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "003");
// if (oAllDeduct != null)
// dr["Medical"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount)
// + itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount);
// else
// dr["Medical"] = 0;
// // Conveyance code: 002
// oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "002");
// if (oAllDeduct != null)
// dr["Conveyance"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount)
// + itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount);
// else
// dr["Conveyance"] = 0;
// // FoodAllowance code: 004
// oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "004");
// if (oAllDeduct != null)
// dr["FoodAllowance"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount)
// + itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount);
// else
// dr["FoodAllowance"] = 0;
// dr["GrossSalaryOriginal"] = Convert.ToDouble(dr["Basic"]) +
// Convert.ToDouble(dr["HouseRent"]) +
// Convert.ToDouble(dr["Medical"]) +
// Convert.ToDouble(dr["Conveyance"]) +
// Convert.ToDouble(dr["FoodAllowance"]);
// dr["PF"] = Convert.ToDouble(dr["Basic"]) * 0.08; // PF 8% of Basic [From Report]
// dr["TotalDays"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Miscellaneous && x.ItemCode == EnumSalaryItemCode.Total_Days).Sum(x => x.ChangedAmount);
// dr["WorkingDays"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Miscellaneous && x.ItemCode == EnumSalaryItemCode.Tot_Attend_Days).Sum(x => x.ChangedAmount);
// dr["Holiday"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Miscellaneous && x.ItemCode == EnumSalaryItemCode.Total_HoliDays).Sum(x => x.ChangedAmount);
// dr["Absent"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Miscellaneous && x.ItemCode == EnumSalaryItemCode.Tot_UnauthLeave_Days).Sum(x => x.ChangedAmount);
// // variable used if muliple basic deduction exist
// double deductBasic = 0;
// // UnAuthorize Leave Basic Deduct
// deductBasic += itemMonthly
// .Details
// .Where(x => x.itemGroupCode == EnumSalaryGroup.UnauthLeave &&
// x.ItemCode == EnumSalaryItemCode.Basic_Salary)
// .Sum(x => x.ChangedAmount);
// dr["DeductBasic"] = deductBasic;
// dr["DeductSalaryAdvance"] = 0.0;
// dr["DeductPF"] = Convert.ToDouble(dr["PF"]);
// dr["SalaryPayment"] = Convert.ToDouble(dr["GrossSalaryOriginal"]) - (Convert.ToDouble(dr["DeductBasic"]) + Convert.ToDouble(dr["DeductSalaryAdvance"]) + Convert.ToDouble(dr["DeductPF"]));
// dr["OtHour"] = itemMonthly
// .Details
// .Where(x => x.itemGroupCode == EnumSalaryGroup.Miscellaneous &&
// x.ItemCode == EnumSalaryItemCode.Over_Time_Hours)
// .Sum(x => x.ChangedAmount);
// dr["OtPayment"] = itemMonthly
// .Details
// .Where(x => x.itemGroupCode == EnumSalaryGroup.Gross &&
// x.ItemCode == EnumSalaryItemCode.Over_Time_Amount)
// .Sum(x => x.ChangedAmount);
// if (Convert.ToDouble(dr["OtHour"]) > 0)
// dr["OtRate"] = Math.Round(Convert.ToDouble(dr["OtPayment"]) / Convert.ToDouble(dr["OtHour"]), 2);
// else
// dr["OtRate"] = 0.0;
// // Attendence Bonus code: 010
// oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "010");
// if (oAllDeduct != null)
// dr["AttnBonus"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount)
// + itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount);
// else
// dr["AttnBonus"] = 0;
// // Conduct Bonus code: 011
// oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "011");
// if (oAllDeduct != null)
// dr["ConductBonus"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount)
// + itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount);
// else
// dr["ConductBonus"] = 0;
// // Production Bonus code: 009
// oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "009");
// if (oAllDeduct != null)
// dr["TtlBonus"] = itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Gross && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount)
// + itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Arrear && x.ItemCode == EnumSalaryItemCode.Allowance && x.ItemID == oAllDeduct.ID.Integer).Sum(x => x.ChangedAmount);
// else
// dr["TtlBonus"] = 0;
// dr["NetPayment"] = Convert.ToDouble(dr["SalaryPayment"]) + Convert.ToDouble(dr["AttnBonus"]) + Convert.ToDouble(dr["OtPayment"]) + Convert.ToDouble(dr["ConductBonus"]) + Convert.ToDouble(dr["TtlBonus"]);
// List<SalaryMonthlyDetail> oSMDLeaveList
// = itemMonthly
// .Details
// .Where(x => x.itemGroupCode == EnumSalaryGroup.Miscellaneous &&
// x.ItemCode == EnumSalaryItemCode.Leave_Days)
// .ToList();
// Leave currentLeave = null;
// currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "CL");
// if (currentLeave != null)
// dr["CL"] = oSMDLeaveList.Where(x => x.ItemID == currentLeave.ID.Integer)
// .Sum(x => x.ChangedAmount);
// else
// dr["CL"] = 0;
// currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "SL");
// if (currentLeave != null)
// dr["SL"] = oSMDLeaveList.Where(x => x.ItemID == currentLeave.ID.Integer)
// .Sum(x => x.ChangedAmount);
// else
// dr["SL"] = 0;
// currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "EL");
// if (currentLeave != null)
// dr["EL"] = oSMDLeaveList.Where(x => x.ItemID == currentLeave.ID.Integer)
// .Sum(x => x.ChangedAmount);
// else
// dr["EL"] = 0;
// currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "PL");
// if (currentLeave != null)
// dr["PL"] = oSMDLeaveList.Where(x => x.ItemID == currentLeave.ID.Integer)
// .Sum(x => x.ChangedAmount);
// else
// dr["PL"] = 0;
// currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "ML");
// if (currentLeave != null)
// dr["ML"] = oSMDLeaveList.Where(x => x.ItemID == currentLeave.ID.Integer)
// .Sum(x => x.ChangedAmount);
// else
// dr["ML"] = 0;
// currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "LWP");
// if (currentLeave != null)
// dr["LWP"] = oSMDLeaveList.Where(x => x.ItemID == currentLeave.ID.Integer)
// .Sum(x => x.ChangedAmount);
// else
// dr["LWP"] = 0;
// currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "L/OUT");
// if (currentLeave != null)
// dr["LOWT"] = oSMDLeaveList.Where(x => x.ItemID == currentLeave.ID.Integer)
// .Sum(x => x.ChangedAmount);
// else
// dr["LOWT"] = 0;
// dr["Remarks"] = itemMonthly.Remarks;
// dTable.Rows.Add(dr);
// }
// dTable.TableName = "PayrollDataSet_SalarySheetStatic";
// oSalarySheets.Tables.Add(dTable);
// List<Microsoft.Reporting.WinForms.ReportParameter> oReportParams = new List<Microsoft.Reporting.WinForms.ReportParameter>();
// Microsoft.Reporting.WinForms.ReportParameter oRParam = new Microsoft.Reporting.WinForms.ReportParameter("SalaryMonth", _SalaryMonth.ToString("MMM yyyy"));
// oReportParams.Add(oRParam);
// //return dTSalarySheet;
// form.CommonReportViewer(null, "Payroll.Report.RDLC.StaticSalarySheet.rdlc", oSalarySheets, oReportParams);
// }
//public byte[] CCWiseSalarySheet()
//{
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// ObjectsTemplate<Costcenter> _crgs = Costcenter.Get();
// DataSet dsCCWiseSD = SalaryMonthly.GetCCWiseSalarySheetDetail(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// PayrollDataSet.PayrollDataSet.CCWSalaryDetailDataTable dCCWSDetail = new Payroll.Report.PayrollDataSet.PayrollDataSet.CCWSalaryDetailDataTable();
// foreach (DataRow oDR in dsCCWiseSD.Tables[0].Rows)
// {
// Costcenter oCost = _crgs.Find(delegate (Costcenter occ) { return occ.Code == oDR["Code"].ToString(); });
// DataRow oD = dCCWSDetail.NewRow();
// oD["EmpNo"] = oDR["EmployeeNo"];
// oD["Name"] = oDR["Name"];
// oD["Code"] = oDR["Code"];
// oD["CostCenter"] = oCost.Name;
// oD["Department"] = oDR["Description"];
// oD["InvolveAmount"] = oDR["GrossAmount"];
// oD["PFAmount"] = 0;//oDR["PFAmount"];
// dCCWSDetail.Rows.Add(oD);
// }
// foreach (DataRow oDR in dsCCWiseSD.Tables[1].Rows)
// {
// DataRow[] dRows = dCCWSDetail.Select("EmpNo='" + oDR["EmployeeNo"].ToString() + "'");
// if (dRows.Length > 0)
// {
// dRows[0]["InvolveAmount"] = Convert.ToDouble(dRows[0]["InvolveAmount"]) + Convert.ToDouble(oDR["GrossArrear"]);
// }
// }
// foreach (DataRow oDR in dsCCWiseSD.Tables[2].Rows)
// {
// DataRow[] dRows = dCCWSDetail.Select("EmpNo='" + oDR["EmployeeNo"].ToString() + "'");
// if (dRows.Length > 0)
// {
// dRows[0]["PFAmount"] = oDR["PFAmount"];
// }
// }
// ReportProcessor reportProcessor = new ReportProcessor();
// return reportProcessor.ShowDlgForSalarySheet(null, dCCWSDetail, nReportID, reportType, payrollTypeId);
// //form.ShowDlgForCCWiswSalaryDetails(_selectedParameter.ReportItem, dCCWSDetail, salaryMonth);
//}
// public DataTable SGSSalarySheet(DateTime dSalaryMonth, string sEmpID)
// {
// _SalaryMonth = dSalaryMonth;
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// oSalarySheets = SalaryMonthly.GetSGSSalarySheet(dSalaryMonth, sEmpID);
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// foreach (DataRow source in oSalarySheets.Tables[0].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[1].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[2].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[3].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[4].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[5].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[6].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.Copy(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// return dTSalarySheet;
// }
// private void CopyForExtendedSSheet(DataRow source, DataRow destination)
// {
// 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["EmpNo"] = destination["EMPLOYEENO"];
// source["EmpName"] = destination["Name"];
// source["Grade"] = destination["GName"];
// source["Department"] = destination["DName"];
// source["Description"] = destination["Description"];
// source["Amount"] = destination["Amount"];
// source["SalaryMonth"] = _SalaryMonth;
// source["Designation"] = destination["DGName"];
// source["DOJ"] = destination["JOININGDATE"];
// source["DOC"] = destination["DATEOFCONFIRMATION"];
// source["Resource"] = destination["CDescription"];
// //source["SLNo"] = destination["EMPLOYEEID"];
// }
// public DataTable ExtendedSalarySheet(DateTime dSalaryMonth, string sEmpID)
// {
// _SalaryMonth = dSalaryMonth;
// DataRow oDR = null;
// DataSet oExtendedSalarySheets = null;
// oExtendedSalarySheets = SalaryMonthly.GetExtendedSalarySheet(dSalaryMonth, sEmpID);
// PayrollDataSet.PayrollDataSet.ExtendedSalarySheetDataTable dTExtendedSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.ExtendedSalarySheetDataTable();
// foreach (DataRow source in oExtendedSalarySheets.Tables[0].Rows)
// {
// oDR = dTExtendedSalarySheet.NewRow();
// this.CopyForExtendedSSheet(oDR, source);
// dTExtendedSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oExtendedSalarySheets.Tables[1].Rows)
// {
// oDR = dTExtendedSalarySheet.NewRow();
// this.CopyForExtendedSSheet(oDR, source);
// dTExtendedSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oExtendedSalarySheets.Tables[2].Rows)
// {
// oDR = dTExtendedSalarySheet.NewRow();
// this.CopyForExtendedSSheet(oDR, source);
// dTExtendedSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oExtendedSalarySheets.Tables[3].Rows)
// {
// oDR = dTExtendedSalarySheet.NewRow();
// this.CopyForExtendedSSheet(oDR, source);
// dTExtendedSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oExtendedSalarySheets.Tables[4].Rows)
// {
// oDR = dTExtendedSalarySheet.NewRow();
// this.CopyForExtendedSSheet(oDR, source);
// dTExtendedSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oExtendedSalarySheets.Tables[5].Rows)
// {
// oDR = dTExtendedSalarySheet.NewRow();
// this.CopyForExtendedSSheet(oDR, source);
// dTExtendedSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oExtendedSalarySheets.Tables[6].Rows)
// {
// oDR = dTExtendedSalarySheet.NewRow();
// this.CopyForExtendedSSheet(oDR, source);
// dTExtendedSalarySheet.Rows.Add(oDR);
// }
// return dTExtendedSalarySheet;
// }
// private void Copy(DataRow destination, bool IsPrv)
// {
// DataRow oDR = null;
// oDR = _salaryRecon.NewRow();
// oDR["EmpNo"] = destination["EMPLOYEENO"];
// oDR["Name"] = destination["Name"];
// oDR["ColDes"] = destination["Description"];
// oDR["SalaryMonth2"] = _selectedParameter.FromDate.Value;
// oDR["SalaryMonth1"] = _selectedParameter.ToDate.Value;
// oDR["TotalEmp"] = TotalEmp;
// oDR["SequenceNo"] = destination["SequenceNo"];
// if (IsPrv == false)
// {
// if (oDR["ColValue2"].ToString() == string.Empty)
// oDR["ColValue2"] = destination["Amount"];
// else oDR["ColValue2"] = Convert.ToDouble(oDR["ColValue2"]) + Convert.ToDouble(destination["Amount"]);
// //oDR["ColValue2"] = destination["Amount"];
// }
// if (IsPrv == true)
// {
// //DataRow[] oRows = _salaryRecon.Select("EmpNo='" + destination["EMPLOYEENO"].ToString() + "'" + "AND ColDes='" + destination["Description"].ToString() + "'");
// DataRow[] oRows = _salaryRecon
// .Where(x => x.ColDes.ToString() == destination["Description"].ToString()
// && x.EmpNo.ToString() == destination["EMPLOYEENO"].ToString())
// .ToArray();
// if (oRows != null && oRows.Length > 0)
// {
// if (oRows[0]["ColValue1"].ToString() ==string.Empty)
// oRows[0]["ColValue1"] = destination["Amount"];
// else oRows[0]["ColValue1"] =Convert.ToDouble(oRows[0]["ColValue1"]) + Convert.ToDouble(destination["Amount"]);
// }
// else
// {
// oRows = _salaryRecon.Select("EmpNo='" + destination["EMPLOYEENO"].ToString() + "'");
// if (oRows != null && oRows.Length > 0)
// {
// int nIndex = _salaryRecon.Rows.IndexOf(oRows[oRows.Length - 1]);
// if (oDR["ColValue1"].ToString() == string.Empty)
// oDR["ColValue1"] = destination["Amount"];
// else oDR["ColValue1"] = Convert.ToDouble(oDR["ColValue1"]) + Convert.ToDouble(destination["Amount"]);
// //oDR["ColValue1"] = destination["Amount"];
// _salaryRecon.Rows.InsertAt(oDR, nIndex + 1);
// }
// else
// {
// if (oDR["ColValue1"].ToString() == string.Empty)
// oDR["ColValue1"] = destination["Amount"];
// else oDR["ColValue1"] = Convert.ToDouble(oDR["ColValue1"]) + Convert.ToDouble(destination["Amount"]);
// //oDR["ColValue1"] = destination["Amount"];
// _salaryRecon.Rows.Add(oDR);
// }
// }
// }
// else _salaryRecon.Rows.Add(oDR);
// }
// private void CopyForCSM(DataRow source, DataRow destination)
// {
// if (tempEmpID == string.Empty)
// {
// tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
// count++;
// }
// if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
// {
// tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
// count++;
// }
// source["EmpNo"] = destination["EMPLOYEENO"];
// source["Name"] = destination["Name"];
// source["ColDes"] = destination["Description"];
// source["ColValue2"] = destination["Amount"];
// source["SalaryMonth2"] = _selectedParameter.FromDate.Value;
// source["SalaryMonth1"] = _selectedParameter.ToDate.Value;
// source["TotalEmp"] = TotalEmp;
// //source["SLNo"] = destination["EMPLOYEEID"];
// }
// private void CopyForPSM(DataRow source, DataRow destination)
// {
// 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["EmpNo"] = destination["EMPLOYEENO"];
// source["Name"] = destination["Name"];
// source["ColDes"] = destination["Description"];
// source["ColValue1"] = destination["Amount"];
// source["SalaryMonth2"] = _selectedParameter.FromDate.Value;
// source["SalaryMonth1"] = _selectedParameter.ToDate.Value;
// source["TotalEmp"] = TotalEmp;
// //source["SLNo"] = destination["EMPLOYEEID"];
// }
// private void CopyForCC(DataRow source, DataRow destination)
// {
// 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["EmpNo"] = destination["EMPLOYEENO"];
// source["EmpName"] = destination["Name"];
// source["Grade"] = destination["GName"];
// source["GCode"] = destination["GCode"];
// source["Department"] = destination["DName"];
// source["Description"] = destination["Description"];
// source["Amount"] = destination["Amount"];
// source["SalaryMonth"] = _SalaryMonth;
// source["CCDes"] = destination["CRGDes"];
// source["AccountNo"] = destination["AccountNo"];
// //source["SLNo"] = destination["EMPLOYEEID"];
// }
// public void ShowSalarySheetReportByCC()
// {
// SalaryMonthly oSM = new SalaryMonthly();
// fReportViewer form = new fReportViewer();
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// _SalaryMonth = _selectedParameter.FromDate.Value;
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// oSalarySheets = SalaryMonthly.GetEmpSalarySheetByCC(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
// PayrollDataSet.dsCompany.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.dsCompany.SalarySheetDataTable();
// PayrollDataSet.dsCompany.SalarySheetDataTable dTSalarySheet2 = new Payroll.Report.PayrollDataSet.dsCompany.SalarySheetDataTable();
// foreach (DataRow source in oSalarySheets.Tables[0].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyForCC(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[1].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyForCC(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[2].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyForCC(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[3].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyForCC(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[4].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyForCC(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[5].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyForCC(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[6].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyForCC(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// var sortedTempData = from DataRow dr in dTSalarySheet.Rows orderby dr["CCDes"] select dr;
// foreach (DataRow dr in sortedTempData)
// {
// DataRow nDr = dTSalarySheet2.NewRow();
// nDr.ItemArray = dr.ItemArray;
// dTSalarySheet2.Rows.Add(nDr);
// }
// //return dTSalarySheet;
// form.ShowDlgForSalarySheetByCC(_selectedParameter.ReportItem, dTSalarySheet2);
// }
// public void ShowSalaryRecon()
// {
// fReportViewer form = new fReportViewer();
// DateTime dFDate = _selectedParameter.FromDate.Value;
// DateTime dToDate = _selectedParameter.ToDate.Value;
// //DateTime dFDate = _selectedParameter.FromDate.Value.AddMinutes(-1);
// //DateTime dToDate = _selectedParameter.FromDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// string[] sEmp = sEmpID.Split(',');
// TotalEmp = sEmp.Length;
// _currentSMonthly = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(dToDate), sEmpID);
// // _currentSMonthly.Tables[0] = _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") != 4).CopyToDataTable();
// _prvSMonthly = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(dFDate), sEmpID);
// PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable dTCSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
// PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable dTPSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
// PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable dTemp = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
// _salaryRecon = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
// //_salaryRecon.Columns.Add("SequenceNo");
// #region SalaryReconciliation
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// DateTime salaryNextMonth = _selectedParameter.ToDate.Value;
// //int nCount = 0;
// //double totCurrGr = 0;
// //double totPrevGR = 0;
// string FirstMonth = salaryMonth.ToString("MMM yyyy");
// string NextMonth = salaryNextMonth.ToString("MMM yyyy");
// //int SimilerEmp = 0;
// //int DisimilerEmp = 0;
// #region GetTotalEmp
// DateTime dtFirstDateSalaryMonth = GlobalFunctions.FirstDateOfMonth(salaryMonth);
// DateTime dtLastDateSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth);
// DateTime dtFirstDateSalaryNextMonth = GlobalFunctions.FirstDateOfMonth(salaryNextMonth);
// DateTime dtLastDateSalaryNextMonth = GlobalFunctions.LastDateOfMonth(salaryNextMonth);
// #endregion
// #endregion
// List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
// List<string> allowances = _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -113).GroupBy(y => y.Field<int>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> OTs = _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -103).GroupBy(y => y.Field<int>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> deductions = _currentSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") != -118).GroupBy(y => y.Field<int>("ItemID")).Select(o => o.Key.ToString()).ToList();
// List<string> Loans = _currentSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") == -118).GroupBy(y => y.Field<int>("ItemID")).Select(o => o.Key.ToString()).ToList();
// _currentSMonthly.Tables["TotalGross"].Columns.Add("SequenceNo");
// _currentSMonthly.Tables["TotalDeduction"].Columns.Add("SequenceNo");
// //_currentSMonthly.Tables["NetPay"].Columns.Add("SequenceNo");
// int seq = 1;
// foreach (string comp in components)
// {
// switch (comp)
// {
// case "Basic":
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101);
// string des="";
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 4 && x.Field<int>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// des=dr["Description"].ToString();
// }
// seq++;
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101).CopyToDataTable();
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 8 && x.Field<int>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 2 && x.Field<int>("ItemCode") == -101 && x.Field<int>("ItemID") == -101))
// {
// //_currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101
// dr["SequenceNo"] = seq;
// dr["Description"] = des;
// dr["Amount"] = -(Convert.ToDouble(dr["Amount"]));
// }
// break;
// case "Allowance":
// des = "";
// 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 _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -113 && x.Field<int>("ItemID").ToString() == allwid))
// {
// des = dr["Description"].ToString();
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 8 && x.Field<int>("ItemCode") == -113 && x.Field<int>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 2 && x.Field<int>("ItemCode") == -113 && x.Field<int>("ItemID").ToString() == allwid))
// {
// //_currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101
// dr["SequenceNo"] = seq;
// dr["Description"] = des;
// dr["Amount"] = -(Convert.ToDouble(dr["Amount"]));
// }
// }
// break;
// case "OT":
// foreach (string id in OTs)
// {
// des = "";
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -103 && x.Field<int>("ItemID").ToString() == id))
// {
// des = dr["Description"].ToString();
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 8 && x.Field<int>("ItemCode") == -103 && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 2 && x.Field<int>("ItemCode") == -103 && x.Field<int>("ItemID").ToString() == id))
// {
// //_currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101
// dr["SequenceNo"] = seq;
// dr["Description"] = des;
// dr["Amount"] = -(Convert.ToDouble(dr["Amount"]));
// }
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave)))
// {
// dr["SequenceNo"] = seq;
// dr["Description"] = "Leave Adj.";
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["TotalGross"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// break;
// case "Deduction":
// foreach (string id in deductions)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") != -118 && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 8 && x.Field<int>("ItemCode") != -118 && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "Loan":
// foreach (string id in Loans)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["TotalDeduction"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _currentSMonthly.Tables["NetPay"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// break;
// default:
// break;
// }
// }
// // components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
// allowances = _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -113).GroupBy(y => y.Field<int>("ItemID")).Select(o => o.Key.ToString()).ToList();
// OTs = _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -103).GroupBy(y => y.Field<int>("ItemID")).Select(o => o.Key.ToString()).ToList();
// deductions = _prvSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") != -118).GroupBy(y => y.Field<int>("ItemID")).Select(o => o.Key.ToString()).ToList();
// Loans = _prvSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") == -118).GroupBy(y => y.Field<int>("ItemID")).Select(o => o.Key.ToString()).ToList();
// _prvSMonthly.Tables["TotalGross"].Columns.Add("SequenceNo");
// _prvSMonthly.Tables["TotalDeduction"].Columns.Add("SequenceNo");
// //_prvSMonthly.Tables["NetPay"].Columns.Add("SequenceNo");
// seq = 1;
// foreach (string comp in components)
// {
// switch (comp)
// {
// case "Basic":
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101);
// string des ="";
// foreach (DataRow dr in _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 4 && x.Field<int>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// des = dr["Description"].ToString();
// }
// seq++;
// //dt=oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 8 && x.Field<decimal>("ItemCode") == -101).CopyToDataTable();
// foreach (DataRow dr in _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 8 && x.Field<int>("ItemCode") == -101))
// {
// dr["SequenceNo"] = seq;
// }
// foreach (DataRow dr in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 2 && x.Field<int>("ItemCode") == -101))
// {
// //_currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -101
// dr["SequenceNo"] = seq;
// dr["Description"] = des;
// // dr["Amount"] = -(Convert.ToDouble(dr["Amount"]));
// }
// 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 _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -113 && x.Field<int>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 8 && x.Field<int>("ItemCode") == -113 && x.Field<int>("ItemID").ToString() == allwid))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "OT":
// foreach (string id in OTs)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -103 && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 8 && x.Field<int>("ItemCode") == -103 && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == Convert.ToDecimal((int)EnumSalaryGroup.UnauthLeave)))
// {
// dr["SequenceNo"] = seq;
// dr["Description"] = "Leave Adj.";
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["TotalGross"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// break;
// case "Deduction":
// foreach (string id in deductions)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") != -118 && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 8 && x.Field<int>("ItemCode") != -118 && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// break;
// case "Loan":
// foreach (string id in Loans)
// {
// // dt = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") == 1 && x.Field<decimal>("ItemCode") == -113 && x.Field<decimal>("ItemID").ToString() == allwid).CopyToDataTable();
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 3 && x.Field<int>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x.Field<int>("ItemID").ToString() == id))
// {
// dr["SequenceNo"] = seq;
// }
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["TotalDeduction"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// seq++;
// foreach (DataRow dr in _prvSMonthly.Tables["NetPay"].Rows)
// {
// dr["SequenceNo"] = seq;
// }
// break;
// default:
// break;
// }
// }
// #region Unused Code
// //ObjectsTemplate<SalaryMonthly> oCurrMonthlies = SalaryMonthly.GetByDateRange(dtFirstDateSalaryMonth, dtLastDateSalaryMonth);
// //ObjectsTemplate<SalaryMonthly> oNextMonthlies = SalaryMonthly.GetByDateRange(dtFirstDateSalaryNextMonth, dtLastDateSalaryNextMonth);
// ////bool Check = true;
// //string countCurrMonth = salaryMonth.ToString("MMM") + " : " + Convert.ToString(oCurrMonthlies.Count.ToString());
// //string countNextMonth = salaryNextMonth.ToString("MMM") + " : " + oNextMonthlies.Count.ToString();
// //foreach (SalaryMonthly oMonth in oCurrMonthlies)
// //{
// // SalaryMonthly oMonthly = oNextMonthlies.Find(delegate(SalaryMonthly oM) { return oM.EmployeeID == oMonth.EmployeeID; });
// // if (oMonthly != null && !oMonthly.ID.IsUnassigned)
// // {
// // SimilerEmp++;
// // }
// // else
// // {
// // DisimilerEmp++;
// // }
// //}
// //foreach (SalaryMonthly oPMonth in oNextMonthlies)
// //{
// // SalaryMonthly oMonthly = oCurrMonthlies.Find(delegate(SalaryMonthly oM) { return oM.EmployeeID == oPMonth.EmployeeID; });
// // if (oMonthly != null && !oMonthly.ID.IsUnassigned)
// // {
// // }
// // else
// // {
// // DisimilerEmp++;
// // }
// //}
// //DataRow oRow = null;
// //DataSet oSalaryMonthlys = SalaryMonthly.GetEmpSalaryReconciliationSummary(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// //DataSet oSalaryNextMonthlys = SalaryMonthly.GetEmpSalaryReconciliationSummary(GlobalFunctions.LastDateOfMonth(salaryNextMonth), sEmpID);
// //PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable dTCSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
// //PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable dTPSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
// //_salaryReconGross = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
// //_salaryReconDecuction = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconDeductionDataTable();
// //foreach (DataRow source in oSalaryNextMonthlys.Tables[0].Rows)
// // this.CopyGross(source, false);
// //foreach (DataRow source in oSalaryMonthlys.Tables[0].Rows)
// // this.CopyGross(source, true);
// //DataRow oDRow = null;
// //int countGR = 0;
// //foreach (DataRow DR in _salaryReconGross.Rows)
// //{
// // if (DR["CurrAmount"].ToString() != "")
// // {
// // totCurrGr = totCurrGr + Convert.ToDouble(DR["CurrAmount"]);
// // }
// // if (DR["PrevAmount"].ToString() != "")
// // {
// // totPrevGR = totPrevGR + Convert.ToDouble(DR["PrevAmount"]);
// // }
// // countGR++;
// //}
// //foreach (DataRow source in oSalaryNextMonthlys.Tables[1].Rows)
// // this.CopyDeduction(source, false);
// //foreach (DataRow source in oSalaryMonthlys.Tables[1].Rows)
// // this.CopyDeduction(source, true);
// // DataRow oDR = null;
// //double totCurrDe = 0;
// //double totPrevDe = 0;
// //int count = 0;
// //foreach (DataRow DR in _salaryReconDecuction.Rows)
// //{
// // if (DR["CurrAmount"].ToString() != "")
// // {
// // totCurrDe = totCurrDe + Convert.ToDouble(DR["CurrAmount"]);
// // }
// // if (DR["PrevAmount"].ToString() != "")
// // {
// // totPrevDe = totPrevDe + Convert.ToDouble(DR["PrevAmount"]);
// // }
// // count++;
// // if (count == _salaryReconDecuction.Rows.Count)
// // {
// // DR["NetAmountCurr"] = totCurrGr - totCurrDe;
// // DR["NetAmountPrev"] = totPrevGR - totPrevDe;
// // }
// //}
// #endregion
// foreach (DataRow source in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") != 4).CopyToDataTable().Rows)
// this.Copy(source, false);
// foreach (DataRow source in _currentSMonthly.Tables[1].Rows)
// this.Copy(source, false);
// foreach (DataRow source in _currentSMonthly.Tables[2].Rows)
// this.Copy(source, false);
// foreach (DataRow source in _currentSMonthly.Tables[3].Rows)
// this.Copy(source, false);
// foreach (DataRow source in _currentSMonthly.Tables[4].Rows)
// this.Copy(source, false);
// //foreach (DataRow source in _currentSMonthly.Tables[5].Rows)
// // this.Copy(source, false);
// //foreach (DataRow source in _currentSMonthly.Tables[6].Rows)
// // this.Copy(source, false);
// //foreach (DataRow source in _currentSMonthly.Tables[7].Rows)
// // this.Copy(source, false);
// //foreach (DataRow source in _currentSMonthly.Tables[8].Rows)
// // this.Copy(source, false);
// //foreach (DataRow source in _currentSMonthly.Tables[9].Rows)
// // this.Copy(source, false);
// //foreach (DataRow source in _currentSMonthly.Tables[10].Rows)
// // this.Copy(source, false);
// //foreach (DataRow source in _currentSMonthly.Tables[11].Rows)
// // this.Copy(source, false);
// //foreach (DataRow source in _currentSMonthly.Tables[12].Rows)
// // this.Copy(source, false);
// // start previous data
// foreach (DataRow source in _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") != 4).CopyToDataTable().Rows)
// this.Copy(source, true);
// foreach (DataRow source in _prvSMonthly.Tables[1].Rows)
// this.Copy(source, true);
// foreach (DataRow source in _prvSMonthly.Tables[2].Rows)
// this.Copy(source, true);
// foreach (DataRow source in _prvSMonthly.Tables[3].Rows)
// this.Copy(source, true);
// foreach (DataRow source in _prvSMonthly.Tables[4].Rows)
// this.Copy(source, true);
// //foreach (DataRow source in _prvSMonthly.Tables[5].Rows)
// // this.Copy(source, true);
// //foreach (DataRow source in _prvSMonthly.Tables[6].Rows)
// // this.Copy(source, true);
// //foreach (DataRow source in _prvSMonthly.Tables[7].Rows)
// // this.Copy(source, true);
// //foreach (DataRow source in _prvSMonthly.Tables[8].Rows)
// // this.Copy(source, true);
// //foreach (DataRow source in _prvSMonthly.Tables[9].Rows)
// // this.Copy(source, true);
// //foreach (DataRow source in _prvSMonthly.Tables[10].Rows)
// // this.Copy(source, true);
// //foreach (DataRow source in _prvSMonthly.Tables[11].Rows)
// // this.Copy(source, true);
// //foreach (DataRow source in _prvSMonthly.Tables[12].Rows)
// // this.Copy(source, true);
// #region Remove For Gross Zero Row and Deduct Zero Row
// //DataTable dTempTest = new DataTable("TempTable");
// //dTempTest.Columns.Add("EmpNo", typeof(string));
// //dTempTest.Columns.Add("Name", typeof(string));
// //dTempTest.Columns.Add("ColDes", typeof(string));
// //dTempTest.Columns.Add("ColValue1", typeof(string));
// //dTempTest.Columns.Add("RowSequence", typeof(int));
// //dTempTest.Columns.Add("SalaryMonth1", typeof(DateTime));
// //dTempTest.Columns.Add("ColValue2", typeof(string));
// //dTempTest.Columns.Add("SalaryMonth2", typeof(DateTime));
// //dTempTest.Columns.Add("ColValue3", typeof(string));
// //dTempTest.Columns.Add("SLNo", typeof(int));
// //dTempTest.Columns.Add("TotalEmp", typeof(int));
// //string sTempEmp = string.Empty;
// //foreach (DataRow oDrow in _salaryRecon.Rows)
// //{
// // if (sTempEmp.Trim() == string.Empty || sTempEmp.Trim() != oDrow["EmpNo"].ToString().Trim())
// // {
// // if (dTemp.Rows.Count > 0)
// // {
// // DataRow[] oTempRow = dTemp.Select("EmpNo='" + oDrow["EmpNo"].ToString() + "'");
// // if (oTempRow.Length > 0)
// // {
// // //if(sTempEmp.Trim()==string.Empty || oTempRow.Length==0)
// // continue;
// // }
// // else
// // {
// // sTempEmp = oDrow["EmpNo"].ToString();
// // DataRow[] dRows = _salaryRecon.Select("EmpNo='" + oDrow["EmpNo"].ToString() + "'");
// // foreach (DataRow oDR in dRows)
// // {
// // DataRow oDNRow = dTemp.NewRow();
// // oDNRow["EmpNo"] = oDR["EmpNo"];
// // oDNRow["Name"] = oDR["Name"];
// // oDNRow["ColDes"] = oDR["ColDes"];
// // oDNRow["ColValue1"] = oDR["ColValue1"];
// // oDNRow["RowSequence"] = oDR["RowSequence"];
// // oDNRow["SalaryMonth1"] = oDR["SalaryMonth1"];
// // oDNRow["ColValue2"] = oDR["ColValue2"];
// // oDNRow["SalaryMonth2"] = oDR["SalaryMonth2"];
// // oDNRow["ColValue3"] = oDR["ColValue3"];
// // oDNRow["SLNo"] = oDR["SLNo"];
// // oDNRow["TotalEmp"] = oDR["TotalEmp"];
// // dTemp.Rows.Add(oDNRow);
// // }
// // }
// // }
// // else
// // {
// // sTempEmp = oDrow["EmpNo"].ToString();
// // DataRow[] dRows = _salaryRecon.Select("EmpNo='" + oDrow["EmpNo"].ToString() + "'");
// // foreach (DataRow oDR in dRows)
// // {
// // DataRow oDNRow = dTemp.NewRow();
// // oDNRow["EmpNo"] = oDR["EmpNo"];
// // oDNRow["Name"] = oDR["Name"];
// // oDNRow["ColDes"] = oDR["ColDes"];
// // oDNRow["ColValue1"] = oDR["ColValue1"];
// // oDNRow["RowSequence"] = oDR["RowSequence"];
// // oDNRow["SalaryMonth1"] = oDR["SalaryMonth1"];
// // oDNRow["ColValue2"] = oDR["ColValue2"];
// // oDNRow["SalaryMonth2"] = oDR["SalaryMonth2"];
// // oDNRow["ColValue3"] = oDR["ColValue3"];
// // oDNRow["SLNo"] = oDR["SLNo"];
// // oDNRow["TotalEmp"] = oDR["TotalEmp"];
// // dTemp.Rows.Add(oDNRow);
// // }
// // }
// // }
// //}
// //foreach (DataRow oDRow in dTemp.Rows)
// //{
// // if (Convert.ToString(oDRow["ColDes"]) == "Total Gross")
// // {
// // DataRow[] oGrosssRows = dTemp.Select("ColDes='" + "Total Gross" + "'" + " AND EmpNo='" + oDRow["EmpNo"].ToString() + "'");
// // DataRow[] oDeductRows = dTemp.Select("ColDes='" + "Total Deduction" + "'" + " AND EmpNo='" + oDRow["EmpNo"].ToString() + "'");
// // if ((oGrosssRows != null && oGrosssRows.Length > 0) && (oDeductRows != null && oDeductRows.Length > 0))
// // {
// // if ((oGrosssRows[0]["ColValue2"].ToString().Length <= 0) && (oDeductRows[0]["ColValue2"].ToString().Length <= 0))
// // {
// // oGrosssRows[0]["ColValue2"] = 0;
// // oDeductRows[0]["ColValue2"] = 0;
// // }
// // if ((oGrosssRows[0]["ColValue1"].ToString().Length <= 0) && (oDeductRows[0]["ColValue1"].ToString().Length <= 0))
// // {
// // oGrosssRows[0]["ColValue1"] = 0;
// // oDeductRows[0]["ColValue1"] = 0;
// // }
// // if (((Convert.ToDouble(oGrosssRows[0]["ColValue2"]) - Convert.ToDouble(oGrosssRows[0]["ColValue1"])) == 0) && ((Convert.ToDouble(oDeductRows[0]["ColValue2"]) - Convert.ToDouble(oDeductRows[0]["ColValue1"])) == 0))
// // {
// // continue;
// // }
// // else
// // {
// // DataRow[] oCheckRows = dTemp.Select("EmpNo='" + oDRow["EmpNo"].ToString() + "'");
// // if (oCheckRows.Length > 0)
// // {
// // foreach (DataRow oDR in oCheckRows)
// // {
// // DataRow oDTest = dTempTest.NewRow();
// // oDTest["EmpNo"] = oDR["EmpNo"];
// // oDTest["Name"] = oDR["Name"];
// // oDTest["ColDes"] = oDR["ColDes"];
// // oDTest["ColValue1"] = oDR["ColValue1"];
// // oDTest["RowSequence"] = oDR["RowSequence"];
// // oDTest["SalaryMonth1"] = oDR["SalaryMonth1"];
// // oDTest["ColValue2"] = oDR["ColValue2"];
// // oDTest["SalaryMonth2"] = oDR["SalaryMonth2"];
// // oDTest["ColValue3"] = oDR["ColValue3"];
// // oDTest["SLNo"] = oDR["SLNo"];
// // oDTest["TotalEmp"] = oDR["TotalEmp"];
// // dTempTest.Rows.Add(oDTest);
// // }
// // }
// // }
// // }
// // }
// //}
// #endregion
// #region Remove For NetPay Zero Row
// DataTable dTempTest = new DataTable("TempTable");
// dTempTest.Columns.Add("EmpNo", typeof(string));
// dTempTest.Columns.Add("Name", typeof(string));
// dTempTest.Columns.Add("ColDes", typeof(string));
// dTempTest.Columns.Add("ColValue1", typeof(string));
// dTempTest.Columns.Add("RowSequence", typeof(int));
// dTempTest.Columns.Add("SalaryMonth1", typeof(DateTime));
// dTempTest.Columns.Add("ColValue2", typeof(string));
// dTempTest.Columns.Add("SalaryMonth2", typeof(DateTime));
// dTempTest.Columns.Add("ColValue3", typeof(string));
// dTempTest.Columns.Add("SLNo", typeof(int));
// dTempTest.Columns.Add("TotalEmp", typeof(int));
// string sTempEmp = string.Empty;
// foreach (DataRow oDrow in _salaryRecon.Rows)
// {
// if (sTempEmp.Trim() == string.Empty || sTempEmp.Trim() != oDrow["EmpNo"].ToString().Trim())
// {
// if (dTemp.Rows.Count > 0)
// {
// DataRow[] oTempRow = dTemp.Select("EmpNo='" + oDrow["EmpNo"].ToString() + "'");
// if (oTempRow.Length > 0)
// {
// //if(sTempEmp.Trim()==string.Empty || oTempRow.Length==0)
// continue;
// }
// else
// {
// sTempEmp = oDrow["EmpNo"].ToString();
// DataRow[] dRows = _salaryRecon.Select("EmpNo='" + oDrow["EmpNo"].ToString() + "'");
// foreach (DataRow oDR in dRows)
// {
// DataRow oDNRow = dTemp.NewRow();
// oDNRow["EmpNo"] = oDR["EmpNo"];
// oDNRow["Name"] = oDR["Name"];
// oDNRow["ColDes"] = oDR["ColDes"];
// oDNRow["ColValue1"] = oDR["ColValue1"];
// oDNRow["RowSequence"] = oDR["RowSequence"];
// oDNRow["SalaryMonth1"] = oDR["SalaryMonth1"];
// oDNRow["ColValue2"] = oDR["ColValue2"];
// oDNRow["SalaryMonth2"] = oDR["SalaryMonth2"];
// oDNRow["ColValue3"] = oDR["ColValue3"];
// oDNRow["SLNo"] = oDR["SLNo"];
// oDNRow["TotalEmp"] = oDR["TotalEmp"];
// dTemp.Rows.Add(oDNRow);
// }
// }
// }
// else
// {
// sTempEmp = oDrow["EmpNo"].ToString();
// DataRow[] dRows = _salaryRecon.Select("EmpNo='" + oDrow["EmpNo"].ToString() + "'");
// foreach (DataRow oDR in dRows)
// {
// DataRow oDNRow = dTemp.NewRow();
// oDNRow["EmpNo"] = oDR["EmpNo"];
// oDNRow["Name"] = oDR["Name"];
// oDNRow["ColDes"] = oDR["ColDes"];
// oDNRow["ColValue1"] = oDR["ColValue1"];
// oDNRow["RowSequence"] = oDR["RowSequence"];
// oDNRow["SalaryMonth1"] = oDR["SalaryMonth1"];
// oDNRow["ColValue2"] = oDR["ColValue2"];
// oDNRow["SalaryMonth2"] = oDR["SalaryMonth2"];
// oDNRow["ColValue3"] = oDR["ColValue3"];
// oDNRow["SLNo"] = oDR["SLNo"];
// oDNRow["TotalEmp"] = oDR["TotalEmp"];
// dTemp.Rows.Add(oDNRow);
// }
// }
// }
// }
// foreach (DataRow oDRow in dTemp.Rows)
// {
// if (Convert.ToString(oDRow["ColDes"]) == "Net Pay")
// {
// DataRow[] oRows = dTemp.Select("ColDes='" + "Net Pay" + "'" + " AND EmpNo='" + oDRow["EmpNo"].ToString() + "'");
// if (oRows != null && oRows.Length > 0)
// {
// if (oRows[0]["ColValue2"].ToString().Length <= 0)
// {
// oRows[0]["ColValue2"] = 0;
// }
// if (oRows[0]["ColValue1"].ToString().Length <= 0)
// {
// oRows[0]["ColValue1"] = 0;
// }
// if ((Convert.ToDouble(oRows[0]["ColValue2"]) - Convert.ToDouble(oRows[0]["ColValue1"])) == 0)
// {
// continue;
// }
// else
// {
// DataRow[] oCheckRows = dTemp.Select("EmpNo='" + oDRow["EmpNo"].ToString() + "'");
// if (oCheckRows.Length > 0)
// {
// foreach (DataRow oDR in oCheckRows)
// {
// DataRow oDTest = dTempTest.NewRow();
// oDTest["EmpNo"] = oDR["EmpNo"];
// oDTest["Name"] = oDR["Name"];
// oDTest["ColDes"] = oDR["ColDes"];
// oDTest["ColValue1"] = oDR["ColValue1"];
// oDTest["RowSequence"] = oDR["RowSequence"];
// oDTest["SalaryMonth1"] = oDR["SalaryMonth1"];
// oDTest["ColValue2"] = oDR["ColValue2"];
// oDTest["SalaryMonth2"] = oDR["SalaryMonth2"];
// oDTest["ColValue3"] = oDR["ColValue3"];
// oDTest["SLNo"] = oDR["SLNo"];
// oDTest["TotalEmp"] = oDR["TotalEmp"];
// dTempTest.Rows.Add(oDTest);
// }
// }
// }
// }
// }
// }
// #endregion
// //DataTable salaryRecon = (_salaryRecon.OrderBy(x => x.Field<string>("SequenceNo")).CopyToDataTable());
// //form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, _salaryRecon, FirstMonth, NextMonth, countCurrMonth, countNextMonth);
// form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, _salaryRecon);
// //form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, dTempTest);
// }
// public void SalaryReconciliationSummary()
// {
// ObjectsTemplate<Employee> _AllEmployee = null;
// fReportViewer form = new fReportViewer();
// DateTime salaryMonth = _selectedParameter.FromDate.Value;
// DateTime salaryNextMonth = _selectedParameter.ToDate.Value;
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// string[] sEmp = sEmpID.Split(new char[] { ',' });
// int nTotalEmp = sEmp.Count();
// int nCount = 0;
// double totCurrGr = 0;
// double totPrevGR = 0;
// string FirstMonth = salaryMonth.ToString("MMM yyyy");
// string NextMonth = salaryNextMonth.ToString("MMM yyyy");
// int SimilerEmp = 0;
// int DisimilerEmp = 0;
// #region GetTotalEmp
// DateTime dtFirstDateSalaryMonth = GlobalFunctions.FirstDateOfMonth(salaryMonth);
// DateTime dtLastDateSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth);
// DateTime dtFirstDateSalaryNextMonth = GlobalFunctions.FirstDateOfMonth(salaryNextMonth);
// DateTime dtLastDateSalaryNextMonth = GlobalFunctions.LastDateOfMonth(salaryNextMonth);
// ObjectsTemplate<SalaryMonthly> oCurrMonthlies = SalaryMonthly.GetByDateRange(dtFirstDateSalaryMonth, dtLastDateSalaryMonth);
// ObjectsTemplate<SalaryMonthly> oNextMonthlies = SalaryMonthly.GetByDateRange(dtFirstDateSalaryNextMonth, dtLastDateSalaryNextMonth);
// bool Check = true;
// string countCurrMonth = salaryMonth.ToString("MMM") + " : " + Convert.ToString(oCurrMonthlies.Count.ToString());
// string countNextMonth = salaryNextMonth.ToString("MMM") + " : " + oNextMonthlies.Count.ToString();
// //string _CollOfEmpId = oNextMonthlies.Select(p => p.EmployeeID.Integer).ToList().ToString();
// //string[] sEmpNext = _CollOfEmpId.Split(new char[] { ',' });
// foreach (SalaryMonthly oMonth in oCurrMonthlies)
// {
// SalaryMonthly oMonthly = oNextMonthlies.Find(delegate(SalaryMonthly oM) { return oM.EmployeeID == oMonth.EmployeeID; });
// if (oMonthly != null && !oMonthly.ID.IsUnassigned)
// {
// SimilerEmp++;
// }
// else
// {
// DisimilerEmp++;
// }
// }
// StringBuilder sb = new StringBuilder();
// foreach (SalaryMonthly oPMonth in oNextMonthlies)
// {
// SalaryMonthly oMonthly = oCurrMonthlies.Find(delegate(SalaryMonthly oM) { return oM.EmployeeID == oPMonth.EmployeeID; });
// SalaryMonthly _oNextMonth = oNextMonthlies.Find(delegate(SalaryMonthly oM) { return oM.EmployeeID == oPMonth.EmployeeID; });
// if (oMonthly != null && !oMonthly.ID.IsUnassigned)
// {
// }
// else
// {
// DisimilerEmp++;
// }
// }
// #endregion
// DataRow oRow = null;
// DataSet oSalaryMonthlys = SalaryMonthly.GetEmpSalaryReconciliationSummary(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
// DataSet oSalaryNextMonthlys = SalaryMonthly.GetEmpSalaryReconciliationSummary(GlobalFunctions.LastDateOfMonth(salaryNextMonth), sEmpID);
// PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable dTCSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
// PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable dTPSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
// _salaryReconGross = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconciliationSummaryDataTable();
// _salaryReconDecuction = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryReconDeductionDataTable();
// foreach (DataRow source in oSalaryNextMonthlys.Tables[0].Rows)
// this.CopyGross(source, false);
// foreach (DataRow source in oSalaryMonthlys.Tables[0].Rows)
// this.CopyGross(source, true);
// DataRow oDRow = null;
// int countGR = 0;
// foreach (DataRow DR in _salaryReconGross.Rows)
// {
// if (DR["CurrAmount"].ToString() != "")
// {
// totCurrGr = totCurrGr + Convert.ToDouble(DR["CurrAmount"]);
// }
// if (DR["PrevAmount"].ToString() != "")
// {
// totPrevGR = totPrevGR + Convert.ToDouble(DR["PrevAmount"]);
// }
// countGR++;
// }
// //if (countGR == _salaryRecon.Rows.Count)
// //{
// // oDRow = _salaryRecon.NewRow();
// // oDRow["Description"] = "Total Gross ";
// // oDRow["CurrAmount"] = totCurrGr;
// // oDRow["PrevAmount"] = totPrevGR;
// // _salaryRecon.Rows.Add(oDRow);
// //}
// foreach (DataRow source in oSalaryNextMonthlys.Tables[1].Rows)
// this.CopyDeduction(source, false);
// foreach (DataRow source in oSalaryMonthlys.Tables[1].Rows)
// this.CopyDeduction(source, true);
// DataRow oDR = null;
// double totCurrDe = 0;
// double totPrevDe = 0;
// int count = 0;
// foreach (DataRow DR in _salaryReconDecuction.Rows)
// {
// //oDR = _salaryRecon.NewRow();
// //oDR["Description"] = DR["Description"];
// //oDR["CurrAmount"] = DR["CurrAmount"];
// if (DR["CurrAmount"].ToString() != "")
// {
// totCurrDe = totCurrDe + Convert.ToDouble(DR["CurrAmount"]);
// }
// //oDR["PrevAmount"] = DR["PrevAmount"];
// if (DR["PrevAmount"].ToString() != "")
// {
// totPrevDe = totPrevDe + Convert.ToDouble(DR["PrevAmount"]);
// }
// //_salaryRecon.Rows.Add(oDR);
// count++;
// if (count == _salaryReconDecuction.Rows.Count)
// {
// //oDR = _salaryRecon.NewRow();
// //oDR["Description"] = "Total Deduction";
// //oDR["CurrAmount"] = totCurrDe;
// //oDR["PrevAmount"] = totPrevDe;
// //_salaryRecon.Rows.Add(oDR);
// //oDR = _salaryReconDecuction.NewRow();
// //oDR["Description"] = "Net Pay ";
// DR["NetAmountCurr"] = totCurrGr - totCurrDe;
// DR["NetAmountPrev"] = totPrevGR - totPrevDe;
// //_salaryReconDecuction.Rows.Add(oDR);
// }
// }
// form.ShowDlgForSalaryReconcilSummary(_selectedParameter.ReportItem, _salaryReconGross, _salaryReconDecuction, FirstMonth, NextMonth, countCurrMonth, countNextMonth);
// }
// private void CopyDeduction(DataRow destination, bool IsPrv)
// {
// DataRow oDR = null;
// //if (_salaryReconDecuction.Rows.Count == 0)
// //{
// // oDR = _salaryReconDecuction.NewRow();
// // oDR["Description"] = "Deduction";
// // _salaryReconDecuction.Rows.Add(oDR);
// //}
// oDR = _salaryReconDecuction.NewRow();
// oDR["Description"] = destination["DESCRIPTION"];
// if (IsPrv == false)
// {
// //oDR = _salaryReconDecuction.NewRow();
// //oDR["Description"] = destination["DESCRIPTION"];
// oDR["CurrAmount"] = destination["Amount"];
// }
// if (IsPrv == true)
// {
// DataRow[] oRows = _salaryReconDecuction.Select("Description='" + destination["Description"].ToString() + "'");
// if (oRows != null && oRows.Length > 0)
// {
// oRows[0]["PrevAmount"] = destination["Amount"];
// }
// else
// {
// oRows = _salaryReconDecuction.Select("Description='" + destination["Description"].ToString() + "'");
// oDR = _salaryReconDecuction.NewRow();
// oDR["Description"] = destination["DESCRIPTION"];
// oDR["PrevAmount"] = destination["Amount"];
// _salaryReconDecuction.Rows.Add(oDR);
// }
// }
// else _salaryReconDecuction.Rows.Add(oDR);
// }
// private void CopyGross(DataRow destination, bool IsPrv)
// {
// DataRow oDR = null;
// //if (_salaryRecon.Rows.Count == 0)
// //{
// // oDR = _salaryRecon.NewRow();
// // oDR["Description"] = "Gross Item";
// // _salaryRecon.Rows.Add(oDR);
// //}
// oDR = _salaryReconGross.NewRow();
// oDR["Description"] = destination["DESCRIPTION"];
// if (IsPrv == false)
// {
// oDR["CurrAmount"] = destination["Amount"];
// }
// if (IsPrv == true)
// {
// //string characters = Regex.Replace(destination["Description"].ToString(), "'", "");
// //DataRow[] oRows = _salaryReconGross.Select("Description='" + characters + "'");
// DataRow[] oRows = _salaryReconGross
// .Where(x => x.Description.ToString() == destination["Description"].ToString())
// .ToArray();
// if (oRows != null && oRows.Length > 0)
// {
// oRows[0]["PrevAmount"] = destination["Amount"];
// }
// else
// {
// oRows = _salaryReconGross
// .Where(x => x.Description.ToString() == destination["Description"].ToString())
// .ToArray();
// oDR = _salaryReconGross.NewRow();
// oDR["Description"] = destination["DESCRIPTION"];
// oDR["PrevAmount"] = destination["Amount"];
// _salaryReconGross.Rows.Add(oDR);
// }
// }
// else _salaryReconGross.Rows.Add(oDR);
// }
// internal void GetEmpIndsalarySheet(string sEmpID, string _months, DateTime formDate, DateTime toDate, string empName)
// {
// fReportViewer form = new fReportViewer();
// DataRow oDR = null;
// DataSet oSalarySheets = null;
// oSalarySheets = MiscellaneousDataset.GetEmpIndSalarySheet(sEmpID, _months);
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// foreach (DataRow source in oSalarySheets.Tables[0].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[1].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[2].Rows)
// {
// if (Convert.ToInt16(source["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Interest)
// {
// continue;
// }
// else
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyDeductInd(oDR, source, oSalarySheets.Tables[2]);
// dTSalarySheet.Rows.Add(oDR);
// }
// }
// foreach (DataRow source in oSalarySheets.Tables[3].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[4].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[5].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[6].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[7].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// //return dTSalarySheet;
// form.ShowDlgForSalarySheet(dTSalarySheet, sEmpID, formDate, toDate, empName);
// }
// private void CopyDeductInd(DataRow source, DataRow destination, DataTable oDt)
// {
// if (tempEmpID == string.Empty)
// {
// tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
// source["SLNo"] = count;
// count++;
// //deductAmonut =
// }
// if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
// {
// tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
// source["SLNo"] = count;
// //source["DeductAmount"]=
// count++;
// }
// 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;
// DateTime month = Convert.ToDateTime(destination["SalaryMonth"]);
// if (Convert.ToDateTime(destination["SalaryMonth"]) == _todate)
// {
// source["ShowBorder"] = "True";
// }
// else
// {
// source["ShowBorder"] = "false";
// }
// source["Font"] = "True";
// source["SalaryDate"] = month.ToString("MMM yyyy");
// source["JoiningDate"] = destination["JoiningDate"];
// }
// else
// {
// source["EmpNo"] = destination["EMPLOYEENO"];
// source["Grade"] = destination["GName"];
// source["EmpName"] = destination["Name"];
// source["Grade"] = destination["GName"];
// source["Department"] = destination["DName"];
// source["Description"] = destination["Description"];
// source["Amount"] = destination["Amount"];
// DateTime month = Convert.ToDateTime(destination["SalaryMonth"]);
// if (Convert.ToDateTime(destination["SalaryMonth"]) == _todate)
// {
// source["ShowBorder"] = "True";
// }
// else
// {
// source["ShowBorder"] = "false";
// }
// source["Font"] = "True";
// source["SalaryDate"] = month.ToString("MMM yyyy");
// source["JoiningDate"] = destination["JoiningDate"];
// }
// }
// public void CopyInd(DataRow source, DataRow destination)
// {
// 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["EmpNo"] = destination["EMPLOYEENO"];
// source["Grade"] = destination["GName"];
// source["EmpName"] = destination["Name"];
// source["Grade"] = destination["GName"];
// source["Department"] = destination["DName"];
// source["Description"] = destination["Description"];
// source["Amount"] = Convert.ToDouble(destination["Amount"]);
// DateTime month = Convert.ToDateTime(destination["SalaryMonth"]);
// if (Convert.ToDateTime(destination["SalaryMonth"]) == _todate)
// {
// source["ShowBorder"] = "True";
// }
// else
// {
// source["ShowBorder"] = "false";
// }
// source["Font"] = "True";
// source["SalaryDate"] = month.ToString("MMM yyyy");
// source["JoiningDate"] = destination["JoiningDate"];
// }
// private bool IsItemExists(string sMonth, string sItem, DataTable dt, string sEmpNo, DataTable dt2)
// {
// bool sts = false;
// //if (_todate.ToString("MMM yyyy") == sMonth)
// // sMonth = _selectedParameter.FromDate.Value.ToString("MMM yyyy");
// //else
// // sMonth = _todate.ToString("MMM yyyy");
// foreach (DataRow dr in dt.Rows)
// {
// if (dr["Description"].ToString() == sItem && dr["SalaryDate"].ToString() == sMonth && dr["EmpNo"].ToString() == sEmpNo)
// {
// sts = true;
// break;
// }
// }
// if (!sts)
// {
// foreach (DataRow dr in dt2.Rows)
// {
// if (dr["Description"].ToString() == sItem && dr["SalaryDate"].ToString() == sMonth && dr["EmpNo"].ToString() == sEmpNo)
// {
// sts = true;
// break;
// }
// }
// }
// return sts;
// }
// public void SalaryReconciliationForAllItems()
// {
// fReportViewer form = new fReportViewer();
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// DateTime fromDate = GlobalFunctions.LastDateOfMonth(_selectedParameter.FromDate.Value);
// _todate = GlobalFunctions.LastDateOfMonth(_selectedParameter.ToDate.Value);
// string _months = "'" + fromDate.ToString("dd MMM yyyy") + "','" + _todate.ToString("dd MMM yyyy") + "'";
// DataRow oDR = null;
// double changedAmonut = 0.00;
// DataSet oSalarySheets = null;
// oSalarySheets = MiscellaneousDataset.GetEmpIndSalarySheet(sEmpID, _months);
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet2 = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dtTempSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// foreach (DataRow source in oSalarySheets.Tables[0].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[1].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[2].Rows)
// {
// if (Convert.ToInt16(source["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Interest)
// {
// continue;
// }
// else
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyDeductInd(oDR, source, oSalarySheets.Tables[2]);
// dTSalarySheet.Rows.Add(oDR);
// }
// }
// foreach (DataRow source in oSalarySheets.Tables[3].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[4].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[5].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[6].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables[7].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopyInd(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow oRowIn in dTSalarySheet.Rows)
// {
// string sSalaryMonth = oRowIn["SalaryDate"].ToString();
// int nMonth = 0;
// if (_todate.ToString("MMM yyyy") == sSalaryMonth)
// {
// sSalaryMonth = _selectedParameter.FromDate.Value.ToString("MMM yyyy");
// nMonth = _selectedParameter.FromDate.Value.Month;
// }
// else
// {
// sSalaryMonth = _todate.ToString("MMM yyyy");
// nMonth = _todate.Month;
// }
// if (!IsItemExists(sSalaryMonth, oRowIn["Description"].ToString(), dTSalarySheet, oRowIn["EmpNo"].ToString(), dTSalarySheet2))
// {
// if (nMonth > Convert.ToDateTime(oRowIn["SalaryDate"]).Month)
// {
// DataRow nDr = dTSalarySheet2.NewRow();
// nDr.ItemArray = oRowIn.ItemArray;
// dTSalarySheet2.Rows.Add(nDr);
// nDr = dTSalarySheet2.NewRow();
// nDr.ItemArray = oRowIn.ItemArray;
// nDr["Amount"] = 0;
// nDr["SalaryDate"] = sSalaryMonth;
// dTSalarySheet2.Rows.Add(nDr);
// }
// else
// {
// DataRow nDr = dTSalarySheet2.NewRow();
// nDr.ItemArray = oRowIn.ItemArray;
// nDr["Amount"] = 0;
// nDr["SalaryDate"] = sSalaryMonth;
// dTSalarySheet2.Rows.Add(nDr);
// nDr = dTSalarySheet2.NewRow();
// nDr.ItemArray = oRowIn.ItemArray;
// dTSalarySheet2.Rows.Add(nDr);
// }
// }
// else
// {
// DataRow nDr = dTSalarySheet2.NewRow();
// nDr.ItemArray = oRowIn.ItemArray;
// dTSalarySheet2.Rows.Add(nDr);
// }
// }
// var sortedData = from DataRow dr in dTSalarySheet2.Rows orderby dr["EmpNo"], dr["Description"] select dr;
// foreach (DataRow dr in sortedData)
// {
// DataRow nDr = dtTempSalarySheet.NewRow();
// nDr.ItemArray = dr.ItemArray;
// dtTempSalarySheet.Rows.Add(nDr);
// }
// List<ItemList> oItems = new List<ItemList>();
// foreach (DataRow oRowIn in dtTempSalarySheet.Rows)
// {
// if (oRowIn["SalaryDate"].ToString() == fromDate.ToString("MMM yyyy"))
// {
// changedAmonut = 0.00;
// changedAmonut = Convert.ToDouble(oRowIn["Amount"]);
// }
// else if (oRowIn["SalaryDate"].ToString() == _todate.ToString("MMM yyyy"))
// {
// double amount = 0.00;
// DataRow or = null;
// or = dTSalarySheet.NewRow();
// or["EmpNo"] = oRowIn["EmpNo"];
// or["Grade"] = oRowIn["Grade"];
// or["EmpName"] = oRowIn["EmpName"];
// or["Grade"] = oRowIn["Grade"];
// or["Department"] = oRowIn["Department"];
// or["Description"] = oRowIn["Description"];
// or["Amount"] = Convert.ToDouble(oRowIn["Amount"]) - changedAmonut;
// amount = Convert.ToDouble(or["Amount"]);
// DateTime month = Convert.ToDateTime(oRowIn["SalaryDate"]);
// if (oRowIn["SalaryDate"].ToString() == _todate.ToString("MMM yyyy"))
// {
// or["ShowBorder"] = "True";
// }
// else
// {
// or["ShowBorder"] = "false";
// }
// if (amount != 0.00)
// {
// or["Font"] = "false";
// }
// else
// {
// or["Font"] = "True";
// }
// or["SalaryDate"] = "";
// or["JoiningDate"] = oRowIn["JoiningDate"];
// or["SLNo"] = count;
// count++;
// dTSalarySheet.Rows.Add(or);
// ItemList il = new ItemList();
// il.ItemName = or["Description"].ToString();
// il.Amount = amount;
// oItems.Add(il);
// }
// }
// List<string> oItemNames = oItems
// .Select(e => e.ItemName)
// .Distinct()
// .ToList();
// List<ItemList> oNewItems = new List<ItemList>();
// foreach (string sName in oItemNames)
// {
// double nPosTotalValue = 0.0;
// double nNegTotalValue = 0.0;
// foreach (ItemList sName1 in oItems)
// {
// if (sName == sName1.ItemName)
// {
// if (sName1.Amount > 0)
// nPosTotalValue += sName1.Amount;
// else
// nNegTotalValue += Math.Abs(sName1.Amount);
// }
// }
// ItemList li = new ItemList();
// li.ItemName = sName;
// li.Amount = nPosTotalValue - nNegTotalValue;
// oNewItems.Add(li);
// }
// foreach (ItemList sName1 in oNewItems)
// {
// DataRow or = null;
// or = dTSalarySheet.NewRow();
// or["EmpNo"] = "Grand Total";
// or["Grade"] = "";
// or["EmpName"] = "";
// or["Grade"] = "";
// or["Department"] = "";
// or["Description"] = sName1.ItemName;
// or["Amount"] = sName1.Amount;
// or["ShowBorder"] = "false";
// or["Font"] = "false";
// or["SalaryDate"] = "";
// or["JoiningDate"] = DateTime.Now;
// or["SLNo"] = 99999999;
// dTSalarySheet.Rows.Add(or);
// }
// form.ShowDlgForSalarySheet(dTSalarySheet, fromDate, _todate);
// }
// public void SalaryCertificate()
// {
// fReportViewer form = new fReportViewer();
// _SalaryMonth = GlobalFunctions.LastDateOfMonth(_selectedParameter.FromDate.Value);
// DateTime toDate = GlobalFunctions.LastDateOfMonth(_selectedParameter.ToDate.Value);
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// DataRow oDR = null;
// string sSQL = string.Empty;
// string itemName = string.Empty;
// DataSet oDset = null;
// oDset = MiscellaneousDataset.GetSalarySheet(sEmpID, _SalaryMonth, toDate);
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable oSalary = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dtTempSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// foreach (DataRow source in oDset.Tables[0].Rows)
// {
// oDR = oSalary.NewRow();
// this.Copy(oDR, source);
// oSalary.Rows.Add(oDR);
// }
// var sortedData = from DataRow dr in oSalary.Rows orderby dr["EmpNo"] select dr;
// foreach (DataRow dr in sortedData)
// {
// DataRow nDr = dtTempSalarySheet.NewRow();
// nDr.ItemArray = dr.ItemArray;
// dtTempSalarySheet.Rows.Add(nDr);
// }
// string empNo = string.Empty;
// foreach (DataRow oDR1 in dtTempSalarySheet)
// {
// foreach (DataRow oRow in oDset.Tables[1].Rows)
// {
// if (oDR1["EmpNo"].ToString() == oRow["EmployeeNo"].ToString())
// {
// double inc = Convert.ToDouble(oRow["Amount"]);
// oDR1["DeductAmount"] = inc;
// }
// }
// }
// form.ShowDlgForSalaryCertificate(_selectedParameter.ReportItem, dtTempSalarySheet, _SalaryMonth, toDate);
// }
// internal void PrepareSalarySummaryReport(DateTime dateTime)
// {
// fReportViewer oviewer = new fReportViewer();
// DataSet dsSalarySummary = new DataSet();
// DataRow oRow = null;
// dsSalarySummary = MiscellaneousDataset.GetSalarySummaryData(dateTime);
// PayrollDataSet.dsCompany.SalarySummaryDataTable dtSalarySummary = new Payroll.Report.PayrollDataSet.dsCompany.SalarySummaryDataTable();
// if (dsSalarySummary.Tables.Count > 0)
// {
// foreach (DataRow orr in dsSalarySummary.Tables[0].Rows)
// {
// oRow = dtSalarySummary.NewRow();
// this.CopySalarySummary(oRow, orr);
// dtSalarySummary.Rows.Add(oRow);
// }
// foreach (DataRow orr in dsSalarySummary.Tables[1].Rows)
// {
// oRow = dtSalarySummary.NewRow();
// this.CopySalarySummary(oRow, orr);
// dtSalarySummary.Rows.Add(oRow);
// }
// foreach (DataRow orr in dsSalarySummary.Tables[2].Rows)
// {
// oRow = dtSalarySummary.NewRow();
// this.CopySalarySummary(oRow, orr);
// dtSalarySummary.Rows.Add(oRow);
// }
// foreach (DataRow orr in dsSalarySummary.Tables[3].Rows)
// {
// oRow = dtSalarySummary.NewRow();
// this.CopySalarySummary(oRow, orr);
// dtSalarySummary.Rows.Add(oRow);
// }
// foreach (DataRow orr in dsSalarySummary.Tables[4].Rows)
// {
// oRow = dtSalarySummary.NewRow();
// this.CopySalarySummary(oRow, orr);
// dtSalarySummary.Rows.Add(oRow);
// }
// foreach (DataRow orr in dsSalarySummary.Tables[5].Rows)
// {
// oRow = dtSalarySummary.NewRow();
// this.CopySalarySummary(oRow, orr);
// dtSalarySummary.Rows.Add(oRow);
// }
// foreach (DataRow orr in dsSalarySummary.Tables[6].Rows)
// {
// oRow = dtSalarySummary.NewRow();
// this.CopySalarySummary(oRow, orr);
// dtSalarySummary.Rows.Add(oRow);
// }
// foreach (DataRow orr in dsSalarySummary.Tables[7].Rows)
// {
// oRow = dtSalarySummary.NewRow();
// this.CopySalarySummary(oRow, orr);
// dtSalarySummary.Rows.Add(oRow);
// }
// if (dtSalarySummary.Rows.Count > 0)
// {
// oviewer.ShowSalarySummaryReport(dtSalarySummary, dateTime);
// }
// }
// }
// private void CopySalarySummary(DataRow source, DataRow destination)
// {
// source["SalaryItems"] = destination["Description"];
// source["Department"] = destination["Department"];
// source["ItemValue"] = destination["Amount"];
// }
// public void SalaryComparison()
// {
// fReportViewer oviewer = new fReportViewer();
// DataSet dsSalaryComparison = new DataSet();
// DataRow orow = null;
// _SalaryMonth = GlobalFunctions.LastDateOfMonth(_selectedParameter.FromDate.Value);
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// dsSalaryComparison = MiscellaneousDataset.GetSalaryComparisonData(_SalaryMonth, sEmpID);
// PayrollDataSet.dsCompany.SalaryComparisonDataTable dtSalaryComparison = new Payroll.Report.PayrollDataSet.dsCompany.SalaryComparisonDataTable();
// if (dsSalaryComparison.Tables.Count > 0)
// {
// foreach (DataRow orr in dsSalaryComparison.Tables[0].Rows)
// {
// orow = dtSalaryComparison.NewRow();
// orow["EmpNo"] = orr["EMPLOYEENO"].ToString();
// orow["Name"] = orr["NAME"].ToString();
// orow["Grade"] = orr["Grade"].ToString();
// orow["Department"] = orr["Department"].ToString();
// orow["Designation"] = orr["Designation"].ToString();
// orow["CurSalary"] = Convert.ToDouble(orr["CurAmount"].ToString());
// orow["PrevSalary"] = Convert.ToDouble(orr["PrvAmount"].ToString());
// dtSalaryComparison.Rows.Add(orow);
// }
// if (dtSalaryComparison.Rows.Count > 0)
// {
// oviewer.ShowSalaryComparisonData(dtSalaryComparison, _SalaryMonth);
// }
// }
// }
// public void AuditReport()
// {
// fReportViewer oviewer = new fReportViewer();
// DataSet dsAuditReport = new DataSet();
// DataRow orow = null;
// _SalaryMonth = GlobalFunctions.LastDateOfMonth(_selectedParameter.FromDate.Value);
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// string sEmpNo = string.Empty;
// dsAuditReport = MiscellaneousDataset.GetEmpsAuditReport(_SalaryMonth, sEmpID);
// PayrollDataSet.dsCompany.DeptWiseCompanyDataTable dtAudit = new Payroll.Report.PayrollDataSet.dsCompany.DeptWiseCompanyDataTable();
// foreach (DataRow orr in dsAuditReport.Tables[0].Rows)
// {
// if (sEmpNo != orr["EMPLOYEENO"].ToString())
// {
// orow = dtAudit.NewRow();
// orow["EmpNo"] = orr["EMPLOYEENO"].ToString();
// orow["Name"] = orr["NAME"].ToString();
// orow["Grade"] = orr["Grade"].ToString();
// orow["Department"] = orr["Department"].ToString();
// orow["Designation"] = orr["Designation"].ToString();
// DateTime dJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
// orow["DOJ"] = dJoin.ToString("dd MMM yyyy");
// if (orr["BIRTHDATE"].ToString() != "")
// {
// DateTime dBirth = Convert.ToDateTime(orr["BIRTHDATE"].ToString());
// orow["DOB"] = dBirth.ToString("dd MMM yyyy");
// }
// else
// {
// orow["DOB"] = "";
// }
// if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Basic_Salary == Convert.ToInt32(orr["ITEMCODE"].ToString()) && (int)EnumSalaryItemCode.Basic_Salary == Convert.ToInt32(orr["ITEMID"].ToString()))
// {
// orow["BasicSalary"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Allowance == Convert.ToInt32(orr["ITEMCODE"].ToString()) && Convert.ToInt32(orr["ITEMID"].ToString()) == 1)
// {
// orow["HouseRent"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Allowance == Convert.ToInt32(orr["ITEMCODE"].ToString()) && Convert.ToInt32(orr["ITEMID"].ToString()) == 5)
// {
// orow["Lunch"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Deductions == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.PF_Contribution == Convert.ToInt32(orr["ITEMCODE"].ToString()) && (int)EnumSalaryItemCode.PF_Contribution == Convert.ToInt32(orr["ITEMID"].ToString()))
// {
// orow["CPF"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Allowance == Convert.ToInt32(orr["ITEMCODE"].ToString()) && Convert.ToInt32(orr["ITEMID"].ToString()) == 4)
// {
// orow["Conveyance"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Allowance == Convert.ToInt32(orr["ITEMCODE"].ToString()) && Convert.ToInt32(orr["ITEMID"].ToString()) == 3)
// {
// orow["Medical"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// orow["Bonus"] = 0;
// sEmpNo = orr["EMPLOYEENO"].ToString();
// dtAudit.Rows.Add(orow);
// }
// else if (sEmpNo == orr["EMPLOYEENO"].ToString())
// {
// if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Basic_Salary == Convert.ToInt32(orr["ITEMCODE"].ToString()) && (int)EnumSalaryItemCode.Basic_Salary == Convert.ToInt32(orr["ITEMID"].ToString()))
// {
// orow["BasicSalary"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Allowance == Convert.ToInt32(orr["ITEMCODE"].ToString()) && Convert.ToInt32(orr["ITEMID"].ToString()) == 1)
// {
// orow["HouseRent"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Allowance == Convert.ToInt32(orr["ITEMCODE"].ToString()) && Convert.ToInt32(orr["ITEMID"].ToString()) == 5)
// {
// orow["Lunch"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Deductions == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.PF_Contribution == Convert.ToInt32(orr["ITEMCODE"].ToString()) && (int)EnumSalaryItemCode.PF_Contribution == Convert.ToInt32(orr["ITEMID"].ToString()))
// {
// orow["CPF"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Allowance == Convert.ToInt32(orr["ITEMCODE"].ToString()) && Convert.ToInt32(orr["ITEMID"].ToString()) == 4)
// {
// orow["Conveyance"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// else if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()) && (int)EnumSalaryItemCode.Allowance == Convert.ToInt32(orr["ITEMCODE"].ToString()) && Convert.ToInt32(orr["ITEMID"].ToString()) == 3)
// {
// orow["Medical"] = Convert.ToDouble(orr["Amount"].ToString());
// }
// }
// }
// if (dtAudit.Rows.Count > 0)
// {
// oviewer.ShowAuditReport(dtAudit, _SalaryMonth);
// }
// }
// internal void PrepareSalaryCertificatedata(Employee oemp, Bank obank)
// {
// fReportViewer oviewer = new fReportViewer();
// DataSet dsSalaryCertificate = new DataSet();
// DataRow orow = null;
// if (obank.ID.Integer == 1)
// {
// dsSalaryCertificate = MiscellaneousDataset.GetSalaryCertificateData(oemp.ID.Integer, obank.ID.Integer);
// }
// else
// {
// dsSalaryCertificate = MiscellaneousDataset.GetSalaryCertificateDataforOtherBank(oemp.ID.Integer, obank.ID.Integer);
// }
// PayrollDataSet.dsCompany.SalaryCertificateDataTable dtSalary = new Payroll.Report.PayrollDataSet.dsCompany.SalaryCertificateDataTable();
// if (obank.ID.Integer == 1)
// {
// foreach (DataRow orr in dsSalaryCertificate.Tables[0].Rows)
// {
// orow = dtSalary.NewRow();
// orow["EmpName"] = orr["NAME"].ToString();
// orow["Designation"] = orr["Designation"].ToString();
// orow["Department"] = orr["Division"].ToString();
// DateTime dJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
// orow["DOJ"] = dJoin.ToString("dd MMM yyyy");
// if (orr["ENDOFCONTRACTDATE"].ToString() != "")
// {
// DateTime dtLeave = Convert.ToDateTime(orr["ENDOFCONTRACTDATE"].ToString());
// orow["DOL"] = dtLeave.ToString("dd MMM yyyy");
// }
// else
// {
// orow["DOL"] = "";
// }
// orow["BankName"] = orr["Bank"].ToString();
// orow["BankAddress"] = orr["ADDRESS"].ToString();
// orow["Salaries"] = orr["GrossAmount"].ToString();
// orow["Loan"] = orr["LoanAmount"].ToString();
// orow["TaxPF"] = orr["DeductAmount"].ToString();
// dtSalary.Rows.Add(orow);
// }
// }
// else
// {
// foreach (DataRow orr in dsSalaryCertificate.Tables[0].Rows)
// {
// orow = dtSalary.NewRow();
// orow["EmpName"] = orr["NAME"].ToString();
// orow["Designation"] = orr["Designation"].ToString();
// DateTime dJoin = Convert.ToDateTime(orr["JOININGDATE"].ToString());
// orow["DOJ"] = dJoin.ToString("dd MMM yyyy");
// if (orr["ENDOFCONTRACTDATE"].ToString() != "")
// {
// DateTime dtLeave = Convert.ToDateTime(orr["ENDOFCONTRACTDATE"].ToString());
// orow["DOL"] = dtLeave.ToString("dd MMM yyyy");
// }
// else
// {
// orow["DOL"] = "";
// }
// orow["BankName"] = orr["Bank"].ToString();
// orow["BankAddress"] = orr["BankAddress"].ToString();
// orow["SalariesDescription"] = orr["DESCRIPTION"].ToString();
// orow["Salaries"] = Convert.ToDouble(orr["Amount"].ToString());
// if ((int)EnumSalaryGroup.Gross == Convert.ToInt32(orr["ITEMGROUP"].ToString()))
// {
// orow["SalaryGroup"] = "Gross Salary";
// }
// else if ((int)EnumSalaryGroup.Deductions == Convert.ToInt32(orr["ITEMGROUP"].ToString()))
// {
// orow["SalaryGroup"] = "Total Deductions";
// }
// else
// {
// continue;
// }
// dtSalary.Rows.Add(orow);
// }
// }
// if (dtSalary.Rows.Count > 0)
// {
// oviewer.ShowSalaryCertificate(dtSalary, obank);
// }
// }
// public void param()
// {
// if (_selectedParameter.Banks.Count > 0)
// {
// foreach (Bank obank in _selectedParameter.Banks)
// {
// if (paramSqlbank == "")
// {
// paramSqlbank = "Bank : " + obank.Name;
// }
// else
// {
// paramSqlbank = paramSqlbank + "," + obank.Name;
// }
// }
// }
// if (paramSqlbank != "")
// {
// paramSqlParameter = paramSqlbank;
// }
// if (_selectedParameter.Categories.Count > 0)
// {
// foreach (Category ocat in _selectedParameter.Categories)
// {
// if (paramSqlCategory == "")
// {
// paramSqlCategory = " Category: " + ocat.Name;
// }
// else
// {
// paramSqlCategory = paramSqlCategory + "," + ocat.Name;
// }
// }
// }
// if (paramSqlCategory != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramSqlCategory;
// }
// else
// {
// paramSqlParameter = paramSqlCategory;
// }
// }
// if (_selectedParameter.Designations.Count > 0)
// {
// foreach (Designation oDesig in _selectedParameter.Designations)
// {
// if (paramDesignation == "")
// {
// paramDesignation = " Designation : " + oDesig.Name;
// }
// else
// {
// paramDesignation = paramDesignation + ", " + oDesig.Name;
// }
// }
// }
// if (paramDesignation != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramDesignation;
// }
// else
// {
// paramSqlParameter = paramDesignation;
// }
// }
// if (_selectedParameter.Departments.Count > 0)
// {
// foreach (Department odept in _selectedParameter.Departments)
// {
// if (paramSqlDepartment == "")
// {
// paramSqlDepartment = " Department: " + odept.Name;
// }
// else
// {
// paramSqlDepartment = paramSqlDepartment + "," + odept.Name;
// }
// }
// }
// if (paramSqlDepartment != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramSqlDepartment;
// }
// else
// {
// paramSqlParameter = paramSqlDepartment;
// }
// }
// if (_selectedParameter.Grades.Count > 0)
// {
// foreach (Grade ogr in _selectedParameter.Grades)
// {
// if (paramSqlGrade == "")
// {
// paramSqlGrade = " Grade: " + ogr.Name;
// }
// else
// {
// paramSqlGrade = paramSqlGrade + "," + ogr.Name;
// }
// }
// }
// if (paramSqlGrade != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramSqlGrade;
// }
// else
// {
// paramSqlParameter = paramSqlGrade;
// }
// }
// if (_selectedParameter.Gradesegments.Count > 0)
// {
// foreach (GradeSegment ogrSeg in _selectedParameter.Gradesegments)
// {
// if (paramSqlGradeSegment == "")
// {
// paramSqlGradeSegment = " Grade Segment: " + ogrSeg.Name;
// }
// else
// {
// paramSqlGradeSegment = paramSqlGradeSegment + "," + ogrSeg.Name;
// }
// }
// }
// if (paramSqlGradeSegment != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramSqlGradeSegment;
// }
// else
// {
// paramSqlParameter = paramSqlGradeSegment;
// }
// }
// if (_selectedParameter.Locations.Count > 0)
// {
// foreach (Location ol in _selectedParameter.Locations)
// {
// if (paramSqlLocation == "")
// {
// paramSqlLocation = " Location: " + ol.Name;
// }
// else
// {
// paramSqlLocation = paramSqlLocation + "," + ol.Name;
// }
// }
// }
// if (paramSqlLocation != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramSqlLocation;
// }
// else
// {
// paramSqlParameter = paramSqlLocation;
// }
// }
// if (_selectedParameter.Religions.Count > 0)
// {
// foreach (Religion oRe in _selectedParameter.Religions)
// {
// if (paramsqlReligion == "")
// {
// paramsqlReligion = " Religion: " + oRe.Name;
// }
// else
// {
// paramsqlReligion = paramsqlReligion + "," + oRe.Name;
// }
// }
// }
// if (paramsqlReligion != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramsqlReligion;
// }
// else
// {
// paramSqlParameter = paramsqlReligion;
// }
// }
// string sql = "";
// if (_selectedParameter.CostCenters.Count > 0)
// {
// foreach (Costcenter ocost in _selectedParameter.CostCenters)
// {
// if (paramSqlCostCenter == "")
// {
// paramSqlCostCenter = " Cost Center: " + ocost.Name;
// costcenterID = Convert.ToString(ocost.ID.Integer);
// }
// else
// {
// paramSqlCostCenter = paramSqlCostCenter + "," + ocost.Name;
// costcenterID = costcenterID + "," + Convert.ToString(ocost.ID.Integer);
// }
// }
// }
// if (paramSqlCostCenter != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramSqlCostCenter;
// }
// else
// {
// paramSqlParameter = paramSqlCostCenter;
// }
// }
// if (_selectedParameter.Branches.Count > 0)
// {
// foreach (Branch obranch in _selectedParameter.Branches)
// {
// if (paramSqlBranch == "")
// {
// paramSqlBranch = " Branch: " + obranch.Name;
// }
// else
// {
// paramSqlBranch = paramSqlBranch + "," + obranch.Name;
// }
// }
// }
// if (paramSqlBranch != "")
// {
// if (paramSqlParameter != "")
// {
// paramSqlParameter = paramSqlParameter + "," + paramSqlBranch;
// }
// else
// {
// paramSqlParameter = paramSqlBranch;
// }
// }
// }
// public void CTCDetail()
// {
// fReportViewer form = new fReportViewer();
// if (_selectedParameter.FromDate.Value <= _selectedParameter.ToDate.Value)
// {
// _SalaryMonth = _selectedParameter.FromDate.Value;
// _SalaryMonth2 = _selectedParameter.ToDate.Value;
// }
// else
// {
// _SalaryMonth2 = _selectedParameter.FromDate.Value;
// _SalaryMonth = _selectedParameter.ToDate.Value;
// }
// string sEmpID = _selectedParameter.ReportItem.INSQL;
// DataRow oDR = null;
// param();
// DataSet oSalarySheets = null;
// oSalarySheets = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), GlobalFunctions.LastDateOfMonth(_SalaryMonth2), sEmpID);
// List<string> selectedEmployeeNos = oSalarySheets.Tables["GrossItem"].AsEnumerable().Select(x => x["EMPLOYEENO"].ToString()).Distinct().ToList();
// ObjectsTemplate<Employee> oEmployees = new ObjectsTemplate<Employee>();
// Employee.GetByEmpIDs(sEmpID)
// .Where(x => selectedEmployeeNos.Contains(x.EmployeeNo))
// .ToList().ForEach(x => oEmployees.Add(x));
// PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
// DataSet oOPIRegister = null;
// oOPIRegister = OPIProcess.GetOPIRegister("", _SalaryMonth, _SalaryMonth2, sEmpID);
// PayrollDataSet.PayrollDataSet.OPIRegisterDataTable ddOPIRegData = new Payroll.Report.PayrollDataSet.PayrollDataSet.OPIRegisterDataTable();
// OpiCalculator opiCalculator = new OpiCalculator();
// opiCalculator.Process(oEmployees, Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
// #region Calcullate Dollar Rates
// ObjectsTemplate<DolarRate> oDolarRates = new ObjectsTemplate<DolarRate>();
// oDolarRates = DolarRate.GetLastSixMonth();
// double hRate = 0;
// double pRate = 0;
// double vRate = 0;
// foreach (DolarRate dr in oDolarRates)
// {
// vRate += dr.VehicleInterestRate;
// }
// if (vRate > 0)
// {
// vRate = 14 - (vRate / (double)oDolarRates.Count);
// }
// foreach (DolarRate dr in oDolarRates)
// {
// hRate += dr.HBInterestRate;
// }
// if (hRate > 0)
// {
// hRate = 14 - (hRate / (double)oDolarRates.Count);
// }
// foreach (DolarRate dr in oDolarRates)
// {
// pRate += dr.PersonalInterestRate;
// }
// if (pRate > 0)
// {
// pRate = 14 - (pRate / (double)oDolarRates.Count);
// }
// #endregion
// #region Loops of Salary Sheet
// foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopySalary(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopySalary(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// oDR = dTSalarySheet.NewRow();
// this.CopySalaryContra(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// //foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
// //{
// // oDR = dTSalarySheet.NewRow();
// // this.CopySalary(oDR, source);
// // dTSalarySheet.Rows.Add(oDR);
// //}
// //foreach (DataRow source in oSalarySheets.Tables["LeaveDays"].Rows)
// //{
// // oDR = dTSalarySheet.NewRow();
// // this.CopySalary(oDR, source);
// // dTSalarySheet.Rows.Add(oDR);
// //}
// //foreach (DataRow source in oSalarySheets.Tables["UnAuthorized"].Rows)
// //{
// // oDR = dTSalarySheet.NewRow();
// // this.CopySalary(oDR, source);
// // dTSalarySheet.Rows.Add(oDR);
// //}
// //foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
// //{
// // oDR = dTSalarySheet.NewRow();
// // this.CopySalary(oDR, source);
// // dTSalarySheet.Rows.Add(oDR);
// //}
// foreach (DataRow source in oSalarySheets.Tables["Bonus"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopySalary(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// //foreach (DataRow source in oSalarySheets.Tables["PerformanceBonus"].Rows)
// //{
// // oDR = dTSalarySheet.NewRow();
// // this.CopySalary(oDR, source);
// // dTSalarySheet.Rows.Add(oDR);
// //}
// //foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
// //{
// // oDR = dTSalarySheet.NewRow();
// // this.CopySalary(oDR, source);
// // dTSalarySheet.Rows.Add(oDR);
// //}
// foreach (DataRow source in oSalarySheets.Tables["CPF"].Rows)
// {
// oDR = dTSalarySheet.NewRow();
// this.CopySalary(oDR, source);
// dTSalarySheet.Rows.Add(oDR);
// }
// #endregion
// #region Loop of Calcullated OPI
// foreach (DataRow oRowIn in oOPIRegister.Tables[0].Rows)
// {
// string exist = "";
// string empNo = "";
// empNo = oRowIn["EMPLOYEENO"].ToString().Trim();
// try
// {
// DataRow oCRow = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x["EMPLOYEENO"].ToString().Trim() == empNo).FirstOrDefault();
// if (oCRow != null)
// {
// DataRow or = null;
// or = dTSalarySheet.NewRow();
// count = dTSalarySheet.Rows.Count;
// or["EmpNo"] = oRowIn["EmployeeNo"].ToString();
// or["EmpName"] = oRowIn["EmpName"].ToString();
// or["Grade"] = oCRow["GName"];
// or["Designation"] = oCRow["DName"];
// or["Department"] = oCRow["Dept"];
// or["JoiningDate"] = oCRow["JoiningDate"];
// or["Description"] = oRowIn["OPIItem"].ToString();
// or["Amount"] = GlobalFunctions.Round(Convert.ToDouble(oRowIn["Amount"].ToString()));
// count++;
// or["SLNo"] = count;
// dTSalarySheet.Rows.Add(or);
// }
// }
// catch (Exception ex)
// {
// throw new Exception(ex.Message);
// }
// }
// #endregion
// foreach (Employee oEmp in oEmployees)
// {
// DataRow oCRow = oSalarySheets.Tables["GrossItem"].AsEnumerable()
// .Where(x => x["EmployeeNo"].ToString().Trim() == oEmp.EmployeeNo.Trim())
// .FirstOrDefault();
// OPIProcessDetail opiProcDetail = opiCalculator.OpiProcessDetails.FirstOrDefault(x => x.EmployeeID == oEmp.ID);
// if (opiProcDetail != null)
// {
// DataRow or = null;
// or = dTSalarySheet.NewRow();
// or["EmpNo"] = oEmp.EmployeeNo;
// or["EmpName"] = oEmp.Name;
// or["Grade"] = oCRow["GName"];
// or["Designation"] = oCRow["DName"];
// or["Department"] = oCRow["Dept"];
// or["JoiningDate"] = oCRow["JoiningDate"];
// or["Description"] = "Group Insurance Premium";
// or["SLNo"] = count++;
// or["Amount"] = opiProcDetail.OPIProcessDetailItems.FirstOrDefault(o => o.OPIItemID.Integer == 1) != null ? opiProcDetail.OPIProcessDetailItems.FirstOrDefault(o => o.OPIItemID.Integer == 1).ChangeNetAmount * 12 : 0;
// dTSalarySheet.Rows.Add(or);
// or = null;
// or = dTSalarySheet.NewRow();
// or["EmpNo"] = oEmp.EmployeeNo;
// or["EmpName"] = oEmp.Name;
// or["Grade"] = oCRow["GName"];
// or["Designation"] = oCRow["DName"];
// or["Department"] = oCRow["Dept"];
// or["JoiningDate"] = oCRow["JoiningDate"];
// or["Description"] = "Health Insurance Premium";
// or["SLNo"] = count++;
// or["Amount"] = opiProcDetail.OPIProcessDetailItems.FirstOrDefault(o => o.OPIItemID.Integer == 2) != null ? opiProcDetail.OPIProcessDetailItems.FirstOrDefault(o => o.OPIItemID.Integer == 2).ChangeNetAmount * 12 : 0; //.ChangeNetAmount
// dTSalarySheet.Rows.Add(or);
// or = null;
// or = dTSalarySheet.NewRow();
// or["EmpNo"] = oEmp.EmployeeNo;
// or["EmpName"] = oEmp.Name;
// or["Grade"] = oCRow["GName"];
// or["Designation"] = oCRow["DName"];
// or["Department"] = oCRow["Dept"];
// or["JoiningDate"] = oCRow["JoiningDate"];
// or["Description"] = "Tution Refund";
// or["SLNo"] = count++;
// or["Amount"] = opiProcDetail.OPIProcessDetailItems.FirstOrDefault(o => o.OPIItemID.Integer == 3) != null ? opiProcDetail.OPIProcessDetailItems.FirstOrDefault(o => o.OPIItemID.Integer == 3).ChangeNetAmount * 12 : 0; //.ChangeNetAmount
// dTSalarySheet.Rows.Add(or);
// //dtrow["Emp1TuitionRefund"] = opiProcDetail.OPIProcessDetailItems.FirstOrDefault(o => o.OPIItemID.Integer == 3) != null ? opiProcDetail.OPIProcessDetailItems.FirstOrDefault(o => o.OPIItemID.Integer == 3).ChangeNetAmount * 12 : 0; //.ChangeNetAmount
// }
// LoanParameter vLoanParam = LoanParameter.GetApplicableParameter(oEmp, ID.FromInteger(4));
// if (vLoanParam != null)
// {
// DataRow or = null;
// or = dTSalarySheet.NewRow();
// or["EmpNo"] = oEmp.EmployeeNo;
// or["EmpName"] = oEmp.Name;
// or["Grade"] = oCRow["GName"];
// or["Designation"] = oCRow["DName"];
// or["Department"] = oCRow["Dept"];
// or["JoiningDate"] = oCRow["JoiningDate"];
// or["Description"] = "CL Interest Saving";
// or["SLNo"] = count++;
// //double nMaxAmount = vLoanParam.NoOfBasic * oEmp.BasicSalary +
// // vLoanParam.NoOfGross * oEmp.GrossSalary + vLoanParam.MaxFlatAmount;
// double nMaxAmount = vLoanParam.MaxFlatAmount;
// or["Amount"] = GlobalFunctions.Round(nMaxAmount * vRate / 100);
// dTSalarySheet.Rows.Add(or);
// }
// LoanParameter pLoanParam = LoanParameter.GetApplicableParameter(oEmp, ID.FromInteger(3));
// if (pLoanParam != null)
// {
// DataRow or = null;
// or = dTSalarySheet.NewRow();
// or["EmpNo"] = oEmp.EmployeeNo;
// or["EmpName"] = oEmp.Name;
// or["Grade"] = oCRow["GName"];
// or["Designation"] = oCRow["DName"];
// or["Department"] = oCRow["Dept"];
// or["JoiningDate"] = oCRow["JoiningDate"];
// or["Description"] = "PL Interest Saving";
// or["SLNo"] = count++;
// double nMaxAmount = pLoanParam.MaxFlatAmount;
// or["Amount"] = GlobalFunctions.Round(nMaxAmount * pRate / 100);
// dTSalarySheet.Rows.Add(or);
// }
// LoanParameter hLoanParam = LoanParameter.GetApplicableParameter(oEmp, ID.FromInteger(2));
// if (hLoanParam != null)
// {
// DataRow or = null;
// or = dTSalarySheet.NewRow();
// or["EmpNo"] = oEmp.EmployeeNo;
// or["EmpName"] = oEmp.Name;
// or["Grade"] = oCRow["GName"];
// or["Designation"] = oCRow["DName"];
// or["Department"] = oCRow["Dept"];
// or["JoiningDate"] = oCRow["JoiningDate"];
// or["Description"] = "HBL Interest Saving";
// or["SLNo"] = count++;
// double nMaxAmount = hLoanParam.MaxFlatAmount;
// or["Amount"] = GlobalFunctions.Round(nMaxAmount * hRate / 100);
// dTSalarySheet.Rows.Add(or);
// }
// }
// //return dTSalarySheet;
// form.ShowDlgForCTCReport(_selectedParameter.ReportItem, dTSalarySheet, paramSqlParameter, _SalaryMonth.ToString("MMM yyyy"), _SalaryMonth2.ToString("MMM yyyy"));
// }
// public void SalaryRegister()
// {
// fReportViewer form = new fReportViewer();
// _SalaryMonth = _selectedParameter.FromDate.Value;
// DateTime firstDateOfMonth = GlobalFunctions.FirstDateOfMonth(_SalaryMonth);
// DateTime lastDateOfMonth = GlobalFunctions.LastDateOfMonth(_SalaryMonth);
// string sEmpIDs = _selectedParameter.ReportItem.INSQL;
// DataSet dsSalaryRegister = MiscellaneousDataset.GetSalaryRegister(firstDateOfMonth, lastDateOfMonth, sEmpIDs);
// DataRow oDR = null;
// DataRow oDRTemp = null;
// PayrollDataSet.PayrollDataSet.SalaryRegisterDataTable dTSalaryRegister = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryRegisterDataTable();
// PayrollDataSet.PayrollDataSet.SalaryRegisterDataTable dTSalaryRegisterTemp = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalaryRegisterDataTable();
// double pf = 0;
// DataRow dRow = null;
// if (BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1)
// {
// foreach (DataRow dr in dsSalaryRegister.Tables[0].Rows)
// {
// foreach (DataColumn dc in dsSalaryRegister.Tables[0].Columns)
// {
// if (dr[dc].ToString() == "PF")
// {
// dr[9] = "E006";
// dr[10] = "Company Contribution of PF";
// pf = Convert.ToDouble(dr[11]);
// DataRow dr1 = dsSalaryRegister.Tables[0].AsEnumerable().Where(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E022").FirstOrDefault();
// DataRow dr2 = dsSalaryRegister.Tables[0].AsEnumerable().Where(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D006").FirstOrDefault();
// dr1[11] = pf + Convert.ToDouble(dr1[11]);
// dr2[11] = pf + Convert.ToDouble(dr2[11]);
// dRow = dTSalaryRegisterTemp.NewRow();
// dRow.ItemArray = dr.ItemArray.Clone() as object[];
// dRow[9] = "D007";
// dRow[10] = "EE Contribution to PF";
// dTSalaryRegisterTemp.Rows.Add(dRow);
// dRow = dTSalaryRegisterTemp.NewRow();
// dRow.ItemArray = dr.ItemArray.Clone() as object[];
// dRow[9] = "D008";
// dRow[10] = "ER Contribution to PF";
// dTSalaryRegisterTemp.Rows.Add(dRow.ItemArray.Clone() as object[]);
// pf = 0;
// }
// if (dr[dc].ToString() == "STA Tax Deduction")
// {
// dr[10] = "Income Tax (On STA Allowance)";
// }
// }
// dTSalaryRegisterTemp.Rows.Add(dr.ItemArray.Clone() as object[]);
// }
// DataTable dTSalaryRegisterTemp1 = dTSalaryRegisterTemp;
// string empNo = string.Empty;
// foreach (DataRow dr in dTSalaryRegisterTemp1.Rows)
// {
// if (dr["EmployeeID"].ToString() != empNo)
// {
// #region Hard Code
// bool e002 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E002");
// if (!e002)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E002";
// oDRTemp[10] = "House Rent";
// oDRTemp[11] = 0;
// oDRTemp[13] = 2;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e003 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E003");
// if (!e003)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E003";
// oDRTemp[10] = "Conveyance";
// oDRTemp[11] = 0;
// oDRTemp[13] = 3;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e004 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E004");
// if (!e004)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E004";
// oDRTemp[10] = "Car/Transport Allowance";
// oDRTemp[11] = 0;
// oDRTemp[13] = 4;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e005 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E005");
// if (!e005)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E005";
// oDRTemp[10] = "Company Contribution of CIRSP";
// oDRTemp[11] = 0;
// oDRTemp[13] = 5;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e006 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E006");
// if (!e006)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E006";
// oDRTemp[10] = "Company Contribution of PF";
// oDRTemp[11] = 0;
// oDRTemp[13] = 6;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e007 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E007");
// if (!e007)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E007";
// oDRTemp[10] = "Cash Recognition";
// oDRTemp[11] = 0;
// oDRTemp[13] = 7;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e008 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E008");
// if (!e008)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E008";
// oDRTemp[10] = "IP Country Allowance";
// oDRTemp[11] = 0;
// oDRTemp[13] = 8;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e009 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E009");
// if (!e009)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E009";
// oDRTemp[10] = "On Call";
// oDRTemp[11] = 0;
// oDRTemp[13] = 9;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e010 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E010");
// if (!e010)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E010";
// oDRTemp[10] = "Prem. Ass";
// oDRTemp[11] = 0;
// oDRTemp[13] = 10;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e011 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E011");
// if (!e011)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E011";
// oDRTemp[10] = "STA";
// oDRTemp[11] = 0;
// oDRTemp[13] = 11;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e012 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E012");
// if (!e012)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E012";
// oDRTemp[10] = "Tax Paid by Company";
// oDRTemp[11] = 0;
// oDRTemp[13] = 12;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e013 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E013");
// if (!e013)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E013";
// oDRTemp[10] = "Travel Assistant";
// oDRTemp[11] = 0;
// oDRTemp[13] = 13;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e014 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E014");
// if (!e014)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E014";
// oDRTemp[10] = "On site";
// oDRTemp[11] = 0;
// oDRTemp[13] = 14;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e015 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E015");
// if (!e015)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E015";
// oDRTemp[10] = "Health Club Membership (Other)";
// oDRTemp[11] = 0;
// oDRTemp[13] = 15;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e016 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E016");
// if (!e016)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E016";
// oDRTemp[10] = "STP (Incentive)";
// oDRTemp[11] = 0;
// oDRTemp[13] = 16;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e017 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E017");
// if (!e017)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E017";
// oDRTemp[10] = "Sales Incentive";
// oDRTemp[11] = 0;
// oDRTemp[13] = 17;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e018 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E018");
// if (!e018)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E018";
// oDRTemp[10] = "Special Allowance";
// oDRTemp[11] = 0;
// oDRTemp[13] = 18;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e019 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E019");
// if (!e019)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E019";
// oDRTemp[10] = "LTP";
// oDRTemp[11] = 0;
// oDRTemp[13] = 19;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e020 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E020");
// if (!e020)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E020";
// oDRTemp[10] = "Arrear";
// oDRTemp[11] = 0;
// oDRTemp[13] = 20;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e027 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E027");
// if (!e027)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E027";
// oDRTemp[10] = "Medical Allowance";
// oDRTemp[11] = 0;
// oDRTemp[13] = 21;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e028 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E028");
// if (!e028)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E028";
// oDRTemp[10] = "Festive Bonus";
// oDRTemp[11] = 0;
// oDRTemp[13] = 22;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e029 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E029");
// if (!e029)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E029";
// oDRTemp[10] = "Internet Allowances";
// oDRTemp[11] = 0;
// oDRTemp[13] = 23;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e030 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E030");
// if (!e030)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E030";
// oDRTemp[10] = "C&S Differencial";
// oDRTemp[11] = 0;
// oDRTemp[13] = 24;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e031 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E031");
// if (!e031)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E031";
// oDRTemp[10] = "Special Risk Premium";
// oDRTemp[11] = 0;
// oDRTemp[13] = 25;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e032 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E032");
// if (!e032)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[8] = "N";
// oDRTemp[9] = "E032";
// oDRTemp[10] = "Furniture Allowance";
// oDRTemp[11] = 0;
// oDRTemp[13] = 26;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e033 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E033");
// if (!e033)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[8] = "N";
// oDRTemp[9] = "E033";
// oDRTemp[10] = "Appliances Allowance";
// oDRTemp[11] = 0;
// oDRTemp[13] = 27;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e035 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E035");
// if (!e035)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E035";
// oDRTemp[10] = "Hardship Allowance";
// oDRTemp[11] = 0;
// oDRTemp[13] = 28;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e036 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E036");
// if (!e036)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E036";
// oDRTemp[10] = "ADDITIONAL PREMIUM";
// oDRTemp[11] = 0;
// oDRTemp[13] = 29;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e037 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E037");
// if (!e037)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E037";
// oDRTemp[10] = "Expat Other Benefit";
// oDRTemp[11] = 0;
// oDRTemp[13] = 29;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e039 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E039");
// if (!e039)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E039";
// oDRTemp[10] = "Expat Rel Hous Fee";
// oDRTemp[11] = 0;
// oDRTemp[13] = 29;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e021 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E021");
// if (!e021)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E021";
// oDRTemp[10] = "Others (Earnings-if any)";
// oDRTemp[11] = 0;
// oDRTemp[13] = 30;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e023 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E023");
// if (!e023)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E023";
// oDRTemp[10] = "Leave Accrual";
// oDRTemp[11] = 0;
// oDRTemp[13] = 30;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e024 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E024");
// if (!e024)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E024";
// oDRTemp[10] = "Technical Sales Incentive Plan (TSIP)";
// oDRTemp[11] = 0;
// oDRTemp[13] = 32;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e0024 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E0024");
// if (!e0024)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E0024";
// oDRTemp[10] = "Share based Compensation Expenses, PS";
// oDRTemp[11] = 0;
// oDRTemp[13] = 33;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e026 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E026");
// if (!e026)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "E026";
// oDRTemp[10] = "Performance Driven Incentive Plan";
// oDRTemp[11] = 0;
// oDRTemp[13] = 34;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d001 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D001");
// if (!d001)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "D001";
// oDRTemp[10] = "Income Tax (On STA Allowance)";
// oDRTemp[11] = 0;
// oDRTemp[13] = 36;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d002 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D002");
// if (!d002)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "D002";
// oDRTemp[10] = "Both Contribution of CIRSP";
// oDRTemp[11] = 0;
// oDRTemp[13] = 37;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d003 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D003");
// if (!d003)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "D003";
// oDRTemp[10] = "Both Contribution of PF";
// oDRTemp[11] = 0;
// oDRTemp[13] = 38;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d004 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D004");
// if (!d004)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "D004";
// oDRTemp[10] = "Income Tax";
// oDRTemp[11] = 0;
// oDRTemp[13] = 39;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d005 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D005");
// if (!d005)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "D005";
// oDRTemp[10] = "PF Loan";
// oDRTemp[11] = 0;
// oDRTemp[13] = 40;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d009 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D009");
// if (!d009)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "D009";
// oDRTemp[10] = "Others (Deduction-if any)";
// oDRTemp[11] = 0;
// oDRTemp[13] = 41;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d007 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D007");
// if (!d007)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "D007";
// oDRTemp[10] = "EE Contribution to PF";
// oDRTemp[11] = 0;
// oDRTemp[13] = 42;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d008 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D008");
// if (!d008)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp[9] = "D008";
// oDRTemp[10] = "ER Contribution to PF";
// oDRTemp[11] = 0;
// oDRTemp[13] = 43;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// #endregion
// empNo = dr["EmployeeID"].ToString();
// }
// }
// foreach (DataRow drSource in dTSalaryRegisterTemp.Rows)
// {
// oDR = dTSalaryRegister.NewRow();
// CopyToSalaryRegisterTableNokia(oDR, drSource);
// dTSalaryRegister.Rows.Add(oDR);
// }
// }
// else if (BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 3)
// {
// #region PF
// foreach (DataRow dr in dsSalaryRegister.Tables[0].Rows)
// {
// foreach (DataColumn dc in dsSalaryRegister.Tables[0].Columns)
// {
// if (dr[dc].ToString() == "PF")
// {
// dr["PayElementCode"] = "E021";
// dr["Description"] = "Company Contribution of PF";
// pf = Convert.ToDouble(dr["Amount"]);
// DataRow dr1 = dsSalaryRegister.Tables[0].AsEnumerable().Where(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E022").FirstOrDefault();
// DataRow dr2 = dsSalaryRegister.Tables[0].AsEnumerable().Where(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D006").FirstOrDefault();
// dr1["Amount"] = pf + Convert.ToDouble(dr1["Amount"]);
// dr2["Amount"] = pf + Convert.ToDouble(dr2["Amount"]);
// dRow = dTSalaryRegisterTemp.NewRow();
// dRow.ItemArray = dr.ItemArray.Clone() as object[];
// dRow["PayElementCode"] = "D007";
// dRow["Description"] = "EE Contribution to PF";
// dTSalaryRegisterTemp.Rows.Add(dRow);
// dRow = dTSalaryRegisterTemp.NewRow();
// dRow.ItemArray = dr.ItemArray.Clone() as object[];
// dRow["PayElementCode"] = "D008";
// dRow["Description"] = "ER Contribution to PF";
// dTSalaryRegisterTemp.Rows.Add(dRow.ItemArray.Clone() as object[]);
// pf = 0;
// }
// if (dr[dc].ToString() == "Basic")
// {
// dr[10] = "Basic Salary";
// }
// }
// dTSalaryRegisterTemp.Rows.Add(dr.ItemArray.Clone() as object[]);
// }
// #endregion
// #region Add Code
// DataTable dTSalaryRegisterTemp1 = dTSalaryRegisterTemp;
// string empNo = string.Empty;
// foreach (DataRow dr in dTSalaryRegisterTemp1.Rows)
// {
// if (dr["EmployeeID"].ToString() != empNo)
// {
// #region Hard Code
// bool e001 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E001");
// if (!e001)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "Basic Salary";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 1;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e002 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E002");
// if (!e002)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "House Rent";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 2;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e021 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E021");
// if (!e021)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "Company Contribution of PF";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 3;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e003 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E003");
// if (!e003)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "CBP";
// oDRTemp["ProcessType"] = "N";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 4;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e004 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E004");
// if (!e004)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "Contractual Bonus";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 5;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e005 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E005");
// if (!e005)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "Festival Bonus";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 6;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e006 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E006");
// if (!e006)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "LFA";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 7;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e007 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E007");
// if (!e007)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "Others (Earnings-if any)";
// oDRTemp["ProcessType"] = "N";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 8;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool e022 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "E022");
// if (!e022)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "E";
// oDRTemp["Description"] = "Total Earnings";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 9;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d004 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D004");
// if (!d004)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "D";
// oDRTemp["Description"] = "Income Tax";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 10;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d003 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D003");
// if (!d003)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "D";
// oDRTemp["Description"] = "PF Loan";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 11;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d007 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D007");
// if (!d007)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "D";
// oDRTemp["Description"] = "EE Contribution to PF";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 12;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d008 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D008");
// if (!d008)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "D";
// oDRTemp["Description"] = "ER Contribution to PF";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 13;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d001 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D001");
// if (!d001)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "D";
// oDRTemp["Description"] = "Excess Mobile Bill";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 14;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d002 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D002");
// if (!d002)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "D";
// oDRTemp["Description"] = "Others (Deduction-if any)";
// oDRTemp["ProcessType"] = "N";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 15;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool d006 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "D006");
// if (!d006)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "D";
// oDRTemp["Description"] = "Total Deductions";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 16;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// bool o001 = dTSalaryRegisterTemp1.AsEnumerable().Any(x => x["EmployeeID"].ToString() == dr["EmployeeID"].ToString() && x["PayElementCode"].ToString() == "O001");
// if (!o001)
// {
// oDRTemp = dTSalaryRegister.NewRow();
// oDRTemp.ItemArray = dr.ItemArray.Clone() as object[];
// oDRTemp["PayElementCode"] = "O";
// oDRTemp["Description"] = "Net Amount";
// oDRTemp["Amount"] = 0;
// oDRTemp["Serial"] = 17;
// dTSalaryRegister.Rows.Add(oDRTemp);
// }
// #endregion
// empNo = dr["EmployeeID"].ToString();
// }
// }
// #endregion
// foreach (DataRow drSource in dTSalaryRegisterTemp.Rows)
// {
// oDR = dTSalaryRegister.NewRow();
// CopyToSalaryRegisterTableAPLL(oDR, drSource);
// dTSalaryRegister.Rows.Add(oDR);
// }
// }
// DataSet dSet = new DataSet();
// dTSalaryRegister.TableName = "PayrollDataSet_SalaryRegister";
// dSet.Tables.Add(dTSalaryRegister);
// List<ReportParameter> parameters = new List<ReportParameter>();
// parameters.Add(new ReportParameter("PayrollTypeID", BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer.ToString()));
// form.CommonReportView(null, dSet, "Payroll.Report.RDLC.SalaryRegister.rdlc", parameters);
// }
// public void CopyToSalaryRegisterTableNokia(DataRow destination, DataRow source)
// {
// destination.ItemArray = source.ItemArray.Clone() as object[];
// #region Pay Element Code
// if (source["PayElementCode"].ToString() == "E001")
// {
// destination["Serial"] = 1;
// }
// else if (source["PayElementCode"].ToString() == "E002")
// {
// destination["Serial"] = 2;
// }
// else if (source["PayElementCode"].ToString() == "E003")
// {
// destination["Serial"] = 3;
// }
// else if (source["PayElementCode"].ToString() == "E004")
// {
// destination["Serial"] = 4;
// }
// else if (source["PayElementCode"].ToString() == "E005")
// {
// destination["Serial"] = 5;
// }
// else if (source["PayElementCode"].ToString() == "E006")
// {
// destination["Serial"] = 6;
// }
// else if (source["PayElementCode"].ToString() == "E007")
// {
// destination["Serial"] = 7;
// }
// else if (source["PayElementCode"].ToString() == "E008")
// {
// destination["Serial"] = 8;
// }
// else if (source["PayElementCode"].ToString() == "E009")
// {
// destination["Serial"] = 9;
// }
// else if (source["PayElementCode"].ToString() == "E010")
// {
// destination["Serial"] = 10;
// }
// else if (source["PayElementCode"].ToString() == "E011")
// {
// destination["Serial"] = 11;
// }
// else if (source["PayElementCode"].ToString() == "E012")
// {
// destination["Serial"] = 12;
// }
// else if (source["PayElementCode"].ToString() == "E013")
// {
// destination["Serial"] = 13;
// }
// else if (source["PayElementCode"].ToString() == "E014")
// {
// destination["Serial"] = 14;
// }
// else if (source["PayElementCode"].ToString() == "E015")
// {
// destination["Serial"] = 15;
// }
// else if (source["PayElementCode"].ToString() == "E016")
// {
// destination["Serial"] = 16;
// }
// else if (source["PayElementCode"].ToString() == "E017")
// {
// destination["Serial"] = 17;
// }
// else if (source["PayElementCode"].ToString() == "E018")
// {
// destination["Serial"] = 18;
// }
// else if (source["PayElementCode"].ToString() == "E019")
// {
// destination["Serial"] = 19;
// }
// else if (source["PayElementCode"].ToString() == "E020")
// {
// destination["Serial"] = 20;
// }
// else if (source["PayElementCode"].ToString() == "E027")
// {
// destination["Serial"] = 21;
// }
// else if (source["PayElementCode"].ToString() == "E028")
// {
// destination["Serial"] = 22;
// }
// else if (source["PayElementCode"].ToString() == "E029")
// {
// destination["Serial"] = 23;
// }
// else if (source["PayElementCode"].ToString() == "E030")
// {
// destination["Serial"] = 24;
// }
// else if (source["PayElementCode"].ToString() == "E031")
// {
// destination["Serial"] = 25;
// }
// else if (source["PayElementCode"].ToString() == "E032")
// {
// destination["Serial"] = 26;
// }
// else if (source["PayElementCode"].ToString() == "E033")
// {
// destination["Serial"] = 27;
// }
// else if (source["PayElementCode"].ToString() == "E035")
// {
// destination["Serial"] = 28;
// }
// else if (source["PayElementCode"].ToString() == "E036")
// {
// destination["Serial"] = 29;
// }
// else if (source["PayElementCode"].ToString() == "E037")
// {
// destination["Serial"] = 29;
// }
// else if (source["PayElementCode"].ToString() == "E039")
// {
// destination["Serial"] = 29;
// }
// else if (source["PayElementCode"].ToString() == "E021")
// {
// destination["Serial"] = 30;
// }
// else if (source["PayElementCode"].ToString() == "E023")
// {
// destination["Serial"] = 31;
// }
// else if (source["PayElementCode"].ToString() == "E024")
// {
// destination["Serial"] = 32;
// }
// else if (source["PayElementCode"].ToString() == "E0024")
// {
// destination["Serial"] = 33;
// }
// else if (source["PayElementCode"].ToString() == "E026")
// {
// destination["Serial"] = 34;
// }
// else if (source["PayElementCode"].ToString() == "E022")
// {
// destination["Serial"] = 35;
// }
// else if (source["PayElementCode"].ToString() == "D001")
// {
// destination["Serial"] = 36;
// }
// else if (source["PayElementCode"].ToString() == "D002")
// {
// destination["Serial"] = 37;
// }
// else if (source["PayElementCode"].ToString() == "D003")
// {
// destination["Serial"] = 38;
// }
// else if (source["PayElementCode"].ToString() == "D004")
// {
// destination["Serial"] = 39;
// }
// else if (source["PayElementCode"].ToString() == "D005")
// {
// destination["Serial"] = 40;
// }
// else if (source["PayElementCode"].ToString() == "D009")
// {
// destination["Serial"] = 41;
// }
// else if (source["PayElementCode"].ToString() == "D007")
// {
// destination["Serial"] = 42;
// }
// else if (source["PayElementCode"].ToString() == "D008")
// {
// destination["Serial"] = 43;
// }
// else if (source["PayElementCode"].ToString() == "D006")
// {
// destination["Serial"] = 44;
// }
// else if (source["PayElementCode"].ToString() == "O001")
// {
// destination["Serial"] = 45;
// }
// #endregion
// }
// public void CopyToSalaryRegisterTableAPLL(DataRow destination, DataRow source)
// {
// destination.ItemArray = source.ItemArray.Clone() as object[];
// #region Pay Element Code
// if (source["Description"].ToString() == "Basic Salary")
// {
// destination["PayElementCode"] = "E";
// destination["Serial"] = 1;
// }
// else if (source["Description"].ToString() == "House Rent")
// {
// destination["PayElementCode"] = "E";
// destination["Serial"] = 2;
// }
// else if (source["Description"].ToString() == "Company Contribution of PF")
// {
// destination["PayElementCode"] = "E";
// destination["Serial"] = 3;
// }
// else if (source["Description"].ToString() == "CBP")
// {
// destination["PayElementCode"] = "E";
// destination["ProcessType"] = "N";
// destination["Serial"] = 4;
// }
// else if (source["Description"].ToString() == "Contractual Bonus")
// {
// destination["PayElementCode"] = "E";
// destination["Serial"] = 5;
// }
// else if (source["Description"].ToString() == "Festival Bonus")
// {
// destination["PayElementCode"] = "E";
// destination["Serial"] = 6;
// }
// else if (source["Description"].ToString() == "LFA")
// {
// destination["PayElementCode"] = "D";
// destination["Serial"] = 7;
// }
// else if (source["Description"].ToString() == "Others (Earnings-if any)")
// {
// destination["PayElementCode"] = "E";
// destination["ProcessType"] = "N";
// destination["Serial"] = 8;
// }
// else if (source["Description"].ToString() == "Total Earnings")
// {
// destination["PayElementCode"] = "E";
// destination["Serial"] = 9;
// }
// else if (source["Description"].ToString() == "Income Tax")
// {
// destination["PayElementCode"] = "D";
// destination["Serial"] = 10;
// }
// else if (source["Description"].ToString() == "PF Loan")
// {
// destination["PayElementCode"] = "D";
// destination["Serial"] = 11;
// }
// else if (source["Description"].ToString() == "EE Contribution to PF")
// {
// destination["PayElementCode"] = "D";
// destination["Serial"] = 12;
// }
// else if (source["Description"].ToString() == "ER Contribution to PF")
// {
// destination["PayElementCode"] = "D";
// destination["Serial"] = 13;
// }
// else if (source["Description"].ToString() == "Excess Mobile Bill")
// {
// destination["PayElementCode"] = "O";
// destination["Serial"] = 14;
// }
// else if (source["Description"].ToString() == "Others (Deduction-if any)")
// {
// destination["PayElementCode"] = "D";
// destination["ProcessType"] = "N";
// destination["Serial"] = 15;
// }
// else if (source["Description"].ToString() == "Total Deductions")
// {
// destination["PayElementCode"] = "D";
// destination["Serial"] = 16;
// }
// else if (source["Description"].ToString() == "Net Amount")
// {
// destination["PayElementCode"] = "O";
// destination["Serial"] = 17;
// }
// #endregion
// }
// }
// public class ItemList
// {
// public string ItemName { get; set; }
// public double Amount { get; set; }
// }
//}