using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using Payroll.BO; using Ease.CoreV35; using Ease.Core.Model; using Ease.Core.Utility; using System.Windows.Forms; using HRM.BO; using HRM.DA; using System.IO; using System.Net.Mail; using HRM.BO.Configuration; using Microsoft.Reporting.NETCore; namespace HRM.Report { public class PaySlip { List _empBankAccs = null; List _oGratuityParams = null; private DateTime _dSalaryMonth = DateTime.MinValue; private DateTime _dMonthEndDate = DateTime.MinValue; DateTime _fiscalyearStart; DateTime _SalaryMonth; public PaySlip() { } public byte[] ReportOverAllSummary(int payrollTypeId, string sEmpID, DateTime SalaryMonth, string reportType) { DateTime salaryMonth = SalaryMonth.LastDateOfMonth(); string[] sEmp = sEmpID.Split(new char[] { ',' }); int nTotalEmp = sEmp.Count(); int nCount = 0; DataSet oSalaryMonthlys = new SalaryMonthlyService().GetEmpOverAllSummaryGross(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable PayslipData = new PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable(); PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable deducDataTable = new PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable(); foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) { DataRow oRow = this.GetItemForOverAll(PayslipData, (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); if (oRow == null) { oRow = PayslipData.NewRow(); oRow = this.GrossMergeForOverAll(oRow, odRow, nTotalEmp, salaryMonth); nCount = nCount + 1; PayslipData.Rows.Add(oRow); } if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) oRow["Earnings"] = odRow["Amount"]; else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) oRow["Arrear"] = odRow["Amount"]; else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) oRow["UnAuthLeave"] = odRow["Amount"]; } oSalaryMonthlys = new SalaryMonthlyService().GetEmpOverAllSummaryDeduct(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); int deductRowCount = oSalaryMonthlys.Tables[0].Rows.Count; int addedDeductRowCount = 0; try { foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) { if (deductRowCount <= nCount) { DataRow oRow = PayslipData.Rows[addedDeductRowCount]; oRow["DeducDescription"] = odRow["DESCRIPTION"]; oRow["DeducAmount"] = odRow["Amount"]; deductRowCount--; addedDeductRowCount++; } else { DataRow oRow = PayslipData.NewRow(); oRow["DeducDescription"] = odRow["Description"]; oRow["DeducAmount"] = odRow["Amount"]; deductRowCount--; PayslipData.Rows.Add(oRow); } } } catch (Exception ex) { throw new Exception(ex.Message); } ReportProcessor reportProcessor = new ReportProcessor(); return reportProcessor.ShowDlgForPaySlipOverAllSummary(null, PayslipData, reportType, payrollTypeId); } private DataRow GrossMergeForOverAll(DataRow destination, DataRow source, int nTotalEmp, DateTime sMonth) { destination["TotalEmp"] = nTotalEmp; if (source["Description"].ToString().Contains("'")) { destination["Description"] = source["Description"].ToString().Replace("'", "\'"); } else if (source["Description"].ToString().Contains("/")) { destination["Description"] = source["Description"].ToString().Replace("/", "/'"); } else { destination["Description"] = source["Description"]; } destination["ItemGroup"] = source["ITEMGROUP"]; destination["ItemCode"] = source["ITEMCode"]; destination["ItemID"] = source["ITEMID"]; destination["Month"] = sMonth; return destination; } private DataRow GetItemForOverAll(PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable Source, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int ITemID) { foreach (DataRow odRow in Source.Rows) { if (Convert.ToInt32(odRow["ItemCode"]) == (int)itemCode && Convert.ToInt32(odRow["ItemID"]) == ITemID) { return odRow; } } return null; } public byte[] ShowReport(int payrollTypeID, DateTime SalaryMonth, string sEmpID, bool isForESS) { DataSet oFDST = new DataSet(); _empBankAccs = new List(); _empBankAccs = new EmployeeBankAccountService().Get(); _oGratuityParams = new ESBDefinitionService().Get(); Employee oEmployee = null; List oEmps = new List(); oEmps = new EmployeeService().GetAllEmps(); List oDesigs = new DesignationService().Get(EnumStatus.Regardless, payrollTypeID); ReportProcessor reportProcessor = new ReportProcessor(); DateTime salaryMonth = SalaryMonth.LastDateOfMonth(); List oSaProcess = new List(); oSaProcess = new SalaryProcessService().Get(salaryMonth, payrollTypeID); //DataTable basicInfo = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable(); if (isForESS) { foreach (SalaryProcess item in oSaProcess) { if (!item.ShowInDesktops) { throw new Exception("Salary is not approved yet."); } } } //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); DataSet oSalaryMonthlysGross = new SalaryMonthlyService().GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); _dSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[0].Rows.Count > 0) { if (oSaProcess[0].PaymentDate != DateTime.MinValue) { _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); } else { _dMonthEndDate = DateTime.MinValue; } } foreach (DataRow odRow in oSalaryMonthlysGross.Tables[0].Rows) { double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); if (dbl == 0) { continue; } DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); if (oRow == null) { oRow = PayslipData.NewRow(); oRow = this.GrossMergePayslip(oRow, odRow); PayslipData.Rows.Add(oRow); } if (Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) { oRow["Earning"] = odRow["CHANGEDAMOUNT"]; } else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) { double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); oRow["Arrear"] = dArrear; } else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) { oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; } } int nCount = 0; DataSet oSalaryMonthlysDeduct = new SalaryMonthlyService().GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo = ""; DataRow[] odros = null; if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) { employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } double dGratuityAmount = 0; double dPFAmount = 0; string sTEmpEmpNo = ""; double nCurrPFAmount = 0; foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) { double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); if (dbl == 0) { continue; } DataRow oRow = null; if (employeeNo != odRow["EMPLOYEENO"].ToString()) { odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros.Length <= nCount) { oRow = PayslipData.NewRow(); oRow = this.GrossMergePayslip(oRow, odRow); PayslipData.Rows.Add(oRow); } else oRow = odros[nCount]; oRow["DeducDescription"] = odRow["Description"]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; oRow["DeducDescription"] = odRow["Description"]; //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) { nCurrPFAmount = 0; dPFAmount = 0; oEmployee = oEmps.Find(delegate (Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); if (odrosPF.Length > 0) { DataRow oRowPF = odrosPF[0]; nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); } if (oEmployee != null) { if (_oGratuityParams.Count > 0 && _oGratuityParams != null) { dGratuityAmount = GetGratuityAmount(_oGratuityParams, oEmployee, salaryMonth); } else { dGratuityAmount = 0; } dPFAmount = GetPFAmount(oEmployee, salaryMonth); } } oRow["Gratuity"] = dGratuityAmount; double nServiceLength = 0; if (oEmployee != null) nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmployee); if (nServiceLength > 5) { //oRow["PF"] = dPFAmount + nCurrPFAmount * 2; oRow["PF"] = dPFAmount + nCurrPFAmount; } else { oRow["PF"] = dPFAmount + nCurrPFAmount; } nCount = nCount + 1; employeeNo = odRow["EMPLOYEENO"].ToString(); sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); } nCount = 0; DataSet oSalaryMonthlysIncomeTax = new SalaryMonthlyService().GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo1 = ""; DataRow[] odros1 = null; if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) { employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) { DataRow oRow = null; if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) { odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros1.Length <= nCount) continue; oRow = odros1[nCount]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; nCount = nCount + 1; employeeNo1 = odRow["EMPLOYEENO"].ToString(); } nCount = 0; DataSet oSalaryMonthlysLaonAmount = new SalaryMonthlyService().GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo12 = ""; DataRow[] odros12 = null; if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) { employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) { DataRow oRow = null; if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) { odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros12.Length <= nCount) continue; oRow = odros12[nCount]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) { oRow["LoanDescription"] = odRow["Description"]; oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; } nCount = nCount + 1; employeeNo12 = odRow["EMPLOYEENO"].ToString(); } bool isDesigFromEmp = false;// ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); foreach (DataRow oRow in PayslipData.Rows) { Employee oEmp = oEmps .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) .SingleOrDefault(); if (oEmp != null) { if (isDesigFromEmp) { oRow["Designation"] = oEmp.DescriptionText; } else { Designation oDesg = oDesigs.Where(o => o.ID == oEmp.DesignationID).SingleOrDefault(); if (oDesg != null) { oRow["Designation"] = oDesg.Name; } } } } //basicInfo = oSalaryMonthlysGross.Tables[0].Copy(); //basicInfo.TableName = "BasicInfo"; //DateTime joinDate = DateTime.MinValue; //foreach (DataRow oRow in basicInfo.Rows) //{ // joinDate = oRow["JoinIngDate"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(oRow["JoinIngDate"]); // if (joinDate != DateTime.MinValue) // oRow["JOININGDATE"] = joinDate.ToString("dd MMM yyyy"); // if (oRow["PaymentMode"].ToString() == "1") // { // oRow["PaymentMode"] = "CashPayment"; // } // else if (oRow["PaymentMode"].ToString() == "2") // { // oRow["PaymentMode"] = "BankTransfer"; // } // else if (oRow["PaymentMode"] == "3") // { // oRow["PaymentMode"] = "Provision"; // } //} loanDT.TableName = "PayrollDataSet_LoanData"; PayslipData.TableName = "PayrollDataSet_Payslip"; oFDST.Tables.Add(PayslipData); oFDST.Tables.Add(loanDT); if (PayslipData != null && PayslipData.Rows.Count <= 0) { return null; } return reportProcessor.GetPayslipReport(null, oFDST, payrollTypeID); } public byte[] ShowReportNew(int payrollTypeID, DateTime SalaryMonth, string sEmpID, bool isForESS) { DataSet oFDST = new DataSet(); //_empBankAccs = new List(); //_empBankAccs = new EmployeeBankAccountService().Get(); //_oGratuityParams = new ESBDefinitionService().Get(); Employee oEmployee = null; List oEmps = new List(); oEmps = new EmployeeService().GetByEmpIDs(sEmpID, payrollTypeID); List oDesigs = new DesignationService().Get(EnumStatus.Regardless, payrollTypeID); ReportProcessor reportProcessor = new ReportProcessor(); DateTime salaryMonth = SalaryMonth.LastDateOfMonth(); List oSaProcess = new List(); oSaProcess = new SalaryProcessService().Get(salaryMonth, payrollTypeID); DataTable basicInfo = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable(); if (isForESS) { foreach (SalaryProcess item in oSaProcess) { if (!item.ShowInDesktops) { throw new Exception("Salary is not approved yet."); } } } //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); DataSet oSalaryMonthlysGross = new SalaryMonthlyService().GetEmpPaySlipGrossForOthersNew(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); _dSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[1].Rows.Count > 0) { if (oSaProcess[0].PaymentDate != DateTime.MinValue) { _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); } else { _dMonthEndDate = DateTime.MinValue; } } foreach (DataRow odRow in oSalaryMonthlysGross.Tables[1].Rows) { double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); if (dbl == 0) { continue; } DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); if (oRow == null) { oRow = PayslipData.NewRow(); oRow = this.GrossMergePayslip(oRow, odRow); PayslipData.Rows.Add(oRow); } if (Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) { oRow["Earning"] = odRow["CHANGEDAMOUNT"]; } else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) { double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); oRow["Arrear"] = dArrear; } else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) { oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; } } int nCount = 0; DataSet oSalaryMonthlysDeduct = new SalaryMonthlyService().GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo = ""; DataRow[] odros = null; if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) { employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } double dGratuityAmount = 0; double dPFAmount = 0; string sTEmpEmpNo = ""; double nCurrPFAmount = 0; foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) { double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); if (dbl == 0) { continue; } DataRow oRow = null; if (employeeNo != odRow["EMPLOYEENO"].ToString()) { odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros.Length <= nCount) { oRow = PayslipData.NewRow(); oRow = this.GrossMergePayslip(oRow, odRow); PayslipData.Rows.Add(oRow); } else oRow = odros[nCount]; oRow["DeducDescription"] = odRow["Description"]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; oRow["DeducDescription"] = odRow["Description"]; //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) { nCurrPFAmount = 0; dPFAmount = 0; oEmployee = oEmps.Find(delegate (Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); if (odrosPF.Length > 0) { DataRow oRowPF = odrosPF[0]; nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); } if (oEmployee != null) { //if (_oGratuityParams.Count > 0 && _oGratuityParams != null) //{ // dGratuityAmount = GetGratuityAmount(_oGratuityParams, oEmployee, salaryMonth); //} //else //{ // dGratuityAmount = 0; //} dPFAmount = GetPFAmount(oEmployee, salaryMonth); } } oRow["Gratuity"] = dGratuityAmount; double nServiceLength = 0; if (oEmployee != null) nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmployee); if (nServiceLength > 5) { //oRow["PF"] = dPFAmount + nCurrPFAmount * 2; oRow["PF"] = dPFAmount + nCurrPFAmount; } else { oRow["PF"] = dPFAmount + nCurrPFAmount; } nCount = nCount + 1; employeeNo = odRow["EMPLOYEENO"].ToString(); sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); } nCount = 0; DataSet oSalaryMonthlysIncomeTax = new SalaryMonthlyService().GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo1 = ""; DataRow[] odros1 = null; if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) { employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) { DataRow oRow = null; if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) { odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros1.Length <= nCount) continue; oRow = odros1[nCount]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; nCount = nCount + 1; employeeNo1 = odRow["EMPLOYEENO"].ToString(); } nCount = 0; DataSet oSalaryMonthlysLaonAmount = new SalaryMonthlyService().GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo12 = ""; DataRow[] odros12 = null; if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) { employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) { DataRow oRow = null; if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) { odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros12.Length <= nCount) continue; oRow = odros12[nCount]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) { oRow["LoanDescription"] = odRow["Description"]; oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; } nCount = nCount + 1; employeeNo12 = odRow["EMPLOYEENO"].ToString(); } bool isDesigFromEmp = false;// ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); foreach (DataRow oRow in PayslipData.Rows) { Employee oEmp = oEmps .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) .SingleOrDefault(); if (oEmp != null) { if (isDesigFromEmp) { oRow["Designation"] = oEmp.DescriptionText; } else { Designation oDesg = oDesigs.Where(o => o.ID == oEmp.DesignationID).SingleOrDefault(); if (oDesg != null) { oRow["Designation"] = oDesg.Name; } } } } basicInfo = oSalaryMonthlysGross.Tables[0].Copy(); basicInfo.TableName = "BasicInfo"; DateTime joinDate = DateTime.MinValue; foreach (DataRow oRow in basicInfo.Rows) { joinDate = oRow["JoinIngDate"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(oRow["JoinIngDate"]); if (joinDate != DateTime.MinValue) oRow["JOININGDATE"] = joinDate.ToString("dd MMM yyyy"); if (oRow["PaymentMode"].ToString() == "1") { oRow["PaymentMode"] = "CashPayment"; oRow["AccountNO"] = oRow["OutAccountNo"]; oRow["BName"] = oRow["OutBank"]; } else if (oRow["PaymentMode"].ToString() == "2") { oRow["PaymentMode"] = "BankTransfer"; } else if (oRow["PaymentMode"] == "3") { oRow["PaymentMode"] = "Provision"; } } //DataSet dsSubReport = new DataSet(); //PayslipData.TableName = "SalaryMonthlysGross"; //dsSubReport.Tables.Add(PayslipData); //rlforPayslipdt.TableName = "RemainingLoanforPayslip"; //dsSubReport.Tables.Add(rlforPayslipdt); loanDT.TableName = "RemainingLoanforPayslip"; PayslipData.TableName = "SalaryMonthlysGross"; oFDST.Tables.Add(PayslipData); oFDST.Tables.Add(loanDT); if (PayslipData != null && PayslipData.Rows.Count <= 0) { return null; } return reportProcessor.ShowDlgForNewPaySlip(null, basicInfo,oFDST, payrollTypeID); } public void PayslipMail(int payrollTypeID, DateTime SalaryMonth, string sEmpID, bool isForESS, EmailSettings emailSettings) { DataSet oFDST = new DataSet(); byte[] bytes = null; _empBankAccs = new List(); _empBankAccs = new EmployeeBankAccountService().Get(); _oGratuityParams = new ESBDefinitionService().Get(); Employee oEmployee = null; List oEmps = new List(); oEmps = new EmployeeService().GetByEmpNos(sEmpID); List oDesigs = new DesignationService().Get(EnumStatus.Regardless, payrollTypeID); ReportProcessor reportProcessor = new ReportProcessor(); DateTime salaryMonth = SalaryMonth.LastDateOfMonth(); List oSaProcess = new List(); oSaProcess = new SalaryProcessService().Get(salaryMonth, payrollTypeID); if (isForESS) { foreach (SalaryProcess item in oSaProcess) { if (!item.ShowInDesktops) { throw new Exception("Salary is not approved yet."); } } } //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); DataSet oSalaryMonthlysGross = new SalaryMonthlyService().GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); //HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipDatatemp = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); DataTable PayslipDatatemp = new DataTable(); DataTable loanDatatemp = new DataTable(); _dSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[0].Rows.Count > 0) { if (oSaProcess[0].PaymentDate != DateTime.MinValue) { _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); } else { _dMonthEndDate = DateTime.MinValue; } } foreach (DataRow odRow in oSalaryMonthlysGross.Tables[0].Rows) { double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); if (dbl == 0) { continue; } DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); if (oRow == null) { oRow = PayslipData.NewRow(); oRow = this.GrossMergePayslip(oRow, odRow); PayslipData.Rows.Add(oRow); } if (Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) { oRow["Earning"] = odRow["CHANGEDAMOUNT"]; } else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) { double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); oRow["Arrear"] = dArrear; } else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) { oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; } } int nCount = 0; DataSet oSalaryMonthlysDeduct = new SalaryMonthlyService().GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo = ""; DataRow[] odros = null; if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) { employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } double dGratuityAmount = 0; double dPFAmount = 0; string sTEmpEmpNo = ""; double nCurrPFAmount = 0; foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) { double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); if (dbl == 0) { continue; } DataRow oRow = null; if (employeeNo != odRow["EMPLOYEENO"].ToString()) { odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros.Length <= nCount) { oRow = PayslipData.NewRow(); oRow = this.GrossMergePayslip(oRow, odRow); PayslipData.Rows.Add(oRow); } else oRow = odros[nCount]; oRow["DeducDescription"] = odRow["Description"]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; oRow["DeducDescription"] = odRow["Description"]; //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) { nCurrPFAmount = 0; dPFAmount = 0; oEmployee = oEmps.Find(delegate (Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); if (odrosPF.Length > 0) { DataRow oRowPF = odrosPF[0]; nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); } if (oEmployee != null) { if (_oGratuityParams.Count > 0 && _oGratuityParams != null) { dGratuityAmount = GetGratuityAmount(_oGratuityParams, oEmployee, salaryMonth); } else { dGratuityAmount = 0; } dPFAmount = GetPFAmount(oEmployee, salaryMonth); } } oRow["Gratuity"] = dGratuityAmount; double nServiceLength = 0; if (oEmployee != null) nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmployee); if (nServiceLength > 5) { //oRow["PF"] = dPFAmount + nCurrPFAmount * 2; oRow["PF"] = dPFAmount + nCurrPFAmount; } else { oRow["PF"] = dPFAmount + nCurrPFAmount; } nCount = nCount + 1; employeeNo = odRow["EMPLOYEENO"].ToString(); sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); } nCount = 0; DataSet oSalaryMonthlysIncomeTax = new SalaryMonthlyService().GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo1 = ""; DataRow[] odros1 = null; if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) { employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) { DataRow oRow = null; if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) { odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros1.Length <= nCount) continue; oRow = odros1[nCount]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; nCount = nCount + 1; employeeNo1 = odRow["EMPLOYEENO"].ToString(); } nCount = 0; DataSet oSalaryMonthlysLaonAmount = new SalaryMonthlyService().GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo12 = ""; DataRow[] odros12 = null; if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) { employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) { DataRow oRow = null; if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) { odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros12.Length <= nCount) continue; oRow = odros12[nCount]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) { oRow["LoanDescription"] = odRow["Description"]; oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; } nCount = nCount + 1; employeeNo12 = odRow["EMPLOYEENO"].ToString(); } bool isDesigFromEmp = false;// ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); foreach (DataRow oRow in PayslipData.Rows) { Employee oEmp = oEmps .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) .SingleOrDefault(); if (oEmp != null) { if (isDesigFromEmp) { oRow["Designation"] = oEmp.DescriptionText; } else { Designation oDesg = oDesigs.Where(o => o.ID == oEmp.DesignationID).SingleOrDefault(); if (oDesg != null) { oRow["Designation"] = oDesg.Name; } } } } foreach (Employee emp in oEmps) { if (oFDST.Tables.Count > 0) { oFDST.Tables.Remove("PayrollDataSet_LoanData"); oFDST.Tables.Remove("PayrollDataSet_Payslip"); } PayslipDatatemp = PayslipData.AsEnumerable().Where(x => x["EMPLOYEENO"].ToString() == emp.EmployeeNo).Any()? PayslipData.AsEnumerable().Where(x => x["EMPLOYEENO"].ToString() == emp.EmployeeNo).CopyToDataTable():new DataTable(); loanDatatemp= loanDT.AsEnumerable().Where(x => x["EMPLOYEENO"].ToString() == emp.EmployeeNo).Any()? loanDT.AsEnumerable().Where(x => x["EMPLOYEENO"].ToString() == emp.EmployeeNo).CopyToDataTable():new DataTable(); loanDatatemp.TableName = "PayrollDataSet_LoanData"; PayslipDatatemp.TableName = "PayrollDataSet_Payslip"; oFDST.Tables.Add(PayslipDatatemp); oFDST.Tables.Add(loanDatatemp); bytes= reportProcessor.GetPayslipReport(null, oFDST, payrollTypeID); MailSender mailSender = new MailSender(); mailSender.AddTo(emp.EmailAddress.ToString()); mailSender.Subject = "Payslip for the month "+ salaryMonth.ToString("MMM yyyy"); Attachment att = new Attachment(new MemoryStream(bytes), "Payslip.pdf"); mailSender.Body = "

" + "" + "

"; mailSender.SendMail(emailSettings, att); //System.Threading.Thread.Sleep(60000); } } public static ESBDefinition GetESBDefinition(List definations, Employee employee) { ESBDefinition odefinaiton = null; ESBGrade oESBGrade = null; odefinaiton = definations.Where(x => x.PayrollTypeID == employee.PayrollTypeID).SingleOrDefault(); if (odefinaiton != null) oESBGrade = odefinaiton.ESBGrades.Where(t => t.GradeID == employee.GradeID).SingleOrDefault(); return odefinaiton; } public double GetGratuityAmount(List oItems, Employee oEmp, DateTime salaryMonth) { double nAmout = 0.0; double nFracYear = 0.0; ESBDefinition item = GetESBDefinition(oItems, oEmp); double nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmp); if (item != null) { foreach (ESBSlab eslb in item.ESBSlabs) { nAmout = 0.0; if (eslb.ServiceYear <= nServiceLength) { string[] sFracMonth = nServiceLength.ToString().Split(new char[] { '.' }); nFracYear = 0; if (sFracMonth.Length > 1) nFracYear = GlobalFunctions.Round(Convert.ToDouble("." + sFracMonth[1])); if (nFracYear >= 0.5) { nServiceLength = Convert.ToDouble(sFracMonth[0]) + 1; } else { nServiceLength = Convert.ToDouble(sFracMonth[0]); } nAmout = oEmp.BasicSalary * eslb.CalculateNo * nServiceLength; } else { nAmout = 0; } } } return nAmout; } public double GetPFAmount(Employee oEmp, DateTime salaryMonth) { double nAmout = 0.0; DataSet ds = new PFTransactionService().GetPFBalance(oEmp.ID, GlobalFunctions.LastDateOfMonth(salaryMonth)); double nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmp); foreach (DataRow dr in ds.Tables[0].Rows) { if (Convert.ToInt16(dr["TranTP"]) == 1) { nAmout = Convert.ToDouble(dr["Amount"]); } //if (nServiceLength > 5) //{ // nAmout += Convert.ToDouble(dr["Amount"]); //} //else //{ // if (Convert.ToInt16(dr["TranTP"]) != 2) // { // nAmout += Convert.ToDouble(dr["Amount"]); // } //} } return nAmout; } private double ServiceYears(DateTime dt, Employee oEmp) { double n = Global.DateFunctions.DateDiff("d", oEmp.JoiningDate, dt); if (n >= 365) return n / 365; else return 0.0; } private DataRow GrossMergePayslip(DataRow destination, DataRow source) { if (Convert.ToInt32(source["ItemGroup"]) == 3) { destination["Name"] = source["Name"]; destination["TINNo"] = source["TINNo"]; destination["EMPLOYEENO"] = source["EMPLOYEENO"]; destination["Grade"] = source["Grade"]; destination["Designation"] = source["Designation"]; destination["Department"] = source["Department"]; destination["LName"] = source["LName"]; destination["JoiningDate"] = source["JoiningDate"]; destination["BName"] = source["BName"]; destination["ActualBasic"] = source["ActualBasic"]; if (source["PAYMENTMODE"].Equals(1)) { destination["PAYMENTMODE"] = "CashPayment"; } else if (source["PAYMENTMODE"].Equals(2)) { destination["PAYMENTMODE"] = "BankTransfer"; } else if (source["PAYMENTMODE"].Equals(3)) { destination["PAYMENTMODE"] = "Provision"; } //EmployeeBankAccount oemp = new EmployeeBankAccount(); //oemp = _empBankAccs.Where(x => x.EmployeeID == Convert.ToInt32(source["EmployeeID"].ToString()) && x.AccountType == EnumBankAccountType.OutPayAccount).FirstOrDefault(); //if (oemp != null) //{ // destination["ACCOUNTNO"] = oemp.AccountNo; //} //else //{ destination["ACCOUNTNO"] = source["ACCOUNTNO"]; //} destination["SalaryMonth"] = Convert.ToDateTime(source["SalaryMonth"]).ToString("dd MMM yyyy"); destination["Description"] = ""; destination["ItemGroup"] = source["ITEMGROUP"]; destination["ItemCode"] = source["ITEMCode"]; destination["ItemID"] = source["ITEMID"]; _SalaryMonth = Convert.ToDateTime(source["SalaryMonth"]); if (_SalaryMonth.Month >= 1 && _SalaryMonth.Month < 7) { _fiscalyearStart = new DateTime(_SalaryMonth.Year - 1, 7, 1); destination["TaxMonth"] = _fiscalyearStart.ToString("MMM yyyy"); } else { _fiscalyearStart = new DateTime(_SalaryMonth.Year, 7, 1); destination["TaxMonth"] = _fiscalyearStart.ToString("MMM yyyy"); } //destination["TaxMonth"] = Payroll.BO.SystemInformation.CurrentSysInfo.TaxYearEndDate.AddMonths(1); // destination["TaxFiscalYearAmount"] = GlobalFunctions.Round(item.GetAmountOnRange(oEmp, _dFiscalYear, _SalaryMonth.AddMinutes(1), EnumSalaryGroup.Deductions, EnumSalaryItemCode.Inc_Tax_Deduction, (int)EnumSalaryItemCode.Inc_Tax_Deduction)); return destination; } else { destination["Name"] = source["Name"]; destination["TINNo"] = source["TINNo"]; destination["EMPLOYEENO"] = source["EMPLOYEENO"]; destination["Grade"] = source["Grade"]; destination["Designation"] = source["Designation"]; destination["Department"] = source["Department"]; destination["LName"] = source["LName"]; destination["JoiningDate"] = source["JoiningDate"]; destination["BName"] = source["BName"]; destination["ActualBasic"] = source["ActualBasic"]; if (source["PAYMENTMODE"].Equals(1)) { destination["PAYMENTMODE"] = "CashPayment"; } else if (source["PAYMENTMODE"].Equals(2)) { destination["PAYMENTMODE"] = "BankTransfer"; } else if (source["PAYMENTMODE"].Equals(3)) { destination["PAYMENTMODE"] = "Provision"; } //EmployeeBankAccount oemp = new EmployeeBankAccount(); //oemp = _empBankAccs.Where(x => x.EmployeeID == Convert.ToInt32(source["EmployeeID"].ToString()) && x.AccountType == EnumBankAccountType.OutPayAccount).FirstOrDefault(); //if (oemp != null) //{ // destination["ACCOUNTNO"] = oemp.AccountNo; //} //else //{ destination["ACCOUNTNO"] = source["ACCOUNTNO"]; //} destination["SalaryMonth"] = Convert.ToDateTime(source["SalaryMonth"]).ToString("dd MMM yyyy"); destination["Description"] = source["Description"]; destination["ItemGroup"] = source["ITEMGROUP"]; destination["ItemCode"] = source["ITEMCode"]; destination["ItemID"] = source["ITEMID"]; _SalaryMonth = Convert.ToDateTime(source["SalaryMonth"]); if (_SalaryMonth.Month >= 1 && _SalaryMonth.Month < 7) { _fiscalyearStart = new DateTime(_SalaryMonth.Year - 1, 7, 1); destination["TaxMonth"] = _fiscalyearStart.ToString("MMM yyyy"); } else { _fiscalyearStart = new DateTime(_SalaryMonth.Year, 7, 1); destination["TaxMonth"] = _fiscalyearStart.ToString("MMM yyyy"); } // destination["TaxFiscalYearAmount"] = GlobalFunctions.Round(item.GetAmountOnRange(oEmp, _dFiscalYear, _SalaryMonth.AddMinutes(1), EnumSalaryGroup.Deductions, EnumSalaryItemCode.Inc_Tax_Deduction, (int)EnumSalaryItemCode.Inc_Tax_Deduction)); return destination; } } private DataRow GetItem(HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable Source, string sEmpNo, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int ITemID) { foreach (DataRow odRow in Source.Rows) { if (Convert.ToString(odRow["EMPLOYEENO"]) == sEmpNo && Convert.ToInt32(odRow["ItemCode"]) == (int)itemCode && Convert.ToInt32(odRow["ItemID"]) == ITemID) { return odRow; } } return null; } public byte[] DownloadPayslip(int payrollTypeID, DateTime SalaryMonth, string sEmpID, bool isForESS) { DataSet oFDST = new DataSet(); //_empBankAccs = new List(); //_empBankAccs = new EmployeeBankAccountService().Get(); //_oGratuityParams = new ESBDefinitionService().Get(); Employee oEmployee = null; List oEmps = new List(); oEmps = new EmployeeService().GetByEmpIDs(sEmpID, payrollTypeID); List oDesigs = new DesignationService().Get(EnumStatus.Regardless, payrollTypeID); ReportProcessor reportProcessor = new ReportProcessor(); DateTime salaryMonth = SalaryMonth.LastDateOfMonth(); List oSaProcess = new List(); oSaProcess = new SalaryProcessService().Get(salaryMonth, payrollTypeID); DataTable basicInfo = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable(); if (isForESS) { foreach (SalaryProcess item in oSaProcess) { if (!item.ShowInDesktops) { throw new Exception("Salary is not approved yet."); } } } //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); DataSet oSalaryMonthlysGross = new SalaryMonthlyService().GetEmpPaySlipGrossForOthersNew(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); _dSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[1].Rows.Count > 0) { if (oSaProcess[0].PaymentDate != DateTime.MinValue) { _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); } else { _dMonthEndDate = DateTime.MinValue; } } foreach (DataRow odRow in oSalaryMonthlysGross.Tables[1].Rows) { double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); if (dbl == 0) { continue; } DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); if (oRow == null) { oRow = PayslipData.NewRow(); oRow = this.GrossMergePayslip(oRow, odRow); PayslipData.Rows.Add(oRow); } if (Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) { oRow["Earning"] = odRow["CHANGEDAMOUNT"]; } else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) { double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); oRow["Arrear"] = dArrear; } else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) { oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; } } int nCount = 0; DataSet oSalaryMonthlysDeduct = new SalaryMonthlyService().GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo = ""; DataRow[] odros = null; if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) { employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } double dGratuityAmount = 0; double dPFAmount = 0; string sTEmpEmpNo = ""; double nCurrPFAmount = 0; foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) { double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); if (dbl == 0) { continue; } DataRow oRow = null; if (employeeNo != odRow["EMPLOYEENO"].ToString()) { odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros.Length <= nCount) { oRow = PayslipData.NewRow(); oRow = this.GrossMergePayslip(oRow, odRow); PayslipData.Rows.Add(oRow); } else oRow = odros[nCount]; oRow["DeducDescription"] = odRow["Description"]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; oRow["DeducDescription"] = odRow["Description"]; //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) { nCurrPFAmount = 0; dPFAmount = 0; oEmployee = oEmps.Find(delegate (Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); if (odrosPF.Length > 0) { DataRow oRowPF = odrosPF[0]; nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); } if (oEmployee != null) { //if (_oGratuityParams.Count > 0 && _oGratuityParams != null) //{ // dGratuityAmount = GetGratuityAmount(_oGratuityParams, oEmployee, salaryMonth); //} //else //{ // dGratuityAmount = 0; //} dPFAmount = GetPFAmount(oEmployee, salaryMonth); } } oRow["Gratuity"] = dGratuityAmount; double nServiceLength = 0; if (oEmployee != null) nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmployee); if (nServiceLength > 5) { //oRow["PF"] = dPFAmount + nCurrPFAmount * 2; oRow["PF"] = dPFAmount + nCurrPFAmount; } else { oRow["PF"] = dPFAmount + nCurrPFAmount; } nCount = nCount + 1; employeeNo = odRow["EMPLOYEENO"].ToString(); sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); } nCount = 0; DataSet oSalaryMonthlysIncomeTax = new SalaryMonthlyService().GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo1 = ""; DataRow[] odros1 = null; if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) { employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) { DataRow oRow = null; if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) { odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros1.Length <= nCount) continue; oRow = odros1[nCount]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; nCount = nCount + 1; employeeNo1 = odRow["EMPLOYEENO"].ToString(); } nCount = 0; DataSet oSalaryMonthlysLaonAmount = new SalaryMonthlyService().GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); string employeeNo12 = ""; DataRow[] odros12 = null; if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) { employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); } foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) { DataRow oRow = null; if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) { odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); nCount = 0; } if (odros12.Length <= nCount) continue; oRow = odros12[nCount]; if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) { oRow["LoanDescription"] = odRow["Description"]; oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; } nCount = nCount + 1; employeeNo12 = odRow["EMPLOYEENO"].ToString(); } bool isDesigFromEmp = false;// ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); foreach (DataRow oRow in PayslipData.Rows) { Employee oEmp = oEmps .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) .SingleOrDefault(); if (oEmp != null) { if (isDesigFromEmp) { oRow["Designation"] = oEmp.DescriptionText; } else { Designation oDesg = oDesigs.Where(o => o.ID == oEmp.DesignationID).SingleOrDefault(); if (oDesg != null) { oRow["Designation"] = oDesg.Name; } } } } basicInfo = oSalaryMonthlysGross.Tables[0].Copy(); basicInfo.TableName = "BasicInfo"; DateTime joinDate = DateTime.MinValue; foreach (DataRow oRow in basicInfo.Rows) { joinDate = oRow["JoinIngDate"] == DBNull.Value ? DateTime.MinValue : Convert.ToDateTime(oRow["JoinIngDate"]); if (joinDate != DateTime.MinValue) oRow["JOININGDATE"] = joinDate.ToString("dd MMM yyyy"); if (oRow["PaymentMode"].ToString() == "1") { oRow["PaymentMode"] = "CashPayment"; oRow["AccountNO"] = oRow["OutAccountNo"]; oRow["BName"] = oRow["OutBank"]; } else if (oRow["PaymentMode"].ToString() == "2") { oRow["PaymentMode"] = "BankTransfer"; } else if (oRow["PaymentMode"] == "3") { oRow["PaymentMode"] = "Provision"; } } //DataSet dsSubReport = new DataSet(); //PayslipData.TableName = "SalaryMonthlysGross"; //dsSubReport.Tables.Add(PayslipData); //rlforPayslipdt.TableName = "RemainingLoanforPayslip"; //dsSubReport.Tables.Add(rlforPayslipdt); loanDT.TableName = "RemainingLoanforPayslip"; PayslipData.TableName = "SalaryMonthlysGross"; oFDST.Tables.Add(PayslipData); oFDST.Tables.Add(loanDT); if (PayslipData != null && PayslipData.Rows.Count <= 0) { return null; } return reportProcessor.ShowDlgForNewPaySlip(null, basicInfo, oFDST, payrollTypeID); } //public void DownloadPayslip(int payrollTypeID, DateTime SalaryMonth, string sEmpID, bool isForESS) //{ // DataSet oFDST = new DataSet(); // byte[] bytes = null; // _empBankAccs = new List(); // _empBankAccs = new EmployeeBankAccountService().Get(); // _oGratuityParams = new ESBDefinitionService().Get(); // Employee oEmployee = null; // List oEmps = new List(); // oEmps = new EmployeeService().GetByEmpNos(sEmpID); // List oDesigs = new DesignationService().Get(EnumStatus.Regardless, payrollTypeID); // ReportProcessor reportProcessor = new ReportProcessor(); // DateTime salaryMonth = SalaryMonth.LastDateOfMonth(); // List oSaProcess = new List(); // oSaProcess = new SalaryProcessService().Get(salaryMonth, payrollTypeID); // if (isForESS) // { // foreach (SalaryProcess item in oSaProcess) // { // if (!item.ShowInDesktops) // { // throw new Exception("Salary is not approved yet."); // } // } // } // //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); // DataSet oSalaryMonthlysGross = new SalaryMonthlyService().GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // //HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipDatatemp = new HRM.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new HRM.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); // //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); // DataTable PayslipDatatemp = new DataTable(); // DataTable loanDatatemp = new DataTable(); // _dSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); // if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[0].Rows.Count > 0) // { // if (oSaProcess[0].PaymentDate != DateTime.MinValue) // { // _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); // } // else // { // _dMonthEndDate = DateTime.MinValue; // } // } // foreach (DataRow odRow in oSalaryMonthlysGross.Tables[0].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMergePayslip(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // if (Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) // { // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // { // double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // oRow["Arrear"] = dArrear; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // { // oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; // } // } // int nCount = 0; // DataSet oSalaryMonthlysDeduct = new SalaryMonthlyService().GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo = ""; // DataRow[] odros = null; // if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) // { // employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // double dGratuityAmount = 0; // double dPFAmount = 0; // string sTEmpEmpNo = ""; // double nCurrPFAmount = 0; // foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = null; // if (employeeNo != odRow["EMPLOYEENO"].ToString()) // { // odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros.Length <= nCount) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMergePayslip(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // else oRow = odros[nCount]; // oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // oRow["DeducDescription"] = odRow["Description"]; // //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) // { // nCurrPFAmount = 0; // dPFAmount = 0; // oEmployee = oEmps.Find(delegate (Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); // if (odrosPF.Length > 0) // { // DataRow oRowPF = odrosPF[0]; // nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); // } // if (oEmployee != null) // { // if (_oGratuityParams.Count > 0 && _oGratuityParams != null) // { // dGratuityAmount = GetGratuityAmount(_oGratuityParams, oEmployee, salaryMonth); // } // else // { // dGratuityAmount = 0; // } // dPFAmount = GetPFAmount(oEmployee, salaryMonth); // } // } // oRow["Gratuity"] = dGratuityAmount; // double nServiceLength = 0; // if (oEmployee != null) // nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmployee); // if (nServiceLength > 5) // { // //oRow["PF"] = dPFAmount + nCurrPFAmount * 2; // oRow["PF"] = dPFAmount + nCurrPFAmount; // } // else // { // oRow["PF"] = dPFAmount + nCurrPFAmount; // } // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); // } // nCount = 0; // DataSet oSalaryMonthlysIncomeTax = new SalaryMonthlyService().GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo1 = ""; // DataRow[] odros1 = null; // if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) // { // employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) // { // odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros1.Length <= nCount) continue; // oRow = odros1[nCount]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) // oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; // nCount = nCount + 1; // employeeNo1 = odRow["EMPLOYEENO"].ToString(); // } // nCount = 0; // DataSet oSalaryMonthlysLaonAmount = new SalaryMonthlyService().GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo12 = ""; // DataRow[] odros12 = null; // if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) // { // employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) // { // odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros12.Length <= nCount) continue; // oRow = odros12[nCount]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) // { // oRow["LoanDescription"] = odRow["Description"]; // oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; // } // nCount = nCount + 1; // employeeNo12 = odRow["EMPLOYEENO"].ToString(); // } // bool isDesigFromEmp = false;// ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); // foreach (DataRow oRow in PayslipData.Rows) // { // Employee oEmp = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .SingleOrDefault(); // if (oEmp != null) // { // if (isDesigFromEmp) // { // oRow["Designation"] = oEmp.DescriptionText; // } // else // { // Designation oDesg = oDesigs.Where(o => o.ID == oEmp.DesignationID).SingleOrDefault(); // if (oDesg != null) // { // oRow["Designation"] = oDesg.Name; // } // } // } // } // foreach (Employee emp in oEmps) // { // if (oFDST.Tables.Count > 0) // { // oFDST.Tables.Remove("PayrollDataSet_LoanData"); // oFDST.Tables.Remove("PayrollDataSet_Payslip"); // } // PayslipDatatemp = PayslipData.AsEnumerable().Where(x => x["EMPLOYEENO"].ToString() == emp.EmployeeNo).Any() ? PayslipData.AsEnumerable().Where(x => x["EMPLOYEENO"].ToString() == emp.EmployeeNo).CopyToDataTable() : new DataTable(); // loanDatatemp = loanDT.AsEnumerable().Where(x => x["EMPLOYEENO"].ToString() == emp.EmployeeNo).Any() ? loanDT.AsEnumerable().Where(x => x["EMPLOYEENO"].ToString() == emp.EmployeeNo).CopyToDataTable() : new DataTable(); // loanDatatemp.TableName = "PayrollDataSet_LoanData"; // PayslipDatatemp.TableName = "PayrollDataSet_Payslip"; // oFDST.Tables.Add(PayslipDatatemp); // oFDST.Tables.Add(loanDatatemp); // bytes = reportProcessor.GetPayslipReport(null, oFDST, payrollTypeID); // //MailSender mailSender = new MailSender(); // //mailSender.AddTo(emp.EmailAddress.ToString()); // //mailSender.Subject = "Payslip for the month " + salaryMonth.ToString("MMM yyyy"); // Attachment att = new Attachment(new MemoryStream(bytes), "Payslip.pdf"); // //mailSender.Body = "

" + "" + "

"; // //mailSender.SendMail(emailSettings, att); // //System.Threading.Thread.Sleep(60000); // } //} //public byte[] ShowBanglaPaySlip(int payrollTypeId, DateTime salaryMonth, int reportId, string sEmpID, string reportType) //{ // ReportProcessor form = new ReportProcessor(); // string RDLCName = "HRM.Report.RDLC.BanglaPayslip.rdlc"; // string[] sEmp = sEmpID.Split(','); // TotalEmp = sEmp.Length; // DataTable dtExtendedSalarySheet = ExtendedSalarySheet(salaryMonth, sEmpID); // dtExtendedSalarySheet.TableName = "PayrollDataSet_ExtendedSalarySheet"; // PayrollDataSet.PayrollDataSet.ExtendedSalarySheetDataTable _extendedSalarySheet; // DataSet resultDataSet = new DataSet(); // resultDataSet.Tables.Add(dtExtendedSalarySheet); // _extendedSalarySheet = new PayrollDataSet.PayrollDataSet.ExtendedSalarySheetDataTable(); // List reportParameters = new List(); // //ReportParameter rParam = new ReportParameter("ReportType", reportType); // //reportParameters.Add(rParam); // return form.CommonReportView(null, RDLCName, resultDataSet, null, reportParameters, true, payrollTypeId, reportType); //} //public void PrepareReport( string empIds) //{ // MailSender oMailSender = new MailSender(); // List _ToSendEmps = new List(); // lblEmployee.Text = ""; // lblEmployee.Refresh(); // PaySlip _payslip = new PaySlip(); // if (ctlEmployee.SelectedEmployee != null) // { // _ToSendEmps.Add((SearchEmployee)ctlEmployee.SelectedEmployee); // } // else if (lsvEmployee.CheckedItems.Count > 0) // { // int index = 0; // foreach (ListViewItem item in lsvEmployee.CheckedItems) // { // _ToSendEmps.Add((SearchEmployee)lsvEmployee.CheckedItems[index++].Tag); // } // } // if (_ToSendEmps.Count > 0) // { // string path = string.Empty; // string filename = string.Empty; // byte[] filetoSendBytes = null; // int count = 0; // try // { // this.Cursor = Cursors.WaitCursor; // EnumSendMail sendMail = EnumSendMail.None; // foreach (SearchEmployee item in _ToSendEmps) // { // lblEmployee.Text = "Sending Mail :" + (++count).ToString() + "/" + _ToSendEmps.Count; // lblEmployee.Refresh(); // if (_Type == 1) // filetoSendBytes = _payslip.ShowReport(dtpfromDate.Value, item.EmployeeID.Integer.ToString()); // else // filetoSendBytes = _payslip.SKFExpencesPaySlip1(dtpfromDate.Value, item.EmployeeID.Integer.ToString()); // if (filetoSendBytes != null) // { // if (!Directory.Exists(Application.StartupPath + @"\Report")) // { // DirectoryInfo dirInfo = new DirectoryInfo(Application.StartupPath + @"\Report"); // dirInfo.Create(); // } // if (_Type == 1) // filename = "Payslip_" + item.EmployeeNo + "-" + dtpfromDate.Value.Month + "-" + dtpfromDate.Value.Year + "_" + DateTime.Now.ToString("hh_mm_ss") + ".pdf"; // else // filename = "Expense_" + item.EmployeeNo + "-" + dtpfromDate.Value.Month + "-" + dtpfromDate.Value.Year + "_" + DateTime.Now.ToString("hh_mm_ss") + ".pdf"; // path = Application.StartupPath + @"\Report\" + filename; // using (FileStream fs = new FileStream(path, FileMode.Create)) // { // fs.Write(filetoSendBytes, 0, filetoSendBytes.Length); // fs.Dispose(); // } // sendMail = SendMail(item, path, _Type); // switch (sendMail) // { // case EnumSendMail.ToMissing: // MessageBox.Show("Employee mail address is missing", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error); // break; // case EnumSendMail.FromMissing: // MessageBox.Show("Missing from address", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error); // break; // case EnumSendMail.BodyMissing: // MessageBox.Show("Missing mail body", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error); // break; // case EnumSendMail.SubjectMissing: // MessageBox.Show("Mail subject is missing", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error); // break; // case EnumSendMail.ServerNotFound: // MessageBox.Show("Server not found", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error); // break; // case EnumSendMail.SendError: // MessageBox.Show("Sending Mail Error", item.EmployeeNo, MessageBoxButtons.OK, MessageBoxIcon.Error); // break; // default: // break; // } // } // } // if (sendMail == EnumSendMail.SuccessFullySend) // { // lblEmployee.Text = string.Empty; // lblEmployee.Refresh(); // MessageBox.Show("Mail Sent Successfully", "Payslip", MessageBoxButtons.OK, MessageBoxIcon.Information); // } // this.Cursor = Cursors.Default; // } // catch (Exception ex) // { // MessageBox.Show(this, ex.Message, "Error Sending Mail", MessageBoxButtons.OK, MessageBoxIcon.Error); // lblEmployee.Text = string.Empty; // lblEmployee.Refresh(); // this.Cursor = Cursors.Default; // } // } //} //private EnumSendMail SendMail(SearchEmployee item, string sPath, int nType) //{ // MS = new MailSender(); // MS.To = item.EmployeeEmail; // "sujon.ahmed@celimited.com"; // if (nType == 1) // { // MS.Subject = "Salary Pay slip of " + dtpfromDate.Value.ToString("MMMM yyyy"); // StringBuilder sb = new StringBuilder(); // sb.AppendLine("Dear " + item.Name + "
"); // sb.AppendLine("Attached the pay slip of your Salary of " + dtpfromDate.Value.ToString("MMMM yyyy") + "." + "
"); // sb.AppendLine("If you have any query, please contact with any resposible person." + "
"); // //sb.AppendLine("1. Mr. Md. Suzaet Hossain-Asstt. Manager-HR & Payroll, mobile-01729073233, email: suzaet@skf.transcombd.com" + "
"); // //sb.AppendLine("2. Mr. Md. Shahabuddin Molla- HR Manager, Operations, mobile-01714098171, email: sum@skf.transcombd.com" + "
"); // //sb.AppendLine("3. Mr. K. M. Shirazul Haque- Sr. HR Manager, Operations, mobile-01713065410, email: shiraz@skf.transcombd.com" + "
"); // MS.Body = sb.ToString(); // } // else if (nType == 2) // { // MS.Subject = "Expense Pay slip of " + dtpfromDate.Value.ToString("MMMM yyyy"); // StringBuilder sb = new StringBuilder(); // sb.AppendLine("Dear " + item.Name + "
"); // sb.AppendLine("Attached the pay slip of your Expense of " + dtpfromDate.Value.ToString("MMMM yyyy") + "." + "
"); // sb.AppendLine("If you have any query, please contact with anyone under mentioned personnel:" + "
"); // sb.AppendLine("1. Mr. Md. Suzaet Hossain-Asstt. Manager-HR & Payroll, mobile-01729073233, email: suzaet@skf.transcombd.com" + "
"); // sb.AppendLine("2. Mr. Md. Shahabuddin Molla- HR Manager, Operations, mobile-01714098171, email: sum@skf.transcombd.com" + "
"); // sb.AppendLine("3. Mr. K. M. Shirazul Haque- Sr. HR Manager, Operations, mobile-01713065410, email: shiraz@skf.transcombd.com" + "
"); // MS.Body = sb.ToString(); // } // MS.AddAttachment(sPath); // return MS.SendPaySlipMail(); //} } } #region old //namespace Payroll.Report //{ // public class PaySlip // { // DataSet dSet = new DataSet(); // private ReportSetup _selectedParameter; // ObjectsTemplate _oGratuityParams = null; // private DateTime _dSalaryMonth = DateTime.MinValue; // private DateTime _dMonthEndDate = DateTime.MinValue; // DataTable _hourTable = null; // ObjectsTemplate _termParamenters = null; // TermParameter termParam = null; // private double _InvestmentAmount = 0.0; // private double _TotalTaxAmount = 0.0; // private double _LessExemptedAmount = 0.0; // private double _PaidTillDateAmount = 0.0; // private double _ThisMonthAmount = 0.0; // private double _ProjectedAmount = 0.0; // private double _AmountPerAnnum = 0.0; // private double _TotalSalaryExempted = 0.0; // private double _TotalAnnuaExempted = 0.0; // private double _TPaidTillDateAmount = 0.0; // private double _TThisMonthAmount = 0.0; // private double _TProjectedAmount = 0.0; // private double _TAmountPerAnnum = 0.0; // private double _pfInvestment; // private double _otherInvestment; // private double _investmentAllowed; // private double _20Investment; // private ObjectsTemplate _incometaxes; // private TaxParameter _taxParameter; // private Employee _employee; // private bool _investmentwithoutPF; // private bool _IsTaxCertificate; // private double _actualInvestment; // private bool _isPrvs = false; // DataSet _dSet = new DataSet(); // public PaySlip() // { // } // public ReportSetup SelectedParameter // { // set // { // _selectedParameter = value; // } // } // private DataRow GrossMerge(DataRow destination, DataRow source) // { // if (Convert.ToInt32(source["ItemGroup"]) == 3) // { // destination["Name"] = source["Name"]; // destination["EMPLOYEENO"] = source["EMPLOYEENO"]; // destination["Grade"] = source["Grade"]; // destination["Designation"] = source["Designation"]; // destination["Department"] = source["Department"]; // destination["ActualBasic"] = source["ActualBasic"]; // if (Convert.ToInt16(source["PAYMENTMODE"].ToString().Trim()) == (int)EnumPaymentMode.CashPayment) // { // destination["PAYMENTMODE"] = "CashPayment"; // } // else if (Convert.ToInt16(source["PAYMENTMODE"].ToString().Trim()) == (int)EnumPaymentMode.BankTransfer) // { // destination["PAYMENTMODE"] = "BankTransfer"; // } // else if (Convert.ToInt16(source["PAYMENTMODE"].ToString().Trim()) == (int)EnumPaymentMode.Provision) // { // destination["PAYMENTMODE"] = "Provision"; // } // destination["BName"] = source["BName"]; // destination["ACCOUNTNO"] = source["ACCOUNTNO"]; // if (_dMonthEndDate != DateTime.MinValue) // { // destination["MonthEndDate"] = Convert.ToDateTime(_dMonthEndDate.ToString("dd MMM yyyy")); // } // else // { // destination["MonthEndDate"] = DateTime.MinValue; // } // destination["SalaryMonth"] = Convert.ToDateTime(_dSalaryMonth.ToString("MMM yyyy")); // destination["Description"] = ""; // destination["ItemGroup"] = source["ITEMGROUP"]; // destination["ItemCode"] = source["ITEMCode"]; // destination["ItemID"] = source["ITEMID"]; // destination["JoiningDate"] = Convert.ToDateTime(source["JoiningDate"]).ToString("dd MMM yyyy"); // destination["TINNo"] = source["TINNo"]; // return destination; // } // else // { // destination["Name"] = source["Name"]; // destination["EMPLOYEENO"] = source["EMPLOYEENO"]; // destination["Grade"] = source["Grade"]; // destination["Designation"] = source["Designation"]; // destination["Department"] = source["Department"]; // destination["ActualBasic"] = source["ActualBasic"]; // if (Convert.ToInt16(source["PAYMENTMODE"].ToString().Trim()) == (int)EnumPaymentMode.CashPayment) // { // destination["PAYMENTMODE"] = "CashPayment"; // } // else if (Convert.ToInt16(source["PAYMENTMODE"].ToString().Trim()) == (int)EnumPaymentMode.BankTransfer) // { // destination["PAYMENTMODE"] = "BankTransfer"; // } // else if (Convert.ToInt16(source["PAYMENTMODE"].ToString().Trim()) == (int)EnumPaymentMode.Provision) // { // destination["PAYMENTMODE"] = "Provision"; // } // destination["BName"] = source["BName"]; // destination["ACCOUNTNO"] = source["ACCOUNTNO"]; // if (_dMonthEndDate != DateTime.MinValue) // { // destination["MonthEndDate"] = Convert.ToDateTime(_dMonthEndDate.ToString("dd MMM yyyy")); // } // else // { // destination["MonthEndDate"] = DateTime.MinValue; // } // destination["SalaryMonth"] = Convert.ToDateTime(_dSalaryMonth.ToString("MMM yyyy")); // //********* // //Added by Chapal // if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1) // { // destination["Description"] = source["Description"]; // } // else // { // if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Basic_Salary) && Convert.ToInt32(source["ItemID"]) == (int)EnumSalaryItemCode.Basic_Salary) // { // decimal hour = (decimal)_hourTable.AsEnumerable().Where(x => x.Field("ItemGroup") == (int)EnumSalaryGroup.Miscellaneous // && x.Field("ItemCode") == (int)EnumSalaryItemCode.Basic_Salary // && x.Field("ItemID") == (int)EnumSalaryItemCode.Basic_Salary // && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()) // .Sum(o => Convert.ToDouble(o["ChangedAmount"].ToString())); // //destination["Description"] = source["Description"] + " (" + hour + " Hours)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Over_Time_Amount))//'Over Time' // { // decimal hour = 0; // if ((Convert.ToInt32(source["ITEMID"]) == 2)) // { // termParam = _termParamenters.Where(o => o.TermID.Integer == 2).FirstOrDefault(); // hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Over_Time_Hours && Convert.ToInt32(x["ItemID"]) == Convert.ToInt32(source["ItemID"]) && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()).Sum(o => o.Field("ChangedAmount")); // hour = hour * Convert.ToDecimal((termParam.Amount / 100)); // hour = hour / 2; // //destination["Description"] = source["Description"] + " (" + hour + " Hours)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMID"]) == (int)3)) // { // termParam = _termParamenters.Where(o => o.TermID.Integer == 3).FirstOrDefault(); // hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Over_Time_Hours && Convert.ToInt32(x["ItemID"]) == Convert.ToInt32(source["ItemID"]) && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()).Sum(o => o.Field("ChangedAmount")); // hour = hour * Convert.ToDecimal((termParam.Amount / 100)); // hour = hour / 2; // //destination["Description"] = source["Description"] + " (" + hour + " Hours)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMID"]) == (int)4)) // { // termParam = _termParamenters.Where(o => o.TermID.Integer == 4).FirstOrDefault(); // hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Over_Time_Hours && Convert.ToInt32(x["ItemID"]) == Convert.ToInt32(source["ItemID"]) && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()).Sum(o => o.Field("ChangedAmount")); // hour = hour * Convert.ToDecimal((termParam.Amount / 100)); // hour = hour / 2; // //destination["Description"] = source["Description"] + " (" + hour + " Hours)"; // destination["Description"] = source["Description"]; // } // else // { // hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Over_Time_Hours && Convert.ToInt32(x["ItemID"]) == Convert.ToInt32(source["ItemID"]) && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()).Sum(o => o.Field("ChangedAmount")); // //destination["Description"] = source["Description"] + " (" + hour + " Hours)"; // destination["Description"] = source["Description"]; // } // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Allowance) && Convert.ToInt32(source["ItemID"]) == 107) //T shift // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Allowance && Convert.ToInt32(x["ItemID"]) == 107 && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()).Sum(o => o.Field("ChangedAmount")); // //destination["Description"] = source["Description"] + " (" + hour + " Days)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Allowance) && Convert.ToInt32(source["ItemID"]) == 13) //Tea Allowance // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Allowance && Convert.ToInt32(x["ItemID"]) == 13 && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()).Sum(o => o.Field("ChangedAmount")); // //destination["Description"] = source["Description"] + " (" + hour + " Days)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Allowance) && Convert.ToInt32(source["ItemID"]) == 106) // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Allowance && Convert.ToInt32(x["ItemID"]) == 106 && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()).Sum(o => o.Field("ChangedAmount")); // //destination["Description"] = source["Description"] + " (" + hour + " Days)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Allowance) && Convert.ToInt32(source["ItemID"]) == 82) // Convence // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Allowance && Convert.ToInt32(x["ItemID"]) == 82 && x["EMPLOYEENO"].ToString() == source["EMPLOYEENO"].ToString()).Sum(o => o.Field("ChangedAmount")); // //destination["Description"] = source["Description"] + " (" + hour + " Days)"; // destination["Description"] = source["Description"]; // } // else // { // destination["Description"] = source["Description"]; // } // } // //******* // destination["ItemGroup"] = source["ITEMGROUP"]; // destination["ItemCode"] = source["ITEMCode"]; // destination["ItemID"] = source["ITEMID"]; // destination["JoiningDate"] = Convert.ToDateTime(source["JoiningDate"]).ToString("dd MMM yyyy"); // destination["TINNo"] = source["TINNo"]; // return destination; // } // } // private DataRow GrossMergeForOverAll(DataRow destination, DataRow source, int nTotalEmp, DateTime sMonth) // { // destination["TotalEmp"] = nTotalEmp; // if (source["Description"].ToString().Contains("'")) // { // source["Description"] = source["Description"].ToString().Replace("'", "\'"); // } // else if (source["Description"].ToString().Contains("/")) // { // source["Description"] = source["Description"].ToString().Replace("/", "/'"); // } // else // { // source["Description"] = source["Description"]; // } // //Added by Chapal // if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1) // { // destination["Description"] = source["Description"]; // } // else // { // if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Basic_Salary) && Convert.ToInt32(source["ItemID"]) == (int)EnumSalaryItemCode.Basic_Salary) // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Basic_Salary && Convert.ToInt32(x["ItemID"]) == (int)EnumSalaryItemCode.Basic_Salary ).Sum(o => o.Field("Amount")); // //destination["Description"] = source["Description"] + " (" + hour + " Hours)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Over_Time_Amount))//'Over Time' // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Over_Time_Hours && Convert.ToInt32(x["ItemID"]) == Convert.ToInt32(source["ItemID"])).Sum(o => o.Field("Amount")); // //destination["Description"] = source["Description"] + " (" + hour + " Hours)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Allowance) && Convert.ToInt32(source["ItemID"]) == 107) //T shift // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Allowance && Convert.ToInt32(x["ItemID"]) == 107).Sum(o => o.Field("Amount")); // //destination["Description"] = source["Description"] + " (" + hour + " Days)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Allowance) && Convert.ToInt32(source["ItemID"]) == 13) //Tea Allowance // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Allowance && Convert.ToInt32(x["ItemID"]) == 13).Sum(o => o.Field("Amount")); // //destination["Description"] = source["Description"] + " (" + hour + " Days)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Allowance) && Convert.ToInt32(source["ItemID"]) == 106) // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Allowance && Convert.ToInt32(x["ItemID"]) == 106).Sum(o => o.Field("Amount")); // //destination["Description"] = source["Description"] + " (" + hour + " Days)"; // destination["Description"] = source["Description"]; // } // else if ((Convert.ToInt32(source["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross) && (Convert.ToInt32(source["ItemCode"]) == (int)EnumSalaryItemCode.Allowance) && Convert.ToInt32(source["ItemID"]) == 82) // Convence // { // decimal hour = _hourTable.AsEnumerable().Where(x => Convert.ToInt32(x["ItemGroup"]) == (int)EnumSalaryGroup.Miscellaneous && Convert.ToInt32(x["ItemCode"]) == (int)EnumSalaryItemCode.Allowance && Convert.ToInt32(x["ItemID"]) == 82).Sum(o => o.Field("Amount")); // //destination["Description"] = source["Description"] + " (" + hour + " Days)"; // destination["Description"] = source["Description"]; // } // else // { // destination["Description"] = source["Description"]; // } // } // destination["ItemGroup"] = source["ITEMGROUP"]; // destination["ItemCode"] = source["ITEMCode"]; // destination["ItemID"] = source["ITEMID"]; // destination["Month"] = sMonth; // return destination; // } // private DataRow GetItem(PayrollDataSet.PayrollDataSet.PayslipDataTable Source, string sEmpNo, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int ITemID) // { // foreach (DataRow odRow in Source.Rows) // { // if (Convert.ToString(odRow["EMPLOYEENO"]) == sEmpNo && // Convert.ToInt32(odRow["ItemCode"]) == (int)itemCode && Convert.ToInt32(odRow["ItemID"]) == ITemID) // { // return odRow; // } // } // return null; // } // private DataRow GetItem(PayrollDataSet.PayrollDataSet.PayslipDataTable Source, string sEmpNo, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int ITemID, string position) // { // foreach (DataRow odRow in Source.Rows) // { // if (Convert.ToString(odRow["EMPLOYEENO"]) == sEmpNo && // Convert.ToInt32(odRow["ItemCode"]) == (int)itemCode && Convert.ToInt32(odRow["ItemID"]) == ITemID && Convert.ToString(odRow["Position"]) == position) // { // return odRow; // } // } // return null; // } // private DataRow GetItemForOverAll(PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable Source, EnumSalaryGroup groupCode, EnumSalaryItemCode itemCode, int ITemID) // { // foreach (DataRow odRow in Source.Rows) // { // if (Convert.ToInt32(odRow["ItemCode"]) == (int)itemCode && Convert.ToInt32(odRow["ItemID"]) == ITemID) // { // return odRow; // } // } // return null; // } // //Added By Anup 21 Dec 2010 : ShowReport For Send Mail Individual Payslip // public byte[] ShowReport(string sEmpID, DateTime salaryMonth) // { // fReportViewer form = new fReportViewer(); // ReportItem _reportItem = new ReportItem(); // _reportItem = ReportItem.Get(ID.FromInteger(Convert.ToInt32(41))); // DataSet oSalaryMonthlys = SalaryMonthly.GetEmpPaySlipGross(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) // { // DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // oRow["Arrear"] = odRow["CHANGEDAMOUNT"]; // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; // } // int nCount = 0; // oSalaryMonthlys = SalaryMonthly.GetEmpPaySlipDeduct(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo = ""; // DataRow[] odros = null; // if (oSalaryMonthlys.Tables[0].Rows.Count > 0) // { // employeeNo = oSalaryMonthlys.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlys.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo != odRow["EMPLOYEENO"].ToString()) // { // odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros.Length <= nCount) continue; // oRow = odros[nCount]; // oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // } // int nCount1 = 0; // oSalaryMonthlys = SalaryMonthly.GetEmpPaySlipIncomeTaxAmount(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo1 = ""; // DataRow[] odros1 = null; // if (oSalaryMonthlys.Tables[0].Rows.Count > 0) // { // employeeNo1 = oSalaryMonthlys.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlys.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) // { // odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount1 = 0; // } // if (odros1.Length <= nCount1) continue; // oRow = odros1[nCount1]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem)) // oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // } // return form.WriteFileForPaySlip(_reportItem, PayslipData); // } // private double ServiceYears(DateTime dt, Employee oEmp) // { // double n = Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("d", oEmp.JoiningDate, dt); // if (n >= 365) // return n / 365; // else // return 0.0; // } // public double GetGratuityAmount(ObjectsTemplate oItems, Employee oEmp, DateTime salaryMonth) // { // double nAmout = 0.0; // double nFracYear = 0.0; // ESBDefinition item = ESBDefinition.Get(oItems, oEmp); // double nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmp); // foreach (ESBSlab eslb in item.ESBSlabs) // { // nAmout = 0.0; // if (eslb.ServiceYear <= nServiceLength) // { // string[] sFracMonth = nServiceLength.ToString().Split(new char[] { '.' }); // nFracYear = 0; // if (sFracMonth.Length > 1) // nFracYear = GlobalFunctions.Round(Convert.ToDouble("." + sFracMonth[1])); // if (nFracYear >= 0.5) // { // nServiceLength = Convert.ToDouble(sFracMonth[0]) + 1; // } // else // { // nServiceLength = Convert.ToDouble(sFracMonth[0]); // } // nAmout = oEmp.BasicSalary * eslb.CalculateNo * nServiceLength; // } // else // { // nAmout = 0; // } // } // return nAmout; // } // public double GetPFAmount(Employee oEmp, DateTime salaryMonth) // { // double nAmout = 0.0; // DataSet ds = PFTransaction.GetPFBalance(oEmp.ID.Integer, GlobalFunctions.LastDateOfMonth(salaryMonth)); // double nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmp); // foreach (DataRow dr in ds.Tables[0].Rows) // { // if (Convert.ToInt16(dr["TranTP"]) == 1) // { // nAmout = Convert.ToDouble(dr["Amount"]); // } // //if (nServiceLength > 5) // //{ // // nAmout += Convert.ToDouble(dr["Amount"]); // //} // //else // //{ // // if (Convert.ToInt16(dr["TranTP"]) != 2) // // { // // nAmout += Convert.ToDouble(dr["Amount"]); // // } // //} // } // return nAmout; // } // //public void ShowReport() // //{ // // _oGratuityParams = ESBDefinition.Get(); // // Employee oEmployee = null; // // ObjectsTemplate oEmps = new ObjectsTemplate(); // // oEmps = Employee.Get(); // // ObjectsTemplate oLoanScheduls = new ObjectsTemplate(); // // oLoanScheduls = LoanSchedule.Get(); // // //ObjectsTemplate oLoanIssues = new ObjectsTemplate(); // // //oLoanIssues = LoanIssue.GetE Get(); // // fReportViewer form = new fReportViewer(); // // DateTime salaryMonth = _selectedParameter.FromDate.Value; // // string sEmpID = _selectedParameter.ReportItem.INSQL; // // SalaryProcess oSaProcess = new SalaryProcess(); // // //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); // // DataSet oSalaryMonthlysGross = SalaryMonthly.GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // // PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // // //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); // // foreach (DataRow odRow in oSalaryMonthlysGross.Tables[0].Rows) // // { // // DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); // // if (oRow == null) // // { // // oRow = PayslipData.NewRow(); // // oRow = this.GrossMerge(oRow, odRow); // // PayslipData.Rows.Add(oRow); // // } // // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // // oRow["Arrear"] = odRow["CHANGEDAMOUNT"]; // // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // // oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; // // } // // int nCount = 0; // // DataSet oSalaryMonthlysDeduct = SalaryMonthly.GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // // string employeeNo = ""; // // DataRow[] odros = null; // // if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) // // { // // employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // // odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // // } // // //if(oSalaryMonthlysDeduct.Tables[0].Rows.Count>oSalaryMonthlysGross.Tables[0].Rows.Count) // // //{ // // // odros=new DataRow[oSalaryMonthlysDeduct.Tables[0].Rows.Count]; // // //} // // foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) // // { // // DataRow oRow = null; // // if (employeeNo != odRow["EMPLOYEENO"].ToString()) // // { // // odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // // nCount = 0; // // } // // if (odros.Length <= nCount) // // { // // oRow = PayslipData.NewRow(); // // oRow = this.GrossMerge(oRow, odRow); // // PayslipData.Rows.Add(oRow); // // } // // else oRow = odros[nCount]; // // //if (odros.Length <= nCount) continue; // // //oRow = odros[nCount]; // // oRow["DeducDescription"] = odRow["Description"]; // // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // // oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // // //GetGratuityAmount(_oGratuityParams, oEmployee); // // // GetPFAmount(oEmployee); // // //Gratuity // // if (oEmployee != null) // // { // // if (_oGratuityParams.Count > 0 && _oGratuityParams != null) // // { // // oRow["Gratuity"] = GetGratuityAmount(_oGratuityParams, oEmployee); // // } // // else // // { // // oRow["Gratuity"] = 0; // // } // // oRow["PF"] = GetPFAmount(oEmployee); // // } // // #region Loan Issue // // ////Personal Loan // // //if ((Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment) && ((Convert.ToInt32(odRow["ItemID"]) == 3))) // // //{ // // // loanAmounn = 0.0; // // // actuInterest = 0.0; // // // principleAmount = 0.0; // // // interest = 0.0; // // // balance = 0.0; // // // sattelmentAmount = 0.0; // // // LoanIssue oLIssue=LoanIssue.GetExistingLoan(ID.FromInteger(Convert.ToInt32(odRow["ItemID"])),oEmployee.ID); // // // //LoanIssue oLIssue = oLoanIssues.Find(delegate(LoanIssue item1) { return oEmployee.ID == item1.EmployeeID && item1.LoanID == ID.FromInteger(Convert.ToInt32(odRow["ItemID"])); }); // // // if (oLIssue != null) // // // { // // // loanAmounn = oLIssue.LoanAmount; // // // List oLSS = oLoanScheduls.FindAll(delegate(LoanSchedule oitem) { return oitem.LoanIssueID == oLIssue.ID; }); // // // if (oLSS.Count>0) // // // { // // // List oBeforeSMonths = oLSS.FindAll(delegate(LoanSchedule oitem) { return oitem.DueInstallmentDate <= GlobalFunctions.LastDateOfMonth(salaryMonth); }); // // // foreach (LoanSchedule oScedule in oBeforeSMonths) // // // { // // // actuInterest = actuInterest + oScedule.ActualInterest; // // // principleAmount = principleAmount + oScedule.InstallmentPrincipal; // // // interest = interest + oScedule.InstallmentInterest; // // // balance = balance + oScedule.OpeningBalance; // // // //oTemLoanSchedule.Add(oScedule); // // // } // // // } // // // sattelmentAmount = (loanAmounn + actuInterest) - (principleAmount + interest); // // // } // // // oRow["PersonalLoan"] = sattelmentAmount;//odRow["CHANGEDAMOUNT"]; // // //} // // //Vehicle Loan // // //if ((Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment && (Convert.ToInt32(odRow["ItemID"]) == 4))) // // //{ // // // loanAmounn = 0.0; // // // actuInterest = 0.0; // // // principleAmount = 0.0; // // // interest = 0.0; // // // balance = 0.0; // // // sattelmentAmount = 0.0; // // // LoanIssue oLIssue=LoanIssue.GetExistingLoan(ID.FromInteger(Convert.ToInt32(odRow["ItemID"])),oEmployee.ID); // // // //LoanIssue oLIssue = oLoanIssues.Find(delegate(LoanIssue item1) { return oEmployee.ID == item1.EmployeeID && item1.LoanID == ID.FromInteger(Convert.ToInt32(odRow["ItemID"])); }); // // // if (oLIssue != null) // // // { // // // loanAmounn = oLIssue.LoanAmount; // // // List oLSS = oLoanScheduls.FindAll(delegate(LoanSchedule oitem) { return oitem.LoanIssueID == oLIssue.ID; }); // // // if (oLSS.Count > 0) // // // { // // // List oBeforeSMonths = oLSS.FindAll(delegate(LoanSchedule oitem) { return oitem.DueInstallmentDate <= GlobalFunctions.LastDateOfMonth(salaryMonth); }); // // // foreach (LoanSchedule oScedule in oBeforeSMonths) // // // { // // // actuInterest = actuInterest + oScedule.ActualInterest; // // // principleAmount = principleAmount + oScedule.InstallmentPrincipal; // // // interest = interest + oScedule.InstallmentInterest; // // // balance = balance + oScedule.OpeningBalance; // // // //oTemLoanSchedule.Add(oScedule); // // // } // // // } // // // sattelmentAmount = (loanAmounn + actuInterest) - (principleAmount + interest); // // // } // // // oRow["VechileLoan"] = sattelmentAmount;//odRow["CHANGEDAMOUNT"]; // // //} // // //House Loan // // //if ((Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment && (Convert.ToInt32(odRow["ItemID"]) == 2))) // // //{ // // // loanAmounn = 0.0; // // // actuInterest = 0.0; // // // principleAmount = 0.0; // // // interest = 0.0; // // // balance = 0.0; // // // sattelmentAmount = 0.0; // // // LoanIssue oLIssue=LoanIssue.GetExistingLoan(ID.FromInteger(Convert.ToInt32(odRow["ItemID"])),oEmployee.ID); // // // //LoanIssue oLIssue = oLoanIssues.Find(delegate(LoanIssue item1) { return oEmployee.ID == item1.EmployeeID && item1.LoanID == ID.FromInteger(Convert.ToInt32(odRow["ItemID"])); }); // // // if (oLIssue != null) // // // { // // // loanAmounn = oLIssue.LoanAmount; // // // List oLSS = oLoanScheduls.FindAll(delegate(LoanSchedule oitem) { return oitem.LoanIssueID == oLIssue.ID; }); // // // if (oLSS.Count > 0) // // // { // // // List oBeforeSMonths = oLSS.FindAll(delegate(LoanSchedule oitem) { return oitem.DueInstallmentDate <= GlobalFunctions.LastDateOfMonth(salaryMonth); }); // // // foreach (LoanSchedule oScedule in oBeforeSMonths) // // // { // // // actuInterest = actuInterest + oScedule.ActualInterest; // // // principleAmount = principleAmount + oScedule.InstallmentPrincipal; // // // interest = interest + oScedule.InstallmentInterest; // // // balance = balance + oScedule.OpeningBalance; // // // //oTemLoanSchedule.Add(oScedule); // // // } // // // } // // // sattelmentAmount = (loanAmounn + actuInterest) - (principleAmount + interest); // // // } // // // oRow["HomeLoan"] = sattelmentAmount;//odRow["CHANGEDAMOUNT"]; // // //} // // //if ((Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.PF_Contribution && (Convert.ToInt32(odRow["ItemID"]) == (int)EnumSalaryItemCode.PF_Contribution))) // // //{ // // // oRow["PF"] = odRow["CHANGEDAMOUNT"]; // // //} // // #endregion // // nCount = nCount + 1; // // employeeNo = odRow["EMPLOYEENO"].ToString(); // // } // // nCount = 0; // // DataSet oSalaryMonthlysIncomeTax = SalaryMonthly.GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // // string employeeNo1 = ""; // // DataRow[] odros1 = null; // // if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) // // { // // employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // // odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // // } // // foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) // // { // // DataRow oRow = null; // // if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) // // { // // odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // // nCount = 0; // // } // // if (odros1.Length <= nCount) continue; // // oRow = odros1[nCount]; // // //oRow["DeducDescription"] = odRow["Description"]; // // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) // // oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; // // nCount = nCount + 1; // // employeeNo1 = odRow["EMPLOYEENO"].ToString(); // // } // // nCount = 0; // // DataSet oSalaryMonthlysLaonAmount = SalaryMonthly.GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // // string employeeNo12 = ""; // // DataRow[] odros12 = null; // // if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) // // { // // employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // // odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // // } // // foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) // // { // // DataRow oRow = null; // // if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) // // { // // odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // // nCount = 0; // // } // // if (odros12.Length <= nCount) continue; // // oRow = odros12[nCount]; // // //oRow["DeducDescription"] = odRow["Description"]; // // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) // // { // // oRow["LoanDescription"] = odRow["Description"]; // // oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; // // } // // nCount = nCount + 1; // // employeeNo12 = odRow["EMPLOYEENO"].ToString(); // // } // // //if (IsApproved) // // //{ // // form.ShowDlgForPaySlip(_selectedParameter.ReportItem, PayslipData); // // //} // // //else // // //{ // // // MessageBox.Show("This salary process is not approve for the month of " + salaryMonth.ToString("MMM yyyy"), "Salary Approved", MessageBoxButtons.OK, MessageBoxIcon.Information); // // //} // //} // public void ShowReportOld() // { // DataSet oFDST = new DataSet(); // _oGratuityParams = ESBDefinition.Get(); // Employee oEmployee = null; // ObjectsTemplate oEmps = new ObjectsTemplate(); // oEmps = Employee.Get(); // List oDesigs = Designation.Get(EnumStatus.Regardless); // fReportViewer form = new fReportViewer(); // DateTime salaryMonth = _selectedParameter.FromDate.Value; // string sEmpID = _selectedParameter.ReportItem.INSQL; // ObjectsTemplate oSaProcess = new ObjectsTemplate(); // oSaProcess = SalaryProcess.Get(GlobalFunctions.LastDateOfMonth(salaryMonth)); // //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); // DataSet oSalaryMonthlysGross = SalaryMonthly.GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // //PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new Payroll.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); // PayrollDataSet.PayrollDataSet.RemainingLoanforPayslipDataTable rlforPayslipdt = new PayrollDataSet.PayrollDataSet.RemainingLoanforPayslipDataTable(); // //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); // _dSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); // if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[0].Rows.Count > 0) // { // if (oSaProcess[0].PaymentDate != DateTime.MinValue) // { // _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); // } // else // { // _dMonthEndDate = DateTime.MinValue; // } // } // foreach (DataRow odRow in oSalaryMonthlysGross.Tables[0].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"].ToString() == "" ? 0 : odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // { // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // { // double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // oRow["Arrear"] = dArrear; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // { // oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; // } // } // int nCount = 0; // DataSet oSalaryMonthlysDeduct = SalaryMonthly.GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo = ""; // DataRow[] odros = null; // if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) // { // employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // double dGratuityAmount = 0; // double dPFAmount = 0; // string sTEmpEmpNo = ""; // double nCurrPFAmount = 0; // foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = null; // if (employeeNo != odRow["EMPLOYEENO"].ToString()) // { // odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros.Length <= nCount) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // else oRow = odros[nCount]; // oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // oRow["DeducDescription"] = odRow["Description"]; // //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) // { // nCurrPFAmount = 0; // dPFAmount = 0; // oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); // if (odrosPF.Length > 0) // { // DataRow oRowPF = odrosPF[0]; // nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); // } // //if(oEmployee!=null) // //{ // // if (_oGratuityParams.Count > 0 && _oGratuityParams != null) // // { // // dGratuityAmount = GetGratuityAmount(_oGratuityParams, oEmployee, salaryMonth); // // } // // else // // { // // dGratuityAmount = 0; // // } // // dPFAmount = GetPFAmount(oEmployee, salaryMonth); // //} // } // oRow["Gratuity"] = dGratuityAmount; // double nServiceLength = 0; // if (oEmployee != null) // nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmployee); // if (nServiceLength > 5) // { // //oRow["PF"] = dPFAmount + nCurrPFAmount * 2; // oRow["PF"] = dPFAmount + nCurrPFAmount; // } // else // { // oRow["PF"] = dPFAmount + nCurrPFAmount; // } // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); // } // nCount = 0; // DataSet oSalaryMonthlysIncomeTax = SalaryMonthly.GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo1 = ""; // DataRow[] odros1 = null; // if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) // { // employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) // { // odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros1.Length <= nCount) continue; // oRow = odros1[nCount]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) // oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; // nCount = nCount + 1; // employeeNo1 = odRow["EMPLOYEENO"].ToString(); // } // nCount = 0; // DataSet oSalaryMonthlysLaonAmount = SalaryMonthly.GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo12 = ""; // DataRow[] odros12 = null; // if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) // { // employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) // { // odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros12.Length <= nCount) continue; // oRow = odros12[nCount]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) // { // oRow["LoanDescription"] = odRow["Description"]; // oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; // } // nCount = nCount + 1; // employeeNo12 = odRow["EMPLOYEENO"].ToString(); // } // bool isDesigFromEmp = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); // foreach (DataRow oRow in PayslipData.Rows) // { // Employee oEmp = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .SingleOrDefault(); // if (oEmp != null) // { // if (isDesigFromEmp) // { // oRow["Designation"] = oEmp.DescriptionText; // } // else // { // Designation oDesg = oDesigs.Where(o => o.ID == oEmp.DesignationID).SingleOrDefault(); // if (oDesg != null) // { // oRow["Designation"] = oDesg.Name; // } // } // } // } // // DataSet rlFPayslip = LoanIssue.RemainingLoanforPayslip(sEmpID); // ObjectsTemplate oExistingLoan = LoanIssue.GetExistingLoan(sEmpID); // if (oExistingLoan != null) // { // foreach (LoanIssue li in oExistingLoan) // { // double actuInterest = 0.0; // double principleAmount = 0.0; // double interest = 0.0; // double balance = 0.0; // string loanName = string.Empty; // DataRow orow = null; // try // { // actuInterest = 0.0; // principleAmount = 0.0; // interest = 0.0; // balance = 0.0; // if (li.Schedules != null) // { // foreach (LoanSchedule oScedule in li.Schedules) // { // if (oScedule.PaymentDate != null && oScedule.PaymentDate != DateTime.MinValue) // { // actuInterest = actuInterest + oScedule.ActualInterest; // principleAmount = principleAmount + oScedule.InstallmentPrincipal; // interest = interest + oScedule.InstallmentInterest; // balance = balance + oScedule.OpeningBalance; // orow = rlforPayslipdt.NewRow(); // orow["LoanName"] = li.LoanObj.Name; // orow["RemainingBalance"] = balance; // orow["RemainingInterest"] = interest; // rlforPayslipdt.Rows.Add(orow); // } // } // } // } // catch (Exception ex) // { // throw new ServiceException(ex.Message); // } // } // } // PayslipData.TableName = "PayrollDataSet_Payslip"; // rlforPayslipdt.TableName = "PayrollDataSet_RemainingLoanforPayslip"; // oFDST.Tables.Add(PayslipData); // oFDST.Tables.Add(rlforPayslipdt); // form.ShowDlgForPaySlipCiti1(_selectedParameter.ReportItem, oFDST); // } // public void ShowReport() // { // _oGratuityParams = ESBDefinition.Get(); // Employee oEmployee = null; // ObjectsTemplate costCenters = Costcenter.Get(); // ObjectsTemplate _empCostCeneters = EmployeeCostCenter.Get(); // Costcenter cCenter = null; // EmployeeCostCenter empCC = null; // ObjectsTemplate oEmps = new ObjectsTemplate(); // _termParamenters = TermParameter.Get(); // string takaInWord = string.Empty; // List oDesigs = Designation.Get(EnumStatus.Regardless); // fReportViewer form = new fReportViewer(); // DateTime salaryMonth = _selectedParameter.FromDate.Value; // salaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); // DateTime startMonth = salaryMonth.AddMonths(-1); // startMonth = new DateTime(startMonth.Year, startMonth.Month, 26); // DateTime endMonth = new DateTime(salaryMonth.Year, salaryMonth.Month, 25); // string sEmpID = _selectedParameter.ReportItem.INSQL; // oEmps = Employee.GetByEmpIDs(sEmpID); // ObjectsTemplate _dailyAttnProcess = DailyAttnProcess.Get(sEmpID,startMonth, endMonth); // ObjectsTemplate _dailyAttnProcessEmp = new ObjectsTemplate(); // ObjectsTemplate oSaProcess = new ObjectsTemplate(); // oSaProcess = SalaryProcess.Get(GlobalFunctions.LastDateOfMonth(salaryMonth)); // ObjectsTemplate _salaryMonthlys = SalaryMonthly.Get(sEmpID, GlobalFunctions.LastDateOfMonth(salaryMonth)); // SalaryMonthly sMonthly = null; // //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); // DataSet oSalaryMonthlysGross = SalaryMonthly.GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // DataSet dsetEmpBasicInfo = Employee.GetEmpBasicInfoForReport(sEmpID); // _hourTable = oSalaryMonthlysGross.Tables[2]; // DataTable basicInfo = new PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable(); // PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // //PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new Payroll.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); // PayrollDataSet.PayrollDataSet.RemainingLoanforPayslipDataTable rlforPayslipdt = new PayrollDataSet.PayrollDataSet.RemainingLoanforPayslipDataTable(); // //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); // _dSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); // if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[1].Rows.Count > 0) // { // if (oSaProcess[0].PaymentDate != DateTime.MinValue) // { // _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); // } // else // { // _dMonthEndDate = DateTime.MinValue; // } // } // bool isDesigFromEmp = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); // foreach (DataRow oRow in oSalaryMonthlysGross.Tables[0].Rows) // { // Employee oEmp = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .SingleOrDefault(); // if (oEmp != null) // { // if (isDesigFromEmp) // { // oRow["Designation"] = oEmp.DescriptionText; // } // } // } // foreach (DataRow odRow in oSalaryMonthlysGross.Tables[1].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"].ToString() == "" ? 0 : odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // oEmployee = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == odRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .FirstOrDefault(); // sMonthly = _salaryMonthlys.Where(o => o.EmployeeID == oEmployee.ID).FirstOrDefault(); // takaInWord = Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(sMonthly.Details.Where(o => o.itemGroupCode == EnumSalaryGroup.OtherItem && o.ItemCode == EnumSalaryItemCode.Net_Payable).FirstOrDefault().ChangedAmount); // oRow["STaka"] = takaInWord; // PayslipData.Rows.Add(oRow); // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // { // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // { // double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // oRow["Arrear"] = dArrear; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // { // oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; // } // if (odRow["PaymentMode"].ToString()=="1") // { // oRow["PaymentMode"] = "CashPayment"; // } // else if (odRow["PaymentMode"].ToString() == "2") // { // oRow["PaymentMode"] = "BankTransfer"; // } // else if (odRow["PaymentMode"] == "3") // { // oRow["PaymentMode"] = "Provision"; // } // } // int nCount = 0; // DataSet oSalaryMonthlysDeduct = SalaryMonthly.GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo = ""; // DataRow[] odros = null; // if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) // { // employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // double dGratuityAmount = 0; // double dPFAmount = 0; // string sTEmpEmpNo = ""; // double nCurrPFAmount = 0; // foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = null; // if (employeeNo != odRow["EMPLOYEENO"].ToString()) // { // odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros.Length <= nCount) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // else oRow = odros[nCount]; // oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // oRow["DeducDescription"] = odRow["Description"]; // //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) // { // nCurrPFAmount = 0; // dPFAmount = 0; // oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); // if (odrosPF.Length > 0) // { // DataRow oRowPF = odrosPF[0]; // nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); // } // } // #region UnusedCode // //oRow["Gratuity"] = dGratuityAmount; // //double nServiceLength = 0; // //if (oEmployee != null) // // nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmployee); // //if (nServiceLength > 5) // //{ // // //oRow["PF"] = dPFAmount + nCurrPFAmount * 2; // // oRow["PF"] = dPFAmount + nCurrPFAmount; // //} // //else // //{ // // oRow["PF"] = dPFAmount + nCurrPFAmount; // //} // #endregion // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions) && // Convert.ToInt32(odRow["ITEMCODE"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment) // { // double balance = 0.0; // double interest = 0.0; // DataRow orow = null; // LoanSchedule oSchedule = LoanSchedule.Get(ID.FromInteger(Convert.ToInt32(odRow["SUPPORTID"]))); // ObjectsTemplate oSchedules = new ObjectsTemplate(); // if (oSchedule != null) // { // oSchedules = LoanSchedule.GetByIssueID(oSchedule.LoanIssueID); // } // foreach (LoanSchedule oSchdl in oSchedules) // { // if (oSchdl.ScheduleNo > oSchedule.ScheduleNo) // { // balance += oSchdl.InstallmentPrincipal; // interest += oSchdl.InstallmentInterest; // } // } // orow = rlforPayslipdt.NewRow(); // orow["LoanName"] = odRow["Description"]; // orow["RemainingBalance"] = balance; // orow["RemainingInterest"] = interest; // orow["EmpNo"] = oEmployee.EmployeeNo; // rlforPayslipdt.Rows.Add(orow); // } // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); // } // #region Unused Code // //nCount = 0; // //DataSet oSalaryMonthlysIncomeTax = SalaryMonthly.GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // //string employeeNo1 = ""; // //DataRow[] odros1 = null; // //if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) // //{ // // employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // // odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // //} // //foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) // //{ // // DataRow oRow = null; // // if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) // // { // // odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // // nCount = 0; // // } // // if (odros1.Length <= nCount) continue; // // oRow = odros1[nCount]; // // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) // // oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; // // nCount = nCount + 1; // // employeeNo1 = odRow["EMPLOYEENO"].ToString(); // //} // //nCount = 0; // //DataSet oSalaryMonthlysLaonAmount = SalaryMonthly.GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // //string employeeNo12 = ""; // //DataRow[] odros12 = null; // //if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) // //{ // // employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // // odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // //} // //foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) // //{ // // DataRow oRow = null; // // if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) // // { // // odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // // nCount = 0; // // } // // if (odros12.Length <= nCount) continue; // // oRow = odros12[nCount]; // // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) // // { // // oRow["LoanDescription"] = odRow["Description"]; // // oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; // // } // // nCount = nCount + 1; // // employeeNo12 = odRow["EMPLOYEENO"].ToString(); // //} // //bool isDesigFromEmp = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); // //foreach (DataRow oRow in PayslipData.Rows) // //{ // // Employee oEmp = oEmps // // .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // // .SingleOrDefault(); // // if (oEmp != null) // // { // // if (isDesigFromEmp) // // { // // oRow["Designation"] = oEmp.DescriptionText; // // } // // else // // { // // Designation oDesg = oDesigs.Where(o => o.ID == oEmp.DesignationID).SingleOrDefault(); // // if (oDesg != null) // // { // // oRow["Designation"] = oDesg.Name; // // } // // } // // } // //} // //foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) // // { // // double actuInterest = 0.0; // // double principleAmount = 0.0; // // double interest = 0.0; // // double balance = 0.0; // // string loanName = string.Empty; // // DataRow orow = null; // // LoanSchedule oschedule = LoanSchedule.Get(ID.FromInteger(Convert.ToInt32(odRow["SupportID"]))); // // try // // { // // oEmployee = oEmps.FirstOrDefault(o => o.ID.Integer == Convert.ToInt32( odRow["EmployeeId"])); //oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.ID == li.EmployeeID}; // // actuInterest = 0.0; // // principleAmount = 0.0; // // interest = 0.0; // // balance = 0.0; // // orow = rlforPayslipdt.NewRow(); // // orow["LoanName"] = odRow["Description"]; // // orow["RemainingBalance"] = oschedule.OpeningBalance; // // orow["RemainingInterest"] = oschedule.InstallmentInterest; // // orow["EmpNo"] = oEmployee.EmployeeNo; // // rlforPayslipdt.Rows.Add(orow); // // } // // catch (Exception ex) // // { // // throw new ServiceException(ex.Message); // // } // // } // // DataSet rlFPayslip = LoanIssue.RemainingLoanforPayslip(sEmpID); // //ObjectsTemplate oExistingLoan = LoanIssue.GetExistingLoan(sEmpID); // //foreach (LoanIssue li in oExistingLoan) // //{ // // double actuInterest = 0.0; // // double principleAmount = 0.0; // // double interest = 0.0; // // double balance = 0.0; // // string loanName = string.Empty; // // DataRow orow = null; // // try // // { // // oEmployee = oEmps.FirstOrDefault(o => o.ID == li.EmployeeID); //oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.ID == li.EmployeeID}; // // actuInterest = 0.0; // // principleAmount = 0.0; // // interest = 0.0; // // balance = 0.0; // // foreach (LoanSchedule oScedule in li.Schedules) // // { // // if (oScedule.PaymentDate != null && oScedule.PaymentDate == DateTime.MinValue) // // { // // actuInterest = actuInterest + oScedule.ActualInterest; // // principleAmount = principleAmount + oScedule.InstallmentPrincipal; // // interest = interest + oScedule.InstallmentInterest; // // balance = balance + oScedule.OpeningBalance; // // } // // } // // orow = rlforPayslipdt.NewRow(); // // orow["LoanName"] = li.LoanObj.Name; // // orow["RemainingBalance"] = balance; // // orow["RemainingInterest"] = interest; // // orow["EmpNo"] = oEmployee.EmployeeNo; // // rlforPayslipdt.Rows.Add(orow); // // } // // catch (Exception ex) // // { // // throw new ServiceException(ex.Message); // // } // //} // #endregion // basicInfo = dsetEmpBasicInfo.Tables[0].Copy(); //oSalaryMonthlysGross.Tables[0].Copy(); // basicInfo.Columns.Add("TotalAbsent", typeof(string)); // basicInfo.Columns.Add("TotalLWP", typeof(string)); // basicInfo.TableName = "BasicInfo"; // double totalAbsentDays = 0; // double totalDaysOfMonth = Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("d", startMonth, endMonth) + 1; // ObjectsTemplate lwps = EmployeeUnAuthorizeLeave.Get(EnumLeaveEntryType.Normal ,GlobalFunctions.LastDateOfMonth(salaryMonth)); // foreach (DataRow oRow in basicInfo.Rows) // { // oEmployee = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .FirstOrDefault(); // _dailyAttnProcessEmp = _dailyAttnProcess.Where(o => o.EmployeeID == oEmployee.ID && o.AttenType == EnumAttendanceType.Absent).ToObjectsTemplate(); // oRow["PayPeriodFrom"] = startMonth.ToString("dd-MMM-yyyy"); // oRow["PayPeriodTo"] = endMonth.ToString("dd-MMM-yyyy"); // oRow["TotalDays"] = totalDaysOfMonth; // totalAbsentDays = _dailyAttnProcessEmp.Count; // oRow["TotalAbsent"] = totalAbsentDays; // if (lwps.Count > 0) // { // oRow["TotalLWP"] = lwps.Where(x => x.EmployeeID == oEmployee.ID).Sum(x => x.LeaveDays); // } // oRow["PayableDays"] = totalDaysOfMonth - totalAbsentDays; // oRow["SalaryMonth"] = salaryMonth.ToString("MMMM yyyy"); // oRow["PaymentDate"] = salaryMonth.ToString("dd MMM yyyy"); // } // DataSet dsSubReport = new DataSet(); // PayslipData.TableName = "SalaryMonthlysGross"; // dsSubReport.Tables.Add(PayslipData); // rlforPayslipdt.TableName = "RemainingLoanforPayslip"; // dsSubReport.Tables.Add(rlforPayslipdt); // form.ShowDlgForNewPaySlip(_selectedParameter.ReportItem, basicInfo, dsSubReport, salaryMonth.ToString("MMMM yyyy")); // } // public byte[] SaveReportForGT(DateTime date, string empID) // { // fReportViewer form = new fReportViewer(); // DateTime fromDate = date; // DateTime toDate = date.LastDateOfMonth(); // string sEmpIDs = empID; // IncomeTax oIncomeTax = new IncomeTax(); // ObjectsTemplate oEmps = new ObjectsTemplate(); // oEmps = Employee.GetByEmpIDs(sEmpIDs); // ObjectsTemplate oEmpCCs = EmployeeCostCenter.Get(); // ObjectsTemplate oCCs = Costcenter.Get(); // EmployeeCostCenter oEmpCC = null; // Costcenter oCC = null; // _taxParameter = TaxParameter.Get(BO.SystemInformation.CurrentSysInfo.TaxParamID); // PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable dtEmpBasicInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable(); // DataSet dsSub = new DataSet(); // ObjectsTemplate oDepartments = Department.Get(); // ObjectsTemplate oGrades = Grade.Get(EnumStatus.Active); // ObjectsTemplate oDesignations = Designation.Get(EnumStatus.Active); // Department oDepartment = null; // Grade oGrade = null; // Designation oDesignation = null; // foreach (Employee oEmp in oEmps) // { // _employee = oEmp; // DataRow dr = dtEmpBasicInfo.NewRow(); // dr["EmpID"] = oEmp.ID; // dr["Name"] = oEmp.Name; // dr["EMPLOYEENO"] = oEmp.EmployeeNo; // dr["ActualBasic"] = oEmp.BasicSalary; // oEmpCC = oEmpCCs.Where(x => x.EmployeeID.Integer == oEmp.ID.Integer && x.IsCurrentCC == true).FirstOrDefault(); // oCC = oEmpCC != null ? oCCs.Where(x => x.ID.Integer == oEmpCC.CostCenterID.Integer).FirstOrDefault() : null; // dr["TINNo"] = BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1 ? oCC != null ? oCC.Code : "" : oEmp.TinNo; // dr["AssessmentYear"] = _taxParameter.AssessmentYear; // dr["FiscalYear"] = _taxParameter.FiscalYear; // oDepartment = oDepartments.Where(x => x.ID.Integer == oEmp.DepartmentID.Integer).FirstOrDefault(); // dr["Department"] = oDepartment != null ? oDepartment.Name : ""; // oGrade = oGrades.Where(x => x.ID.Integer == oEmp.GradeID.Integer).FirstOrDefault(); // dr["Grade"] = oGrade != null ? oGrade.Name : ""; // dr["JOININGDATE"] = oEmp.JoiningDate; // oDesignation = oDesignations.Where(x => x.ID.Integer == oEmp.DesignationID.Integer).FirstOrDefault(); // dr["Designation"] = oDesignation != null ? oDesignation.Name : ""; // dr["ACCOUNTNO"] = oEmp.AccountNo; // dr["PAYMENTMODE"] = oEmp.PaymentMode == EnumPaymentMode.BankTransfer ? "Bank Transfer" : "Cash Payment"; // dtEmpBasicInfo.Rows.Add(dr); // _incometaxes = IncomeTax.Get(oIncomeTax.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, BO.SystemInformation.CurrentSysInfo.TaxParamID); // _dSet = PrepareDataset(oEmp.ID, oEmp.EmployeeNo); // if (dsSub.Tables.Count <= 0) // { // dsSub = _dSet; // } // else // { // dsSub.Merge(_dSet); // } // } // DataSet dsPaySlip = PrepareDataSetForPaySlip(sEmpIDs, fromDate, toDate, oEmps); // dsSub.Merge(dsPaySlip); // return form.SaveReportForGT(null, dtEmpBasicInfo, dsSub); // } // public void ShowReportForGT() // { // fReportViewer form = new fReportViewer(); // DateTime fromDate = _selectedParameter.FromDate.Value; // DateTime toDate = _selectedParameter.FromDate.Value.LastDateOfMonth(); // string sEmpIDs = _selectedParameter.ReportItem.INSQL; // IncomeTax oIncomeTax = new IncomeTax(); // ObjectsTemplate oEmps = new ObjectsTemplate(); // oEmps = Employee.GetByEmpIDs(sEmpIDs); // ObjectsTemplate oEmpCCs = EmployeeCostCenter.Get(); // ObjectsTemplate oCCs = Costcenter.Get(); // EmployeeCostCenter oEmpCC = null; // Costcenter oCC = null; // _taxParameter = TaxParameter.Get(BO.SystemInformation.CurrentSysInfo.TaxParamID); // PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable dtEmpBasicInfo = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable(); // DataSet dsSub = new DataSet(); // ObjectsTemplate oDepartments = Department.Get(); // ObjectsTemplate oGrades = Grade.Get(EnumStatus.Active); // ObjectsTemplate oDesignations = Designation.Get(EnumStatus.Active); // Department oDepartment = null; // Grade oGrade = null; // Designation oDesignation = null; // foreach (Employee oEmp in oEmps) // { // _employee = oEmp; // DataRow dr = dtEmpBasicInfo.NewRow(); // dr["EmpID"] = oEmp.ID; // dr["Name"] = oEmp.Name; // dr["EMPLOYEENO"] = oEmp.EmployeeNo; // dr["ActualBasic"] = oEmp.BasicSalary; // oEmpCC = oEmpCCs.Where(x => x.EmployeeID.Integer == oEmp.ID.Integer && x.IsCurrentCC == true).FirstOrDefault(); // oCC = oEmpCC != null ? oCCs.Where(x => x.ID.Integer == oEmpCC.CostCenterID.Integer).FirstOrDefault() : null; // dr["TINNo"] = BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1 ? oCC != null ? oCC.Code : "" : oEmp.TinNo; // dr["AssessmentYear"] = _taxParameter.AssessmentYear; // dr["FiscalYear"] = _taxParameter.FiscalYear; // oDepartment = oDepartments.Where(x => x.ID.Integer == oEmp.DepartmentID.Integer).FirstOrDefault(); // dr["Department"] = oDepartment != null ? oDepartment.Name : ""; // oGrade = oGrades.Where(x => x.ID.Integer == oEmp.GradeID.Integer).FirstOrDefault(); // dr["Grade"] = oGrade != null ? oGrade.Name : ""; // dr["JOININGDATE"] = oEmp.JoiningDate; // oDesignation = oDesignations.Where(x => x.ID.Integer == oEmp.DesignationID.Integer).FirstOrDefault(); // dr["Designation"] = oDesignation != null ? oDesignation.Name : ""; // dr["ACCOUNTNO"] = oEmp.AccountNo; // dr["PAYMENTMODE"] = oEmp.PaymentMode == EnumPaymentMode.BankTransfer ? "Bank Transfer" : "Cash Payment"; // dtEmpBasicInfo.Rows.Add(dr); // _incometaxes = IncomeTax.Get(oIncomeTax.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, BO.SystemInformation.CurrentSysInfo.TaxParamID); // _dSet = PrepareDataset(oEmp.ID, oEmp.EmployeeNo); // if (dsSub.Tables.Count <= 0) // { // dsSub = _dSet; // } // else // { // dsSub.Merge(_dSet); // } // } // DataSet dsPaySlip = PrepareDataSetForPaySlip(sEmpIDs, fromDate, toDate, oEmps); // dsSub.Merge(dsPaySlip); // form.ShowDlgForGT(_selectedParameter.ReportItem, dtEmpBasicInfo, dsSub); // } // public DataSet PrepareDataSetForPaySlip(string sEmpIDs, DateTime fromDate, DateTime toDate, ObjectsTemplate oEmps) // { // Employee oEmployee = null; // string takaInWord = string.Empty; // List oDesigs = Designation.Get(EnumStatus.Regardless); // ObjectsTemplate _dailyAttnProcess = DailyAttnProcess.Get(sEmpIDs, fromDate, toDate); // ObjectsTemplate _dailyAttnProcessEmp = new ObjectsTemplate(); // ObjectsTemplate oSaProcess = new ObjectsTemplate(); // oSaProcess = SalaryProcess.Get(toDate); // ObjectsTemplate _salaryMonthlys = SalaryMonthly.Get(sEmpIDs, toDate); // SalaryMonthly sMonthly = null; // //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); // DataSet oSalaryMonthlysGross = SalaryMonthly.GetEmpPaySlipGrossForOthers(toDate, sEmpIDs); // DataSet dsetEmpBasicInfo = Employee.GetEmpBasicInfoForReport(sEmpIDs); // _hourTable = oSalaryMonthlysGross.Tables[2]; // DataTable basicInfo = new PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable(); // PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // //PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new Payroll.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); // PayrollDataSet.PayrollDataSet.RemainingLoanforPayslipDataTable rlforPayslipdt = new PayrollDataSet.PayrollDataSet.RemainingLoanforPayslipDataTable(); // //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); // _dSalaryMonth = toDate; // if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[1].Rows.Count > 0) // { // if (oSaProcess[0].PaymentDate != DateTime.MinValue) // { // _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); // } // else // { // _dMonthEndDate = DateTime.MinValue; // } // } // bool isDesigFromEmp = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); // foreach (DataRow oRow in oSalaryMonthlysGross.Tables[0].Rows) // { // Employee oEmp = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .SingleOrDefault(); // if (oEmp != null) // { // if (isDesigFromEmp) // { // oRow["Designation"] = oEmp.DescriptionText; // } // } // } // foreach (DataRow odRow in oSalaryMonthlysGross.Tables[1].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"].ToString() == "" ? 0 : odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // oEmployee = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == odRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .FirstOrDefault(); // sMonthly = _salaryMonthlys.Where(o => o.EmployeeID == oEmployee.ID).FirstOrDefault(); // takaInWord = Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(sMonthly.Details.Where(o => o.itemGroupCode == EnumSalaryGroup.OtherItem && o.ItemCode == EnumSalaryItemCode.Net_Payable).FirstOrDefault().ChangedAmount); // oRow["STaka"] = takaInWord; // PayslipData.Rows.Add(oRow); // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // { // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // { // double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // oRow["Arrear"] = dArrear; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // { // oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; // } // if (odRow["PaymentMode"].ToString() == "1") // { // oRow["PaymentMode"] = "CashPayment"; // } // else if (odRow["PaymentMode"].ToString() == "2") // { // oRow["PaymentMode"] = "BankTransfer"; // } // else if (odRow["PaymentMode"] == "3") // { // oRow["PaymentMode"] = "Provision"; // } // } // int nCount = 0; // DataSet oSalaryMonthlysDeduct = SalaryMonthly.GetEmpPaySlipDeductForOthers(toDate, sEmpIDs); // string employeeNo = ""; // DataRow[] odros = null; // if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) // { // employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // double dGratuityAmount = 0; // double dPFAmount = 0; // string sTEmpEmpNo = ""; // double nCurrPFAmount = 0; // foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = null; // if (employeeNo != odRow["EMPLOYEENO"].ToString()) // { // odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros.Length <= nCount) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // else // { // oRow = odros[nCount]; // } // if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1) // { // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // oRow["DeducDescription"] = odRow["Description"]; // if (Convert.ToInt32(odRow["ItemCode"].ToString()) == (int)EnumSalaryItemCode.PF_Contribution) // { // oRow["DeducDescription"] = "EE Contribution to PF"; // nCount++; // if (odros.Length <= nCount) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // else // { // oRow = odros[nCount]; // } // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // oRow["DeducDescription"] = "ER Contribution to PF"; // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // oRow["Description"] = "Company Contribution of PF"; // } // } // else // { // oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // oRow["DeducDescription"] = odRow["Description"]; // //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) // { // nCurrPFAmount = 0; // dPFAmount = 0; // oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); // if (odrosPF.Length > 0) // { // DataRow oRowPF = odrosPF[0]; // nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); // } // } // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions) && // Convert.ToInt32(odRow["ITEMCODE"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment) // { // double balance = 0.0; // double interest = 0.0; // DataRow orow = null; // LoanSchedule oSchedule = LoanSchedule.Get(ID.FromInteger(Convert.ToInt32(odRow["SUPPORTID"]))); // ObjectsTemplate oSchedules = new ObjectsTemplate(); // if (oSchedule != null) // { // oSchedules = LoanSchedule.GetByIssueID(oSchedule.LoanIssueID); // } // foreach (LoanSchedule oSchdl in oSchedules) // { // if (oSchdl.ScheduleNo > oSchedule.ScheduleNo) // { // balance += oSchdl.InstallmentPrincipal; // interest += oSchdl.InstallmentInterest; // } // } // orow = rlforPayslipdt.NewRow(); // orow["LoanName"] = odRow["Description"]; // orow["RemainingBalance"] = balance; // orow["RemainingInterest"] = interest; // orow["EmpNo"] = oEmployee.EmployeeNo; // rlforPayslipdt.Rows.Add(orow); // } // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); // } // basicInfo = dsetEmpBasicInfo.Tables[0].Copy(); //oSalaryMonthlysGross.Tables[0].Copy(); // basicInfo.Columns.Add("TotalAbsent", typeof(string)); // basicInfo.Columns.Add("TotalLWP", typeof(string)); // basicInfo.TableName = "BasicInfo"; // double totalAbsentDays = 0; // double totalDaysOfMonth = Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("d", fromDate, toDate) + 1; // ObjectsTemplate lwps = EmployeeUnAuthorizeLeave.Get(EnumLeaveEntryType.Normal, toDate); // foreach (DataRow oRow in basicInfo.Rows) // { // oEmployee = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .FirstOrDefault(); // _dailyAttnProcessEmp = _dailyAttnProcess.Where(o => o.EmployeeID == oEmployee.ID && o.AttenType == EnumAttendanceType.Absent).ToObjectsTemplate(); // oRow["PayPeriodFrom"] = fromDate.ToString("dd-MMM-yyyy"); // oRow["PayPeriodTo"] = toDate.ToString("dd-MMM-yyyy"); // oRow["TotalDays"] = totalDaysOfMonth; // totalAbsentDays = _dailyAttnProcessEmp.Count; // oRow["TotalAbsent"] = totalAbsentDays; // if (lwps.Count > 0) // { // oRow["TotalLWP"] = lwps.Where(x => x.EmployeeID == oEmployee.ID).Sum(x => x.LeaveDays); // } // oRow["PayableDays"] = totalDaysOfMonth - totalAbsentDays; // oRow["SalaryMonth"] = fromDate.ToString("MMMM yyyy"); // oRow["PaymentDate"] = fromDate.ToString("dd MMM yyyy"); // } // DataSet dsSubReport = new DataSet(); // PayslipData.TableName = "PayrollDataSet_Payslip"; // dsSubReport.Tables.Add(PayslipData); // rlforPayslipdt.TableName = "RemainingLoanforPayslip"; // dsSubReport.Tables.Add(rlforPayslipdt); // return dsSubReport; // } // private DataSet PrepareDataset(ID nEmpID, string EmpNo) // { // DataSet orootDataset = new DataSet(); // DataRow dr = null; // IncomeTax oIncomeTax = new IncomeTax(); // PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new Payroll.Report.PayrollDataSet.PayrollDataSet.IncomeTaxDataTable(); // PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable2 = new Payroll.Report.PayrollDataSet.PayrollDataSet.IncomeTaxDataTable(); // DataRow houseRent = null; // DataRow Conveyance = null; // DataRow Medical = null; // DataRow lfa = null; // DataRow wppf = null; // DataRow TotalSalaryExepted = null; // DataRow TotalAnnualExepted = null; // _InvestmentAmount = 0.0; // _TotalTaxAmount = 0.0; // _LessExemptedAmount = 0.0; // _PaidTillDateAmount = 0.0; // _ThisMonthAmount = 0.0; // _ProjectedAmount = 0.0; // _AmountPerAnnum = 0.0; // _TotalSalaryExempted = 0.0; // _TotalAnnuaExempted = 0.0; // _TPaidTillDateAmount = 0.0; // _TThisMonthAmount = 0.0; // _TProjectedAmount = 0.0; // _TAmountPerAnnum = 0.0; // _pfInvestment = 0; // _otherInvestment = 0; // _investmentAllowed = 0; // _20Investment = 0; // foreach (IncomeTax oItem in _incometaxes) // { // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance || // oItem.ItemGroup == EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance || // oItem.ItemGroup == EnumIncomeTaxItemGroup.Exemption_Medical_Allowance || // oItem.ItemGroup == EnumIncomeTaxItemGroup.Exemption_LFA_Allowance || // oItem.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Examption) continue; // if (oItem.Side == EnumIncomeTaxSide.Inc_SalaryIncome || oItem.Side == EnumIncomeTaxSide.Dec_SalaryIncome) // { // dr = dTable1.NewRow(); // dTable1.Rows.Add(this.getARow(dr, oItem, EmpNo)); // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.House_Rent_Allowance) // houseRent = dr; // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Medical_Allowance) // Medical = dr; // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Conveyance_Allowance) // Conveyance = dr; // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.LFA_Allowance) // lfa = dr; // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance) // wppf = dr; // } // } // if (houseRent != null) // { // IncomeTax taxAmount = IncomeTax.Get(_incometaxes, nEmpID, // EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance); // if (taxAmount != null) // { // _TotalSalaryExempted += taxAmount.TotalAmount; // houseRent["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount); // } // } // if (Medical != null) // { // IncomeTax taxAmount = IncomeTax.Get(_incometaxes, nEmpID, // EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance); // if (taxAmount != null) // { // _TotalSalaryExempted += taxAmount.TotalAmount; // Medical["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount); // } // } // if (Conveyance != null) // { // IncomeTax taxAmount = IncomeTax.Get(_incometaxes, nEmpID, // EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance); // if (taxAmount != null) // { // _TotalSalaryExempted += taxAmount.TotalAmount; // Conveyance["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount); // } // } // if (lfa != null) // { // IncomeTax taxAmount = IncomeTax.Get(_incometaxes, nEmpID, // EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance); // if (taxAmount != null) // { // _TotalSalaryExempted += taxAmount.TotalAmount; // lfa["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount); // } // } // if (wppf != null) // { // IncomeTax taxAmount = IncomeTax.Get(_incometaxes, nEmpID, // EnumIncomeTaxItemGroup.WPPF_Examption, (int)EnumIncomeTaxItemGroup.WPPF_Examption); // if (taxAmount != null) // { // _TotalSalaryExempted += taxAmount.TotalAmount; // wppf["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount); // } // } // IncomeTax salaryIncome = IncomeTax.Get(_incometaxes, nEmpID, // EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income); // if (salaryIncome != null) // { // dr = dTable1.NewRow(); // dTable1.Rows.Add(this.getARow(dr, salaryIncome, EmpNo)); // TotalSalaryExepted = dr; // TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted; // } // foreach (IncomeTax oItem in _incometaxes) // { // if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome || oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome) // { // dr = dTable1.NewRow(); // dTable1.Rows.Add(this.getARow(dr, oItem, EmpNo)); // //_TotalAnnuaExempted = oItem.TotalAmount; // } // } // IncomeTax totalAnnualIncome = IncomeTax.Get(_incometaxes, nEmpID, // EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income); // if (totalAnnualIncome != null) // { // dr = dTable1.NewRow(); // dTable1.Rows.Add(this.getARow(dr, totalAnnualIncome, EmpNo)); // TotalAnnualExepted = dr; // TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted; // } // dTable1.TableName = "PayrollDataSet_IncomeTax"; // orootDataset.Tables.Add(dTable1); // // Crate Slab Data // double ngrossTax = 0; // PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable dTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable(); // _InvestmentAmount = _taxParameter.MaxInvAmount; // if (totalAnnualIncome != null) // { // ObjectsTemplate empTaxSlabs = TaxParameter.CalculateTaxOnSlab(_taxParameter, _employee, totalAnnualIncome.TotalAmount); // int index = 0; // dr = null; // foreach (TaxParameterSlab drr in empTaxSlabs) // { // dr = dTable.NewRow(); // dr["EmpID"] = nEmpID; // dr["EmpNo"] = EmpNo; // dr["CurrentRate"] = drr.TaxPercent.ToString() + "%"; // if (index == 0) // dr["Parameter"] = "On First BDT-" + drr.IncomeAmount.ToString(); // else if (index + 1 == empTaxSlabs.Count) // dr["Parameter"] = "On Remaining Balance";// + drr.IncomeAmount.ToString(); // else // dr["Parameter"] = "On Next BDT-" + drr.IncomeAmount.ToString(); // dr["TaxableIncome"] = drr.SlabTaxableAmount.ToString(); // dr["IndividualTaxLiability"] = drr.SlabTaxAmount.ToString(); // index++; // dTable.Rows.Add(dr); // ngrossTax = ngrossTax + drr.SlabTaxAmount; // } // } // dTable.TableName = "PayrollDataSet_IncomeTaxSlab"; // orootDataset.Tables.Add(dTable); // //Create other items // PayrollDataSet.PayrollDataSet.IncomeTaxOtherDataTable oDTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.IncomeTaxOtherDataTable(); // // DataSet oIncomeTaxOth = IncomeTax.GetEmpIDforOthTax(dataFrom, nEmpID); // DataRow oDRow = null; // //IncomeTax oInvestment = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, // // (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment); // //if (oInvestment != null) // //{ // // oDRow = oDTable.NewRow(); // // oDRow["DataColumn1"] = oInvestment.Description; // // oDRow["DataColumn2"] = ""; // // oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oInvestment.TotalAmount); // // oDTable.Rows.Add(oDRow); // //} // IncomeTax investmentCapdo; // if (_investmentwithoutPF == false) // { // investmentCapdo = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Income, // (int)EnumIncomeTaxItemGroup.Annual_Income); // if (investmentCapdo != null) // _20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100; // } // else // { // investmentCapdo = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, // (int)EnumIncomeTaxItemGroup.Annual_Salary_Income); // if (investmentCapdo != null) // _20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100; // } // IncomeTax acinvestment = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Actual, // (int)EnumIncomeTaxItemGroup.Investment_Actual); // if (acinvestment != null) // _actualInvestment = acinvestment.TotalAmount; // IncomeTax taxRebate = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Allowed, // (int)EnumIncomeTaxItemGroup.Investment_Allowed); // if (taxRebate != null) // { // _investmentAllowed = taxRebate.TotalAmount; // string spf = ""; // IncomeTax pf = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, // (int)EnumIncomeTaxItemGroup.Company_Contri_PF); // if (pf != null) // { // _pfInvestment = pf.TotalAmount; // double npfamount = 0; // double otherAmount = 0; // IncomeTax actualInvestment = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Actual, // (int)EnumIncomeTaxItemGroup.Investment_Actual); // npfamount = (pf.TotalAmount * 2 > taxRebate.TotalAmount) ? taxRebate.TotalAmount : pf.TotalAmount * 2; // if (actualInvestment == null) // { // otherAmount = taxRebate.TotalAmount - pf.TotalAmount * 2; // if (otherAmount < 0) otherAmount = 0; // _otherInvestment = otherAmount; // } // else // { // otherAmount = actualInvestment.TotalAmount; // _otherInvestment = otherAmount; // } // if (ngrossTax <= 0) _otherInvestment = 0; // // spf = "PF: " + GlobalFunctions.TakaFormat(npfamount) + ", Other: " + GlobalFunctions.TakaFormat(otherAmount); // spf = ""; // } // //oDRow = oDTable.NewRow(); // //oDRow["EmpID"] = nEmpID; // //oDRow["EmpNo"] = EmpNo; // //oDRow["DataColumn1"] = taxRebate.Description; // //oDRow["DataColumn2"] = spf; // //oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(taxRebate.TotalAmount); // ////oDTable.Rows.Add(oDRow); // } // foreach (IncomeTax oItem in _incometaxes) // { // // Only "Tax Rebate on Investment" will show as requirement for GT // if (oItem.Description.ToLower() == "Tax Rebate on Investment".ToLower()) // { // if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax) // { // oDRow = oDTable.NewRow(); // oDRow["EmpID"] = nEmpID; // oDRow["EmpNo"] = EmpNo; // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment || oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate) // { // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate) // { // oDRow["DataColumn1"] = "AIT for vehicale/others"; // } // else // oDRow["DataColumn1"] = oItem.Description; // if (ngrossTax > 0) // oDRow["DataColumn3"] = "(" + oItem.TotalAmount.ToString("#,##") + ")"; // else oDRow["DataColumn3"] = "(0)"; // } // else // { // oDRow["DataColumn1"] = oItem.Description; // oDRow["DataColumn3"] = oItem.TotalAmount.ToString("#,##"); // } // oDRow["DataColumn2"] = ""; // oDTable.Rows.Add(oDRow); // } // } // } // IncomeTax oNetTaxPayable = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Net_Payable, // (int)EnumIncomeTaxItemGroup.Net_Payable); // if (oNetTaxPayable != null) // { // oDRow = oDTable.NewRow(); // oDRow["EmpID"] = nEmpID; // oDRow["EmpNo"] = EmpNo; // oDRow["DataColumn1"] = oNetTaxPayable.Description; // oDRow["DataColumn2"] = ""; // oDRow["DataColumn3"] = oNetTaxPayable.TotalAmount.ToString("#,##"); // oDTable.Rows.Add(oDRow); // } // IncomeTax oTaxDeducted = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted, // (int)EnumIncomeTaxItemGroup.Tax_Deducted); // // IncomeTax oTaxRefund = IncomeTax.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Refund_On_Current_Year, // //(int)EnumIncomeTaxItemGroup.Tax_Refund_On_Current_Year); // if (_isPrvs) // { // if (oTaxDeducted != null) // { // //oDRow = oDTable.NewRow(); // //oDRow["EmpID"] = nEmpID; // //oDRow["EmpNo"] = EmpNo; // ////oDRow["DataColumn1"] = "Tax deducted from salary"; // //oDRow["DataColumn1"] = "Total Tax Paid to The Government"; // //oDRow["DataColumn2"] = ""; // //oDRow["DataColumn3"] = (oTaxDeducted.TotalAmount).ToString("#,##"); // //oDTable.Rows.Add(oDRow); // } // } // else // { // if (oTaxDeducted != null) // { // //oDRow = oDTable.NewRow(); // //oDRow["EmpID"] = nEmpID; // //oDRow["EmpNo"] = EmpNo; // //oDRow["DataColumn1"] = "Tax paid up to previous month"; // //oDRow["DataColumn2"] = ""; // //oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.PreviousAmount); // //oDTable.Rows.Add(oDRow); // //oDRow = oDTable.NewRow(); // //oDRow["EmpID"] = nEmpID; // //oDRow["EmpNo"] = EmpNo; // //oDRow["DataColumn1"] = "Tax paid this month"; // //oDRow["DataColumn2"] = ""; // //oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.ThisMonthAmount); // //oDTable.Rows.Add(oDRow); // //oDRow = oDTable.NewRow(); // //oDRow["EmpID"] = nEmpID; // //oDRow["EmpNo"] = EmpNo; // //oDRow["DataColumn1"] = "Tax to be paid upto June"; // //oDRow["DataColumn2"] = ""; // //if (oNetTaxPayable != null) // //{ // // oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oNetTaxPayable.TotalAmount - oTaxDeducted.TotalAmount); // //} // //oDTable.Rows.Add(oDRow); // } // } // oDTable.TableName = "PayrollDataSet_IncomeTaxOther"; // orootDataset.Tables.Add(oDTable); // //PayrollDataSet.PayrollDataSet.ITHeaderDataTable oMulIT = new Payroll.Report.PayrollDataSet.PayrollDataSet.ITHeaderDataTable(); // //Employee oEmp = Employee.Get(nEmpID); // //oDRow = oMulIT.NewRow(); // //oDRow["EmpNo"] = oEmp.EmployeeNo; // //oDRow["EmpName"] = oEmp.Name; // //oDRow["TINNo"] = oEmp.TinNo; // //oDRow["AssesmentYear"] = _taxParameter.AssessmentYear; // //oDRow["FiscalYear"] = _taxParameter.FiscalYear; // //oMulIT.Rows.Add(oDRow); // //oMulIT.TableName = "PayrollDataSet_ITHeader"; // //orootDataset.Tables.Add(oMulIT); // return orootDataset; // } // private DataRow getARow(DataRow orow, IncomeTax oItem, string EmpNo) // { // if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Annual_Salary_Income) // { // DataRow dr = orow; // dr["EmpID"] = oItem.EmployeeID; // dr["EmpNo"] = EmpNo; // dr["ItemCode"] = oItem.ItemGroup; // dr["ItemID"] = oItem.ItemID; // dr["IncomeHead"] = oItem.Description; // dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_AmountPerAnnum); //oDRow["AmountPerannum"]; // dr["ThisMonth"] = GlobalFunctions.TakaFormat(_ThisMonthAmount); // dr["PaidTillDate"] = GlobalFunctions.TakaFormat(_PaidTillDateAmount);//oDRow["PaidTillDate"]; // dr["Projected"] = GlobalFunctions.TakaFormat(_ProjectedAmount); // dr["Position"] = oItem.Position; // dr["Side"] = oItem.Side; // dr["LessExaempted"] = "0"; // dr["RowSequence"] = oItem.Position; // return dr; // } // else if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Annual_Income) // { // DataRow dr = orow; // dr["EmpID"] = oItem.EmployeeID; // dr["EmpNo"] = EmpNo; // dr["ItemCode"] = oItem.ItemGroup; // dr["ItemID"] = oItem.ItemID; // dr["IncomeHead"] = oItem.Description; // dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_TAmountPerAnnum); //oDRow["AmountPerannum"]; // dr["ThisMonth"] = GlobalFunctions.TakaFormat(_TThisMonthAmount); // dr["PaidTillDate"] = GlobalFunctions.TakaFormat(_TPaidTillDateAmount);//oDRow["PaidTillDate"]; // dr["Projected"] = GlobalFunctions.TakaFormat(_TProjectedAmount); // dr["Position"] = oItem.Position; // dr["Side"] = oItem.Side; // dr["LessExaempted"] = "0"; // dr["RowSequence"] = oItem.Position; // return dr; // } // else // { // DataRow dr = orow; // dr["EmpID"] = oItem.EmployeeID; // dr["EmpNo"] = EmpNo; // dr["ItemCode"] = oItem.ItemGroup; // dr["ItemID"] = oItem.ItemID; // dr["IncomeHead"] = oItem.Description; // dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(oItem.TotalAmount); //oDRow["AmountPerannum"]; // dr["ThisMonth"] = GlobalFunctions.TakaFormat(oItem.ThisMonthAmount); // dr["PaidTillDate"] = GlobalFunctions.TakaFormat(oItem.PreviousAmount);//oDRow["PaidTillDate"]; // dr["Projected"] = GlobalFunctions.TakaFormat(oItem.ProjectedAmount); // dr["Position"] = oItem.Position; // dr["Side"] = oItem.Side; // if (!(oItem.ItemGroup == EnumIncomeTaxItemGroup.Company_Contri_PF)) // { // _AmountPerAnnum += oItem.TotalAmount; // _ThisMonthAmount += oItem.ThisMonthAmount; // _PaidTillDateAmount += oItem.PreviousAmount; // _ProjectedAmount += oItem.ProjectedAmount; // } // _TAmountPerAnnum += oItem.TotalAmount; // _TThisMonthAmount += oItem.ThisMonthAmount; // _TPaidTillDateAmount += oItem.PreviousAmount; // _TProjectedAmount += oItem.ProjectedAmount; // dr["LessExaempted"] = "0"; // dr["RowSequence"] = oItem.Position; // return dr; // } // } // public byte[] ShowReport(DateTime salaryMonth2, string sEmpID2) // { // DataSet oFDST = new DataSet(); // _oGratuityParams = ESBDefinition.Get(); // Employee oEmployee = null; // ObjectsTemplate oEmps = new ObjectsTemplate(); // oEmps = Employee.Get(); // List oDesigs = Designation.Get(EnumStatus.Regardless); // fReportViewer form = new fReportViewer(); // DateTime salaryMonth = salaryMonth2; // string sEmpID = sEmpID2; // ObjectsTemplate oSaProcess = new ObjectsTemplate(); // oSaProcess = SalaryProcess.Get(GlobalFunctions.LastDateOfMonth(salaryMonth)); // //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); // DataSet oSalaryMonthlysGross = SalaryMonthly.GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // PayrollDataSet.PayrollDataSet.LoanDataDataTable loanDT = new Payroll.Report.PayrollDataSet.PayrollDataSet.LoanDataDataTable(); // //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); // _dSalaryMonth = GlobalFunctions.LastDateOfMonth(salaryMonth); // if (oSaProcess != null && oSaProcess.Count > 0 && oSalaryMonthlysGross.Tables[0].Rows.Count > 0) // { // if (oSaProcess[0].PaymentDate != DateTime.MinValue) // { // _dMonthEndDate = Convert.ToDateTime(oSaProcess[0].PaymentDate); // } // else // { // _dMonthEndDate = DateTime.MinValue; // } // } // foreach (DataRow odRow in oSalaryMonthlysGross.Tables[1].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // { // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // { // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // { // double dArrear = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // oRow["Arrear"] = dArrear; // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // { // oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; // } // } // int nCount = 0; // DataSet oSalaryMonthlysDeduct = SalaryMonthly.GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo = ""; // DataRow[] odros = null; // if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) // { // employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // double dGratuityAmount = 0; // double dPFAmount = 0; // string sTEmpEmpNo = ""; // double nCurrPFAmount = 0; // foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) // { // double dbl = Convert.ToDouble(odRow["CHANGEDAMOUNT"].ToString()); // if (dbl == 0) // { // continue; // } // DataRow oRow = null; // if (employeeNo != odRow["EMPLOYEENO"].ToString()) // { // odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros.Length <= nCount) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // else oRow = odros[nCount]; // oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // oRow["DeducDescription"] = odRow["Description"]; // //if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.PF_Contribution)) // //{ // // oRow["DeducDescription"] = "PF Both Contribution"; // // oRow["DeducAmount"] = Convert.ToDouble(odRow["CHANGEDAMOUNT"]) * 2; // // // oRow["Description"] = "PF Contribution (Co's)"; // // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // //} // //else // //{ // // oRow["DeducDescription"] = odRow["Description"]; // // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // // //oRow["DeducDescription"] = odRow["Description"]; // //} // //oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // if (sTEmpEmpNo == "" || sTEmpEmpNo != odRow["EMPLOYEENO"].ToString()) // { // nCurrPFAmount = 0; // dPFAmount = 0; // oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // DataRow[] odrosPF = oSalaryMonthlysDeduct.Tables[0].Select(" ItemCode='" + (int)EnumSalaryItemCode.PF_Contribution + "' AND EMPLOYEENO='" + odRow["EMPLOYEENO"].ToString() + "'"); // if (odrosPF.Length > 0) // { // DataRow oRowPF = odrosPF[0]; // nCurrPFAmount = Convert.ToDouble(oRowPF["CHANGEDAMOUNT"]); // } // if (oEmployee != null) // { // if (_oGratuityParams.Count > 0 && _oGratuityParams != null) // { // dGratuityAmount = GetGratuityAmount(_oGratuityParams, oEmployee, salaryMonth); // } // else // { // dGratuityAmount = 0; // } // dPFAmount = GetPFAmount(oEmployee, salaryMonth); // } // } // oRow["Gratuity"] = dGratuityAmount; // double nServiceLength = 0; // if (oEmployee != null) // nServiceLength = ServiceYears(GlobalFunctions.LastDateOfMonth(salaryMonth), oEmployee); // if (nServiceLength > 5) // { // //oRow["PF"] = dPFAmount + nCurrPFAmount * 2; // oRow["PF"] = dPFAmount + nCurrPFAmount; // } // else // { // oRow["PF"] = dPFAmount + nCurrPFAmount; // } // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // sTEmpEmpNo = odRow["EMPLOYEENO"].ToString(); // } // nCount = 0; // DataSet oSalaryMonthlysIncomeTax = SalaryMonthly.GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo1 = ""; // DataRow[] odros1 = null; // if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) // { // employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) // { // odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros1.Length <= nCount) continue; // oRow = odros1[nCount]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) // oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; // nCount = nCount + 1; // employeeNo1 = odRow["EMPLOYEENO"].ToString(); // } // nCount = 0; // DataSet oSalaryMonthlysLaonAmount = SalaryMonthly.GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo12 = ""; // DataRow[] odros12 = null; // if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) // { // employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) // { // odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros12.Length <= nCount) continue; // oRow = odros12[nCount]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) // { // oRow["LoanDescription"] = odRow["Description"]; // oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; // } // nCount = nCount + 1; // employeeNo12 = odRow["EMPLOYEENO"].ToString(); // } // bool isDesigFromEmp = ConfigurationManager.GetBoolValue("designation", "desigfromdescriptiontext", EnumConfigurationType.Logic); // foreach (DataRow oRow in PayslipData.Rows) // { // Employee oEmp = oEmps // .Where(o => o.EmployeeNo.ToUpper().Trim() == oRow["EMPLOYEENO"].ToString().ToUpper().Trim()) // .SingleOrDefault(); // if (oEmp != null) // { // if (isDesigFromEmp) // { // oRow["Designation"] = oEmp.DescriptionText; // } // else // { // Designation oDesg = oDesigs.Where(o => o.ID == oEmp.DesignationID).SingleOrDefault(); // if (oDesg != null) // { // oRow["Designation"] = oDesg.Name; // } // } // } // } // loanDT.TableName = "PayrollDataSet_LoanData"; // PayslipData.TableName = "PayrollDataSet_Payslip"; // oFDST.Tables.Add(PayslipData); // oFDST.Tables.Add(loanDT); // return form.ShowDlgForPaySlipCiti2(null, oFDST); // } // public byte[] SKFExpencesPaySlip1(DateTime dDate, string sID) // { // fReportViewer form = new fReportViewer(); // DateTime salaryMonth = dDate; // DateTime fromDate = GlobalFunctions.FirstDateOfMonth(salaryMonth); // DateTime toDate = GlobalFunctions.LastDateOfMonth(salaryMonth); // string sEmpID = sID; // DataRow odr = null; // string month = salaryMonth.ToString("MMM-yyyy"); // DataSet oDataset = new DataSet(); // DataSet oExpensesPSlipDSet = MiscellaneousDataset.GetExpensesPaySlipData(fromDate, toDate, sEmpID); // PayrollDataSet.PayrollDataSet.SKFExpencesPaySlipDataTable skfExpTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.SKFExpencesPaySlipDataTable(); // foreach (DataRow odrow in oExpensesPSlipDSet.Tables[0].Rows) // { // odr = skfExpTable.NewRow(); // odr["EmpNo"] = odrow["EmployeeNo"]; // odr["EmpName"] = odrow["EmpName"]; // odr["Designation"] = odrow["Designation"]; // odr["Department"] = odrow["Department"]; // odr["AccountNo"] = odrow["OUTPAYACCOUNTNO"]; // odr["Tinno"] = odrow["TinNo"]; // odr["JoiningDate"] = odrow["JoiningDate"]; // odr["Grade"] = odrow["Grade"]; // if (odrow["PaymentMode"].Equals(1)) // { // odr["PaymentMode"] = "CashPayment"; // } // else if (odrow["PaymentMode"].Equals(2)) // { // odr["PaymentMode"] = "BankTransfer"; // } // else if (odrow["PaymentMode"].Equals(3)) // { // odr["PaymentMode"] = "Provision"; // } // if (!odrow.IsNull("Utility Expenses")) // { // odr["UtilityExp"] = odrow["Utility Expenses"]; // } // if (!odrow.IsNull("Leave Fare Assistance Expense")) // { // odr["LFAExp"] = odrow["Leave Fare Assistance Expense"]; // } // if (!odrow.IsNull("Medical Expenses")) // { // odr["MedicalExp"] = odrow["Medical Expenses"]; // } // if (!odrow.IsNull("Servant Allowances")) // { // odr["ServantAllow"] = odrow["Servant Allowances"]; // } // if (!odrow.IsNull("Car Allowances/ Expenses")) // { // odr["CarAllow"] = odrow["Car Allowances/ Expenses"]; // } // if (!odrow.IsNull("Driver Allowances")) // { // odr["DriverAllow"] = odrow["Driver Allowances"]; // } // if (!odrow.IsNull("Security Allowances")) // { // odr["SecurityAllow"] = odrow["Security Allowances"]; // } // if (!odrow.IsNull("Worker’s Profit Participation Fund")) // { // odr["WPPFund"] = odrow["Worker’s Profit Participation Fund"]; // } // if (!odrow.IsNull("Manager’s Telephone Expenses")) // { // odr["ManagerTelExp"] = odrow["Manager’s Telephone Expenses"]; // } // if (!odrow.IsNull("Telephone Expenses (Mobile Bill)")) // { // odr["TelExp"] = odrow["Telephone Expenses (Mobile Bill)"]; // } // if (!odrow.IsNull("Mobile Set")) // { // odr["MobileSet"] = odrow["Mobile Set"]; // } // if (!odrow.IsNull("Group Insurance")) // { // odr["[GroupInsurance]"] = odrow["Group Insurance"]; // } // if (!odrow.IsNull("Other Expenses")) // { // odr["OtherExp"] = odrow["Other Expenses"]; // } // skfExpTable.Rows.Add(odr); // } // return form.ShowDlgForSkfExpensesPSlip1(skfExpTable, month); // } // public void BanglaPaySlip() // { // #region Initialize Components // fReportViewer form = new fReportViewer(); // DateTime salaryMonth = _selectedParameter.FromDate.Value; // string sEmpID = _selectedParameter.ReportItem.INSQL; // ObjectsTemplate salarymonthlies = SalaryMonthly.Get(sEmpID, GlobalFunctions.LastDateOfMonth(salaryMonth)); // DataSet oSalaryMonthlyDetails = SalaryMonthly.GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // List oAllDeducts = AllowanceDeduction.Get(EnumStatus.Regardless); // List oLeaves = Leave.Get(); // List oEmployees = Employee.GetByEmpIDs(sEmpID); // DataRow oDR = null; // double totalGross = 0.0; // PayrollDataSet.PayrollDataSet.BanglaPaySlipDataTable banglaPaySlipData = new PayrollDataSet.PayrollDataSet.BanglaPaySlipDataTable(); // #region Calcullate Bangla Month // string[] BanglaMonths = {"Rvbyqvwi","‡deªyqvix","gvP©","GwcÖj", // "‡g","Ryb","RyjvB","AvMó", // "‡m‡Þ¤^i","A‡±vei","b‡f¤^i","wW‡m¤^i"}; // string month = BanglaMonths[salaryMonth.Month - 1]; // #endregion // //parameter = new ReportParameter("rptMonth", month); // //parameters.Add(parameter); // #endregion // foreach (SalaryMonthly itemMonthly in salarymonthlies) // { // totalGross = 0.0; // oDR = banglaPaySlipData.NewRow(); // oDR["SalaryMonth"] = salaryMonth; // oDR["EmpNo"] = itemMonthly.Employee.EmployeeNo; // oDR["Name"] = itemMonthly.Employee.Name; // oDR["Grade"] = itemMonthly.Employee.Grade.Name; // oDR["Designation"] = itemMonthly.Employee.Designation.Name; // oDR["DOfJoining"] = itemMonthly.Employee.JoiningDate; // #region Gross Payment // oDR["Basic"] = itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Basic_Salary) + // +itemMonthly.GetAmount(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Basic_Salary); // #region Calcullate Allowances // // House rent code: 001 // AllowanceDeduction oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "001"); // oDR["HouseRent"] = oAllDeduct != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) + // itemMonthly.GetAmount(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) // : 0; // // Conveyance code: 002 // oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "002"); // oDR["Transport"] = oAllDeduct != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) + // itemMonthly.GetAmount(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) // : 0; // // medical code: 003 // oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "003"); // oDR["Medical"] = oAllDeduct != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) + // itemMonthly.GetAmount(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) // : 0; // // FoodAllowance code: 004 // oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "004"); // oDR["Food"] = oAllDeduct != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) + // itemMonthly.GetAmount(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) // : 0; // // Attendence Bonus code: 010 // oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "010"); // oDR["AttBon"] = oAllDeduct != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) + // itemMonthly.GetAmount(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) // : 0; // // Conduct Bonus code: 011 // oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "011"); // oDR["ConductBonus"] = oAllDeduct != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) + // itemMonthly.GetAmount(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) // : 0; // // Production Bonus code: 009 // oAllDeduct = oAllDeducts.FirstOrDefault(x => x.Code.Trim() == "009"); // oDR["ProdBonus"] = oAllDeduct != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) + // itemMonthly.GetAmount(EnumSalaryGroup.Arrear, EnumSalaryItemCode.Allowance, oAllDeduct.ID.Integer) // : 0; // #endregion // totalGross = Convert.ToDouble(oDR["Basic"]) + // Convert.ToDouble(oDR["HouseRent"]) + // Convert.ToDouble(oDR["Medical"]) + // Convert.ToDouble(oDR["Transport"]) + // Convert.ToDouble(oDR["Food"]) + // Convert.ToDouble(oDR["AttBon"]) + // Convert.ToDouble(oDR["ConductBonus"]) + // Convert.ToDouble(oDR["ProdBonus"]); // +Convert.ToDouble(oDR["SplAllow"]); // oDR["MonthlyWages"] = totalGross; // #endregion // #region Day Calcullation // oDR["WRDays"] = itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Total_Days); // oDR["PRDays"] = itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Tot_Attend_Days); // oDR["HolyDays"] = itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Total_HoliDays); // oDR["DeducDays"] = itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Tot_UnauthLeave_Days); // #endregion // #region Leave Calcullation // Leave currentLeave = null; // currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "CL"); // oDR["CLDays"] = currentLeave != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Leave_Days, // currentLeave.ID.Integer) // : 0; // currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "SL"); // oDR["SLDays"] = currentLeave != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Leave_Days, // currentLeave.ID.Integer) // : 0; // currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "EL"); // oDR["ELDays"] = currentLeave != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Leave_Days, // currentLeave.ID.Integer) // : 0; // currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "ML"); // oDR["MLDays"] = currentLeave != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Leave_Days, // currentLeave.ID.Integer) // : 0; // currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "PL"); // oDR["PLDays"] = currentLeave != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Leave_Days, // currentLeave.ID.Integer) // : 0; // currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "LWP"); // oDR["LWPDays"] = currentLeave != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Leave_Days, // currentLeave.ID.Integer) // : 0; // currentLeave = oLeaves.SingleOrDefault(x => x.Code.ToUpper().Trim() == "L/OUT"); // oDR["LOUTDays"] = currentLeave != null ? // itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Leave_Days, // currentLeave.ID.Integer) // : 0; // oDR["MTRDays"] = 0; // ?? What is This // #endregion // #region Overtime // oDR["OTHours"] = itemMonthly.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Over_Time_Hours);// (item.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Over_Time_Hours, 1) <= 52) ? item.GetAmount(EnumSalaryGroup.Miscellaneous, EnumSalaryItemCode.Over_Time_Hours, 1) : 52; // oDR["OTPayable"] = itemMonthly.GetAmount(EnumSalaryGroup.Gross, EnumSalaryItemCode.Over_Time_Amount); // oDR["OTRate"] = Convert.ToDouble(oDR["OTHours"]) > 0 ? // Math.Round(Convert.ToDouble(oDR["OTPayable"]) / Convert.ToDouble(oDR["OTHours"]), 2) // : 0.0; // #endregion // #region Deductions // // variable used if muliple basic deduction exist // double deductBasic = 0; // // UnAuthorize Leave Basic Deduct // deductBasic += itemMonthly // .GetAmount(EnumSalaryGroup.UnauthLeave, EnumSalaryItemCode.Basic_Salary); // oDR["DeductAmnt"] = deductBasic; // oDR["DeductPF"] = Convert.ToDouble(oDR["Basic"]) * 0.08; // oDR["DeductSalaryAdvance"] = 0.0; // oDR["NetDeductAmnt"] = Convert.ToDouble(oDR["DeductAmnt"]) + Convert.ToDouble(oDR["DeductPF"]) + // Convert.ToDouble(oDR["DeductSalaryAdvance"]); // #endregion // // Gross + Overtime - Deductions // oDR["NetWages"] = Convert.ToDouble(oDR["MonthlyWages"]) + Convert.ToDouble(oDR["OTPayable"]) // - Convert.ToDouble(oDR["NetDeductAmnt"]); // oDR["ProdBonusDescription"] = string.Empty; // if (Convert.ToDouble(oDR["ProdBonus"]) > 0) // { // ProdBonusProcessEmp oPREmp = ProdBonusProcess.GetProdBonusEmp(itemMonthly.EmployeeID, salaryMonth.LastDateOfMonth()); // oDR["ProdBonusDescription"] = oPREmp.Description; // } // banglaPaySlipData.Rows.Add(oDR); // } // form.ShowDlgForBanglaPaySlipOverAllSummary(_selectedParameter.ReportItem, banglaPaySlipData, month); // } // public void ShowReportCiti1() // { // _oGratuityParams = ESBDefinition.Get(); // Employee oEmployee = null; // ObjectsTemplate oEmps = new ObjectsTemplate(); // oEmps = Employee.Get(); // ObjectsTemplate oLoanScheduls = new ObjectsTemplate(); // oLoanScheduls = LoanSchedule.Get(); // //ObjectsTemplate oLoanIssues = new ObjectsTemplate(); // //oLoanIssues = LoanIssue.GetE Get(); // fReportViewer form = new fReportViewer(); // DateTime salaryMonth = _selectedParameter.FromDate.Value; // string sEmpID = _selectedParameter.ReportItem.INSQL; // SalaryProcess oSaProcess = new SalaryProcess(); // //bool bIsProcess = SalaryMonthly.IsSalaryProcessed(SessionManager.CurrentEmployee.ID, _SalaryMonth); // DataSet oSalaryMonthlysGross = SalaryMonthly.GetEmpPaySlipGrossForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // PayrollDataSet.PayrollDataSet.PayslipDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.PayslipDataTable(); // //bool IsApproved = oSaProcess.GetBySMonth(GlobalFunctions.LastDateOfMonth(salaryMonth)); // foreach (DataRow odRow in oSalaryMonthlysGross.Tables[0].Rows) // { // DataRow oRow = this.GetItem(PayslipData, Convert.ToString(odRow["EMPLOYEENO"]), (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // oRow["Earning"] = odRow["CHANGEDAMOUNT"]; // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // oRow["Arrear"] = odRow["CHANGEDAMOUNT"]; // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // oRow["unAuthLeave"] = odRow["CHANGEDAMOUNT"]; // } // int nCount = 0; // DataSet oSalaryMonthlysDeduct = SalaryMonthly.GetEmpPaySlipDeductForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo = ""; // DataRow[] odros = null; // if (oSalaryMonthlysDeduct.Tables[0].Rows.Count > 0) // { // employeeNo = oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysDeduct.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // //if(oSalaryMonthlysDeduct.Tables[0].Rows.Count>oSalaryMonthlysGross.Tables[0].Rows.Count) // //{ // // odros=new DataRow[oSalaryMonthlysDeduct.Tables[0].Rows.Count]; // //} // foreach (DataRow odRow in oSalaryMonthlysDeduct.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo != odRow["EMPLOYEENO"].ToString()) // { // odros = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros.Length <= nCount) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMerge(oRow, odRow); // PayslipData.Rows.Add(oRow); // } // else oRow = odros[nCount]; // //if (odros.Length <= nCount) continue; // //oRow = odros[nCount]; // oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Deductions)) // oRow["DeducAmount"] = odRow["CHANGEDAMOUNT"]; // oEmployee = oEmps.Find(delegate(Employee oEmpItem) { return oEmpItem.EmployeeNo == odRow["EMPLOYEENO"].ToString().Trim(); }); // //GetGratuityAmount(_oGratuityParams, oEmployee); // // GetPFAmount(oEmployee); // //Gratuity // if (_oGratuityParams.Count > 0 && _oGratuityParams != null) // { // oRow["Gratuity"] = GetGratuityAmount(_oGratuityParams, oEmployee, salaryMonth); // } // else // { // oRow["Gratuity"] = 0; // } // oRow["PF"] = GetPFAmount(oEmployee, salaryMonth); // #region Loan Issue // ////Personal Loan // //if ((Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment) && ((Convert.ToInt32(odRow["ItemID"]) == 3))) // //{ // // loanAmounn = 0.0; // // actuInterest = 0.0; // // principleAmount = 0.0; // // interest = 0.0; // // balance = 0.0; // // sattelmentAmount = 0.0; // // LoanIssue oLIssue=LoanIssue.GetExistingLoan(ID.FromInteger(Convert.ToInt32(odRow["ItemID"])),oEmployee.ID); // // //LoanIssue oLIssue = oLoanIssues.Find(delegate(LoanIssue item1) { return oEmployee.ID == item1.EmployeeID && item1.LoanID == ID.FromInteger(Convert.ToInt32(odRow["ItemID"])); }); // // if (oLIssue != null) // // { // // loanAmounn = oLIssue.LoanAmount; // // List oLSS = oLoanScheduls.FindAll(delegate(LoanSchedule oitem) { return oitem.LoanIssueID == oLIssue.ID; }); // // if (oLSS.Count>0) // // { // // List oBeforeSMonths = oLSS.FindAll(delegate(LoanSchedule oitem) { return oitem.DueInstallmentDate <= GlobalFunctions.LastDateOfMonth(salaryMonth); }); // // foreach (LoanSchedule oScedule in oBeforeSMonths) // // { // // actuInterest = actuInterest + oScedule.ActualInterest; // // principleAmount = principleAmount + oScedule.InstallmentPrincipal; // // interest = interest + oScedule.InstallmentInterest; // // balance = balance + oScedule.OpeningBalance; // // //oTemLoanSchedule.Add(oScedule); // // } // // } // // sattelmentAmount = (loanAmounn + actuInterest) - (principleAmount + interest); // // } // // oRow["PersonalLoan"] = sattelmentAmount;//odRow["CHANGEDAMOUNT"]; // //} // //Vehicle Loan // //if ((Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment && (Convert.ToInt32(odRow["ItemID"]) == 4))) // //{ // // loanAmounn = 0.0; // // actuInterest = 0.0; // // principleAmount = 0.0; // // interest = 0.0; // // balance = 0.0; // // sattelmentAmount = 0.0; // // LoanIssue oLIssue=LoanIssue.GetExistingLoan(ID.FromInteger(Convert.ToInt32(odRow["ItemID"])),oEmployee.ID); // // //LoanIssue oLIssue = oLoanIssues.Find(delegate(LoanIssue item1) { return oEmployee.ID == item1.EmployeeID && item1.LoanID == ID.FromInteger(Convert.ToInt32(odRow["ItemID"])); }); // // if (oLIssue != null) // // { // // loanAmounn = oLIssue.LoanAmount; // // List oLSS = oLoanScheduls.FindAll(delegate(LoanSchedule oitem) { return oitem.LoanIssueID == oLIssue.ID; }); // // if (oLSS.Count > 0) // // { // // List oBeforeSMonths = oLSS.FindAll(delegate(LoanSchedule oitem) { return oitem.DueInstallmentDate <= GlobalFunctions.LastDateOfMonth(salaryMonth); }); // // foreach (LoanSchedule oScedule in oBeforeSMonths) // // { // // actuInterest = actuInterest + oScedule.ActualInterest; // // principleAmount = principleAmount + oScedule.InstallmentPrincipal; // // interest = interest + oScedule.InstallmentInterest; // // balance = balance + oScedule.OpeningBalance; // // //oTemLoanSchedule.Add(oScedule); // // } // // } // // sattelmentAmount = (loanAmounn + actuInterest) - (principleAmount + interest); // // } // // oRow["VechileLoan"] = sattelmentAmount;//odRow["CHANGEDAMOUNT"]; // //} // //House Loan // //if ((Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Monthly_Installment && (Convert.ToInt32(odRow["ItemID"]) == 2))) // //{ // // loanAmounn = 0.0; // // actuInterest = 0.0; // // principleAmount = 0.0; // // interest = 0.0; // // balance = 0.0; // // sattelmentAmount = 0.0; // // LoanIssue oLIssue=LoanIssue.GetExistingLoan(ID.FromInteger(Convert.ToInt32(odRow["ItemID"])),oEmployee.ID); // // //LoanIssue oLIssue = oLoanIssues.Find(delegate(LoanIssue item1) { return oEmployee.ID == item1.EmployeeID && item1.LoanID == ID.FromInteger(Convert.ToInt32(odRow["ItemID"])); }); // // if (oLIssue != null) // // { // // loanAmounn = oLIssue.LoanAmount; // // List oLSS = oLoanScheduls.FindAll(delegate(LoanSchedule oitem) { return oitem.LoanIssueID == oLIssue.ID; }); // // if (oLSS.Count > 0) // // { // // List oBeforeSMonths = oLSS.FindAll(delegate(LoanSchedule oitem) { return oitem.DueInstallmentDate <= GlobalFunctions.LastDateOfMonth(salaryMonth); }); // // foreach (LoanSchedule oScedule in oBeforeSMonths) // // { // // actuInterest = actuInterest + oScedule.ActualInterest; // // principleAmount = principleAmount + oScedule.InstallmentPrincipal; // // interest = interest + oScedule.InstallmentInterest; // // balance = balance + oScedule.OpeningBalance; // // //oTemLoanSchedule.Add(oScedule); // // } // // } // // sattelmentAmount = (loanAmounn + actuInterest) - (principleAmount + interest); // // } // // oRow["HomeLoan"] = sattelmentAmount;//odRow["CHANGEDAMOUNT"]; // //} // //if ((Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.PF_Contribution && (Convert.ToInt32(odRow["ItemID"]) == (int)EnumSalaryItemCode.PF_Contribution))) // //{ // // oRow["PF"] = odRow["CHANGEDAMOUNT"]; // //} // #endregion // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // } // nCount = 0; // DataSet oSalaryMonthlysIncomeTax = SalaryMonthly.GetEmpPaySlipIncomeTaxAmountForOthers(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo1 = ""; // DataRow[] odros1 = null; // if (oSalaryMonthlysIncomeTax.Tables[0].Rows.Count > 0) // { // employeeNo1 = oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros1 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysIncomeTax.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlysIncomeTax.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo1 != odRow["EMPLOYEENO"].ToString()) // { // odros1 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros1.Length <= nCount) continue; // oRow = odros1[nCount]; // //oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.OtherItem) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Inc_Tax_Deduction)) // oRow["IncomTaxAmount"] = odRow["CHANGEDAMOUNT"]; // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // } // nCount = 0; // DataSet oSalaryMonthlysLaonAmount = SalaryMonthly.GetEmpPaySlipDeductForLR(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // string employeeNo12 = ""; // DataRow[] odros12 = null; // if (oSalaryMonthlysLaonAmount.Tables[0].Rows.Count > 0) // { // employeeNo12 = oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString(); // odros12 = PayslipData.Select(" EmployeeNo='" + oSalaryMonthlysLaonAmount.Tables[0].Rows[0]["EMPLOYEENO"].ToString() + "'"); // } // foreach (DataRow odRow in oSalaryMonthlysLaonAmount.Tables[0].Rows) // { // DataRow oRow = null; // if (employeeNo12 != odRow["EMPLOYEENO"].ToString()) // { // odros12 = PayslipData.Select(" EmployeeNo='" + odRow["EMPLOYEENO"].ToString() + "'"); // nCount = 0; // } // if (odros12.Length <= nCount) continue; // oRow = odros12[nCount]; // //oRow["DeducDescription"] = odRow["Description"]; // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Miscellaneous) && (Convert.ToInt32(odRow["ItemCode"]) == (int)EnumSalaryItemCode.Loan_Remain_Balance)) // { // oRow["LoanDescription"] = odRow["Description"]; // oRow["LoanAmount"] = odRow["CHANGEDAMOUNT"]; // } // nCount = nCount + 1; // employeeNo = odRow["EMPLOYEENO"].ToString(); // } // //if (IsApproved) // //{ // form.ShowDlgForPaySlipCiti(_selectedParameter.ReportItem, PayslipData); // //} // //else // //{ // // MessageBox.Show("This salary process is not approve for the month of " + salaryMonth.ToString("MMM yyyy"), "Salary Approved", MessageBoxButtons.OK, MessageBoxIcon.Information); // //} // } // public void ReportOverAllSummeryForManagement() // { // fReportViewer form = new fReportViewer(); // DateTime salaryMonth = _selectedParameter.FromDate.Value; // string sEmpID = _selectedParameter.ReportItem.INSQL; // string[] sEmp = sEmpID.Split(new char[] { ',' }); // int nTotalEmp = sEmp.Count(); // int nCount = 0; // // int noofCashPayment = 0; // DataSet oSalaryMonthlys = SalaryMonthly.GetEmpOverAllSummaryGross(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // // DataSet cashpaymentNo = MiscellaneousDataset.GetCashPaymentSummaryData(GlobalFunctions.LastDateOfMonth(salaryMonth)); // PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable(); // PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable deducDataTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable(); // foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) // { // DataRow oRow = this.GetItemForOverAll(PayslipData, (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMergeForOverAll(oRow, odRow, nTotalEmp, salaryMonth); // nCount = nCount + 1; // PayslipData.Rows.Add(oRow); // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // { // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == 1 && Convert.ToInt32(odRow["ITEMCODE"]) == -113 && Convert.ToInt32(odRow["ITEMID"]) == 36) || (Convert.ToInt32(odRow["ITEMGROUP"]) == 1 && Convert.ToInt32(odRow["ITEMCODE"]) == -113 && Convert.ToInt32(odRow["ITEMID"]) == 144)) // { // oRow["PPAmount"] = odRow["Amount"]; // oRow["Earnings"] = odRow["Amount"]; // } // else { // oRow["Earnings"] = odRow["Amount"]; // } // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // { // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == 8 && Convert.ToInt32(odRow["ITEMCODE"]) == -113 && Convert.ToInt32(odRow["ITEMID"]) == 36) || (Convert.ToInt32(odRow["ITEMGROUP"]) == 8 && Convert.ToInt32(odRow["ITEMCODE"]) == -113 && Convert.ToInt32(odRow["ITEMID"]) == 144)) // { // oRow["PPAmount"] = odRow["Amount"]; // oRow["Arrear"] = odRow["Amount"]; // } // else { // oRow["Arrear"] = odRow["Amount"]; // } // } // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // oRow["UnAuthLeave"] = odRow["Amount"]; // } // oSalaryMonthlys = SalaryMonthly.GetEmpOverAllSummaryDeduct(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // // noofCashPayment = cashpaymentNo.Tables[0].Rows.Count; // int deductRowCount = oSalaryMonthlys.Tables[0].Rows.Count; // int addedDeductRowCount = 0; // try // { // foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) // { // if (deductRowCount <= nCount) // { // DataRow oRow = PayslipData.Rows[addedDeductRowCount]; // if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ITEMCODE"]) == -118 && Convert.ToInt32(odRow["ITEMID"]) == 2) // {//Religious Principle // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -119 && Convert.ToInt32(odRow["ItemID"]) == 2) // {//Religious Interest // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -118 && Convert.ToInt32(odRow["ItemID"])== 1) // {//House Rent Advance Principle // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -119 && Convert.ToInt32(odRow["ItemID"]) == 1) // {//House Rent Advance Interest // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -118 && Convert.ToInt32(odRow["ItemID"]) == 4) // {//House Building Principle // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -119 && Convert.ToInt32(odRow["ItemID"]) == 4) // {//House Building Interest // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -118 && Convert.ToInt32(odRow["ItemID"]) == 8) // {//Pre Leave Pay Principle // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -119 && Convert.ToInt32(odRow["ItemID"]) == 8) // {//Pre Leave Pay Interest // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -118 && Convert.ToInt32(odRow["ItemID"]) == 21) // {//Co-Operative Principle // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -119 && Convert.ToInt32(odRow["ItemID"]) == 21) // {//Co-Operative interest // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToString(odRow["DESCRIPTION"]) == "WPPF") // { // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToString(odRow["DESCRIPTION"]) == "PLP") // { // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToString(odRow["DESCRIPTION"]) == "Flood/Cyclone") // { // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else if (Convert.ToString(odRow["DESCRIPTION"]) == "Bank EMI") // { // oRow["LoanName"] = odRow["DESCRIPTION"]; // oRow["LoanAmount"] = odRow["Amount"]; // } // else // { // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -115 && Convert.ToInt32(odRow["ItemID"]) == 117) || ((Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -115 && Convert.ToInt32(odRow["ItemID"]) == 121)) || ((Convert.ToInt32(odRow["ITEMGROUP"]) == 3 && Convert.ToInt32(odRow["ItemCode"]) == -115 && Convert.ToInt32(odRow["ItemID"]) == 122))) // { // oRow["SCIAmount"] = odRow["Amount"]; // oRow["DeducDescription"] = odRow["Description"]; // oRow["DeducAmount"] = odRow["Amount"]; // } // else // { // oRow["DeducDescription"] = odRow["Description"]; // oRow["DeducAmount"] = odRow["Amount"]; // } // } // deductRowCount--; // addedDeductRowCount++; // } // else // { // DataRow oRow = PayslipData.NewRow(); // oRow["DeducDescription"] = odRow["Description"]; // oRow["DeducAmount"] = odRow["Amount"]; // deductRowCount--; // PayslipData.Rows.Add(oRow); // } // } // } // catch (Exception ex) // { // throw new Exception(ex.Message); // } // form.ShowDlgForPaySlipOverAllSummary(_selectedParameter.ReportItem, PayslipData); // } // public void ReportOverAllSummeryForNonManagement() // { // fReportViewer form = new fReportViewer(); // DateTime salaryMonth = _selectedParameter.FromDate.Value; // string sEmpID = _selectedParameter.ReportItem.INSQL; // string[] sEmp = sEmpID.Split(new char[] { ',' }); // int nTotalEmp = sEmp.Count(); // int nCount = 0; // DataSet oSalaryMonthlys = SalaryMonthly.GetEmpOverAllSummaryGross(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // _hourTable = oSalaryMonthlys.Tables[1]; // PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable PayslipData = new Payroll.Report.PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable(); // PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable deducDataTable = new Payroll.Report.PayrollDataSet.PayrollDataSet.OverAllSummaryDataTable(); // foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) // { // DataRow oRow = this.GetItemForOverAll(PayslipData, (EnumSalaryGroup)Convert.ToInt32(odRow["ITEMGROUP"]), (EnumSalaryItemCode)Convert.ToInt32(odRow["ItemCode"]), Convert.ToInt32(odRow["ItemID"])); // if (oRow == null) // { // oRow = PayslipData.NewRow(); // oRow = this.GrossMergeForOverAll(oRow, odRow, nTotalEmp, salaryMonth); // nCount = nCount + 1; // PayslipData.Rows.Add(oRow); // } // if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Gross)) // oRow["Earnings"] = odRow["Amount"]; // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.Arrear)) // oRow["Arrear"] = odRow["Amount"]; // else if ((Convert.ToInt32(odRow["ITEMGROUP"]) == (int)EnumSalaryGroup.UnauthLeave)) // oRow["UnAuthLeave"] = odRow["Amount"]; // } // oSalaryMonthlys = SalaryMonthly.GetEmpOverAllSummaryDeduct(GlobalFunctions.LastDateOfMonth(salaryMonth), sEmpID); // int deductRowCount = oSalaryMonthlys.Tables[0].Rows.Count; // int addedDeductRowCount = 0; // try // { // foreach (DataRow odRow in oSalaryMonthlys.Tables[0].Rows) // { // if (deductRowCount <= nCount) // { // DataRow oRow = PayslipData.Rows[addedDeductRowCount]; // oRow["DeducDescription"] = odRow["DESCRIPTION"]; // oRow["DeducAmount"] = odRow["Amount"]; // deductRowCount--; // addedDeductRowCount++; // } // else // { // DataRow oRow = PayslipData.NewRow(); // oRow["DeducDescription"] = odRow["Description"]; // oRow["DeducAmount"] = odRow["Amount"]; // deductRowCount--; // PayslipData.Rows.Add(oRow); // } // } // } // catch (Exception ex) // { // throw new Exception(ex.Message); // } // form.ShowDlgForPaySlipOverAllSummary(_selectedParameter.ReportItem, PayslipData); // } // public void ReportOverAllSummary() // { // if (Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID.Integer == 1) // { // ReportOverAllSummeryForManagement(); // } // else // { // ReportOverAllSummeryForNonManagement(); // } // } // } //} #endregion