using HRM.BO; using Ease.Core.DataAccess; using System; using System.Data; namespace HRM.DA { public class MiscellaneousDatasetDA { internal static DataSet GetItemWiseSalary(TransactionContext tc, string sEmpID, DateTime _SalaryMonth, DateTime toDate, string sSQL) { DataSet rootDataset = new DataSet(); DataSet tempdataset = new DataSet(); try { string sTableName; sEmpID = IDHelper.GetIDs(tc, sEmpID, out sTableName); string SSalary = SQLParser.MakeSQL(@"select E.EmployeeNo,E.Name,S.SalaryMonth,sum(smd.ChangedAmount) Amount from SalaryMonthly s inner join Employee E on S.EmployeeID=E.EmployeeID inner join SalaryMonthlyDetail smd on S.SalaryMonthlyID=smd.SalaryMonthlyID where S.EmployeeID in(%q) %q And S.SalaryMonth between %d and %d group by E.EmployeeNo,E.Name,S.SalaryMonth order by E.EmployeeNo,S.SalaryMonth", sEmpID, sSQL, _SalaryMonth, toDate); tempdataset = tc.ExecuteDataSet(SSalary); tempdataset.Tables[0].TableName = "ItemWiseSalary"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); if (sTableName != "") tc.ExecuteNonQuery("Drop TAble %q", sTableName); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmployeesPF(TransactionContext tc, DateTime dateTime, int locationID, string empIds) { DataSet rootDataset = new DataSet(); DataSet tempdataset = new DataSet(); string sTranType = Convert.ToString((int)EnumPFTranType.PFAmount) + "," + Convert.ToString((int)EnumPFTranType.CPFAmount); try { if (empIds != string.Empty) { string sexpEmps = SQLParser.MakeSQL(@"SELECT t.EmployeeNo, t.[Name], SUM(t.EPF) EPF,t.CRGID, SUM(t.CPF) CPF,t.CostCenter,t.Designation,t.Department,t.JOININGDATE,t.Location FROM ( SELECT e.EmployeeID,e.EmployeeNo,e.Name,e.JOININGDATE,D.NAME AS Designation, Dep.DESCRIPTION AS Department,lc.[DESCRIPTION] Location,CC.CRGID, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END AS EPF, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END AS CPF, CC.DESCRIPTION AS CostCenter FROM PFTRANSACTION pt LEFT JOIN Employee e ON pt.EMPLOYEEID = e.EMPLOYEEID AND pt.TRANDATE = %d LEFT JOIN DESIGNATION D ON e.DESIGNATIONID = D.DESIGNATIONID LEFT JOIN DEPARTMENT Dep ON e.DEPARTMENTID = Dep.DEPARTMENTID LEFT JOIN EMPCOSTCENTER cmpcc ON e.EMPLOYEEID=cmpcc.EMPLOYEEID AND cmpcc.CurrentCC=1 INNER JOIN CRG CC ON cmpcc.CostCenterID = CC.CRGID Inner JOIN LOCATION lc ON e.LOCATIONID = lc.LOCATIONID AND e.LOCATIONID = %n AND e.EMPLOYEEID IN (%q) )t GROUP BY t.EmployeeNo, t.[Name], t.CostCenter, t.JOININGDATE,t.Designation,t.Department,t.Location,t.CRGID ORDER BY t.CostCenter", (int)EnumPFTranType.PFAmount, (int)EnumPFTranType.CPFAmount, dateTime, locationID, empIds); tempdataset = tc.ExecuteDataSet(sexpEmps); tempdataset.Tables[0].TableName = "MonthlyPFExp"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); string sSQLMonthlyPF = SQLParser.MakeSQL(@"SELECT t.EmployeeNo, t.[Name], t.THISMONTHBASIC, t.TotalGross, SUM(t.EPF) EPF,t.CRGID, SUM(t.CPF) CPF,t.CostCenter,t.Designation,t.Department,t.JOININGDATE,t.Location FROM ( SELECT e.EmployeeNo,e.Name,e.JOININGDATE,D.NAME AS Designation,Dep.DESCRIPTION AS Department, ISNULL(sm.THISMONTHBASIC,0) THISMONTHBASIC,lc.[DESCRIPTION] Location, IsNull(sm.ThisMonthGross,0) as TotalGross,CC.CRGID, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END AS EPF, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END AS CPF, CC.DESCRIPTION AS CostCenter FROM PFTRANSACTION pt LEFT JOIN Employee e ON pt.EMPLOYEEID = e.EMPLOYEEID AND pt.TRANDATE = %d LEFT JOIN DESIGNATION D ON e.DESIGNATIONID = D.DESIGNATIONID LEFT JOIN DEPARTMENT Dep ON e.DEPARTMENTID = Dep.DEPARTMENTID LEFT JOIN EMPCOSTCENTER cmpcc ON e.EMPLOYEEID=cmpcc.EMPLOYEEID AND cmpcc.CurrentCC=1 INNER JOIN CRG CC ON cmpcc.CostCenterID = CC.CRGID LEFT JOIN SALARYMONTHLY sm ON sm.EMPLOYEEID = e.EMPLOYEEID Inner JOIN LOCATION lc ON sm.LOCATIONID = lc.LOCATIONID AND sm.SalaryMonth = %d AND sm.LOCATIONID = %n )t GROUP BY t.EmployeeNo, t.[Name], t.THISMONTHBASIC, t.TotalGross, t.CostCenter, t.JOININGDATE,t.Designation,t.Department,t.Location,t.CRGID ORDER BY t.CostCenter" , (int)EnumPFTranType.PFAmount, (int)EnumPFTranType.CPFAmount, dateTime, dateTime, locationID); tempdataset = tc.ExecuteDataSet(sSQLMonthlyPF); tempdataset.Tables[0].TableName = "MonthlyPF"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetDataSetBySQL(TransactionContext tc, string sSQL) { DataSet tempdataset = new DataSet(); try { tempdataset = tc.ExecuteDataSet(sSQL); } catch (Exception ex) { throw new Exception(ex.Message); } return tempdataset; } internal static DataSet GetFor177Data(TransactionContext tc, DateTime dSalarymonth, string sEmpID, int payrollTypeId) { DataSet rootDataset = new DataSet(); DataSet tempdataset = new DataSet(); try { string sSQL = SQLParser.MakeSQL(@" select e.EMPLOYEEID,e.EmployeeNo,sd.ITEMGROUP,sd.ITEMCODE,sd.ITEMID,sd.Description,SUM(sd.changedamount) Amount from SALARYMONTHLYDETAIL sd,SALARYMONTHLY S ,Employee e Where sd.SALARYMONTHLYID=S.SALARYMONTHLYID And S.EmployeeID = e.EmployeeId AND S.SalaryMonth = %d and sd.ITEMGROUP in(1,3,8) AND sd.ItemCode not in(-102) AND S.EmployeeID IN(%q) AND S.payrolltypeid = %n group by e.EMPLOYEEID,e.EmployeeNo,sd.ITEMGROUP,sd.ITEMCODE,sd.ITEMID,sd.DESCRIPTION ORDER BY e.EmployeeNo ", dSalarymonth, sEmpID, payrollTypeId, sEmpID); tempdataset = tc.ExecuteDataSet(sSQL); tempdataset.Tables[0].TableName = "EmpWiseSalary"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); //sSQL = SQLParser.MakeSQL(@" // select e.EMPLOYEEID,e.EmployeeNo,sd.ITEMGROUP,sd.ITEMCODE,sd.ITEMID,sd.Description,SUM(sd.changedamount) Amount // from SALARYMONTHLYDETAIL sd,SALARYMONTHLY S ,Employee e // Where sd.SALARYMONTHLYID = S.SALARYMONTHLYID And S.EmployeeID = e.EmployeeId // AND S.SalaryMonth between %d and %d and sd.ITEMGROUP in(3) // AND sd.ItemCode in(-128) AND S.EmployeeID IN (%q) AND S.payrolltypeid = %n // group by e.EMPLOYEEID,e.EmployeeNo,sd.ITEMGROUP,sd.ITEMCODE,sd.ITEMID,sd.DESCRIPTION // ORDER BY e.EmployeeNo ", // dSStartMonthDate, dSEndMonthDate, sEmpID, payrollTypeId, sEmpID); //tempdataset = tc.ExecuteDataSet(sSQL); //tempdataset.Tables[0].TableName = "EmpWisePF"; //rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); sSQL = SQLParser.MakeSQL(@"SELECT e.EMPLOYEEID,e.EmployeeNo,bpd.BONUSID,b.NAME Description,Sum(bpd.CHANGEBONUSAMOUNT) Amount FROM BONUSPROCESSDETAIL bpd INNER JOIN BONUS b ON bpd.BONUSID = b.BONUSID inner join Employee e on bpd.EMPLOYEEID = e.EmployeeId LEFT JOIN BONUSPROCESS bp ON bpd.BONUSPROCESSID = bp.BONUSPROCESSID WHERE bp.BONUSMONTH=%d AND bpd.EMPLOYEEID IN (%q) AND bp.ISDISBURSEWITHSALARY = %n AND bp.PAYROLLTYPEID = %n GROUP BY e.EMPLOYEEID,e.EmployeeNo,bpd.BONUSID,b.NAME ORDER BY e.EmployeeNo", dSalarymonth, sEmpID, false, payrollTypeId); tempdataset = tc.ExecuteDataSet(sSQL); tempdataset.Tables[0].TableName = "EmpWiseBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmployeesPFNew(TransactionContext tc, DateTime Fromdate, DateTime Todate, string sEmpIDs) { DataSet rootDataset = new DataSet(); DataSet tempdataset = new DataSet(); string sTranType = Convert.ToString((int)EnumPFTranType.PFAmount) + "," + Convert.ToString((int)EnumPFTranType.CPFAmount); try { // string sqlPFexception = SQLParser.MakeSQL(@"SELECT t.[Name],t.EmployeeNo,t.JOININGDATE, t.Designation,t.Department, t.TotalGross GrossSalary,ROUND (SUM(t.EPF),0)as EPF, Round(SUM(t.CPF),0) CPF, t.BIRTHDATE // FROM // ( // SELECT e.EmployeeNo,e.Name,e.JOININGDATE,e.BIRTHDATE, D.NAME Designation,Dep.DESCRIPTION Department, // NVL(sm.THISMONTHBASIC,0) THISMONTHBASIC, // NVL(sm.ThisMonthBasic,0) TotalGross, // CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END EPF, // CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END CPF, // // CC.DESCRIPTION CostCenter // FROM PFTRANSACTION pt // LEFT JOIN Employee e ON pt.EMPLOYEEID = e.EMPLOYEEID AND pt.TRANDATE BETWEEN %d AND %d // LEFT JOIN DESIGNATION D ON e.DESIGNATIONID = D.DESIGNATIONID // LEFT JOIN DEPARTMENT Dep ON e.DEPARTMENTID = Dep.DEPARTMENTID // LEFT JOIN EMPCOSTCENTER cmpcc ON e.EMPLOYEEID=cmpcc.EMPLOYEEID AND cmpcc.CurrentCC=1 // INNER JOIN CRG CC ON cmpcc.CostCenterID = CC.CRGID // LEFT JOIN SALARYMONTHLY sm ON sm.EMPLOYEEID = e.EMPLOYEEID AND sm.SalaryMonth = %d // Left JOIN SALARYMONTHLYDETAIL smd ON sm.SALARYMONTHLYID = smd.SALARYMONTHLYID AND smd.ITEMGROUP IN(1,8) // // )t // GROUP BY t.EmployeeNo, t.[Name], t.THISMONTHBASIC, t.TotalGross, t.CostCenter, // t.JOININGDATE,t.Designation,t.Department,t.BirthDate", (int)EnumPFTranType.PFAmount, (int)EnumPFTranType.CPFAmount, Fromdate, Todate, Todate); string sqlPfException = ""; if (sEmpIDs == "") { sqlPfException = SQLParser.MakeSQL(@" SELECT t.Name,t.EmployeeNo,t.JOININGDATE, t.Designation,t.Department, t.TotalGross GrossSalary,ROUND (SUM(t.EPF),0)as EPF, Round(SUM(t.CPF),0) CPF, t.BIRTHDATE FROM (SELECT e.EmployeeNo,e.Name,e.BIRTHDATE, e.JOININGDATE, D.NAME Designation,Dept.DESCRIPTION Department, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END EPF, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END CPF, ISNULL(s.THISMONTHBASIC,0) THISMONTHBASIC, ISNULL(s.ThisMonthBasic,0) TotalGross FROM SALARYMONTHLY s INNER JOIN EMPLOYEE e ON e.EMPLOYEEID= s.EMPLOYEEID INNER JOIN DESIGNATION d ON d.DESIGNATIONID= e.DESIGNATIONID INNER JOIN DEPARTMENT dept ON e.DEPARTMENTID = dept.DEPARTMENTID INNER JOIN EmpLifeCycle elc ON elc.EmployeeID=e.EMPLOYEEID INNER JOIN EMPCOSTCENTER cmpcc ON e.EMPLOYEEID=cmpcc.EMPLOYEEID AND cmpcc.CurrentCC=1 INNER JOIN CRG CC ON cmpcc.CostCenterID = CC.CRGID INNER JOIN SALARYMONTHLYDETAIL smd ON s.SALARYMONTHLYID = smd.SALARYMONTHLYID AND smd.ITEMGROUP IN(1,8) LEFT JOIN PFTRANSACTION pt ON pt.EMPLOYEEID=e.EMPLOYEEID WHERE s.SalaryMonth=%d AND elc.IsConfirm=1 AND elc.EffectDate BETWEEN %d AND %d)t GROUP BY t.EmployeeNo, t.Name, t.THISMONTHBASIC, t.TotalGross, t.JOININGDATE,t.Designation,t.Department,t.BirthDate", (int)EnumPFTranType.PFAmount, (int)EnumPFTranType.CPFAmount,PayrollGlobalFunctions.PayrollLastDateOfMonth(Fromdate), Fromdate, Todate); tempdataset = tc.ExecuteDataSet(sqlPfException); tempdataset.Tables[0].TableName = "PFandConfirmation"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } else { string sTableName; sEmpIDs = IDHelper.GetIDs(tc, sEmpIDs, out sTableName); sqlPfException = SQLParser.MakeSQL(@" SELECT t.Name,t.EmployeeNo,t.JOININGDATE, t.Designation,t.Department, t.TotalGross GrossSalary,ROUND (SUM(t.EPF),0)as EPF, Round(SUM(t.CPF),0) CPF, t.BIRTHDATE FROM (SELECT e.EmployeeNo,e.Name,e.BIRTHDATE, e.JOININGDATE, D.NAME Designation,Dept.DESCRIPTION Department, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END EPF, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END CPF, NVL(s.THISMONTHBASIC,0) THISMONTHBASIC, NVL(s.ThisMonthBasic,0) TotalGross FROM SALARYMONTHLY s INNER JOIN EMPLOYEE e ON e.EMPLOYEEID= s.EMPLOYEEID INNER JOIN DESIGNATION d ON d.DESIGNATIONID= e.DESIGNATIONID INNER JOIN DEPARTMENT dept ON e.DEPARTMENTID = dept.DEPARTMENTID INNER JOIN EmpLifeCycle elc ON elc.EmployeeID=e.EMPLOYEEID INNER JOIN EMPCOSTCENTER cmpcc ON e.EMPLOYEEID=cmpcc.EMPLOYEEID AND cmpcc.CurrentCC=1 INNER JOIN CRG CC ON cmpcc.CostCenterID = CC.CRGID INNER JOIN SALARYMONTHLYDETAIL smd ON s.SALARYMONTHLYID = smd.SALARYMONTHLYID AND smd.ITEMGROUP IN(1,8) LEFT JOIN PFTRANSACTION pt ON pt.EMPLOYEEID=e.EMPLOYEEID WHERE s.SalaryMonth=%d AND elc.IsConfirm=1 AND elc.EffectDate BETWEEN %d AND %d AND e.EMPLOYEEID IN (%q) )t GROUP BY t.EmployeeNo, t.Name, t.THISMONTHBASIC, t.TotalGross, t.JOININGDATE,t.Designation,t.Department,t.BirthDate", (int)EnumPFTranType.PFAmount, (int)EnumPFTranType.CPFAmount, Todate, Fromdate, Todate, sEmpIDs); tempdataset = tc.ExecuteDataSet(sqlPfException); tempdataset.Tables[0].TableName = "PFandConfirmation"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); if (sTableName != "") tc.ExecuteNonQuery("Drop TAble %q", sTableName); } } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpCostCenter(TransactionContext tc, string sEmpID) { DataSet OPIDset = new DataSet(); string query = SQLParser.MakeSQL(@"SELECT emp.EMPLOYEEID,cc.CRGID,cc.[DESCRIPTION] CostCenter FROM EMPLOYEE EMp LEFT JOIN EMPCOSTCENTER ecc ON (emp.EMPLOYEEID = ecc.EMPLOYEEID AND ecc.CurrentCC=1) LEFT JOIN CRG cc ON ecc.COSTCENTERID = cc.CRGID WHERE emp.EMPLOYEEID IN(%q)", sEmpID); OPIDset = tc.ExecuteDataSet(query); return OPIDset; } internal static DataSet GetPerquisiteData(TransactionContext tc, DateTime dSStartMonthDate, DateTime dSEndMonthDate, string sEmpID, int payrollTypeId) { DataSet rootDataset = new DataSet(); DataSet tempdataset = new DataSet(); try { string sSQL = SQLParser.MakeSQL(@" select e.EMPLOYEEID,e.EmployeeNo,sd.ITEMGROUP,sd.ITEMCODE,sd.ITEMID,sd.Description,SUM(sd.changedamount) Amount from SALARYMONTHLYDETAIL sd,SALARYMONTHLY S ,Employee e Where sd.SALARYMONTHLYID=S.SALARYMONTHLYID And S.EmployeeID = e.EmployeeId AND S.SalaryMonth between %d and %d and sd.ITEMGROUP in(1,8) AND sd.ItemCode not in(-102) AND S.EmployeeID IN(%q) group by e.EMPLOYEEID,e.EmployeeNo,sd.ITEMGROUP,sd.ITEMCODE,sd.ITEMID,sd.DESCRIPTION ORDER BY e.EmployeeNo ", dSStartMonthDate, dSEndMonthDate, sEmpID, payrollTypeId, sEmpID); tempdataset = tc.ExecuteDataSet(sSQL); tempdataset.Tables[0].TableName = "EmpWiseSalary"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); sSQL = SQLParser.MakeSQL(@" select e.EMPLOYEEID,e.EmployeeNo,sd.ITEMGROUP,sd.ITEMCODE,sd.ITEMID,sd.Description,SUM(sd.changedamount) Amount from SALARYMONTHLYDETAIL sd,SALARYMONTHLY S ,Employee e Where sd.SALARYMONTHLYID = S.SALARYMONTHLYID And S.EmployeeID = e.EmployeeId AND S.SalaryMonth between %d and %d and sd.ITEMGROUP in(3) AND sd.ItemCode in(-128) AND S.EmployeeID IN (%q) group by e.EMPLOYEEID,e.EmployeeNo,sd.ITEMGROUP,sd.ITEMCODE,sd.ITEMID,sd.DESCRIPTION ORDER BY e.EmployeeNo ", dSStartMonthDate, dSEndMonthDate, sEmpID, payrollTypeId, sEmpID); tempdataset = tc.ExecuteDataSet(sSQL); tempdataset.Tables[0].TableName = "EmpWisePF"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); sSQL = SQLParser.MakeSQL(@"SELECT e.EMPLOYEEID,e.EmployeeNo,bpd.BONUSID,b.NAME Description,Sum(bpd.CHANGEBONUSAMOUNT) Amount FROM BONUSPROCESSDETAIL bpd INNER JOIN BONUS b ON bpd.BONUSID = b.BONUSID inner join Employee e on bpd.EMPLOYEEID = e.EmployeeId LEFT JOIN BONUSPROCESS bp ON bpd.BONUSPROCESSID = bp.BONUSPROCESSID WHERE bp.BONUSMONTH BETWEEN %d and %d AND bpd.EMPLOYEEID IN (%q) AND bp.ISDISBURSEWITHSALARY = %n GROUP BY e.EMPLOYEEID,e.EmployeeNo,bpd.BONUSID,b.NAME ORDER BY e.EmployeeNo", dSStartMonthDate, dSEndMonthDate, sEmpID, false, payrollTypeId); tempdataset = tc.ExecuteDataSet(sSQL); tempdataset.Tables[0].TableName = "EmpWiseBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } /* internal static IDataReader GetByGlobalID(TransactionContext tc, string GPDPID) { var sql = SQLParser.MakeSQL(@"Select EmployeeID From Employee Where GlobalID = %s", GPDPID); return tc.ExecuteReader(sql); } internal static DataSet GetEmpGrossPay(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var queryGross = SQLParser.MakeSQL( @"select E.EmployeeNo, E.Name,Sum(A.amount) GrossAmount,a.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,a.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryGross); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var queryTotalDeduction = SQLParser.MakeSQL( @"select E.EmployeeNo, E.Name, Sum(A.amount) DeductionAmount,A.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID from ( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2,3) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID)A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LOCATIONID,E.DESIGNATIONID, E.DEPARTMENTID ", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryTotalDeduction); tempdataset.Tables[0].TableName = "TotalDeduction"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetTotalOPI(TransactionContext tc, string oPIItem, DateTime _SalaryMonth, string sEmpID) { var oTotalOPI = new DataSet(); var sQuary = SQLParser.MakeSQL("SELECT e.EmployeeNo,e.DEPARTMENTID, e.Name EmpName," + " e.DESIGNATIONID,e.BRANCHID, Sum(opdi.NetAmount) OPIAmount" + " FROM Employee e, " + " OPIItem oi, OPIProcess op, OPIProcessDetail opd, OPIProcessDetailItem opdi " + " WHERE op.OPIMonth >= %d AND op.OPIMonth <= %d " + " AND e.EmployeeId IN(%q) AND op.OPIProcessID = opd.OPIProcessID" + " AND e.EmployeeId = opd.EmployeeId AND opd.OPIProcessDetailId = opdi.OPIProcessDetailId" + " AND oi.OPIItemId = opdi.OPIItemId " + " GROUP BY e.EmployeeId, e.EmployeeNo, e.Name,e.DEPARTMENTID,e.DESIGNATIONID," + " e.BRANCHID ORDER BY e.EmployeeNo", PayrollGlobalFunctions.PayrollFirstDateOfMonth(_SalaryMonth), PayrollGlobalFunctions.PayrollLastDateOfMonth(_SalaryMonth), sEmpID, oPIItem); oTotalOPI = tc.ExecuteDataSet(sQuary); return oTotalOPI; } internal static DataSet GetEmpDeduction(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var deductItem = SQLParser.MakeSQL( "select A.EmployeeNo,A.CIFNo, A.Name,A.GName,A.GCode,A.SequenceNo,A.DName,A.Description, " + " SUM(A.changedamount) Amount,A.Department,A.Branch,A.DEPARTMENTID,A.ITEMCODE,A.ITEMGROUP,A.ITEMID " + " from (" + " select S.EmployeeID, E.EmployeeNo, E.Name,E.GLOBALID CIFNo, " + " sd.ItemGroup,sd.ItemCode, sd.ItemID, sd.Description,sd.Position, " + " sd.changedamount,G.DESCRIPTION GName,G.Code GCode,G.SequenceNo,D.Name DName ," + " DE.DESCRIPTION Department,L.DESCRIPTION Branch,DE.DEPARTMENTID" + " from Grades G,DESIGNATION D,Employee E, SALARYMONTHLY S, SalaryMonthlyDetail Sd,DEPARTMENT DE," + " LOCATION L " + " where G.GradeID= E.GradeID AND D.DESIGNATIONID=E.DESIGNATIONID " + " AND E.employeeID=S.EmployeeID AND S.SalaryMonthlyID=Sd.SalaryMonthlyID " + " AND S.SalaryMonth=%d and Sd.ItemGroup=3 " + " AND L.LOCATIONID=S.LOCATIONID and DE.DEPARTMENTID=S.DEPARTMENTID" + " AND S.EmployeeID IN(%q) " + " union " + " select S.EmployeeID, E.EmployeeNo, E.Name, sd.ItemGroup,sd.ItemCode,E.GLOBALID CIFNo, " + " sd.ItemID, sd.Description,sd.Position, -sd.changedamount,G.DESCRIPTION GName," + " G.Code GCode,G.sequenceNo,D.Name DName,DE.DESCRIPTION Department,L.DESCRIPTION Branch,DE.DEPARTMENTID " + " from Grades G,DESIGNATION D,Employee E, " + " SALARYMONTHLY S, SalaryMonthlyDetail Sd,DEPARTMENT DE,LOCATION L " + " where G.GradeID= E.GradeID " + " AND D.DESIGNATIONID=E.DESIGNATIONID AND E.employeeID=S.EmployeeID " + " AND DE.DEPARTMENTID=S.DEPARTMENTID AND L.LOCATIONID=S.LOCATIONID " + " AND S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d" + " and Sd.ItemGroup=2 AND S.EmployeeID IN(%q) " + " ) A " + " group by A.EmployeeID, A.EmployeeNo, A.Name,A.GName,A.SequenceNo,A.GCode,A.CIFNo," + " A.DName, A.ItemCode, A.ItemID,A.ITEMGROUP, A.Description,A.Position ,A.Department,A.Branch,A.DEPARTMENTID " + " order by A.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(deductItem); tempdataset.Tables[0].TableName = "DeductItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var query6 = SQLParser.MakeSQL( "select E.EmployeeNo, E.Name,A.GName,A.GCode,A.SequenceNo,A.DName,A.Department," + " 'Total Deduction' Description, Sum(A.amount) amount,A.Branch,A.DEPARTMENTID " + " ,E.GLOBALID CIFNo from" + " ( select S.EmployeeID, Sum(sd.changedamount) Amount,G.DESCRIPTION GName," + " G.Code GCode,G.SequenceNo,D.Name DName,DE.DEPARTMENTID," + " DE.DESCRIPTION Department,L.DESCRIPTION Branch " + " from DEPARTMENT DE,LOCATION L," + " GRADES G,DESIGNATION D,SALARYMONTHLY S,SalaryMonthlyDetail Sd" + " where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d" + " AND S.DEPARTMENTID=DE.DEPARTMENTID AND S.LOCATIONID = L.LOCATIONID" + " AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID " + " and Sd.ItemGroup IN (2,3) AND S.EmployeeID IN(%q)" + " group by S.EmployeeID,G.DESCRIPTION,G.SequenceNo,G.Code,D.Name,DE.DESCRIPTION," + " L.DESCRIPTION,DE.DEPARTMENTID ) A, Employee E " + " where A.EmployeeID = E.EmployeeID " + " group by E.EmployeeNo, E.Name,A.GName,A.SequenceNo,A.GCode,A.DName ,A.Department," + " A.Branch,A.DEPARTMENTID,E.GLOBALID order by E.EmployeeNo", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(query6); tempdataset.Tables[0].TableName = "TotalDeduction"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetBranchWiseSalary(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var queryGross = SQLParser.MakeSQL(@"Select Sum(A.amount) GrossAmount,E.DEPARTMENTID , A.LOCATIONID from( select S.EmployeeID,Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID) A, Employee E where A.EmployeeID = E.EmployeeID group by A.LOCATIONID,E.DEPARTMENTID order by A.LocationID,E.DEPARTMENTID", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryGross); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sFestiveBonus = SQLParser.MakeSQL(@"Select Sum(A.amount) FestivalBonus, E.DEPARTMENTID, A.LOCATIONID from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) and ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID) A, Employee E where A.EmployeeID = E.EmployeeID group by A.LOCATIONID,E.DEPARTMENTID order by A.LOCATIONID,E.DEPARTMENTID", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(sFestiveBonus); tempdataset.Tables[0].TableName = "FestivalBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sPerformanceBonus = SQLParser.MakeSQL(@"Select Sum(A.amount) PerformBonus,E.DEPARTMENTID, A.LOCATIONID from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) and ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID) A, Employee E where A.EmployeeID = E.EmployeeID group by A.LOCATIONID,E.DEPARTMENTID order by A.LOCATIONID,E.DEPARTMENTID", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(sPerformanceBonus); tempdataset.Tables[0].TableName = "PerformanceBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var queryTotalDeduction = SQLParser.MakeSQL(@"select A.LOCATIONID, Sum(A.amount) DeductionAmount, E.DEPARTMENTID from ( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2,3) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID)A, Employee E where A.EmployeeID = E.EmployeeID group by A.LOCATIONID,E.DEPARTMENTID order by A.LOCATIONID,E.DEPARTMENTID", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryTotalDeduction); tempdataset.Tables[0].TableName = "TotalDeduction"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetCCWiseSalaryDetails(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var sSQL = SQLParser.MakeSQL( @"select A.EmployeeNo, A.Name,A.GName,A.DName,A.GCode,A.CRGDes,A.SequenceNO, A.Description, SUM(A.amonut) amount,A.PERCENTAGE,A.DEPARTMENTID,A.LocationID from (select S.EmployeeID, E.EmployeeNo, E.Name, sd.ItemGroup,sd.ItemCode, sd.ItemID, sd.Description,sd.Position, sd.changedamount*SEMCC.PERCENTAGE/100 amonut, SEMCC.PERCENTAGE, G.DESCRIPTION GName,D.Name DName,G.Code GCode,G.SequenceNo, E.DEPARTMENTID,E.LocationID, CC.DESCRIPTION CRGDes from Grades G,CRG CC,SALARYEMPCOSTCENTER SEMCC , DESIGNATION D,Employee E, SALARYMONTHLY S, SalaryMonthlyDetail Sd where G.GradeID= E.GradeID AND S.EMPLOYEEID=SEMCC.EMPLOYEEID AND CC.CRGID=SEMCC.COSTCENTERID AND D.DESIGNATIONID=E.DESIGNATIONID AND E.employeeID=S.EmployeeID AND S.SalaryMonthlyID=Sd.SalaryMonthlyID AND SD.SALARYMONTHLYID=SEMCC.SALARYMONTHLYID AND S.SalaryMonth=%d and Sd.ItemGroup in(8,4) AND sd.ItemCode not in(-133) AND S.EmployeeID IN(%q) union select S.EmployeeID, E.EmployeeNo, E.Name, sd.ItemGroup,sd.ItemCode, sd.ItemID, sd.Description,sd.Position,sd.changedamount*SEMCC.PERCENTAGE/100 amonut, SEMCC.PERCENTAGE, G.DESCRIPTION GName, D.Name DName,G.Code GCode,G.SequenceNo, E.DEPARTMENTID,E.LocationID, CC.DESCRIPTION CRGDes from Grades G,CRG CC, SALARYEMPCOSTCENTER SEMCC, DESIGNATION D,Employee E, SALARYMONTHLY S, SalaryMonthlyDetail Sd where G.GradeID= E.GradeID AND S.EMPLOYEEID=SEMCC.EMPLOYEEID AND CC.CRGID=SEMCC.COSTCENTERID AND D.DESIGNATIONID=E.DESIGNATIONID AND E.employeeID=S.EmployeeID AND SD.SALARYMONTHLYID=SEMCC.SALARYMONTHLYID AND S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup in(1,4) AND sd.ItemCode not in(-133) AND S.EmployeeID IN(%q) ) A group by A.EmployeeID, A.EmployeeNo, A.Name,A.GName,A.DName,A.SequenceNo,A.GCode, A.CRGDes, A.ItemCode, A.ItemID, A.Description,A.Position ,A.PERCENTAGE,A.DEPARTMENTID, A.LocationID order by A.EmployeeNo,A.CRGDes,A.Position,A.SequenceNo,A.GCode", dSMonthDate, sEmpID, dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(sSQL); tempdataset.Tables[0].TableName = "GrossItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var queryGross = SQLParser.MakeSQL( @"select E.EmployeeNo, E.Name,A.GName,A.GCode,A.SequenceNo,A.DName,'Gross Pay' Description, Sum(A.amount) amount,A.CRGDes,A.PERCENTAGE,E.DEPARTMENTID,E.LocationID from ( select S.EmployeeID, Sum(sd.changedamount)*EMPC.PERCENTAGE/100 Amount, G.DESCRIPTION GName, G.Code GCode,G.SequenceNo,D.Name DName,CC.DESCRIPTION CRGDes,EMPC.PERCENTAGE from SALARYMONTHLY S,Grades G,DESIGNATION D, SalaryMonthlyDetail Sd, CRG CC,EMPCOSTCENTER EMPC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) AND S.EmployeeID IN(%q) And S.EMPLOYEEID=EMPC.EMPLOYEEID AND EMPC.COSTCENTERID=CC.CRGID group by S.EmployeeID,G.DESCRIPTION,G.SequenceNo,G.Code,D.Name ,CC.DESCRIPTION ,EMPC.PERCENTAGE UNION select S.EmployeeID, -Sum(sd.changedamount)* EMPC.PERCENTAGE/100 Amount,G.DESCRIPTION GName, G.Code GCode,G.sequenceNo,D.Name DName,CC.DESCRIPTION CRGDes,EMPC.PERCENTAGE from GRADES G,DESIGNATION D,SALARYMONTHLY S, SalaryMonthlyDetail Sd,CRG CC,EMPCOSTCENTER EMPC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID and Sd.ItemGroup IN (2) AND S.EmployeeID IN(%q) And S.EMPLOYEEID=EMPC.EMPLOYEEID AND EMPC.COSTCENTERID=CC.CRGID group by S.EmployeeID,G.DESCRIPTION,G.SequenceNo,G.Code,D.Name,CC.DESCRIPTION,EMPC.PERCENTAGE ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.GName,A.SequenceNo,A.GCode,A.DName,A.CRGDes,A.PERCENTAGE,E.DEPARTMENTID,E.LocationID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryGross); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetDividionWiseReport(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var queryGross = SQLParser.MakeSQL(@"Select E.EMPLOYEEID,E.EmployeeNo, E.Name,Sum(A.amount) GrossAmount,A.LocationID,E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID from( select S.EmployeeID,Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EMPLOYEEID,E.EmployeeNo, E.Name,A.LocationID,E.BRANCHID, E.DESIGNATIONID,E.DEPARTMENTID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryGross); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sFestiveBonus = SQLParser.MakeSQL(@"Select E.EmployeeNo, E.Name,Sum(A.amount) FestivalBonus, A.LocationID , E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) and ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID,A.LocationID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(sFestiveBonus); tempdataset.Tables[0].TableName = "FestivalBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sPerformanceBonus = SQLParser.MakeSQL(@"Select E.EmployeeNo, E.Name,Sum(A.amount) PerformBonus,A.LocationID , E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) and ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LocationID , E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(sPerformanceBonus); tempdataset.Tables[0].TableName = "PerformanceBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var SCoPFContri = SQLParser.MakeSQL(@"Select E.EmployeeNo, E.Name,Sum(A.changedamount) CoPFContri, A.LOCATIONID , E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID from( select S.EmployeeID,sd.changedamount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup=3 AND S.EmployeeID IN(%q) AND sd.ITEMCODE in(-128) ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LocationID , E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID order by E.EmployeeNo", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(SCoPFContri); tempdataset.Tables[0].TableName = "CoPFContribution"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var queryTotalDeduction = SQLParser.MakeSQL(@"select E.EmployeeNo, E.Name, Sum(A.amount) DeductionAmount,A.LocationID ,E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID from ( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2,3) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID)A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LocationID ,E.BRANCHID,E.DESIGNATIONID , E.DEPARTMENTID order by E.EmployeeNo ", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryTotalDeduction); tempdataset.Tables[0].TableName = "TotalDeduction"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetCTCDetail(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var queryGross = SQLParser.MakeSQL( @"select E.EmployeeID, E.EmployeeNo,E.GLOBALID CIFNo, E.Name,A.GName,A.GCode,A.SequenceNo, E.DESIGNATIONID,'GrossPay' Description, Sum(A.amount) amount,A.CRGDes,A.PERCENTAGE,E.DEPARTMENTID,A.LOCATIONID from ( select S.EmployeeID, Sum(sd.changedamount)*EMPC.PERCENTAGE/100 Amount,S.LOCATIONID, G.DESCRIPTION GName, G.Code GCode,G.SequenceNo,D.Name DName,CC.DESCRIPTION CRGDes,EMPC.PERCENTAGE from SALARYMONTHLY S,Grades G,DESIGNATION D, SalaryMonthlyDetail Sd, CRG CC,EMPCOSTCENTER EMPC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) AND S.EmployeeID IN(%q) And S.EMPLOYEEID=EMPC.EMPLOYEEID AND EMPC.COSTCENTERID=CC.CRGID group by S.EmployeeID,G.DESCRIPTION,G.SequenceNo,G.Code,D.Name ,CC.DESCRIPTION ,EMPC.PERCENTAGE,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount)* EMPC.PERCENTAGE/100 Amount,S.LOCATIONID,G.DESCRIPTION GName, G.Code GCode,G.sequenceNo,D.Name DName,CC.DESCRIPTION CRGDes,EMPC.PERCENTAGE from GRADES G,DESIGNATION D,SALARYMONTHLY S, SalaryMonthlyDetail Sd,CRG CC,EMPCOSTCENTER EMPC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID and Sd.ItemGroup IN (2) AND S.EmployeeID IN(%q) And S.EMPLOYEEID=EMPC.EMPLOYEEID AND EMPC.COSTCENTERID=CC.CRGID group by S.EmployeeID,G.DESCRIPTION,G.SequenceNo,G.Code,D.Name,CC.DESCRIPTION,EMPC.PERCENTAGE,S.LOCATIONID ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeID,E.EmployeeNo, E.Name,A.GName,A.SequenceNo,A.GCode,E.DESIGNATIONID,A.CRGDes,A.LOCATIONID, A.PERCENTAGE,E.DEPARTMENTID,E.GLOBALID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryGross); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sFestiveBonus = SQLParser.MakeSQL( @"Select E.EmployeeNo, E.Name,Sum(A.amount) FestivalBonus,A.LOCATIONID, E.BRANCHID,E.DESIGNATIONID, E.DEPARTMENTID from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) and ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LOCATIONID, E.BRANCHID,E.DESIGNATIONID,E.DEPARTMENTID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(sFestiveBonus); tempdataset.Tables[0].TableName = "FestivalBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sPerformanceBonus = SQLParser.MakeSQL( @"Select E.EmployeeNo, E.Name,Sum(A.amount) PerformBonus,A.LOCATIONID,E.DESIGNATIONID, E.DEPARTMENTID from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) and ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND ITEMID in (4) AND ITEMCODE in(-113) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(sPerformanceBonus); tempdataset.Tables[0].TableName = "PerformanceBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var SCoPFContri = SQLParser.MakeSQL( @"Select E.EmployeeNo, E.Name,Sum(A.amount) CoPFContri,A.LOCATIONID,E.DESIGNATIONID, E.DEPARTMENTID from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (3) AND S.EmployeeID IN(%q) AND Sd.ITEMCODE in(-128) group by S.EmployeeID,S.LOCATIONID ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(SCoPFContri); tempdataset.Tables[0].TableName = "CoPFContribution"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var queryTotalDeduction = SQLParser.MakeSQL(@"select E.EmployeeNo, E.Name, Sum(A.amount) DeductionAmount,A.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID from ( select S.EmployeeID, Sum(sd.changedamount) Amount,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2,3) AND S.EmployeeID IN(%q) group by S.EmployeeID,S.LOCATIONID)A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID order by E.EmployeeNo", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryTotalDeduction); tempdataset.Tables[0].TableName = "TotalDeduction"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetIncrement(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var queryGross = SQLParser.MakeSQL( @"Select distinct E.EMPLOYEEID,E.EmployeeNo, E.Name,Sum(A.amount) GrossAmount,A.LOCATIONID, E.DESIGNATIONID, E.DEPARTMENTID,A.CRGDes,A.CRGID,A.PERCENTAGE from( select S.EmployeeID,Sum(sd.changedamount)*SEMPCC.PERCENTAGE/100 amount, CC.DESCRIPTION CRGDes,CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd,SALARYEMPCOSTCENTER SEMPCC,CRG CC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) And S.EMPLOYEEID=SEMPCC.EMPLOYEEID AND CC.CRGID=SEMPCC.COSTCENTERID AND S.EmployeeID IN(%q) group by S.EmployeeID,CC.DESCRIPTION,CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount)*SEMPCC.PERCENTAGE/100 amount,CC.DESCRIPTION CRGDes,CC.CRGID, SEMPCC.PERCENTAGE,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd,SALARYEMPCOSTCENTER SEMPCC,CRG CC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) And S.EMPLOYEEID=SEMPCC.EMPLOYEEID AND CC.CRGID=SEMPCC.COSTCENTERID AND S.EmployeeID IN(%q) group by S.EmployeeID,CC.DESCRIPTION,CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EMPLOYEEID,E.EmployeeNo, E.Name,A.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID, A.CRGDes,A.PERCENTAGE,A.CRGID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryGross); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var queryBasic = SQLParser.MakeSQL(@"Select E.EMPLOYEEID,E.EmployeeNo, E.Name,A.amount BasicAmount, A.LOCATIONID,E.DESIGNATIONID, E.DEPARTMENTID ,A.CRGDes,A.CRGID,A.PERCENTAGE from( select S.EmployeeID,Sum(sd.changedamount)*SEMPCC.PERCENTAGE/100 Amount,CC.DESCRIPTION CRGDes,CC.CRGID , SEMPCC.PERCENTAGE,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd ,SALARYEMPCOSTCENTER SEMPCC,CRG CC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) and ITEMID in (-101) And S.EMPLOYEEID=SEMPCC.EMPLOYEEID AND CC.CRGID=SEMPCC.COSTCENTERID AND S.EmployeeID IN(%q) group by S.EmployeeID, CC.DESCRIPTION,CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount)*SEMPCC.PERCENTAGE/100 amount,CC.DESCRIPTION CRGDes,CC.CRGID, SEMPCC.PERCENTAGE,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd ,SALARYEMPCOSTCENTER SEMPCC,CRG CC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND ITEMID in (-101) AND S.EmployeeID IN(%q) group by S.EmployeeID,CC.DESCRIPTION,CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID)A, Employee E where A.EmployeeID = E.EmployeeID group by E.EMPLOYEEID,E.EmployeeNo, E.Name,A.LOCATIONID,A.amount, E.DESIGNATIONID,E.DEPARTMENTID ,A.CRGDes,A.PERCENTAGE,A.CRGID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(queryBasic); tempdataset.Tables[0].TableName = "Basic"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sFestiveBonus = SQLParser.MakeSQL(@" Select E.EmployeeNo, E.Name,Sum(A.amount) FestivalBonus, A.LOCATIONID,E.DESIGNATIONID, E.DEPARTMENTID,A.CRGDes,A.CRGID,A.PERCENTAGE from( select S.EmployeeID, Sum(sd.changedamount)*SEMPCC.PERCENTAGE/100 Amount,CC.DESCRIPTION CRGDes,CC.CRGID, SEMPCC.PERCENTAGE,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd ,SALARYEMPCOSTCENTER SEMPCC,CRG CC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (1, 8) and ITEMID in (4) AND ITEMCODE in(-113) And S.EMPLOYEEID=SEMPCC.EMPLOYEEID AND CC.CRGID=SEMPCC.COSTCENTERID AND S.EmployeeID IN(%q) group by S.EmployeeID,CC.DESCRIPTION,CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID UNION select S.EmployeeID, -Sum(sd.changedamount)*SEMPCC.PERCENTAGE/100 Amount,CC.DESCRIPTION CRGDes,CC.CRGID,SEMPCC.PERCENTAGE ,S.LOCATIONID from SALARYMONTHLY S,SalaryMonthlyDetail Sd,SALARYEMPCOSTCENTER SEMPCC,CRG CC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (2) AND ITEMID in (4) AND ITEMCODE in(-113) And S.EMPLOYEEID=SEMPCC.EMPLOYEEID AND CC.CRGID=SEMPCC.COSTCENTERID AND S.EmployeeID IN(%q) group by S.EmployeeID,CC.DESCRIPTION,CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name, A.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID,A.CRGDes,A.PERCENTAGE,A.CRGID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(sFestiveBonus); tempdataset.Tables[0].TableName = "FestivalBonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var SCoPFContri = SQLParser.MakeSQL( @" Select E.EmployeeNo, E.Name,Sum(A.amount) CoPFContri,A.LOCATIONID,E.DESIGNATIONID, E.DEPARTMENTID,A.CRGDes,A.CRGID,A.PERCENTAGE from( select S.EmployeeID, Sum(sd.changedamount)*SEMPCC.PERCENTAGE/100 Amount,CC.DESCRIPTION CRGDes, CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID from SALARYMONTHLY S, SalaryMonthlyDetail Sd,SALARYEMPCOSTCENTER SEMPCC,CRG CC where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth=%d and Sd.ItemGroup IN (3) And S.EMPLOYEEID=SEMPCC.EMPLOYEEID AND CC.CRGID=SEMPCC.COSTCENTERID AND S.EmployeeID IN(%q) group by S.EmployeeID,CC.DESCRIPTION,CC.CRGID,SEMPCC.PERCENTAGE,S.LOCATIONID ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.LOCATIONID,E.DESIGNATIONID,E.DEPARTMENTID, A.CRGDes,A.PERCENTAGE,A.CRGID order by E.EmployeeNo", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(SCoPFContri); tempdataset.Tables[0].TableName = "CoPFContribution"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetADHeadReport(TransactionContext tc, DateTime dSMonthDate, string checkItem, string itemcode) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var sAllowanceDeduct = SQLParser.MakeSQL( "select S.EMPLOYEEID,S.LOCATIONID,Sd.DESCRIPTION,Sum(Sd.CHANGEDAMOUNT) Amount" + " from SALARYMONTHLY S,SALARYMONTHLYDETAIL Sd" + " where S.SALARYMONTHLYID=SD.SALARYMONTHLYID AND S.SalaryMonth=%d %q) %q)" + " group by S.EMPLOYEEID,S.LOCATIONID,Sd.DESCRIPTION", dSMonthDate, checkItem, itemcode); tempdataset = tc.ExecuteDataSet(sAllowanceDeduct); tempdataset.Tables[0].TableName = "HeadAllowanceDeduct"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetGrandFatherData(TransactionContext tc, int payrollTypeID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var sGrandFatherData = SQLParser.MakeSQL( @"SELECT e.EMPLOYEENO, e.NAME, dep.DESCRIPTION DEPARTMENT, deg.NAME DESIGNATION, g.CODE GRADE, e.JOININGDATE, bat.ALLOWANCE, bat.BONUS, bat.GRATUITY, bat.LEAVE, bat.opi, bat.PENSION FROM BATBGRANDFATHERTAGING bat LEFT JOIN EMPLOYEE e ON e.EMPLOYEEID= bat.EMPLOYEEID LEFT JOIN GRADES g ON g.GRADEID= e.GRADEID LEFT JOIN DEPARTMENT dep ON dep.DEPARTMENTID=e.DEPARTMENTID LEFT JOIN DESIGNATION deg ON deg.DESIGNATIONID=e.DESIGNATIONID WHERE e.PAYROLLTYPEID=%n ORDER BY e.EMPLOYEENO asc", payrollTypeID); tempdataset = tc.ExecuteDataSet(sGrandFatherData); tempdataset.Tables[0].TableName = "GrandFatherData"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpJoiningInsuranceData(TransactionContext tc, DateTime fromDate, DateTime toDate, int payrollTypeID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var sInsuranceData = SQLParser.MakeSQL( @"SELECT e.EMPLOYEENO, e.NAME, e.BIRTHDATE,e.JOININGDATE, D.Name Designation, g.Code Grade, g.InsuranceCoverage FROM EMPLOYEE e LEFT JOIN Designation d ON d.DESIGNATIONID=e.DESIGNATIONID Left Join Grades g ON g.GradeID=e.GradeID WHERE e.JOININGDATE BETWEEN %d AND %d AND e.PayrollTypeID = %n", fromDate, toDate, payrollTypeID); tempdataset = tc.ExecuteDataSet(sInsuranceData); tempdataset.Tables[0].TableName = "InsuranceData"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpPromotionInsuranceData(TransactionContext tc, DateTime fromDate, DateTime toDate, int payrollTypeID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var sInsuranceData = SQLParser.MakeSQL( @"SELECT e.EMPLOYEENO, e.NAME, e.BIRTHDATE,e.JOININGDATE, D.Name Designation, g.Code Grade, g.InsuranceCoverage FROM EMPLOYEE e LEFT JOIN Designation d ON d.DESIGNATIONID=e.DESIGNATIONID Left Join Grades g ON g.GradeID=e.GradeID WHERE e.JOININGDATE BETWEEN %d AND %d AND e.PayrollTypeID = %n", fromDate, toDate, payrollTypeID); tempdataset = tc.ExecuteDataSet(sInsuranceData); tempdataset.Tables[0].TableName = "InsuranceData"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpDisConInsuranceData(TransactionContext tc, DateTime fromDate, DateTime toDate, int payrollTypeID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); try { var sInsuranceData = SQLParser.MakeSQL( @"SELECT e.EMPLOYEENO, e.NAME, e.BIRTHDATE,elc.EFFECTDATE, D.Name Designation, g.Code Grade, g.InsuranceCoverage FROM EMPLIFECYCLE elc Inner join Employee e on e.Employeeid=elc.EmployeeID LEFT JOIN Designation d ON d.DESIGNATIONID=e.DESIGNATIONID Left Join Grades g ON g.GradeID=e.GradeID WHERE elc.EFFECTDATE BETWEEN %d AND %d and elc.Status = %n AND e.PayrolltypeID=%n", fromDate, toDate, EnumEmployeeStatus.Discontinued, payrollTypeID); tempdataset = tc.ExecuteDataSet(sInsuranceData); tempdataset.Tables[0].TableName = "InsuranceData"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetOPIHeadReport(TransactionContext tc, DateTime dSMonthDate, string checkItem) private ataSet root private a ase = new D private a ta private ataSet temp private a ase = new D private a ta //string sOPI = SQLParser.MakeSQL("Select D.EmployeeID,D.LocationID,I.Description,(I.ChangeNetAmount)as Amount from OPIProce // + " OPIProcessDetail D, OPIProcessDetailItem I W // + " O.OPIMonth=%d AND I.OPIProcessDetailID=D.OPIProcessDet // + " AND O.OPIProcessID= D.OPIProcessI // + " ORDER BY D.OPIProcessDetailID, OPIItemID", dSMonthDate, checI private stri g sOPI = private SQ L private Parser. M akeSQL("Select D.EmployeeID,D.LocationID,I.Description,(I.ChangeNetAmount)as Amount,oi.Sequ nc " from OPIProcess O, OPIProcessDetail D, OPIProcessDetailItem I,OpiIt m " Where O.OPIMonth=%d AND I.OPIProcessDetailID=D.OPIProcessDet il " AND O.OPIProcessID= D.OPIProcess D " AND I.OPIItemID=oi.OpiI em " ORDER BY D.OPIProcessDetailID, I.OPI private I emID", dSMo private n hDate, ch private e cI private temp a as private e t = tc.Execute private D ataS private e ts private temp d private ataset . T a private b les[0]. private Ta l Name = "H private ea root D ataset . Tab l es.Add(temp d private ataset . T a private b les[ 0 ] . Co catch (Ex ep private ti th ow private new Ex c private ep t private ion(ex. M es return private root Dataset; } internal static DataSet GetBranchWiseSalaryDetails(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { internal Data et internal ootDatas t = new Dat internal a et(); DataSet = internal new ataSet(); try internal stri g sSQ = internal SQLP a internal r se internal sele pt internal edamou t) internal A o nt, internal S.DEPA R TMENTID , S.LOCATIONID, sd.ItemGroup,sd.ITEMCODE, internal sd.ITEMID from internal SALARYMONTHLYDETAIL sd internal inner join internal SALARYMONTHLY S on sd.SALARYMONTHLYID= internal S.SALARYMONTHLYID where S.SalaryMonth= % internal d and sd.ITEMGROUP in internal (1, 2, 8) AND internal sd.ItemCode not in internal (-133) AND internal S.EmployeeID IN(%q) internal group by sd.DESCRIPTION,S.DEPARTMENTID,S.LOCATIONID,sd.ITEMCODE,sd.ITEMGROUP, internal sd.ITEMID order by S.LOCATIONID,S.DEPARTMENTID", dSMonthDate, sEmpID); internal et(sSQL); Tables[0]. internal T b internal eN a me = "Branch"; internal set.Tables. A dd(tem p internal d a t aset.Tabl s 0]. internal Copy( )) catch ( Exc e internal ption ex) { ow on(ex M essage); otDat set } internal static DataSet GetTotalBranchWiseOPI(TransactionContext tc, string str, DateTime dSMonthDate, string sEmpID) internal DataSet root ataset = internal new D taSet(); internal D ataSet tempdataset = internal n w internal Data et( ) try { = SQLPa ser.MakeSQL @ SE ECT opd . D EP d.LOCAT ONID, oi.OPI t mId me O op ount F ROM OPI I tem oi, OPIProcess op, OPIProcessDetail opd, OPIProcessDetailItem opdi WHERE op.OPIMonth >= %d AND op.OPIMonth <=%d AND opd.EmployeeId IN(% q) AND op.OPIProcessID = opd.OPIProcessID AND opd.OPIProcessDetailId = opdi.OPIProcessDetailId AND oi.OPIItemId = opdi.OPIItemId GROUP BY opd.LOCATIONID,opd.DEPARTMENTID, oi.OPIItemId, oi.Name ORDER BY opd.LOCATIONID,opd.DEPARTMENTID", PayrollGlobalFunctions.PayrollFirstDateOfMonth(dSMonthDate), PayrollGlobalFunctions.PayrollLastDateOfMonth( dSMonthDate), sEmpI D) tempdataset = tc.Exe c uteDataSet(sSQL); t e pdataset.Tables[0].Tab l eName = "BranchOPI"; rootDa t as mpdataset.T b es [ 0].Copy()); atch(Excep t ion ex ) { eption(ex.M e ssage) ; } ret u r n r } internal static DataSet GetTotalOPIForBranch(TransactionContext tc, string oPIItem, DateTime _SalaryMonth, string sEmpID) { Da t s tr ng sQuary = SQLParser.akeSQL(@"SELECT pd.DEP RTMENTI ,opd.LocationID, Sum(o di . etAmou t) OPIA m unt FROM OPIItem oi , OPIPro ess op , OPIProcess P Pro essDeta i l It RE op. PIMont = %d AND o p.OPIMo n th <= %d AND opd.EmployeeId IN(%q) AND op.OPIProcessID = opd.OPIProcessID AND opd.OPIProcessDetailId = opdi.OPIProcessDetailId AND oi.OPIItemId = opdi.OPIItemId GROUP BY opd.LocationID,opd.DEPARTMENTID ORDER BY opd.LocationID,opd.DEPARTMENTID", PayrollGlobalFunctions.PayrollFirstDateOfMonth(_SalaryMonth), PayrollGlobalFunctions.PayrollLastDateOfMonth(_SalaryMonth), sEmpID, oPIItem); oTotalOPI = tc.ExecuteDataSet(sQuary); ret ur } internal static DataSet GetBranchWiseEmpDeduction(TransactionContext tc, DateTime _SalaryMonth, string sEmpID) { Da t Set roo t Dt ataSet(); DataSet tempda t ae Set(); try { tring s QL = SQLParser.MakeSQL(@" S elect SMD.DESCRIPT ON , UM(SMD.C ANGEDAMOUNT) mount S ,SM.DEP RTMENTID,SM L CAT ONID,SM D . IT MCODE fr m SALAR Y M ON MD,S S whe e SM E PLOYEEID i n(%q) A N D SMD.ITEMGROUP IN(3) AND SM.SALARYMONTH=%d AND SM.SALARYMONTHLYID=SMD.SALARYMONTHLYID AND SMD.CHANGEDAMOUNT<>0 GROUP by SMD.ITEMGROUP,SMD.ITEMID,SMD.ITEMCODE, SMD.DESCRIPTION, SM.DEPARTMENTID,SM.LOCATIONID order by SM.LOCATIONID,SM.DEPARTMENTID asc", sEmpID, _SalaryMonth); tempdataset = tc.ExecuteDataSet(sSQL); tempdataset.Tables[0].TableName = "BranchDeduction"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } (Excep t on ex) throw n w E xception(ex.Me s sage ) ; re t urn ro o t D a taset; } internal static DataSet GetCCWiseFinance(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { D at ae Set() Da t t tr y { G QLP ar ser Mak eS QL(@ "s elect o,SUM(A.amount) Am unt, A. EPARTME TID, A.LOCATIONID,A It e Group, A. TEMCODE,A.I T MID, A. RGID,A .CostCenter fro (Select S. O ATI NID, S.D E P AR escript on, (sd.CHAN E AMO NT* EMPC C .PE )as mGroup sd.ITEMCO E sd.ITEMID , CC.CRGI D, CC.Description CostCenter from SALARYMONTHLYDETAIL sd ,SALARYMONTHLY S, SALARYEMPCOSTCENTER EMPCC,CRG CC Where sd.SALARYMONTHLYID = S.SALARYMONTHLYID AND S.SALARYMONTHLYID = EMPCC.SALARYMONTHLYID AND EMPCC.COSTCENTERID = CC.CRGID AND S.SalaryMonth = %d and sd.ITEMGROUP in(1, 8) AND sd.ItemCode not in(-133) AND S.EmployeeID IN(% q))A group by A.Description,A.DEPARTMENTID,A.LOCATIONID,A.ItemGroup,A.ITEMCODE, A.ITEMID,A.CRGID,A.CostCenter order by A.LOCATIONID,A.CRGID,A.DEPARTMENTID", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(GrossItem); tempdataset.Tables[0].TableName = "GrossItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var DeductItem = SQLParser.MakeSQL(@"select A.Description,SUM(A.amount) Amount,A.DEPA R MENTID, ItemGroup,A I EM C ODE,A.ITEMID,A . CRGID,A.C o st from (Selec t S . LOCATIONI , .DEPARTMENT ID (sd.CHANGED A MOUNT* E MPC C .PERCENTAGE / 100)as a m o unt, emGrou ,sd.ITEMCO E sd.ITEMID , CC.CRGI D ,CC.Description CostCenter from SALARYMONTHLYDETAIL sd ,SALARYMONTHLY S,SALARYEMPCOSTCENTER EMPCC,CRG CC Where sd.SALARYMONTHLYID=S.SALARYMONTHLYID AND S.SALARYMONTHLYID=EMPCC.SALARYMONTHLYID AND EMPCC.COSTCENTERID=CC.CRGID AND sd.CHANGEDAMOUNT<>0 AND S.SalaryMonth=%d and sd.ITEMGROUP in(3) AND S.EmployeeID IN(%q))A group by A.Description,A.DEPARTMENTID,A.LOCATIONID,A.ItemGroup,A.ITEMCODE, A.ITEMID,A.CRGID,A.CostCenter order by A.LOCATIONID,A.CRGID,A.DEPARTMENTID", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(DeductItem); tempdataset.Tables[0].TableName = "DeductItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var opiItem = SQLParser.MakeSQL(@"select A.Description,SUM(A.amount) Amount,A.DEPAR T ENTID, RGID,A.Cost e te r ,A.SequenceNO pd.LOCATION I D,opd. D E P A RTMENTID, p i.Descriptio n, EMPCC.PERCE N TAGE/1 0 0)a s amount, C C . C RI CostC nter,oi S quenceNO from OPIItem oi, OPIProcess op, OPIProcessDetail opd,SALARYEMPCOSTCENTER EMPCC, CRG CC,OPIProcessDetailItem opdi Where op.OPIMonth == %d AND opd.EmployeeId IN(%q) AND op.OPIProcessID = opd.OPIProcessID AND opd.EmployeeId = EMPCC.EMPLOYEEID AND EMPCC.COSTCENTERID=CC.CRGID AND opd.OPIProcessDetailId = opdi.OPIProcessDetailId AND oi.OPIItemId = opdi.OPIItemId )A group by A.Description,A.DEPARTMENTID,A.LOCATIONID,A.CRGID,A.CostCenter,A.SequenceNO order by A.LOCATIONID,A.CRGID,A.DEPARTMENTID", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(opiItem); tempdataset.Tables[0].TableName = "OPIItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } aset; } internal static DataSet GetNewCCWiseSalaryDetails(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { DataSet root D ataset = n D a taSet t e m p dataset = n w DataSet () y { st r ing Gr o s s I tem = S QL QL.Empl y eeNo, A.N me, A, A A.Ite Cod, A.ItemI D, A . ItemGro u p SUM(A.monut) Amou n AE, A.DEPARTMENTID, .Locat on from(select E.EmployeeNo, E.Na e, d.ItemGr up, sd.ItemC o e, sd.It criptio, sd.change a oun * SEMCC.P E RC monut, SE CC.PERC E N TA sign RI .EPARTMENT I D, CC.D E SCRIPTION CRGDes, CC.CRGID from CRG CC, LOCATION L,SALARYEMPCOSTCENTER SEMCC, DESIGNATION D,Employee E, SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.EMPLOYEEID = SEMCC.EMPLOYEEID AND CC.CRGID = SEMCC.COSTCENTERID AND D.DESIGNATIONID = E.DESIGNATIONID AND E.employeeID = S.EmployeeID AND S.SalaryMonthlyID = Sd.SalaryMonthlyID AND SD.SALARYMONTHLYID = SEMCC.SALARYMONTHLYID AND S.SalaryMonth = %d and Sd.ItemGroup in(8) AND S.LOCATIONID = L.LOCATIONID AND S.EmployeeID IN(% q) union select E.EmployeeNo, E.Name, sd.ItemGroup,sd.ItemCode, sd.ItemID, sd.Description,sd.changedamount * SEMCC.PERCENTAGE / 100 amonut, SEMCC.PERCENTAGE, D.Name Designation, L.DESCRIPTION Location, S.DEPARTMENTID,CC.DESCRIPTION CRGDes, CC.CRGID from CRG CC, LOCATION L, SALARYEMPCOSTCENTER SEMCC, DESIGNATION D,Employee E, SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.EMPLOYEEID = SEMCC.EMPLOYEEID AND CC.CRGID = SEMCC.COSTCENTERID AND D.DESIGNATIONID = E.DESIGNATIONID AND E.employeeID = S.EmployeeID AND SD.SALARYMONTHLYID = SEMCC.SALARYMONTHLYID AND S.SalaryMonthlyID = Sd.SalaryMonthlyID AND S.SalaryMonth = %d and Sd.ItemGroup in(1) AND S.LOCATIONID = L.LOCATIONID AND S.EmployeeID IN(% q) ) A group by A.EmployeeNo, A.Name,A.Designation,A.ItemGroup,A.Location,A.CRGID, A.CRGDes, A.ItemCode, A.ItemID, A.Description ,A.PERCENTAGE,A.DEPARTMENTID,A.Location order by A.CRGID,A.DEPARTMENTID", dSMonthDate, sEmpID, dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(GrossItem); tempdataset.Tables[0].TableName = "GrossItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetCCWiseOPIDetails(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { DataSe t rootDataset new D a tS DataSet t m da t aset = new Dat a Set(); { string o iItem = SQL Pa elect disti n ct A.D e scr i ption, A.amo u nt Amo u n t, A.DE P A R TM gn A.LOC TI ON os ceNO, .EM LOYEENO, A . NA M E, A.PER C EN(Selec opd.DEPART MENTID, opdiDescription, (opdi NetAmo nt * EMPC .PERCENTAGE / 100)as a mount, CC.CRGID CC.Descript i n Cost enter, oi.SequenceN ION LOC TION, E.E M P LO, D.NAME Designation E PCC PERCENT A G E o, OPIP ocessDe a l opd, SAL A RYEMPCO S TCENTER EMPCC, CRG CC,OPIProcessDetailItem opdi, EMPLOYEE E,LOCATION L, DESIGNATION D Where op.OPIMonth = %d AND opd.EmployeeId IN(% q) AND op.OPIProcessID = opd.OPIProcessID AND opd.EmployeeId = E.EmployeeId AND opd.EmployeeId = EMPCC.EMPLOYEEID AND EMPCC.COSTCENTERID = CC.CRGID AND opd.OPIProcessDetailId = opdi.OPIProcessDetailId AND E.LOCATIONID = L.LOCATIONID AND oi.OPIItemId = opdi.OPIItemId AND opd.DESIGNATIONID = D.DESIGNATIONID)A order by A.CRGID,A.DEPARTMENTID", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(opiItem); tempdataset.Tables[0].TableName = "OPIItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetCCWiseSummary(TransactionContext tc, DateTime dSMonthDate, string sEmpID) { ataS e t rootDat set = n e w DataSet(); Data S et ew Da aS t ( ); try { ross = SQLP r er .MakeSQL(@"Sele c t A.Cos t Ce EPARTMENTID , E.Role , s u m (A.amount a Amount from( s elect S .Em p loyeeID,Sum ( sd.cha n g e d amou n t ) *E AG , TM TION ost enter,CC. C RG I D YMONTH Y S,SalaryM onthlyDetai Sd,SALARYEMPCOST ENTER MPCC,CR CC wher S . alaryMon hlyID=Sd.Sa l ryMont lyID A ND S.SalaryM nd d.ItemG r o up ND S.SA ARYMONTHLYI = MPC .SALARY M O NT NTERID CC.CRGID A D S.Employe e ID IN(% q ) group by S.EmployeeID,S.DEPARTMENTID,CC.DESCRIPTION,CC.CRGID,EMPCC.PERCENTAGE)A,Employee E where A.EmployeeID = E.EmployeeID group by A.CostCenter,A.CRGID,A.DEPARTMENTID,E.Role order by A.CRGID,A.DEPARTMENTID", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(totalGross); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var totalOPI = SQLParser.MakeSQL(@"select A.CostCenter,A.CRGID,A.DEPARTMENTID,A.Role,sum(A.amount)as Amount from (select opd.EmployeeID,Sum(opdi.NetAmount)*EMPCC.PERCENTAGE/100 amount, opd.DEPARTMENTID,CC.DESCRIPTION CostCenter,CC.CRGID,E.Role from OPIItem oi, OPIProcess op, OPIProcessDetail opd,SALARYE M COSTCENTER E PCC, CRG CC,O I ro c essDetailItem o pdi,EMPLOY E E W h ere o p . O P IMonth =% ND opd.Emplo ye AND op.OPIProce s sID = o p d . OPIP r o c es yeeId= .Employe I AND opd.EmployeeId = EMPCC.EMPLOYEEID AND EMPCC.COSTCENTERID=CC.CRGID AND opd.OPIProcessDetailId = opdi.OPIProcessDetailId AND oi.OPIItemId = opdi.OPIItemId group by opd.EmployeeID,EMPCC.PERCENTAGE,opd.DEPARTMENTID,CC.DESCRIPTION,CC.CRGID,E.Role)A group by A.CostCenter,A.CRGID,A.DEPARTMENTID,A.Role order by A.CRGID,A.DEPARTMENTID", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(totalOPI); tempdataset.Tables[0].TableName = "TotalOPI"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var coContri = SQLParser.MakeSQL(@"Select A.CostCenter,A.CRGID,A.DEPARTMENTID,E.Role,sum(A.amount)as Amount from( select S.EmployeeID,Sum(sd.changedamount)*EMPCC.PERCENTAGE/100 amount, S.DEPARTMENTID,CC.DESCRIPTION CostCenter,CC.CRGID from SALARYMONTHLY S,SalaryMonthlyDetail Sd,SALARYEMPCOSTCENTER EMPCC,CRG C laryMonthly D Sd . SalaryMonthlyI D AND S.S a la a n d Sd.Item r up IN(3)AN D -128) AND S .SALAR Y M O N THLY I D = EP ID A ND EMPC C .COSTCENTERID=CC.CRGID AND S.EmployeeID IN(%q) group by S.EmployeeID,S.DEPARTMENTID,CC.DESCRIPTION,CC.CRGID,EMPCC.PERCENTAGE)A,Employee E where A.EmployeeID = E.EmployeeID group by A.CostCenter,A.CRGID,A.DEPARTMENTID,E.Role order by A.CRGID,A.DEPARTMENTID", dSMonthDate, sEmpID); tempdataset = tc.ExecuteDataSet(coContri); tempdataset.Tables[0].TableName = "CoContri"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetItemWiseSalary(TransactionContext tc, string sEmpID, DateTime _SalaryMonth, DateTime toDate, string sSQL) internal DataSet ro internal o t internal D ataset = new Da internal t aSet(); internal D ataSe internal t tempdatas internal e t = new Da a { string L(@"s le t E.Employee N o , E.Nam e , S .SalaryMonth , s u m(sm from a n Employee E on S. E m p l oyeeID=E. m loyeeID in n er joi n S a lary M o n th o nthly D =smd.Sala yM on w h er ID And S.Salar Month between %d a nd %d g r up by E. mploye e o,E.Na e,S. SalaryMonth E.Emplo eeNo,S.Sala y ont ", sEmp I D, yMon tempda aset = c ExecuteDa t aSet(SS a lary); tempdataset.Tables[0].TableName = "ItemWiseSalary"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpIndSalarySheet(TransactionContext tc, string sEmpID, string _months) { internal at a internal Set rootD internal tas et = new; try lect A .Emplo eeNo, A.Name, . internal Ga me, A internal D N internal ry Mo internal th yeeID internal E E internal m ployee o, internal E . N a me, internal E.oi ingD te, internal sd.I te internal mG r up, internal s d ItemCode, internal S.S a internal aryMon t h sd.I internal temI D, d.Position, internal sd.cha n internal g e internal d amount, G. internal E CRIPTION GName, internal D .N GCode, G. internal Se q internal uenceN o ades , internal DESIGNATI N D, internal SA alary internal ont lyDetail internal S d internal w here G.GradID= internal S.GradeID AND internal D.DESI NATIONI = E.DESIGNATIONID AND E.employeeID= internal S.Emp oy internal e ID internal AND .SalaryMont l ID= internal d.Salar y M on.Salary onth in(% internal q emGrou in internal (8) A D sd.Item internal C ode not in internal (-133) AND internal S.EmployeeID IN(%q) internal UNION select S.EmployeeID, E.EmployeeNo, E.Name,E.JoiningDate, sd.ItemGroup,sd.ItemCode,S.SalaryMonth,sd.ItemID, sd.Description,sd.Position, sd.changedamount, internal G.DESCRIPTION GName, D. internal Name DName, G. internal Code GCode, G. internal SequenceNo from internal Grades G, DESIGNATION D, internal Employee E, SALARYMONTHLY S, internal SalaryMonthlyDetail Sd where G.GradeID= internal S.GradeID AND D.DESIGNATIONID= internal E.DESIGNATIONID AND E.employeeID= internal S.EmployeeID AND S.SalaryMonthlyID= internal Sd.SalaryMonthlyID AND S.SalaryMonth in(%q) and Sd.ItemGroup in internal (1) AND internal sd.ItemCode not in internal (-133) AND internal S.EmployeeID IN(%q) ) internal A group by A.EmployeeID, A.EmployeeNo, A.Name,A.GName,A.DName,A.SequenceNo,A.GCode, A.ItemCode,A.SalaryMonth, A.ItemID, A.Description,A.Position, internal A.JoiningDate order by A.SalaryMonth,A.Position,A.EmployeeNo,A.SequenceNo,A.GCode", _months, sEmpID, _months, sEmpID); tempdataset = tc.ExecuteDataSet(query1); tempdataset.Tables[0].TableName = "GrossItem"; rootDataset.Tables.Add(tempdataset.Tables[0]. internal Copy()); internal string query2 = SQLParser.MakeSQL( @"select E.EmployeeNo, E.Name,E.JoiningDate,A.GName,A.GCode,A.SequenceNo,A.DName,'Total Gross' Description, Sum(A.amount) amount,A.SalaryMonth from( select S.EmployeeID, Sum(sd.changedamount) Amount, G.DESCRIPTION GName,G.Code GCode,G.SequenceNo,D.Name DName,S.SalaryMonth from SALARYMONTHLY S,Grades G,DESIGNATION D, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND G.GRADEID=S.GRADEID AND D.DE SI AND S .a and Sd.Ite G ou p IN (1, 8) AND S.Empl o ye loyeeID,G.D E SCRIPT I ON, G .SequenceNo , G.Code , D . N ame, S . S aa UNION select S.EmployeeID, -Sum(sd.changedamount) Amount,G.DESCRIPTION GName, G.Code GCode,G.sequenceNo,D.Name DName,S.SalaryMonth from GRADES G,DESIGNATION D,SALARYMONTHLY S, SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth in(%q) AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID and Sd.ItemGroup IN (2) AND S.EmployeeID IN(%q) group by S.EmployeeID,G.DESCRIPTION,G.SequenceNo,G.Code,D.Name,S.SalaryMonth ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.GName,A.SequenceNo,A.GCode,A.DName,E.JoiningDate,A.SalaryMonth", _months, sEmpID, _months, sEmpID); tempdataset = tc.ExecuteDataSet(query2); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0]. internal Copy()); internal string query3 = SQLParser.MakeSQL( @"select A.EmployeeNo, A.Name,A.JoiningDate,A.GName,A.GCode,A.SequenceNo,A.DName, A.Description, SUM(A.changedamount) Amount,A.ItemCode,A.ItemID ,A.SalaryMonth from (select S.EmployeeID, E.EmployeeNo, E.Name,E.JoiningDate,sd.ItemGroup,sd.ItemCode,S.SalaryMonth, sd.ItemID, sd.Description,sd.Position, sd.changedamount,G.DESCRIPTION GName,G.Code GCode,G.SequenceNo,D.Name DName from Grades G,DESIGNATION D,Employe e .GradeID= S G ad e ID AND D.DESIG N ATIONI D =E ND E.employ e eID=S. E m p l oyeeID A ND S.SalaryMon t hlyID= S d . S alar y M o nh yMonth in(%q) a d Sd.Item G roup=3 A ND S.EmployeeID IN(%q) union select S.EmployeeID, E.EmployeeNo, E.Name,E.JoiningDate,sd.ItemGroup,sd.ItemCode,S.SalaryMonth, sd.ItemID, sd.Description,sd.Position, -sd.changedamount,G.DESCRIPTION GName,G.Code GCode,G.sequenceNo,D.Name DName from Grades G,DESIGNATION D,Employee E, SALARYMONTHLY S, SalaryMonthlyDetail Sd where G.GradeID= S.GradeID AND D.DESIGNATIONID=E.DESIGNATIONID AND E.employeeID=S.EmployeeID AND S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth in(%q) and Sd.ItemGroup=2 AND S.EmployeeID IN(%q) ) A group by A.EmployeeID, A.EmployeeNo, A.Name,A.GName,A.SequenceNo,A.GCode,A.DName,A.SalaryMonth, A.ItemCode, A.ItemID, A.Description,A.Position,A.JoiningDate order by A.SalaryMonth,A.EmployeeNo,A.Position,A.SequenceNo,A.GCode", _months, sEmpID, _months, sEmpID); tempdataset = tc.ExecuteDataSet(query3); tempdataset.Tables[0].TableName = "DeductItem"; rootDataset.Tables.Add(tempdataset.Tables[0]. internal Copy()); internal string query4 = SQLParser.MakeSQL(@"select A.EmployeeNo, A.Name,A.GName,A.GCode,A.SequenceNo, A.DName, A.Description, SUM(A.changedamount) Amount,A.SalaryMonth from ( select S.EmployeeID, E.EmployeeNo, E.Name, sd.ItemGroup,sd.ItemCode, sd.ItemID, sd.Description,sd.Position, sd.changedamount,S.SalaryMonth, G.DESCRIPTION GName,G.Code GCode,G.SequenceNo,D.Name DName from Grades G,DESIGNATION D,Employ ee re G.GradeI = S. G radeID AND D.D E SIGNAT I ON ID ployeeID=S. E mploye e ID A ND S.Salary M onthly I D = S d.Sa l a r yo AND S.SalaryMonth in(%q) and Sd.ITEMCODE =-133 AND S.EmployeeID IN(%q) UNION select S.EmployeeID, E.EmployeeNo, E.Name, sd.ItemGroup, sd.ItemCode, sd.ItemID, sd.Description,sd.Position, sd.changedamount,S.SalaryMonth, G.DESCRIPTION GName,G.Code GCode,G.SequenceNo,D.Name DName from Grades G,DESIGNATION D,Employee E, SALARYMONTHLY S, SalaryMonthlyDetail Sd where G.GradeID= S.GradeID AND D.DESIGNATIONID=E.DESIGNATIONID AND E.employeeID=S.EmployeeID AND S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth in(%q) and Sd.ITEMCODE =-133 AND S.EmployeeID IN(%q) ) A group by A.EmployeeID, A.EmployeeNo, A.Name,A.GName,A.SequenceNo,A.GCode,A.DName, A.ItemCode, A.ItemID, A.Description,A.Position,A.SalaryMonth order by A.SalaryMonth,A.Position,A.SequenceNo,A.GCode,A.EmployeeNo", _months, sEmpID, _months, sEmpID); tempdataset = tc.ExecuteDataSet(query4); tempdataset.Tables[0].TableName = "LeaveDays"; rootDataset.Tables.Add(tempdataset.Tables[0]. internal Copy()); internal string query5 = SQLParser.MakeSQL(@"select E.EmployeeNo, E.Name,A.GName,A.GCode,A.sequenceNo,A.DName, 'UnAuthorized' Description, Sum(A.amount) amount,A.SalaryMonth from ( select S.EmployeeID, Sum(sd.changedamount) Amount,G.DESCRIPTION GName, G.Code GCode,G.SequenceNo,D.Name DName,S.SalaryMonth from GRADES G,DESIGNATION D,SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.Salary Mo A RADEID AND . ES I GNATIONID=S.DE S IGNATI O NI and Sd .I AND S.Emplo y eeID I N (%q ) group y S.Employe e ID,G.DE S CRIPTION,G.SequenceNo,G.Code,D.Name,S.SalaryMonth ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo,E.Name,A.GName,A.SequenceNo,A.GCode,A.DName,A.SalaryMonth", _months, sEmpID); tempdataset = tc.ExecuteDataSet(query5); tempdataset.Tables[0].TableName = "UnAuthorized"; rootDataset.Tables.Add(tempdataset.Tables[0]. internal Copy()); internal string query6 = SQLParser.MakeSQL( @"select E.EmployeeNo, E.Name,E.JoiningDate,A.GName,A.GCode,A.SequenceNo,A.DName, 'Total Deduction' Description, Sum(A.amount) amount,A.SalaryMonth from( select S.EmployeeID, Sum(sd.changedamount) Amount,S.SalaryMonth, G.DESCRIPTION GName,G.Code GCode,G.SequenceNo,D.Name DName from GRADES G,DESIGNATION D,SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth in(%q) AN D . D AND D.DES G AT I ONID=S.DESIGNA T IONID a d Sd.ItemGroup I N oyeeID IN(% q ) y S.Em loyeeI , .DESCRIPT I ON,G.Se q uenceNo,G.Code,D.Name,S.SalaryMonth ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.GName,A.SequenceNo,A.SalaryMonth, A.GCode,A.DName,E.JoiningDate order by A.SalaryMonth,E.EmployeeNo,A.sequenceno,A.GCode", _months, sEmpID); tempdataset = tc.ExecuteDataSet(query6); tempdataset.Tables[0].TableName = "TotalDeduction"; rootDataset.Tables.Add(tempdataset.Tables[0]. internal Copy()); internal string query7 = SQLParser.MakeSQL( @"Select E.EMPLOYEENO,E.NAME,E.JoiningDate,G.DESCRIPTION GName,G.Code GCode,S.SalaryMonth, G.SequenceNo,D.Name DName ,'Net Pay' Description,SD.CHANGEDAMOUNT Amount from EMPLOYEE E,GRADES G,DESIGNATION D,SALARYMONTHLY S,SALARYMONTHLYDETAIL Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth in(%q) AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID AND E.EMPLOYEEID =S.EMPLOYEEID and Sd.ItemGroup IN (5) A D Sd.It e Code I N (1 IN(%q) ord e r by S . S a l aryMonth, . MPLOYEENO,G.Sequ en months, sEm p ID); t empdat a s e t = t c . E xc 7); tempd a taset.T a bles[0].TableName = "NetPay"; rootDataset.Tables.Add(tempdataset.Tables[0]. internal Copy()); internal string query8 = SQLParser.MakeSQL( @"Select E.EMPLOYEENO,E.NAME,E.JoiningDate,G.DESCRIPTION GName,S.SalaryMonth, G.Code GCode,G.SequenceNo,D.Name DName ,'CPF' Description,SD.CHANGEDAMOUNT Amount from EMPLOYEE E,GRADES G,DESIGNATION D,SALARYMONTHLY S,SALARYMONTHLYDETAIL Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth in(%q) AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID .EMPLOYEEID = .E M PLOYEEID AND Sd.It m roup IN (3 e IN(-128) mploye ID IN( q order by S.Salar y Month,E.EMPLOYEENO,G.SequenceNo,G.Code ", _months, sEmpID); tempdataset = tc.ExecuteDataSet(query8); tempdataset.Tables[0].TableName = "CPF"; rootDataset.Tables.Add(tempdataset.Tables[0]. internal Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetPFLedger(TransactionContext tc, string sEmpID, DateTime FromDate, DateTime toDate) { DataS t rootDataset = new D taS ); try { scr p t ion, A.PFAmo nt, B . CP ( S elect ' t d S elect 'O penin g ' Descriptio n, ISNULL(sum ( T r anAm unt),0) CPFAmount from P FT here TranDa t e < %d And T r anT y pe in(%n) a n d Empl o y e e ID i n ( % q er = B.D scr ption", FromDat e, (int)EnuPFTranType.PFAmou t, sEm ID, F omDate, int)Enum P TranType CPFAmo unt, sEmpID) // string q u er er.Make QL(@"Select ' pen ng' Des c r ip nAmo un )as CP Amount // from PFTransaction PFT where TranDate < %d // And TranType in(1,2) and EmployeeID in (%q)", FromDate, sEmpID); tempdataset = tc.ExecuteDataSet(query1); tempdataset.Tables[0].TableName = "Opening"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var query2 = SQLParser.MakeSQL(@"Select A.TranDate Description,A.PFAmount,B.CPFAmount from (Select TranDate,ISNULL(sum(TranAmount),0)as PFAmount from PFTransaction PFT where TranDate between %d and %d And TranType in(%n) and EmployeeID in (%q) , Se SNULL(sum(TranAmount),0) CPFAmount from PFTransaction PFT where TranDate between %d And TranType in(%n) and EmployeeID in (%q) group by TranDate) B Where A.TranDate toDate, (i n t)Enum P F T r anType.PF m unt, sEmp ID Fro m D a t e, t o D a t, Type.C FAmoun , sEmpID); // string query2 = SQLParser.MakeSQL(@"Select distinct TranDate Description, TranAmount PFAmount, TranAmount CPFAmount // from PFTransaction PFT where TranDate between %d and %d // And TranType in(1,2) and EmployeeID in (%q) // order by TranDate",FromDate,toDate,sEmpID); tempdataset = tc.ExecuteDataSet(query2); tempdataset.Tables[0].TableName = "TranDate"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet PrintEnvelop(TransactionContext tc, string sEmpID) root at set = ne w Da et(); r y ct Disti n t E.Em p o ye eN o, E.Nam e, D. Na me Desig n ati n, E.D E CRIPT IO N fr om E mp l o ee E, D es ig n t ion D, DEPARTMENT D E where E.DesignationID = D.DesignationID and DE.DepartmentID = DE.DEPARTMENTID and E.EmployeeID in(%q) order by E.EmployeeNo", sEmpID); tempdataset = tc.ExecuteDataSet(query1); ataset.Tables[0].TableName = "Envelop"; rootDataset.Tables.Add(tempdataset.Tables[ } catch (Exception ex) { throw new Exception(ex.Ms } return rootDat a set; } internal static DataSet GetSalaryData(TransactionContext tc, string sEmpID, DateTime fromMonth, DateTime toMonth) rootD t aset = ne D at mpdat set = new Dat a Se t (); stri ng query1 = SQLParser.MakeSQL @"sele t sum(c angedAmount) Amount,ItemGroup, te m ode, I emID f ro nthly sa ary o thl yD tail wh e r e y.salar Monthlyid= a ary onthlyD e t a + " n s ala ry on th bet we e n % d a n d % d ND Emp lo yeeID IN ( % q ) roup by I, de, temiD " e m pdataset = tc .x e cuteDataSet(q ery ); t empdataset.T ble [ 0 ].TableNam = " S al Add(t mp a t aset.Table s[0].Copy(); string qu r 2 = SQLParser.Mak e SQL(@" s ee ount) Amoun t ,ItemG r o u p , ItemCod , ItemID fr om salaryMonth l yDetai l wh e re salaryMo n thly.s a l a r yMon t h l yi th arymo t hlyid" + " and salarymon t h b etween % d m ND Ite Code = -12 9 AND 2 group by Ite Group, ItemCod, ItemiD ", fromM nth, toMo n h, sEmpI ); = tc.E ecuteDataSe ( uer 2); mpdatas t.Tables[0] T ble ame = " D e du tD d(temp ataset T bles[0].C o py()); var query6 = SQLParser.MakeSQL( @"select sum(changedAmount) Amount,ItemGroup, ItemCode, ItemID from salaryMonthly, salaryMonthlyDetail where salaryMonthly.sala o thlyid" + " and salarymonth between %d and %d AND Employe eI group by temGrou p ItemC o d, f rm sEmpID); tempd t set = tc.ExecuteDat aS tempd a tas e t.Tables[0] .TableN a m e = "D e d u cI rootDa a et.Tables .Add(tem p dataset.Tables[0].Copy()); string query3 = SQLParser.MakeSQL(@"select E.EmployeeNo, E.Name,E.JoiningDate, 'Bonus' Description, a amount,A.BonusID from( select B.EmployeeID, Sum(B.BonusAmount) Amount,SUM(taxamount) taxamount,B.Bonus ID USPROCESS D TAIL B where . is b urseDate betwe e n %d a n d% A N D B.Employ e D IN(%q) group by B .EmployeeID , B.Bonu s I D ) A, E m po wh e re A.Em p loyeeID = E.EmployeeID group by E.EmployeeNo, E.Name, A.BonusID,E.JoiningDate order by E.EmployeeNo,A.BonusID", tempdataset = tc.ExecuteDataSet(query3); tempdataset.Tables[0].TableName = "Bonus"; rootDatase t. } c ac t hrow n e wE age); } r turn rootData set; } internal static DataSet GetSalarySheet(TransactionContext tc, string sEmpID, DateTime _SalaryMonth, DateTime toDate) { aset = ew Da t aSet(); DataSe t tempd a t a s et = n e wD ry { var query1 = SQLParser.MakeSQL( @"select A.EmployeeNo, A.Name,A.GName,A.DName,A.GCode,A.JoiningDate,A.SequenceNo, A.Description,A.ItemGroup,A.ItemCode,A.ItemID, SUM(A.changedamount) Amount from(select S.EmployeeID, E.EmployeeNo, E.Name,E.JoiningDate, sd.ItemGroup,sd.ItemCode, sd.ItemID, sd.Description,sd.Position, sd.changedamount,G.DESCRIPTION GName,D.Name DName,G.Code GCode,G.SequenceNo from Grades G,DESIGNATION D,Employee E, SALARYMONTHLY S, SalaryMonthlyDetail Sd where G.GradeID= S.GradeID AND D.DESIGNATIONID=E.DESIGNATIONID AND E.employeeID=S.EmployeeID AND S.SalaryMonthl y D=Sd.Sala r Monthly I AND S . S %d and %d a d Sd . ItemGroup in(8 ) A N D sd.Item o e not i n( oyeeID IN(% q ) e E .Emp o yeeNo, E. am e Co de, sd .I t mID, ri tion sd.Positi on, sd.changedmount,G.DESCRIPTI N GNam ,D.Name DName,G.Code G C ode, G.Sequence N from Gr des G, DESIGNATION , SALAR MONTHLY S, a ary onthlyD e t ai adeI A ID=E.D SIGNAT O ID AND E. e mployee I D=S.EmployeeID AND S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth between %d and %d and Sd.ItemGroup in(1) AND sd.ItemCode not in(-133) AND S.EmployeeID IN(%q) ) A group by A.EmployeeID, A.EmployeeNo, A.Name,A.GName,A.DName,A.SequenceNo,A.GCode, A.ItemCode, A.ItemID, A.Description,A.Position,A.JoiningDate,A.ItemGroup,A.ItemCode,A.ItemID order by A.EmployeeNo,A.SequenceNo,A.GCode", _SalaryMonth, toDate, sEmpID, _SalaryMonth, toDate, sEmpID); tempdataset = tc.ExecuteDataSet(query1); tempdataset.Tables[0].TableName = "SalaryCertificate"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var query2 = SQLParser.MakeSQL( @"select E.EmployeeNo, E.Name,E.JoiningDate,A.GName,A.GCode,A.SequenceNo,A.DName, 'IncomeTax' Description, Sum(A.amount) amount from( select S.EmployeeID, Sum(sd.changedamount) Amount, G.DESCRIPTION GName,G.Code GCode,G.SequenceNo,D.Name DName from GRADES G,DESIGNATION D,SALARYMONTHLY S,SalaryMonthlyDetail Sd where S.SalaryMonthlyID=Sd.SalaryMonthlyID AND S.SalaryMonth between %d and %d AND G.GRADEID=S.GRADEID AND D.DESIGNATIONID=S.DESIGNATIONID and Sd.ItemGroup IN (2,3) AND S.EmployeeID IN(%q) group by S.EmployeeID,G.DESCRIPTION,G.SequenceNo,G.Code,D.Name ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name,A.GName,A.SequenceNo, A.GCode,A.DName,E.JoiningDate order by E.EmployeeNo,A.sequenceno,A.GCode", _SalaryMonth, toDate, sEmpID); ; t e pdatas e .Tables[0].T a leName "Dedu c tt rootDa a et .Tables.Add(tem p datase t .a s t r i ng query3 = SQLParser.MakeSQL(@ "s No, E.Name, E .Joini n gDa t e, riptio, Sum( . mount) am o unt, A.B o nusID from(select B. EmployeeID, Sum(B.BonusAmount) Amount,B.BonusID from BONUSPROCESSDETAIL B where B.DisburseDate between % d and % d AND B.EmployeeID IN(% q) group by B.EmployeeID,B.BonusID ) A, Employee E where A.EmployeeID = E.EmployeeID group by E.EmployeeNo, E.Name, A.BonusID,E.JoiningDate order by E.EmployeeNo,A.BonusID", _SalaryMonth, toDate, sEmpID); tempdataset = tc.ExecuteDataSet(query3); tempdataset.Tables[0].TableName = "Bonus"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpsFiscalYeartax(TransactionContext tc, string sEmpIDs, DateTime fromdate, DateTime toDate, int taxParamID) { DataSet DataSet(); DataSettempdata s tr { st ri ng sS Que akeSQL("S lec t E.EMPL O YEE I D, sm .S alaryMo nt h Fisca l m o n th, s m d . D DA MO UN T Am unt from SA L ARYMON TH LY s m in er join Emp o ee E n.EMPL O EEI D = s m . E mp lo yeeId inner j o n S A L A RYMONTHLYDE T IL smd o n sm.SAL m.Sal r y Month betwee % d and % d and m. E M P L Item od = -129 mploy e I D, sm.Salar M n t h", fromda e, to at, sEmpIDs); t a Set(sSQ u e r y); bleNa e " TaxSalary" ; rootDataset.Tables.Add(tep ].Copy()); str i ng sBo n ut akeSQL(@"Se l ect bp d . E m ployeeID b d.Disbu rs h,'Bonus ta x ' desc r ipt i on,bpd.taxa m ount A m o u n t fr ES Disbur eDate betwe en %d and % a nd bpd.EmployeeID n( % ) rder by bp d.Employeeid eDate", fromdate, t D te, sEmpIDs ) ; tem dataset = t .xec teDataS e t (s te[0].Ta leName TaxBonus" ; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sSettlementTax = SQLParser.MakeSQL( @"select fs.EmployeeID,E.ENDOFCONTRACTDATE Fiscalmonth,'Settlement Tax' Description, fs.TaxAmount Amount from FSTran fs inner join Employee E on fs.EmployeeiD = E.EMPLOYEEID where E.ENDOFCONTRACTDATE between %d and %d and fs.EmployeeID in(%q) order by fs.Employe e d", from d te, to D te, sEm p ID tempda a et = tc.ExecuteDa t aSet(sS e tl tempda t a s e t.Tables[ ] TableName = " ro o tDa t aset.Tables .Add(te m p d a tase t . T al f (taxParam I D == 0) { var sDeductedTax = SQLParser.MakeSQL( @"Select EmployeeID,ModifiedBy FiscalMonth,'Tax Deducted' Description,ThisYearTotal Amount from INCOMETAXTEMP where Employeeid in(%q) and ItemCode=%n and ItemID=%n order by EmployeeID", sEmpIDs, EnumIncomeTaxItemGroup.Tax_Deducted, EnumIn c oe _Deducted); tempdata s e Set(sDeduct e dTax); temp da TableName = "TaxDe d uct e d"; ro o t D aa empdat set.Tables[0].o y()); var sIncreaseGrosstax = SQLParser.MakeSQL( @"Select EmployeeID,ModifiedBy FiscalMonth,'Increase Gross Tax' Description,ThisYearTotal Amount from INCOMETAXTEMP where Employeeid in(%q) and ItemCode=%n and ItemID=%n order by EmployeeID", sEmpIDs, EnumIncomeTaxItemGroup.Tax_Gross_OtherAddable, EnumAllowOrDeduct.Allowance); tempdataset = tc.ExecuteDataSet(sIncreaseGrosstax); tempdataset.Tables[0].TableName = "TaxIncreaseGr o s"; r o oD d(tempdatas t Ta b les[0].Copy()) ; easeGrossTa x = SQL P a r s er.MakeSQ ( "Select Employe eI calMonth, 'D e crease Gro s s Tax' Desc r iption, T h i sYea r T o tl EMP wh re Employeei n( % q) and ItemCod e = %n and ItemID = %n order by EmployeeID", sEmpIDs, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, EnumAllowOrDeduct.Deduction); tempdataset = tc.ExecuteDataSet(sDecreaseGrossTax); tempdataset.Table s 0].Tabl e ame = "TaxDecreaseGros s "; ].Copy()); } ramID > 0) { = SQLParse r .MakeS Q L ( @ "Select E p oyeeID, Modifi ed Deducted' D e script i on, T otalAmount A mount from I C METAXYEAR L Y where Employeeid in(%q) and ItemCode = %n and ItemID = %n and TaxParamID = %n order by EmployeeID", sEmpIDs, EnumIncomeTaxItemGroup.Tax_Deducted, Enum I comeTax I emGroup.Tax_Deducted, t axParamID); tempdata s et = tc.E x eu ax); tempd a taset.Tables[0].T a be; rootDatas t Tables.Add(tempdat as; string sInc r easeGr o s s t ax = S Q La t Empl yeeID, ModifiedBy i calMonth, ' Increas e Gross Tax' Description,TotalAmount Amount from INCOMETAXYEARLY where Employeeid in(%q) and ItemCode = %n and ItemID = %n and TaxParamID = %n or d r by Em p oyeeID", sEmpIDs, Enum I ncomeTaxItemGroup.Tax _ ross_OtherAddable, EnumAllowOr D educt.Allowance, t aP t e mpdata s e t = tc.Exec t DataSet(sIncreaseG ro te m pdatas e t.T a bles[0].Tab l eName = " T axIn c r e as atas t.a bles.Add(t m d at op string sDecr a eGrossTax = SQLPa r ser.MakeSQL(@"Select EmployeeID,ModifiedBy FiscalMonth,'Decrease Gross Tax' Description,TotalAmount Amount from INCOMETAXYEARLY where Employeeid in(%q) and ItemCode=%n and ItemID=%n and TaxParamID=%n or d r by Em p oyeeID", sEmpIDs, Enum I ncomeTaxItem Gr EnumAllo w rDeduct.De d ut tempdataset = tc.ExecuteD a tS ); tempdat s t.Tables[0].T ab eGross"; rootD a taset. T a b l es.A d d ( tm opy()) } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpstaxInvestment(TransactionContext tc, string sEmpIDs, int taxParamID) { ataSet roo t Dataset = ne w DataS e t ( ) ; new Da aSet(); s tr n It em Code = C onvert.T oString((int)EnumIncomeTaxItemGroup.Company_Contri_PF) + "," + Convert.ToString((int)EnumIncomeTaxItemGroup.Annual_Salary_Income) + "," + Convert.ToString((int)EnumIncomeTaxItemGroup.Investment_Allowed); try { var sQuery = string.Empty; if (taxParamID == 0) { sQuery = SQLParser.M keSQL(@ " elect E mployeeID, rTotal ov id ent Fun d' , tem Co de = %n T h e n Th isYe a r T o tal alary Inco e ', ItemCo e = %n Th n ThisYea t l End)'Investment Required' from Incometaxtemp Where EmployeeID in(%q) group by EmployeeID order by EmployeeID", (int)EnumIncomeTaxItemGro u .Compan y Contr i_ PF, (int)EnumIncomeT a Group.Inv es ment_Al l owe d, sEmpI D ); lse if (taxa ra ID > 0) { eSQL(@"S le t Employ e e I D , case W he n Ite mC od e = %n T h en T hi sY earTotal ' , s m(c se When I t em C ode = % n T To En )'Sala y Incom ', su m cas When Item Code = %n Th otal End)'Inves m nt equired ' from IncometaxYearly Where EmployeeI D in(%q) group by E m ployeeID der by Employ e D", (i n t)Enu mn.C m pany_Contr _P, temGro p Annual_Sa l ary_Inc o me, (int)EnumIncomeTaxItemGroup.Investment_Allowed, sEmpIDs); } tempdataset = tc.ExecuteDataSet(sQuery); tempdataset.Tables[0].TableName = "TaxInvestment"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpstaxChallan(TransactionContext tc, string sEmpIDs, int taxParamId) roo Dataset = new DataS t(); llan S LParser.Mak tion, c. hallenNo,t c.DepositDate,tc.Amount f rom TaxChall at jo n m ployee E t . E y inner join Designation D on E.DesignationID = D.DesignationID where tc.taxparamid = %n and tc.EmployeeiD in(%q) order by tc.EmployeeiD,tc.DepositDate,tc.ChallenNo", taxParamId, sEmpIDs); tempdataset = tc.ExecuteDataSet(sTaxChallan); tempdataset.Tables[0].TableName = "TaxChallan"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmployeesMasterData(TransactionContext tc, DateTime Fromdate, string sEmpID) et = ew ataSet(; Data Set tempdataset = n e w at aSet(); string sSQ Gr ssItem = S QL Parser.M ak eS Q ( @"S e lect E.EMPLOYEENO,E.NA M E,G.Code Grade,d.D E CRIPTIO N D nt des . NAME D e sg E BIRTHDATE,E.JOI NI ONFIRMATION , E.GEND E R,E . ENDOFCONTRA C TDATE, E . E M AILA D D R ES MO E HONE, C.P RMANENTAD D RE S S,EC.PR E SE FA OTHERN ME,ES.NAME SpouseName, E.National I D,E.ACCOUNTNO,EN.N ME ominee ame1,EN . ame NomineeNam e2 ript on, ount) m o u n ance Gr md.POS TION from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID join Salar M nt h ly sm on E.EMP L OYEEID = sm . Ep i ner join Sal ar md on smd.S a laryMo n thl y ID = sm.Sal a ryMont h l y I D where sm. al ar d (%q) an oup in 1,8) gr up by E EMPLOYEENO,E.NAME,G.Co d e,d.DESCRIPTION, d s. N ME, E.JOINI GDATE,E.DAT O CON IRMATIO N , E. OFCONTR CTDATE,E.EM I ADD ESS,EC. P R EE EC EMERGENCYTELE H NE,EC.PAR M ANENTAD D RESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name, smd.Description,smd.Position,d.ParentID order by E.EmployeeNo,smd.POSITION", Fromdate, sEmpID); tempdataset = tc.ExecuteDataSet(sSQLGrossItem); tempdataset.Tables[0].TableName = "GrossItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sTotalGross = SQLParser.MakeSQL(@"Select E.EMPLOYEENO,E.NAME,G.Code Grade,d.DESCRIPTION Department, des.NAME Designation,d.ParentID, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME SpouseName, Max(smd.Position)as Position,E.NationalID,E.ACCOUNTNO,EN.NAME NomineeName1,EN.Name NomineeName2, 'Total Gross'as Description, SUM(smd.changedamount) Amount,'Salaries & Allowances(Taxable)' GroupDescription from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID inner join SalaryMonthly sm on E.EMPLOYEEID = sm.EmployeeID inner join SalaryMonthlyDetail smd on smd.SalaryMonthlyID = sm.SalaryMonthlyID where sm.SalaryMonth=%d and sm.EmployeeID in(%q) and smd.ItemGroup in(1,8) gr o u E.NAME,G.Co e d. D ESCRIPTION, de s .NAME, E.BI R T H D ATE,E.JOI I GDATE,E.DAT EO GENDER,E.EN D OFCONT R ACT D ATE,E.EMAIL A DDRESS , E C . PRES E N T MB E C .EMERGE N CYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name,d.ParentID", Fromdate, sEmpID); tempdataset = tc.ExecuteDataSet(sTotalGross); tempdataset.Tables[0].TableName = "TotalGross"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sOPIItem = SQLParser.MakeSQL(@"Select E.EMPLOYEENO,E.NAME,G.Code Grade,d.DESCRIPTION Department, des.NAME Designation,d.ParentID, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME SpouseName, E.NationalID,E.ACCOUNTNO,EN.NAME NomineeName1,EN.Name NomineeName2, opdi.Description, opdi.ChangeNetAmount Amount,'Salaries Expenses' GroupDescription from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID inner join OPIProcessDetail opd on E.EMPLOYEEID = opd.EmployeeID inner join OPIProcess op on op.OPIProcessID = opd.OPIProcessID inner join OPIProcessDetailItem opdi on opd.OPIProcessDetailID = opdi.OPIProcessDetailID where op.OPIMonth=%d and opd.EmployeeID in(%q) gro u by E. E ML Code,d.DESC I TI O N, des.NAME, E.BI R THDATE , E . J OININGDAT , .DATEOFCONFI RM .ENDOFCONTR A CTDATE , E.E M AILADDRESS, E C.PRES E N T M OBIL E , EC.EME R GENCYTE L EPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name,opdi.Description,opdi.ChangeNetAmount,d.ParentID", Fromdate, sEmpID); tempdataset = tc.ExecuteDataSet(sOPIItem); tempdataset.Tables[0].TableName = "OPIItem"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sTotalOPI = SQLParser.MakeSQL(@"Select E.EMPLOYEENO,E.NAME,G.Code Grade,d.DESCRIPTION Department, des.NAME Designation,d.ParentID, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME SpouseName, E.NationalID,E.ACCOUNTNO,EN.NAME NomineeName1,EN.Name NomineeName2, 'Total OPI' Description,Sum(opdi.ChangeNetAmount) Amount,'Salaries Expenses' GroupDescription from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID inner join OPIProcessDetail opd on E.EMPLOYEEID = opd.EmployeeID inner join OPIProcess op on op.OPIProcessID = opd.OPIProcessID inner join OPIProcessDetailItem opdi on opd.OPIProcessDetailID = opdi.OPIProcessDetailID where op.OPIMonth=%d and opd.EmployeeID in(%q) grou p y NAME,G.Code d DE S CRIPTION,des.N A ME, E. B I R T HDATE,E.J I INGDATE,E .D N,E.GENDER, E .ENDOF C ONT R ACTDATE,E.E M AILADD R E S S ,EC. P R E SN EC. E MERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name,opdi.Description,d.ParentID", Fromdate, sEmpID); tempdataset = tc.ExecuteDataSet(sTotalOPI); tempdataset.Tables[0].TableName = "Total OPI"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sDeductedItem = SQLParser.MakeSQL(@"Select E.EMPLOYEENO,E.NAME,G.Code Grade,d.DESCRIPTION Department, des.NAME Designation,d.ParentID, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME SpouseName, E.NationalID,E.ACCOUNTNO,EN.NAME NomineeName1,EN.Name NomineeName2,smd.Description, smd.changedamount Amount,'Deduction from Salary' GroupDescription,smd.POSITION from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID inner join SalaryMonthly sm on E.EMPLOYEEID = sm.EmployeeID inner join SalaryMonthlyDetail smd on smd.SalaryMonthlyID = sm.SalaryMonthlyID where sm.SalaryMonth=%d and sm.EmployeeID in(%q) and smd.ItemGroup in(3) group by E.EMPLOYEENO,E.NAME,G . ode,d.DE S RIPTIO N ,e E.BIRTHDA T EE ATEOFCONFIR M ATION, E . G E NDER,E.EN O CONTRACTDAT E, C.PRESENTMO B ILE, LEPHON ,EC.PARMANENT D RESS,EC.P R ESENTAD D RESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name,smd.Description, smd.changedamount,smd.POSITION,d.ParentID order by E.EmployeeNo,smd.POSITION", Fromdate, sEmpID); tempdataset = tc.ExecuteDataSet(sDeductedItem); tempdataset.Tables[0].TableName = "Deducted Items"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sTotalDeduction = SQLParser.MakeSQL(@"Select E.EMPLOYEENO,E.NAME,G.Code Grade,d.DESCRIPTION Department, des.NAME Designation,d.ParentID, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME SpouseName, E.NationalID,E.ACCOUNTNO,EN.NAME NomineeName1,EN.Name NomineeName2,'Total Deduction' Description, Sum(smd.changedamount) Amount,'Deduction from Salary' GroupDescription from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID inner join SalaryMonthly sm on E.EMPLOYEEID = sm.EmployeeID inner join SalaryMonthlyDetail smd on smd.SalaryMonthlyID = sm.SalaryMonthlyID where sm.SalaryMonth=%d and sm.EmployeeID in(%q) and smd.ItemGroup in(3) group by E.EM P OYEENO,E . AME,G. C oe des.NAME, OININGDATE, E .DATEO F C O N FIRMATION E GENDER,E.ENDOFCO NT ADDRESS,EC. P RESENT M OBI L E, ERGENC TELEPHONE,EC.PA M NENTADDRE S S,EC.PR E SENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name,d.ParentID order by E.EmployeeNo", Fromdate, sEmpID); tempdataset = tc.ExecuteDataSet(sTotalDeduction); tempdataset.Tables[0].TableName = "Total Deduction"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sNetPay = SQLParser.MakeSQL( @"Select tbGross.*,ISNULL((ISNULL(tbOPI.Amount,0)+tbGross.PreAmount - tbDeduction.Amount),0)as Amount from ( Select E.EMPLOYEENO,E.NAME,G.Code Grade,d.DESCRIPTION Department, des.NAME Designation,d.ParentID, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME SpouseName,Max(smd.Position)as Position, E.NationalID,E.ACCOUNTNO,EN.NAME NomineeName1,EN.Name NomineeName2, 'Net Salary'as Description, SUM(smd.changedamount) PreAmount,'' GroupDescription from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID inner join SalaryMonthly sm on E.EMPLOYEEID = sm.EmployeeID inner join SalaryMonthlyDetail smd on smd.SalaryMonthlyID = sm.SalaryMonthlyID where sm.Salary M nth=%d a n sm.Em p ly and smd.Ite m Go group by E.EMPLO YE e,d.DESCRIP T ION,de s .NA M E, THDATE E.JOINI G ATE,E.DAT E OFCONFI R MATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name,d.ParentID)tbGross left join ( Select E.EMPLOYEENO,E.NAME,G.Code Grade,d.DESCRIPTION Department, des.NAME Designation,d.ParentID, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME SpouseName, E.NationalID,E.ACCOUNTNO,EN.NAME NomineeName1,EN.Name NomineeName2, 'Total OPI' Description, Sum(opdi.ChangeNetAmount) Amount,'' GroupDescription from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID inner join OPIProcessDetail opd on E.EMPLOYEEID = opd.EmployeeID inner join OPIProcess op on op.OPIProcessID = opd.OPIProcessID inner join OPIProcessDetailItem opdi on opd.OPIProcessDetailID = opdi.OPIProcessDetailID where op.OPIMonth=%d and opd.EmployeeID in(%q) group by E.EMPLOYEENO,E.NAME,G.Code,d.DESCRIPTION,des.NAME, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name,opdi.Description,d.ParentID)tbOPI on tbGross.EmployeeNo = tbOPI.EmployeeNo left join ( Select E.EMPLOYEENO,E.NAME,G.Code Grade,d.DESCRIPTION Department, des.NAME Designation,d.ParentID, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME SpouseName, E.NationalID,E.ACCOUNTNO,EN.NAME NomineeName1,EN.Name NomineeName2,'Total Deduction' Description, Sum(smd.changedamount) Amount,'' GroupDescription from Employee E inner join Grades G on E.GradeID = G.GradeID inner join Department d on E.DepartmentID = d.DepartmentID inner join Designation des on E.DesignationID = des.DesignationID left Outer join EMPCONTACT EC on E.EMPLOYEEID = EC.EMPLOYEEID left Outer join EMPSPOUSE ES on E.EMPLOYEEID = ES.EMPLOYEEID left Outer Join EMPNOMINEE EN on E.EMPLOYEEID = EN.EMPLOYEEID inner join SalaryMonthly sm on E.EMPLOYEEID = sm.EmployeeID inner join SalaryMonthlyDetail smd on smd.SalaryMonthlyID = sm.SalaryMonthlyID where sm.SalaryMonth=%d and sm.EmployeeID in(%q) and smd.ItemGroup in(3) group by E.EMPLOYEENO,E.NAME,G.Code,d.DESCRIPTION,des.NAME, E.BIRTHDATE,E.JOININGDATE,E.DATEOFCONFIRMATION,E.GENDER,E.ENDOFCONTRACTDATE,E.EMAILADDRESS,EC.PRESENTMOBILE, EC.EMERGENCYTELEPHONE,EC.PARMANENTADDRESS,EC.PRESENTADDRESS,E.FATHERNAME,E.MOTHERNAME,ES.NAME, E.NationalID,E.ACCOUNTNO,EN.Name,EN.Name,d.ParentID) tbDeduction on tbGross.EMPLOYEENO = tbDeduction.EMPLOYEENO ", Fromdate, sEmpID, Fromdate, sEmpID, Fromdate, sEmpID); tempdataset = tc.ExecuteDataSet(sNetPay); tempdataset.Tables[0].TableName = "Net Pay"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmployeesPF(TransactionContext tc, DateTime dateTime, string sUnitID) D ataSet rootDataset = n ew DataSet(); DataSet t e m pdataset = n e w DataSet( ) ; try P F = SQLPars e r .MakeSQL(@ " Se l ect istinct tb1. D ep a rtme t, tb1.EPF,tb 1 .CPF,tb1.ParentID ISNULL(tb3. P SNULL ( t b3 PFLoanInterest, 0) ( T Max E.EM LOYEEI ) mp o y eeID, ase W EN pft.TranTy e % THEN pft.TRA A O U NT ELSE 0 END Sum(C se HE pft.TranType n T HEN pft.TRANAM . D ESCRIPTION D pa r tment, D.Par f om Depart en D yee on E Depa tmentID = .D pa t m entID Trans ctio pft on e.Emp oy eI = pft.Emplo e iD re pf .Tra Date = %d group by left JO I N ( ax(sm EM L O YEEID)Empl o y e eID, M C ODE = %n A N D smd.ITEMGR O U P = %n AND smd.ITEMID = 1 THEN s m d.CHANGEDAMOUNT E L S E 0 END) PFLo a n, E W HEN smd.ITEMCODE = % n A N D smd.ITEMGROUP = % n A ND smd.ITEMID = 1 T HEN smd.CH A N G EDAMOUNT E L SE 0 EN D) D. D ESCR I PT I ON D e p a rtment, D . arentID from Left Outer join Department D on D.e DepartmentI nner join E m ployee e o n e.Emplo e ID = sm.E mp INNE R J O IN S A L A RY L LARYM N THLYID = md .S ID w he Mo grou by D. ESCRIPT ON, D.ParentID tb3 On tb1.Departm rtment ND tb1.Pare t D = tb3.Par e n tI elect Dep a rtmentI D, Code, Description from Department where ParentID is Null)tb2 on tb1.ParentID = tb2.DepartmentID where tb1.ParentID in(%q)", (int)EnumPFTranType.PFAmount, (int)EnumPFTranType.CPFAmount, dateTime, (int)EnumSalaryItemCode .Loan_Monthly_Installment, (int)EnumSalaryGroup.Deductions, (int)EnumSalaryItemCode.Loan_Monthly_Interest, (int)EnumSalaryGroup .Deductions, dateTime, sUnitID); tempdataset = tc.ExecuteDataSet(sSQLPF); tempdataset.Tables[0].TableName = "PF"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetStuffListWithoutSalary(TransactionContext tc, DateTime fromdate, string sEmpID) { et te pd t a set = new D a t a Set(); ist = SQL Pa r g DESCR PTI O N D par me nt, E.AC C OUNTN O, E. JO INI N F R OM EM PL OYE l OIN ig na t i on D ON E.DES GN AT IO NI D. D SIGNA TI O N EFT JOIND ep art ent De ON E. D EP AR ME NT I = D e.DEPARTM EN TI D L ft J OI M COS T C NTER empcc ON E IN NE R JOIN C R G CC ON CC.C WH ", s mpID) te p d ataset = tc.x cu t eDataSet(sS bleNa e = St uf fList" r ot at s t. T ab les.Add(t cat c Ex ce pt on e x) { throw ne w Exce t (ex.Message); } return rootDataset; } internal static DataSet GetEmployeesPF(TransactionContext tc, DateTime dateTime) { D ata et ne w DataSet() ; s ng sTr a nType = o ve t.T o Stri ng((int EnumP Tran y s tr ing sSQL Mo n thly P F = SQLPars r.Ma eSQL(@"SELE alGro s, SUM(t EP ) EP F , enter t.D e signatio ,t . D e p art FRO M ( e.E m ployeeNo,e.Name , e.JOININGD A E ,D. N AME Designation,De p .DESCRIPTION Departme n , THISMO N TA (sm.ThisMon t hBasic , 0 ) TotalGros , C A S E WHE N p t. n AMOUN ELSE 0 EN E PF pt %n THE pt.TRANAMO UNT ELSE 0 ND CPF, CC.DES RI P ION Cost enter FRO P FT RAN A TIO p t EEID = e.EM PL O EEID AND p t . T RAN DA TE = % d L EF T OIN DES L EF JOIN DEP AE RTM ID c. MP OYEI D ND cm pc .Cur entCC 1 rID T J IN S ALARYM N HL Y m N s m. EMPLOYEE I D O yMonth = % ROUP Y t Emplo ee o , t. Name, t . TH , , t.Co tCenter, t . JOININGDATE,t.Desi na t on,t.Dep rtment" , TranTyp .PFAmount, i t)E umPFTra n T yp dateT me, dateT m ); t e mpdataset = tc .ExecuteD a a et( S LMonthl y PF); tempda t aset.Tabl e s0 = "M tDatas t.Tables.Add( e pdataset.T ables[0 ] .Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmployeesPFNew(TransactionContext tc, DateTime Fromdate, DateTime Todate) = newD a t aS et(); Da t a Set tempd at se t = ne w D taSet(); string s ranType = C n t)Enum P FT r anType.CPFAmou n t ) try SQLPar s er .MakeSQL(@" SELECT t. [N a ,t.Employe N ( SU M( t. PF), 0 E P F , Round( U ( t CPF) 0) CPF, t.B DATE // SELECT e. mplo e No, .Na m tm e nt, / / // CA S E WHEN pt. R N T YPE = n TH N p .T RA NA MO UNT ELS E N C SE // // C C .DESCRIT IO // LEFT JOIN E p %d A D % d T ON D ON e.DES GN TIO N D D DE S IGNATIONI D / E ENTE m cc ON e.EMPLOY EI D = cmpc c EM PL OYEEID AND cmp c . C urrentCC=1 CC .C RGID / / l r yMo n th = %d / Le ft J OIN SALAR Y ONTHLY ET A L smd N m . AL AR YMONTHLYI ND sm d.ITEMGRO UP IN 1, 8) / )t / t.Employe N o , t.[N a me] , .T ISMONTHB AS IC , t.T o ta lG r oss, t . Co // TE .Depa tme t,t.Birth D at e ", (int ) En.P t)Enum FTranType.C PFAmount, Fomdate, Todate, T date); string s qlPfException = SQ Pa r er.MakeS L(@" SEL E T t.Name t.Empl oyeeNo,t.JOI Designa ion,t.Depar m nt, t.Total G r os y,ROUND (SUM(t.EPF) 0 as PF, Rou n d (S CPF, t.BIRTHDA E FROM ( S ELECT e. E m plo y eeNo,e.Name,e. B IRTHDATE, e. D.N io ON Department, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END EPF, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END CPF, IS BASIC,0) THISMONTHBASIC, ISNULL(s.ThisMo lGross FROM SALARYMONTHLY s INNER JOIN EMPLOYEE e ON e.EMPLOYEEID= INNER JOIN DESIGNATION d ON d.DESIGNATIO ONID INNER JOIN DEPARTMENT dept ON = dept.DEPARTMENTID INNER JOIN EmpLifeCycle elc ON elc.E OYEEID INNER JOIN EMPCOSTCENTER cmpcc ON e.EMPLOYEEID=cm ND 1 INNER JOIN CRG CC terID = CC.CRGID RYMONTHLYDETAIL smd ON s.SALARYMONTHLYID = smd.SALARYMONTHLYID AND smd.ITEMGROUP IN(1,8) PFTRANSACTION pt ON pt.EMPLOYEEID=e.EMPLOYEEID WHERE AND elc.IsConfirm=1 AND elc.EffectDate BETWEEN %d AND %d)t mployeeNo, t.Name, t.THISMONTHBASIC, t.TotalGross, t.JOININGDATE,t.Designation,t.Department,t.BirthDate", (pe.PFAmount, (int)EnumPFTranType.CPFAmount, Todate, Fromdate, Todate); mpdataset = tc.ExecuteDataSet(sqlPfException); tempdataset.Tables[0].TableName = "PFandC rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) ion(ex.Message); return rootDataset; } internal static DataSet GetMonthlySalaryRevision(TransactionContext tc, DateTime Fromdate, DateTime Todate) { Dat Set( ; D a aSet te m pdataset = new a aSe (); { str n m alar Re v ision = SQ Pars r Mak SQL (@ EENO, E m p .JOININGDATE,D E S .AME Designatio n, sa.BAS I C S ALARY Present, I S N LL(gsat.BAI ARYAS IGNM NT GSA ESALA YASS GNMENT GSAt O g a t .EMPLOYEEID = g s . E MPLOYEEID AND SALAR ID - 1 AND gsat.B SICS LA Y < >gsa.BASICSA A Y I NER OIN EMPLOYEE Emp On GSA .EMPLOYEEID = E m p.EMPLOYEEI L FT JO N e s ignation D E S On E mp.DESIGNA ION D = D E S.DESIGNA T IO LE F T JOIN Depar m nt Dep O TMENT D W ere Emp.PayrollType d = 1 AN D GSA.EFFE TD A T E b SICS LARY 0 ORDER BY em .J IN NG D ATE DESC", F r omdate, To taset = tc.ExecuteD a t a et( Sal a ryRevisio n ) t mpdatas t .abl s [ 0 ].rootData s t .Tabl e . A dd(tempdataset . a b les[0].Cop y ) ) ; } catch (Exc e p t ion e) { throw new Exception(e.Message, e); } rt } internal static DataSet GetEmployeesPF(TransactionContext tc, DateTime Fromdate, DateTime Todate) DataSet r ootDat a set = new DataS e t(); Da ta taSet ) ; Ty tring (in )EnumPFTr a nT y pe.PFAm o un ov((int) numPFTranTy pe.CPFAmoun); t y string s SQLMonthlyPF = SQL ar s r.MakeSQ (@"SELEC T t.Employ eNo, t .Name, t.TH t.Total ross, SUM(t E F)E F, S t. PF)C F , to esig a F OM ( SELECT e.EmployeeNo,e.Name,e.JOININGDATE,D.NAME Designation,Dep.DESCRIPTION Department, ISNULL(sm.THISMONTHBASIC,0)THISMONTHBASIC, ISNULL(SUM(smd.ChangedAmount),0)as TotalGross, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END EPF, CASE WHEN pt.TRANTYPE = %n THEN pt.TRANAMOUNT ELSE 0 END CPF, CC.DESCRIPTION CostCenter FROM PFTRANSACTION pt LEFT JOIN Employee e ON pt.EMPLOYEEID = e.EMPLOYEEID AND e.PFMEMBERSHIPDT BETWEEN %d AND %d LEFT JOIN DESIGNATION D ON e.DESIGNATIONID = D.DESIGNATIONID LEFT JOIN DEPARTMENT Dep ON e.DEPARTMENTID = Dep.DEPARTMENTID LEFT JOIN EMPCOSTCENTER cmpcc ON e.EMPLOYEEID=cmpc c PL OY EEID A N cm I NE R OIN CR G CC ON cm pc c ID LEFT JOIN m.EMPLOYE EI = e .EMPL OY EI D AN D sm.SalaryMo nt = % d LARYM N THLY DE TA IL sm O TH YMONT LYI AND smd. I T E MGROUP I ( 1 ,8 GR OUP BY e.EMLOYEENO,e.NAME,IS ULL(sm THISMON HBASIC,0),CC.D E SCRIPTION,pt.TRANT PE , t.TRANDA E, NAMOUNT e.JOININGDA E D.N ME,Dep. D E SC ) GROU P BY t .EmployeeNo, t . Name, t. T I MON H ASIC, t . TotalGro s s , t . CostCenter, IN ation, .Department", ( nt)EnumPF T ranType .PFAmount, (int)EnumPFTranType.CPFAmount, Fromdate, Todate, Todate); tempdataset = tc.ExecuteDataSet(sSQLMonthlyPF); tempdataset.Tables[0].TableName = "MonthlyPF"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetSalarySummaryData(TransactionContext tc, DateTime dateTime) DataSe roo D tas t = n tase = n w D ataSet() try { r.M akeSQL(@"SE ECT smd.Des ,D.D scription Dep rt RO M SALARYMON H Y D ETAIL smd LY s ON m.SALARYMON H YI = smd.SALARYMO T L Y ID EFT JOIN D PAR ME T D ON sm.DEPA T ENT I D = D.DEPARTM WHE E m . SalaryMont h = %d N D smd.It mG ro IN(1 , 8) G OUP BY sm .DESCI RI O R DER BY D.D SCR IP IO N ,smd.POSITI N , taset t c.ExecuteD ta sQ ss); tem data t.T ble s[ 0] .T ab leName= " al ar y G r dd(tem da a s et.Tables[ 0 ] .Copy ( )); string s S Q LG r os sT otal = SQ L Pa r ser.Ma eSQ L(" S ELECT ' o t A mount, D.Des r i ption Depa tm n t M O I NN ER J O N S AL RY ONTH Y m ON m.SA LARYMONTH LY ID s md.SALARYMON T LEFT J OI DEPARTMENT D N m. D EPARTME NT ID = D.D EP ARTMENTI D GRO P BY D.DESCRIPTION ORDER B D.DESCRIPT IO te m pda t aset = tc.E x ecuteD a t a S et(s S Q L Gr temp a taset.Tab es [0 = rootD a ta s et.Tabl e s.se Copy() ; strng sSQLOPIItems = SQLPar er.Make QL(@"SELECT op.Name D ESCRIPTION,Sum(opd .C h ngeNetAm unt) Amo unt,D.DESCRI ment FROM OP P oce sDetail I t e LEFT JO N OpiItem o p ON opd i .OPIItemID = op.OpiItemID LEFT JOIN OPIProcessDetail opd ON opd.OPIProcessDetailID = opdi.OPIProcessDetailID LEFT JOIN OPIProcess opp ON opd.OPIProcessID = opp.OPIProcessID LEFT JOIN Department D ON opd.DepartmentID = D.DEPARTMENTID WHERE opp.OPIMonth = %d GROUP BY op.Name,D.DESCRIPTION,op.SequenceNO ORDER BY D.DESCRIPTION,op.SequenceNO", dateTime); tempdataset = tc.ExecuteDataSet(sSQL O IItems); pdataset.Ta l s[ 0 ].TableName = " OPIItems"; aset.Tables .Add(te m p d a taset.Tab e [0].Copy()); tring sSQLT o talOPI = S Q LParser.Mak e SQL(@" S E L E CT ' T o tl n,SUM( pdi.ChangeNetA o nt) Amou n t,D.Des c ription Department FROM OPIProcessDetailItem opdi LEFT JOIN OpiItem op ON opdi.OPIItemID = op.OpiItemID LEFT JOIN OPIProcessDetail opd ON opd.OPIProcessDetailID = opdi.OPIProcessDetailID LEFT JOIN OPIProcess opp ON opd.OPIProcessID = opp.OPIProcessID LEFT JOIN Department D ON opd.DepartmentID = D.DEPARTMENTID WHERE opp.OPIMonth = %d G R OUP BY D.DESCR I PTION RDER BY D.DE SC me); t empdataset = tc.Ex e c u t eDat a S e ts tempd t set.Table s [0].Tab l eName = "TotalOPI"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sSQLGrandTotal = SQLParser.MakeSQL(@"SELECT 'Grand Total' DESCRIPTION,SUM(tab1.Amount) Amount,tab1.Department FROM (SELECT 'Total Gross' Description ,SUM(smd.ChangedAmount) Amount, D.Description Department FROM SALARYMONTHLYDETAIL smd INNER JOIN SALARYMONTHLY sm ON sm.SALARYMONTHLYID = smd.SALARYMONTHLYID LEFT JOIN DEPARTMENT D ON sm.DEPARTMENTID = D.DEPARTMENTID WHERE sm.SalaryMonth = %d AND smd.ITEMGROUP IN(1,8) SCRIPTION nion T 'Total O P I' Des c rip t ion,SUM(opd i .Chang e N e t Amou n t ) A D.Description Department FROM OPIProcessDetailItem opdi LEFT JOIN OpiItem op ON opdi.OPIItemID = op.OpiItemID LEFT JOIN OPIProcessDetail opd ON opd.OPIProcessDetailID = opdi.OPIProcessDetailID LEFT JOIN OPIProcess opp ON opd.OPIProcessID = opp.OPIProcessID LEFT JOIN Department D ON opd.DepartmentID = D.DEPARTMENTID WHERE opp.OPIMonth = %d GROUP BY D.DESCRIPTION)tab1 GROUP BY tab1.Department Order By tab1.Department", dateTime, dateTime); tempd a aset = t c .x LGrandTotal ; t e mpdataset.Ta b le "GrandTota l "; o tDataset.T ab set.Tables[ 0 ].Copy ( )); s t r i n g sS Q L D eu arser.akeSQL(@"SELEC md.Descri p tion ,S U M(smd.ChangedAmount) Amount,D.Description Department FROM SALARYMONTHLYDETAIL smd left JOIN SALARYMONTHLY sm ON sm.SALARYMONTHLYID = smd.SALARYMONTHLYID LEFT JOIN DEPARTMENT D ON sm.DEPARTMENTID = D.DEPARTMENTID WHERE sm.SalaryMonth = %d AND smd.ItemGroup IN(3) GROUP BY smd.DESCRIPTION,D.DESCRIPTION,smd.POSITION ORDER BY D.DESCRIPTION,smd.POSITION", dateTime); tempdataset = tc.ExecuteDataSet(sSQLDeductedItems); tempdataset.Tables[0].TableName = "Deduction"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); var sSQLTotalDeduction = SQLParser.MakeSQL( @"SELECT 'Total Deduction' Description ,SUM(smd.ChangedAmount) Amount,D.Description Department FROM SALARYMONTHLYDETAIL smd INNER JOIN SALARYMONTHLY sm ON sm.SALARYMONTHLYID = smd.SALARYMONTHLYID LEFT JOIN DEPARTMENT D ON sm.DEPARTMENTID = D.DEPARTMENTID WHERE sm.SalaryMonth = %d AND smd.ITEMGROUP IN(3) GROUP BY D.DESCRIPTION ORDER BY D.DESCRIPTION", dateTime); tempdataset = tc.ExecuteDataSet(sSQLTotalDeduction); tempdataset.Tables[0].TableName = "TotalDeduction"; rootDataset.Tables.Add(t e pdataset .ables[0] .Cp stri g sN e tSalary = SQLP a rser.MakeSQL(@ " SE ' Descript i on, (t1 .A m o unt - t2.m unt) Amount ,t FROM (SELECT ' G rand To t al' DESCRIPTION,SUM(tab1.Amount) Amount,tab1.Department FROM (SELECT 'Total Gross' Description ,SUM(smd.ChangedAmount) Amount,D.Description Department FROM SALARYMONTHLYDETAIL smd INNER JOIN SALARYMONTHLY sm ON sm.SALARYMONTHLYID = smd.SALARYMONTHLYID LEFT JOIN DEPARTMENT D ON sm.DEPARTMENTID = D.DEPARTMENTID WHERE sm.SalaryMonth = %d AND smd.ITEMGROUP IN(1, 8) GROUP BY D.DESCRIPTION U n in SELECT 'Total O P I' (opdi.Chang e NetAmo u n t ) Amount, . escription De F R O M OPI P r o cs LEFT JOIN OpiItem op ON opdi.OPIItemID = op.OpiItemID LEFT JOIN OPIProcessDetail opd ON opd.OPIProcessDetailID = opdi.OPIProcessDetailID LEFT JOIN OPIProcess opp ON opd.OPIProcessID = opp.OPIProcessID LEFT JOIN Department D ON opd.DepartmentID = D.DEPARTMENTID WHERE opp.OPIMonth = %d GROUP BY D.DESCRIPTION)tab1 GROUP BY tab1.Department)t1 LEFT OUTER join (S E LC on' Descrip i n, SUM(smd.Change d Amount) Amount,D. D es ent LYDETAIL sm d SALAR MONTHLY sm O sm.SALAR Y MONTHLY I D = smd.SALARYMONTHLYID LEFT JOIN DEPARTMENT D ON sm.DEPARTMENTID = D.DEPARTMENTID WHERE sm.SalaryMonth = %d AND smd.ITEMGROUP IN(3) GROUP BY D.DESCRIPTION)t2 ON t1.Department = t2.Department ORDER BY t1.Department", dateTime, dateTime, dateTime); tempdataset = tc.ExecuteDataSet(sNetSalary); tempdataset.Tables[0].TableName = "NetSalary"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetStaggingData(TransactionContext tc) et = new ataSet(); DataSet t m d a taset = new D string sSQL = S Q Par er.M akeSQL(@" EL E C T * empda as t = tc.Execut 0] .T abl taset. bl es.A d( te m pd ataset.Tabl e s[0 ] .Cop y ()); s L = SQ LP rs r.MakeSQL(" SELECT DIS e, ar re ar nfo, pr om ot iontype, tillda e FR fect ate" ; tempdatas t = t c.ExecuteD[0].able ame = "STAGGING_ RAD SA ARY A SSIGNMENT"; rootDataset.Table sSQ = SQLPars r.M ke QL( @ "SELECT dist n t e m ployeeno, post ode, osti gtype, extr d te FRO M STAGGING_EM P S T ING ORDER BY atase = t c.Execut D t aS Table am = "STAGGING_ E MPPOS mpdat se .Tab l es[0].Copy ( )); h(E cepti n ex ( ex.M essa e); } rt ur n r o otD a taset; } internal static DataSet GetSalaryComparisonData(TransactionContext tc, DateTime _SalaryMonth, string sEmpID) Dat Set empdat set = n w D ta t( ) ; t ry { akeS L(@" ELECT E.EM L YE NO , E.NAME,(G.DE C I P TION) Grade, (D.D S R I TIO ) D epartment DE S . NA IT GR O UP IN(1,8) T EN sm d .CHANGEDAM OUNT ELSE 0 END) CurAmount, S UM laryMonth = %d AND s m d .ITEMGROU N(1,8) THE N s md NT Prv m ount FROM E MP L FT JOI Grades G ON E.GRADEID = G.GRADEID LEF J IN De pa rtmen ON E.DEPAR T M ET TMEN Lef t Join Designation DES ON E.DESIGNATIONID = D E SD EFT J O IN S a lary Mon thly s m ON E .E M P LO YE E ID = s m . E ML LEFT JOIN SalaryMo n thlyDet i sm LARYM NTH LY D WHERE s m.EMPL O Y E EI IN ( q) GROUP BY E .EMPLO Y EEN O ,E.NAME,G.D E SCRIPT I O N , D.DE S C R I D ES .NAME", _ SalaryMonth , PayrollGlobal F unctions.Payrol l LastDateOfMo nt(_Sal ryMon t h.Add on hs(1)), pID); temp at se t = t c.Ex e cu laryCompari s on); mp ataset.Tabl es[0].Table Nam rison"; rootDat set T able s.Ad d ( t e mpdat as e t . } catc (E ceptio x) { ew.Mess ge ); return rootDat set; } internal static DataSet GetEmpExperience(TransactionContext tc, int empid) atas t = w DataSet( ; Da ta St = { t ing sSQLE x perien e = SQLParser.MakeSQL(@"SELECT E.NAME,E.FATHERNAME,E.MOTHERNAME,E.JOININGDATE,E.ENDOFCONTRACTDATE, E.Gender,D.DESCRIPTION Department,DES.NAME Designation FROM EMPLOYEE e Left Outer Join Department D ON E.DEPARTMENTID = D.DEPARTMENTID LEFT OUTER JOIN Designation DES ON E.DESIGNATIONID = DES.DESIGNATIONID WHERE E.EMPLOYEEID = %n", empid); tempdataset = tc.ExecuteDataSet(sSQLExperience); tempdataset.Tables[0].TableName = "Experience"; rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpsAuditReport(TransactionContext tc, DateTime _SalaryMonth, string sEmpID) { DataSet ro t at as e t = new DataSe { st in s SQL Au dit = SQ P rse r.Ma keSQL(@"S Desi tion G.DESCRIP TI ON Grade, E,smdI TE M G ROUP, sm d. IT EMI ,E J O I N F RO M EM PL O Y E E E D.D E PART MENT ID LEFT JOIN De s ignation DE S O N E.DESIGN A T I O N I N Grad e s .GRADEID ly sm On E .EMPLO Y E E I D = sm .EMP O EEID LEFT JOI N Sa la ry MonthlyDe ta is RY smd. R YMONTHLYI WHERE sm . Salar Mo n t EID IN %q) O DER BY E.EMPLOYE E ID", _SalaryMonth, sE m ID) eDataS t( S LAudit) ; mpdatas t.Tables[0] T t te pda aset.T ab les[0].C ( ); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetSalaryRegister(TransactionContext tc, DateTime PayrollFirstDateOfMonth, DateTime PayrollLastDateOfMonth, string sEmpID, int payrollTypeID) { var rootDataset = new DataSet(); var tempdataset = new DataSet(); var sql = string.Empty; try { if (payrollTypeID == 1) { #region Nokia sql = SQLParser.MakeSQL(@"SELECT * FROM (SELECT 'BD' CountryCode, E.EMPLOYEENO EmployeeID, E.NAME EmpName, CC.Code CostCenter, 'BD80' EntityCode, CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) +'-'+ CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) YearCode, %d PeriodStartDate, %d PeriodEndDate, CASE allowDeduct.CODE WHEN 'E032' THEN 'N' WHEN 'E033' THEN 'N' ELSE 'R' END ProcessType, CASE salMonD.ITEMID WHEN -101 THEN 'E001' WHEN -129 THEN 'D004' WHEN -132 THEN 'O001' WHEN -144 THEN 'D001' ELSE allowDeduct.CODE END PayElementCode, salMonD.DESCRIPTION Description, SUM(salMonD.CHANGEDAMOUNT) Amount, 'BDT' PayoutCurrency FROM SALARYMONTHLY salMon LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN EMPCOSTCENTER salCC ON salCC.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN CRG CC ON CC.CRGID = salCC.COSTCENTERID LEFT JOIN SALARYMONTHLYDETAIL salMonD ON salMonD.SALARYMONTHLYID = salMon.SALARYMONTHLYID LEFT JOIN ALLOWANCEDEDUCTION allowDeduct ON (allowDeduct.NAME = salMonD.DESCRIPTION AND allowDeduct.PAYROLLTYPEID = %n) WHERE salMon.SALARYMONTH = %d AND salMon.EmployeeID IN (%q) AND salCC.CURRENTCC = 1 Group BY E.EMPLOYEENO, E.NAME, CC.Code, salMon.SALARYMONTH, allowDeduct.CODE, salMonD.ITEMID, salMonD.DESCRIPTION UNION SELECT 'BD' CountryCode, E.EMPLOYEENO EmployeeID, E.NAME EmpName, CC.Code CostCenter, 'BD80' EntityCode, CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) +'-'+ CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) YearCode, %d PeriodStartDate, %d PeriodEndDate, 'R' ProcessType, 'E023' PayElementCode, CASE WHEN oi.Name IS NULL THEN 'Leave Accrual' ELSE oi.Name END Description, CASE WHEN op.VALUE IS NULL THEN 0 ELSE op.VALUE END Amount, 'BDT' PayoutCurrency FROM SALARYMONTHLY salMon LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN EMPCOSTCENTER salCC ON salCC.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN CRG CC ON CC.CRGID = salCC.COSTCENTERID LEFT JOIN OpiParameterIndividual op ON op.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN OPIITEM oi ON oi.OPIItemId = op.OPIItemId WHERE salMon.SALARYMONTH = %d AND salMon.EmployeeID IN (%q) AND oi.OPIItemId = 1 AND salCC.CURRENTCC = 1 AND op.FROMDATE BETWEEN %d AND %d UNION SELECT 'BD' CountryCode, E.EMPLOYEENO EmployeeID, E.NAME EmpName, CC.Code CostCenter, 'BD80' EntityCode, CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) +'-'+ CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) YearCode, %d PeriodStartDate, %d PeriodEndDate, 'R' ProcessType, 'E022' PayElementCode, 'Total Earnings' Description, SUM(salMonD.CHANGEDAMOUNT) Amount, 'BDT' PayoutCurrency FROM SALARYMONTHLY salMon LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN EMPCOSTCENTER salCC ON salCC.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN CRG CC ON CC.CRGID = salCC.COSTCENTERID LEFT JOIN SALARYMONTHLYDETAIL salMonD ON salMonD.SALARYMONTHLYID = salMon.SALARYMONTHLYID LEFT JOIN ALLOWANCEDEDUCTION allowDeduct ON (allowDeduct.NAME = salMonD.DESCRIPTION AND allowDeduct.PAYROLLTYPEID = %n) WHERE salMon.SALARYMONTH = %d AND salMon.EmployeeID IN (%q) AND salMonD.ITEMGROUP IN (1,8) AND salCC.CURRENTCC = 1 GROUP BY E.EMPLOYEENO, E.NAME, CC.Code, salMon.SALARYMONTH UNION SELECT 'BD' CountryCode, E.EMPLOYEENO EmployeeID, E.NAME EmpName, CC.Code CostCenter, 'BD80' EntityCode, CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) +'-'+ CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) YearCode, %d PeriodStartDate, %d PeriodEndDate, 'R' ProcessType, 'D006' PayElementCode, 'Total Deductions' Description, SUM(salMonD.CHANGEDAMOUNT) Amount, 'BDT' PayoutCurrency FROM SALARYMONTHLY salMon LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN EMPCOSTCENTER salCC ON salCC.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN CRG CC ON CC.CRGID = salCC.COSTCENTERID LEFT JOIN SALARYMONTHLYDETAIL salMonD ON salMonD.SALARYMONTHLYID = salMon.SALARYMONTHLYID LEFT JOIN ALLOWANCEDEDUCTION allowDeduct ON (allowDeduct.NAME = salMonD.DESCRIPTION AND allowDeduct.PAYROLLTYPEID = %n) WHERE salMon.SALARYMONTH = %d AND salMon.EmployeeID IN (%q) AND salMonD.ITEMGROUP = 3 AND salCC.CURRENTCC = 1 GROUP BY E.EMPLOYEENO, E.NAME, CC.Code, salMon.SALARYMONTH ) tab1 ORDER BY tab1.EmployeeID", PayrollFirstDateOfMonth, PayrollLastDateOfMonth, payrollTypeID, PayrollLastDateOfMonth, sEmpID, PayrollFirstDateOfMonth, PayrollLastDateOfMonth, PayrollLastDateOfMonth, sEmpID, PayrollFirstDateOfMonth, PayrollLastDateOfMonth, PayrollFirstDateOfMonth, PayrollLastDateOfMonth, payrollTypeID, PayrollLastDateOfMonth, sEmpID, PayrollFirstDateOfMonth, PayrollLastDateOfMonth, payrollTypeID, PayrollLastDateOfMonth, sEmpID); #endregion } else if (payrollTypeID == 3) { #region APLL sql = SQLParser.MakeSQL(@"SELECT * FROM (SELECT 'BD' CountryCode, E.EMPLOYEENO EmployeeID, E.NAME EmpName, '' CostCenter, 'L865' EntityCode, CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) YearCode, %s PeriodStartDate, %s PeriodEndDate, 'R' ProcessType, CASE salMonD.ITEMID WHEN -101 THEN 'E001' WHEN -129 THEN 'D004' WHEN -132 THEN 'O001' WHEN -144 THEN 'D001' ELSE allowDeduct.CODE END PayElementCode, salMonD.DESCRIPTION Description, SUM(salMonD.CHANGEDAMOUNT) Amount, 'BDT' PayoutCurrency FROM SALARYMONTHLY salMon LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN SALARYMONTHLYDETAIL salMonD ON salMonD.SALARYMONTHLYID = salMon.SALARYMONTHLYID LEFT JOIN ALLOWANCEDEDUCTION allowDeduct ON (allowDeduct.NAME = salMonD.DESCRIPTION AND allowDeduct.PAYROLLTYPEID = %n) WHERE salMon.SALARYMONTH = %d AND salMon.EmployeeID IN (%q) Group BY E.EMPLOYEENO, E.NAME, salMon.SALARYMONTH, allowDeduct.CODE, salMonD.ITEMID, salMonD.DESCRIPTION UNION SELECT 'BD' CountryCode, E.EMPLOYEENO EmployeeID, E.NAME EmpName, '' CostCenter, 'L865' EntityCode, CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) YearCode, %s PeriodStartDate, %s PeriodEndDate, 'R' ProcessType, 'E022' PayElementCode, 'Total Earnings' Description, SUM(salMonD.CHANGEDAMOUNT) Amount, 'BDT' PayoutCurrency FROM SALARYMONTHLY salMon LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN SALARYMONTHLYDETAIL salMonD ON salMonD.SALARYMONTHLYID = salMon.SALARYMONTHLYID LEFT JOIN ALLOWANCEDEDUCTION allowDeduct ON (allowDeduct.NAME = salMonD.DESCRIPTION AND allowDeduct.PAYROLLTYPEID = %n) WHERE salMon.SALARYMONTH = %d AND salMon.EmployeeID IN (%q) AND salMonD.ITEMGROUP IN (1,8) GROUP BY E.EMPLOYEENO, E.NAME, salMon.SALARYMONTH UNION SELECT 'BD' CountryCode, E.EMPLOYEENO EmployeeID, E.NAME EmpName, '' CostCenter, 'L865' EntityCode, CAST(YEAR(salMon.SALARYMONTH) AS VARCHAR) YearCode, %s PeriodStartDate, %s PeriodEndDate, 'R' ProcessType, 'D007' PayElementCode, 'Total Deductions' Description, SUM(salMonD.CHANGEDAMOUNT) Amount, 'BDT' PayoutCurrency FROM SALARYMONTHLY salMon LEFT JOIN EMPLOYEE E ON E.EMPLOYEEID = salMon.EMPLOYEEID LEFT JOIN SALARYMONTHLYDETAIL salMonD ON salMonD.SALARYMONTHLYID = salMon.SALARYMONTHLYID LEFT JOIN ALLOWANCEDEDUCTION allowDeduct ON (allowDeduct.NAME = salMonD.DESCRIPTION AND allowDeduct.PAYROLLTYPEID = %n) WHERE salMon.SALARYMONTH = %d AND salMon.EmployeeID IN (%q) AND salMonD.ITEMGROUP = 3 GROUP BY E.EMPLOYEENO, E.NAME, salMon.SALARYMONTH ) tab1 ORDER BY tab1.EmployeeID", PayrollFirstDateOfMonth.ToString("dd/MM/yyyy"), PayrollLastDateOfMonth.ToString("dd/MM/yyyy"), payrollTypeID, PayrollLastDateOfMonth, sEmpID, PayrollFirstDateOfMonth.ToString("dd/MM/yyyy"), PayrollLastDateOfMonth.ToString("dd/MM/yyyy"), payrollTypeID, PayrollLastDateOfMonth, sEmpID, PayrollFirstDateOfMonth.ToString("dd/MM/yyyy"), PayrollLastDateOfMonth.ToString("dd/MM/yyyy"), payrollTypeID, PayrollLastDateOfMonth, sEmpID); #endregion } tempdataset = tc.ExecuteDataSet(sql); rootDataset.Tables.Add(tempdataset.Tables[0].Copy()); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetSalaryCertificateData(TransactionContext tc, int EmpID, int bankID) DataSet t Conver .ToString((int ) rt.ToString((int)E umSalaryIte mC { string SQLAud i = SQ Parser.MakeSQL @"SE ECT E.EMPLOYE NO,E.NA DE . AM D esignation D .DESCR I PTION Divis smd. TEMG OUP=%n THEN smd.CHA GEDAMOU T LSE 0 E N D) GrossAmount, S EN s d.CH NGEDAMOUNT ELSE 0 ND) LoanAm un , S U M(CASE WHEN smd ITEMGROUP=% n AND smd.ITEM O E NO t R O Em loyee E INNER JOIN BRAN H S NER J IN B A NKS b ON B r B A NKID b.BAN K ID O ID = ARTME T ep O N E.DEPARTM ENTID = Dep.DEPARTMENTID INNER JOIN SALARYMONTHLY sm ON E.E MP L OY E EID = sm.EMPLOYEEID INNER JOIN HERE sm.SalaryMonth=(SE L ECT MAX( S alaryMonth) F R M SALARYMONTHLY) AN D .EMPLOYEEID = n AND B.BANKID = %n DES.NAME,Dep.DE S CRIPTION , b.NAME,Br.AD D R SS", (int)EnumSalaryGr o up.Gross , (int)EnumSa l a yGroup.Deduct i ns, sItemCode, yGroup.Dedu e tempdataset = t c.E x ec udit); tempdataset .Tables [ 0 ] .Tabl e N a me root a taset.Tab es .A et )); } c at n { throw nw Exception(ex.Me sage); } return rootDataset; } internal static DataSet GetSalaryCertificateDataforOtherBank(TransactionContext tc, int EmpID, int bankID) { at a Set temp d a tas e t new DataSet(); try S akeSQL ELECT E.E L YEE O, E.NA M E, E.JOIN NGDATE, E.ENDOFCONTRACTDATE,Br.ADDRESS BankAddress, DES.NAME Designation, b.NAME Bank, smd.ITEMGROUP, smd.CHANGEDAMOUNT Amount, smd.DESCRIPTION FROM Employee E INNER JOIN BRANCHES Br ON E.BRANCHID = Br.BRANCHID INNER JOIN BANKS b ON Br.BANKID = b.BANKID INNER JOIN DESIGNATION DES ON E.DESIGNATIONID = DES.DESIGNATIONID INNER JOIN SALARYMONTHLY sm ON E.EMPLOYEEID = sm.EMPLOYEEID INNER JOIN SALARYMONTHLYDETAIL smd ON sm.SALARYMONTHLYID = smd.SALARYMONTHLYID WHERE sm.SalaryMonth = (SELECT MAX(SalaryMonth) FROM SALARYMONTHLY) AND E.EMPLOYEEID = %n AND B.BANKID = %n GROUP BY E.EMPLOYEENO,E.NAME,E.JOININGDATE,E.ENDOFCONTRACTDATE,smd.DESCRIPTION, DES.NAME,b.NAME,Br.ADDRESS,smd.CHANGEDAMOUNT,smd.POSITION,smd.ITEMGROUP ORD ER B Y smd.P OS T ION " , EmpID , ba kID); tempdat a u dit ) ; tempdata s t.Tables[ 0 .Tabl e ame = " O rootDa ae t.T a bl es.Add(tempdat a set.Table s [ } catch (E xc ep ti on ex ) { ow ne E xcept i on(e.Me s sag e ); } r et; } internal static DataSet GetExceptionEmployeesPF(TransactionContext tc, DateTime fromdate, DateTime todate) { Dat a aet = new DataSet( ; ataSet tempdataset = new DataSet(); try { string sSA rser.Ma eSQL(@"SELE T t.E ployeeN o , t TRAN AM OUN ) PF Am ou nt,t .C o n ry, er,t.D sii partmet FROM SELE T e. E mpl o yeeNo,e.N am ,e2. RESENTAD RE ROM FTRANSAC IO p pt.E PLOY EID = p ex Em p loyeeI yee e ON p ex.Employee D = e. M P LOYEEID AND p . RAN D ATE BETWEEN % LEF JOI DESIGNATION O e D E SIGNATIONI D . DESIGNATION ER JO N EM CONTACT e2 ON e2.EM LOY EI =e . EMPLOYEEID ON e. EP A RTMENTID = D e p.DEPA TME N TID MPL Y E EID=cmpcc. M L O EEI A ND cmp c C u I NNER JOIN C R G CC O N cmpcc.CostC e n t erID = CC.CRGID GROUP BY t.Em p loy e eNo, t.N a me, t .CostCent t JO IN NGD A TE,t.D esig na t on,t. D partme n t tempdat aset = SQLAudit) ; temp da ase .a bl eT ame = " xce p ti on PF"; r o otData se ts Ad t.Tab e s[0].Copy )) ; Excep ion ex) { w ; } return rootDat set; } internal static DataSet GetEmpArrearBankAdvice(TransactionContext tc, string sEmpID, string itemType, int processID, int branchID) DataSet o ank dvices = nD stri g sSQL; i(sE m pID != string.Empty) { sSQL = SQLParser.MakeSQL( @"SELECT E.EMPLOYEENO,E.NAME,E.EMAILADDRESS,E.AccountNo,sum(ROUND(APDI.CHANGEDAMOUNT , 0)) CHANGEDAMOUNT,BA.NAME,BR.ADDRESS FROM EMPLOYEE E,ArrearProcess AP,ArrearProcessDetail APD,ArrearProcessDetailItem APDI, BRANCHES BR,BANKS BA WHERE AP.ArrearProcessID=APD.ArrearProcessID AND APD.EmployeeID = E.EmployeeID AND BR.BranchID=APD.BranchID AND BA.BANKID = BR.BANKID AND APD.ArrearProcessDetailID = APDI.ArrearProcessDetailID AND APDI.ItemType NOT in (8, 11) AND APD.EmployeeID IN(%q) And AP.ArrearProcessID=%n And APD.BranchID=%n Group by E.EMPLOYEENO,E.NAME,E.EMAILADDRESS,E.AccountNo,BA.NAME,BR.ADDRESS order by E.EmployeeNo", sEmpID, processID, branchID); } else { sSQL = SQLParser.MakeSQL( @"SELECT E.EMPLOYEENO,E.NAME,E.EMAILADDRESS,E.AccountNo,sum(ROUND(APDI.CHANGEDAMOUNT, 0)) CHANGEDAMOUNT,BA.NAME,BR.ADDRESS FROM EMPLOYEE E,ArrearProcess AP,ArrearProcessDetail APD,ArrearProcessDetailItem APDI, BRANCHES BR,BANKS BA WHERE AP.ArrearProcessID=APD.ArrearProcessID AND APD.EmployeeID = E.EmployeeID AND BR.BranchID=APD.BranchID AN D BA.BA N KID = BR.BANKID AND A D.Ar ea r s A N mType NOT in (8, 1 ) And AP Ar r arProc ssID=% n And AP .BranchI D %n Group b E.EMPLOYEEN , .NA E,E.EMA I L AD untN .A rd r by E . Emplo ye proc e ssID, branchID); } oBankAdvices = tc.ExecuteDataSet(sSQL); } catch (Exception ex) { throw new Exception(ex.Message); } return oBankAdvices; } internal static DataSet GetEmpArrerSheet(TransactionContext tc, string sEmpID, string itemType, int arrPrcssID) { DataSet r tem dat a set = new a a S et(); que y; if (s u ry = SQLPa RIP ION GName, rPr .* , R OW_NUMBE () VE ( P RT IT nse RAN K () OVER (O DE R B Y E.E PL O YEENO) SLGroup Grades G , DESIGNATI O N D ,Emp l oy e e E, (SE EC a pd.Employe eID ad e,apd sc apdi.SerialNo,apdi.ChangedAmount FROM ArrearProcessDetail apd,ArrearProcessDetailItem apdi WHERE apd.ArrearprocessDetailID= apdi.ArrearprocessDetailID And apd.ArrearProcessID=%n AND apdi.ItemType IN(%q) AND apd.EmployeeID IN (%q)) ArrPrs WHERE G.GradeID = ArrPrs.GradeID AND E.EmployeeID = ArrPrs.EmployeeID AND D.DesignationID = ArrPrs.DesingnationID ORDER BY E.EMPLOYEENO,ArrPrs.SerialNo ", arrPrcssID, itemType, sEmpID); } else { query = SQLParser.MakeSQL(@"SELECT E.EMPLOYEENO,E.NAME,G.DESCRIPTION GName, D.Name DName,D.CODE DCode,G.Code GCode,ArrPrs.*, ROW_NUMBER ( L,den se _RAN K ) OVER ( O RD NO NATIO D, mployee E , (SEL ECT apd.EmpoyeeID,apd.Proces Month, pd.Desi gnationID, apd.G r deI ,apdi.Item Type,apdi.It scripti n, apd . eri lNo,apd i . Ch rP o cessDe ai apd,A r rearP ro pd WHERE apd.ArrearprocessDetailID= apdi.ArrearprocessDetailID And apd.ArrearProcessID=%n AND apdi.ItemType IN(%q)) ArrPrs WHERE G.GradeID = ArrPrs.GradeID AND E.EmployeeID = ArrPrs.EmployeeID AND D.DesignationID = ArrPrs.DesingnationID ORDER BY E.EMPLOYEENO,ArrPrs.SerialNo ", arrPrcssID, itemType); } return tc.ExecuteDataSet(query); } catch (Exception ex) { throw new Exception(ex.Message); } return rootDataset; } internal static DataSet GetEmpArrerSlipGross(TransactionContext tc, string sEmpID, string itemType, int processID) try { string sSQL; { OYE NO, G . CODE Gra e, D G .N D.DESC MODE, APD. A CCOUNTNO, AP ype N Cat go y, E.JOININGD A TE, roces P inner join ArrearProcessDetail APD on AP.ArrearProcessID = APD.ArrearProcessID inner join EMPLOYEE E on APD.EMPLOYEEID = E.EMPLOYEEID inner join DEPARTMENT D on APD.DEPARTMENTID = D.DEPARTMENTID inner join Grades G on APD.GRADEID = G.GRADEID inner join DESIGNATION DG on APD.DesingnationID = DG.DESIGNATIONID inner join LOCATION L on APD.LOCATIONID = L.LOCATIONID left outer join BRANCHES Br on APD.BRANCHID = Br.BRANCHID left outer join BANKS B on Br.BANKID = B.BANKID inner join CATEGORY cat on E.CATEGORYID = cat.CATEGORYID inner join ArrearProcessDetailItem APDI on APD.ArrearprocessDetailID = APDI.ArrearprocessDetailID AND APDI.ItemType IN(% q) And AP.ArrearProcessID = %n AND APD.EmployeeID IN(% q) ORDER BY E.EmployeeNo", itemType, processID, sEmpID); } else { sSQL = SQLParser.MakeSQL(@"SELECT E.NAME Name,E.EMPLOYEENO,G.CODE Grade,DG.Name De s gnation,L. D scriptio n L D.DES C RIPTI O N .N ASICS L ARY,E.PAY EN TM APD.ACC O UN es DESCRI TION Descri ption,APDI.emType, APDI.CHANGEDAMOU T, A DI.Ite ID,cat . ESCRIP ION Cate g ry, .JOININGD ATE, E.DEP A R TM FRO M Proc s Detail AP D on AP. A rrearProcessID=APD.ArrearProcessID inner join EMPLOYEE E on APD.EMPLOYEEID=E.EMPLOYEEID inner join DEPARTMENT D on APD.DEPARTMENTID=D.DEPARTMENTID inner join Grades G on APD.GRADEID=G.GRADEID inner join DESIGNATION DG on APD.DesingnationID =DG.DESIGNATIONID inner join LOCATION L on APD.LOCATIONID=L.LOCATIONID left outer join BRANCHES Br on APD.BRANCHID=Br.BRANCHID left outer join BANKS B on Br.BANKID=B.BANKID inner join CATEGORY cat on E.CATEGORYID=cat.CATEGORYID inner join ArrearProcessDetailItem APDI on APD.ArrearprocessDetailID=APDI.ArrearprocessDetailID AND APDI.ItemType IN(%q) And AP.ArrearProcessID=%n ORDER BY E.EmployeeNo", itemType, processID); } oArrearSlips = tc.ExecuteDataSet(sSQL); } catch (Exception ex) { throw new Exception(ex.Message); } return oArrearSlips; } internal static DataSet GetArrearSlipDeduct(TransactionContext tc, string sEmpID, string itemType, int processID) Arrea Slip = new DataSet(); t y { string sSQL; { sS L = SQLParser.Make S Q L(G.N me D esignation L. D e s c iptio L a m e, PI NAME RY APD.ACCOUNTNO,APD.ProcessMonth,APDI.DESCRIPTION Description, APDI.ItemType, APDI.CHANGEDAMOUNT,APDI.ItemID FROM Employee E Inner join ArrearProcessDetail APD on E.EMPLOYEEID = APD.EMPLOYEEID inner join ArrearProcess AP on AP.ArrearProcessID = APD.ArrearProcessID inner join Grades G on APD.GRADEID = G.GRADEID Inner join Department D on APD.DEPARTMENTID = D.DEPARTMENTID inner join Designation DG on APD.DesingnationID = Dg.DESIGNATIONID inner join ArrearProcessDetailItem APDI on APD.ArrearprocessDetailID = APDI.ArrearprocessDetailID left outer join BRANCHES Br on APD.BRANCHID = br.BRANCHID left outer join BANKS B on Br.BANKID = B.BANKID Inner join Location L on APD.LocationID = L.LocationID AND APDI.ItemType in(%q) AND APD.EmployeeID IN(% q) And AP.ArrearProcessID = %n ORDER BY E.EmployeeNo", itemType, sEmpID, processID); } else { sSQL = SQLParser.MakeSQL(@"SELECT E.NAME Name,E.EMPLOYEENO,G.CODE Grade,DG.Name Designation,L.Description LName, D.DESCRIPTION Department,B.NAME Bank,E.BASICSALARY ,E.PAYMENTMODE, APD.ACCOUNTNO,APD.ProcessMonth,APDI.DESCRIPTION Description,APDI.ItemType, APDI.CHAN G DAMOUNT, A DI.ItemID F O E m ployee E Inner join Ar et .EMPL Y EEID=APD. MP LO inner j oi es rrearP ocessID=APD. ArrearProcesID i nner join Grades G on PD.GRA EID=G. G ADEID Inner j in Departme t D o APD.DE P A RT PART r o in De ig ation D G on AP =D inner join ArrearProcessDetailItem APDI on APD.ArrearprocessDetailID=APDI.ArrearprocessDetailID left outer join BRANCHES Br on APD.BRANCHID=br.BRANCHID left outer join BANKS B on Br.BANKID=B.BANKID Inner join Location L on APD.LocationID =L.LocationID AND APDI.ItemType in(%q) And AP.ArrearProcessID=%n ORDER BY E.EmployeeNo", itemType, processID); } oArrearSlips = tc.ExecuteDataSet(sSQL); } catch (Exception ex) { throw new Exception(ex.Message); } return oArrearSlips; } internal static DataSet GetEmpArrerSlipGross(TransactionContext tc, DateTime arrearMonth, string sEmpID, string itemType) et(); try string sSQL = SQ L Pars e r.MakeSQL(@"SELECT E. atio ',L.D scri tion LNa e, AME ank,E BASI SALAR , .P YM E NTMODE , NTNO, PD.P cessMont , PD .DE S CRIPTION D s c r iption,APDI APDI.C AN G E D A OUN ,AP D I.ItemID,c t. D E S C E. EP R T MENTID nner join ArrearP r ocessDetail APD on AP.ArrearProcessID=APD.ArrearProcessID inner join EMPLOYEE E on APD.EMPLOYEEID=E.EMPLOYEEID inner join DEPARTMENT D on APD.DEPARTMENTID=D.DEPARTMENTID inner join Grades G on APD.GRADEID=G.GRADEID inner join DESIGNATION DG on APD.DesingnationID =DG.DESIGNATIONID inner join LOCATION L on APD.LOCATIONID=L.LOCATIONID left outer join BRANCHES Br on APD.BRANCHID=Br.BRANCHID left outer join BANKS B on Br.BANKID=B.BANKID inner join CATEGORY cat on E.CATEGORYID=cat.CATEGORYID inner join ArrearProcessDetailItem APDI on APD.ArrearprocessDetailID=APDI.ArrearprocessDetailID AND APD.ProcessMonth=%d AND APDI.ItemType IN(%q) AND APD.EmployeeID IN(%q) ORDER BY E.EmployeeNo", arrearMonth, itemType, sEmpID); oArrearSlips = tc.ExecuteDataSet(sSQL); } catch (Exception ex) { throw new Exception(ex.Message); } return oArrearSlips; } internal static DataSet GetCashPaymentSummaryData(TransactionContext tc, DateTime fromdate) hPa Ds e t = new DataSet ( ) ; string gr oupID = Convert.ToString(ro + Convert.To t in g ((int)EnumSala r yGro u p.ng qu r y = SQLPa se r.LE e.EMP OYE NO, e.NAME RO HLY AS sm, SALARYMON THLYDETAIL S smd, Employee e DEPART ENT AS, DESIGNATION AS d2, d e partment pd WHERE s m SALARY ONTHLY I = smd.S LARYMONT HL ND AND d.PARE NT I D = pd.DEP A RTMENTID AND e.DEPARTMENTID = d.DEPARTMENTID AND e.DESIGNATIONID = d2.DESIGNATIONID AND sm.SalaryMonth = %d AND smd.ITEMCODE = -132 AND smd.ITEMID = -132 AND sm.BRANCHID IS NULL ORDER BY e.EMPLOYEENO", fromdate); cashPayDset = tc.ExecuteDataSet(query); return cashPayDset; } internal static DataSet GetArrearSlipDeduct(TransactionContext tc, DateTime arrearMonth, string sEmpID, string itemType) { try SELE T E. E Name, E .E MPLOYEENO, G COD G ad e, DG.Name 'Desig n ati o n',L.Description D. ESCRIPTI N De art m ent, B.NAME B a nk, E.BASIC P .A COU N TNO, APD.Proc e s s Month, APDI.DE APDI.CHA FR M mpl o yee E Inner jo n A r rearProcessDe i n n e r join Arre cess D i In PARTM NTID onID = g.DE IGNATIONID inn e r join ArrearProcessDe Arr arp r ocessDetailI D r o AP D .BRANCHID = r.B R A N HID lef B on Br.BAN I = B .BANKID Inner jo n L A.Loca ion D AND A D.ProcessMon th = %d AND APDI.ItemType in(% ) AND PD.Empl yeeID IN( % q) ORD ER loye No" , a r arM nth, ite mT yp e oArre r lips = t c.Execut e D ata S et(sSQL); ca t ch Ex ept io n ex) { ceptio (ex Me s a e); } return oArrearSlips; } internal static DataSet GetExpensesPaySlipData(TransactionContext tc, DateTime fromDate, DateTime toDate, string sEmpID) { taSet ); try { rs LEC e .Employe eN o, e .Nam e as EmpNam e.O T P AYACCOUNTNO, e . P aymentMode, d men , desig.[NAME] A S D esignation, g.C IIt m, I NUL L (Sum(CON V E RT( igi t, o pdi.Ne t A mou )), ) A S Amount F OM P LEFT JOINO ailItem opd N o i.OPIItemId = o pdi.O P It LEFT JOIN OPI rocess etail o d ON opd.OPIProcess D etailId = opdi.OPI ro c ssDetail d LEFT JOIN EFT J O I N Employee e N e.PL YEE ID = o pd.E pl oyeeI d D = e.DEPARTM NT D L E FT JOIN Gra es g on g.G r adeI d = e.Grade I >= % d AND op.OPIMo n th < = %d A G ROU Y e.E plo ee o, e .Name, d.[DES e ) src ( r OPI tem ([Utilit xp nse s ], [Leave Fa e A ssistanc Exp nces / Expe es], [Drive A lo anc e s], tici pa t on F nd], [Manager’ s Telephon Exp ns s], [ Telephone Expenses(M o bile Bill ], ) p v; " et = tc.Ex cute ataSe ( ue y) ; } t row n Exceptio ( x. ess a ge); } return tempDataSet; }*/ } }