5977 lines
280 KiB
C#
5977 lines
280 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Data;
|
|
using Payroll.BO;
|
|
using Ease.CoreV35.Model;
|
|
using System.Text.RegularExpressions;
|
|
|
|
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 = "";
|
|
|
|
string firstWord = string.Empty;
|
|
string secondWord = string.Empty;
|
|
|
|
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;
|
|
|
|
public ReportSetup SelectedParameter
|
|
{
|
|
set
|
|
{
|
|
_selectedParameter = value;
|
|
}
|
|
}
|
|
|
|
public rptSalarySheet()
|
|
{
|
|
|
|
|
|
}
|
|
|
|
private void Copy(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["Department"];
|
|
source["Description"] = destination["Description"];
|
|
source["Amount"] = destination["Amount"];
|
|
source["SalaryMonth"] = _SalaryMonth;
|
|
source["JoiningDate"] = destination["JoiningDate"];
|
|
source["Division"] = destination["Division"];
|
|
source["AccountNo"] = destination["ACCOUNTNO"];
|
|
source["BankName"] = destination["BankName"];
|
|
//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 ShowReportForEuro()
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
_SalaryMonth = _selectedParameter.FromDate.Value;
|
|
ID nReportID = _selectedParameter.ReportItem.ReportID;
|
|
string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
|
|
oSalarySheets = SalaryMonthly.GetEmpEuroSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
|
|
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
|
|
|
|
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["TotalAmount"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
form.ShowDlgForEuroSalarySheet(_selectedParameter.ReportItem, dTSalarySheet, nReportID);
|
|
}
|
|
|
|
public void ShowExpatSalarySheetReport()
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
_SalaryMonth = _selectedParameter.FromDate.Value;
|
|
ID nReportID = _selectedParameter.ReportItem.ReportID;
|
|
string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
|
|
oSalarySheets = SalaryMonthly.GetExpatSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
|
|
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
|
|
|
|
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["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);
|
|
}
|
|
|
|
|
|
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["EuroItem"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["TotalEuroAmount"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
form.ShowDlgForExpatSalarySheet(_selectedParameter.ReportItem, dTSalarySheet, nReportID);
|
|
}
|
|
|
|
|
|
private void GetRow(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"] = GlobalFunctions.TakaFormat(Convert.ToDouble(destination["Amount"]));
|
|
source["SalaryMonth"] = _SalaryMonth;
|
|
source["MonthOfYear"] = destination["SalaryMonth"];
|
|
|
|
|
|
if (destination.Table.Columns.Contains("CostCenter"))
|
|
{
|
|
source["CostCenter"] = destination["CostCenter"];
|
|
}
|
|
//source["SLNo"] = destination["EMPLOYEEID"];
|
|
}
|
|
|
|
public void ShowReportWithArreaForManagement()
|
|
{
|
|
|
|
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();
|
|
|
|
#region Loop Start
|
|
foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyDataWithArrear(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyDataWithArrear(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyDataWithArrear(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["TotalDeduction"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyDataWithArrear(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["NetPay"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyDataWithArrear(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 ShowReportForPayRollRegisterForAll(string emps, DateTime fstDate, DateTime endDate)
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
string sEmpID = emps;
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
oSalarySheets = SalaryMonthly.GetEmpStartDateAndEndDate(fstDate, endDate, sEmpID);
|
|
PayrollDataSet.PayrollDataSet.SalarySheetByMonthDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetByMonthDataTable();
|
|
PayrollDataSet.PayrollDataSet.PayRollRegisterForAllDataTable PayRollRegister = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayRollRegisterForAllDataTable();
|
|
PayrollDataSet.PayrollDataSet.PayRollRegisterForAllDataTable PayRollRegisterAll = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayRollRegisterForAllDataTable();
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables[0].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.GetRow(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables[1].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.GetRow(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables[2].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.GetRow(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables[3].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.GetRow(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables[4].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.GetRow(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables[5].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.GetRow(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables[6].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.GetRow(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
//var query = from DataRow dr in dTSalarySheet.Rows
|
|
// group dr by
|
|
// new
|
|
// {
|
|
// a = dr["EmpNo"].ToString(),
|
|
// b = dr["Description"].ToString(),
|
|
// c = dr["GCode"].ToString(),
|
|
// d = dr["CostCenter"].ToString(),
|
|
// e = dr["MonthOfYear"].ToString()
|
|
// }
|
|
// into rslt
|
|
// select new
|
|
// {
|
|
// k = rslt,
|
|
// v = rslt.Sum(ob => Convert.ToDouble(ob.ItemArray.GetValue(6).ToString()))
|
|
// };
|
|
//DataRow fdr = null;
|
|
//foreach (var it in query)
|
|
//{
|
|
// fdr = PayRollRegister.NewRow();
|
|
// fdr["EmpNo"] = it.k.Key.a;
|
|
// fdr["Description"] = it.k.Key.b;
|
|
// fdr["Amount"] = it.v;
|
|
// fdr["FakeDes"] = it.k.Key.b;
|
|
// fdr["EmpName"] = it.k.Select(ob => ob.ItemArray.GetValue(15)).First();
|
|
// fdr["GCode"] = it.k.Key.c;
|
|
// fdr["CostCenter"] = it.k.Key.d;
|
|
// fdr["SalaryMonth"] = it.k.Key.e;
|
|
// PayRollRegister.Rows.Add(fdr);
|
|
//}
|
|
|
|
foreach (DataRow drow in dTSalarySheet.Rows)
|
|
{
|
|
DataRow nDr = PayRollRegisterAll.NewRow();
|
|
nDr["EmpNo"] = drow["EmpNo"];
|
|
nDr["Description"] = drow["Description"];
|
|
nDr["Amount"] = drow["Amount"];
|
|
nDr["FakeDes"] = drow["Description"];
|
|
nDr["EmpName"] = drow["EmpName"];
|
|
nDr["GCode"] = drow["GCode"];
|
|
nDr["CostCenter"] = drow["CostCenter"];
|
|
nDr["SalaryMonth"] = drow["MonthOfYear"];
|
|
PayRollRegisterAll.Rows.Add(nDr);
|
|
}
|
|
|
|
//var sortedData = from DataRow dr in PayRollRegister.Rows orderby dr["SalaryMonth"] select dr;
|
|
|
|
//foreach (DataRow dr in sortedData)
|
|
//{
|
|
// DataRow nDr = PayRollRegisterAll.NewRow();
|
|
// nDr.ItemArray = dr.ItemArray;
|
|
|
|
// PayRollRegisterAll.Rows.Add(nDr);
|
|
//}
|
|
|
|
form.ShowPayRollRegisterByAll(PayRollRegisterAll);
|
|
}
|
|
|
|
public void ShowReportForSalaryForTax(DateTime fstDate, DateTime endDate)
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
oSalarySheets = SalaryMonthly.GetSalaryForTax(fstDate, endDate);
|
|
PayrollDataSet.dsCompany.SalaryForTaxDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.dsCompany.SalaryForTaxDataTable();
|
|
double basic, houseRent, conveyance, festivalBonus, computerUsage, medical, overtimeAllowance, totalCost;
|
|
foreach (DataRow dr in oSalarySheets.Tables[0].Rows)
|
|
{
|
|
basic = Math.Round(Convert.ToDouble(dr["Basic"].ToString()));
|
|
houseRent = Math.Round(Convert.ToDouble(dr["HouseRent"].ToString()));
|
|
conveyance = Math.Round(Convert.ToDouble(dr["Conveyance"].ToString()));
|
|
festivalBonus = Math.Round(Convert.ToDouble(dr["FestivalBonus"].ToString()));
|
|
computerUsage = Math.Round(Convert.ToDouble(dr["ComputerUsage"].ToString()));
|
|
medical = Math.Round(Convert.ToDouble(dr["Medical"].ToString()));
|
|
overtimeAllowance = Math.Round(Convert.ToDouble(dr["OvertimeAllowance"].ToString()));
|
|
totalCost = basic + houseRent + conveyance + festivalBonus + computerUsage + medical + overtimeAllowance;
|
|
oDR = dTSalarySheet.NewRow();
|
|
oDR["EmpNo"] = dr["EMPLOYEENO"].ToString();
|
|
oDR["EmpName"] = dr["NAME"].ToString();
|
|
oDR["Department"] = dr["Dept"].ToString();
|
|
oDR["SequenceNo"] = dr["SequenceNO"].ToString();
|
|
oDR["Basic"] = basic;
|
|
oDR["HouseRent"] = houseRent;
|
|
oDR["Conveyance"] = conveyance;
|
|
oDR["FestivalBonus"] = festivalBonus;
|
|
oDR["ComputerUsage"] = computerUsage;
|
|
oDR["Medical"] = medical;
|
|
oDR["OvertimeAllowance"] = overtimeAllowance;
|
|
oDR["TotalCost"] = totalCost;
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
DataSet dSet = new DataSet();
|
|
dTSalarySheet.TableName = "dsCompany_SalaryForTax";
|
|
dSet.Tables.Add(dTSalarySheet);
|
|
|
|
//List<ReportParameter> parameters = new List<ReportParameter>();
|
|
//parameters.Add(new ReportParameter("BankName", _selectedParameter.Banks[0].Name));
|
|
|
|
|
|
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.rptSalaryForTax.rdlc", null);
|
|
}
|
|
|
|
public DataTable ExportSalarySheet(DateTime dMonth, ID nRepID, string sEmpIDs)
|
|
{
|
|
_SalaryMonth = dMonth;
|
|
ID nReportID = nRepID;
|
|
string sEmpID = sEmpIDs;
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
oSalarySheets = SalaryMonthly.GetEmpSalarySheet(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
|
|
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
|
|
//List<Employee> oEmps = Employee.Get();
|
|
DataTable dtEmployee = SalaryMonthly.GetCustomDataTable("Select Employeeno,gradeid,name,BasicSalary from employee");
|
|
List<string> components = new List<string>() { "Basic", "Allowance", "OT", "Deduction", "Loan" };
|
|
List<string> basics = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -101).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
List<string> OTs = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && 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 && x.Field<Int32>("ItemCode") != -118).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
List<string> Loans = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -118).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
int seq = 0;
|
|
foreach (string comp in components)
|
|
{
|
|
switch (comp)
|
|
{
|
|
case "Basic":
|
|
foreach (string id in basics)
|
|
{
|
|
// 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") == -101 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
seq++;
|
|
dr["SequenceNo"] = 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))
|
|
{
|
|
seq++;
|
|
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;
|
|
}
|
|
}
|
|
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<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -103 && 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") == -103 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
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["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<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") == 8 && x.Field<Int32>("ItemCode") != -118 && x.Field<Int32>("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<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && 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") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["TotalDeduction"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["NetPay"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
#region Loop Start
|
|
foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
|
|
{
|
|
if (source["ITEMGROUP"].ToString() != "2")
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyNonMngtForGross(oDR, source);
|
|
if (source["ITEMGROUP"].ToString() == "1")
|
|
{
|
|
DataRow dr = this.GetItem2(oSalarySheets.Tables["UnAuthorizedLeave"], source["EMPLOYEENO"].ToString(), EnumSalaryGroup.UnauthLeave, (EnumSalaryItemCode)Convert.ToInt16(source["ITEMCODE"]), Convert.ToInt16(source["ITEMID"]));
|
|
if (dr != null)
|
|
{
|
|
oDR["Amount"] = Convert.ToDouble(oDR["Amount"]) - Convert.ToDouble(dr["Amount"]);
|
|
}
|
|
}
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyNonManagement(oDR, source);
|
|
DataRow dr = this.GetItem3(oSalarySheets.Tables["TotalDeduction"], source["EMPLOYEENO"].ToString());
|
|
DataRow dr2 = this.GetItem3(oSalarySheets.Tables["NetPay"], source["EMPLOYEENO"].ToString());
|
|
if (dr != null && dr2 != null)
|
|
{
|
|
oDR["Amount"] = Convert.ToDouble(dr2["Amount"]) + Convert.ToDouble(dr["Amount"]);
|
|
}
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyNonMngtForDeduct(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;
|
|
Pivot pvt = new Pivot(dTSalarySheet);
|
|
DataTable ddt = pvt.PivotData("EmpNo", "Amount", AggregateFunction.Sum, "Description");
|
|
DataColumnCollection columns = ddt.Columns;
|
|
|
|
List<string> sList = new List<string>();
|
|
List<AllowanceDeduction> oallow = AllowanceDeduction.GetAllowance(EnumStatus.Regardless);
|
|
sList.Add("EmpNo");
|
|
sList.Add("EmpName");
|
|
sList.Add("Grade");
|
|
sList.Add("Actual Basic");
|
|
sList.Add("Basic");
|
|
|
|
foreach (AllowanceDeduction ad in oallow)
|
|
{
|
|
if (columns.Contains(ad.Name))
|
|
{
|
|
sList.Add(ad.Name);
|
|
}
|
|
}
|
|
List<Bonus> oBonus = Bonus.Get(EnumStatus.Regardless);
|
|
foreach (Bonus oB in oBonus)
|
|
{
|
|
|
|
if (columns.Contains(oB.Name))
|
|
{
|
|
sList.Add(oB.Name);
|
|
}
|
|
}
|
|
sList.Add("OT Amount");
|
|
sList.Add("Unauthorized Leave");
|
|
sList.Add("Total Gross");
|
|
sList.Add("Income Tax");
|
|
List<AllowanceDeduction> oDeductions = AllowanceDeduction.GetDeduction(EnumStatus.Regardless);
|
|
foreach (AllowanceDeduction oD in oDeductions)
|
|
{
|
|
if (columns.Contains(oD.Name))
|
|
{
|
|
sList.Add(oD.Name);
|
|
}
|
|
}
|
|
sList.Add("PF");
|
|
sList.Add("Total Deduction");
|
|
sList.Add("Net Pay");
|
|
DataTable convertedDT = new DataTable();
|
|
List<string> uniqueList = sList.Distinct().ToList();
|
|
foreach (var item in uniqueList)
|
|
{
|
|
if (item.ToString().ToLower() == "empno" || item.ToString().ToLower() == "empname" || item.ToString().ToLower() == "grade")
|
|
convertedDT.Columns.Add(item, typeof(string));
|
|
else
|
|
convertedDT.Columns.Add(item, typeof(double));
|
|
}
|
|
DataRow odr = null;
|
|
ObjectsTemplate<Grade> oGrades = Grade.Get(EnumStatus.Regardless);
|
|
foreach (DataRow dr in ddt.Rows)
|
|
{
|
|
odr = convertedDT.NewRow();
|
|
//Employee oEmp = oEmps.Where(x => ddt.AsEnumerable().Any(y => y.Field<string>("EmpNo").Equals(x.EmployeeNo))).FirstOrDefault();
|
|
DataRow drEmp = this.GetEmployee(dtEmployee, dr["EmpNo"].ToString());
|
|
Employee oEmp = new Employee();
|
|
if (drEmp != null)
|
|
{
|
|
oEmp.GradeID = ID.FromInteger(Convert.ToInt16(drEmp["gradeid"]));
|
|
oEmp.Name = drEmp["name"].ToString();
|
|
oEmp.BasicSalary = Convert.ToDouble(drEmp["BasicSalary"].ToString());
|
|
}
|
|
Grade grd = oGrades.Find(x => oEmp.GradeID == x.ID);
|
|
foreach (DataColumn dc in dr.Table.Columns)
|
|
{
|
|
|
|
var myColumn = odr.Table.Columns.Cast<DataColumn>().SingleOrDefault(col => col.ColumnName == dc.ColumnName);
|
|
if (myColumn != null)
|
|
{
|
|
if (myColumn.ColumnName.ToLower() == "empno")
|
|
odr[myColumn.ColumnName] = dr[dc.ColumnName];
|
|
else
|
|
odr[myColumn.ColumnName] = Convert.ToDouble(dr[dc.ColumnName].ToString() == "" ? "0" : dr[dc.ColumnName].ToString());
|
|
}
|
|
}
|
|
odr["EmpName"] = oEmp.Name;
|
|
odr["Grade"] = grd == null ? "" : grd.Name;
|
|
odr["Actual Basic"] = oEmp.BasicSalary;
|
|
|
|
convertedDT.Rows.Add(odr);
|
|
}
|
|
return convertedDT;
|
|
|
|
}
|
|
private DataRow GetEmployee(DataTable Source, string sEmpID)
|
|
{
|
|
foreach (DataRow odRow in Source.Rows)
|
|
{
|
|
if (Convert.ToString(odRow["EMPLOYEENO"]) == sEmpID )
|
|
{
|
|
return odRow;
|
|
}
|
|
|
|
}
|
|
return null;
|
|
}
|
|
public void ShowReport()
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
_SalaryMonth = _selectedParameter.FromDate.Value;
|
|
ID nReportID = _selectedParameter.ReportItem.ReportID;
|
|
string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
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> basics = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -101).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
List<string> allowances = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
List<string> OTs = oSalarySheets.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 1 && 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 && x.Field<Int32>("ItemCode") != -118).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
List<string> Loans = oSalarySheets.Tables["DeductItem"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -118).GroupBy(y => y.Field<Int32>("ItemID")).Select(o => o.Key.ToString()).ToList();
|
|
int seq = 0;
|
|
foreach (string comp in components)
|
|
{
|
|
switch (comp)
|
|
{
|
|
case "Basic":
|
|
foreach (string id in basics)
|
|
{
|
|
// 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") == -101 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
seq++;
|
|
dr["SequenceNo"] = 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))
|
|
{
|
|
seq++;
|
|
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;
|
|
}
|
|
}
|
|
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<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -103 && 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") == -103 && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
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["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<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") == 8 && x.Field<Int32>("ItemCode") != -118 && x.Field<Int32>("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<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Installment) && 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") == Convert.ToDecimal((int)EnumSalaryItemCode.Loan_Monthly_Interest) && x.Field<Int32>("ItemID").ToString() == id))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["TotalDeduction"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
|
|
seq++;
|
|
foreach (DataRow dr in oSalarySheets.Tables["NetPay"].Rows)
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
break;
|
|
default:
|
|
break;
|
|
}
|
|
|
|
}
|
|
|
|
|
|
#region Loop Start
|
|
foreach (DataRow source in oSalarySheets.Tables["GrossItem"].Rows)
|
|
{
|
|
if (source["ITEMGROUP"].ToString() != "2")
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyNonMngtForGross(oDR, source);
|
|
|
|
if (source["ITEMGROUP"].ToString() == "1")
|
|
{
|
|
DataRow dr = this.GetItem2(oSalarySheets.Tables["UnAuthorizedLeave"], source["EMPLOYEENO"].ToString(), EnumSalaryGroup.UnauthLeave, (EnumSalaryItemCode)Convert.ToInt16(source["ITEMCODE"]), Convert.ToInt16(source["ITEMID"]));
|
|
if (dr != null)
|
|
{
|
|
oDR["Amount"] = Convert.ToDouble(oDR["Amount"]) - Convert.ToDouble(dr["Amount"]);
|
|
}
|
|
}
|
|
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["TotalGross"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyNonManagement(oDR, source);
|
|
DataRow dr = this.GetItem3(oSalarySheets.Tables["TotalDeduction"], source["EMPLOYEENO"].ToString());
|
|
DataRow dr2 = this.GetItem3(oSalarySheets.Tables["NetPay"], source["EMPLOYEENO"].ToString());
|
|
if (dr != null && dr2 != null)
|
|
{
|
|
oDR["Amount"] = Convert.ToDouble(dr2["Amount"]) + Convert.ToDouble(dr["Amount"]);
|
|
}
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["DeductItem"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.CopyNonMngtForDeduct(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);
|
|
}
|
|
private DataRow GetItem2(DataTable Source, string sEmpNo, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int ITemID)
|
|
{
|
|
foreach (DataRow odRow in Source.Rows)
|
|
{
|
|
if (Convert.ToString(odRow["EMPLOYEENO"]) == sEmpNo && Convert.ToInt32(odRow["ITEMGROUP"]) == (int)groupCode &&
|
|
Convert.ToInt32(odRow["ItemCode"]) == (int)itemCode && Convert.ToInt32(odRow["ItemID"]) == ITemID)
|
|
{
|
|
return odRow;
|
|
}
|
|
|
|
}
|
|
return null;
|
|
}
|
|
private DataRow GetItem3(DataTable Source, string sEmpNo)
|
|
{
|
|
foreach (DataRow odRow in Source.Rows)
|
|
{
|
|
if (Convert.ToString(odRow["EMPLOYEENO"]) == sEmpNo )
|
|
{
|
|
return odRow;
|
|
}
|
|
|
|
}
|
|
return null;
|
|
}
|
|
private void CopyNonMngtForGross(DataRow source, DataRow destination)
|
|
{
|
|
double OtallownceAmount = 0.0;
|
|
|
|
|
|
if (tempEmpID == string.Empty)
|
|
{
|
|
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
|
|
source["SLNo"] = count;
|
|
count++;
|
|
OtallownceAmount = 0.0;
|
|
}
|
|
if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
|
|
{
|
|
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
|
|
source["SLNo"] = count;
|
|
count++;
|
|
OtallownceAmount = 0.0;
|
|
}
|
|
source["EmpNo"] = destination["EMPLOYEENO"];
|
|
source["EmpName"] = destination["Name"];
|
|
source["Grade"] = destination["GName"];
|
|
source["THISMONTHBASIC"] = destination["THISMONTHBASIC"];
|
|
source["Department"] = destination["DeptName"];
|
|
source["DeptSequence"] = destination["DeptSequence"];
|
|
if ((Convert.ToInt16(destination["ITEMCODE"]) == Convert.ToInt16(EnumSalaryItemCode.Over_Time_Amount) ))
|
|
{
|
|
OtallownceAmount = OtallownceAmount + Convert.ToDouble(destination["Amount"]);
|
|
|
|
source["Description"] = "OT Amount";
|
|
source["Amount"] = OtallownceAmount;
|
|
}
|
|
else
|
|
{
|
|
source["Description"] = destination["Description"];
|
|
if (Convert.ToInt32(destination["Amount"]) != 0)
|
|
{
|
|
source["Amount"] = destination["Amount"];
|
|
}
|
|
else
|
|
{
|
|
source["Amount"] = 0.0;
|
|
}
|
|
|
|
}
|
|
|
|
source["SalaryMonth"] = _SalaryMonth;
|
|
source["JoiningDate"] = destination["JoiningDate"];
|
|
source["SequenceNo"] = destination["SequenceNo"];
|
|
|
|
}
|
|
private void CopyNonMngtForDeduct(DataRow source, DataRow destination)
|
|
{
|
|
double OtallownceAmount = 0.0;
|
|
|
|
|
|
if (tempEmpID == string.Empty)
|
|
{
|
|
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
|
|
source["SLNo"] = count;
|
|
count++;
|
|
OtallownceAmount = 0.0;
|
|
}
|
|
if (tempEmpID != Convert.ToString(destination["EMPLOYEENO"]))
|
|
{
|
|
tempEmpID = Convert.ToString(destination["EMPLOYEENO"]);
|
|
source["SLNo"] = count;
|
|
count++;
|
|
OtallownceAmount = 0.0;
|
|
}
|
|
source["EmpNo"] = destination["EMPLOYEENO"];
|
|
source["EmpName"] = destination["Name"];
|
|
source["Grade"] = destination["GName"];
|
|
source["THISMONTHBASIC"] = destination["THISMONTHBASIC"];
|
|
source["Department"] = destination["DeptName"];
|
|
source["DeptSequence"] = destination["DeptSequence"];
|
|
if ((Convert.ToInt16(destination["ITEMCODE"]) == Convert.ToInt16(EnumSalaryItemCode.Over_Time_Amount)))
|
|
{
|
|
OtallownceAmount = OtallownceAmount + Convert.ToDouble(destination["Amount"]);
|
|
|
|
source["Description"] = "OT Amount";
|
|
source["Amount"] = OtallownceAmount;
|
|
}
|
|
else
|
|
{
|
|
source["Description"] = destination["Description"];
|
|
if (Convert.ToInt32(destination["Amount"]) != 0)
|
|
{
|
|
source["Amount"] = destination["Amount"];
|
|
}
|
|
else
|
|
{
|
|
source["Amount"] = 0.0;
|
|
}
|
|
|
|
}
|
|
|
|
source["SalaryMonth"] = _SalaryMonth;
|
|
source["JoiningDate"] = destination["JoiningDate"];
|
|
source["SequenceNo"] = destination["SequenceNo"];
|
|
|
|
}
|
|
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++;
|
|
|
|
}
|
|
source["EmpNo"] = destination["EMPLOYEENO"];
|
|
source["EmpName"] = destination["Name"];
|
|
source["Grade"] = destination["GName"];
|
|
source["Department"] = destination["DeptName"];
|
|
source["DeptSequence"] = destination["DeptSequence"];
|
|
source["THISMONTHBASIC"] = destination["THISMONTHBASIC"];
|
|
source["Description"] = destination["Description"];
|
|
if (Convert.ToInt32(destination["Amount"]) > 0)
|
|
{
|
|
source["Amount"] = destination["Amount"];
|
|
}
|
|
else
|
|
{
|
|
source["Amount"] = 0.0;
|
|
}
|
|
|
|
source["SalaryMonth"] = _SalaryMonth;
|
|
source["JoiningDate"] = destination["JoiningDate"];
|
|
source["SequenceNo"] = destination["SequenceNo"];
|
|
|
|
|
|
}
|
|
public void ShowOldSalarySheetReport(DateTime salaryMonth)
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
_selectedParameter = new ReportSetup();
|
|
_SalaryMonth = salaryMonth;
|
|
ID nReportID = ID.FromInteger(55);
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
|
|
oSalarySheets = SalaryMonthly.GetEmpSalarySheetOld(GlobalFunctions.LastDateOfMonth(_SalaryMonth),"");
|
|
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
|
|
|
|
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["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)
|
|
{
|
|
//if (Convert.ToInt16(source["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Interest)
|
|
//{
|
|
// continue;
|
|
//}
|
|
//else
|
|
//{
|
|
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);
|
|
//}
|
|
|
|
|
|
foreach (DataRow source in oSalarySheets.Tables["LeaveDays"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
|
|
form.ShowDlgForSalarySheet(_selectedParameter.ReportItem, dTSalarySheet, nReportID);
|
|
}
|
|
private void CopyDataWithArrear(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"];
|
|
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 = 50;
|
|
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.Arrear) && Convert.ToInt16(destination["ItemID"]) == 26)
|
|
{
|
|
source["Description"] = destination["Description"];//Shift Allowance Arrear
|
|
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"]) == 5)
|
|
{
|
|
source["Description"] = destination["Description"]; //Leave Allowance
|
|
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 Arrear
|
|
seqenceNo = 25;
|
|
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 = 27;
|
|
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 = 28;
|
|
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 = 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_Interest) && 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"]) == 2)
|
|
{
|
|
source["Description"] = destination["Description"];// Religious
|
|
seqenceNo = 32;
|
|
source["SequenceNo"] = seqenceNo;
|
|
}
|
|
else if (Convert.ToString(destination["Description"]) == "Religious Interest")
|
|
{
|
|
source["Description"] = destination["Description"]; //Religious Interest
|
|
seqenceNo = 33;
|
|
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 = 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"]) == 134)
|
|
{
|
|
source["Description"] = destination["Description"];//Recognitio Reward ( Gift Card)
|
|
seqenceNo = 35;
|
|
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 = 36;
|
|
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 = 37;
|
|
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 = 38;
|
|
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;
|
|
}
|
|
else
|
|
{
|
|
source["Description"] = destination["Description"];
|
|
seqenceNo = 48;
|
|
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"];
|
|
}
|
|
|
|
|
|
public void ShowReportPNL()
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
_SalaryMonth = _selectedParameter.FromDate.Value;
|
|
ID nReportID = _selectedParameter.ReportItem.ReportID;
|
|
string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|
DataRow oDR = null;
|
|
DataSet oSalarySheets = null;
|
|
|
|
DateTime salaryMonth = GlobalFunctions.LastDateOfMonth(_SalaryMonth);
|
|
oSalarySheets = SalaryMonthly.GetEmpPNL(GlobalFunctions.LastDateOfMonth(_SalaryMonth), sEmpID);
|
|
PayrollDataSet.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.Report.PayrollDataSet.PayrollDataSet.SalarySheetDataTable();
|
|
|
|
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["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)
|
|
{
|
|
//if (Convert.ToInt16(source["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Interest)
|
|
//{
|
|
// continue;
|
|
//}
|
|
//else
|
|
//{
|
|
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["CPF"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
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["NetPay"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
foreach (DataRow source in oSalarySheets.Tables["OPI"].Rows)
|
|
{
|
|
oDR = dTSalarySheet.NewRow();
|
|
this.Copy(oDR, source);
|
|
dTSalarySheet.Rows.Add(oDR);
|
|
}
|
|
//return dTSalarySheet;
|
|
form.ShowDlgForPNL(_selectedParameter.ReportItem, dTSalarySheet, nReportID, salaryMonth.ToString("MMM yyyy"));
|
|
}
|
|
|
|
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 static int CountWord(string word)
|
|
{
|
|
int c = 0;
|
|
for (int i = 1; i < word.Length; i++)
|
|
{
|
|
if (char.IsWhiteSpace(word[i - 1]) == true)
|
|
{
|
|
if (char.IsLetterOrDigit(word[i]) == true ||
|
|
char.IsPunctuation(word[i]))
|
|
{
|
|
c++;
|
|
}
|
|
}
|
|
}
|
|
if (word.Length > 2)
|
|
{
|
|
c++;
|
|
}
|
|
return c;
|
|
}
|
|
|
|
|
|
|
|
public void ShowBEFTNform(DateTime dMonth, string Ids)
|
|
{
|
|
DataSet dataSet = new DataSet();
|
|
string processDate = string.Empty;
|
|
DateTime pDate = DateTime.MinValue;
|
|
ObjectsTemplate<SalaryProcess> sProcesses = new ObjectsTemplate<SalaryProcess>();
|
|
sProcesses = SalaryProcess.Get(dMonth);
|
|
SalaryProcess sProcess = new SalaryProcess();
|
|
foreach (SalaryProcess sp in sProcesses)
|
|
{
|
|
pDate = sp.ProcessDate;
|
|
}
|
|
processDate = pDate.ToString("dd-MM-yyyy");
|
|
string serial = string.Empty;
|
|
fReportViewer form = new fReportViewer();
|
|
DataRow oDR = null;
|
|
DataSet oBeftnForm = new DataSet();
|
|
oBeftnForm = MiscellaneousDataset.GetBEFTNform(dMonth, Ids);
|
|
PayrollDataSet.dsCompany.BEFTNformDataTable bftnTable = new Payroll.Report.PayrollDataSet.dsCompany.BEFTNformDataTable();
|
|
PayrollDataSet.dsCompany.BEFTNformDataTable bTable1 = new Payroll.Report.PayrollDataSet.dsCompany.BEFTNformDataTable();
|
|
int sl = 1;
|
|
double nTotal = 0;
|
|
string smonth = dMonth.ToString("MMMM yyyy");
|
|
foreach (DataRow dr in oBeftnForm.Tables[0].Rows)
|
|
{
|
|
oDR = bftnTable.NewRow();
|
|
oDR["EmpName"] = dr["Name"];
|
|
oDR["SL"] = sl;
|
|
oDR["Amount"] = dr["Amount"];
|
|
oDR["AccType"] = "Saving Account";
|
|
oDR["AccountNo"] = dr["ACCOUNTNO"];
|
|
oDR["ReceiveBankCode"] = dr["BranchCode"];
|
|
oDR["SenderAccNo"] = "001-004175-011";
|
|
oDR["SalaryMonth"] = Convert.ToDateTime(dr["SalaryMonth"]).ToString("MMM yy");
|
|
bftnTable.Rows.Add(oDR);
|
|
nTotal += Convert.ToDouble(oDR["Amount"]);
|
|
sl++;
|
|
}
|
|
int srl = sl - 1;
|
|
serial = srl.ToString();
|
|
string amountInTaka = NumWordsWrapper(Payroll.BO.GlobalFunctions.Round(nTotal));
|
|
string dtotal = nTotal.ToString();
|
|
DataRow or = null;
|
|
char[] splitString = dtotal.ToCharArray();
|
|
splitString.Reverse();
|
|
|
|
foreach (DataRow dr in bftnTable.Rows)
|
|
{
|
|
for (int i = splitString.Count() - 1, j = 9; i >= 0; i--, j--)
|
|
{
|
|
dr["Col" + j.ToString()] = splitString[i];
|
|
}
|
|
}
|
|
|
|
if (bftnTable.Rows.Count == 0)
|
|
{
|
|
processDate = "";
|
|
}
|
|
form.ShowDlgForBEFTNform(bftnTable, bTable1, smonth, serial, amountInTaka, processDate);
|
|
}
|
|
|
|
public static String NumWordsWrapper(double value)
|
|
{
|
|
string words = "";
|
|
double intPart;
|
|
double decPart = 0;
|
|
if (value == 0)
|
|
return "zero";
|
|
|
|
try
|
|
{
|
|
string[] splitter = value.ToString().Split('.');
|
|
intPart = double.Parse(splitter[0]);
|
|
if (splitter.Length > 1)
|
|
{
|
|
decPart = double.Parse(splitter[1]);
|
|
}
|
|
}
|
|
catch
|
|
{
|
|
intPart = value;
|
|
}
|
|
|
|
words = NumWords(Convert.ToInt32(intPart));
|
|
|
|
if (decPart > 0)
|
|
{
|
|
if (words != "")
|
|
words += " and ";
|
|
int counter = decPart.ToString().Length;
|
|
switch (counter)
|
|
{
|
|
case 1: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// tenths
|
|
case 2: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// hundredths
|
|
case 3: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// thousandths
|
|
case 4: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// ten-thousandths
|
|
case 5: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// hundred-thousandths
|
|
case 6: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// millionths
|
|
case 7: words += NumWords(Convert.ToInt32(decPart)) + ""; break;// ten-millionths
|
|
}
|
|
}
|
|
return words + " Taka Only";
|
|
}
|
|
|
|
private static string NumWords(int Num)
|
|
{
|
|
#region Old Code
|
|
//string[] numbersArr = new string[] { "one", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "eleven", "twelve", "thirteen", "fourteen", "fifteen", "sixteen", "seventeen", "eighteen", "nineteen" };
|
|
//string[] tensArr = new string[] { "twenty", "thirty", "fourty", "fifty", "sixty", "seventy", "eighty", "ninty" };
|
|
//string[] suffixesArr = new string[] { "thousand", "million", "billion", "trillion", "quadrillion", "quintillion", "sextillion", "septillion", "octillion", "nonillion", "decillion", "undecillion", "duodecillion", "tredecillion", "Quattuordecillion", "Quindecillion", "Sexdecillion", "Septdecillion", "Octodecillion", "Novemdecillion", "Vigintillion" };
|
|
//string words = "";
|
|
|
|
//bool tens = false;
|
|
|
|
//if (n < 0)
|
|
//{
|
|
// words += "negative ";
|
|
// n *= -1;
|
|
//}
|
|
|
|
//int power = (suffixesArr.Length + 1) * 3;
|
|
|
|
//while (power > 3)
|
|
//{
|
|
// double pow = Math.Pow(10, power);
|
|
// if (n > pow)
|
|
// {
|
|
// if (n % Math.Pow(10, power) > 0)
|
|
// {
|
|
// words += NumWords(Math.Floor(n / pow)) + " " + suffixesArr[(power / 3) - 1] + " and ";
|
|
// }
|
|
// else if (n % pow > 0)
|
|
// {
|
|
// words += NumWords(Math.Floor(n / pow)) + " " + suffixesArr[(power / 3) - 1];
|
|
// }
|
|
// n %= pow;
|
|
// }
|
|
// power -= 3;
|
|
//}
|
|
//if (n >= 1000)
|
|
//{
|
|
// if (n % 1000 > 0) words += NumWords(Math.Floor(n / 1000)) + " thousand and ";
|
|
// else words += NumWords(Math.Floor(n / 1000)) + " thousand";
|
|
// n %= 1000;
|
|
//}
|
|
//if (0 <= n && n <= 999)
|
|
//{
|
|
// if ((int)n / 100 > 0)
|
|
// {
|
|
// words += NumWords(Math.Floor(n / 100)) + " hundred";
|
|
// n %= 100;
|
|
// }
|
|
// if ((int)n / 10 > 1)
|
|
// {
|
|
// if (words != "")
|
|
// words += " ";
|
|
// words += tensArr[(int)n / 10 - 2];
|
|
// tens = true;
|
|
// n %= 10;
|
|
// }
|
|
|
|
// if (n < 20)
|
|
// {
|
|
// if (words != "" && tens == false)
|
|
// words += " ";
|
|
// words += (tens ? "-" + numbersArr[(int)n - 1] : numbersArr[(int)n - 1]);
|
|
// n -= Math.Floor(n);
|
|
// }
|
|
//}
|
|
|
|
//return words;
|
|
#endregion
|
|
string[] Below20 = { "", "One ", "Two ", "Three ", "Four ",
|
|
"Five ", "Six " , "Seven ", "Eight ", "Nine ", "Ten ", "Eleven ",
|
|
"Twelve " , "Thirteen ", "Fourteen ","Fifteen ",
|
|
"Sixteen " , "Seventeen ","Eighteen " , "Nineteen " };
|
|
string[] Below100 = { "", "", "Twenty ", "Thirty ",
|
|
"Forty ", "Fifty ", "Sixty ", "Seventy ", "Eighty ", "Ninety " };
|
|
string InWords = "";
|
|
if (Num >= 1 && Num < 20)
|
|
InWords += Below20[Num];
|
|
if (Num >= 20 && Num <= 99)
|
|
InWords += Below100[Num / 10] + Below20[Num % 10];
|
|
if (Num >= 100 && Num <= 999)
|
|
InWords += NumWords(Num / 100) + " Hundred " + NumWords(Num % 100);
|
|
if (Num >= 1000 && Num <= 99999)
|
|
InWords += NumWords(Num / 1000) + " Thousand " + NumWords(Num % 1000);
|
|
if (Num >= 100000 && Num <= 9999999)
|
|
InWords += NumWords(Num / 100000) + " Lac " + NumWords(Num % 100000);
|
|
if (Num >= 10000000)
|
|
InWords += NumWords(Num / 10000000) + " Crore " + NumWords(Num % 10000000);
|
|
|
|
return InWords;
|
|
}
|
|
|
|
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(sEmpID, _SalaryMonth.LastDateOfMonth());
|
|
List<Employee> oEmployees = Employee.GetByEmpIDs(sEmpID); //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)
|
|
{
|
|
Employee oEmp = oEmployees.FirstOrDefault(x => x.ID.Integer == itemMonthly.EmployeeID.Integer);
|
|
if (oEmp == null) continue;
|
|
DataRow dr = dTable.NewRow();
|
|
|
|
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: 008
|
|
AllowanceDeduction oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "008");
|
|
|
|
if (oAllDeduct != null)
|
|
dr["HouseRent"] = Math.Round(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() == "011");
|
|
|
|
if (oAllDeduct != null)
|
|
dr["Medical"] = Math.Round(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: 010
|
|
oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "010");
|
|
|
|
if (oAllDeduct != null)
|
|
dr["Conveyance"] = Math.Round(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: 009
|
|
oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "006");
|
|
|
|
if (oAllDeduct != null)
|
|
dr["FoodAllowance"] = Math.Round(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"] = Math.Round(Convert.ToDouble(dr["Basic"]) +
|
|
Convert.ToDouble(dr["HouseRent"]) +
|
|
Convert.ToDouble(dr["Medical"]) +
|
|
Convert.ToDouble(dr["Conveyance"]) +
|
|
Convert.ToDouble(dr["FoodAllowance"]));
|
|
|
|
dr["PF"] = Math.Round(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"] = Math.Round(itemMonthly.Details.Where(x => x.itemGroupCode == EnumSalaryGroup.Miscellaneous && x.ItemCode == EnumSalaryItemCode.Total_HoliDays).Sum(x => x.ChangedAmount));
|
|
|
|
dr["Absent"] = Math.Round(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"] = Math.Round(deductBasic);
|
|
|
|
dr["DeductSalaryAdvance"] = 0.0;
|
|
|
|
dr["DeductPF"] = Math.Round(Convert.ToDouble(dr["PF"]));
|
|
|
|
dr["SalaryPayment"] = Math.Round(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"] = Math.Round(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() == "001");
|
|
|
|
if (oAllDeduct != null)
|
|
dr["AttnBonus"] = Math.Round(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() == "002");
|
|
|
|
if (oAllDeduct != null)
|
|
dr["ConductBonus"] = Math.Round(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: 013
|
|
oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "013");
|
|
|
|
if (oAllDeduct != null)
|
|
dr["TtlBonus"] = Math.Round(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;
|
|
|
|
oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "004");
|
|
|
|
//if (oAllDeduct != null)
|
|
// dr["Fine"] = itemMonthly
|
|
// .Details
|
|
// .Where(x => x.itemGroupCode == EnumSalaryGroup.Deductions &&
|
|
// x.ItemCode == EnumSalaryItemCode.Over_Time_Amount)
|
|
// .Sum(x => x.ChangedAmount);
|
|
//else
|
|
// dr["Fine"] = 0;
|
|
|
|
oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "002");
|
|
|
|
//dr["PFLoan"] = 0;
|
|
|
|
oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "012");
|
|
|
|
//if (oAllDeduct != null)
|
|
// dr["IfterBill"] = 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["IfterBill"] = 0;
|
|
|
|
|
|
//dr["NetPayment"] = Convert.ToDouble(dr["SalaryPayment"]) + Convert.ToDouble(dr["AttnBonus"]) + Convert.ToDouble(dr["OtPayment"]) + Convert.ToDouble(dr["ConductBonus"]) + Convert.ToDouble(dr["TtlBonus"])+ Convert.ToDouble(dr["IfterBill"]);
|
|
dr["NetPayment"] = Math.Round(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() == "SPL");
|
|
|
|
//if (currentLeave != null)
|
|
// dr["SPL"] = oSMDLeaveList.Where(x => x.ItemID == currentLeave.ID.Integer)
|
|
// .Sum(x => x.ChangedAmount);
|
|
//else
|
|
// dr["SPL"] = 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 void 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"];
|
|
}
|
|
}
|
|
|
|
form.ShowDlgForCCWiswSalaryDetails(_selectedParameter.ReportItem, dCCWSDetail, salaryMonth);
|
|
}
|
|
|
|
public void CCWiseSalarySummary()
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
DateTime salaryMonth = _selectedParameter.FromDate.Value;
|
|
string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|
|
|
DataSet dsCCWiseSS = SalaryMonthly.GetCCWiseSalarySheet(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID);
|
|
PayrollDataSet.PayrollDataSet.CCWSaSummaryDataTable dCCWSSummary = new Payroll.Report.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);
|
|
}
|
|
|
|
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;
|
|
|
|
if (IsPrv == false)
|
|
{
|
|
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)
|
|
{
|
|
oRows[0]["ColValue1"] = 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]);
|
|
oDR["ColValue1"] = destination["Amount"];
|
|
_salaryRecon.Rows.InsertAt(oDR, nIndex + 1);
|
|
}
|
|
else
|
|
{
|
|
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 ShowDetailSalarySheetByCC()
|
|
{
|
|
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.PayrollDataSet.SalarySheetDataTable dTSalarySheet = new Payroll.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);
|
|
}
|
|
|
|
form.ShowDlgForSalarySheetByCC(_selectedParameter.ReportItem, dTSalarySheet);
|
|
}
|
|
public void ShowSalaryReconOld()
|
|
{
|
|
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);
|
|
|
|
//_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 PayrollDataSet.PayrollDataSet.SalaryReconsilationDataTable();
|
|
DataSet ds = SalaryMonthly.GetEmpSalarySheet2(GlobalFunctions.LastDateOfMonth(dToDate), sEmpID);
|
|
foreach (DataRow dr in ds.Tables[0].Rows)
|
|
{
|
|
_salaryRecon.Rows.Add(dr.ItemArray);
|
|
}
|
|
foreach (DataRow dr in ds.Tables[1].Rows)
|
|
{
|
|
_salaryRecon.Rows.Add(dr.ItemArray);
|
|
}
|
|
foreach (DataRow dr in ds.Tables[2].Rows)
|
|
{
|
|
_salaryRecon.Rows.Add(dr.ItemArray);
|
|
}
|
|
foreach (DataRow dr in ds.Tables[3].Rows)
|
|
{
|
|
_salaryRecon.Rows.Add(dr.ItemArray);
|
|
}
|
|
foreach (DataRow dr in ds.Tables[4].Rows)
|
|
{
|
|
_salaryRecon.Rows.Add(dr.ItemArray);
|
|
}
|
|
foreach (DataRow dr in ds.Tables[5].Rows)
|
|
{
|
|
_salaryRecon.Rows.Add(dr.ItemArray);
|
|
}
|
|
foreach (DataRow dr in ds.Tables[6].Rows)
|
|
{
|
|
_salaryRecon.Rows.Add(dr.ItemArray);
|
|
}
|
|
foreach (DataRow dr in ds.Tables[7].Rows)
|
|
{
|
|
_salaryRecon.Rows.Add(dr.ItemArray);
|
|
}
|
|
|
|
|
|
|
|
//#region Remove For NetPay Zero Row
|
|
|
|
//DataTable dTempTest = new DataTable("TempTable");
|
|
//// DataTable dTemp = new DataTable("TTable");
|
|
//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
|
|
|
|
|
|
//form.ShowDlgFor_salaryReconcil(_selectedParameter.ReportItem, __salaryRecon, FirstMonth, NextMonth, countCurrMonth, countNextMonth);
|
|
form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, _salaryRecon);
|
|
|
|
//form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, dTempTest);
|
|
}
|
|
|
|
public void ShowSalaryRecon()
|
|
{
|
|
fReportViewer form = new fReportViewer();
|
|
|
|
DateTime dFDate = _selectedParameter.FromDate.Value;
|
|
DateTime dToDate = _selectedParameter.ToDate.Value;
|
|
|
|
string sEmpID = _selectedParameter.ReportItem.INSQL;
|
|
string[] sEmp = sEmpID.Split(',');
|
|
TotalEmp = sEmp.Length;
|
|
_currentSMonthly = SalaryMonthly.GetEmpReconciliationSalarySheet(GlobalFunctions.LastDateOfMonth(dFDate), GlobalFunctions.LastDateOfMonth(dToDate), sEmpID);
|
|
// _currentSMonthly.Tables[0] = _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<decimal>("ItemGroup") != 4).CopyToDataTable();
|
|
//_prvSMonthly = SalaryMonthly.GetEmpReconciliationSalarySheet(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;
|
|
|
|
string FirstMonth = salaryMonth.ToString("MMM yyyy");
|
|
string NextMonth = salaryNextMonth.ToString("MMM yyyy");
|
|
|
|
#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","Bonus", "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> bonus = _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") == 1 && x.Field<int>("ItemCode") == -107).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["DeductItem"].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();
|
|
}
|
|
|
|
//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))
|
|
{
|
|
seq++;
|
|
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))
|
|
{
|
|
seq++;
|
|
//_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 "Bonus":
|
|
des = "";
|
|
foreach (string allwid in bonus)
|
|
{
|
|
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") == -107 && x.Field<int>("ItemID").ToString() == allwid))
|
|
{
|
|
dr["SequenceNo"] = seq;
|
|
}
|
|
}
|
|
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;
|
|
}
|
|
}
|
|
|
|
#region Old Code
|
|
//// 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":
|
|
|
|
// 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;
|
|
// }
|
|
// 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;
|
|
// }
|
|
//}
|
|
|
|
#endregion
|
|
|
|
if (_currentSMonthly.Tables["GrossItem"].Rows.Count > 0)
|
|
{
|
|
foreach (DataRow source in _currentSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") != 4).CopyToDataTable().Rows)
|
|
this.Copy(source, false, dFDate, dToDate);
|
|
}
|
|
foreach (DataRow source in _currentSMonthly.Tables[1].Rows)
|
|
this.Copy(source, false, dFDate, dToDate);
|
|
|
|
foreach (DataRow source in _currentSMonthly.Tables[2].Rows)
|
|
this.Copy(source, false, dFDate, dToDate);
|
|
|
|
foreach (DataRow source in _currentSMonthly.Tables[3].Rows)
|
|
this.Copy(source, false, dFDate, dToDate);
|
|
|
|
foreach (DataRow source in _currentSMonthly.Tables[4].Rows)
|
|
this.Copy(source, false, dFDate, dToDate);
|
|
|
|
#region Old Code
|
|
//if (_prvSMonthly.Tables["GrossItem"].Rows.Count > 0)
|
|
//{
|
|
// foreach (DataRow source in _prvSMonthly.Tables["GrossItem"].AsEnumerable().Where(x => x.Field<int>("ItemGroup") != 4).CopyToDataTable().Rows)
|
|
// this.Copy(source, false, dFDate, dToDate);
|
|
//}
|
|
//foreach (DataRow source in _prvSMonthly.Tables[1].Rows)
|
|
// this.Copy(source, false, dFDate, dToDate);
|
|
|
|
//foreach (DataRow source in _prvSMonthly.Tables[2].Rows)
|
|
// this.Copy(source, false, dFDate, dToDate);
|
|
|
|
//foreach (DataRow source in _prvSMonthly.Tables[3].Rows)
|
|
// this.Copy(source, false, dFDate, dToDate);
|
|
|
|
//foreach (DataRow source in _prvSMonthly.Tables[4].Rows)
|
|
// this.Copy(source, false, dFDate, dToDate);
|
|
|
|
//#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
|
|
#endregion
|
|
|
|
|
|
form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, _salaryRecon);
|
|
}
|
|
|
|
private void Copy(DataRow destination, bool IsPrv, DateTime fromDate, DateTime toDate)
|
|
{
|
|
DataRow oDR = null;
|
|
oDR = _salaryRecon.NewRow();
|
|
oDR["EmpNo"] = destination["EMPLOYEENO"];
|
|
oDR["Name"] = destination["Name"];
|
|
oDR["ColDes"] = destination["Description"];
|
|
oDR["SalaryMonth2"] = fromDate;
|
|
oDR["SalaryMonth1"] = toDate;
|
|
oDR["TotalEmp"] = TotalEmp;
|
|
oDR["SequenceNo"] = destination["SequenceNo"];
|
|
oDR["RowSequence"] = oDR["SequenceNo"];
|
|
oDR["ColValue2"] = destination["Amount"];
|
|
|
|
_salaryRecon.Rows.Add(oDR);
|
|
}
|
|
|
|
//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);
|
|
|
|
// _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();
|
|
|
|
// #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);
|
|
|
|
// //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++;
|
|
// // }
|
|
// //}
|
|
|
|
// #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++;
|
|
// //}
|
|
|
|
// //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[0].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);
|
|
// // start previous data
|
|
|
|
// foreach (DataRow source in _prvSMonthly.Tables[0].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);
|
|
|
|
// #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
|
|
|
|
// //form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, _salaryRecon, FirstMonth, NextMonth, countCurrMonth, countNextMonth);
|
|
// form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, _salaryRecon);
|
|
|
|
// //form.ShowDlgForSalaryReconcil(_selectedParameter.ReportItem, dTempTest);
|
|
//}
|
|
|
|
public void SalaryReconciliationSummaryOld()
|
|
{
|
|
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();
|
|
|
|
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++;
|
|
}
|
|
}
|
|
|
|
#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);
|
|
}
|
|
|
|
public void SalaryReconciliationSummary()
|
|
{
|
|
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();
|
|
|
|
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++;
|
|
}
|
|
}
|
|
|
|
#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++;
|
|
}
|
|
|
|
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;
|
|
}
|
|
}
|
|
|
|
form.ShowDlgForSalaryReconcilSummary(_selectedParameter.ReportItem, _salaryReconGross, _salaryReconDecuction, FirstMonth, NextMonth, countCurrMonth, countNextMonth);
|
|
}
|
|
|
|
private void CopyDeduction(DataRow destination, bool IsPrv)
|
|
{
|
|
DataRow oDR = null;
|
|
|
|
oDR = _salaryReconDecuction.NewRow();
|
|
oDR["Description"] = destination["DESCRIPTION"];
|
|
if (IsPrv == false)
|
|
{
|
|
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;
|
|
|
|
oDR = _salaryReconGross.NewRow();
|
|
|
|
if (IsPrv == false)
|
|
{
|
|
oDR["CurrAmount"] = destination["Amount"];
|
|
oDR["Description"] = destination["DESCRIPTION"];
|
|
}
|
|
if (IsPrv == true)
|
|
{
|
|
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);
|
|
}
|
|
|
|
public void ItemWiseSalary()
|
|
{
|
|
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;
|
|
|
|
#region SqlParam
|
|
if (_selectedParameter.SalaryItems.Count > 0)
|
|
{
|
|
foreach (JVSetupDetail oDetail in _selectedParameter.SalaryItems)
|
|
{
|
|
if (oDetail.JVItemType == 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;
|
|
}
|
|
else if (oDetail.JVItemType == enumPayrollComponentType.Allowance)
|
|
{
|
|
sSQL = " AND ItemGroup in(" + Convert.ToString((int)EnumSalaryGroup.Gross + "," + Convert.ToString((int)EnumSalaryGroup.Arrear)) + ")";
|
|
|
|
if (oDetail.ItemID.Integer == (int)EnumSalaryItemCode.Basic_Salary)
|
|
{
|
|
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Basic_Salary) + ") AND ItemID in(" + Convert.ToString(oDetail.ItemID.Integer) + ")";
|
|
}
|
|
else
|
|
{
|
|
sSQL = sSQL + " AND ItemCode in(" + Convert.ToString((int)EnumSalaryItemCode.Allowance) + ") AND ItemID in(" + Convert.ToString(oDetail.ItemID.Integer) + ")";
|
|
}
|
|
|
|
itemName = oDetail.Name;
|
|
}
|
|
else if (oDetail.JVItemType == 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.Integer) + ")";
|
|
|
|
itemName = oDetail.Name;
|
|
}
|
|
else if (oDetail.JVItemType == 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.Integer) + ")";
|
|
itemName = oDetail.Name;
|
|
}
|
|
else if (oDetail.JVItemType == 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.Integer) + ")";
|
|
|
|
itemName = oDetail.Name;
|
|
}
|
|
else if (oDetail.JVItemType == 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.JVItemType == 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.JVItemType == 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.JVItemType == 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 = MiscellaneousDataset.GetItemWiseSalary(sEmpID, _SalaryMonth, toDate, sSQL);
|
|
PayrollDataSet.PayrollDataSet.EmpItemWiseSalaryDataTable oSalary = new Payroll.Report.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);
|
|
}
|
|
else
|
|
{
|
|
throw new ServiceException("No Data Found !!!");
|
|
}
|
|
}
|
|
|
|
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, int deptId)
|
|
{
|
|
fReportViewer oviewer = new fReportViewer();
|
|
|
|
DataSet dsSalarySummary = new DataSet();
|
|
DataRow oRow = null;
|
|
|
|
dsSalarySummary = MiscellaneousDataset.GetSalarySummaryData(dateTime, deptId);
|
|
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);
|
|
}
|
|
|
|
foreach (DataRow orr in dsSalarySummary.Tables[8].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"];
|
|
source["Unit"] = destination["Unit"];
|
|
}
|
|
|
|
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 class ItemList
|
|
{
|
|
public string ItemName { get; set; }
|
|
public double Amount { get; set; }
|
|
}
|
|
}
|