8410 lines
473 KiB
C#
8410 lines
473 KiB
C#
using Ease.Core.Model;
|
||
using HRM.BO;
|
||
using HRM.DA;
|
||
using Microsoft.Reporting.NETCore;
|
||
using NPOI.SS.Formula.Functions;
|
||
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using System.Text.Json;
|
||
|
||
namespace HRM.Report
|
||
{
|
||
public class RptIncomeTax
|
||
{
|
||
private int _TaxParameterID;
|
||
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 _taxdeducted = 0.0;
|
||
List<Employee> _Employees = null;
|
||
|
||
private double[] m_nXpos;
|
||
private double[] m_nCXpos;
|
||
private double[] m_nCXpos2;
|
||
private double[] m_nExptXpos;
|
||
private double[] m_nColWidth;
|
||
private double[] m_nCColWidth;
|
||
private double[] m_nCColWidth2;
|
||
private double m_nYpos;
|
||
private int m_nCurPage;
|
||
private double m_nTotalWidth;
|
||
private double m_nCTotalWidth;
|
||
private double m_nCTotalWidth2;
|
||
private double _pfInvestment;
|
||
private double _otherInvestment;
|
||
private double _investmentAllowed;
|
||
private double _20Investment;
|
||
DataSet _dSet = new DataSet();
|
||
DataSet _dITSlabs = new DataSet();
|
||
ReportItem _item = null;
|
||
DataTable _dTable = new DataTable();
|
||
string RDLC = string.Empty;
|
||
private List<IncomeTax> _incometaxes;
|
||
private TaxParameter _taxParameter;
|
||
private Employee _employee;
|
||
private bool _investmentwithoutPF;
|
||
private bool _IsTaxCertificate;
|
||
private double _actualInvestment;
|
||
private bool _isPrvs = false;
|
||
int nIndex = 0;
|
||
int empID = 0;
|
||
Employee oEmp = null;
|
||
Grade oGrade = null;
|
||
Department oDepartment = null;
|
||
Designation oDesignation = null;
|
||
List<Employee> oEmployees = null;
|
||
List<Grade> oGrades = null;
|
||
List<Department> oDepartments = null;
|
||
List<Designation> oDesignations = null;
|
||
List<EmployeeCostCenter> oEmployeeCostCenters = null;
|
||
List<ArrearProcessDetail> oArrearProcessDetails = null;
|
||
List<TaxParameter> _taxParameters = null;
|
||
List<IncomeTax> oincometaxes = null;
|
||
ReportParameter rParam = null;
|
||
private List<ReportParameter> reportParameters = new List<ReportParameter>();
|
||
private string signaturePath = "";
|
||
|
||
public byte[] GetDataReport108(int nTaxParamID, string sEmpNo, int payrollTypeId, int systemTaxParamID, DateTime nextPayProcessDate, string reportType)
|
||
{
|
||
|
||
TaxParameter otaxparam = new TaxParameterService().Get(nTaxParamID);
|
||
DataRow oDRow = null;
|
||
DataRow oDRow1 = null;
|
||
DataSet finalDataSet = new DataSet();
|
||
PayrollDataSet.PayrollDataSet.Report108DataTable dTreport108 = new PayrollDataSet.PayrollDataSet.Report108DataTable();
|
||
PayrollDataSet.PayrollDataSet.Report108Part2DataTable dTreport108P2 = new PayrollDataSet.PayrollDataSet.Report108Part2DataTable();
|
||
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
//_Employees = Employee.GetWithDiscontinue();
|
||
_Employees = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollTypeId);
|
||
double nAmount = 0;
|
||
double nFesAmount = 0;
|
||
double nRebAmount = 0;
|
||
double nPFCFAmount = 0;
|
||
double nBonusArrearLeaveOverTimeAmount = 0;
|
||
double nTempAmount = 0;
|
||
double nOthers = 0;
|
||
List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, payrollTypeId);
|
||
Designation desig = null;
|
||
double totalAnnualIncome = 0;
|
||
double tExemption = 0;
|
||
|
||
double totalForeignAnnualIncome = 0.0;
|
||
int empWithoutTIN = _Employees.Count(x => string.IsNullOrEmpty(x.TinNo));
|
||
int foreignEmp = _Employees.Count(x => x.NationalityID.HasValue && x.NationalityID != 0 && x.NationalityID != 1);
|
||
|
||
|
||
foreach (Employee oEmp in _Employees)
|
||
{
|
||
totalAnnualIncome = 0;
|
||
GrandTotal = 0.0;
|
||
nPFCFAmount = 0;
|
||
oDRow = dTreport108.NewRow();
|
||
if (nTaxParamID == systemTaxParamID)
|
||
{
|
||
oIncomeTaxs = new IncomeTaxService().Get(GetEnumForSalaryIT(oEmp.ID, nextPayProcessDate), oEmp.ID, nTaxParamID);
|
||
}
|
||
else
|
||
{
|
||
oIncomeTaxs = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, nTaxParamID);
|
||
}
|
||
|
||
if (oIncomeTaxs == null) continue;
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
GrandTotal = 0;
|
||
List<TaxChallan> oTaxChallans = new TaxChallanService().Get(nTaxParamID, nTaxParamID);
|
||
|
||
if (oIncomeTax != null)
|
||
{
|
||
desig = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
//nIndex = oIncomeTaxs.GetIndex(oEmp.ID);
|
||
oDRow["TIN"] = oEmp.TinNo;
|
||
oDRow["SLNo"] = nCount;//col 1
|
||
oDRow["EmpNo"] = oEmp.EmployeeNo;
|
||
oDRow["Name"] = oEmp.Name;//col 2
|
||
oDRow["PostalAdd"] = "";//Postal Address ,col 3
|
||
oDRow["NEmployee"] = desig != null ? desig.Name : "";//Designation of Employee ,col 4
|
||
//
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary).TotalAmount : 0.0);//Total Amount of Salary Basic+Bonus, col 5
|
||
totalAnnualIncome += nAmount;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["Basic"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
//nAmount = GlobalFunctions.Round(IncomeTax.GetAmount(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus));
|
||
//GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["Bonus"] = GlobalFunctions.TakaFormat(nAmount);
|
||
//oDRow["Total"] = GlobalFunctions.TakaFormat(GrandTotal);
|
||
//
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance).TotalAmount : 0.0);//Periodical Cash Allowance, col 6
|
||
totalAnnualIncome += nAmount;
|
||
nTempAmount = nTempAmount + nAmount;
|
||
oDRow["HREarned"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance).TotalAmount : 0.0);
|
||
oDRow["HRExempted"] = GlobalFunctions.TakaFormat(nAmount);
|
||
nTempAmount = nTempAmount - nAmount;
|
||
oDRow["HRTaxable"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
IncomeTax oITax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Conveyance_Allowance);
|
||
if (oITax != null)
|
||
{
|
||
//
|
||
nAmount = oITax.TotalAmount;
|
||
totalAnnualIncome += nAmount;
|
||
oDRow["CEarned"] = GlobalFunctions.TakaFormat(oITax.TotalAmount);
|
||
}
|
||
else
|
||
oDRow["CEarned"] = 0.0;
|
||
nTempAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance).TotalAmount : 0.0);
|
||
oDRow["CExempted"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
|
||
oDRow["CTaxable"] = GlobalFunctions.TakaFormat(nAmount - nTempAmount);
|
||
GrandTotal = GrandTotal + nAmount - nTempAmount;
|
||
|
||
nTempAmount = 0;
|
||
//
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance).TotalAmount : 0);
|
||
totalAnnualIncome += nAmount;
|
||
oDRow["MEarned"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
nTempAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance).TotalAmount : 0.0);
|
||
oDRow["MExempted"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["MTaxable"] = GlobalFunctions.TakaFormat(nAmount - nTempAmount);
|
||
GrandTotal = GrandTotal + nAmount - nTempAmount;
|
||
|
||
oDRow["Entertainment"] = 0;
|
||
nAmount = 0;
|
||
nTempAmount = 0;
|
||
IncomeTax totalExemption = Get(oIncomeTaxs, oEmp.ID,
|
||
EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
if (totalExemption != null)
|
||
{
|
||
tExemption = totalExemption.TotalAmount;
|
||
}
|
||
if (nTaxParamID >= 2) //nTaxParamID.Integer == 2 (this line of code is changed by Tamanna consulting with chapal vai in 19 August 2020)
|
||
{
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& !titem.Description.Contains("Festive")
|
||
&& !titem.Description.Contains("Festival")
|
||
&& !titem.Description.Contains("LFA")
|
||
&& !titem.Description.Contains("Leave Encashment")
|
||
&& !titem.Description.Contains("Gratuity")
|
||
|
||
)
|
||
{
|
||
//
|
||
nAmount = nAmount + titem.TotalAmount;
|
||
|
||
}
|
||
}
|
||
}
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.Description.Contains("Festive")
|
||
|| titem.Description.Contains("Festival")
|
||
|| titem.Description.Contains("LFA")
|
||
|| titem.Description.Contains("Leave Encashment")
|
||
|| titem.Description.Contains("Gratuity")
|
||
)
|
||
{
|
||
nTempAmount = nTempAmount + titem.TotalAmount;
|
||
}
|
||
}
|
||
}
|
||
|
||
}
|
||
else
|
||
{
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance)
|
||
|
||
|
||
{
|
||
//
|
||
nAmount = nAmount + titem.TotalAmount;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
nOthers = 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& !titem.Description.Contains("TA Reimbursement")
|
||
&& !titem.Description.Contains("Festive")
|
||
&& !titem.Description.Contains("Festival")
|
||
&& !titem.Description.Contains("LFA")
|
||
&& !titem.Description.Contains("Leave Encashment")
|
||
&& !titem.Description.Contains("Gratuity")
|
||
&& !titem.Description.Contains("Joining Bonus")
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.TimeCard
|
||
)
|
||
{
|
||
//
|
||
nOthers = nOthers + titem.TotalAmount;
|
||
|
||
}
|
||
}
|
||
}
|
||
totalAnnualIncome += nAmount + nTempAmount;
|
||
oDRow["Others"] = GlobalFunctions.TakaFormat(nOthers);
|
||
GrandTotal = GrandTotal + nAmount + nTempAmount;
|
||
|
||
IncomeTax taItem = oIncomeTaxs.Where(x => x.Description.Contains("TA Reimbursement")).FirstOrDefault();
|
||
if (taItem != null)
|
||
{
|
||
oDRow["CashReimbursement"] = GlobalFunctions.TakaFormat(taItem.TotalAmount);
|
||
}
|
||
|
||
double wppf = 0;
|
||
double wppfExamp = 0;
|
||
if (oIncomeTaxs.Any(item => item.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Examption && item.TotalAmount > 0))
|
||
wppfExamp = oIncomeTaxs.Where(i => i.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Examption).Select(i => i.TotalAmount).FirstOrDefault();
|
||
oDRow["WPPFExemption"] = GlobalFunctions.TakaFormat(wppfExamp);
|
||
|
||
if (oIncomeTaxs.Any(item => item.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance && item.TotalAmount > 0))
|
||
wppf = oIncomeTaxs.Where(i => i.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance).Select(i => i.TotalAmount).FirstOrDefault();
|
||
oDRow["WPPF"] = GlobalFunctions.TakaFormat(wppf);
|
||
oDRow["WPPFTaxable"] = GlobalFunctions.TakaFormat(wppf - wppfExamp);
|
||
|
||
GrandTotal = GrandTotal + (wppf - wppfExamp);
|
||
|
||
oDRow["FDate"] = (oEmp.JoiningDate > otaxparam.FiscalyearDatefrom) ? oEmp.JoiningDate.ToString("dd MMM yyyy") : otaxparam.FiscalyearDatefrom.ToString("dd MMM yyyy");
|
||
oDRow["TDate"] = (oEmp.Status != EnumEmployeeStatus.Live) ? ((DateTime)oEmp.DiscontinueDate).ToString("dd MMM yyyy") : otaxparam.FiscalyearDateTo.ToString("dd MMM yyyy");
|
||
oDRow["SANDOtherSum"] = 0;//Salary and all other Sum ,col 8
|
||
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Cmp_Provided_House) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Cmp_Provided_House).TotalAmount : 0.0;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
oDRow["EnterAllowance"] = 0;//Amount of Entertaitment Allowance ,col 10
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car).TotalAmount : 0.0;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["VechilesPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["SPByEmployeer"] = 0;//Salary Paid by employeer ,col 12
|
||
oDRow["VOfFree"] = 0;//Value of Rent Free Accomodation or Value of any Concession in Rent for the Accomodation provided by the Employer,col 13
|
||
//
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF).TotalAmount : 0;
|
||
totalAnnualIncome += nAmount;
|
||
|
||
oDRow["EContribution"] = GlobalFunctions.TakaFormat(nAmount);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
|
||
oDRow["InterestCredit"] = 0; //Math.Round(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Interest Credit to the assessee's accout in a recognised provident fund,col 15
|
||
oDRow["VofAnyBenefit"] = 0;//Value of any benefit ,col 15
|
||
//GrandTotal = GrandTotal +
|
||
// Convert.ToDouble(oDRow["SANDOtherSum"]) +
|
||
// Convert.ToDouble(oDRow["BasicPercent"]) +
|
||
// Convert.ToDouble(oDRow["EnterAllowance"]) +
|
||
// Convert.ToDouble(oDRow["VechilesPercent"]) +
|
||
// Convert.ToDouble(oDRow["SPByEmployeer"]) +
|
||
// Convert.ToDouble(oDRow["VOfFree"]) +
|
||
// Convert.ToDouble(oDRow["EContribution"])
|
||
// + Convert.ToDouble(oDRow["InterestCredit"])
|
||
// + Convert.ToDouble(oDRow["VofAnyBenefit"]);
|
||
|
||
oDRow["TotalCol"] = GlobalFunctions.TakaFormat(GrandTotal);//Total Col 5,6,8 to 16 ,col 16
|
||
oDRow["AmountLiable"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
//GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
oDRow["ConToTheProvident"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
oDRow["InvestmentAllowed"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
oDRow["LFA"] = nTaxParamID >= 2
|
||
? GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, 43) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, 43).TotalAmount : new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 43) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 43).TotalAmount : 0)
|
||
: GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, (int)EnumIncomeTaxItemGroup.LFA_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, (int)EnumIncomeTaxItemGroup.LFA_Allowance).TotalAmount : 0);
|
||
oDRow["LFAExamption"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance).TotalAmount : 0);
|
||
oDRow["AIT"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, (int)EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, (int)EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate).TotalAmount : 0);
|
||
|
||
oDRow["TaxIncome"] = GlobalFunctions.TakaFormat(GrandTotal); //GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_Refund, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_Refund, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Taxable Income ,col 19
|
||
//double ndjustedAmount = 0.0;
|
||
//double totalAmountNow = 0.0;
|
||
//if (nTaxParamID != Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID)
|
||
//{
|
||
// foreach (IncomeTax oItem in oIncomeTaxs)
|
||
// {
|
||
// if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
// {
|
||
// if (oItem.ItemGroup != EnumIncomeTaxItemGroup.Tax_Credit_On_Investment)
|
||
// {
|
||
// if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax)
|
||
// ndjustedAmount = ndjustedAmount + oItem.TotalAmount;
|
||
// else
|
||
// ndjustedAmount = ndjustedAmount - oItem.TotalAmount;
|
||
// }
|
||
// }
|
||
// }
|
||
// IncomeTax oNetTaxPayable = IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable, (int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
|
||
// if (oNetTaxPayable != null)
|
||
// {
|
||
// oNetTaxPayable.TotalAmount = oNetTaxPayable.TotalAmount - ndjustedAmount;
|
||
// totalAmountNow = oNetTaxPayable.TotalAmount;
|
||
// oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(oNetTaxPayable.TotalAmount);
|
||
// }
|
||
//}
|
||
//else
|
||
//{
|
||
|
||
IncomeTax oTax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable, (int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
IncomeTax oDeductTax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
|
||
oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(oTax.TotalAmount);
|
||
//if (oTax != null)
|
||
//{
|
||
// if (Convert.ToDouble(oDRow["AIT"].ToString()) > 0 && oTax.TotalAmount < 5000)//&&(oDeductTax.TotalAmount >= 5000 && oDeductTax.TotalAmount <= 6000)
|
||
// {
|
||
// oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(Convert.ToDouble(5000));
|
||
// }
|
||
// else
|
||
// {
|
||
// oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(oTax.TotalAmount);
|
||
// }
|
||
//}
|
||
//else
|
||
//{
|
||
// oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(0);
|
||
//}
|
||
|
||
|
||
//oDRow["TaxPayable"] =
|
||
// GlobalFunctions.TakaFormat(
|
||
// IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
// (int)EnumIncomeTaxItemGroup.Net_Payable) != null
|
||
// ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
// (int)EnumIncomeTaxItemGroup.Net_Payable).TotalAmount
|
||
// : 0); //Tax Payable ,col 20
|
||
// }
|
||
oDRow["ThisMonthAmount"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted).ThisMonthAmount : 0);
|
||
//if (nTaxParamID != Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID)
|
||
//{
|
||
// oDRow["TaxActualDeduct"] = GlobalFunctions.TakaFormat(totalAmountNow);
|
||
//}
|
||
//else
|
||
//{
|
||
|
||
//oDRow["TaxActualDeduct"] =
|
||
// GlobalFunctions.TakaFormat(
|
||
// new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null
|
||
// ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted).TotalAmount
|
||
// : 0); //Tax actually deduct ,col 21
|
||
|
||
// }
|
||
|
||
|
||
//This condition is added for sgs
|
||
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
if (companyName == "SGS Bangladesh Limited")
|
||
{
|
||
TaxParameter taxParameter = new TaxParameterService().Get(nTaxParamID);
|
||
PayrollType pType = new PayrollTypeService().Get(payrollTypeId);
|
||
IncomeTax totalAnnualIncomeForSlab = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
List<TaxParameterSlab> empTaxSlabs = CalculateTaxOnSlab(taxParameter, oEmp, totalAnnualIncomeForSlab.TotalAmount);
|
||
//int index = 0;
|
||
//DataRow dr = null;
|
||
double netAmmountSGS = 0.0;
|
||
foreach (TaxParameterSlab drr in empTaxSlabs)
|
||
{
|
||
if (drr.IncomeAmount == empTaxSlabs[0].IncomeAmount && drr.IncomeAmount > drr.SlabTaxableAmount)
|
||
{
|
||
netAmmountSGS = 0;
|
||
break;
|
||
}
|
||
netAmmountSGS = netAmmountSGS + drr.SlabTaxAmount;
|
||
}
|
||
//double netAmmountSGS = ngrossTax;
|
||
if (netAmmountSGS != 0)
|
||
{
|
||
foreach (IncomeTax oItem in oIncomeTaxs)
|
||
{
|
||
if ((oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate && oItem.ItemID == -227) || (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment && oItem.ItemID == -210))
|
||
//|| (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherAddable && oItem.ItemID == 2))
|
||
netAmmountSGS = netAmmountSGS - oItem.TotalAmount;
|
||
}
|
||
}
|
||
//if (netAmmountSGS == 0)
|
||
// netAmmountSGS = 0.00;
|
||
if (netAmmountSGS < 0 || (netAmmountSGS > 0 && netAmmountSGS < 5000))
|
||
{
|
||
//netAmmountSGS = 5000;
|
||
DataTable dtTaxRegion = null;
|
||
|
||
dtTaxRegion = new SGSExceptionReportService().GetTaxRegionDTByEmpId(oIncomeTaxs[0].TaxParameterID, oEmp.ID);
|
||
if (dtTaxRegion.Rows.Count > 0)
|
||
{
|
||
foreach (DataRow row in dtTaxRegion.Rows)
|
||
{
|
||
short regionType = (short)row["TaxRegionType"];
|
||
if (oEmp.TaxCircle == EnumTaxCircle.CityCorporation)
|
||
{
|
||
netAmmountSGS = 4000;
|
||
}
|
||
if (oEmp.TaxCircle == EnumTaxCircle.Union)
|
||
{
|
||
netAmmountSGS = 3000;
|
||
}
|
||
}
|
||
}
|
||
else
|
||
netAmmountSGS = 5000;
|
||
}
|
||
oDRow["TaxActualDeduct"] = GlobalFunctions.TakaFormat(netAmmountSGS);
|
||
}
|
||
else
|
||
{
|
||
oDRow["TaxActualDeduct"] =
|
||
GlobalFunctions.TakaFormat(
|
||
new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted) != null
|
||
? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted).TotalAmount
|
||
: 0); //Tax actually deduct ,col 21
|
||
}
|
||
oDRow["TotalChallan"] = oTaxChallans.Count > 0 ? GlobalFunctions.TakaFormat(oTaxChallans.Where(x => x.EmployeeID == oEmp.ID).Sum(x => x.Amount)) : "0";
|
||
oDRow["ThisYearBasicPay"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary).TotalAmount : 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
|
||
if (EnumIncomeTaxItemGroup.Company_Contri_PF == titem.ItemGroup ||
|
||
titem.Description.Contains("Gratuity")
|
||
|
||
|
||
)
|
||
{
|
||
//
|
||
//nPFCFAmount = nPFCFAmount + titem.TotalAmount;
|
||
nPFCFAmount = titem.TotalAmount;
|
||
|
||
}
|
||
}
|
||
|
||
oDRow["CompanyPf"] = nPFCFAmount;
|
||
nBonusArrearLeaveOverTimeAmount = 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
//if (titem.Description.Contains("Arrear") || titem.Description.Contains("Leave Encashment") || titem.Description.Contains("overtime") || titem.Description.Contains("Advance") ||
|
||
// (titem.Description.Contains("Bonus") && !(titem.Description.Contains("Festive")
|
||
// || titem.Description.Contains("Festival")))
|
||
|
||
|
||
// )
|
||
if (titem.Description.Contains("Arrear") || titem.Description.Contains("Leave Encashment") || titem.Description.Contains("overtime") || titem.Description.Contains("Advance") || titem.Description.Contains("Dress Allowance") ||
|
||
(titem.Description.Contains("Bonus") || titem.Description.Contains("Over Time") ||
|
||
(titem.Description.Contains("Festive") || titem.Description.Contains("Festival")))
|
||
|
||
|
||
)
|
||
{
|
||
//
|
||
nBonusArrearLeaveOverTimeAmount = nBonusArrearLeaveOverTimeAmount + titem.TotalAmount;
|
||
|
||
}
|
||
}
|
||
}
|
||
oDRow["BonusArrearLeaveOverTimeAmount"] = nBonusArrearLeaveOverTimeAmount;
|
||
nFesAmount = 0;
|
||
//foreach (IncomeTax titem in oIncomeTaxs)
|
||
//{
|
||
// if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
// {
|
||
// if (
|
||
// titem.Description.Contains("Festive")
|
||
// || titem.Description.Contains("Festival")
|
||
|
||
// )
|
||
// {
|
||
// //
|
||
// nFesAmount = nFesAmount + titem.TotalAmount;
|
||
|
||
// }
|
||
// }
|
||
//}
|
||
oDRow["FestivalBonus"] = nFesAmount;
|
||
oDRow["Remarks"] = "";//Remarks ,col 22
|
||
|
||
//IncomeTax totalExemption = Get(oIncomeTaxs, oEmp.ID,
|
||
//EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
//if (totalExemption != null)
|
||
//{
|
||
// tExemption = totalExemption.TotalAmount;
|
||
//}
|
||
//oDRow["ExemptedIncome"] = Convert.ToDouble(oDRow["HRExempted"].ToString()) + Convert.ToDouble(oDRow["CExempted"].ToString()) + Convert.ToDouble(oDRow["MExempted"].ToString()) + Convert.ToDouble(oDRow["WPPFExemption"].ToString()) + Convert.ToDouble(oDRow["LFAExamption"].ToString());
|
||
oDRow["ExemptedIncome"] = tExemption; ;
|
||
nRebAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0.0);
|
||
oDRow["RebateIncome"] = nRebAmount;
|
||
//oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(totalAnnualIncome + nBonusArrearLeaveOverTimeAmount);
|
||
|
||
//oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(totalAnnualIncome);
|
||
oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income).TotalAmount : 0.0));
|
||
//oDRow["Total"] = GlobalFunctions.TakaFormat(Convert.ToDouble(oDRow["TotalAnnualIncome"].ToString()) - Convert.ToDouble(oDRow["ExemptedIncome"].ToString()));
|
||
oDRow["Total"] = GlobalFunctions.TakaFormat(GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income).TotalAmount : 0.0));
|
||
|
||
// Sum for foreign employees
|
||
if (oEmp.NationalityID != 0 && oEmp.NationalityID != 1)
|
||
{
|
||
// Convert formatted string back to double
|
||
double incomeToAdd;
|
||
if (double.TryParse(oDRow["TotalAnnualIncome"].ToString(), out incomeToAdd))
|
||
{
|
||
totalForeignAnnualIncome += incomeToAdd;
|
||
}
|
||
}
|
||
|
||
dTreport108.Rows.Add(oDRow);
|
||
nCount++;
|
||
|
||
}
|
||
}
|
||
|
||
double SumOfTotalAnnualIncome = dTreport108.AsEnumerable().Sum(row =>
|
||
string.IsNullOrEmpty(row["TotalAnnualIncome"].ToString())
|
||
? 0
|
||
: Convert.ToDouble(row["TotalAnnualIncome"]));
|
||
|
||
double SumOfTotalAnnualIncomeWithoutTIN = dTreport108.AsEnumerable()
|
||
.Where(row =>
|
||
string.IsNullOrWhiteSpace(row["TIN"]?.ToString()) // TIN is null, empty, or whitespace
|
||
)
|
||
.Sum(row =>
|
||
double.TryParse(row["TotalAnnualIncome"]?.ToString(), out double val) ? val : 0
|
||
);
|
||
|
||
|
||
oDRow1 = dTreport108P2.NewRow();
|
||
oDRow1["EmpWithoutTIN"] = empWithoutTIN;
|
||
oDRow1["ForeignEmp"] = foreignEmp;
|
||
oDRow1["TotalForeignAnnualIncome"] = totalForeignAnnualIncome;
|
||
oDRow1["SumOfTotalAnnualIncome"] = SumOfTotalAnnualIncome;
|
||
oDRow1["SumOfTotalAnnualIncomeWithoutTIN"] = SumOfTotalAnnualIncomeWithoutTIN;
|
||
dTreport108P2.Rows.Add(oDRow1);
|
||
|
||
dTreport108.TableName = "PayrollDataSet_Report108";
|
||
finalDataSet.Tables.Add(dTreport108);
|
||
|
||
dTreport108P2.TableName = "PayrollDataSet_Report108P2";
|
||
finalDataSet.Tables.Add(dTreport108P2);
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowDlgForReport108(null, finalDataSet, payrollTypeId, reportType, otaxparam.AssessmentYear);
|
||
}
|
||
|
||
public byte[] GetDataReport177(string sEmpNo, int payrollTypeId, DateTime SalaryMonth, string reportType)
|
||
{
|
||
// TaxParameter otaxparam = new TaxParameterService().Get(nTaxParamID);
|
||
DataRow oDRow = null;
|
||
DataRow tempDr = null;
|
||
PayrollDataSet.PayrollDataSet.Report108DataTable dTreport108 = new PayrollDataSet.PayrollDataSet.Report108DataTable();
|
||
MiscellaneousDatasetService miscellaneousDatasetService = new MiscellaneousDatasetService();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
//_Employees = Employee.GetWithDiscontinue();
|
||
_Employees = new EmployeeService().GetByEmpIDs(sEmpNo);
|
||
double nAmount = 0;
|
||
double nFesAmount = 0;
|
||
double nRebAmount = 0;
|
||
double nPFCFAmount = 0;
|
||
double nBonusArrearLeaveOverTimeAmount = 0;
|
||
double nTempAmount = 0;
|
||
double nOthers = 0;
|
||
List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, payrollTypeId);
|
||
Designation desig = null;
|
||
double totalAnnualIncome = 0;
|
||
|
||
TaxParameter oTaxParameter = new TaxParameterService().GetByDate(SalaryMonth, payrollTypeId);
|
||
List<ITEmpHead> itEmpHeads = new ITEmpHeadService().GetWithTaxParam(oTaxParameter.ID);
|
||
DataSet dsPerquisite = miscellaneousDatasetService.GetFor177Data(GlobalFunctions.LastDateOfMonth(SalaryMonth), sEmpNo, payrollTypeId);
|
||
List<TaxMergeMaster> taxMergeMasters = new List<TaxMergeMaster>();
|
||
List<TaxMergeMaster> otherTaxMergeMasters = new List<TaxMergeMaster>();
|
||
List<TaxMergeMaster> oTBonousTaxMergeMasters = new List<TaxMergeMaster>();
|
||
taxMergeMasters = new TaxMergeMasterService().GetbyTaxParameter(oTaxParameter.ID, payrollTypeId);
|
||
//TaxMergeMaster taxMergeMaster = null;
|
||
TaxMergeMaster houseRentMergeMaster = null;
|
||
TaxMergeMaster conveyanceMergeMaster = null;
|
||
TaxMergeMaster medicalMergeMaster = null;
|
||
ITEmpHead oITEmpHead = new ITEmpHead();
|
||
if (dsPerquisite != null && dsPerquisite.Tables.Count > 0 && dsPerquisite.Tables[0].Rows.Count > 0)
|
||
{
|
||
otherTaxMergeMasters = taxMergeMasters.Where(titem => titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.TimeCard
|
||
//&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Business_Travel
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Tax_Deducted
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Company_Contri_PF).ToList(); // time card(OT)
|
||
|
||
oTBonousTaxMergeMasters = taxMergeMasters.Where(titem => titem.ItemGroup == EnumIncomeTaxItemGroup.TimeCard || titem.ItemGroup == EnumIncomeTaxItemGroup.Bonus).ToList(); // time card(OT)
|
||
houseRentMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.House_Rent_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.House_Rent_Allowance);
|
||
conveyanceMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Conveyance_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Conveyance_Allowance);
|
||
medicalMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Medical_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Medical_Allowance);
|
||
DataTable tempPerquisite = new DataTable();
|
||
|
||
foreach (Employee oEmp in _Employees)
|
||
{
|
||
tempPerquisite = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().Where(x => x.Field<Int32>("Employeeid") == oEmp.ID).CopyToDataTable();
|
||
GrandTotal = 0.0;
|
||
oDRow = dTreport108.NewRow();
|
||
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
GrandTotal = 0;
|
||
|
||
desig = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
//nIndex = new IncomeTaxService().GetIndex(oEmp.ID);
|
||
oDRow["TIN"] = oEmp.TinNo;
|
||
oDRow["SLNo"] = nCount;//col 1
|
||
oDRow["EmpNo"] = oEmp.EmployeeNo;
|
||
oDRow["Name"] = oEmp.Name;//col 2
|
||
oDRow["PostalAdd"] = "";//Postal Address ,col 3
|
||
oDRow["NEmployee"] = desig != null ? desig.Name : "";//Designation of Employee ,col 4
|
||
|
||
#region Basic
|
||
//taxMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary && x.ItemID == (int)EnumIncomeTaxItemGroup.Basic_Salary);
|
||
// if (taxMergeMaster != null)
|
||
// {
|
||
// foreach (TaxMergeMaster.TaxMergeDetail item in taxMergeMaster.TaxMergeDetails)
|
||
// {
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -101 && x.Field<Int32>("ItemID") == -101 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["Basic"] = GlobalFunctions.TakaFormat(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
//}
|
||
// }
|
||
#endregion
|
||
|
||
#region HousRent
|
||
if (houseRentMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in houseRentMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
oDRow["HREarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
}
|
||
#endregion
|
||
|
||
#region Conveyance
|
||
if (conveyanceMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in conveyanceMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
oDRow["CEarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
}
|
||
#endregion
|
||
|
||
#region Medical
|
||
if (medicalMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in medicalMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
oDRow["MEarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
}
|
||
#endregion
|
||
|
||
#region Others
|
||
if (otherTaxMergeMasters != null && otherTaxMergeMasters.Count > 0)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster otaxmarge in otherTaxMergeMasters)
|
||
{
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in otaxmarge.TaxMergeDetails)
|
||
{
|
||
if (item.Type == EnumTaxMergeType.Allowance)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
}
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
oDRow["Others"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
}
|
||
#endregion
|
||
|
||
#region BonusArrearLeave
|
||
if (oTBonousTaxMergeMasters != null && oTBonousTaxMergeMasters.Count > 0)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster otBonustaxmarge in oTBonousTaxMergeMasters)
|
||
{
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in otBonustaxmarge.TaxMergeDetails)
|
||
{
|
||
if (item.Type == EnumTaxMergeType.Allowance)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
else if (item.Type == EnumTaxMergeType.OT)
|
||
{
|
||
tempDr = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -103 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
else if (item.Type == EnumTaxMergeType.Bonus)
|
||
{
|
||
tempDr = dsPerquisite.Tables["EmpWiseBonus"].AsEnumerable().FirstOrDefault(x => x.Field<Int32>("BonusID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
}
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
oDRow["BonusArrearLeaveOverTimeAmount"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
}
|
||
#endregion
|
||
|
||
#region PF
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -128 && x.Field<Int32>("ItemID") == -128 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["CompanyPf"] = GlobalFunctions.TakaFormat(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
#endregion
|
||
|
||
#region Non-Cash Benefit : Transport
|
||
if (itEmpHeads != null && itEmpHeads.Count > 0)
|
||
{
|
||
oITEmpHead = itEmpHeads.Where(x => x.EmployeeID == oEmp.ID).FirstOrDefault();
|
||
nAmount = GlobalFunctions.Round(oITEmpHead != null ? Convert.ToDouble(oITEmpHead.HouseRent) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["VechilesPercent"] = GlobalFunctions.TakaFormat(oITEmpHead != null ? Convert.ToDouble(oITEmpHead.HouseRent) : 0);
|
||
}
|
||
#endregion
|
||
|
||
#region Tax Deduct
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -129 && x.Field<Int32>("ItemID") == -129 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
oDRow["TaxActualDeduct"] = GlobalFunctions.TakaFormat(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
#endregion
|
||
|
||
|
||
oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(GrandTotal);
|
||
dTreport108.Rows.Add(oDRow);
|
||
nCount++;
|
||
|
||
|
||
}
|
||
}
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowDlgForReport177(null, dTreport108, payrollTypeId, reportType, SalaryMonth.ToString("MMM yyyy"));
|
||
}
|
||
|
||
public byte[] GetDataReport177Quaterly(string sEmpNo, int payrollTypeId, int quarter, string reportType)
|
||
{
|
||
PayrollType payroll = new PayrollTypeService().Get(payrollTypeId);
|
||
DateTime SalaryMonthFrom = DateTime.MinValue;
|
||
DateTime SalaryMonthTo = DateTime.MinValue;
|
||
if (quarter == 1)
|
||
{
|
||
SalaryMonthFrom = new DateTime(payroll.TaxYearEndDate.Year, 7, 1);
|
||
SalaryMonthTo = new DateTime(payroll.TaxYearEndDate.Year, 9, 30);
|
||
}
|
||
else if (quarter == 2)
|
||
{
|
||
SalaryMonthFrom = new DateTime(payroll.TaxYearEndDate.Year, 10, 1);
|
||
SalaryMonthTo = new DateTime(payroll.TaxYearEndDate.Year, 12, 31);
|
||
}
|
||
else if (quarter == 3)
|
||
{
|
||
SalaryMonthFrom = new DateTime(payroll.TaxYearEndDate.Year + 1, 1, 1);
|
||
SalaryMonthTo = new DateTime(payroll.TaxYearEndDate.Year + 1, 3, 31);
|
||
}
|
||
else if (quarter == 4)
|
||
{
|
||
SalaryMonthFrom = new DateTime(payroll.TaxYearEndDate.Year + 1, 4, 1);
|
||
SalaryMonthTo = new DateTime(payroll.TaxYearEndDate.Year + 1, 6, 30);
|
||
}
|
||
DataRow oDRow = null;
|
||
DataRow tempDr = null;
|
||
EnumerableRowCollection<DataRow> tempDrs = null;
|
||
PayrollDataSet.PayrollDataSet.Report108DataTable dTreport108 = new PayrollDataSet.PayrollDataSet.Report108DataTable();
|
||
MiscellaneousDatasetService miscellaneousDatasetService = new MiscellaneousDatasetService();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
//_Employees = Employee.GetWithDiscontinue();
|
||
_Employees = new EmployeeService().GetByEmpIDs(sEmpNo);
|
||
double nAmount = 0;
|
||
double nFesAmount = 0;
|
||
double nRebAmount = 0;
|
||
double nPFCFAmount = 0;
|
||
double nBonusArrearLeaveOverTimeAmount = 0;
|
||
double nTempAmount = 0;
|
||
double nOthers = 0;
|
||
List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, payrollTypeId);
|
||
Designation desig = null;
|
||
double totalAnnualIncome = 0;
|
||
|
||
TaxParameter oTaxParameter = new TaxParameterService().GetByDate(SalaryMonthFrom);
|
||
List<ITEmpHead> itEmpHeads = new ITEmpHeadService().GetWithTaxParam(oTaxParameter.ID);
|
||
DataSet dsPerquisite = miscellaneousDatasetService.GetFor177DataQuarterly(GlobalFunctions.FirstDateOfMonth(SalaryMonthFrom), GlobalFunctions.LastDateOfMonth(SalaryMonthTo), sEmpNo, payrollTypeId);
|
||
|
||
|
||
string em = string.Empty;
|
||
foreach (DataRow rw in dsPerquisite.Tables["EmpWiseBonus"].Rows)
|
||
{
|
||
if (!_Employees.Any(x => x.ID.ToString() == rw["EmployeeId"].ToString()))
|
||
{
|
||
em = em + rw["EmployeeId"].ToString() + ",";
|
||
}
|
||
}
|
||
em = em.Trim(',');
|
||
if (em.Length > 0)
|
||
{
|
||
List<Employee> emps = new EmployeeService().GetByEmpIDs(em);
|
||
foreach (Employee emp in emps)
|
||
{
|
||
_Employees.Add(emp);
|
||
}
|
||
}
|
||
|
||
|
||
List<TaxMergeMaster> taxMergeMasters = new List<TaxMergeMaster>();
|
||
List<TaxMergeMaster> otherTaxMergeMasters = new List<TaxMergeMaster>();
|
||
List<TaxMergeMaster> oTBonousTaxMergeMasters = new List<TaxMergeMaster>();
|
||
taxMergeMasters = new TaxMergeMasterService().GetbyTaxParameter(oTaxParameter.ID, payrollTypeId);
|
||
//TaxMergeMaster taxMergeMaster = null;
|
||
TaxMergeMaster houseRentMergeMaster = null;
|
||
TaxMergeMaster conveyanceMergeMaster = null;
|
||
TaxMergeMaster medicalMergeMaster = null;
|
||
ITEmpHead oITEmpHead = new ITEmpHead();
|
||
if (dsPerquisite != null && dsPerquisite.Tables.Count > 0 && dsPerquisite.Tables[0].Rows.Count > 0)
|
||
{
|
||
otherTaxMergeMasters = taxMergeMasters.Where(titem => titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.TimeCard
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Business_Travel
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Tax_Deducted
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Company_Contri_PF).ToList(); // time card(OT)
|
||
|
||
oTBonousTaxMergeMasters = taxMergeMasters.Where(titem => titem.ItemGroup == EnumIncomeTaxItemGroup.TimeCard || titem.ItemGroup == EnumIncomeTaxItemGroup.Bonus).ToList(); // time card(OT)
|
||
houseRentMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.House_Rent_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.House_Rent_Allowance);
|
||
conveyanceMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Conveyance_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Conveyance_Allowance);
|
||
medicalMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Medical_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Medical_Allowance);
|
||
DataTable tempPerquisite = new DataTable();
|
||
double bonusTax = 0;
|
||
double TotalBonus = 0;
|
||
double TotalMothlyBonus = 0;
|
||
double TotalArear = 0;
|
||
|
||
foreach (Employee oEmp in _Employees)
|
||
{
|
||
|
||
GrandTotal = 0.0;
|
||
oDRow = dTreport108.NewRow();
|
||
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
GrandTotal = 0;
|
||
|
||
desig = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
//nIndex = new IncomeTaxService().GetIndex(oEmp.ID);
|
||
oDRow["TIN"] = oEmp.TinNo;
|
||
oDRow["SLNo"] = nCount;//col 1
|
||
oDRow["EmpNo"] = oEmp.EmployeeNo;
|
||
oDRow["Name"] = oEmp.Name;//col 2
|
||
oDRow["PostalAdd"] = "";//Postal Address ,col 3
|
||
oDRow["NEmployee"] = desig != null ? desig.Name : "";//Designation of Employee ,col 4
|
||
if (dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().Any(x => x.Field<Int32>("Employeeid") == oEmp.ID))
|
||
{
|
||
tempPerquisite = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().Where(x => x.Field<Int32>("Employeeid") == oEmp.ID).CopyToDataTable();
|
||
#region Basic
|
||
//taxMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary && x.ItemID == (int)EnumIncomeTaxItemGroup.Basic_Salary);
|
||
// if (taxMergeMaster != null)
|
||
// {
|
||
// foreach (TaxMergeMaster.TaxMergeDetail item in taxMergeMaster.TaxMergeDetails)
|
||
// {
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -101 && x.Field<Int32>("ItemID") == -101 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["Basic"] = tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0;
|
||
//oDRow["Basic"] = GlobalFunctions.TakaFormat(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
//}
|
||
// }
|
||
#endregion
|
||
|
||
#region HousRent
|
||
if (houseRentMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in houseRentMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["HREarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["HREarned"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
|
||
#region Conveyance
|
||
if (conveyanceMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in conveyanceMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["CEarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["CEarned"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
|
||
#region Medical
|
||
if (medicalMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in medicalMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["MEarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["MEarned"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
|
||
#region Others
|
||
if (otherTaxMergeMasters != null && otherTaxMergeMasters.Count > 0)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster otaxmarge in otherTaxMergeMasters)
|
||
{
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in otaxmarge.TaxMergeDetails)
|
||
{
|
||
if (item.Type == EnumTaxMergeType.Allowance)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
}
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["Others"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["Others"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
}
|
||
#region BonusArrearLeave
|
||
if (oTBonousTaxMergeMasters != null && oTBonousTaxMergeMasters.Count > 0)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster otBonustaxmarge in oTBonousTaxMergeMasters)
|
||
{
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in otBonustaxmarge.TaxMergeDetails)
|
||
{
|
||
if (item.Type == EnumTaxMergeType.Allowance)
|
||
{
|
||
tempDr = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
TotalMothlyBonus = TotalMothlyBonus + nAmount;
|
||
}
|
||
else if (item.Type == EnumTaxMergeType.OT)
|
||
{
|
||
tempDr = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -103 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
else if (item.Type == EnumTaxMergeType.Bonus)
|
||
{
|
||
tempDr = dsPerquisite.Tables["EmpWiseBonus"].AsEnumerable().FirstOrDefault(x => x.Field<Int32>("BonusID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
TotalBonus = TotalBonus + nAmount;
|
||
|
||
}
|
||
}
|
||
}
|
||
tempDrs = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 8 && (x.Field<Int32>("ItemCode") == -113 || x.Field<Int32>("ItemCode") == -101 || x.Field<Int32>("ItemCode") == -103) && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
if (tempDrs != null && tempDrs.Count() > 0)
|
||
{
|
||
foreach (DataRow dr in tempDrs)
|
||
{
|
||
nAmount = GlobalFunctions.Round(dr != null ? Convert.ToDouble(dr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
TotalArear = TotalArear + nAmount;
|
||
}
|
||
|
||
}
|
||
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["BonusArrearLeaveOverTimeAmount"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["BonusArrearLeaveOverTimeAmount"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
if (tempPerquisite != null)
|
||
{
|
||
#region PF
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -128 && x.Field<Int32>("ItemID") == -128 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["CompanyPf"] = GlobalFunctions.TakaFormat(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
oDRow["CompanyPf"] = tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0;
|
||
#endregion
|
||
|
||
#region Non-Cash Benefit : Residence
|
||
if (oEmp.EmployeeNo == "08660")
|
||
{
|
||
nAmount = GlobalFunctions.Round(450000);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else if (oEmp.EmployeeNo == "08661")
|
||
{
|
||
nAmount = GlobalFunctions.Round(529165);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else if (oEmp.EmployeeNo == "08668")
|
||
{
|
||
nAmount = GlobalFunctions.Round(529165);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else if (oEmp.EmployeeNo == "08669")
|
||
{
|
||
nAmount = GlobalFunctions.Round(490000);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else if (oEmp.EmployeeNo == "08772")
|
||
{
|
||
nAmount = GlobalFunctions.Round(525000);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else
|
||
{
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(0);
|
||
oDRow["BasicPercent"] = 0;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Non-Cash Benefit : Transport
|
||
if (itEmpHeads != null && itEmpHeads.Count > 0)
|
||
{
|
||
oITEmpHead = itEmpHeads.Where(x => x.EmployeeID == oEmp.ID).FirstOrDefault();
|
||
nAmount = GlobalFunctions.Round(oITEmpHead != null ? Convert.ToDouble(oITEmpHead.HouseRent) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["VechilesPercent"] = GlobalFunctions.TakaFormat(oITEmpHead != null ? Convert.ToDouble(oITEmpHead.HouseRent) : 0);
|
||
oDRow["VechilesPercent"] = oITEmpHead != null ? Convert.ToDouble(oITEmpHead.HouseRent) : 0;
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
#region Tax Deduct
|
||
if (tempPerquisite != null)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -129 && x.Field<Int32>("ItemID") == -129 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
}
|
||
tempDrs = dsPerquisite.Tables["EmpWiseBonus"].AsEnumerable().Where(x => x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
bonusTax = 0;
|
||
if (tempDrs != null && tempDrs.Count() > 0)
|
||
{
|
||
foreach (DataRow dr in tempDrs)
|
||
{
|
||
bonusTax = GlobalFunctions.Round(dr != null ? Convert.ToDouble(dr["TaxAmount"]) : 0);
|
||
nAmount = nAmount + bonusTax;
|
||
}
|
||
|
||
}
|
||
|
||
//oDRow["TaxActualDeduct"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["TaxActualDeduct"] = nAmount;
|
||
#endregion
|
||
|
||
//oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(GrandTotal);
|
||
oDRow["TotalAnnualIncome"] = GrandTotal;
|
||
dTreport108.Rows.Add(oDRow);
|
||
nCount++;
|
||
|
||
|
||
}
|
||
}
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowDlgForReport177(null, dTreport108, payrollTypeId, reportType, SalaryMonthFrom.ToString("MMMM yyyy - ") + SalaryMonthTo.ToString("MMMM yyyy"), true);
|
||
}
|
||
public byte[] GetDataReport177Yearly(int nTaxParamID, string sEmpNo, int payrollTypeId, int systemTaxParamID, DateTime nextPayProcessDate, string reportType)
|
||
{
|
||
|
||
TaxParameter otaxparam = new TaxParameterService().Get(nTaxParamID);
|
||
DataRow oDRow = null;
|
||
PayrollDataSet.PayrollDataSet.Report108DataTable dTreport108 = new PayrollDataSet.PayrollDataSet.Report108DataTable();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal, GrandTotalNew;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
|
||
_Employees = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollTypeId);
|
||
double nAmount = 0;
|
||
double nFesAmount = 0;
|
||
double nRebAmount = 0;
|
||
double nPFCFAmount = 0;
|
||
double nBonusArrearLeaveOverTimeAmount = 0;
|
||
double nTempAmount = 0;
|
||
double nOthers = 0;
|
||
List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, payrollTypeId);
|
||
Designation desig = null;
|
||
double totalAnnualIncome = 0;
|
||
double tExemption = 0;
|
||
|
||
foreach (Employee oEmp in _Employees)
|
||
{
|
||
totalAnnualIncome = 0;
|
||
GrandTotal = 0.0;
|
||
oDRow = dTreport108.NewRow();
|
||
if (nTaxParamID == systemTaxParamID)
|
||
{
|
||
oIncomeTaxs = new IncomeTaxService().Get(GetEnumForSalaryIT(oEmp.ID, nextPayProcessDate), oEmp.ID, nTaxParamID);
|
||
}
|
||
else
|
||
{
|
||
oIncomeTaxs = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, nTaxParamID);
|
||
}
|
||
|
||
if (oIncomeTaxs == null) continue;
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
GrandTotal = 0;
|
||
GrandTotalNew = 0;
|
||
nPFCFAmount = 0;
|
||
nRebAmount = 0;
|
||
List<TaxChallan> oTaxChallans = new TaxChallanService().Get(nTaxParamID, nTaxParamID);
|
||
|
||
if (oIncomeTax != null)
|
||
{
|
||
desig = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
oDRow["TIN"] = oEmp.TinNo;
|
||
oDRow["SLNo"] = nCount;
|
||
oDRow["EmpNo"] = oEmp.EmployeeNo;
|
||
oDRow["Name"] = oEmp.Name;
|
||
oDRow["PostalAdd"] = "";
|
||
oDRow["NEmployee"] = desig != null ? desig.Name : "";
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary).TotalAmount : 0.0);//Total Amount of Salary Basic+Bonus, col 5
|
||
totalAnnualIncome += nAmount;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["Basic"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["Basic"] = nAmount;
|
||
GrandTotalNew = GrandTotalNew + nAmount;
|
||
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance).TotalAmount : 0.0);//Periodical Cash Allowance, col 6
|
||
totalAnnualIncome += nAmount;
|
||
nTempAmount = nTempAmount + nAmount;
|
||
//oDRow["HREarned"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["HREarned"] = nAmount;
|
||
GrandTotalNew = GrandTotalNew + nAmount;
|
||
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance).TotalAmount : 0.0);
|
||
//oDRow["HRExempted"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["HRExempted"] = nAmount;
|
||
nTempAmount = nTempAmount - nAmount;
|
||
//oDRow["HRTaxable"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["HRTaxable"] = nTempAmount;
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
IncomeTax oITax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Conveyance_Allowance);
|
||
if (oITax != null)
|
||
{
|
||
nAmount = oITax.TotalAmount;
|
||
totalAnnualIncome += nAmount;
|
||
//oDRow["CEarned"] = GlobalFunctions.TakaFormat(oITax.TotalAmount);
|
||
oDRow["CEarned"] = oITax.TotalAmount;
|
||
GrandTotalNew = GrandTotalNew + oITax.TotalAmount;
|
||
}
|
||
else
|
||
oDRow["CEarned"] = 0.0;
|
||
nTempAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance).TotalAmount : 0.0);
|
||
//oDRow["CExempted"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["CExempted"] = nTempAmount;
|
||
|
||
//oDRow["CTaxable"] = GlobalFunctions.TakaFormat(nAmount - nTempAmount);
|
||
oDRow["CTaxable"] = nAmount - nTempAmount;
|
||
GrandTotal = GrandTotal + nAmount - nTempAmount;
|
||
|
||
nTempAmount = 0;
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance).TotalAmount : 0);
|
||
totalAnnualIncome += nAmount;
|
||
//oDRow["MEarned"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["MEarned"] = nAmount;
|
||
GrandTotalNew = GrandTotalNew + nAmount;
|
||
|
||
nTempAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance).TotalAmount : 0.0);
|
||
//oDRow["MExempted"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
//oDRow["MTaxable"] = GlobalFunctions.TakaFormat(nAmount - nTempAmount);
|
||
oDRow["MExempted"] = nTempAmount;
|
||
oDRow["MTaxable"] = nAmount - nTempAmount;
|
||
GrandTotal = GrandTotal + nAmount - nTempAmount;
|
||
|
||
oDRow["Entertainment"] = 0;
|
||
nAmount = 0;
|
||
nTempAmount = 0;
|
||
IncomeTax totalExemption = Get(oIncomeTaxs, oEmp.ID,
|
||
EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
if (totalExemption != null)
|
||
{
|
||
tExemption = totalExemption.TotalAmount;
|
||
}
|
||
if (nTaxParamID >= 2) //nTaxParamID.Integer == 2 (this line of code is changed by Tamanna consulting with chapal vai in 19 August 2020)
|
||
{
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& !titem.Description.Contains("Festive")
|
||
&& !titem.Description.Contains("Festival")
|
||
&& !titem.Description.Contains("LFA")
|
||
&& !titem.Description.Contains("Leave Encashment")
|
||
&& !titem.Description.Contains("Gratuity")
|
||
)
|
||
{
|
||
nAmount = nAmount + titem.TotalAmount;
|
||
}
|
||
}
|
||
}
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.Description.Contains("Festive")
|
||
|| titem.Description.Contains("Festival")
|
||
|| titem.Description.Contains("LFA")
|
||
|| titem.Description.Contains("Leave Encashment")
|
||
|| titem.Description.Contains("Gratuity")
|
||
)
|
||
{
|
||
nTempAmount = nTempAmount + titem.TotalAmount;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance)
|
||
{
|
||
nAmount = nAmount + titem.TotalAmount;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
nOthers = 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& !titem.Description.Contains("TA Reimbursement")
|
||
&& !titem.Description.Contains("Festive")
|
||
&& !titem.Description.Contains("Festival")
|
||
&& !titem.Description.Contains("LFA")
|
||
&& !titem.Description.Contains("Leave Encashment")
|
||
&& !titem.Description.Contains("Gratuity")
|
||
&& !titem.Description.Contains("Joining Bonus")
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.TimeCard
|
||
)
|
||
{
|
||
nOthers = nOthers + titem.TotalAmount;
|
||
}
|
||
}
|
||
}
|
||
totalAnnualIncome += nAmount + nTempAmount;
|
||
//oDRow["Others"] = GlobalFunctions.TakaFormat(nOthers);
|
||
oDRow["Others"] = nOthers;
|
||
GrandTotal = GrandTotal + nAmount + nTempAmount;
|
||
GrandTotalNew = GrandTotalNew + nOthers;
|
||
|
||
|
||
IncomeTax taItem = oIncomeTaxs.Where(x => x.Description.Contains("TA Reimbursement")).FirstOrDefault();
|
||
if (taItem != null)
|
||
{
|
||
//oDRow["CashReimbursement"] = GlobalFunctions.TakaFormat(taItem.TotalAmount);
|
||
oDRow["CashReimbursement"] = taItem.TotalAmount;
|
||
GrandTotalNew = GrandTotalNew + taItem.TotalAmount;
|
||
}
|
||
|
||
double wppf = 0;
|
||
double wppfExamp = 0;
|
||
if (oIncomeTaxs.Any(item => item.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Examption && item.TotalAmount > 0))
|
||
wppfExamp = oIncomeTaxs.Where(i => i.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Examption).Select(i => i.TotalAmount).FirstOrDefault();
|
||
oDRow["WPPFExemption"] = GlobalFunctions.TakaFormat(wppfExamp);
|
||
|
||
if (oIncomeTaxs.Any(item => item.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance && item.TotalAmount > 0))
|
||
wppf = oIncomeTaxs.Where(i => i.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance).Select(i => i.TotalAmount).FirstOrDefault();
|
||
//oDRow["WPPF"] = GlobalFunctions.TakaFormat(wppf);
|
||
//oDRow["WPPFTaxable"] = GlobalFunctions.TakaFormat(wppf - wppfExamp);
|
||
oDRow["WPPF"] = wppf;
|
||
oDRow["WPPFTaxable"] = wppf - wppfExamp;
|
||
|
||
GrandTotal = GrandTotal + (wppf - wppfExamp);
|
||
|
||
oDRow["FDate"] = (oEmp.JoiningDate > otaxparam.FiscalyearDatefrom) ? oEmp.JoiningDate.ToString("dd MMM yyyy") : otaxparam.FiscalyearDatefrom.ToString("dd MMM yyyy");
|
||
oDRow["TDate"] = (oEmp.Status != EnumEmployeeStatus.Live) ? ((DateTime)oEmp.EndOfContractDate).ToString("dd MMM yyyy") : otaxparam.FiscalyearDateTo.ToString("dd MMM yyyy");
|
||
oDRow["SANDOtherSum"] = 0;//Salary and all other Sum ,col 8
|
||
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Cmp_Provided_House) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Cmp_Provided_House).TotalAmount : 0.0;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
GrandTotalNew = GrandTotalNew + nAmount;
|
||
|
||
oDRow["EnterAllowance"] = 0;//Amount of Entertaitment Allowance ,col 10
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car).TotalAmount : 0.0;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["VechilesPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["VechilesPercent"] = nAmount;
|
||
GrandTotalNew = GrandTotalNew + nAmount;
|
||
oDRow["SPByEmployeer"] = 0;//Salary Paid by employeer ,col 12
|
||
oDRow["VOfFree"] = 0;//Value of Rent Free Accomodation or Value of any Concession in Rent for the Accomodation provided by the Employer,col 13
|
||
//
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF).TotalAmount : 0;
|
||
totalAnnualIncome += nAmount;
|
||
|
||
//oDRow["EContribution"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["EContribution"] = nAmount;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
|
||
oDRow["InterestCredit"] = 0; //Math.Round(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Interest Credit to the assessee's accout in a recognised provident fund,col 15
|
||
oDRow["VofAnyBenefit"] = 0;//Value of any benefit ,col 15
|
||
//GrandTotal = GrandTotal +
|
||
// Convert.ToDouble(oDRow["SANDOtherSum"]) +
|
||
// Convert.ToDouble(oDRow["BasicPercent"]) +
|
||
// Convert.ToDouble(oDRow["EnterAllowance"]) +
|
||
// Convert.ToDouble(oDRow["VechilesPercent"]) +
|
||
// Convert.ToDouble(oDRow["SPByEmployeer"]) +
|
||
// Convert.ToDouble(oDRow["VOfFree"]) +
|
||
// Convert.ToDouble(oDRow["EContribution"])
|
||
// + Convert.ToDouble(oDRow["InterestCredit"])
|
||
// + Convert.ToDouble(oDRow["VofAnyBenefit"]);
|
||
|
||
//oDRow["TotalCol"] = GlobalFunctions.TakaFormat(GrandTotal);//Total Col 5,6,8 to 16 ,col 16
|
||
//oDRow["AmountLiable"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
// //GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
//oDRow["ConToTheProvident"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
//oDRow["InvestmentAllowed"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
//oDRow["LFA"] = nTaxParamID >= 2
|
||
// ? GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, 43) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, 43).TotalAmount : new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 43) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 43).TotalAmount : 0)
|
||
// : GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, (int)EnumIncomeTaxItemGroup.LFA_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, (int)EnumIncomeTaxItemGroup.LFA_Allowance).TotalAmount : 0);
|
||
//oDRow["LFAExamption"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance).TotalAmount : 0);
|
||
//oDRow["AIT"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, (int)EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, (int)EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate).TotalAmount : 0);
|
||
|
||
//oDRow["TaxIncome"] = GlobalFunctions.TakaFormat(GrandTotal);
|
||
|
||
oDRow["TotalCol"] = GrandTotal;//Total Col 5,6,8 to 16 ,col 16
|
||
oDRow["AmountLiable"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0;//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
//GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
oDRow["ConToTheProvident"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0;//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
oDRow["InvestmentAllowed"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed).TotalAmount : 0;//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
oDRow["LFA"] = nTaxParamID >= 2
|
||
? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, 43) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, 43).TotalAmount : new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 43) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 43).TotalAmount : 0
|
||
: new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, (int)EnumIncomeTaxItemGroup.LFA_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, (int)EnumIncomeTaxItemGroup.LFA_Allowance).TotalAmount : 0;
|
||
oDRow["LFAExamption"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance).TotalAmount : 0;
|
||
oDRow["AIT"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, (int)EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, (int)EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate).TotalAmount : 0;
|
||
oDRow["TaxIncome"] = GrandTotal;
|
||
|
||
//GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_Refund, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_Refund, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Taxable Income ,col 19
|
||
//double ndjustedAmount = 0.0;
|
||
//double totalAmountNow = 0.0;
|
||
//if (nTaxParamID != Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID)
|
||
//{
|
||
// foreach (IncomeTax oItem in oIncomeTaxs)
|
||
// {
|
||
// if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
// {
|
||
// if (oItem.ItemGroup != EnumIncomeTaxItemGroup.Tax_Credit_On_Investment)
|
||
// {
|
||
// if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax)
|
||
// ndjustedAmount = ndjustedAmount + oItem.TotalAmount;
|
||
// else
|
||
// ndjustedAmount = ndjustedAmount - oItem.TotalAmount;
|
||
// }
|
||
// }
|
||
// }
|
||
// IncomeTax oNetTaxPayable = IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable, (int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
|
||
// if (oNetTaxPayable != null)
|
||
// {
|
||
// oNetTaxPayable.TotalAmount = oNetTaxPayable.TotalAmount - ndjustedAmount;
|
||
// totalAmountNow = oNetTaxPayable.TotalAmount;
|
||
// oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(oNetTaxPayable.TotalAmount);
|
||
// }
|
||
//}
|
||
//else
|
||
//{
|
||
|
||
IncomeTax oTax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable, (int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
IncomeTax oDeductTax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
|
||
if (oTax != null)
|
||
{
|
||
if (Convert.ToDouble(oDRow["AIT"].ToString()) > 0 && oTax.TotalAmount < 5000)//&&(oDeductTax.TotalAmount >= 5000 && oDeductTax.TotalAmount <= 6000)
|
||
{
|
||
//oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(Convert.ToDouble(5000));
|
||
oDRow["TaxPayable"] = Convert.ToDouble(5000);
|
||
}
|
||
else
|
||
{
|
||
//oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(oTax.TotalAmount);
|
||
oDRow["TaxPayable"] = oTax.TotalAmount;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
//oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(0);
|
||
oDRow["TaxPayable"] = 0;
|
||
}
|
||
|
||
|
||
//oDRow["TaxPayable"] =
|
||
// GlobalFunctions.TakaFormat(
|
||
// IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
// (int)EnumIncomeTaxItemGroup.Net_Payable) != null
|
||
// ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
// (int)EnumIncomeTaxItemGroup.Net_Payable).TotalAmount
|
||
// : 0); //Tax Payable ,col 20
|
||
// }
|
||
|
||
//oDRow["ThisMonthAmount"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted).ThisMonthAmount : 0);
|
||
oDRow["ThisMonthAmount"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted).ThisMonthAmount : 0;
|
||
//if (nTaxParamID != Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID)
|
||
//{
|
||
// oDRow["TaxActualDeduct"] = GlobalFunctions.TakaFormat(totalAmountNow);
|
||
//}
|
||
//else
|
||
//{
|
||
|
||
//oDRow["TaxActualDeduct"] =
|
||
// GlobalFunctions.TakaFormat(
|
||
// new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null
|
||
// ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted).TotalAmount
|
||
// : 0); //Tax actually deduct ,col 21
|
||
|
||
// }
|
||
|
||
|
||
//This condition is added for sgs
|
||
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
#region
|
||
//if (companyName == "SGS Bangladesh Limited")
|
||
//{
|
||
// TaxParameter taxParameter = new TaxParameterService().Get(nTaxParamID);
|
||
// PayrollType pType = new PayrollTypeService().Get(payrollTypeId);
|
||
// IncomeTax totalAnnualIncomeForSlab = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
// List<TaxParameterSlab> empTaxSlabs = CalculateTaxOnSlab(taxParameter, oEmp, totalAnnualIncomeForSlab.TotalAmount);
|
||
// double netAmmountSGS = 0.0;
|
||
// foreach (TaxParameterSlab drr in empTaxSlabs)
|
||
// {
|
||
// if (drr.IncomeAmount == empTaxSlabs[0].IncomeAmount && drr.IncomeAmount > drr.SlabTaxableAmount)
|
||
// {
|
||
// netAmmountSGS = 0;
|
||
// break;
|
||
// }
|
||
// netAmmountSGS = netAmmountSGS + drr.SlabTaxAmount;
|
||
// }
|
||
// if (netAmmountSGS != 0)
|
||
// {
|
||
// foreach (IncomeTax oItem in oIncomeTaxs)
|
||
// {
|
||
// if ((oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate && oItem.ItemID == -227) || (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment && oItem.ItemID == -210))
|
||
// netAmmountSGS = netAmmountSGS - oItem.TotalAmount;
|
||
// }
|
||
// }
|
||
// if (netAmmountSGS < 0 || (netAmmountSGS > 0 && netAmmountSGS < 5000))
|
||
// {
|
||
// DataTable dtTaxRegion = null;
|
||
|
||
// dtTaxRegion = new SGSExceptionReportService().GetTaxRegionDTByEmpId(oIncomeTaxs[0].TaxParameterID, oEmp.ID);
|
||
// if (dtTaxRegion.Rows.Count > 0)
|
||
// {
|
||
// foreach (DataRow row in dtTaxRegion.Rows)
|
||
// {
|
||
// short regionType = (short)row["TaxRegionType"];
|
||
// if (regionType == 2)
|
||
// {
|
||
// netAmmountSGS = 4000;
|
||
// }
|
||
// if (regionType == 3)
|
||
// {
|
||
// netAmmountSGS = 3000;
|
||
// }
|
||
// }
|
||
// }
|
||
// else
|
||
// netAmmountSGS = 5000;
|
||
// }
|
||
// oDRow["TaxActualDeduct"] = GlobalFunctions.TakaFormat(netAmmountSGS);
|
||
//}
|
||
//else
|
||
//{
|
||
// oDRow["TaxActualDeduct"] =
|
||
// GlobalFunctions.TakaFormat(
|
||
// new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null
|
||
// ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted).TotalAmount : 0); //Tax actually deduct ,col 21
|
||
//}
|
||
#endregion
|
||
|
||
//oDRow["TaxActualDeduct"] =
|
||
// GlobalFunctions.TakaFormat(
|
||
// new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null
|
||
// ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted).TotalAmount : 0);
|
||
|
||
oDRow["TaxActualDeduct"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted) != null
|
||
? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted).TotalAmount : 0;
|
||
|
||
//oDRow["TotalChallan"] = oTaxChallans.Count > 0 ? GlobalFunctions.TakaFormat(oTaxChallans.Where(x => x.EmployeeID == oEmp.ID).Sum(x => x.Amount)) : "0";
|
||
oDRow["TotalChallan"] = oTaxChallans.Count > 0 ? oTaxChallans.Where(x => x.EmployeeID == oEmp.ID).Sum(x => x.ChallanAmount) : 0;
|
||
oDRow["ThisYearBasicPay"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary).TotalAmount : 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
|
||
if (EnumIncomeTaxItemGroup.Company_Contri_PF == titem.ItemGroup ||
|
||
titem.Description.Contains("Gratuity")
|
||
|
||
|
||
)
|
||
{
|
||
nPFCFAmount = titem.TotalAmount;
|
||
}
|
||
}
|
||
|
||
oDRow["CompanyPf"] = nPFCFAmount;
|
||
GrandTotalNew = GrandTotalNew + nPFCFAmount;
|
||
nBonusArrearLeaveOverTimeAmount = 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.Description.Contains("Arrear") || titem.Description.Contains("Leave Encashment") || titem.Description.Contains("overtime") || titem.Description.Contains("Advance") || titem.Description.Contains("Dress Allowance") ||
|
||
titem.ItemGroup == EnumIncomeTaxItemGroup.Bonus || titem.ItemGroup == EnumIncomeTaxItemGroup.TimeCard || (titem.Description.Contains("Bonus") || titem.Description.Contains("Over Time") ||
|
||
(titem.Description.Contains("Festive") || titem.Description.Contains("Festival")))
|
||
)
|
||
{
|
||
nBonusArrearLeaveOverTimeAmount = nBonusArrearLeaveOverTimeAmount + titem.TotalAmount;
|
||
|
||
}
|
||
}
|
||
}
|
||
oDRow["BonusArrearLeaveOverTimeAmount"] = nBonusArrearLeaveOverTimeAmount;
|
||
GrandTotalNew = GrandTotalNew + nBonusArrearLeaveOverTimeAmount;
|
||
|
||
nFesAmount = 0;
|
||
//foreach (IncomeTax titem in oIncomeTaxs)
|
||
//{
|
||
// if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
// {
|
||
// if (
|
||
// titem.Description.Contains("Festive")
|
||
// || titem.Description.Contains("Festival")
|
||
|
||
// )
|
||
// {
|
||
// //
|
||
// nFesAmount = nFesAmount + titem.TotalAmount;
|
||
|
||
// }
|
||
// }
|
||
//}
|
||
oDRow["FestivalBonus"] = nFesAmount;
|
||
oDRow["Remarks"] = "";//Remarks ,col 22
|
||
|
||
//IncomeTax totalExemption = Get(oIncomeTaxs, oEmp.ID,
|
||
//EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
//if (totalExemption != null)
|
||
//{
|
||
// tExemption = totalExemption.TotalAmount;
|
||
//}
|
||
//oDRow["ExemptedIncome"] = Convert.ToDouble(oDRow["HRExempted"].ToString()) + Convert.ToDouble(oDRow["CExempted"].ToString()) + Convert.ToDouble(oDRow["MExempted"].ToString()) + Convert.ToDouble(oDRow["WPPFExemption"].ToString()) + Convert.ToDouble(oDRow["LFAExamption"].ToString());
|
||
oDRow["ExemptedIncome"] = tExemption; ;
|
||
nRebAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0.0);
|
||
oDRow["RebateIncome"] = nRebAmount;
|
||
//oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(totalAnnualIncome + nBonusArrearLeaveOverTimeAmount);
|
||
|
||
//oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(totalAnnualIncome);
|
||
//oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income).TotalAmount : 0.0));
|
||
|
||
//oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(GrandTotalNew);
|
||
oDRow["TotalAnnualIncome"] = GrandTotalNew;
|
||
|
||
//oDRow["Total"] = GlobalFunctions.TakaFormat(Convert.ToDouble(oDRow["TotalAnnualIncome"].ToString()) - Convert.ToDouble(oDRow["ExemptedIncome"].ToString()));
|
||
|
||
//oDRow["Total"] = GlobalFunctions.TakaFormat(GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income).TotalAmount : 0.0));
|
||
oDRow["Total"] = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income).TotalAmount : 0.0);
|
||
|
||
|
||
dTreport108.Rows.Add(oDRow);
|
||
nCount++;
|
||
}
|
||
}
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowDlgForReport177Yearly(null, dTreport108, payrollTypeId, reportType, otaxparam.AssessmentYear);
|
||
}
|
||
|
||
public byte[] GetDataReportTaxReconciliation(int nTaxParamID, string sEmpNo, int payrollTypeId, int systemTaxParamID, DateTime nextPayProcessDate, string reportType)
|
||
{
|
||
|
||
TaxParameter otaxparam = new TaxParameterService().Get(nTaxParamID);
|
||
DataRow oDRow = null;
|
||
PayrollDataSet.PayrollDataSet.Report108DataTable dTreport108 = new PayrollDataSet.PayrollDataSet.Report108DataTable();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
_Employees = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollTypeId);
|
||
double nAmount = 0;
|
||
double nFesAmount = 0;
|
||
double nCompanyProvidedCar = 0;
|
||
double nRebAmount = 0;
|
||
double nPFCFAmount = 0;
|
||
double nBonusArrearLeaveOverTimeAmount = 0;
|
||
double springBonus = 0;
|
||
double otherInvestment = 0;
|
||
double taxExemptedIncome = 0;
|
||
double monthlySalary = 0;
|
||
double nTempAmount = 0;
|
||
double nOthers = 0;
|
||
List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, payrollTypeId);
|
||
Designation desig = null;
|
||
double totalAnnualIncome = 0;
|
||
double tExemption = 0;
|
||
DataSet oDFinalIncomeTax = null;
|
||
bool ITStatus = false;
|
||
foreach (Employee oEmp in _Employees)
|
||
{
|
||
_employee = new Employee();
|
||
_incometaxes = new List<IncomeTax>();
|
||
totalAnnualIncome = 0;
|
||
GrandTotal = 0.0;
|
||
oDRow = dTreport108.NewRow();
|
||
if (nTaxParamID == systemTaxParamID)
|
||
{
|
||
oIncomeTaxs = new IncomeTaxService().Get(GetEnumForSalaryIT(oEmp.ID, nextPayProcessDate), oEmp.ID, nTaxParamID);
|
||
}
|
||
else
|
||
{
|
||
oIncomeTaxs = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, nTaxParamID);
|
||
ITStatus = false;
|
||
}
|
||
_incometaxes = oIncomeTaxs;
|
||
if (oIncomeTaxs != null && oIncomeTaxs.Count < 1) continue;
|
||
_employee = oEmp;
|
||
_taxParameter = otaxparam;
|
||
if (nTaxParamID == systemTaxParamID)
|
||
{
|
||
oDFinalIncomeTax = PrepareDatasetNew(oEmp.ID);
|
||
}
|
||
else
|
||
{
|
||
oDFinalIncomeTax = PrepareDatasetNew(oEmp.ID);
|
||
}
|
||
|
||
if (oIncomeTaxs == null) continue;
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
GrandTotal = 0;
|
||
List<TaxChallan> oTaxChallans = new TaxChallanService().Get(nTaxParamID, nTaxParamID);
|
||
|
||
if (oIncomeTax != null)
|
||
{
|
||
desig = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
oDRow["TIN"] = oEmp.TinNo;
|
||
oDRow["SLNo"] = nCount;
|
||
oDRow["EmpNo"] = oEmp.EmployeeNo;
|
||
oDRow["Name"] = oEmp.Name;
|
||
oDRow["PostalAdd"] = "";
|
||
oDRow["NEmployee"] = desig != null ? desig.Name : "";
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary).TotalAmount : 0.0);//Total Amount of Salary Basic+Bonus, col 5
|
||
totalAnnualIncome += nAmount;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["Basic"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance).TotalAmount : 0.0);//Periodical Cash Allowance, col 6
|
||
totalAnnualIncome += nAmount;
|
||
nTempAmount = nTempAmount + nAmount;
|
||
oDRow["HREarned"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance).TotalAmount : 0.0);
|
||
oDRow["HRExempted"] = GlobalFunctions.TakaFormat(nAmount);
|
||
nTempAmount = nTempAmount - nAmount;
|
||
oDRow["HRTaxable"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
IncomeTax oITax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Conveyance_Allowance);
|
||
if (oITax != null)
|
||
{
|
||
nAmount = oITax.TotalAmount;
|
||
totalAnnualIncome += nAmount;
|
||
oDRow["CEarned"] = GlobalFunctions.TakaFormat(oITax.TotalAmount);
|
||
}
|
||
else
|
||
oDRow["CEarned"] = 0.0;
|
||
nTempAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance).TotalAmount : 0.0);
|
||
oDRow["CExempted"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
|
||
oDRow["CTaxable"] = GlobalFunctions.TakaFormat(nAmount - nTempAmount);
|
||
GrandTotal = GrandTotal + nAmount - nTempAmount;
|
||
|
||
nTempAmount = 0;
|
||
nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance).TotalAmount : 0);
|
||
totalAnnualIncome += nAmount;
|
||
oDRow["MEarned"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
nTempAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance).TotalAmount : 0.0);
|
||
oDRow["MExempted"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["MTaxable"] = GlobalFunctions.TakaFormat(nAmount - nTempAmount);
|
||
GrandTotal = GrandTotal + nAmount - nTempAmount;
|
||
|
||
oDRow["Entertainment"] = 0;
|
||
nAmount = 0;
|
||
nTempAmount = 0;
|
||
IncomeTax totalExemption = Get(oIncomeTaxs, oEmp.ID,
|
||
EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
if (totalExemption != null)
|
||
{
|
||
tExemption = totalExemption.TotalAmount;
|
||
}
|
||
if (nTaxParamID >= 2) //nTaxParamID.Integer == 2 (this line of code is changed by Tamanna consulting with chapal vai in 19 August 2020)
|
||
{
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& !titem.Description.Contains("Festive")
|
||
&& !titem.Description.Contains("Festival")
|
||
&& !titem.Description.Contains("LFA")
|
||
&& !titem.Description.Contains("Leave Encashment")
|
||
&& !titem.Description.Contains("Gratuity")
|
||
)
|
||
{
|
||
nAmount = nAmount + titem.PreviousAmount + titem.ThisMonthAmount;
|
||
}
|
||
}
|
||
}
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.Description.Contains("Festive")
|
||
|| titem.Description.Contains("Festival")
|
||
|| titem.Description.Contains("LFA")
|
||
|| titem.Description.Contains("Leave Encashment")
|
||
|| titem.Description.Contains("Gratuity")
|
||
)
|
||
{
|
||
nTempAmount = nTempAmount + titem.PreviousAmount + titem.ThisMonthAmount;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
else
|
||
{
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance)
|
||
{
|
||
nAmount = nAmount + titem.PreviousAmount + titem.ThisMonthAmount;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
nOthers = 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& !titem.Description.Contains("TA Reimbursement")
|
||
&& !titem.Description.Contains("Festive")
|
||
&& !titem.Description.Contains("Festival")
|
||
&& !titem.Description.Contains("LFA")
|
||
&& !titem.Description.Contains("Leave Encashment")
|
||
&& !titem.Description.Contains("Gratuity")
|
||
&& !titem.Description.Contains("Joining Bonus")
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.TimeCard
|
||
)
|
||
{
|
||
nOthers = nOthers + titem.PreviousAmount + titem.ThisMonthAmount;
|
||
}
|
||
}
|
||
}
|
||
totalAnnualIncome += nAmount + nTempAmount;
|
||
oDRow["Others"] = GlobalFunctions.TakaFormat(nOthers);
|
||
GrandTotal = GrandTotal + nAmount + nTempAmount;
|
||
|
||
IncomeTax taItem = oIncomeTaxs.Where(x => x.Description.Contains("TA Reimbursement")).FirstOrDefault();
|
||
if (taItem != null)
|
||
{
|
||
oDRow["CashReimbursement"] = GlobalFunctions.TakaFormat(taItem.TotalAmount);
|
||
}
|
||
|
||
double wppf = 0;
|
||
double wppfExamp = 0;
|
||
if (oIncomeTaxs.Any(item => item.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Examption && item.TotalAmount > 0))
|
||
wppfExamp = oIncomeTaxs.Where(i => i.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Examption).Select(i => i.TotalAmount).FirstOrDefault();
|
||
oDRow["WPPFExemption"] = GlobalFunctions.TakaFormat(wppfExamp);
|
||
|
||
if (oIncomeTaxs.Any(item => item.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance && item.TotalAmount > 0))
|
||
wppf = oIncomeTaxs.Where(i => i.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance).Select(i => i.TotalAmount).FirstOrDefault();
|
||
oDRow["WPPF"] = GlobalFunctions.TakaFormat(wppf);
|
||
oDRow["WPPFTaxable"] = GlobalFunctions.TakaFormat(wppf - wppfExamp);
|
||
|
||
GrandTotal = GrandTotal + (wppf - wppfExamp);
|
||
|
||
oDRow["FDate"] = (oEmp.JoiningDate > otaxparam.FiscalyearDatefrom) ? oEmp.JoiningDate.ToString("dd MMM yyyy") : otaxparam.FiscalyearDatefrom.ToString("dd MMM yyyy");
|
||
oDRow["TDate"] = (oEmp.Status != EnumEmployeeStatus.Live) ? ((DateTime)oEmp.DiscontinueDate).ToString("dd MMM yyyy") : otaxparam.FiscalyearDateTo.ToString("dd MMM yyyy");
|
||
oDRow["SANDOtherSum"] = 0;//Salary and all other Sum ,col 8
|
||
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Cmp_Provided_House) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Cmp_Provided_House).TotalAmount : 0.0;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
oDRow["EnterAllowance"] = 0;//Amount of Entertaitment Allowance ,col 10
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car).TotalAmount : 0.0;
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["VechilesPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["SPByEmployeer"] = 0;//Salary Paid by employeer ,col 12
|
||
oDRow["VOfFree"] = 0;//Value of Rent Free Accomodation or Value of any Concession in Rent for the Accomodation provided by the Employer,col 13
|
||
//
|
||
nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF).TotalAmount : 0;
|
||
totalAnnualIncome += nAmount;
|
||
|
||
oDRow["EContribution"] = GlobalFunctions.TakaFormat(nAmount);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
|
||
oDRow["InterestCredit"] = 0; //Math.Round(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Interest Credit to the assessee's accout in a recognised provident fund,col 15
|
||
oDRow["VofAnyBenefit"] = 0;
|
||
|
||
oDRow["TotalCol"] = GlobalFunctions.TakaFormat(GrandTotal);//Total Col 5,6,8 to 16 ,col 16
|
||
oDRow["AmountLiable"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
//GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
oDRow["ConToTheProvident"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
oDRow["InvestmentAllowed"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Investment_Allowed, (int)EnumIncomeTaxItemGroup.Investment_Allowed).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
oDRow["LFA"] = nTaxParamID >= 2
|
||
? GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, 43) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, 43).TotalAmount : new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 43) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 43).TotalAmount : 0)
|
||
: GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, (int)EnumIncomeTaxItemGroup.LFA_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance, (int)EnumIncomeTaxItemGroup.LFA_Allowance).TotalAmount : 0);
|
||
oDRow["LFAExamption"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance).TotalAmount : 0);
|
||
oDRow["AIT"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, (int)EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, (int)EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate).TotalAmount : 0);
|
||
|
||
oDRow["TaxIncome"] = GlobalFunctions.TakaFormat(GrandTotal);
|
||
|
||
IncomeTax oTax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable, (int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
IncomeTax oDeductTax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
|
||
if (oTax != null)
|
||
{
|
||
if (Convert.ToDouble(oDRow["AIT"].ToString()) > 0 && oTax.TotalAmount < 5000)//&&(oDeductTax.TotalAmount >= 5000 && oDeductTax.TotalAmount <= 6000)
|
||
{
|
||
oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(Convert.ToDouble(5000));
|
||
}
|
||
else
|
||
{
|
||
oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(oTax.TotalAmount);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
oDRow["TaxPayable"] = GlobalFunctions.TakaFormat(0);
|
||
}
|
||
|
||
oDRow["ThisMonthAmount"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted).ThisMonthAmount : 0);
|
||
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
|
||
oDRow["TaxActualDeduct"] =
|
||
GlobalFunctions.TakaFormat(
|
||
new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted) != null
|
||
? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted).TotalAmount : 0);
|
||
|
||
oDRow["TotalChallan"] = oTaxChallans.Count > 0 ? GlobalFunctions.TakaFormat((double)(oTaxChallans.Where(x => x.EmployeeID == oEmp.ID).Sum(x => x.ChallanAmount))) : "0";
|
||
oDRow["ThisYearBasicPay"] = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary).TotalAmount : 0;
|
||
nPFCFAmount = 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (EnumIncomeTaxItemGroup.Company_Contri_PF == titem.ItemGroup || titem.Description.Contains("Gratuity"))
|
||
{
|
||
nPFCFAmount = titem.PreviousAmount + titem.ThisMonthAmount;
|
||
}
|
||
}
|
||
|
||
oDRow["CompanyPf"] = nPFCFAmount;
|
||
nBonusArrearLeaveOverTimeAmount = 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
{
|
||
if (titem.Description.Contains("Arrear") || titem.Description.Contains("Leave Encashment") || titem.Description.Contains("overtime") || titem.Description.Contains("Advance") || titem.Description.Contains("Dress Allowance") ||
|
||
(titem.Description.Contains("Bonus") || titem.Description.Contains("Over Time") ||
|
||
(titem.Description.Contains("Festive") || titem.Description.Contains("Festival")))
|
||
)
|
||
{
|
||
nBonusArrearLeaveOverTimeAmount = nBonusArrearLeaveOverTimeAmount + titem.PreviousAmount + titem.ThisMonthAmount;
|
||
|
||
}
|
||
}
|
||
}
|
||
oDRow["BonusArrearLeaveOverTimeAmount"] = nBonusArrearLeaveOverTimeAmount;
|
||
|
||
oDRow["Remarks"] = "";//Remarks ,col 22
|
||
oDRow["ExemptedIncome"] = tExemption; ;
|
||
nRebAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0.0);
|
||
oDRow["RebateIncome"] = nRebAmount;
|
||
oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income).TotalAmount : 0.0));
|
||
oDRow["Total"] = GlobalFunctions.TakaFormat(GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income).TotalAmount : 0.0));
|
||
|
||
|
||
springBonus = 0;
|
||
foreach (IncomeTax titem in (oIncomeTaxs.Where(x => x.ItemGroup == EnumIncomeTaxItemGroup.Bonus && x.Description.Contains("Spring")).ToList()))
|
||
{
|
||
if (oDFinalIncomeTax.Tables.Contains("PayrollDataSet_IncomeTax"))
|
||
{
|
||
DataTable oTable = oDFinalIncomeTax.Tables["PayrollDataSet_IncomeTax"];
|
||
DataRow item = (from DataRow row in oTable.Rows
|
||
where Convert.ToInt32(row["ItemID"]) == titem.ItemID
|
||
select row).First();
|
||
if (item != null)
|
||
{
|
||
springBonus = (Convert.ToDouble(item["PaidTillDate"].ToString()) + Convert.ToDouble(item["ThisMonth"].ToString()) + Convert.ToDouble(item["Projected"].ToString())) - Convert.ToDouble(item["LessExaempted"].ToString());
|
||
}
|
||
}
|
||
}
|
||
nFesAmount = 0;
|
||
foreach (IncomeTax titem in (oIncomeTaxs.Where(x => x.ItemGroup == EnumIncomeTaxItemGroup.Bonus && (x.ItemID == -213 || x.ItemID == 40)).ToList()))
|
||
{
|
||
nFesAmount = nFesAmount + titem.ThisMonthAmount + titem.PreviousAmount;
|
||
}
|
||
oDRow["FestivalBonus"] = GlobalFunctions.TakaFormat(nFesAmount);
|
||
|
||
//nCompanyProvidedCar = 0;
|
||
//foreach (IncomeTax titem in (oIncomeTaxs.Where(x => x.ItemGroup == EnumIncomeTaxItemGroup.Cmp_Provided_car && x.ItemID == -215).ToList()))
|
||
//{
|
||
// nCompanyProvidedCar = nCompanyProvidedCar + titem.ThisMonthAmount + titem.PreviousAmount;
|
||
//}
|
||
//oDRow["CompanyProvidedCar"] = GlobalFunctions.TakaFormat(nCompanyProvidedCar);
|
||
|
||
|
||
monthlySalary = 0;
|
||
foreach (IncomeTax titem in oIncomeTaxs)
|
||
{
|
||
if (titem.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary || titem.ItemGroup == EnumIncomeTaxItemGroup.House_Rent_Allowance ||
|
||
titem.ItemGroup == EnumIncomeTaxItemGroup.Conveyance_Allowance || titem.ItemGroup == EnumIncomeTaxItemGroup.Medical_Allowance ||
|
||
titem.ItemGroup == EnumIncomeTaxItemGroup.Other_Allowance || titem.ItemGroup == EnumIncomeTaxItemGroup.TimeCard ||
|
||
titem.ItemGroup == EnumIncomeTaxItemGroup.Cmp_Provided_House || titem.ItemGroup == EnumIncomeTaxItemGroup.WPPF_Allowance ||
|
||
titem.ItemGroup == EnumIncomeTaxItemGroup.LFA_Allowance || (titem.ItemGroup == EnumIncomeTaxItemGroup.Bonus && titem.ItemID == 7))
|
||
{
|
||
monthlySalary = monthlySalary + titem.PreviousAmount + titem.ThisMonthAmount;
|
||
}
|
||
}
|
||
//oDRow["SpringBonus"] = GlobalFunctions.TakaFormat(springBonus);
|
||
//oDRow["OtherInvestment"] = GlobalFunctions.TakaFormat(otherInvestment);
|
||
//oDRow["TaxExemptedIncome"] = GlobalFunctions.TakaFormat(taxExemptedIncome);
|
||
//oDRow["MonthlySalary"] = GlobalFunctions.TakaFormat(monthlySalary);
|
||
dTreport108.Rows.Add(oDRow);
|
||
nCount++;
|
||
|
||
}
|
||
}
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowDlgForReportTaxReconciliation(null, dTreport108, payrollTypeId, reportType, otaxparam.AssessmentYear);
|
||
}
|
||
|
||
private DataSet PrepareDatasetNew(int nEmpID)
|
||
{
|
||
|
||
DataSet orootDataset = new DataSet();
|
||
DataRow dr = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable2 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
DataRow houseRent = null;
|
||
DataRow Conveyance = null;
|
||
DataRow Medical = null;
|
||
DataRow lfa = 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) continue;
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_SalaryIncome || oItem.Side == EnumIncomeTaxSide.Dec_SalaryIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
|
||
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;
|
||
}
|
||
}
|
||
|
||
|
||
IncomeTax salaryIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
|
||
if (salaryIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
salaryIncome.Description = "Total income from Salary";
|
||
dTable1.Rows.Add(this.getARow(dr, salaryIncome));
|
||
|
||
TotalSalaryExepted = dr;
|
||
|
||
TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oItem.Description = "Company's contribution to Provident Fund";
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
DataRow pfdat = dTable1.FirstOrDefault(x => x["ItemCode"].ToString() == (EnumIncomeTaxItemGroup.Company_Contri_PF).ToString());
|
||
double pfamount = 0;
|
||
if (pfdat != null)
|
||
{
|
||
pfamount = Convert.ToDouble(pfdat["AmountPerAnnum"].ToString());
|
||
}
|
||
dr = dTable1.NewRow();
|
||
dr["EmpID"] = _incometaxes[0].EmployeeID;
|
||
//dr["ItemCode"] = _incometaxes[0].ItemGroup;
|
||
//dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = "Total Annual Income";
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(salaryIncome.TotalAmount + pfamount); //oDRow["AmountPerannum"];
|
||
dr["ThisMonth"] = 0;
|
||
dr["PaidTillDate"] = 0;//oDRow["PaidTillDate"];
|
||
dr["Projected"] = 0;
|
||
dr["Position"] = 25;
|
||
dr["Side"] = 8;
|
||
dr["LessExaempted"] = "0";
|
||
dr["RowSequence"] = 25;
|
||
dTable1.Rows.Add(dr);
|
||
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oItem.Description = "Less: Exemption (1/3 of total annual income or 450,000; whichever is lower)";
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
IncomeTax totalAnnualIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
totalAnnualIncome.Description = "Total Taxable Income";
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualIncome));
|
||
TotalAnnualExepted = dr;
|
||
TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax grstax = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax);
|
||
if (grstax != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
grstax.Description = "Gross Tax Payable";
|
||
dTable1.Rows.Add(this.getARow(dr, grstax));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax rebtoninv = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment);
|
||
if (rebtoninv != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
rebtoninv.Description = "Less: Tax Rebate on Investment";
|
||
dTable1.Rows.Add(this.getARow(dr, rebtoninv));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
IncomeTax ait = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, 1);
|
||
if (ait != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
ait.Description = "Less: AIT";
|
||
dTable1.Rows.Add(this.getARow(dr, ait));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax oNetTaxPayable = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
(int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
if (oNetTaxPayable != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oNetTaxPayable.Description = "Net Tax Payable (As per Sec 86)";
|
||
dTable1.Rows.Add(this.getARow(dr, oNetTaxPayable));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
dTable1.TableName = "PayrollDataSet_IncomeTax";
|
||
orootDataset.Tables.Add(dTable1);
|
||
// Crate Slab Data
|
||
double ngrossTax = 0;
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable dTable = new PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable();
|
||
_InvestmentAmount = _taxParameter.MaxInvAmount;
|
||
bool isExist = dTable1.AsEnumerable().Where(x => x["ItemCode"].ToString() == "-237").Any();
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
if (isExist) totalAnnualIncome.PreviousAmount -= _TotalSalaryExempted;
|
||
List<TaxParameterSlab> empTaxSlabs = CalculateTaxOnSlab(_taxParameter, _employee, totalAnnualIncome.TotalAmount);
|
||
int index = 0;
|
||
dr = null;
|
||
foreach (TaxParameterSlab drr in empTaxSlabs)
|
||
{
|
||
dr = dTable.NewRow();
|
||
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 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 = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Income,
|
||
(int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
if (investmentCapdo != null)
|
||
_20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100;
|
||
}
|
||
else
|
||
{
|
||
investmentCapdo = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income,
|
||
(int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
if (investmentCapdo != null)
|
||
_20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100;
|
||
|
||
}
|
||
|
||
IncomeTax acinvestment = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Actual,
|
||
(int)EnumIncomeTaxItemGroup.Investment_Actual);
|
||
if (acinvestment != null)
|
||
_actualInvestment = acinvestment.TotalAmount;
|
||
|
||
IncomeTax taxRebate = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Allowed,
|
||
(int)EnumIncomeTaxItemGroup.Investment_Allowed);
|
||
|
||
if (taxRebate != null)
|
||
{
|
||
_investmentAllowed = taxRebate.TotalAmount;
|
||
string spf = "";
|
||
IncomeTax pf = 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 = 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["DataColumn1"] = taxRebate.Description;
|
||
oDRow["DataColumn2"] = spf;
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(taxRebate.TotalAmount);
|
||
// oDTable.Rows.Add(oDRow);
|
||
}
|
||
if (_isPrvs)
|
||
{
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment)
|
||
{
|
||
oDRow["DataColumn1"] = oItem.Description;// +" @ " + _taxParameter.MaxInvExempPercent.ToString() + "%";
|
||
if (ngrossTax > 0)
|
||
oDRow["DataColumn3"] = "(" + GlobalFunctions.TakaFormat(oItem.TotalAmount) + ")";
|
||
else oDRow["DataColumn3"] = "(0)";
|
||
}
|
||
else
|
||
{
|
||
oDRow["DataColumn1"] = oItem.Description;
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oItem.TotalAmount);
|
||
}
|
||
oDRow["DataColumn2"] = "";
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
}
|
||
}
|
||
|
||
|
||
//if (oNetTaxPayable != null)
|
||
//{
|
||
// oDRow = oDTable.NewRow();
|
||
// oDRow["DataColumn1"] = oNetTaxPayable.Description;
|
||
// oDRow["DataColumn2"] = "";
|
||
// oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oNetTaxPayable.TotalAmount);
|
||
// oDTable.Rows.Add(oDRow);
|
||
//}
|
||
|
||
IncomeTax oTaxDeducted = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
|
||
if (!_isPrvs)
|
||
{
|
||
if (oTaxDeducted != null)
|
||
{
|
||
|
||
oDRow = oDTable.NewRow();
|
||
//oDRow["DataColumn1"] = "Tax deducted from salary";
|
||
oDRow["DataColumn1"] = "Total Tax Paid";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.TotalAmount);
|
||
_taxdeducted = oTaxDeducted.TotalAmount;
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (oTaxDeducted != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax paid up to previous month";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.PreviousAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax paid this month";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.ThisMonthAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax to be paid upto June";
|
||
oDRow["DataColumn2"] = "";
|
||
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;
|
||
}
|
||
//public byte[] ShowIncomeTax(int nTaxParamID, string sEmpNo, int payrollTypeId, int systemTaxParamID, DateTime nextPayProcessDate, string reportType)
|
||
//{
|
||
// TaxParameter otaxparam = new TaxParameterService().Get(nTaxParamID);
|
||
// DataRow oDRow = null;
|
||
// PayrollDataSet.PayrollDataSet.Report108DataTable dTreport108 = new PayrollDataSet.PayrollDataSet.Report108DataTable();
|
||
// //int nIndex;
|
||
// int nCount = 1;
|
||
// double GrandTotal;
|
||
// List<IncomeTax> oIncomeTaxs = null;
|
||
// IncomeTax oIncomeTax = new IncomeTax();
|
||
// //_Employees = Employee.GetWithDiscontinue();
|
||
// _Employees = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollTypeId);
|
||
// double nAmount = 0;
|
||
// double nOtherAmount = 0;
|
||
// double nExAmount = 0;
|
||
// double nTempAmount = 0;
|
||
|
||
// foreach (Employee oEmp in _Employees)
|
||
// {
|
||
// GrandTotal = 0.0;
|
||
// oDRow = dTreport108.NewRow();
|
||
|
||
// if (nTaxParamID == systemTaxParamID)
|
||
// {
|
||
// oIncomeTaxs = new IncomeTaxService().Get(GetEnumForSalaryIT(oEmp.ID, nextPayProcessDate), oEmp.ID, nTaxParamID);
|
||
// }
|
||
// else
|
||
// {
|
||
// oIncomeTaxs = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, nTaxParamID);
|
||
// }
|
||
|
||
// if (oIncomeTaxs == null) continue;
|
||
|
||
// nTempAmount = 0;
|
||
// nAmount = 0;
|
||
|
||
// if (oIncomeTax != null)
|
||
// {
|
||
// //nIndex = oIncomeTaxs.GetIndex(oEmp.ID);
|
||
// oDRow["TIN"] = oEmp.TinNo;
|
||
// oDRow["SLNo"] = nCount;//col 1
|
||
// oDRow["EmpNo"] = oEmp.EmployeeNo;
|
||
// //oDRow["Designation"] = oEmp.Designation != null ? oEmp.Designation.Name : "";
|
||
// oDRow["Name"] = oEmp.Name;//col 2
|
||
// oDRow["PostalAdd"] = "";//Postal Address ,col 3
|
||
// oDRow["NEmployee"] = oEmp.DescriptionText;//Nature of Employee ,col 4
|
||
|
||
// nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary).TotalAmount : 0.0);//Total Amount of Salary Basic+Bonus, col 5
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["Basic"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nAmount = GlobalFunctions.Round(new IncomeTaxService().GetAmount(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus));
|
||
// //GrandTotal = GrandTotal + nAmount;
|
||
// nOtherAmount += nAmount;
|
||
// oDRow["Bonus"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
|
||
// nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance).TotalAmount : 0.0);//Periodical Cash Allowance, col 6
|
||
// nTempAmount = nTempAmount + nAmount;
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["HREarned"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance).TotalAmount : 0.0);
|
||
// oDRow["HRExempted"] = GlobalFunctions.TakaFormat(nAmount);
|
||
// nTempAmount = nTempAmount - nAmount;
|
||
// nExAmount += nAmount;
|
||
// oDRow["HRTaxable"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
|
||
|
||
// nTempAmount = 0;
|
||
// nAmount = 0;
|
||
// IncomeTax oITax = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Conveyance_Allowance);
|
||
// if (oITax != null)
|
||
// {
|
||
// nAmount = oITax.TotalAmount;
|
||
// oDRow["CEarned"] = GlobalFunctions.TakaFormat(oITax.TotalAmount);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// }
|
||
// else
|
||
// oDRow["CEarned"] = 0.0;
|
||
// nTempAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance).TotalAmount : 0.0);
|
||
// nExAmount += nTempAmount;
|
||
// oDRow["CExempted"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
|
||
// oDRow["CTaxable"] = GlobalFunctions.TakaFormat(nAmount - nTempAmount);
|
||
|
||
|
||
// nTempAmount = 0;
|
||
// nAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance).TotalAmount : 0);
|
||
// oDRow["MEarned"] = GlobalFunctions.TakaFormat(nAmount);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
|
||
// nTempAmount = GlobalFunctions.Round(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Exemption_Medical_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_Medical_Allowance).TotalAmount : 0.0);
|
||
// nExAmount += nTempAmount;
|
||
// oDRow["MExempted"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
// oDRow["MTaxable"] = GlobalFunctions.TakaFormat(nAmount - nTempAmount);
|
||
|
||
|
||
// oDRow["Entertainment"] = 0;
|
||
// nAmount = 0;
|
||
|
||
// foreach (IncomeTax titem in oIncomeTaxs)
|
||
// {
|
||
// if (titem.Side == EnumIncomeTaxSide.Inc_SalaryIncome)
|
||
// {
|
||
// if (titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
// && titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
// && titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
// && titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
// && titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
// && titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
// && titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
// && titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance)
|
||
// {
|
||
// nAmount = nAmount + titem.TotalAmount;
|
||
// }
|
||
// }
|
||
// }
|
||
|
||
// //nAmount = nAmount + Convert.ToDouble(oDRow["Bonus"].ToString());
|
||
// nOtherAmount += GlobalFunctions.Round(new IncomeTaxService().GetAmount(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Earned_Leave));
|
||
// oDRow["Others"] = GlobalFunctions.TakaFormat(nOtherAmount);
|
||
// GrandTotal = GrandTotal + nOtherAmount;
|
||
|
||
// double nAnnul = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income).TotalAmount : 0;
|
||
// oDRow["AmountLiable"] = GlobalFunctions.TakaFormat(nAnnul);
|
||
// oDRow["Total"] = GlobalFunctions.TakaFormat(nAnnul + nExAmount);
|
||
|
||
// oDRow["FDate"] = (oEmp.JoiningDate > otaxparam.FiscalyearDatefrom) ? oEmp.JoiningDate.ToString("dd MMM yyyy") : otaxparam.FiscalyearDatefrom.ToString("dd MMM yyyy");
|
||
// oDRow["TDate"] = (oEmp.Status != EnumEmployeeStatus.Live) ? ((DateTime)oEmp.DiscontinueDate).ToString("dd MMM yyyy") : otaxparam.FiscalyearDateTo.ToString("dd MMM yyyy");
|
||
// oDRow["SANDOtherSum"] = 0;//Salary and all other Sum ,col 8
|
||
|
||
// nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Other_Allowance) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_House, (int)EnumIncomeTaxItemGroup.Cmp_Provided_House).TotalAmount : 0.0;
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// oDRow["EnterAllowance"] = 0;//Amount of Entertaitment Allowance ,col 10
|
||
// oDRow["VechilesPercent"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Cmp_Provided_car, (int)EnumIncomeTaxItemGroup.Cmp_Provided_car).TotalAmount : 0.0);
|
||
// oDRow["SPByEmployeer"] = 0;//Salary Paid by employeer ,col 12
|
||
// oDRow["VOfFree"] = 0;//Value of Rent Free Accomodation or Value of any Concession in Rent for the Accomodation provided by the Employer,col 13
|
||
|
||
// nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF).TotalAmount : 0;
|
||
// oDRow["EContribution"] = GlobalFunctions.TakaFormat(nAmount);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
|
||
// oDRow["InterestCredit"] = 0; //Math.Round(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Interest Credit to the assessee's accout in a recognised provident fund,col 15
|
||
// oDRow["VofAnyBenefit"] = 0;//Value of any benefit ,col 15
|
||
// oDRow["TotalCol"] = GlobalFunctions.TakaFormat(GrandTotal);//Total Col 5,6,8 to 16 ,col 16
|
||
// //oDRow["AmountLiable"] = GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
|
||
// //GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17
|
||
// oDRow["ConToTheProvident"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0);//Amount Liable to tax under section 21 of income tax ordinance 1984 ,col 17;//Contribution to the provident ,col 18
|
||
// oDRow["TaxIncome"] = GlobalFunctions.TakaFormat(GrandTotal); //GlobalFunctions.TakaFormat(IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_Refund, (int)EnumIncomeTaxItemGroup.Gross_Tax) != null ? IncomeTax.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Gross_Refund, (int)EnumIncomeTaxItemGroup.Gross_Tax).TotalAmount : 0);//Taxable Income ,col 19
|
||
// oDRow["TaxPayable"] =
|
||
// GlobalFunctions.TakaFormat(
|
||
// new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
// (int)EnumIncomeTaxItemGroup.Net_Payable) != null
|
||
// ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
// (int)EnumIncomeTaxItemGroup.Net_Payable).TotalAmount
|
||
// : 0); //Tax Payable ,col 20
|
||
// // }
|
||
// nAmount = 0;
|
||
// nAmount = new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment).TotalAmount : 0;
|
||
// // oDRow["InvestmentRebate"] = GlobalFunctions.TakaFormat(nAmount);
|
||
// oDRow["ThisMonthAmount"] = GlobalFunctions.TakaFormat(new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted, (int)EnumIncomeTaxItemGroup.Tax_Deducted).ThisMonthAmount : 0);
|
||
// oDRow["TaxActualDeduct"] =
|
||
// GlobalFunctions.TakaFormat(
|
||
// new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted) != null
|
||
// ? new IncomeTaxService().Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted).TotalAmount
|
||
// : 0); //Tax actually deduct ,col 21
|
||
// // }
|
||
|
||
// oDRow["Remarks"] = "";//Remarks ,col 22
|
||
// dTreport108.Rows.Add(oDRow);
|
||
// nCount++;
|
||
|
||
// }
|
||
// }
|
||
// ReportProcessor reportProcessor = new ReportProcessor();
|
||
// return reportProcessor.ShowDlgForReport108(null, dTreport108, payrollTypeId, reportType);
|
||
//}
|
||
public EnumIncomeTaxDataFrom GetEnumForSalaryIT(int nEmpID, DateTime nextPayProcessDate)
|
||
{
|
||
|
||
return new IncomeTaxService().currentYeardataSource(nEmpID);
|
||
EnumIncomeTaxDataFrom nType;
|
||
|
||
SalaryMonthlyService salaryMonthlyService = new SalaryMonthlyService();
|
||
bool isprocessed = false, isfinalized = false;
|
||
salaryMonthlyService.IsSalaryProcessedAndFinalized(nEmpID, nextPayProcessDate, ref isprocessed, ref isfinalized);
|
||
if (isprocessed == true && isfinalized == false)
|
||
{
|
||
nType = EnumIncomeTaxDataFrom.SalaryITTempData;
|
||
}
|
||
else
|
||
{
|
||
nType = EnumIncomeTaxDataFrom.ProcessTempData;
|
||
}
|
||
return nType;
|
||
}
|
||
public byte[] showTaxCard(int employeeId, bool ITStatus, int nTaxParamID, int systemTaxParamID, DateTime nextPayProcessDate, int payrollTypeId, string reportType)
|
||
{
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
ReportItemService reportItemService = new ReportItemService();
|
||
TaxChallanService taxChallanService = new TaxChallanService();
|
||
|
||
if (nTaxParamID == systemTaxParamID)
|
||
{
|
||
oincometaxes = new IncomeTaxService().Get(GetEnumForSalaryIT(employeeId, nextPayProcessDate), employeeId, nTaxParamID);
|
||
}
|
||
else
|
||
{
|
||
oincometaxes = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessedData, employeeId, nTaxParamID);
|
||
ITStatus = false;
|
||
}
|
||
|
||
//oincometaxes = incomeTaxService.Get(GetEnumForSalaryIT(employeeId, nextPayProcessDate), employeeId, taxParamId);
|
||
_IsTaxCertificate = ITStatus;
|
||
_isPrvs = ITStatus;
|
||
List<TaxChallan> oTaxChallans = new List<TaxChallan>();
|
||
DataSet oDFinalIncomeTax = null;
|
||
DataSet _dSet = new DataSet();
|
||
_taxParameter = taxParameterService.Get(nTaxParamID);
|
||
_employee = new EmployeeService().Get(employeeId);
|
||
_item = reportItemService.GetByReportType(Convert.ToInt32(EnumReportType.ITIndividual));
|
||
_incometaxes = oincometaxes;
|
||
oDFinalIncomeTax = PrepareDataset(employeeId);
|
||
|
||
IncomeTax pf = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Company_Contri_PF,
|
||
(int)EnumIncomeTaxItemGroup.Company_Contri_PF);
|
||
double PFInvestment = 0.0;
|
||
if (pf != null)
|
||
PFInvestment = pf.TotalAmount;
|
||
|
||
//oDFinalIncomeTax.Tables[0].TableName = "PayrollDataSet_IncomeTax";
|
||
//_dSet.Tables.Add(oDFinalIncomeTax.Tables[0].TableName);
|
||
////_dITSlabs = GetIncomeTaxSlabs(oparameter.ID, oEmp.ID);
|
||
//oDFinalIncomeTax.Tables[1].TableName = "PayrollDataSet_IncomeTaxSlab";
|
||
//_dSet.Tables.Add(oDFinalIncomeTax.Tables[1].Copy());
|
||
|
||
//oDTableOthers = GetIncomeTaxOthers(oIncomeTax.GetEnumForSalaryIT(oEmp.ID), oEmp.ID);
|
||
|
||
|
||
|
||
//oDFinalIncomeTax.Tables[2].TableName = "PayrollDataSet_IncomeTaxOther";
|
||
//_dSet.Tables.Add(oDFinalIncomeTax.Tables[2].Copy());
|
||
|
||
PayrollDataSet.PayrollDataSet.TaxRebeatInvestmentDataTable dTable = new PayrollDataSet.PayrollDataSet.TaxRebeatInvestmentDataTable();
|
||
|
||
DataRow dr = null;
|
||
dr = dTable.NewRow();
|
||
dr["TaxPercent"] = _taxParameter.MaxInvestPercent;
|
||
dr["TaxableIncome"] = _20Investment;
|
||
dr["MaxInvestment"] = _taxParameter.MaxInvAmount;
|
||
dr["PFInvestment"] = PFInvestment;
|
||
dTable.Rows.Add(dr);
|
||
|
||
dTable.TableName = "PayrollDataSet_TaxRebeatInvestment";
|
||
oDFinalIncomeTax.Tables.Add(dTable);
|
||
|
||
PayrollDataSet.PayrollDataSet.TaxChallanDataTable dTChallan = new PayrollDataSet.PayrollDataSet.TaxChallanDataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan1DataTable dTChallan1 = new PayrollDataSet.PayrollDataSet.TaxChallan1DataTable();
|
||
DataRow dChallan = null;
|
||
dChallan = dTChallan.NewRow();
|
||
//if (!ITStatus)
|
||
//{
|
||
List<TaxChallan> taxChallans = new List<TaxChallan>();
|
||
taxChallans = taxChallanService.GetByTaxParamIDandPayrolltypeID(nTaxParamID, _employee.PayrollTypeID);
|
||
TaxParameter taxParameter = new TaxParameterService().Get(nTaxParamID);
|
||
string fiscalYear = taxParameter.FiscalYear.ToString();
|
||
string[] a = fiscalYear.Split('-');
|
||
|
||
//oTaxChallans = taxChallanService.Get(employeeId, nTaxParamID);
|
||
oTaxChallans = taxChallans;
|
||
|
||
//For SGS
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
if (companyName == "SGS Bangladesh Limited")
|
||
{
|
||
//oTaxChallans = taxChallanService.GetByTaxParamId(nTaxParamID);
|
||
oEmp = new EmployeeService().Get(employeeId);
|
||
|
||
if (oEmp.Status == EnumEmployeeStatus.Discontinued)
|
||
{
|
||
oTaxChallans = oTaxChallans.FindAll(x =>
|
||
x.SalaryMonthly >= oEmp.JoiningDate && x.SalaryMonthly <= oEmp.DiscontinueDate);
|
||
}
|
||
else
|
||
{
|
||
oTaxChallans = oTaxChallans.FindAll(x => x.SalaryMonthly >= oEmp.JoiningDate);
|
||
}
|
||
}
|
||
|
||
if (oTaxChallans != null && oTaxChallans.Count > 0)
|
||
{
|
||
int slNo = 1;
|
||
dTChallan1.Columns["Address"].DataType = typeof(string);
|
||
|
||
foreach (var challanItem in oTaxChallans)
|
||
{
|
||
dr = dTChallan1.NewRow();
|
||
if (companyName == "SGS Bangladesh Limited")
|
||
{
|
||
dr["BankName"] = "Sonali Bank PLC";
|
||
dr["Address"] = "Gulshan";
|
||
}
|
||
else
|
||
{
|
||
dr["BankName"] = challanItem.BankName;
|
||
dr["Address"] = challanItem.Address;
|
||
}
|
||
dr["SLNo"] = slNo++; ;
|
||
dr["ChallanNo"] = challanItem.ChallanNo != null ? challanItem.ChallanNo : "";
|
||
dr["ChallanDate"] = challanItem.DepositDate.ToString("dd MMM yyyy");
|
||
dr["Amount"] = challanItem.ChallanAmount;
|
||
dr["EmployeeAmount"] = challanItem.EmployeeAmount;
|
||
dr["SalaryMonth"] = challanItem.SalaryMonthly.ToString("MMMM yyyy");
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
}
|
||
}
|
||
|
||
dTChallan1.TableName = "PayrollDataSet_TaxChallan1";
|
||
oDFinalIncomeTax.Tables.Add(dTChallan1);
|
||
|
||
|
||
//int count = 1;
|
||
//string sChallanNo = "";//"This is a system generated document, Does Not require Signature. \n";
|
||
// \nCertified that the above-mentioned amount of tax has already been deposited based on the employer’s confirmation of investment amount in allowed instruments.
|
||
// "# 57 dated 06-Sep-2010, # 56/88 dated 05-Oct-2010, # 54 dated 03-Nov-2010, # 58 dated 07-Dec-2010, # 57 dated 06-Jan-2011, # 56 dated 10-Feb-2011, # 58 dated 09-Mar-2011, # 50 dated 13-Apr-2011, # 47 dated 03-May-2011, # 55 dated 09-Jun-2011, # 71/49 dated 21-Jul-2011.";
|
||
//if (oTaxChallans != null && oTaxChallans.Count > 0)
|
||
//{
|
||
|
||
// foreach (TaxChallan oItem in oTaxChallans)
|
||
// {
|
||
// if (count == oTaxChallans.Count)
|
||
// {
|
||
// sChallanNo += "ChallanNo: #" + oItem.ChallanNo + " dated " + oItem.DepositDate.ToString("dd-MMM-yyyy") + ".";
|
||
// }
|
||
// else
|
||
// {
|
||
// sChallanNo += "ChallanNo: #" + oItem.ChallanNo + " dated " + oItem.DepositDate.ToString("dd-MMM-yyyy") + ", ";
|
||
// count++;
|
||
// }
|
||
// }
|
||
//}
|
||
//dChallan["ChallanNo"] = sChallanNo;
|
||
//}
|
||
//else
|
||
//{
|
||
// //For SGS
|
||
// var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
// string companyName = Convert.ToString(companyNameObj);
|
||
|
||
//}
|
||
|
||
double _taxInvestment = _actualInvestment;
|
||
//string trget = "Tax Investment";
|
||
//var rslt = from item in oincometaxes
|
||
// where item.Description.ToLower() == trget.ToLower()
|
||
// select item;
|
||
//if(rslt.Count() == 1)
|
||
//{
|
||
// _taxInvestment = rslt.First().TotalAmount;
|
||
//}
|
||
|
||
dChallan["TaxInvestment"] = _taxInvestment;
|
||
dTChallan.Rows.Add(dChallan);
|
||
dTChallan.TableName = "PayrollDataSet_TaxChallan";
|
||
oDFinalIncomeTax.Tables.Add(dTChallan);
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
|
||
return reportProcessor.ShowDlgForTaxCard(_item, oDFinalIncomeTax, _employee.Name, _employee.EmployeeNo, _employee.TinNo, _taxParameter.AssessmentYear, _taxParameter.FiscalYear, payrollTypeId, ITStatus, reportType, _taxParameter);
|
||
|
||
}
|
||
|
||
public byte[] showTaxCardCityBank(int employeeId, bool ITStatus, int nTaxParamID, int systemTaxParamID, DateTime nextPayProcessDate, int payrollTypeId, string reportType)
|
||
{
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
ReportItemService reportItemService = new ReportItemService();
|
||
TaxChallanService taxChallanService = new TaxChallanService();
|
||
bool IsSeparateBonusChallan = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "incometax", "separatebonuschallan");
|
||
|
||
if (nTaxParamID == systemTaxParamID)
|
||
{
|
||
oincometaxes = new IncomeTaxService().Get(GetEnumForSalaryIT(employeeId, nextPayProcessDate), employeeId, nTaxParamID);
|
||
}
|
||
else
|
||
{
|
||
oincometaxes = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessedData, employeeId, nTaxParamID);
|
||
ITStatus = false;
|
||
}
|
||
|
||
//oincometaxes = incomeTaxService.Get(GetEnumForSalaryIT(employeeId, nextPayProcessDate), employeeId, taxParamId);
|
||
_IsTaxCertificate = ITStatus;
|
||
_isPrvs = ITStatus;
|
||
List<TaxChallan> oTaxChallans = new List<TaxChallan>();
|
||
DataSet oDFinalIncomeTax = null;
|
||
DataSet _dSet = new DataSet();
|
||
_taxParameter = taxParameterService.GetTaxParameterWithSignature(nTaxParamID);
|
||
_employee = new EmployeeService().Get(employeeId);
|
||
_item = reportItemService.GetByReportType(Convert.ToInt32(EnumReportType.ITIndividual));
|
||
_incometaxes = oincometaxes;
|
||
oDFinalIncomeTax = PrepareDatasetCityBank(employeeId);
|
||
Grade grade = new GradeService().Get(_employee.GradeID ?? 0);
|
||
string gradeName = string.Empty;
|
||
if (grade != null) gradeName = grade.Name;
|
||
string gender = _employee.Gender switch
|
||
{
|
||
EnumGender.Male => "Male",
|
||
EnumGender.Female => "Female",
|
||
_ => "Other"
|
||
};
|
||
|
||
IncomeTax pf = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Company_Contri_PF,
|
||
(int)EnumIncomeTaxItemGroup.Company_Contri_PF);
|
||
double PFInvestment = 0.0;
|
||
if (pf != null)
|
||
PFInvestment = pf.TotalAmount;
|
||
|
||
//oDFinalIncomeTax.Tables[0].TableName = "PayrollDataSet_IncomeTax";
|
||
//_dSet.Tables.Add(oDFinalIncomeTax.Tables[0].TableName);
|
||
////_dITSlabs = GetIncomeTaxSlabs(oparameter.ID, oEmp.ID);
|
||
//oDFinalIncomeTax.Tables[1].TableName = "PayrollDataSet_IncomeTaxSlab";
|
||
//_dSet.Tables.Add(oDFinalIncomeTax.Tables[1].Copy());
|
||
|
||
//oDTableOthers = GetIncomeTaxOthers(oIncomeTax.GetEnumForSalaryIT(oEmp.ID), oEmp.ID);
|
||
|
||
|
||
|
||
//oDFinalIncomeTax.Tables[2].TableName = "PayrollDataSet_IncomeTaxOther";
|
||
//_dSet.Tables.Add(oDFinalIncomeTax.Tables[2].Copy());
|
||
|
||
PayrollDataSet.PayrollDataSet.TaxRebeatInvestmentDataTable dTable = new PayrollDataSet.PayrollDataSet.TaxRebeatInvestmentDataTable();
|
||
|
||
DataRow dr = null;
|
||
dr = dTable.NewRow();
|
||
dr["TaxPercent"] = _taxParameter.MaxInvestPercent;
|
||
dr["TaxableIncome"] = _20Investment;
|
||
dr["MaxInvestment"] = _taxParameter.MaxInvAmount;
|
||
dr["PFInvestment"] = PFInvestment;
|
||
dTable.Rows.Add(dr);
|
||
|
||
dTable.TableName = "PayrollDataSet_TaxRebeatInvestment";
|
||
oDFinalIncomeTax.Tables.Add(dTable);
|
||
|
||
PayrollDataSet.PayrollDataSet.TaxChallanDataTable dTChallan = new PayrollDataSet.PayrollDataSet.TaxChallanDataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan1DataTable dTChallan1 = new PayrollDataSet.PayrollDataSet.TaxChallan1DataTable();
|
||
DataRow dChallan = null;
|
||
dChallan = dTChallan.NewRow();
|
||
//if (!ITStatus)
|
||
//{
|
||
List<TaxChallan> taxChallans = new List<TaxChallan>();
|
||
taxChallans = taxChallanService.GetByTaxParamIDandPayrolltypeID(nTaxParamID, _employee.PayrollTypeID);
|
||
TaxParameter taxParameter = new TaxParameterService().GetTaxParameterWithSignature(nTaxParamID);
|
||
string fiscalYear = taxParameter.FiscalYear.ToString();
|
||
string[] a = fiscalYear.Split('-');
|
||
DataSet tempChallan = new DataSet();
|
||
DateTime startdate = new DateTime(Convert.ToInt32(a[0]), 7, 1);
|
||
DateTime enddate = new DateTime(Convert.ToInt32(a[1]), 6, 30);
|
||
tempChallan = taxChallanService.GetTaxDeductionByIDFromSalaryBonus(_employee.ID, _employee.PayrollTypeID, startdate, enddate, IsSeparateBonusChallan);
|
||
string isbonus = "0";
|
||
DataRow dramount = null;
|
||
double amnt = 0;
|
||
|
||
//oTaxChallans = taxChallanService.Get(employeeId, nTaxParamID);
|
||
oTaxChallans = taxChallans;
|
||
|
||
//For SGS
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
|
||
if (oTaxChallans != null && oTaxChallans.Count > 0)
|
||
{
|
||
int slNo = 1;
|
||
dTChallan1.Columns["Address"].DataType = typeof(string);
|
||
|
||
foreach (var challanItem in oTaxChallans)
|
||
{
|
||
if (tempChallan.Tables[0].Rows.Count > 0)
|
||
{
|
||
isbonus = challanItem.IsBonusAmount ? "1" : "0";
|
||
if (IsSeparateBonusChallan)
|
||
{
|
||
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(challanItem.SalaryMonthly).ToString() && x["IsSeparateBonus"].ToString() == isbonus);
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
}
|
||
else
|
||
{
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(challanItem.SalaryMonthly).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
}
|
||
|
||
}
|
||
|
||
dr = dTChallan1.NewRow();
|
||
|
||
dr["BankName"] = challanItem.BankName;
|
||
dr["Address"] = challanItem.Address;
|
||
|
||
dr["SLNo"] = slNo++; ;
|
||
dr["ChallanNo"] = challanItem.ChallanNo != null ? challanItem.ChallanNo : "";
|
||
dr["ChallanDate"] = challanItem.DepositDate.ToString("dd MMM yyyy");
|
||
dr["Amount"] = challanItem.ChallanAmount;
|
||
dr["EmployeeAmount"] = amnt;
|
||
dr["SalaryMonth"] = challanItem.SalaryMonthly.ToString("MMMM yyyy");
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
}
|
||
}
|
||
|
||
dTChallan1.TableName = "PayrollDataSet_TaxChallan1";
|
||
oDFinalIncomeTax.Tables.Add(dTChallan1);
|
||
|
||
|
||
//int count = 1;
|
||
//string sChallanNo = "";//"This is a system generated document, Does Not require Signature. \n";
|
||
// \nCertified that the above-mentioned amount of tax has already been deposited based on the employer’s confirmation of investment amount in allowed instruments.
|
||
// "# 57 dated 06-Sep-2010, # 56/88 dated 05-Oct-2010, # 54 dated 03-Nov-2010, # 58 dated 07-Dec-2010, # 57 dated 06-Jan-2011, # 56 dated 10-Feb-2011, # 58 dated 09-Mar-2011, # 50 dated 13-Apr-2011, # 47 dated 03-May-2011, # 55 dated 09-Jun-2011, # 71/49 dated 21-Jul-2011.";
|
||
//if (oTaxChallans != null && oTaxChallans.Count > 0)
|
||
//{
|
||
|
||
// foreach (TaxChallan oItem in oTaxChallans)
|
||
// {
|
||
// if (count == oTaxChallans.Count)
|
||
// {
|
||
// sChallanNo += "ChallanNo: #" + oItem.ChallanNo + " dated " + oItem.DepositDate.ToString("dd-MMM-yyyy") + ".";
|
||
// }
|
||
// else
|
||
// {
|
||
// sChallanNo += "ChallanNo: #" + oItem.ChallanNo + " dated " + oItem.DepositDate.ToString("dd-MMM-yyyy") + ", ";
|
||
// count++;
|
||
// }
|
||
// }
|
||
//}
|
||
//dChallan["ChallanNo"] = sChallanNo;
|
||
//}
|
||
//else
|
||
//{
|
||
// //For SGS
|
||
// var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
// string companyName = Convert.ToString(companyNameObj);
|
||
//}
|
||
|
||
double _taxInvestment = _actualInvestment;
|
||
//string trget = "Tax Investment";
|
||
//var rslt = from item in oincometaxes
|
||
// where item.Description.ToLower() == trget.ToLower()
|
||
// select item;
|
||
//if(rslt.Count() == 1)
|
||
//{
|
||
// _taxInvestment = rslt.First().TotalAmount;
|
||
//}
|
||
|
||
dChallan["TaxInvestment"] = _taxInvestment;
|
||
dTChallan.Rows.Add(dChallan);
|
||
dTChallan.TableName = "PayrollDataSet_TaxChallan";
|
||
oDFinalIncomeTax.Tables.Add(dTChallan);
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
|
||
return reportProcessor.ShowDlgForTaxCardCityBank(_item, oDFinalIncomeTax, _employee.Name, _employee.EmployeeNo, _employee.TinNo, _taxParameter.AssessmentYear, _taxParameter.FiscalYear, payrollTypeId, ITStatus, reportType, _taxParameter, gradeName, gender);
|
||
|
||
}
|
||
|
||
private DataSet PrepareDataset(int nEmpID)
|
||
{
|
||
|
||
DataSet orootDataset = new DataSet();
|
||
DataRow dr = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable2 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
DataRow houseRent = null;
|
||
DataRow Conveyance = null;
|
||
DataRow Medical = null;
|
||
DataRow lfa = 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) continue;
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_SalaryIncome || oItem.Side == EnumIncomeTaxSide.Dec_SalaryIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
|
||
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 (houseRent != null)
|
||
{
|
||
IncomeTax taxAmount = 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 = 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 = 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 = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance);
|
||
if (taxAmount != null)
|
||
{
|
||
_TotalSalaryExempted += taxAmount.TotalAmount;
|
||
lfa["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount);
|
||
}
|
||
}
|
||
|
||
IncomeTax salaryIncome = 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));
|
||
|
||
TotalSalaryExepted = dr;
|
||
|
||
TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome || oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome)
|
||
{
|
||
|
||
if (oItem.ItemID != -305)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
}
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
IncomeTax totalAnnualExemption = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
if (totalAnnualExemption != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
totalAnnualExemption.ProjectedAmount *= -1;
|
||
totalAnnualExemption.TotalAmount *= -1;
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualExemption));
|
||
}
|
||
IncomeTax totalAnnualIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualIncome));
|
||
TotalAnnualExepted = dr;
|
||
TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
dTable1.TableName = "PayrollDataSet_IncomeTax";
|
||
orootDataset.Tables.Add(dTable1);
|
||
// Crate Slab Data
|
||
double ngrossTax = 0;
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable dTable = new PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable();
|
||
_InvestmentAmount = _taxParameter.MaxInvAmount;
|
||
bool isExist = dTable1.AsEnumerable().Where(x => x["ItemCode"].ToString() == "-237").Any();
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
if (isExist) totalAnnualIncome.PreviousAmount -= _TotalSalaryExempted;
|
||
List<TaxParameterSlab> empTaxSlabs = CalculateTaxOnSlab(_taxParameter, _employee, totalAnnualIncome.TotalAmount);
|
||
int index = 0;
|
||
dr = null;
|
||
foreach (TaxParameterSlab drr in empTaxSlabs)
|
||
{
|
||
dr = dTable.NewRow();
|
||
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 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 = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Income,
|
||
(int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
if (investmentCapdo != null)
|
||
_20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100;
|
||
}
|
||
else
|
||
{
|
||
investmentCapdo = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income,
|
||
(int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
if (investmentCapdo != null)
|
||
_20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100;
|
||
|
||
}
|
||
|
||
IncomeTax acinvestment = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Actual,
|
||
(int)EnumIncomeTaxItemGroup.Investment_Actual);
|
||
if (acinvestment != null)
|
||
_actualInvestment = acinvestment.TotalAmount;
|
||
|
||
IncomeTax taxRebate = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Allowed,
|
||
(int)EnumIncomeTaxItemGroup.Investment_Allowed);
|
||
|
||
if (taxRebate != null)
|
||
{
|
||
_investmentAllowed = taxRebate.TotalAmount;
|
||
string spf = "";
|
||
IncomeTax pf = 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 = 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["DataColumn1"] = taxRebate.Description;
|
||
oDRow["DataColumn2"] = spf;
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(taxRebate.TotalAmount);
|
||
// oDTable.Rows.Add(oDRow);
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
//if ((oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax) && oItem.ItemID != 4 && oItem.ItemID != 12)
|
||
//{
|
||
// oDRow = oDTable.NewRow();
|
||
// if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment)
|
||
// {
|
||
// oDRow["DataColumn1"] = oItem.Description;// +" @ " + _taxParameter.MaxInvExempPercent.ToString() + "%";
|
||
// if(ngrossTax >0)
|
||
// oDRow["DataColumn3"] = "(" + GlobalFunctions.TakaFormat(oItem.TotalAmount) + ")";
|
||
// else oDRow["DataColumn3"] = "(0)";
|
||
// }
|
||
// else
|
||
// {
|
||
// oDRow["DataColumn1"] = oItem.Description;
|
||
// oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oItem.TotalAmount);
|
||
// }
|
||
// oDRow["DataColumn2"] = "";
|
||
// oDTable.Rows.Add(oDRow);
|
||
//}
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment)
|
||
{
|
||
oDRow["DataColumn1"] = oItem.Description;// +" @ " + _taxParameter.MaxInvExempPercent.ToString() + "%";
|
||
if (ngrossTax > 0)
|
||
oDRow["DataColumn3"] = "(" + GlobalFunctions.TakaFormat(oItem.TotalAmount) + ")";
|
||
else oDRow["DataColumn3"] = "(0)";
|
||
}
|
||
else
|
||
{
|
||
oDRow["DataColumn1"] = oItem.Description;
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oItem.TotalAmount);
|
||
}
|
||
oDRow["DataColumn2"] = "";
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
|
||
}
|
||
|
||
IncomeTax oNetTaxPayable = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
(int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
|
||
IncomeTax oTaxDeducted = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
|
||
if (oNetTaxPayable != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = oNetTaxPayable.Description;
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oNetTaxPayable.TotalAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
if (!_isPrvs)
|
||
{
|
||
if (oTaxDeducted != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
//oDRow["DataColumn1"] = "Tax deducted from salary";
|
||
oDRow["DataColumn1"] = "Total Tax Paid";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.TotalAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (oTaxDeducted != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax paid up to previous month";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.PreviousAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax paid this month";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.ThisMonthAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax to be paid upto June";
|
||
oDRow["DataColumn2"] = "";
|
||
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 DataSet PrepareDatasetCityBank(int nEmpID)
|
||
{
|
||
|
||
DataSet orootDataset = new DataSet();
|
||
DataRow dr = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable2 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
DataRow houseRent = null;
|
||
DataRow Conveyance = null;
|
||
DataRow Medical = null;
|
||
DataRow lfa = 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) continue;
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_SalaryIncome || oItem.Side == EnumIncomeTaxSide.Dec_SalaryIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
|
||
dTable1.Rows.Add(this.getARowCityBank(dr, oItem));
|
||
|
||
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 (houseRent != null)
|
||
{
|
||
IncomeTax taxAmount = 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 = 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 = 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 = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance);
|
||
if (taxAmount != null)
|
||
{
|
||
_TotalSalaryExempted += taxAmount.TotalAmount;
|
||
lfa["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount);
|
||
}
|
||
}
|
||
|
||
IncomeTax salaryIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
|
||
if (salaryIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARowCityBank(dr, salaryIncome));
|
||
|
||
TotalSalaryExepted = dr;
|
||
|
||
TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome || oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome)
|
||
{
|
||
|
||
if (oItem.ItemID != -305)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARowCityBank(dr, oItem));
|
||
}
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
IncomeTax totalAnnualExemption = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
if (totalAnnualExemption != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
totalAnnualExemption.ProjectedAmount *= -1;
|
||
totalAnnualExemption.TotalAmount *= -1;
|
||
dTable1.Rows.Add(this.getARowCityBank(dr, totalAnnualExemption));
|
||
}
|
||
IncomeTax totalAnnualIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARowCityBank(dr, totalAnnualIncome));
|
||
TotalAnnualExepted = dr;
|
||
TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
dTable1.TableName = "PayrollDataSet_IncomeTax";
|
||
orootDataset.Tables.Add(dTable1);
|
||
// Crate Slab Data
|
||
double ngrossTax = 0;
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable dTable = new PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable();
|
||
_InvestmentAmount = _taxParameter.MaxInvAmount;
|
||
bool isExist = dTable1.AsEnumerable().Where(x => x["ItemCode"].ToString() == "-237").Any();
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
if (isExist) totalAnnualIncome.PreviousAmount -= _TotalSalaryExempted;
|
||
List<TaxParameterSlab> empTaxSlabs = CalculateTaxOnSlab(_taxParameter, _employee, totalAnnualIncome.TotalAmount);
|
||
int index = 0;
|
||
dr = null;
|
||
foreach (TaxParameterSlab drr in empTaxSlabs)
|
||
{
|
||
dr = dTable.NewRow();
|
||
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 PayrollDataSet.PayrollDataSet.IncomeTaxOtherDataTable();
|
||
// DataSet oIncomeTaxOth = IncomeTax.GetEmpIDforOthTax(dataFrom, nEmpID);
|
||
DataRow oDRow = null;
|
||
IncomeTax investmentCapdo;
|
||
if (_investmentwithoutPF == false)
|
||
{
|
||
investmentCapdo = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Income,
|
||
(int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
if (investmentCapdo != null)
|
||
_20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100;
|
||
}
|
||
else
|
||
{
|
||
investmentCapdo = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income,
|
||
(int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
if (investmentCapdo != null)
|
||
_20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100;
|
||
|
||
}
|
||
|
||
IncomeTax acinvestment = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Actual,
|
||
(int)EnumIncomeTaxItemGroup.Investment_Actual);
|
||
if (acinvestment != null)
|
||
_actualInvestment = acinvestment.TotalAmount;
|
||
|
||
IncomeTax taxRebate = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Allowed,
|
||
(int)EnumIncomeTaxItemGroup.Investment_Allowed);
|
||
|
||
if (taxRebate != null)
|
||
{
|
||
_investmentAllowed = taxRebate.TotalAmount;
|
||
string spf = "";
|
||
IncomeTax pf = 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 = 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["DataColumn1"] = taxRebate.Description;
|
||
oDRow["DataColumn2"] = spf;
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(taxRebate.TotalAmount);
|
||
// oDTable.Rows.Add(oDRow);
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment)
|
||
{
|
||
oDRow["DataColumn1"] = "(G) " + oItem.Description;// +" @ " + _taxParameter.MaxInvExempPercent.ToString() + "%";
|
||
if (ngrossTax > 0)
|
||
oDRow["DataColumn3"] = "(" + GlobalFunctions.TakaFormat(oItem.TotalAmount) + ")";
|
||
else oDRow["DataColumn3"] = "(0)";
|
||
}
|
||
else
|
||
{
|
||
oDRow["DataColumn1"] = "(G) " + oItem.Description;
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oItem.TotalAmount);
|
||
}
|
||
oDRow["DataColumn2"] = "";
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
|
||
}
|
||
|
||
IncomeTax oNetTaxPayable = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
(int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
|
||
IncomeTax oTaxDeducted = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
|
||
if (oNetTaxPayable != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "(H) " + oNetTaxPayable.Description;
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oNetTaxPayable.TotalAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
if (!_isPrvs)
|
||
{
|
||
if (oTaxDeducted != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
//oDRow["DataColumn1"] = "Tax deducted from salary";
|
||
oDRow["DataColumn1"] = "(I) Total Tax Paid";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.TotalAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (oTaxDeducted != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "(I) Tax paid up to previous month";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.PreviousAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "(J) Tax paid this month";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.ThisMonthAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "(K) Tax to be paid upto June";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oNetTaxPayable.TotalAmount - oTaxDeducted.TotalAmount);
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
oDTable.TableName = "PayrollDataSet_IncomeTaxOther";
|
||
orootDataset.Tables.Add(oDTable);
|
||
|
||
return orootDataset;
|
||
}
|
||
|
||
public static IncomeTax Get(List<IncomeTax> Incometaxs,
|
||
int employeeId, EnumIncomeTaxItemGroup groupCode, int itemId)
|
||
{
|
||
IncomeTax ReturnItem = Incometaxs.Find(delegate (IncomeTax taxItem)
|
||
{
|
||
return taxItem.EmployeeID == employeeId
|
||
&& taxItem.ItemGroup == groupCode
|
||
&& taxItem.ItemID == itemId;
|
||
});
|
||
return ReturnItem;
|
||
}
|
||
|
||
public static List<TaxParameterSlab> CalculateTaxOnSlab(TaxParameter parameter, Employee emp, double taxableIncome)
|
||
{
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
PayrollType payrollType = new PayrollType();
|
||
payrollType = new PayrollTypeService().Get(emp.PayrollTypeID);
|
||
List<TaxParameterSlab> empTaxSlabs = taxParameterService.GetEmployeeSlab(payrollType, parameter, emp);
|
||
if (empTaxSlabs == null || empTaxSlabs.Count == 0) throw new ServiceException("Employee Tax Slabs not found; Employee No:" + emp.EmployeeNo);
|
||
int index = 0;
|
||
|
||
if (emp.HasDisableChildren)
|
||
{
|
||
empTaxSlabs[0].IncomeAmount += 25000;
|
||
}
|
||
//if (emp.ForeignExPat &&
|
||
// Ease.CoreV35.Utility.Global.DateFunctions.DateDiff("m", emp.JoiningDate, SystemInformation.CurrentSysInfo.NextPayProcessDate) > 6)
|
||
//{
|
||
// empTaxSlabs[empTaxSlabs.Count - 1].SlabTaxAmount = empTaxSlabs[empTaxSlabs.Count].TaxPercent * (taxableIncome / 100);
|
||
// return empTaxSlabs;
|
||
//}
|
||
|
||
while (taxableIncome != 0)
|
||
{
|
||
TaxParameterSlab slab = empTaxSlabs[index];
|
||
if (taxableIncome > slab.IncomeAmount && index != empTaxSlabs.Count - 1)
|
||
{
|
||
slab.SlabTaxAmount = GlobalFunctions.Round((slab.IncomeAmount * slab.TaxPercent) / 100);
|
||
slab.SlabTaxableAmount = slab.IncomeAmount;
|
||
taxableIncome = taxableIncome - slab.IncomeAmount;
|
||
}
|
||
else
|
||
{
|
||
slab.SlabTaxableAmount = taxableIncome;
|
||
slab.SlabTaxAmount = GlobalFunctions.Round(((taxableIncome * slab.TaxPercent) / 100));
|
||
taxableIncome = 0;
|
||
}
|
||
index = index + 1;
|
||
}
|
||
return empTaxSlabs;
|
||
|
||
}
|
||
|
||
private DataRow getARow(DataRow orow, IncomeTax oItem)
|
||
{
|
||
if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Annual_Salary_Income)
|
||
{
|
||
DataRow dr = orow;
|
||
dr["EmpID"] = oItem.EmployeeID;
|
||
dr["ItemCode"] = oItem.ItemGroup;
|
||
dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = oItem.Description;
|
||
//modified
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_AmountPerAnnum); //oDRow["AmountPerannum"];
|
||
dr["ThisMonth"] = GlobalFunctions.TakaFormat(_ThisMonthAmount);
|
||
dr["PaidTillDate"] = GlobalFunctions.TakaFormat(_PaidTillDateAmount);//oDRow["PaidTillDate"];
|
||
dr["Projected"] = GlobalFunctions.TakaFormat(_ProjectedAmount);
|
||
//end modified
|
||
dr["Position"] = oItem.Position;
|
||
dr["Side"] = oItem.Side;
|
||
dr["LessExaempted"] = "0";
|
||
dr["RowSequence"] = oItem.Position;
|
||
//if (_taxParameter.FiscalyearDatefrom < new DateTime(2022, 7, 1))
|
||
//{
|
||
// dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_AmountPerAnnum); //oDRow["AmountPerannum"];
|
||
// dr["ThisMonth"] = GlobalFunctions.TakaFormat(_ThisMonthAmount);
|
||
// dr["PaidTillDate"] = GlobalFunctions.TakaFormat(_PaidTillDateAmount);//oDRow["PaidTillDate"];
|
||
// dr["Projected"] = GlobalFunctions.TakaFormat(_ProjectedAmount);
|
||
//}
|
||
//else
|
||
//{
|
||
// 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);
|
||
//}
|
||
|
||
return dr;
|
||
|
||
}
|
||
else if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Annual_Income)
|
||
{
|
||
DataRow dr = orow;
|
||
dr["EmpID"] = oItem.EmployeeID;
|
||
dr["ItemCode"] = oItem.ItemGroup;
|
||
dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = oItem.Description;
|
||
//modified
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(oItem.TotalAmount); //oDRow["AmountPerannum"];
|
||
dr["ThisMonth"] = GlobalFunctions.TakaFormat(_TThisMonthAmount);
|
||
dr["PaidTillDate"] = GlobalFunctions.TakaFormat(_TPaidTillDateAmount);//oDRow["PaidTillDate"];
|
||
dr["Projected"] = GlobalFunctions.TakaFormat(_TProjectedAmount);
|
||
//end modified
|
||
dr["Position"] = oItem.Position;
|
||
dr["Side"] = oItem.Side;
|
||
dr["LessExaempted"] = "0";
|
||
dr["RowSequence"] = oItem.Position;
|
||
//if (_taxParameter.FiscalyearDatefrom < new DateTime(2022, 7, 1))
|
||
//{
|
||
// dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_TAmountPerAnnum); //oDRow["AmountPerannum"];
|
||
// dr["ThisMonth"] = GlobalFunctions.TakaFormat(_TThisMonthAmount);
|
||
// dr["PaidTillDate"] = GlobalFunctions.TakaFormat(_TPaidTillDateAmount);//oDRow["PaidTillDate"];
|
||
// dr["Projected"] = GlobalFunctions.TakaFormat(_TProjectedAmount);
|
||
//}
|
||
//else
|
||
//{
|
||
// 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);
|
||
//}
|
||
|
||
return dr;
|
||
}
|
||
else
|
||
{
|
||
DataRow dr = orow;
|
||
dr["EmpID"] = oItem.EmployeeID;
|
||
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;
|
||
}
|
||
}
|
||
private DataRow getARowCityBank(DataRow orow, IncomeTax oItem)
|
||
{
|
||
if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Annual_Salary_Income)
|
||
{
|
||
DataRow dr = orow;
|
||
dr["EmpID"] = oItem.EmployeeID;
|
||
dr["ItemCode"] = oItem.ItemGroup;
|
||
dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = "(A) " + oItem.Description;
|
||
//modified
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_AmountPerAnnum);
|
||
dr["ThisMonth"] = GlobalFunctions.TakaFormat(_ThisMonthAmount);
|
||
dr["PaidTillDate"] = GlobalFunctions.TakaFormat(_PaidTillDateAmount);
|
||
dr["Projected"] = GlobalFunctions.TakaFormat(_ProjectedAmount);
|
||
//end modified
|
||
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["ItemCode"] = oItem.ItemGroup;
|
||
dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = oItem.Description;
|
||
//modified
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(oItem.TotalAmount);
|
||
dr["ThisMonth"] = GlobalFunctions.TakaFormat(_TThisMonthAmount);
|
||
dr["PaidTillDate"] = GlobalFunctions.TakaFormat(_TPaidTillDateAmount);
|
||
dr["Projected"] = GlobalFunctions.TakaFormat(_TProjectedAmount);
|
||
//end modified
|
||
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["ItemCode"] = oItem.ItemGroup;
|
||
dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = oItem.Description;
|
||
if (oItem.Description == "Total Exempted Income")
|
||
{
|
||
dr["IncomeHead"] = "(B) " + oItem.Description;
|
||
}
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(oItem.TotalAmount);
|
||
dr["ThisMonth"] = GlobalFunctions.TakaFormat(oItem.ThisMonthAmount);
|
||
dr["PaidTillDate"] = GlobalFunctions.TakaFormat(oItem.PreviousAmount);
|
||
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[] ShowTaxCertificate(string empIds, int taxParamId, int payrollType, int currentTaxParamId, string reportType)
|
||
{
|
||
byte[] bytes = null;
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
bool IsSeparateBonusChallan = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "incometax", "separatebonuschallan");
|
||
TaxParameter taxParameter = new TaxParameterService().GetTaxParameterWithSignature(taxParamId);
|
||
string assessmentYear = taxParameter.AssessmentYear.ToString();
|
||
string fiscalYear = taxParameter.FiscalYear.ToString();
|
||
string sEmpNo = empIds;
|
||
DataRow dr = null;
|
||
//IncomeTax oIncomeTax = new IncomeTax();
|
||
//IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
string TaxPeriod = "";
|
||
//DataSet oDset = null;
|
||
DataSet resultDataSet = new DataSet();
|
||
DataRow oDRow = null;
|
||
LocalReport localReport = new LocalReport();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
List<Employee> employeeList = null;
|
||
List<TaxChallan> taxChallans = new List<TaxChallan>();
|
||
List<TaxChallan> temptaxChallans = new List<TaxChallan>();
|
||
TaxChallan taxChallan = null;
|
||
TaxChallanService taxChallanService = new TaxChallanService();
|
||
employeeList = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollType);
|
||
taxChallans = new TaxChallanService().GetByTaxParamIDandPayrolltypeID(taxParamId, payrollType);
|
||
List<Designation> designations = new DesignationService().GetAll();
|
||
List<Department> departments = new DepartmentService().GetAll();
|
||
Designation designation = null;
|
||
Department department = null;
|
||
int nEmpID;
|
||
DataRow houseRent = null;
|
||
DataRow Conveyance = null;
|
||
DataRow Medical = null;
|
||
DataRow lfa = null;
|
||
DataRow TotalSalaryExepted = null;
|
||
DataRow TotalAnnualExepted = null;
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable empBasic = new PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan1DataTable dTChallan1 = new PayrollDataSet.PayrollDataSet.TaxChallan1DataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan2DataTable dTChallan2 = new PayrollDataSet.PayrollDataSet.TaxChallan2DataTable();
|
||
|
||
double challanCount = 0;
|
||
foreach (Employee oEmp in employeeList)
|
||
{
|
||
_AmountPerAnnum = 0;
|
||
_ThisMonthAmount = 0;
|
||
_PaidTillDateAmount = 0;
|
||
_ProjectedAmount = 0;
|
||
_employee = oEmp;
|
||
nEmpID = oEmp.ID;
|
||
GrandTotal = 0.0;
|
||
|
||
if (currentTaxParamId == taxParamId)
|
||
{
|
||
_incometaxes = incomeTaxService.Get(incomeTaxService.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, taxParamId);
|
||
}
|
||
else
|
||
{
|
||
_incometaxes = incomeTaxService.Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, taxParamId);
|
||
}
|
||
if (_incometaxes == null || _incometaxes.Count < 1) continue;
|
||
designation = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
department = departments.FirstOrDefault(x => x.ID == oEmp.DepartmentID);
|
||
|
||
oDRow = empBasic.NewRow();
|
||
oDRow["EmployeeNo"] = oEmp.EmployeeNo;
|
||
oDRow["EmpID"] = oEmp.ID;
|
||
oDRow["TinNo"] = oEmp.TinNo;
|
||
oDRow["Name"] = oEmp.Name;
|
||
oDRow["Designation"] = designation != null ? designation.Name : "";
|
||
oDRow["department"] = department != null ? department.Name : "";
|
||
oDRow["Gender"] = oEmp.Gender.ToString();
|
||
|
||
|
||
|
||
|
||
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) continue;
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_SalaryIncome || oItem.Side == EnumIncomeTaxSide.Dec_SalaryIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
|
||
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;
|
||
}
|
||
}
|
||
|
||
#region add items in certificate
|
||
IncomeTax salaryIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
|
||
if (salaryIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
salaryIncome.Description = "Total income from Salary";
|
||
dTable1.Rows.Add(this.getARow(dr, salaryIncome));
|
||
|
||
TotalSalaryExepted = dr;
|
||
|
||
TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oItem.Description = "Company's contribution to Provident Fund";
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
DataRow pfdat = dTable1.FirstOrDefault(x => x["ItemCode"].ToString() == (EnumIncomeTaxItemGroup.Company_Contri_PF).ToString() && x["EmpID"].ToString() == nEmpID.ToString());
|
||
double pfamount = 0;
|
||
if (pfdat != null)
|
||
{
|
||
pfamount = Convert.ToDouble(pfdat["AmountPerAnnum"].ToString());
|
||
}
|
||
dr = dTable1.NewRow();
|
||
dr["EmpID"] = _incometaxes[0].EmployeeID;
|
||
//dr["ItemCode"] = _incometaxes[0].ItemGroup;
|
||
//dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = "Total Annual Income";
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_AmountPerAnnum + pfamount); //oDRow["AmountPerannum"];
|
||
dr["ThisMonth"] = 0;
|
||
dr["PaidTillDate"] = 0;//oDRow["PaidTillDate"];
|
||
dr["Projected"] = 0;
|
||
dr["Position"] = 25;
|
||
dr["Side"] = 8;
|
||
dr["LessExaempted"] = "0";
|
||
dr["RowSequence"] = 25;
|
||
dTable1.Rows.Add(dr);
|
||
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oItem.Description = "Less: Exemption (1/3 of total annual income or 500,000; whichever is lower)";
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
IncomeTax totalAnnualIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
|
||
IncomeTax TotalIncome = Get(_incometaxes, nEmpID, EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
|
||
double TotalIncomeFromSalary = TotalIncome.TotalAmount;
|
||
|
||
IncomeTax PF = Get(_incometaxes, nEmpID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF);
|
||
|
||
double EmpPF = 0;
|
||
if (PF != null)
|
||
EmpPF = PF.TotalAmount;
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
totalAnnualIncome.Description = "Total Taxable Income";
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualIncome));
|
||
TotalAnnualExepted = dr;
|
||
TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax grstax = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax);
|
||
if (grstax != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
grstax.Description = "Gross Tax Payable";
|
||
dTable1.Rows.Add(this.getARow(dr, grstax));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax rebtoninv = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment);
|
||
if (rebtoninv != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
rebtoninv.Description = "Less: Tax Rebate on Investment";
|
||
dTable1.Rows.Add(this.getARow(dr, rebtoninv));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
IncomeTax ait = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, 1);
|
||
if (ait != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
ait.Description = "Less: AIT";
|
||
dTable1.Rows.Add(this.getARow(dr, ait));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax oNetTaxPayable = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
(int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
if (oNetTaxPayable != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oNetTaxPayable.Description = "Net Tax Payable (As per Sec 86)";
|
||
if (oNetTaxPayable.TotalAmount < 0)
|
||
{
|
||
oNetTaxPayable.TotalAmount = 0;
|
||
}
|
||
dTable1.Rows.Add(this.getARow(dr, oNetTaxPayable));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
#endregion
|
||
|
||
//Temporary for param 8
|
||
double totalChallanAmount = 0;
|
||
double totalChallanAmountForChallan = 0;
|
||
DataSet tempChallan = new DataSet();
|
||
|
||
#region old fiscal year report
|
||
if (fiscalYear.Trim() == "2022-2023")
|
||
{
|
||
|
||
tempChallan = taxChallanService.GetTaxDeductionByID(_employee.ID, _employee.PayrollTypeID);
|
||
//taxChallanService.GetChallan()
|
||
|
||
if (tempChallan != null && tempChallan.Tables.Count != 0)
|
||
{
|
||
double amnt = 0;
|
||
int length = 12;
|
||
DataRow temp = null;
|
||
if (tempChallan.Tables[0].Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < 6; i++)
|
||
{
|
||
switch (i)
|
||
{
|
||
case 0:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jul22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[0];
|
||
break;
|
||
case 1:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Aug22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[1];
|
||
break;
|
||
case 2:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Sep22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[2];
|
||
break;
|
||
case 3:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Oct22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[3];
|
||
break;
|
||
case 4:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Nov22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[4];
|
||
break;
|
||
case 5:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Dec22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[5];
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan1.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp["ChallanNo"];
|
||
dr["ChallanDate"] = (Convert.ToDateTime(temp["DateOfChallan"])).ToString("dd MMM yyyy");
|
||
dr["BankName"] = temp["BankName"];
|
||
dr["Amount"] = amnt;
|
||
dr["TotalAmount"] = temp["TotalAmount"];
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
}
|
||
|
||
for (int i = 6; i < 12; i++)
|
||
{
|
||
switch (i)
|
||
{
|
||
case 6:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jan23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[6];
|
||
break;
|
||
case 7:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Feb23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[7];
|
||
break;
|
||
case 8:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Mar23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[8];
|
||
break;
|
||
case 9:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Apr23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[9];
|
||
break;
|
||
case 10:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["May23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[10];
|
||
break;
|
||
case 11:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jun23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[11];
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan2.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp["ChallanNo"];
|
||
dr["ChallanDate"] = (Convert.ToDateTime(temp["DateOfChallan"])).ToString("dd MMM yyyy");
|
||
dr["BankName"] = temp["BankName"];
|
||
dr["Amount"] = amnt;
|
||
dr["TotalAmount"] = temp["TotalAmount"];
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan2.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
}
|
||
}
|
||
// dTChallan1.
|
||
}
|
||
_taxdeducted = totalChallanAmount;
|
||
oDRow["TotalDeduction"] = totalChallanAmount;
|
||
oDRow["TotalDeductionForChallan"] = payrollType == 1 ? totalChallanAmount : totalChallanAmountForChallan;
|
||
oDRow["TotalIncomeFromSalary"] = TotalIncomeFromSalary;
|
||
oDRow["EmpPF"] = EmpPF;
|
||
empBasic.Rows.Add(oDRow);
|
||
}
|
||
#endregion
|
||
else
|
||
{
|
||
string[] a = fiscalYear.Split('-');
|
||
DateTime startdate = new DateTime(Convert.ToInt32(a[0]), 7, 1);
|
||
DateTime enddate = new DateTime(Convert.ToInt32(a[1]), 6, 30);
|
||
tempChallan = taxChallanService.GetTaxDeductionByIDFromSalaryBonus(_employee.ID, _employee.PayrollTypeID, startdate, enddate, IsSeparateBonusChallan);
|
||
|
||
//taxChallanService.GetChallan()
|
||
|
||
if (tempChallan != null && tempChallan.Tables.Count != 0)
|
||
{
|
||
double amnt = 0;
|
||
double refund = 0;
|
||
int length = 12;
|
||
//TaxChallan temp = null;
|
||
TaxChallan temprefund = null;
|
||
|
||
DataRow dramount = null;
|
||
Branch branch = null;
|
||
Bank bank = null;
|
||
temptaxChallans = taxChallans.Where(x => x.EmployeeID == 0).ToList();
|
||
|
||
if (tempChallan.Tables[0].Rows.Count > 0 && temptaxChallans.Count > 0)
|
||
{
|
||
//challanCount = temptaxChallans.Count / (double)2;
|
||
challanCount = tempChallan.Tables[0].Rows.Count;
|
||
|
||
|
||
int i = 0;
|
||
string isbonus = "0";
|
||
|
||
if (temptaxChallans.Count < challanCount)
|
||
{
|
||
challanCount = temptaxChallans.Count;
|
||
}
|
||
|
||
challanCount = challanCount / (double)2;
|
||
challanCount = Math.Ceiling(challanCount);
|
||
|
||
foreach (TaxChallan temp in temptaxChallans)
|
||
{
|
||
refund = 0;
|
||
isbonus = temp.IsBonusAmount ? "1" : "0";
|
||
if (IsSeparateBonusChallan)
|
||
{
|
||
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(temp.SalaryMonthly).ToString() && x["IsSeparateBonus"].ToString() == isbonus);
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
}
|
||
else
|
||
{
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(temp.SalaryMonthly).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
}
|
||
|
||
//temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate).ToString() && x.EmployeeID == 0);
|
||
if (amnt == 0) continue;
|
||
if (temp != null && temp.BranchID > 0)
|
||
{
|
||
branch = new BranchService().Get(temp.BranchID);
|
||
bank = new BankService().Get(branch.BankID);
|
||
}
|
||
if (i < challanCount)
|
||
{
|
||
dr = dTChallan1.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp != null ? temp.ChallanNo : "";
|
||
dr["ChallanDate"] = (temp != null ? temp.DepositDate.ToString("dd MMM yyyy") : "");
|
||
dr["BankName"] = bank != null ? bank.Name : "";
|
||
dr["BranchName"] = branch != null ? branch.Name : "";
|
||
dr["Amount"] = temp != null ? amnt : 0;
|
||
dr["TotalAmount"] = temp != null ? temp.Amount : 0;
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
totalChallanAmountForChallan += (temp != null ? amnt : 0);
|
||
|
||
}
|
||
else
|
||
{
|
||
dr = dTChallan2.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp != null ? temp.ChallanNo : "";
|
||
dr["ChallanDate"] = (temp != null ? temp.DepositDate.ToString("dd MMM yyyy") : "");
|
||
dr["BankName"] = bank != null ? bank.Name : "";
|
||
dr["BranchName"] = branch != null ? branch.Name : "";
|
||
dr["Amount"] = temp != null ? amnt : 0;
|
||
dr["TotalAmount"] = temp != null ? temp.Amount : 0;
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan2.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
totalChallanAmountForChallan += (temp != null ? amnt : 0);
|
||
|
||
}
|
||
branch = null;
|
||
bank = null;
|
||
i++;
|
||
}
|
||
}
|
||
}
|
||
_taxdeducted = totalChallanAmount;
|
||
oDRow["TotalDeduction"] = totalChallanAmount;
|
||
oDRow["TotalDeductionForChallan"] = payrollType == 1 ? totalChallanAmount : totalChallanAmountForChallan;
|
||
oDRow["TotalIncomeFromSalary"] = TotalIncomeFromSalary;
|
||
oDRow["EmpPF"] = EmpPF;
|
||
empBasic.Rows.Add(oDRow);
|
||
//IncomeTax oNetTaxdeducted = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
//oDRow["TotalDeduction"] = oNetTaxdeducted!=null? oNetTaxdeducted.TotalAmount:0;
|
||
//empBasic.Rows.Add(oDRow);
|
||
}
|
||
}
|
||
empBasic.TableName = "PayrollDataSet_PayslipBasicInfo";
|
||
resultDataSet.Tables.Add(empBasic);
|
||
|
||
dTable1.TableName = "PayrollDataSet_IncomeTax";
|
||
resultDataSet.Tables.Add(dTable1);
|
||
|
||
dTChallan1.TableName = "PayrollDataSet_TaxChallan1";
|
||
resultDataSet.Tables.Add(dTChallan1);
|
||
|
||
dTChallan2.TableName = "PayrollDataSet_TaxChallan2";
|
||
resultDataSet.Tables.Add(dTChallan2);
|
||
//rParam = new ReportParameter("TaxPeriod", TaxPeriod);
|
||
//reportParameters.Add(rParam);
|
||
//rParam = new ReportParameter("signature", signaturePath);
|
||
//reportParameters.Add(rParam);
|
||
|
||
//if (reportParameters != null)
|
||
// localReport.SetParameters(reportParameters);
|
||
//Warning[] warnings;
|
||
//string[] streamids;
|
||
//string mimeType;
|
||
//string encoding;
|
||
//string filenameExtension;
|
||
//bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
|
||
// out streamids, out warnings);
|
||
|
||
//dt.TableName = "PayrollDataSet_AnnualIncomeCertificate";
|
||
//resultDataSet.Tables.Add(dt);
|
||
//string rdlcName = "HRM.Report.RDLC.AnnualIncomeCertificate.rdlc";
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowIncomeCertificate(null, resultDataSet, TaxPeriod, payrollType, taxParamId, reportType, assessmentYear, fiscalYear, taxParameter);
|
||
//return reportProcessor.CommonReportView(null, rdlcName, resultDataSet, null, reportParameters, true, payrollType, reportType);
|
||
}
|
||
|
||
public byte[] ShowTaxCertificateOld(string empIds, int taxParamId, int payrollType, int currentTaxParamId, string reportType)
|
||
{
|
||
byte[] bytes = null;
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
|
||
TaxParameter taxParameter = new TaxParameterService().Get(taxParamId);
|
||
string assessmentYear = taxParameter.AssessmentYear.ToString();
|
||
string fiscalYear = taxParameter.FiscalYear.ToString();
|
||
string sEmpNo = empIds;
|
||
DataRow dr = null;
|
||
//IncomeTax oIncomeTax = new IncomeTax();
|
||
//IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
string TaxPeriod = "";
|
||
//DataSet oDset = null;
|
||
DataSet resultDataSet = new DataSet();
|
||
DataRow oDRow = null;
|
||
LocalReport localReport = new LocalReport();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
List<Employee> employeeList = null;
|
||
List<TaxChallan> taxChallans = new List<TaxChallan>();
|
||
TaxChallan taxChallan = null;
|
||
TaxChallanService taxChallanService = new TaxChallanService();
|
||
employeeList = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollType);
|
||
taxChallans = new TaxChallanService().GetByTaxParamIDandPayrolltypeID(taxParamId, payrollType);
|
||
List<Designation> designations = new DesignationService().GetAll();
|
||
List<Department> departments = new DepartmentService().GetAll();
|
||
Designation designation = null;
|
||
Department department = null;
|
||
int nEmpID;
|
||
DataRow houseRent = null;
|
||
DataRow Conveyance = null;
|
||
DataRow Medical = null;
|
||
DataRow lfa = null;
|
||
DataRow TotalSalaryExepted = null;
|
||
DataRow TotalAnnualExepted = null;
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable empBasic = new PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable();
|
||
//PayrollDataSet.PayrollDataSet.AnnualIncomeCertificateDataTable dt = new PayrollDataSet.PayrollDataSet.AnnualIncomeCertificateDataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan1DataTable dTChallan1 = new PayrollDataSet.PayrollDataSet.TaxChallan1DataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan2DataTable dTChallan2 = new PayrollDataSet.PayrollDataSet.TaxChallan2DataTable();
|
||
|
||
foreach (Employee oEmp in employeeList)
|
||
{
|
||
_AmountPerAnnum = 0;
|
||
_ThisMonthAmount = 0;
|
||
_PaidTillDateAmount = 0;
|
||
_ProjectedAmount = 0;
|
||
//if (oEmp.JoiningDate >= taxParameter.FiscalyearDatefrom)
|
||
//{
|
||
// TaxPeriod = "from " + oEmp.JoiningDate.ToString("MMMM dd, yyyy") + " to " + taxParameter.FiscalyearDateTo.ToString("MMMM dd, yyyy");
|
||
//}
|
||
//else
|
||
//{
|
||
// TaxPeriod = "from " + taxParameter.FiscalyearDatefrom.ToString("MMMM dd, yyyy") + " to " + taxParameter.FiscalyearDateTo.ToString("MMMM dd, yyyy");
|
||
//}
|
||
_employee = oEmp;
|
||
nEmpID = oEmp.ID;
|
||
GrandTotal = 0.0;
|
||
|
||
if (currentTaxParamId == taxParamId)
|
||
{
|
||
_incometaxes = incomeTaxService.Get(incomeTaxService.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, taxParamId);
|
||
}
|
||
else
|
||
{
|
||
_incometaxes = incomeTaxService.Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, taxParamId);
|
||
}
|
||
if (_incometaxes == null || _incometaxes.Count < 1) continue;
|
||
designation = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
department = departments.FirstOrDefault(x => x.ID == oEmp.DepartmentID);
|
||
|
||
oDRow = empBasic.NewRow();
|
||
oDRow["EmployeeNo"] = oEmp.EmployeeNo;
|
||
oDRow["EmpID"] = oEmp.ID;
|
||
oDRow["TinNo"] = oEmp.TinNo;
|
||
oDRow["Name"] = oEmp.Name;
|
||
oDRow["Designation"] = designation != null ? designation.Name : "";
|
||
oDRow["department"] = department != null ? department.Name : "";
|
||
oDRow["Gender"] = oEmp.Gender.ToString();
|
||
|
||
|
||
|
||
|
||
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) continue;
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_SalaryIncome || oItem.Side == EnumIncomeTaxSide.Dec_SalaryIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
|
||
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;
|
||
}
|
||
}
|
||
|
||
|
||
IncomeTax salaryIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
|
||
if (salaryIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
salaryIncome.Description = "Total income from Salary";
|
||
dTable1.Rows.Add(this.getARow(dr, salaryIncome));
|
||
|
||
TotalSalaryExepted = dr;
|
||
|
||
TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oItem.Description = "Company's contribution to Provident Fund";
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
DataRow pfdat = dTable1.FirstOrDefault(x => x["ItemCode"].ToString() == (EnumIncomeTaxItemGroup.Company_Contri_PF).ToString() && x["EmpID"].ToString() == nEmpID.ToString());
|
||
double pfamount = 0;
|
||
if (pfdat != null)
|
||
{
|
||
pfamount = Convert.ToDouble(pfdat["AmountPerAnnum"].ToString());
|
||
}
|
||
dr = dTable1.NewRow();
|
||
dr["EmpID"] = _incometaxes[0].EmployeeID;
|
||
//dr["ItemCode"] = _incometaxes[0].ItemGroup;
|
||
//dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = "Total Annual Income";
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_AmountPerAnnum + pfamount); //oDRow["AmountPerannum"];
|
||
dr["ThisMonth"] = 0;
|
||
dr["PaidTillDate"] = 0;//oDRow["PaidTillDate"];
|
||
dr["Projected"] = 0;
|
||
dr["Position"] = 25;
|
||
dr["Side"] = 8;
|
||
dr["LessExaempted"] = "0";
|
||
dr["RowSequence"] = 25;
|
||
dTable1.Rows.Add(dr);
|
||
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oItem.Description = "Less: Exemption (1/3 of total annual income or 450,000; whichever is lower)";
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
IncomeTax totalAnnualIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
totalAnnualIncome.Description = "Total Taxable Income";
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualIncome));
|
||
TotalAnnualExepted = dr;
|
||
TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax grstax = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax);
|
||
if (grstax != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
grstax.Description = "Gross Tax Payable";
|
||
dTable1.Rows.Add(this.getARow(dr, grstax));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax rebtoninv = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment);
|
||
if (rebtoninv != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
rebtoninv.Description = "Less: Tax Rebate on Investment";
|
||
dTable1.Rows.Add(this.getARow(dr, rebtoninv));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
IncomeTax ait = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, 1);
|
||
if (ait != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
ait.Description = "Less: AIT";
|
||
dTable1.Rows.Add(this.getARow(dr, ait));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax oNetTaxPayable = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
(int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
if (oNetTaxPayable != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oNetTaxPayable.Description = "Net Tax Payable (As per Sec 86)";
|
||
if (oNetTaxPayable.TotalAmount < 0)
|
||
{
|
||
oNetTaxPayable.TotalAmount = 0;
|
||
}
|
||
dTable1.Rows.Add(this.getARow(dr, oNetTaxPayable));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
//Temporary for param 8
|
||
double totalChallanAmount = 0;
|
||
double totalChallanAmountForChallan = 0;
|
||
DataSet tempChallan = new DataSet();
|
||
if (fiscalYear.Trim() == "2022-2023")
|
||
{
|
||
|
||
tempChallan = taxChallanService.GetTaxDeductionByID(_employee.ID, _employee.PayrollTypeID);
|
||
//taxChallanService.GetChallan()
|
||
|
||
if (tempChallan != null && tempChallan.Tables.Count != 0)
|
||
{
|
||
double amnt = 0;
|
||
int length = 12;
|
||
DataRow temp = null;
|
||
if (tempChallan.Tables[0].Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < 6; i++)
|
||
{
|
||
switch (i)
|
||
{
|
||
case 0:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jul22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[0];
|
||
break;
|
||
case 1:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Aug22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[1];
|
||
break;
|
||
case 2:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Sep22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[2];
|
||
break;
|
||
case 3:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Oct22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[3];
|
||
break;
|
||
case 4:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Nov22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[4];
|
||
break;
|
||
case 5:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Dec22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[5];
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan1.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp["ChallanNo"];
|
||
dr["ChallanDate"] = (Convert.ToDateTime(temp["DateOfChallan"])).ToString("dd MMM yyyy");
|
||
dr["BankName"] = temp["BankName"];
|
||
dr["Amount"] = amnt;
|
||
dr["TotalAmount"] = temp["TotalAmount"];
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
}
|
||
|
||
for (int i = 6; i < 12; i++)
|
||
{
|
||
switch (i)
|
||
{
|
||
case 6:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jan23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[6];
|
||
break;
|
||
case 7:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Feb23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[7];
|
||
break;
|
||
case 8:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Mar23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[8];
|
||
break;
|
||
case 9:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Apr23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[9];
|
||
break;
|
||
case 10:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["May23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[10];
|
||
break;
|
||
case 11:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jun23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[11];
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan2.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp["ChallanNo"];
|
||
dr["ChallanDate"] = (Convert.ToDateTime(temp["DateOfChallan"])).ToString("dd MMM yyyy");
|
||
dr["BankName"] = temp["BankName"];
|
||
dr["Amount"] = amnt;
|
||
dr["TotalAmount"] = temp["TotalAmount"];
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan2.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
}
|
||
}
|
||
// dTChallan1.
|
||
}
|
||
_taxdeducted = totalChallanAmount;
|
||
oDRow["TotalDeduction"] = totalChallanAmount;
|
||
oDRow["TotalDeductionForChallan"] = payrollType == 1 ? totalChallanAmount : totalChallanAmountForChallan;
|
||
empBasic.Rows.Add(oDRow);
|
||
}
|
||
else
|
||
{
|
||
string[] a = fiscalYear.Split('-');
|
||
DateTime startdate = new DateTime(Convert.ToInt32(a[0]), 7, 1);
|
||
DateTime enddate = new DateTime(Convert.ToInt32(a[1]), 6, 30);
|
||
tempChallan = taxChallanService.GetTaxDeductionByIDFromSalaryBonus(_employee.ID, _employee.PayrollTypeID, startdate, enddate, false);
|
||
//taxChallanService.GetChallan()
|
||
|
||
if (tempChallan != null && tempChallan.Tables.Count != 0)
|
||
{
|
||
double amnt = 0;
|
||
double refund = 0;
|
||
int length = 12;
|
||
TaxChallan temp = null;
|
||
TaxChallan temprefund = null;
|
||
|
||
DataRow dramount = null;
|
||
if (tempChallan.Tables[0].Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < 6; i++)
|
||
{
|
||
refund = 0;
|
||
switch (i)
|
||
{
|
||
case 0:
|
||
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate).ToString() && x.EmployeeID == 0); //tempChallan.Tables[1].Rows[0];
|
||
break;
|
||
case 1:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(1)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(1)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 2:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(2)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(2)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 3:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(3)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(3)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 4:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(4)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(4)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 5:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(5)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(5)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan1.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp != null ? temp.ChallanNo : "";
|
||
dr["ChallanDate"] = (temp != null ? temp.DepositDate.ToString("dd MMM yyyy") : "");
|
||
dr["BankName"] = temp != null ? temp.BankName : "";
|
||
dr["Amount"] = temp != null ? amnt : 0;
|
||
dr["Amount"] = temp != null ? temp.ChallanAmount : 0;
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
totalChallanAmountForChallan += (temp != null ? amnt : 0);
|
||
}
|
||
|
||
for (int i = 6; i < 12; i++)
|
||
{
|
||
refund = 0;
|
||
switch (i)
|
||
{
|
||
case 6:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(6)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(6)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 7:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(7)).ToString());
|
||
temprefund = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(7)).ToString() && x.EmployeeID == _employee.ID);
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0)) - (temprefund != null ? temprefund.ChallanAmount : 0);
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(7)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 8:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(8)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(8)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 9:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(9)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(9)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 10:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(10)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(10)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 11:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(11)).ToString());
|
||
temprefund = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(11)).ToString() && x.EmployeeID == _employee.ID);
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0)) - (temprefund != null ? temprefund.ChallanAmount : 0);
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(11)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan2.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp != null ? temp.ChallanNo : "";
|
||
dr["ChallanDate"] = (temp != null ? temp.DepositDate.ToString("dd MMM yyyy") : "");
|
||
dr["BankName"] = temp != null ? temp.BankName : "";
|
||
dr["Amount"] = temp != null ? amnt : 0;
|
||
dr["Amount"] = temp != null ? temp.ChallanAmount : 0;
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan2.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
totalChallanAmountForChallan += (temp != null ? amnt : 0);
|
||
|
||
}
|
||
}
|
||
// dTChallan1.
|
||
}
|
||
_taxdeducted = totalChallanAmount;
|
||
oDRow["TotalDeduction"] = totalChallanAmount;
|
||
oDRow["TotalDeductionForChallan"] = payrollType == 1 ? totalChallanAmount : totalChallanAmountForChallan;
|
||
empBasic.Rows.Add(oDRow);
|
||
//IncomeTax oNetTaxdeducted = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
//oDRow["TotalDeduction"] = oNetTaxdeducted!=null? oNetTaxdeducted.TotalAmount:0;
|
||
//empBasic.Rows.Add(oDRow);
|
||
}
|
||
}
|
||
empBasic.TableName = "PayrollDataSet_PayslipBasicInfo";
|
||
resultDataSet.Tables.Add(empBasic);
|
||
|
||
dTable1.TableName = "PayrollDataSet_IncomeTax";
|
||
resultDataSet.Tables.Add(dTable1);
|
||
|
||
dTChallan1.TableName = "PayrollDataSet_TaxChallan1";
|
||
resultDataSet.Tables.Add(dTChallan1);
|
||
|
||
dTChallan2.TableName = "PayrollDataSet_TaxChallan2";
|
||
resultDataSet.Tables.Add(dTChallan2);
|
||
//rParam = new ReportParameter("TaxPeriod", TaxPeriod);
|
||
//reportParameters.Add(rParam);
|
||
//rParam = new ReportParameter("signature", signaturePath);
|
||
//reportParameters.Add(rParam);
|
||
|
||
//if (reportParameters != null)
|
||
// localReport.SetParameters(reportParameters);
|
||
//Warning[] warnings;
|
||
//string[] streamids;
|
||
//string mimeType;
|
||
//string encoding;
|
||
//string filenameExtension;
|
||
//bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
|
||
// out streamids, out warnings);
|
||
|
||
//dt.TableName = "PayrollDataSet_AnnualIncomeCertificate";
|
||
//resultDataSet.Tables.Add(dt);
|
||
//string rdlcName = "HRM.Report.RDLC.AnnualIncomeCertificate.rdlc";
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowIncomeCertificate(null, resultDataSet, TaxPeriod, payrollType, taxParamId, reportType, assessmentYear, fiscalYear, taxParameter);
|
||
//return reportProcessor.CommonReportView(null, rdlcName, resultDataSet, null, reportParameters, true, payrollType, reportType);
|
||
}
|
||
public byte[] ShowTaxCertificateEmpWiseChallan(string empIds, int taxParamId, int payrollType, int currentTaxParamId, string reportType)
|
||
{
|
||
byte[] bytes = null;
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
|
||
TaxParameter taxParameter = new TaxParameterService().Get(taxParamId);
|
||
string assessmentYear = taxParameter.AssessmentYear.ToString();
|
||
string fiscalYear = taxParameter.FiscalYear.ToString();
|
||
string sEmpNo = empIds;
|
||
DataRow dr = null;
|
||
//IncomeTax oIncomeTax = new IncomeTax();
|
||
//IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
string TaxPeriod = "";
|
||
//DataSet oDset = null;
|
||
DataSet resultDataSet = new DataSet();
|
||
DataRow oDRow = null;
|
||
LocalReport localReport = new LocalReport();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
List<Employee> employeeList = null;
|
||
List<TaxChallan> taxChallans = new List<TaxChallan>();
|
||
List<TaxChallan> temptaxChallans = null;
|
||
TaxChallan taxChallan = null;
|
||
TaxChallanService taxChallanService = new TaxChallanService();
|
||
employeeList = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollType);
|
||
taxChallans = new TaxChallanService().GetByTaxParamIDandPayrolltypeIDEmployeewise(taxParamId, payrollType);
|
||
List<Designation> designations = new DesignationService().GetAll();
|
||
List<Department> departments = new DepartmentService().GetAll();
|
||
Designation designation = null;
|
||
Department department = null;
|
||
int nEmpID;
|
||
DataRow houseRent = null;
|
||
DataRow Conveyance = null;
|
||
DataRow Medical = null;
|
||
DataRow lfa = null;
|
||
DataRow TotalSalaryExepted = null;
|
||
DataRow TotalAnnualExepted = null;
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable empBasic = new PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable();
|
||
//PayrollDataSet.PayrollDataSet.AnnualIncomeCertificateDataTable dt = new PayrollDataSet.PayrollDataSet.AnnualIncomeCertificateDataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan1DataTable dTChallan1 = new PayrollDataSet.PayrollDataSet.TaxChallan1DataTable();
|
||
|
||
|
||
foreach (Employee oEmp in employeeList)
|
||
{
|
||
_AmountPerAnnum = 0;
|
||
_ThisMonthAmount = 0;
|
||
_PaidTillDateAmount = 0;
|
||
_ProjectedAmount = 0;
|
||
//if (oEmp.JoiningDate >= taxParameter.FiscalyearDatefrom)
|
||
//{
|
||
// TaxPeriod = "from " + oEmp.JoiningDate.ToString("MMMM dd, yyyy") + " to " + taxParameter.FiscalyearDateTo.ToString("MMMM dd, yyyy");
|
||
//}
|
||
//else
|
||
//{
|
||
// TaxPeriod = "from " + taxParameter.FiscalyearDatefrom.ToString("MMMM dd, yyyy") + " to " + taxParameter.FiscalyearDateTo.ToString("MMMM dd, yyyy");
|
||
//}
|
||
_employee = oEmp;
|
||
nEmpID = oEmp.ID;
|
||
GrandTotal = 0.0;
|
||
|
||
if (currentTaxParamId == taxParamId)
|
||
{
|
||
_incometaxes = incomeTaxService.Get(incomeTaxService.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, taxParamId);
|
||
}
|
||
else
|
||
{
|
||
_incometaxes = incomeTaxService.Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, taxParamId);
|
||
}
|
||
if (_incometaxes == null || _incometaxes.Count < 1) continue;
|
||
designation = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
department = departments.FirstOrDefault(x => x.ID == oEmp.DepartmentID);
|
||
|
||
oDRow = empBasic.NewRow();
|
||
oDRow["EmployeeNo"] = oEmp.EmployeeNo;
|
||
oDRow["EmpID"] = oEmp.ID;
|
||
oDRow["TinNo"] = oEmp.TinNo;
|
||
oDRow["Name"] = oEmp.Name;
|
||
oDRow["Designation"] = designation != null ? designation.Name : "";
|
||
oDRow["department"] = department != null ? department.Name : "";
|
||
oDRow["Gender"] = oEmp.Gender.ToString();
|
||
|
||
|
||
|
||
|
||
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) continue;
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_SalaryIncome || oItem.Side == EnumIncomeTaxSide.Dec_SalaryIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
|
||
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;
|
||
}
|
||
}
|
||
|
||
|
||
IncomeTax salaryIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
|
||
if (salaryIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
salaryIncome.Description = "Total income from Salary";
|
||
dTable1.Rows.Add(this.getARow(dr, salaryIncome));
|
||
|
||
TotalSalaryExepted = dr;
|
||
|
||
TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oItem.Description = "Company's contribution to Provident Fund";
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
DataRow pfdat = dTable1.FirstOrDefault(x => x["ItemCode"].ToString() == (EnumIncomeTaxItemGroup.Company_Contri_PF).ToString() && x["EmpID"].ToString() == nEmpID.ToString());
|
||
double pfamount = 0;
|
||
if (pfdat != null)
|
||
{
|
||
pfamount = Convert.ToDouble(pfdat["AmountPerAnnum"].ToString());
|
||
}
|
||
dr = dTable1.NewRow();
|
||
dr["EmpID"] = _incometaxes[0].EmployeeID;
|
||
//dr["ItemCode"] = _incometaxes[0].ItemGroup;
|
||
//dr["ItemID"] = oItem.ItemID;
|
||
dr["IncomeHead"] = "Total Annual Income";
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(_AmountPerAnnum + pfamount); //oDRow["AmountPerannum"];
|
||
dr["ThisMonth"] = 0;
|
||
dr["PaidTillDate"] = 0;//oDRow["PaidTillDate"];
|
||
dr["Projected"] = 0;
|
||
dr["Position"] = 25;
|
||
dr["Side"] = 8;
|
||
dr["LessExaempted"] = "0";
|
||
dr["RowSequence"] = 25;
|
||
dTable1.Rows.Add(dr);
|
||
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oItem.Description = "Less: Exemption (1/3 of total annual income or 450,000; whichever is lower)";
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
IncomeTax totalAnnualIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
totalAnnualIncome.Description = "Total Taxable Income";
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualIncome));
|
||
TotalAnnualExepted = dr;
|
||
TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax grstax = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Gross_Tax, (int)EnumIncomeTaxItemGroup.Gross_Tax);
|
||
if (grstax != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
grstax.Description = "Gross Tax Payable";
|
||
dTable1.Rows.Add(this.getARow(dr, grstax));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax rebtoninv = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Tax_Credit_On_Investment, (int)EnumIncomeTaxItemGroup.Tax_Credit_On_Investment);
|
||
if (rebtoninv != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
rebtoninv.Description = "Less: Tax Rebate on Investment";
|
||
dTable1.Rows.Add(this.getARow(dr, rebtoninv));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
IncomeTax ait = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate, 1);
|
||
if (ait != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
ait.Description = "Less: AIT";
|
||
dTable1.Rows.Add(this.getARow(dr, ait));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
IncomeTax oNetTaxPayable = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
(int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
if (oNetTaxPayable != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
oNetTaxPayable.Description = "Net Tax Payable (As per Sec 86)";
|
||
if (oNetTaxPayable.TotalAmount < 0)
|
||
{
|
||
oNetTaxPayable.TotalAmount = 0;
|
||
}
|
||
dTable1.Rows.Add(this.getARow(dr, oNetTaxPayable));
|
||
TotalAnnualExepted = dr;
|
||
//TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
|
||
|
||
|
||
|
||
//Temporary for param 8
|
||
double totalChallanAmount = 0;
|
||
double totalChallanAmountForChallan = 0;
|
||
DataSet tempChallan = new DataSet();
|
||
temptaxChallans = taxChallans.Where(x => x.EmployeeID == _employee.ID).ToList();
|
||
//if (fiscalYear.Trim() == "2022-2023")
|
||
//{
|
||
|
||
// //tempChallan = taxChallanService.GetTaxDeductionByID(_employee.ID, _employee.PayrollTypeID);
|
||
// //taxChallanService.GetChallan()
|
||
|
||
// if (tempChallan != null && tempChallan.Tables.Count != 0)
|
||
// {
|
||
// double amnt = 0;
|
||
// int length = 12;
|
||
// DataRow temp = null;
|
||
// if (temptaxChallans.Count > 0)
|
||
// {
|
||
// for (int i = 0; i < 6; i++)
|
||
// {
|
||
// switch (i)
|
||
// {
|
||
// case 0:
|
||
// amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jul22"].ToString());
|
||
// temp = tempChallan.Tables[1].Rows[0];
|
||
// break;
|
||
// case 1:
|
||
// amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Aug22"].ToString());
|
||
// temp = tempChallan.Tables[1].Rows[1];
|
||
// break;
|
||
// case 2:
|
||
// amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Sep22"].ToString());
|
||
// temp = tempChallan.Tables[1].Rows[2];
|
||
// break;
|
||
// case 3:
|
||
// amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Oct22"].ToString());
|
||
// temp = tempChallan.Tables[1].Rows[3];
|
||
// break;
|
||
// case 4:
|
||
// amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Nov22"].ToString());
|
||
// temp = tempChallan.Tables[1].Rows[4];
|
||
// break;
|
||
// case 5:
|
||
// amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Dec22"].ToString());
|
||
// temp = tempChallan.Tables[1].Rows[5];
|
||
// break;
|
||
|
||
// }
|
||
|
||
// dr = dTChallan1.NewRow();
|
||
// dr["SLNo"] = i + 1;
|
||
// dr["ChallanNo"] = temp["ChallanNo"];
|
||
// dr["ChallanDate"] = (Convert.ToDateTime(temp["DateOfChallan"])).ToString("dd MMM yyyy");
|
||
// dr["BankName"] = temp["BankName"];
|
||
// dr["Amount"] = amnt;
|
||
// dr["TotalAmount"] = temp["TotalAmount"];
|
||
// dr["EmpID"] = _employee.ID;
|
||
// dTChallan1.Rows.Add(dr);
|
||
// totalChallanAmount += amnt;
|
||
// }
|
||
|
||
|
||
|
||
// }
|
||
// // dTChallan1.
|
||
// }
|
||
// _taxdeducted = totalChallanAmount;
|
||
// oDRow["TotalDeduction"] = totalChallanAmount;
|
||
// oDRow["TotalDeductionForChallan"] = payrollType == 1 ? totalChallanAmount : totalChallanAmountForChallan;
|
||
// empBasic.Rows.Add(oDRow);
|
||
//}
|
||
//else
|
||
//{
|
||
string[] a = fiscalYear.Split('-');
|
||
DateTime startdate = new DateTime(Convert.ToInt32(a[0]), 7, 1);
|
||
DateTime enddate = new DateTime(Convert.ToInt32(a[1]), 6, 30);
|
||
//tempChallan = taxChallanService.GetTaxDeductionByIDFromSalaryBonus(_employee.ID, _employee.PayrollTypeID, startdate, enddate);
|
||
//taxChallanService.GetChallan()
|
||
|
||
double amnt = 0;
|
||
double refund = 0;
|
||
int length = 12;
|
||
//TaxChallan temp = null;
|
||
TaxChallan temprefund = null;
|
||
|
||
DataRow dramount = null;
|
||
int i = 0;
|
||
if (temptaxChallans.Count > 0)
|
||
{
|
||
foreach (TaxChallan temp in temptaxChallans)
|
||
{
|
||
|
||
|
||
//dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate).ToString());
|
||
//amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
//temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate).ToString() && x.EmployeeID == 0); //tempChallan.Tables[1].Rows[0];
|
||
|
||
|
||
dr = dTChallan1.NewRow();
|
||
dr["SLNo"] = i = i + 1;
|
||
dr["ChallanNo"] = temp != null ? temp.ChallanNo : "";
|
||
dr["ChallanDate"] = (temp != null ? temp.DepositDate.ToString("dd MMM yyyy") : "");
|
||
dr["BankName"] = temp != null ? temp.BankName : "";
|
||
dr["EmployeeAmount"] = temp != null ? temp.EmployeeAmount : 0;
|
||
dr["Amount"] = temp != null ? temp.ChallanAmount : 0;
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
totalChallanAmountForChallan += (temp != null ? amnt : 0);
|
||
}
|
||
|
||
|
||
}
|
||
// dTChallan1.
|
||
//}
|
||
_taxdeducted = totalChallanAmount;
|
||
oDRow["TotalDeduction"] = totalChallanAmount;
|
||
oDRow["TotalDeductionForChallan"] = payrollType == 1 ? totalChallanAmount : totalChallanAmountForChallan;
|
||
empBasic.Rows.Add(oDRow);
|
||
//IncomeTax oNetTaxdeducted = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
//oDRow["TotalDeduction"] = oNetTaxdeducted!=null? oNetTaxdeducted.TotalAmount:0;
|
||
//empBasic.Rows.Add(oDRow);
|
||
|
||
}
|
||
empBasic.TableName = "PayrollDataSet_PayslipBasicInfo";
|
||
resultDataSet.Tables.Add(empBasic);
|
||
|
||
dTable1.TableName = "PayrollDataSet_IncomeTax";
|
||
resultDataSet.Tables.Add(dTable1);
|
||
|
||
dTChallan1.TableName = "PayrollDataSet_TaxChallan1";
|
||
resultDataSet.Tables.Add(dTChallan1);
|
||
|
||
|
||
//rParam = new ReportParameter("TaxPeriod", TaxPeriod);
|
||
//reportParameters.Add(rParam);
|
||
//rParam = new ReportParameter("signature", signaturePath);
|
||
//reportParameters.Add(rParam);
|
||
|
||
//if (reportParameters != null)
|
||
// localReport.SetParameters(reportParameters);
|
||
//Warning[] warnings;
|
||
//string[] streamids;
|
||
//string mimeType;
|
||
//string encoding;
|
||
//string filenameExtension;
|
||
//bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
|
||
// out streamids, out warnings);
|
||
|
||
//dt.TableName = "PayrollDataSet_AnnualIncomeCertificate";
|
||
//resultDataSet.Tables.Add(dt);
|
||
//string rdlcName = "HRM.Report.RDLC.AnnualIncomeCertificate.rdlc";
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowIncomeCertificate(null, resultDataSet, TaxPeriod, payrollType, taxParamId, reportType, assessmentYear, fiscalYear, taxParameter);
|
||
//return reportProcessor.CommonReportView(null, rdlcName, resultDataSet, null, reportParameters, true, payrollType, reportType);
|
||
}
|
||
//public byte[] ShowTaxCertificate(string empIds, int taxParamId, int payrollType, int currentTaxParamId, string reportType)
|
||
//{
|
||
// byte[] bytes = null;
|
||
// IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
|
||
// TaxParameter taxParameter = new TaxParameterService().Get(taxParamId);
|
||
// string assessmentYear = taxParameter.AssessmentYear.ToString();
|
||
// string fiscalYear = taxParameter.FiscalYear.ToString();
|
||
// string sEmpNo = empIds;
|
||
|
||
// string TaxPeriod = "";
|
||
// //DataSet oDset = null;
|
||
// DataSet resultDataSet = new DataSet();
|
||
// DataRow oDRow = null;
|
||
// LocalReport localReport = new LocalReport();
|
||
// int nIndex;
|
||
// int nCount = 1;
|
||
// double GrandTotal;
|
||
// List<IncomeTax> oIncomeTaxs = null;
|
||
// IncomeTax oIncomeTax = new IncomeTax();
|
||
// List<Employee> employeeList = null;
|
||
// List<TaxChallan> taxChallans = new List<TaxChallan>();
|
||
|
||
// employeeList = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollType);
|
||
// taxChallans = new TaxChallanService().GetByTaxParamId(taxParamId);
|
||
// double nAmount = 0;
|
||
// double nTempAmount = 0;
|
||
// double performanceBonus = 0;
|
||
// double salesIncentive = 0;
|
||
// double otherAllowances = 0;
|
||
// double gratuityAmount = 0;
|
||
// double leaveAmount = 0;
|
||
|
||
// PayrollDataSet.PayrollDataSet.AnnualIncomeCertificateDataTable dt = new PayrollDataSet.PayrollDataSet.AnnualIncomeCertificateDataTable();
|
||
|
||
// foreach (Employee oEmp in employeeList)
|
||
// {
|
||
// if (oEmp.JoiningDate >= taxParameter.FiscalyearDatefrom)
|
||
// {
|
||
// TaxPeriod = "from " + oEmp.JoiningDate.ToString("MMMM dd, yyyy") + " to " + taxParameter.FiscalyearDateTo.ToString("MMMM dd, yyyy");
|
||
// }
|
||
// else
|
||
// {
|
||
// TaxPeriod = "from " + taxParameter.FiscalyearDatefrom.ToString("MMMM dd, yyyy") + " to " + taxParameter.FiscalyearDateTo.ToString("MMMM dd, yyyy");
|
||
// }
|
||
// GrandTotal = 0.0;
|
||
// oDRow = dt.NewRow();
|
||
// if (currentTaxParamId == taxParamId)
|
||
// {
|
||
// oIncomeTaxs = incomeTaxService.Get(incomeTaxService.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, taxParamId);
|
||
// }
|
||
// else
|
||
// {
|
||
// oIncomeTaxs = incomeTaxService.Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, taxParamId);
|
||
// }
|
||
// if (oIncomeTaxs == null) continue;
|
||
|
||
// if (oEmp.Status == EnumEmployeeStatus.Discontinued)
|
||
// {
|
||
// taxChallans = taxChallans.FindAll(x =>
|
||
// x.SalaryMonthly >= oEmp.JoiningDate && x.SalaryMonthly <= oEmp.DiscontinueDate);
|
||
// }
|
||
// else
|
||
// {
|
||
// taxChallans = taxChallans.FindAll(x => x.SalaryMonthly >= oEmp.JoiningDate);
|
||
// }
|
||
// nTempAmount = 0;
|
||
// nAmount = 0;
|
||
// GrandTotal = 0;
|
||
// performanceBonus = 0;
|
||
// salesIncentive = 0;
|
||
// otherAllowances = 0;
|
||
// gratuityAmount = 0;
|
||
// leaveAmount = 0;
|
||
// if (oIncomeTax != null)
|
||
// {
|
||
// // nIndex = incomeTaxService.GetIndex(oEmp.ID);
|
||
// nIndex = oIncomeTaxs.FindIndex(x => x.EmployeeID == oEmp.ID);
|
||
// var taxDeduction =
|
||
// oIncomeTaxs.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
|
||
// oDRow["EmployeeID"] = oEmp.EmployeeNo;
|
||
// oDRow["Assesse"] = oEmp.Name;
|
||
// oDRow["Designation"] = oEmp.Designation.Name;
|
||
// oDRow["AssessmentYear"] = assessmentYear;
|
||
// oDRow["IncomeYear"] = fiscalYear;
|
||
// oDRow["TaxDeduction"] = GlobalFunctions.TakaFormat(taxDeduction == null ? 0 : taxDeduction.TotalAmount);
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Basic_Salary, (int)EnumIncomeTaxItemGroup.Basic_Salary).TotalAmount : 0.0);//Total Amount of Salary Basic+Bonus, col 5
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["BasicSalary"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.House_Rent_Allowance, (int)EnumIncomeTaxItemGroup.House_Rent_Allowance).TotalAmount : 0.0);//Periodical Cash Allowance, col 6
|
||
// nTempAmount = nTempAmount + nAmount;
|
||
// oDRow["HouseRentAllowance"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nTempAmount = 0;
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Medical_Allowance, (int)EnumIncomeTaxItemGroup.Medical_Allowance).TotalAmount : 0);
|
||
// oDRow["MedicalAllowance"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nTempAmount = 0;
|
||
// nAmount = 0;
|
||
// IncomeTax oITax = incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Conveyance_Allowance, (int)EnumIncomeTaxItemGroup.Conveyance_Allowance);
|
||
// if (oITax != null)
|
||
// {
|
||
// nAmount = oITax.TotalAmount;
|
||
// oDRow["TransportAllowance"] = GlobalFunctions.TakaFormat(oITax.TotalAmount);
|
||
// }
|
||
// else
|
||
// {
|
||
// oDRow["TransportAllowance"] = 0.0;
|
||
// }
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.GetAmount(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance) != null ? incomeTaxService.GetAmount(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.LFA_Allowance) : 0.0);
|
||
// oDRow["FeeOrFreeOrConcessionalPassagesLFA"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 5) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 5).TotalAmount : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["MobileInternetAllowance"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// /*nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, -213) != null
|
||
// ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, -213).TotalAmount
|
||
// : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// performanceBonus = performanceBonus + nAmount;
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 4) != null
|
||
// ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 4).TotalAmount
|
||
// : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// performanceBonus = performanceBonus + nAmount;*/
|
||
|
||
// oDRow["PerformanceBonus"] = GlobalFunctions.TakaFormat(performanceBonus);
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, (int)EnumIncomeTaxItemGroup.Bonus) != null
|
||
// ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, (int)EnumIncomeTaxItemGroup.Bonus).TotalAmount
|
||
// : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["FestivalBonus"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// /*nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 3) != null
|
||
// ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 3).TotalAmount
|
||
// : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// salesIncentive = salesIncentive + nAmount;
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 8) != null
|
||
// ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 8).TotalAmount
|
||
// : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// salesIncentive = salesIncentive + nAmount;*/
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 6) != null
|
||
// ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 6).TotalAmount
|
||
// : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// salesIncentive = salesIncentive + nAmount;
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 24) != null
|
||
// ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 24).TotalAmount
|
||
// : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// salesIncentive = salesIncentive + nAmount;
|
||
|
||
// oDRow["SalesIncentive"] = GlobalFunctions.TakaFormat(salesIncentive);
|
||
|
||
// if (!(Convert.ToDouble(oDRow["SalesIncentive"]) > 0))
|
||
// {
|
||
// taxChallans.RemoveAll(x => x.ChallanNo == "T-97" || x.ChallanNo == "T-602"
|
||
// || x.ChallanNo == "T-270" ||
|
||
// x.ChallanNo == "T-98");
|
||
// }
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 15) != null
|
||
// ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Bonus, 15).TotalAmount
|
||
// : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["MaternityBenefits"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Cash_Benefits, (int)EnumIncomeTaxItemGroup.Other_Cash_Benefits) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Cash_Benefits, (int)EnumIncomeTaxItemGroup.Other_Cash_Benefits).TotalAmount : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["EarnedLeaveEncashment"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF, (int)EnumIncomeTaxItemGroup.Company_Contri_PF).TotalAmount : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// oDRow["ProvidentFund"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 11) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 11).TotalAmount : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// otherAllowances = otherAllowances + nAmount;
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 8) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 8).TotalAmount : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// otherAllowances = otherAllowances + nAmount;
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 12) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 12).TotalAmount : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// otherAllowances = otherAllowances + nAmount;
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 13) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 13).TotalAmount : 0.0);
|
||
// GrandTotal = GrandTotal + nAmount;
|
||
// otherAllowances = otherAllowances + nAmount;
|
||
|
||
// oDRow["OtherAllowances"] = GlobalFunctions.TakaFormat(otherAllowances);
|
||
|
||
// nAmount = GlobalFunctions.Round(incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 45) != null ? incomeTaxService.Get(oIncomeTaxs, oEmp.ID, EnumIncomeTaxItemGroup.Other_Allowance, 45).TotalAmount : 0.0);
|
||
|
||
// oDRow["TAReimbursement"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// FSTranDetail fsTranDetail = new FSTranDetailService().GetGratuity(oEmp.ID);
|
||
// gratuityAmount = fsTranDetail == null ? 0 : fsTranDetail.ChangedValue;
|
||
// oDRow["GratuityAmount"] = GlobalFunctions.TakaFormat(gratuityAmount);
|
||
|
||
// nAmount = 0.0;
|
||
// oDRow["OtherBenefitsAwards"] = GlobalFunctions.TakaFormat(nAmount);
|
||
|
||
// FSTranDetail fsTranDetail2 = new FSTranDetailService().GetFinalSettlement(oEmp.ID);
|
||
// leaveAmount = fsTranDetail2 == null ? 0 : fsTranDetail2.ChangedValue;
|
||
// oDRow["FinalSettlement"] = GlobalFunctions.TakaFormat(leaveAmount);
|
||
|
||
// oDRow["TotalIncome"] = Convert.ToDouble(oDRow["BasicSalary"]) +
|
||
// Convert.ToDouble(oDRow["HouseRentAllowance"]) +
|
||
// Convert.ToDouble(oDRow["MedicalAllowance"]) +
|
||
// Convert.ToDouble(oDRow["TransportAllowance"]) +
|
||
// Convert.ToDouble(oDRow["FeeOrFreeOrConcessionalPassagesLFA"]) +
|
||
// Convert.ToDouble(oDRow["MobileInternetAllowance"]) +
|
||
// Convert.ToDouble(oDRow["FestivalBonus"]) +
|
||
// Convert.ToDouble(oDRow["PerformanceBonus"]) +
|
||
// Convert.ToDouble(oDRow["SalesIncentive"]) +
|
||
// Convert.ToDouble(oDRow["MaternityBenefits"]) +
|
||
// Convert.ToDouble(oDRow["EarnedLeaveEncashment"]) +
|
||
// Convert.ToDouble(oDRow["ProvidentFund"]) +
|
||
// Convert.ToDouble(oDRow["TAReimbursement"]) +
|
||
// Convert.ToDouble(oDRow["OtherAllowances"]) +
|
||
// Convert.ToDouble(oDRow["GratuityAmount"]) +
|
||
// Convert.ToDouble(oDRow["OtherBenefitsAwards"]) +
|
||
// Convert.ToDouble(oDRow["FinalSettlement"]);
|
||
// var str = string.Join(",", taxChallans.Select(x => x.ChallanNo));
|
||
// var deduction = taxDeduction == null ? 0 : taxDeduction.TotalAmount;
|
||
// if (deduction == 0)
|
||
// {
|
||
// oDRow["TaxChallan"] = "";
|
||
// }
|
||
// else
|
||
// {
|
||
// oDRow["TaxChallan"] = str;
|
||
// }
|
||
|
||
// dt.Rows.Add(oDRow);
|
||
// }
|
||
// }
|
||
|
||
// //rParam = new ReportParameter("TaxPeriod", TaxPeriod);
|
||
// //reportParameters.Add(rParam);
|
||
// //rParam = new ReportParameter("signature", signaturePath);
|
||
// //reportParameters.Add(rParam);
|
||
|
||
// //if (reportParameters != null)
|
||
// // localReport.SetParameters(reportParameters);
|
||
// //Warning[] warnings;
|
||
// //string[] streamids;
|
||
// //string mimeType;
|
||
// //string encoding;
|
||
// //string filenameExtension;
|
||
// //bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
|
||
// // out streamids, out warnings);
|
||
|
||
// //dt.TableName = "PayrollDataSet_AnnualIncomeCertificate";
|
||
// //resultDataSet.Tables.Add(dt);
|
||
// //string rdlcName = "HRM.Report.RDLC.AnnualIncomeCertificate.rdlc";
|
||
|
||
// ReportProcessor reportProcessor = new ReportProcessor();
|
||
// return reportProcessor.ShowDlgForAnnualIncomeCertificate(null, dt, TaxPeriod, payrollType, reportType);
|
||
// //return reportProcessor.CommonReportView(null, rdlcName, resultDataSet, null, reportParameters, true, payrollType, reportType);
|
||
//}
|
||
public byte[] ShowMultipleTaxCard(string sEmpIDs, bool ITStatus, int nTaxParamID, int systemTaxParamID, DateTime nextPayProcessDate, int payrollTypeID, string reportType)
|
||
{
|
||
ReportProcessor form = new ReportProcessor();
|
||
string RDLCName = null;
|
||
|
||
//DataSet orootDataset = this.PrepareDatasetMultipleEmployeeTaxCard(sEmpIDs, ITStatus, nTaxParamID, systemTaxParamID, nextPayProcessDate, payrollTypeID);
|
||
|
||
_taxParameter = new TaxParameterService().GetTaxParameterWithSignature(nTaxParamID);
|
||
|
||
|
||
//string[] sEmp = sEmpID.Split(',');
|
||
//int TotalEmp = sEmp.Length;
|
||
|
||
//List<Employee> oEmps = new EmployeeService().GetByEmpIDs(sEmpIDs, payrollTypeID);
|
||
//foreach (Employee oEmp in oEmps)
|
||
//{
|
||
|
||
// if (nTaxParamID == systemTaxParamID)
|
||
// {
|
||
// oincometaxes = new IncomeTaxService().Get(GetEnumForSalaryIT(oEmp.ID, nextPayProcessDate), oEmp.ID, nTaxParamID);
|
||
// }
|
||
// else
|
||
// {
|
||
// oincometaxes = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, nTaxParamID);
|
||
// ITStatus = false;
|
||
// }
|
||
//}
|
||
|
||
DataSet ds = new DataSet();
|
||
List<Employee> oEMployees = new EmployeeService().GetEmpsWithDiscontinue(sEmpIDs, payrollTypeID);
|
||
PayrollDataSet.PayrollDataSet.EmployeeDataTable dEmpTable = new PayrollDataSet.PayrollDataSet.EmployeeDataTable();
|
||
DataRow dr = null;
|
||
|
||
foreach (Employee oEmp in oEMployees)
|
||
{
|
||
|
||
dr = dEmpTable.NewRow();
|
||
|
||
dr["EmployeeID"] = oEmp.ID.ToString();
|
||
dr["EmployeeNo"] = oEmp.EmployeeNo.ToString();
|
||
dr["EmployeeName"] = oEmp.Name;
|
||
dr["TINNo"] = oEmp.TinNo;
|
||
dr["Designation"] = oEmp.Designation.Name;
|
||
dr["Location"] = oEmp.Location.Name;
|
||
dr["Department"] = oEmp.Department.Name;
|
||
|
||
string m = Enum.GetName(typeof(EnumGender), (int)oEmp.Gender);
|
||
dr["Gender"] = m.ToString();
|
||
|
||
dEmpTable.Rows.Add(dr);
|
||
}
|
||
dEmpTable.TableName = "PayrollDataSet_Employee";
|
||
ds.Tables.Add(dEmpTable);
|
||
//dEmpTable.TableName = "PayrollDataSet_BanglaPaySlipNew";
|
||
//ds.Tables.Add(dEmpTable);
|
||
|
||
DataSet dsSub = new DataSet();
|
||
dsSub = this.PrepareDatasetMultipleEmployeeTaxCard(sEmpIDs, oEMployees, ITStatus, nTaxParamID, systemTaxParamID, nextPayProcessDate, payrollTypeID);
|
||
//dsSub = this.PrepareDatasetMultipleEmployeeTaxCard(sEmpIDs, ITStatus, nTaxParamID, systemTaxParamID, nextPayProcessDate, payrollTypeID);
|
||
//dTable.TableName = "PayrollDataSet_BanglaPaySlipNewProdBonus";
|
||
//dsSub.Tables.Add(dTable);
|
||
//dTChallan.TableName = "dsBonusDataSet_BanglaPSlipBonus";
|
||
//dsSub.Tables.Add(dTChallan);
|
||
if (_isPrvs == false)
|
||
{
|
||
RDLCName = "NewTaxCard.rdlc";
|
||
}
|
||
else
|
||
{
|
||
if (_taxParameter.FiscalyearDatefrom < new DateTime(2022, 7, 1))
|
||
{
|
||
RDLCName = "PrevTaxCard.rdlc";
|
||
}
|
||
else
|
||
{
|
||
RDLCName = "PrevTaxCardNew.rdlc";
|
||
}
|
||
}
|
||
bool otherInvestment = false;
|
||
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
|
||
List<ReportParameter> _parameters = new List<ReportParameter>();
|
||
ReportParameter parameter = new ReportParameter("AssesmentYear", _taxParameter.AssessmentYear);
|
||
_parameters.Add(parameter);
|
||
|
||
parameter = new ReportParameter("FiscalYear", _taxParameter.FiscalYear);
|
||
_parameters.Add(parameter);
|
||
|
||
parameter = new ReportParameter("OtherInvestment", otherInvestment.ToString());
|
||
_parameters.Add(parameter);
|
||
|
||
return form.CommonReportViewForReportsWithSignature(null, ds, dsSub, RDLCName, _parameters, true, payrollTypeID, reportType, _taxParameter);
|
||
}
|
||
public DataSet PrepareDatasetMultipleEmployeeTaxCard(string sEmpIDs, List<Employee> oEMployees, bool ITStatus, int nTaxParamID, int systemTaxParamID, DateTime nextPayProcessDate, int payrollTypeID)
|
||
{
|
||
DataSet _dTaxtables = new DataSet();
|
||
//_TaxParameterID = nTaxParamID;
|
||
string sSalaryEmp = string.Empty;
|
||
string sProcessTempEmp = string.Empty;
|
||
|
||
//List<Employee> oEMployees = new EmployeeService().GetEmpsWithDiscontinue(sEmpIDs, payrollTypeID);
|
||
List<IncomeTax> oTaxes = new List<IncomeTax>();
|
||
List<IncomeTax> oSalaryTaxes = new List<IncomeTax>();
|
||
List<IncomeTax> oTempTaxes = new List<IncomeTax>();
|
||
PayrollDataSet.PayrollDataSet.TaxRebeatInvestmentDataTable dTable = new PayrollDataSet.PayrollDataSet.TaxRebeatInvestmentDataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallanDataTable dTChallan = new PayrollDataSet.PayrollDataSet.TaxChallanDataTable();
|
||
DataRow dChallan = null;
|
||
DataRow dr = null;
|
||
|
||
_taxParameter = new TaxParameterService().GetTaxParameterWithSignature(nTaxParamID);
|
||
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
|
||
if (nTaxParamID == systemTaxParamID)
|
||
{
|
||
foreach (Employee oem in oEMployees)
|
||
{
|
||
EnumIncomeTaxDataFrom oEnum = incomeTaxService.GetEnumForSalaryIT(oem.ID);
|
||
|
||
if (oEnum == EnumIncomeTaxDataFrom.SalaryITTempData)
|
||
{
|
||
if (sSalaryEmp == string.Empty)
|
||
{
|
||
sSalaryEmp = oem.ID.ToString();
|
||
}
|
||
else
|
||
{
|
||
sSalaryEmp = sSalaryEmp + "," + oem.ID.ToString();
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (sProcessTempEmp == string.Empty)
|
||
{
|
||
sProcessTempEmp = oem.ID.ToString();
|
||
}
|
||
else
|
||
{
|
||
sProcessTempEmp = sProcessTempEmp + "," + oem.ID.ToString();
|
||
}
|
||
}
|
||
}
|
||
|
||
//bool bSalaryProcessed = SalaryMonthly.IsSalaryProcessed(Payroll.BO.SystemInformation.CurrentSysInfo.NextPayProcessDate);
|
||
|
||
if (sSalaryEmp != string.Empty)
|
||
{
|
||
oSalaryTaxes = incomeTaxService.Get(EnumIncomeTaxDataFrom.SalaryITTempData, sSalaryEmp, nTaxParamID);
|
||
}
|
||
|
||
if (sProcessTempEmp != string.Empty)
|
||
{
|
||
oTempTaxes = incomeTaxService.Get(EnumIncomeTaxDataFrom.ProcessTempData, sProcessTempEmp, nTaxParamID);
|
||
}
|
||
|
||
if (oSalaryTaxes.Count > 0)
|
||
{
|
||
if (oTempTaxes.Count > 0)
|
||
{
|
||
oTaxes = oSalaryTaxes.Concat(oTempTaxes).ToList();
|
||
}
|
||
else
|
||
{
|
||
oTaxes = oSalaryTaxes;
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (oTempTaxes.Count > 0)
|
||
{
|
||
oTaxes = oTempTaxes;
|
||
}
|
||
}
|
||
|
||
foreach (Employee oEmp in oEMployees)
|
||
{
|
||
_employee = oEmp;
|
||
|
||
_incometaxes = oTaxes.Where(x => x.EmployeeID == _employee.ID).ToList();
|
||
|
||
if (_incometaxes.Count == 0)
|
||
{
|
||
continue;
|
||
}
|
||
|
||
_dSet = PrepareDatasetMultipleTaxCard(oEmp, payrollTypeID);
|
||
|
||
if (_dSet.Tables.Count > 0)
|
||
{
|
||
_dTaxtables.Merge(_dSet);
|
||
}
|
||
|
||
IncomeTax pf = incomeTaxService.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Company_Contri_PF,
|
||
(int)EnumIncomeTaxItemGroup.Company_Contri_PF);
|
||
double PFInvestment = 0.0;
|
||
if (pf != null)
|
||
PFInvestment = pf.TotalAmount;
|
||
|
||
|
||
dr = dTable.NewRow();
|
||
dr["TaxPercent"] = _taxParameter.MaxInvestPercent;
|
||
dr["TaxableIncome"] = _20Investment;
|
||
dr["MaxInvestment"] = _taxParameter.MaxInvAmount;
|
||
dr["PFInvestment"] = PFInvestment;
|
||
dr["EmpID"] = _employee.ID.ToString();
|
||
dTable.Rows.Add(dr);
|
||
|
||
|
||
dChallan = dTChallan.NewRow();
|
||
List<TaxChallan> oTaxChallanIndEmp = new List<TaxChallan>();
|
||
//oTaxChallanIndEmp = oTaxChallans.Where(x => x.EmployeeID == oEmp.ID).ToList();
|
||
oTaxChallanIndEmp = new TaxChallanService().Get(oEmp.ID, nTaxParamID);
|
||
int count = 1;
|
||
string sChallanNo = "";
|
||
|
||
if (oTaxChallanIndEmp != null && oTaxChallanIndEmp.Count > 0)
|
||
{
|
||
sChallanNo = "Challan No. : ";
|
||
|
||
foreach (TaxChallan oItem in oTaxChallanIndEmp)
|
||
{
|
||
if (count == oTaxChallanIndEmp.Count)
|
||
{
|
||
sChallanNo += oItem.ChallanNo + "/" + oItem.DepositDate.ToString("ddMMMyy") + ", ";
|
||
}
|
||
else
|
||
{
|
||
sChallanNo += oItem.ChallanNo + "/" + oItem.DepositDate.ToString("ddMMMyy") + ", ";
|
||
count++;
|
||
}
|
||
}
|
||
}
|
||
|
||
dChallan["ChallanNo"] = sChallanNo;
|
||
|
||
double _taxInvestment = _actualInvestment;
|
||
dChallan["TaxInvestment"] = _taxInvestment;
|
||
|
||
dChallan["EmpID"] = oEmp.ID.ToString();
|
||
dTChallan.Rows.Add(dChallan);
|
||
}
|
||
dTChallan.TableName = "PayrollDataSet_TaxChallan";
|
||
_dTaxtables.Tables.Add(dTChallan);
|
||
dTable.TableName = "PayrollDataSet_TaxRebeatInvestment";
|
||
_dTaxtables.Tables.Add(dTable);
|
||
|
||
|
||
}
|
||
else
|
||
{
|
||
List<TaxChallan> oTaxChallanIndEmp = new List<TaxChallan>();
|
||
List<TaxChallan> oTaxChallans = new List<TaxChallan>();
|
||
|
||
oTaxes = incomeTaxService.Get(EnumIncomeTaxDataFrom.ProcessedData, sEmpIDs, nTaxParamID);
|
||
oTaxChallans = new TaxChallanService().Get(sEmpIDs, nTaxParamID);
|
||
|
||
_isPrvs = true;
|
||
|
||
foreach (Employee oEmp in oEMployees)
|
||
{
|
||
|
||
_incometaxes = oTaxes.Where(x => x.EmployeeID == oEmp.ID).ToList();
|
||
_dSet = PrepareDatasetMultipleTaxCard(oEmp, payrollTypeID);
|
||
|
||
if (_dSet.Tables.Count > 0)
|
||
{
|
||
_dTaxtables.Merge(_dSet);
|
||
}
|
||
|
||
IncomeTax pf = incomeTaxService.Get(_incometaxes, oEmp.ID, EnumIncomeTaxItemGroup.Company_Contri_PF,
|
||
(int)EnumIncomeTaxItemGroup.Company_Contri_PF);
|
||
double PFInvestment = 0.0;
|
||
if (pf != null)
|
||
PFInvestment = pf.TotalAmount;
|
||
|
||
dr = dTable.NewRow();
|
||
dr["TaxPercent"] = _taxParameter.MaxInvestPercent;
|
||
dr["TaxableIncome"] = _20Investment;
|
||
dr["MaxInvestment"] = _taxParameter.MaxInvAmount;
|
||
dr["PFInvestment"] = PFInvestment;
|
||
dr["EmpID"] = oEmp.ID.ToString();
|
||
dTable.Rows.Add(dr);
|
||
|
||
dChallan = dTChallan.NewRow();
|
||
|
||
//oTaxChallanIndEmp = oTaxChallans.Where(x => x.EmployeeID == oEmp.ID).ToList();
|
||
oTaxChallanIndEmp = new TaxChallanService().Get(oEmp.ID, nTaxParamID);
|
||
int count = 1;
|
||
string sChallanNo = "This is a computer-generated document. No signature is required.";// \nCertified that the above-mentioned amount of tax has already been deposited based on the employer’s confirmation of investment amount in allowed instruments.
|
||
|
||
if (oTaxChallanIndEmp != null && oTaxChallanIndEmp.Count > 0)
|
||
{
|
||
sChallanNo = "Challan No. : ";
|
||
|
||
foreach (TaxChallan oItem in oTaxChallanIndEmp)
|
||
{
|
||
if (count == oTaxChallanIndEmp.Count)
|
||
{
|
||
sChallanNo += oItem.ChallanNo + "/" + oItem.DepositDate.ToString("ddMMMyy") + ", ";
|
||
}
|
||
else
|
||
{
|
||
sChallanNo += oItem.ChallanNo + "/" + oItem.DepositDate.ToString("ddMMMyy") + ", ";
|
||
count++;
|
||
}
|
||
}
|
||
}
|
||
|
||
dChallan["ChallanNo"] = sChallanNo;
|
||
|
||
double _taxInvestment = _actualInvestment;
|
||
dChallan["TaxInvestment"] = _taxInvestment;
|
||
|
||
dChallan["EmpID"] = oEmp.ID.ToString();
|
||
dTChallan.Rows.Add(dChallan);
|
||
}
|
||
|
||
dTChallan.TableName = "PayrollDataSet_TaxChallan";
|
||
_dTaxtables.Tables.Add(dTChallan);
|
||
dTable.TableName = "PayrollDataSet_TaxRebeatInvestment";
|
||
_dTaxtables.Tables.Add(dTable);
|
||
|
||
//dEmpTable.TableName = "PayrollDataSet_Employee";
|
||
//_dTaxtables.Tables.Add(dEmpTable);
|
||
}
|
||
|
||
//if (_dTaxtables.Tables.Count > 0)
|
||
//{
|
||
// form.ShowMultipleEmployeeTaxCard(_taxParameter, _item, _dTaxtables, _taxParameter.AssessmentYear, _taxParameter.FiscalYear, _isPrvs);
|
||
//}
|
||
return _dTaxtables;
|
||
}
|
||
|
||
|
||
public byte[] ShowMonthlyMultipleTaxCard(string sEmpIDs, bool ITStatus, int nTaxParamID, int systemTaxParamID, DateTime month, int payrollTypeID, string reportType)
|
||
{
|
||
ReportProcessor form = new ReportProcessor();
|
||
string RDLCName = null;
|
||
|
||
//DataSet orootDataset = this.PrepareDatasetMultipleEmployeeTaxCard(sEmpIDs, ITStatus, nTaxParamID, systemTaxParamID, nextPayProcessDate, payrollTypeID);
|
||
|
||
var taxParams = new TaxParameterService().GetbyPayrolltype(payrollTypeID);
|
||
if (taxParams == null || taxParams.Count == 0)
|
||
{
|
||
throw new Exception("No tax parameter found for the payroll type.");
|
||
}
|
||
|
||
_taxParameter = taxParams.FirstOrDefault(tp =>
|
||
month >= tp.FiscalyearDatefrom &&
|
||
month <= tp.FiscalyearDateTo);
|
||
|
||
if (_taxParameter == null)
|
||
{
|
||
throw new Exception("No tax setup found for the given month and payroll .");
|
||
}
|
||
nTaxParamID = _taxParameter.ID;
|
||
|
||
//string[] sEmp = sEmpID.Split(',');
|
||
//int TotalEmp = sEmp.Length;
|
||
|
||
//List<Employee> oEmps = new EmployeeService().GetByEmpIDs(sEmpIDs, payrollTypeID);
|
||
//foreach (Employee oEmp in oEmps)
|
||
//{
|
||
|
||
// if (nTaxParamID == systemTaxParamID)
|
||
// {
|
||
// oincometaxes = new IncomeTaxService().Get(GetEnumForSalaryIT(oEmp.ID, nextPayProcessDate), oEmp.ID, nTaxParamID);
|
||
// }
|
||
// else
|
||
// {
|
||
// oincometaxes = new IncomeTaxService().Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, nTaxParamID);
|
||
// ITStatus = false;
|
||
// }
|
||
//}
|
||
|
||
DataSet ds = new DataSet();
|
||
List<Employee> oEMployees = new EmployeeService().GetEmpsWithDiscontinue(sEmpIDs, payrollTypeID);
|
||
PayrollDataSet.PayrollDataSet.EmployeeDataTable dEmpTable = new PayrollDataSet.PayrollDataSet.EmployeeDataTable();
|
||
DataRow dr = null;
|
||
|
||
foreach (Employee oEmp in oEMployees)
|
||
{
|
||
|
||
dr = dEmpTable.NewRow();
|
||
|
||
dr["EmployeeID"] = oEmp.ID.ToString();
|
||
dr["EmployeeNo"] = oEmp.EmployeeNo.ToString();
|
||
dr["EmployeeName"] = oEmp.Name;
|
||
dr["TINNo"] = oEmp.TinNo;
|
||
dr["Designation"] = oEmp.Designation.Name;
|
||
dr["Location"] = oEmp.Location.Name;
|
||
dr["Department"] = oEmp.Department.Name;
|
||
|
||
string m = Enum.GetName(typeof(EnumGender), (int)oEmp.Gender);
|
||
dr["Gender"] = m.ToString();
|
||
|
||
dEmpTable.Rows.Add(dr);
|
||
}
|
||
dEmpTable.TableName = "PayrollDataSet_Employee";
|
||
ds.Tables.Add(dEmpTable);
|
||
//dEmpTable.TableName = "PayrollDataSet_BanglaPaySlipNew";
|
||
//ds.Tables.Add(dEmpTable);
|
||
|
||
DataSet dsSub = new DataSet();
|
||
dsSub = this.PrepareDatasetMonthlyMultipleEmployeeTaxCard(sEmpIDs, oEMployees, ITStatus, nTaxParamID, systemTaxParamID, month, payrollTypeID);
|
||
//dsSub = this.PrepareDatasetMultipleEmployeeTaxCard(sEmpIDs, ITStatus, nTaxParamID, systemTaxParamID, nextPayProcessDate, payrollTypeID);
|
||
//dTable.TableName = "PayrollDataSet_BanglaPaySlipNewProdBonus";
|
||
//dsSub.Tables.Add(dTable);
|
||
//dTChallan.TableName = "dsBonusDataSet_BanglaPSlipBonus";
|
||
//dsSub.Tables.Add(dTChallan);
|
||
//if (_isPrvs == false)
|
||
//{
|
||
RDLCName = "NewTaxCardMonthly.rdlc";
|
||
//}
|
||
//else
|
||
//{
|
||
// if (_taxParameter.FiscalyearDatefrom < new DateTime(2022, 7, 1))
|
||
// {
|
||
// RDLCName = "PrevTaxCard.rdlc";
|
||
// }
|
||
// else
|
||
// {
|
||
// RDLCName = "PrevTaxCardNew.rdlc";
|
||
// }
|
||
//}
|
||
bool otherInvestment = false;
|
||
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
//if (companyName == "SGS Bangladesh Limited")
|
||
// otherInvestment = true;
|
||
|
||
List<ReportParameter> _parameters = new List<ReportParameter>();
|
||
ReportParameter parameter = new ReportParameter("AssesmentYear", _taxParameter.AssessmentYear);
|
||
_parameters.Add(parameter);
|
||
|
||
|
||
parameter = new ReportParameter("Month", GlobalFunctions.LastDateOfMonth(month).ToString("MMM yyyy"));
|
||
_parameters.Add(parameter);
|
||
|
||
parameter = new ReportParameter("FiscalYear", _taxParameter.FiscalYear);
|
||
_parameters.Add(parameter);
|
||
|
||
parameter = new ReportParameter("OtherInvestment", otherInvestment.ToString());
|
||
_parameters.Add(parameter);
|
||
|
||
return form.CommonReportViewForReports(null, ds, dsSub, RDLCName, _parameters, true, payrollTypeID, reportType);
|
||
}
|
||
public DataSet PrepareDatasetMonthlyMultipleEmployeeTaxCard(string sEmpIDs, List<Employee> oEMployees, bool ITStatus, int nTaxParamID, int systemTaxParamID, DateTime month, int payrollTypeID)
|
||
{
|
||
DataSet _dTaxtables = new DataSet();
|
||
//_TaxParameterID = nTaxParamID;
|
||
string sSalaryEmp = string.Empty;
|
||
string sProcessTempEmp = string.Empty;
|
||
|
||
//List<Employee> oEMployees = new EmployeeService().GetEmpsWithDiscontinue(sEmpIDs, payrollTypeID);
|
||
List<IncomeTax> oTaxes = new List<IncomeTax>();
|
||
List<IncomeTax> oSalaryTaxes = new List<IncomeTax>();
|
||
List<IncomeTax> oTempTaxes = new List<IncomeTax>();
|
||
PayrollDataSet.PayrollDataSet.TaxRebeatInvestmentDataTable dTable = new PayrollDataSet.PayrollDataSet.TaxRebeatInvestmentDataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallanDataTable dTChallan = new PayrollDataSet.PayrollDataSet.TaxChallanDataTable();
|
||
DataRow dChallan = null;
|
||
DataRow dr = null;
|
||
|
||
_taxParameter = new TaxParameterService().Get(nTaxParamID);
|
||
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
|
||
|
||
oTempTaxes = incomeTaxService.GetMonthlyData(month, sEmpIDs, nTaxParamID);
|
||
|
||
|
||
foreach (Employee oEmp in oEMployees)
|
||
{
|
||
_employee = oEmp;
|
||
|
||
_incometaxes = oTempTaxes.Where(x => x.EmployeeID == _employee.ID).ToList();
|
||
|
||
if (_incometaxes.Count == 0)
|
||
{
|
||
continue;
|
||
}
|
||
|
||
_dSet = PrepareDatasetMultipleTaxCard(oEmp, payrollTypeID);
|
||
|
||
if (_dSet.Tables.Count > 0)
|
||
{
|
||
_dTaxtables.Merge(_dSet);
|
||
}
|
||
|
||
IncomeTax pf = incomeTaxService.Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Company_Contri_PF,
|
||
(int)EnumIncomeTaxItemGroup.Company_Contri_PF);
|
||
double PFInvestment = 0.0;
|
||
if (pf != null)
|
||
PFInvestment = pf.TotalAmount;
|
||
|
||
|
||
dr = dTable.NewRow();
|
||
dr["TaxPercent"] = _taxParameter.MaxInvestPercent;
|
||
dr["TaxableIncome"] = _20Investment;
|
||
dr["MaxInvestment"] = _taxParameter.MaxInvAmount;
|
||
dr["PFInvestment"] = PFInvestment;
|
||
dr["EmpID"] = _employee.ID.ToString();
|
||
dTable.Rows.Add(dr);
|
||
|
||
|
||
dChallan = dTChallan.NewRow();
|
||
List<TaxChallan> oTaxChallanIndEmp = new List<TaxChallan>();
|
||
//oTaxChallanIndEmp = oTaxChallans.Where(x => x.EmployeeID == oEmp.ID).ToList();
|
||
oTaxChallanIndEmp = new TaxChallanService().Get(oEmp.ID, nTaxParamID);
|
||
int count = 1;
|
||
string sChallanNo = "";
|
||
|
||
if (oTaxChallanIndEmp != null && oTaxChallanIndEmp.Count > 0)
|
||
{
|
||
sChallanNo = "Challan No. : ";
|
||
|
||
foreach (TaxChallan oItem in oTaxChallanIndEmp)
|
||
{
|
||
if (count == oTaxChallanIndEmp.Count)
|
||
{
|
||
sChallanNo += oItem.ChallanNo + "/" + oItem.DepositDate.ToString("ddMMMyy") + ", ";
|
||
}
|
||
else
|
||
{
|
||
sChallanNo += oItem.ChallanNo + "/" + oItem.DepositDate.ToString("ddMMMyy") + ", ";
|
||
count++;
|
||
}
|
||
}
|
||
}
|
||
|
||
dChallan["ChallanNo"] = sChallanNo;
|
||
|
||
double _taxInvestment = _actualInvestment;
|
||
dChallan["TaxInvestment"] = _taxInvestment;
|
||
|
||
dChallan["EmpID"] = oEmp.ID.ToString();
|
||
dTChallan.Rows.Add(dChallan);
|
||
}
|
||
dTChallan.TableName = "PayrollDataSet_TaxChallan";
|
||
_dTaxtables.Tables.Add(dTChallan);
|
||
dTable.TableName = "PayrollDataSet_TaxRebeatInvestment";
|
||
_dTaxtables.Tables.Add(dTable);
|
||
|
||
|
||
|
||
|
||
//if (_dTaxtables.Tables.Count > 0)
|
||
//{
|
||
// form.ShowMultipleEmployeeTaxCard(_taxParameter, _item, _dTaxtables, _taxParameter.AssessmentYear, _taxParameter.FiscalYear, _isPrvs);
|
||
//}
|
||
return _dTaxtables;
|
||
}
|
||
|
||
|
||
private DataSet PrepareDatasetMultipleTaxCard(Employee _employee, int payrollTypeID)
|
||
{
|
||
|
||
DataSet orootDataset = new DataSet();
|
||
DataRow dr = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
|
||
|
||
var companyNameObj = new SystemConfigarationService().GetconfigValue(EnumConfigurationType.Logic, "system", "company");
|
||
string companyName = Convert.ToString(companyNameObj);
|
||
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable2 = new 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, _employee));
|
||
|
||
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 = new IncomeTaxService().Get(_incometaxes, _employee.ID,
|
||
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 = new IncomeTaxService().Get(_incometaxes, _employee.ID,
|
||
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 = new IncomeTaxService().Get(_incometaxes, _employee.ID,
|
||
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 = new IncomeTaxService().Get(_incometaxes, _employee.ID,
|
||
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 = new IncomeTaxService().Get(_incometaxes, _employee.ID,
|
||
EnumIncomeTaxItemGroup.WPPF_Examption, (int)EnumIncomeTaxItemGroup.WPPF_Examption);
|
||
if (taxAmount != null)
|
||
{
|
||
_TotalSalaryExempted += taxAmount.TotalAmount;
|
||
wppf["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount);
|
||
}
|
||
}
|
||
|
||
IncomeTax salaryIncome = new IncomeTaxService().Get(_incometaxes, _employee.ID,
|
||
EnumIncomeTaxItemGroup.Annual_Salary_Income, (int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
|
||
if (salaryIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARow(dr, salaryIncome, _employee));
|
||
|
||
TotalSalaryExepted = dr;
|
||
|
||
TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome || oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome)
|
||
{
|
||
|
||
if (oItem.ItemID != -305)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARow(dr, oItem, _employee));
|
||
}
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
IncomeTax totalAnnualExemption = new IncomeTaxService().Get(_incometaxes, _employee.ID,
|
||
EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
if (totalAnnualExemption != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
totalAnnualExemption.ProjectedAmount *= -1;
|
||
totalAnnualExemption.TotalAmount *= -1;
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualExemption, _employee));
|
||
}
|
||
IncomeTax totalAnnualIncome = new IncomeTaxService().Get(_incometaxes, _employee.ID,
|
||
EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualIncome, _employee));
|
||
TotalAnnualExepted = dr;
|
||
TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
dTable1.TableName = "PayrollDataSet_IncomeTax";
|
||
orootDataset.Tables.Add(dTable1);
|
||
// Crate Slab Data
|
||
double ngrossTax = 0;
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable dTable = new PayrollDataSet.PayrollDataSet.IncomeTaxSlabDataTable();
|
||
_InvestmentAmount = _taxParameter.MaxInvAmount;
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
PayrollType pType = new PayrollTypeService().Get(payrollTypeID);
|
||
List<TaxParameterSlab> empTaxSlabs = new TaxParameterService().CalculateTaxOnSlab(pType, _taxParameter, _employee, totalAnnualIncome.TotalAmount);
|
||
int index = 0;
|
||
dr = null;
|
||
foreach (TaxParameterSlab drr in empTaxSlabs)
|
||
{
|
||
dr = dTable.NewRow();
|
||
dr["CurrentRate"] = drr.TaxPercent.ToString() + "%";
|
||
dr["EmpID"] = _employee.ID.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 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 = new IncomeTaxService().Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Income,
|
||
(int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
if (investmentCapdo != null)
|
||
_20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100;
|
||
}
|
||
else
|
||
{
|
||
investmentCapdo = new IncomeTaxService().Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Annual_Salary_Income,
|
||
(int)EnumIncomeTaxItemGroup.Annual_Salary_Income);
|
||
if (investmentCapdo != null)
|
||
_20Investment = (investmentCapdo.TotalAmount * _taxParameter.MaxInvestPercent) / 100;
|
||
|
||
}
|
||
|
||
IncomeTax acinvestment = new IncomeTaxService().Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Actual,
|
||
(int)EnumIncomeTaxItemGroup.Investment_Actual);
|
||
if (acinvestment != null)
|
||
_actualInvestment = acinvestment.TotalAmount;
|
||
|
||
IncomeTax taxRebate = new IncomeTaxService().Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Investment_Allowed,
|
||
(int)EnumIncomeTaxItemGroup.Investment_Allowed);
|
||
|
||
if (taxRebate != null)
|
||
{
|
||
_investmentAllowed = taxRebate.TotalAmount;
|
||
string spf = "";
|
||
IncomeTax pf = new IncomeTaxService().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 = new IncomeTaxService().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["DataColumn1"] = taxRebate.Description;
|
||
oDRow["DataColumn2"] = spf;
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(taxRebate.TotalAmount);
|
||
oDRow["EmpID"] = _employee.ID.ToString();
|
||
// oDTable.Rows.Add(oDRow);
|
||
}
|
||
bool bAIT = false;
|
||
double dNetTax = 0;
|
||
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
|
||
if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment || oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate)
|
||
{
|
||
if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate)
|
||
{
|
||
oDRow["DataColumn1"] = oItem.Description;//"AIT WPPF";
|
||
bAIT = true;
|
||
}
|
||
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"] = "";
|
||
oDRow["EmpID"] = _employee.ID.ToString();
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
|
||
}
|
||
|
||
IncomeTax oNetTaxPayable = new IncomeTaxService().Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Net_Payable,
|
||
(int)EnumIncomeTaxItemGroup.Net_Payable);
|
||
|
||
IncomeTax oTaxDeducted = new IncomeTaxService().Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
(int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
|
||
|
||
if (oNetTaxPayable != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = oNetTaxPayable.Description;
|
||
oDRow["DataColumn2"] = "";
|
||
|
||
//if (bAIT == true && oNetTaxPayable.TotalAmount < 5000)//(oTaxDeducted.TotalAmount <= 6000) &&
|
||
//{
|
||
// //oDRow["DataColumn3"] = oNetTaxPayable.TotalAmount.ToString("#,##");
|
||
// oDRow["DataColumn3"] = Convert.ToDouble(5000).ToString("#,##");
|
||
// dNetTax = Convert.ToDouble(oDRow["DataColumn3"]);
|
||
//}
|
||
//else
|
||
//{
|
||
oDRow["DataColumn3"] = oNetTaxPayable.TotalAmount.ToString("#,##");
|
||
dNetTax = oNetTaxPayable.TotalAmount;
|
||
//}
|
||
|
||
oDRow["EmpID"] = _employee.ID.ToString();
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
|
||
// 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["DataColumn1"] = "Tax deducted from salary";
|
||
oDRow["DataColumn1"] = "Total Tax Paid to The Government";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = (oTaxDeducted.TotalAmount).ToString("#,##");
|
||
oDRow["EmpID"] = _employee.ID.ToString();
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
if (oTaxDeducted != null)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax paid up to previous month";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.PreviousAmount);
|
||
oDRow["EmpID"] = _employee.ID.ToString();
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax paid this month";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oTaxDeducted.ThisMonthAmount);
|
||
oDRow["EmpID"] = _employee.ID.ToString();
|
||
oDTable.Rows.Add(oDRow);
|
||
|
||
oDRow = oDTable.NewRow();
|
||
oDRow["DataColumn1"] = "Tax to be paid upto June";
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["EmpID"] = _employee.ID.ToString();
|
||
|
||
if (oNetTaxPayable != null)
|
||
{
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(dNetTax - oTaxDeducted.TotalAmount);
|
||
}
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
}
|
||
|
||
|
||
|
||
|
||
oDTable.TableName = "PayrollDataSet_IncomeTaxOther";
|
||
orootDataset.Tables.Add(oDTable);
|
||
|
||
|
||
return orootDataset;
|
||
}
|
||
private DataRow getARow(DataRow orow, IncomeTax oItem, Employee _employee)
|
||
{
|
||
double _salaryIncomeCertificateEarning = 0;
|
||
if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Annual_Salary_Income)
|
||
{
|
||
DataRow dr = orow;
|
||
dr["EmpID"] = oItem.EmployeeID;
|
||
dr["Name"] = _employee.Name;
|
||
dr["TinNo"] = _employee.TinNo;
|
||
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;
|
||
_salaryIncomeCertificateEarning = _salaryIncomeCertificateEarning + Math.Round(_AmountPerAnnum);
|
||
return dr;
|
||
}
|
||
else if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Annual_Income)
|
||
{
|
||
DataRow dr = orow;
|
||
dr["EmpID"] = oItem.EmployeeID;
|
||
dr["Name"] = _employee.Name;
|
||
dr["TinNo"] = _employee.TinNo;
|
||
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;
|
||
_salaryIncomeCertificateEarning = _salaryIncomeCertificateEarning + Math.Round(_TAmountPerAnnum);
|
||
return dr;
|
||
}
|
||
else
|
||
{
|
||
DataRow dr = orow;
|
||
dr["EmpID"] = oItem.EmployeeID;
|
||
dr["Name"] = _employee.Name;
|
||
dr["TinNo"] = _employee.TinNo;
|
||
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;
|
||
_salaryIncomeCertificateEarning = _salaryIncomeCertificateEarning + Math.Round(oItem.TotalAmount);
|
||
return dr;
|
||
}
|
||
}
|
||
public byte[] ShowITPfAndOtherDetails(string reportType, string sEmpID, int payrollTypeId, int taxParameterId)
|
||
{
|
||
List<TaxParameter> _TaxParameters = null;
|
||
_TaxParameters = new TaxParameterService().GetbyPayrolltype(payrollTypeId);
|
||
string[] sEmps = sEmpID.Split(',');
|
||
List<Employee> allEmps = new EmployeeService().Get();
|
||
List<EmployeeTaxInvestment> oEmpsITInvestment = new EmployeeTaxInvestmentService().GetAllUsersInfo(taxParameterId);
|
||
Dictionary<int, Employee> mapAllEmps = new Dictionary<int, Employee>();
|
||
Dictionary<int, EmployeeTaxInvestment> mapITInvestment = new Dictionary<int, EmployeeTaxInvestment>();
|
||
foreach (EmployeeTaxInvestment oEmpInvestment in oEmpsITInvestment)
|
||
{
|
||
mapITInvestment.Add(oEmpInvestment.EmployeeID, oEmpInvestment);
|
||
}
|
||
|
||
foreach (Employee emp in allEmps)
|
||
{
|
||
if (!mapAllEmps.ContainsKey(emp.ID))
|
||
{
|
||
mapAllEmps.Add(emp.ID, emp);
|
||
}
|
||
}
|
||
|
||
PayrollDataSet.PayrollDataSet.ITPfAndOtherDetailsDataTable dTPFAndInvestment = new PayrollDataSet.PayrollDataSet.ITPfAndOtherDetailsDataTable();
|
||
foreach (string oEmp in sEmps)
|
||
{
|
||
IncomeTaxService oIncomeTax = new IncomeTaxService();
|
||
DataRow dr = dTPFAndInvestment.NewRow();
|
||
int eid = Convert.ToInt32(oEmp);
|
||
//int eid = FromInteger(id);
|
||
List<IncomeTax> _IncomeTaxs = new IncomeTaxService().Get(oIncomeTax.GetEnumForSalaryIT(eid), eid, _TaxParameters[0].ID);
|
||
int count = 0;
|
||
dr["EmployeeNo"] = String.Empty;
|
||
dr["EmployeeName"] = String.Empty;
|
||
if (mapAllEmps.ContainsKey(Convert.ToInt32(oEmp)))
|
||
{
|
||
dr["EmployeeName"] = mapAllEmps[Convert.ToInt32(oEmp)].Name;
|
||
dr["EmployeeNo"] = mapAllEmps[Convert.ToInt32(oEmp)].EmployeeNo;
|
||
|
||
}
|
||
if (mapITInvestment.ContainsKey(Convert.ToInt32(oEmp)))
|
||
{
|
||
dr["CumulativeAmount"] = mapITInvestment[Convert.ToInt32(oEmp)].Amount;
|
||
}
|
||
else dr["CumulativeAmount"] = 0.0;
|
||
double total = 0.0, pfamount = 0.0;
|
||
foreach (IncomeTax tetax in _IncomeTaxs)
|
||
{
|
||
|
||
if (tetax.ItemID == -220)
|
||
{
|
||
total = tetax.PreviousAmount + tetax.ProjectedAmount + tetax.ThisMonthAmount;
|
||
count++;
|
||
}
|
||
if (tetax.ItemID == -207)
|
||
{
|
||
pfamount = (tetax.PreviousAmount + tetax.ProjectedAmount + tetax.ThisMonthAmount) * 2;
|
||
count++;
|
||
}
|
||
if (count == 2) break;
|
||
}
|
||
if (pfamount != 0.0)
|
||
{
|
||
dr["TotalPFAmount"] = pfamount;
|
||
}
|
||
else
|
||
{
|
||
}
|
||
if (total - pfamount != 0.0)
|
||
{
|
||
dr["InvestmentAllowed"] = total - pfamount;
|
||
}
|
||
else
|
||
{
|
||
}
|
||
if (pfamount == 0.0 && (total - pfamount) == 0.0) continue;
|
||
if (pfamount == 0.0)
|
||
{
|
||
dr["TotalPFAmount"] = 0.0;
|
||
}
|
||
if (total - pfamount == 0.0)
|
||
{
|
||
dr["InvestmentAllowed"] = 0.0;
|
||
}
|
||
dTPFAndInvestment.Rows.Add(dr);
|
||
|
||
}
|
||
DataSet ds = new DataSet();
|
||
dTPFAndInvestment.TableName = "PayrollDataSet_ITPfAndOtherDetails";
|
||
ds.Tables.Add(dTPFAndInvestment);
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
|
||
return reportProcessor.ShowShowAllPFandDetails(reportType, ds, payrollTypeId);
|
||
|
||
}
|
||
|
||
public object GenerateTaxperquisite(DateTime fromDate, DateTime toDate, double exemtedAmount, double percentage, string sEmpIDs, int payrollTypeId)
|
||
{
|
||
DateTime startDate, endDate;
|
||
startDate = endDate = DateTime.Now;
|
||
int nGroupID = 1;
|
||
startDate = fromDate.FirstDateOfMonth();
|
||
endDate = toDate.LastDateOfMonth();
|
||
MiscellaneousDatasetService miscellaneousDatasetService = new MiscellaneousDatasetService();
|
||
ArrearProcessService arrearProcessService = new ArrearProcessService();
|
||
DataRow oDR = null;
|
||
DataSet oPayrollPerquisite = null;
|
||
oEmployees = new EmployeeService().GetAllEmps();
|
||
oGrades = new GradeService().GetAll();
|
||
oDepartments = new DepartmentService().GetAll();
|
||
oDesignations = new DesignationService().GetAll();
|
||
oEmployeeCostCenters = new EmployeeCostCenterService().Get();
|
||
DataSet dsPerquisite = miscellaneousDatasetService.GetPerquisiteDataNew(startDate, endDate, sEmpIDs, payrollTypeId);
|
||
oArrearProcessDetails = arrearProcessService.GetArrearProcessDetailsNew(startDate, endDate, sEmpIDs, payrollTypeId);
|
||
PayrollDataSet.dsCompany.dtPerquisiteDataTable oDatatable = new PayrollDataSet.dsCompany.dtPerquisiteDataTable();
|
||
oDatatable.Columns.Add("ItemGroup", typeof(int));
|
||
oDatatable.Columns.Add("ItemID", typeof(int));
|
||
oDatatable.Columns.Add("ItemCode", typeof(string));
|
||
oDatatable.Columns.Add("HeadType", typeof(string));
|
||
oDatatable.Columns.Add("IsFestival", typeof(bool));
|
||
//HeadType 1 = EmpWiseSalary, 2 = EmpWiseBonus, 3 = EmpWisePF
|
||
if (dsPerquisite.Tables[0].Rows.Count > 0)
|
||
{
|
||
nIndex = 0;
|
||
foreach (DataRow oRow in dsPerquisite.Tables["EmpWiseSalary"].Rows)
|
||
{
|
||
oDR = oDatatable.NewRow();
|
||
CreateNewRowPerquisite(oDR, oRow, 1);
|
||
oDatatable.Rows.Add(oDR);
|
||
|
||
foreach (DataRow orr in oDatatable.Rows)
|
||
{
|
||
if (oDR["AmountDescription"].ToString() == orr["AmountDescription"].ToString())
|
||
{
|
||
if (orr["GroupID"].ToString() == "")
|
||
{
|
||
nGroupID++;
|
||
oDR["GroupID"] = nGroupID;
|
||
}
|
||
else
|
||
{
|
||
oDR["GroupID"] = Convert.ToInt32(orr["GroupID"]);
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
nIndex = 0;
|
||
foreach (DataRow oRow in dsPerquisite.Tables["EmpWiseBonus"].Rows)
|
||
{
|
||
oDR = oDatatable.NewRow();
|
||
CreateNewRowPerquisite(oDR, oRow, 2);
|
||
oDatatable.Rows.Add(oDR);
|
||
|
||
foreach (DataRow orr in oDatatable.Rows)
|
||
{
|
||
if (oDR["AmountDescription"].ToString() == orr["AmountDescription"].ToString())
|
||
{
|
||
if (orr["GroupID"].ToString() == "")
|
||
{
|
||
nGroupID++;
|
||
oDR["GroupID"] = nGroupID;
|
||
}
|
||
else
|
||
{
|
||
oDR["GroupID"] = Convert.ToInt32(orr["GroupID"]);
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
nIndex = 0;
|
||
foreach (DataRow oRow in dsPerquisite.Tables["EmpWisePF"].Rows)
|
||
{
|
||
oDR = oDatatable.NewRow();
|
||
CreateNewRowPerquisite(oDR, oRow, 3);
|
||
oDatatable.Rows.Add(oDR);
|
||
|
||
foreach (DataRow orr in oDatatable.Rows)
|
||
{
|
||
if (oDR["AmountDescription"].ToString() == orr["AmountDescription"].ToString())
|
||
{
|
||
if (orr["GroupID"].ToString() == "")
|
||
{
|
||
nGroupID++;
|
||
oDR["GroupID"] = nGroupID;
|
||
}
|
||
else
|
||
{
|
||
oDR["GroupID"] = Convert.ToInt32(orr["GroupID"]);
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
string salaryMonth = startDate.ToString("MMM yyyy");
|
||
string salaryMonth2 = endDate.ToString("MMM yyyy");
|
||
|
||
List<string> sumColumns;
|
||
DataTable resultTable = ToPivotPerquisiteTable(oDatatable, exemtedAmount, percentage, out sumColumns);
|
||
// convert DataTable to list-of-dictionaries for JSON serialization
|
||
var dataList = DataTableToDictionaryList(resultTable);
|
||
// return an anonymous object that will be serialized to { data: [...], sumColumns: [...] }
|
||
return new { data = dataList, sumColumns = sumColumns };
|
||
}
|
||
public DataTable ToPivotPerquisiteTable(DataTable source, double exemtedAmount, double percentage, out List<string> sumColumns)
|
||
{
|
||
DataTable pivot = new DataTable();
|
||
|
||
// identity columns
|
||
pivot.Columns.Add("Employee No", typeof(string));
|
||
pivot.Columns.Add("Name", typeof(string));
|
||
pivot.Columns.Add("Designation", typeof(string));
|
||
pivot.Columns.Add("Grade", typeof(string));
|
||
pivot.Columns.Add("Department", typeof(string));
|
||
|
||
// descriptions (sorted)
|
||
var descriptions = source.AsEnumerable()
|
||
.Select(r => r["AmountDescription"].ToString())
|
||
.Distinct()
|
||
.OrderBy(x => x)
|
||
.ToList();
|
||
|
||
foreach (var desc in descriptions)
|
||
{
|
||
pivot.Columns.Add(desc, typeof(decimal));
|
||
}
|
||
|
||
// calculated columns
|
||
pivot.Columns.Add("Total Perquisite Income", typeof(decimal));
|
||
pivot.Columns.Add("Examted", typeof(decimal));
|
||
pivot.Columns.Add("Perquisite Payable", typeof(decimal));
|
||
pivot.Columns.Add("Percentage", typeof(string));
|
||
pivot.Columns.Add("Excess Payable", typeof(decimal));
|
||
|
||
// track which descriptions contributed to 'Perquisite Income'
|
||
var sumSet = new HashSet<string>(StringComparer.OrdinalIgnoreCase);
|
||
|
||
// group by employee
|
||
var groups = source.AsEnumerable().GroupBy(r => new
|
||
{
|
||
EmpNo = r["EmpNo"].ToString(),
|
||
Name = r["Name"].ToString(),
|
||
Designation = r["Designation"].ToString(),
|
||
Grade = r["Grade"].ToString(),
|
||
Department = r["Department"].ToString()
|
||
});
|
||
|
||
foreach (var g in groups)
|
||
{
|
||
DataRow newRow = pivot.NewRow();
|
||
newRow["Employee No"] = g.Key.EmpNo;
|
||
newRow["Name"] = g.Key.Name;
|
||
newRow["Designation"] = g.Key.Designation;
|
||
newRow["Grade"] = g.Key.Grade;
|
||
newRow["Department"] = g.Key.Department;
|
||
|
||
decimal sumForA = 0m;
|
||
|
||
foreach (var row in g)
|
||
{
|
||
string desc = row["AmountDescription"].ToString();
|
||
decimal amount = row["Amount"] == DBNull.Value ? 0 : Math.Round(Convert.ToDecimal(row["Amount"]), 2);
|
||
newRow[desc] = amount;
|
||
|
||
int headType = Convert.ToInt32(row["HeadType"]); //HeadType 1 = EmpWiseSalary, 2 = EmpWiseBonus, 3 = EmpWisePF
|
||
if (headType != 2)
|
||
{
|
||
//EnumSalaryGroup itemGroup = (EnumSalaryGroup)Convert.ToInt32(row["ItemGroup"]);
|
||
EnumSalaryItemCode itemCode = (EnumSalaryItemCode)Convert.ToInt32(row["ItemCode"]);
|
||
int itemID = Convert.ToInt32(row["ItemID"]);
|
||
|
||
if (itemCode != EnumSalaryItemCode.Basic_Salary &&
|
||
itemCode != EnumSalaryItemCode.Over_Time_Amount &&
|
||
itemCode != EnumSalaryItemCode.Bonus)
|
||
{
|
||
sumForA += amount;
|
||
// mark this description as Sum in 'Perquisite Income'
|
||
if (!string.IsNullOrWhiteSpace(desc))
|
||
sumSet.Add(desc);
|
||
}
|
||
}
|
||
else if (headType == 2)
|
||
{
|
||
bool IsFestival = Convert.ToBoolean(row["IsFestival"]);
|
||
if (!IsFestival)
|
||
{
|
||
sumForA += amount;
|
||
if (!string.IsNullOrWhiteSpace(desc))
|
||
sumSet.Add(desc);
|
||
}
|
||
}
|
||
}
|
||
|
||
// fill zeros for missing descs
|
||
foreach (var desc in descriptions)
|
||
if (newRow.IsNull(desc))
|
||
newRow[desc] = 0m;
|
||
|
||
// calculated columns
|
||
newRow["Total Perquisite Income"] = Math.Round(sumForA, 2);
|
||
newRow["Examted"] = Math.Round(Convert.ToDecimal(exemtedAmount), 2);
|
||
|
||
decimal perquisitePayable = sumForA > (decimal)exemtedAmount ? sumForA - (decimal)exemtedAmount : 0m;
|
||
newRow["Perquisite Payable"] = Math.Round(perquisitePayable, 2);
|
||
|
||
newRow["Percentage"] = Convert.ToString(percentage) + "%";
|
||
|
||
decimal excessPayable = perquisitePayable * (decimal)(percentage / 100.0);
|
||
newRow["Excess Payable"] = Math.Round(excessPayable, 2);
|
||
|
||
pivot.Rows.Add(newRow);
|
||
}
|
||
|
||
// out parameter
|
||
sumColumns = sumSet.ToList();
|
||
// optionally sort sumColumns alphabetically
|
||
sumColumns.Sort(StringComparer.OrdinalIgnoreCase);
|
||
return pivot;
|
||
}
|
||
public static List<Dictionary<string, object>> DataTableToDictionaryList(DataTable dt)
|
||
{
|
||
var list = new List<Dictionary<string, object>>();
|
||
foreach (DataRow dr in dt.Rows)
|
||
{
|
||
var dict = new Dictionary<string, object>();
|
||
foreach (DataColumn col in dt.Columns)
|
||
{
|
||
dict[col.ColumnName] = dr[col] == DBNull.Value ? null : dr[col];
|
||
}
|
||
list.Add(dict);
|
||
}
|
||
return list;
|
||
}
|
||
|
||
private void CreateNewRow(DataRow oDR, DataRow oRow, int nType)
|
||
{
|
||
nIndex++;
|
||
double ArrearAmount = 0.0;
|
||
int tempEmpID = Convert.ToInt32(oRow["EMPLOYEEID"].ToString());
|
||
|
||
if (empID == 0 || tempEmpID != empID)
|
||
{
|
||
oEmp = oEmployees.Where(o => o.ID == tempEmpID).Single();
|
||
}
|
||
|
||
if (nType == 1 || nType == 3)
|
||
{
|
||
ArrearAmount = GetEmployeeWiseSalaryArrearAmount(tempEmpID, oArrearProcessDetails, (EnumSalaryItemCode)Convert.ToInt32(oRow["ITEMCODE"].ToString().Trim()), Convert.ToInt32(oRow["ITEMID"].ToString().Trim()), (EnumSalaryGroup)Convert.ToInt32(oRow["ITEMGROUP"].ToString().Trim()));
|
||
}
|
||
else if (nType == 2)
|
||
{
|
||
ArrearAmount = GeEmpWiseBonusArrearAmount(oEmp, oArrearProcessDetails, Convert.ToInt32(oRow["BonusId"].ToString().Trim()));
|
||
}
|
||
|
||
oDR["EmpNo"] = oEmp.EmployeeNo;
|
||
oDR["Name"] = oEmp.Name;
|
||
|
||
if (oEmp.GradeID != null)
|
||
{
|
||
oGrade = oGrades.Where(o => o.ID == oEmp.GradeID).Single();
|
||
}
|
||
oDR["Grade"] = oGrade.Name;
|
||
if (oEmp.DepartmentID != null)
|
||
{
|
||
oDepartment = oDepartments.Where(o => o.ID == oEmp.DepartmentID).Single();
|
||
}
|
||
oDR["Department"] = oDepartment.Name;
|
||
if (oEmp.DesignationID != null)
|
||
{
|
||
oDesignation = oDesignations.Where(o => o.ID == oEmp.DesignationID).Single();
|
||
}
|
||
oDR["Designation"] = oDesignation.Name;
|
||
|
||
EmployeeCostCenter ecc = oEmployeeCostCenters.Where(x => x.EmployeeID == oEmp.ID && x.IsCurrentCC == true).FirstOrDefault();
|
||
|
||
if (ecc != null)
|
||
{
|
||
if (ecc.Costcenter != null)
|
||
{
|
||
oDR["CC"] = ecc.Costcenter.Code;
|
||
}
|
||
else
|
||
{
|
||
oDR["CC"] = "";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
oDR["CC"] = "";
|
||
}
|
||
|
||
oDR["DOJ"] = oEmp.JoiningDate.ToString("dd MMM yyyy");
|
||
oDR["DOB"] = oEmp.BirthDate.ToString("dd MMM yyyy");
|
||
oDR["AmountDescription"] = oRow["Description"].ToString();
|
||
|
||
if (oDR["AmountDescription"].ToString() == "Ordinary Amount" || oDR["AmountDescription"].ToString() == "Basic")
|
||
{
|
||
oDR["AmountDescription"] = "Basic";
|
||
oDR["GroupID"] = 1;
|
||
}
|
||
if ((nType == 1 && Convert.ToInt32(oRow["ITEMGROUP"].ToString().Trim()) != 8) || nType == 2 || nType == 3)
|
||
oDR["Amount"] = Convert.ToDouble(oRow["Amount"].ToString()) + ArrearAmount;
|
||
else
|
||
oDR["Amount"] = Convert.ToDouble(oRow["Amount"].ToString());
|
||
|
||
}
|
||
|
||
private void CreateNewRowPerquisite(DataRow oDR, DataRow oRow, int nType)
|
||
{
|
||
nIndex++;
|
||
double ArrearAmount = 0.0;
|
||
int tempEmpID = Convert.ToInt32(oRow["EMPLOYEEID"].ToString());
|
||
|
||
if (empID == 0 || tempEmpID != empID)
|
||
{
|
||
oEmp = oEmployees.Where(o => o.ID == tempEmpID).Single();
|
||
}
|
||
|
||
if (nType == 1 || nType == 3)
|
||
{
|
||
//ArrearAmount = GetEmployeeWiseSalaryArrearAmount(tempEmpID, oArrearProcessDetails, (EnumSalaryItemCode)Convert.ToInt32(oRow["ITEMCODE"].ToString().Trim()), Convert.ToInt32(oRow["ITEMID"].ToString().Trim()), EnumSalaryGroup.Gross);
|
||
}
|
||
else if (nType == 2)
|
||
{
|
||
ArrearAmount = GeEmpWiseBonusArrearAmount(oEmp, oArrearProcessDetails, Convert.ToInt32(oRow["BonusId"].ToString().Trim()));
|
||
}
|
||
|
||
oDR["EmpNo"] = oEmp.EmployeeNo;
|
||
oDR["Name"] = oEmp.Name;
|
||
|
||
if (oEmp.GradeID != null)
|
||
{
|
||
oGrade = oGrades.Where(o => o.ID == oEmp.GradeID).Single();
|
||
}
|
||
oDR["Grade"] = oGrade.Name;
|
||
if (oEmp.DepartmentID != null)
|
||
{
|
||
oDepartment = oDepartments.Where(o => o.ID == oEmp.DepartmentID).Single();
|
||
}
|
||
oDR["Department"] = oDepartment.Name;
|
||
if (oEmp.DesignationID != null)
|
||
{
|
||
oDesignation = oDesignations.Where(o => o.ID == oEmp.DesignationID).Single();
|
||
}
|
||
oDR["Designation"] = oDesignation.Name;
|
||
|
||
EmployeeCostCenter ecc = oEmployeeCostCenters.Where(x => x.EmployeeID == oEmp.ID && x.IsCurrentCC == true).FirstOrDefault();
|
||
|
||
if (ecc != null)
|
||
{
|
||
if (ecc.Costcenter != null)
|
||
{
|
||
oDR["CC"] = ecc.Costcenter.Code;
|
||
}
|
||
else
|
||
{
|
||
oDR["CC"] = "";
|
||
}
|
||
}
|
||
else
|
||
{
|
||
oDR["CC"] = "";
|
||
}
|
||
|
||
oDR["DOJ"] = oEmp.JoiningDate.ToString("dd MMM yyyy");
|
||
oDR["DOB"] = oEmp.BirthDate.ToString("dd MMM yyyy");
|
||
oDR["AmountDescription"] = oRow["Description"].ToString();
|
||
|
||
if (oDR["AmountDescription"].ToString() == "Ordinary Amount" || oDR["AmountDescription"].ToString() == "Basic")
|
||
{
|
||
oDR["AmountDescription"] = "Basic";
|
||
oDR["GroupID"] = 1;
|
||
}
|
||
if (nType == 1 || nType == 2 || nType == 3)
|
||
oDR["Amount"] = Convert.ToDouble(oRow["Amount"].ToString()) + ArrearAmount;
|
||
else
|
||
oDR["Amount"] = Convert.ToDouble(oRow["Amount"].ToString());
|
||
|
||
if (nType == 1 || nType == 3)
|
||
{
|
||
//oDR["ItemGroup"] = oRow["ITEMGROUP"];
|
||
oDR["ItemID"] = oRow["ITEMID"];
|
||
oDR["ItemCode"] = oRow["ITEMCODE"];
|
||
}
|
||
if (nType == 2)
|
||
{
|
||
oDR["IsFestival"] = Convert.ToBoolean(oRow["IsFestival"] == DBNull.Value ? false : oRow["IsFestival"]);
|
||
}
|
||
else
|
||
{
|
||
oDR["IsFestival"] = false;
|
||
}
|
||
oDR["HeadType"] = nType;
|
||
}
|
||
private double GetEmployeeWiseSalaryArrearAmount(int employeeID, List<ArrearProcessDetail> oArrearProcessDetails, EnumSalaryItemCode salaryItemCode, int salarytItemID, EnumSalaryGroup salaryGroup)
|
||
{
|
||
double amount = 0.0;
|
||
enumPayrollComponentType enmArrPrsType;
|
||
|
||
if (salaryGroup == EnumSalaryGroup.Gross)
|
||
{
|
||
if (salaryItemCode == EnumSalaryItemCode.Basic_Salary)
|
||
{
|
||
enmArrPrsType = enumPayrollComponentType.Ordinary_Hour;
|
||
}
|
||
}
|
||
|
||
int ItemID;
|
||
GetArrearItemTypeAndItemIDForSalary(salaryItemCode, salarytItemID, salaryGroup, out enmArrPrsType, out ItemID);
|
||
|
||
if (ItemID == 0)
|
||
{
|
||
amount = oArrearProcessDetails
|
||
.Where(o => o.EmployeeID == employeeID)
|
||
.Sum(o => o.ArrearProcessDetailItems
|
||
.Where(ob => ob.ItemType == enmArrPrsType)
|
||
.Sum(obj => obj.ChangedAmount));
|
||
}
|
||
else
|
||
{
|
||
amount = oArrearProcessDetails
|
||
.Where(o => o.EmployeeID == employeeID)
|
||
.Sum(o => o.ArrearProcessDetailItems
|
||
.Where(ob => ob.ItemType == enmArrPrsType && ob.ItemID == ItemID)
|
||
.Sum(obj => obj.ChangedAmount));
|
||
}
|
||
|
||
return amount;
|
||
}
|
||
|
||
private void GetArrearItemTypeAndItemIDForSalary(EnumSalaryItemCode SalaryItemCode, int SalaryItemID, EnumSalaryGroup SalGroup, out enumPayrollComponentType enmArrPrsType, out int ItemID)
|
||
{
|
||
ItemID = 0;
|
||
|
||
switch (SalaryItemCode)
|
||
{
|
||
case EnumSalaryItemCode.Basic_Salary:
|
||
enmArrPrsType = enumPayrollComponentType.Ordinary_Hour;
|
||
break;
|
||
case EnumSalaryItemCode.Over_Time_Amount:
|
||
enmArrPrsType = enumPayrollComponentType.Over_Time;
|
||
ItemID = SalaryItemID;
|
||
break;
|
||
case EnumSalaryItemCode.Bonus:
|
||
enmArrPrsType = enumPayrollComponentType.Bonus;
|
||
break;
|
||
case EnumSalaryItemCode.PF_Contribution:
|
||
enmArrPrsType = enumPayrollComponentType.PF;
|
||
break;
|
||
case EnumSalaryItemCode.Inc_Tax_Deduction:
|
||
enmArrPrsType = enumPayrollComponentType.IncomeTax;
|
||
break;
|
||
case EnumSalaryItemCode.Allowance:
|
||
enmArrPrsType = enumPayrollComponentType.Allowance;
|
||
ItemID = SalaryItemID;
|
||
break;
|
||
case EnumSalaryItemCode.Deduction:
|
||
enmArrPrsType = enumPayrollComponentType.Deduction;
|
||
ItemID = SalaryItemID;
|
||
break;
|
||
default:
|
||
enmArrPrsType = enumPayrollComponentType.Net_pay;
|
||
break;
|
||
}
|
||
}
|
||
private double GeEmpWiseBonusArrearAmount(Employee emp, List<ArrearProcessDetail> oArrearProcessDetails, int bonusItemID)
|
||
{
|
||
double amount = 0.0;
|
||
|
||
amount = oArrearProcessDetails
|
||
.Where(o => o.EmployeeID == emp.ID)
|
||
.Sum(o => o.ArrearProcessDetailItems
|
||
.Where(ob => ob.ItemType == enumPayrollComponentType.Bonus && ob.ItemID == bonusItemID)
|
||
.Sum(obj => obj.ChangedAmount));
|
||
return amount;
|
||
}
|
||
|
||
public byte[] showTaxCardForMultiple(string empIds, int taxParamId, int payrollType, int currentTaxParamId, string reportType)
|
||
{
|
||
bool IsSeparateBonusChallan = new SystemConfigarationService().GetconfigBooleanValue(EnumConfigurationType.Logic, "incometax", "separatebonuschallan");
|
||
byte[] bytes = null;
|
||
IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
|
||
TaxParameter taxParameter = new TaxParameterService().Get(taxParamId);
|
||
string assessmentYear = taxParameter.AssessmentYear.ToString();
|
||
string fiscalYear = taxParameter.FiscalYear.ToString();
|
||
string sEmpNo = empIds;
|
||
DataRow dr = null;
|
||
//IncomeTax oIncomeTax = new IncomeTax();
|
||
//IncomeTaxService incomeTaxService = new IncomeTaxService();
|
||
TaxParameterService taxParameterService = new TaxParameterService();
|
||
string TaxPeriod = "";
|
||
//DataSet oDset = null;
|
||
DataSet resultDataSet = new DataSet();
|
||
DataRow oDRow = null;
|
||
LocalReport localReport = new LocalReport();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
List<Employee> employeeList = null;
|
||
List<TaxChallan> taxChallans = new List<TaxChallan>();
|
||
TaxChallan taxChallan = null;
|
||
TaxChallanService taxChallanService = new TaxChallanService();
|
||
employeeList = new EmployeeService().GetEmpsWithDiscontinue(sEmpNo, payrollType);
|
||
//taxChallans = new TaxChallanService().GetByTaxParamIDandPayrolltypeID(taxParamId, payrollType);
|
||
List<Designation> designations = new DesignationService().GetAll();
|
||
List<Department> departments = new DepartmentService().GetAll();
|
||
Designation designation = null;
|
||
Department department = null;
|
||
int nEmpID;
|
||
DataRow houseRent = null;
|
||
DataRow Conveyance = null;
|
||
DataRow Medical = null;
|
||
DataRow lfa = null;
|
||
DataRow TotalSalaryExepted = null;
|
||
DataRow TotalAnnualExepted = null;
|
||
PayrollDataSet.PayrollDataSet.IncomeTaxDataTable dTable1 = new PayrollDataSet.PayrollDataSet.IncomeTaxDataTable();
|
||
PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable empBasic = new PayrollDataSet.PayrollDataSet.PayslipBasicInfoDataTable();
|
||
//PayrollDataSet.PayrollDataSet.AnnualIncomeCertificateDataTable dt = new PayrollDataSet.PayrollDataSet.AnnualIncomeCertificateDataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan1DataTable dTChallan1 = new PayrollDataSet.PayrollDataSet.TaxChallan1DataTable();
|
||
PayrollDataSet.PayrollDataSet.TaxChallan2DataTable dTChallan2 = new PayrollDataSet.PayrollDataSet.TaxChallan2DataTable();
|
||
|
||
foreach (Employee oEmp in employeeList)
|
||
{
|
||
taxChallans = new TaxChallanService().GetByTaxParamIDandPayrolltypeIDandBranchID(taxParamId, payrollType, Convert.ToInt32(oEmp.BranchID));
|
||
_AmountPerAnnum = 0;
|
||
_ThisMonthAmount = 0;
|
||
_PaidTillDateAmount = 0;
|
||
_ProjectedAmount = 0;
|
||
_employee = oEmp;
|
||
nEmpID = oEmp.ID;
|
||
GrandTotal = 0.0;
|
||
|
||
if (currentTaxParamId == taxParamId)
|
||
{
|
||
_incometaxes = incomeTaxService.Get(incomeTaxService.GetEnumForSalaryIT(oEmp.ID), oEmp.ID, taxParamId);
|
||
}
|
||
else
|
||
{
|
||
_incometaxes = incomeTaxService.Get(EnumIncomeTaxDataFrom.ProcessedData, oEmp.ID, taxParamId);
|
||
}
|
||
if (_incometaxes == null || _incometaxes.Count < 1) continue;
|
||
designation = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
department = departments.FirstOrDefault(x => x.ID == oEmp.DepartmentID);
|
||
|
||
oDRow = empBasic.NewRow();
|
||
oDRow["EmployeeNo"] = oEmp.EmployeeNo;
|
||
oDRow["EmpID"] = oEmp.ID;
|
||
oDRow["TinNo"] = oEmp.TinNo;
|
||
oDRow["Name"] = oEmp.Name;
|
||
oDRow["Designation"] = designation != null ? designation.Name : "";
|
||
oDRow["department"] = department != null ? department.Name : "";
|
||
oDRow["Gender"] = oEmp.Gender.ToString();
|
||
|
||
//Temporary for param 8
|
||
double totalChallanAmount = 0;
|
||
double totalChallanAmountForChallan = 0;
|
||
DataSet tempChallan = new DataSet();
|
||
if (taxParamId == 8)
|
||
{
|
||
|
||
tempChallan = taxChallanService.GetTaxDeductionByID(_employee.ID, _employee.PayrollTypeID);
|
||
//taxChallanService.GetChallan()
|
||
|
||
if (tempChallan != null && tempChallan.Tables.Count != 0)
|
||
{
|
||
double amnt = 0;
|
||
int length = 12;
|
||
DataRow temp = null;
|
||
if (tempChallan.Tables[0].Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < 6; i++)
|
||
{
|
||
switch (i)
|
||
{
|
||
case 0:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jul22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[0];
|
||
break;
|
||
case 1:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Aug22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[1];
|
||
break;
|
||
case 2:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Sep22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[2];
|
||
break;
|
||
case 3:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Oct22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[3];
|
||
break;
|
||
case 4:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Nov22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[4];
|
||
break;
|
||
case 5:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Dec22"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[5];
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan1.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp["ChallanNo"];
|
||
dr["ChallanDate"] = (Convert.ToDateTime(temp["DateOfChallan"])).ToString("dd MMM yyyy");
|
||
dr["BankName"] = temp["BankName"];
|
||
dr["Amount"] = amnt;
|
||
dr["TotalAmount"] = temp["TotalAmount"];
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
}
|
||
|
||
for (int i = 6; i < 12; i++)
|
||
{
|
||
switch (i)
|
||
{
|
||
case 6:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jan23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[6];
|
||
break;
|
||
case 7:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Feb23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[7];
|
||
break;
|
||
case 8:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Mar23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[8];
|
||
break;
|
||
case 9:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Apr23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[9];
|
||
break;
|
||
case 10:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["May23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[10];
|
||
break;
|
||
case 11:
|
||
amnt = Convert.ToDouble(tempChallan.Tables[0].Rows[0]["Jun23"].ToString());
|
||
temp = tempChallan.Tables[1].Rows[11];
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan2.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp["ChallanNo"];
|
||
dr["ChallanDate"] = (Convert.ToDateTime(temp["DateOfChallan"])).ToString("dd MMM yyyy");
|
||
dr["BankName"] = temp["BankName"];
|
||
dr["Amount"] = amnt;
|
||
dr["TotalAmount"] = temp["TotalAmount"];
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan2.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
}
|
||
}
|
||
// dTChallan1.
|
||
}
|
||
_taxdeducted = totalChallanAmount;
|
||
oDRow["TotalDeduction"] = totalChallanAmount;
|
||
empBasic.Rows.Add(oDRow);
|
||
}
|
||
else
|
||
{
|
||
string[] a = fiscalYear.Split('-');
|
||
DateTime startdate = new DateTime(Convert.ToInt32(a[0]), 7, 1);
|
||
DateTime enddate = new DateTime(Convert.ToInt32(a[1]), 6, 30);
|
||
tempChallan = taxChallanService.GetTaxDeductionByIDFromSalaryBonus(_employee.ID, _employee.PayrollTypeID, startdate, enddate, IsSeparateBonusChallan);
|
||
//taxChallanService.GetChallan()
|
||
|
||
if (tempChallan != null && tempChallan.Tables.Count != 0)
|
||
{
|
||
double amnt = 0;
|
||
double refund = 0;
|
||
int length = 12;
|
||
TaxChallan temp = null;
|
||
TaxChallan temprefund = null;
|
||
|
||
DataRow dramount = null;
|
||
if (tempChallan.Tables[0].Rows.Count > 0)
|
||
{
|
||
for (int i = 0; i < 6; i++)
|
||
{
|
||
refund = 0;
|
||
switch (i)
|
||
{
|
||
case 0:
|
||
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate).ToString() && x.EmployeeID == 0); //tempChallan.Tables[1].Rows[0];
|
||
break;
|
||
case 1:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(1)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(1)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 2:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(2)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(2)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 3:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(3)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(3)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 4:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(4)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(4)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 5:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(5)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(5)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan1.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp != null ? temp.ChallanNo : "";
|
||
dr["ChallanDate"] = (temp != null ? temp.DepositDate.ToString("dd MMM yyyy") : "");
|
||
dr["BankName"] = temp != null ? temp.BankName : "";
|
||
dr["Amount"] = temp != null ? amnt : 0;
|
||
//dr["TotalAmount"] = temp != null ? temp.Amount : 0;
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan1.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
totalChallanAmountForChallan += (temp != null ? amnt : 0);
|
||
}
|
||
|
||
for (int i = 6; i < 12; i++)
|
||
{
|
||
refund = 0;
|
||
switch (i)
|
||
{
|
||
case 6:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(6)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(6)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 7:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(7)).ToString());
|
||
temprefund = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(7)).ToString() && x.EmployeeID == _employee.ID);
|
||
//amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0)) - (temprefund != null ? temprefund.Amount : 0);
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(7)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 8:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(8)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(8)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 9:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(9)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(9)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 10:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(10)).ToString());
|
||
amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0));
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(10)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
case 11:
|
||
dramount = tempChallan.Tables[0].AsEnumerable().FirstOrDefault(x => x["Salarymonth"].ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(11)).ToString());
|
||
temprefund = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(11)).ToString() && x.EmployeeID == _employee.ID);
|
||
//amnt = Convert.ToDouble((dramount != null ? dramount["Amount"] : 0)) - (temprefund != null ? temprefund.Amount : 0);
|
||
temp = taxChallans.FirstOrDefault(x => GlobalFunctions.LastDateOfMonth(x.SalaryMonthly).ToString() == GlobalFunctions.LastDateOfMonth(startdate.AddMonths(11)).ToString() && x.EmployeeID == 0);
|
||
break;
|
||
|
||
}
|
||
|
||
dr = dTChallan2.NewRow();
|
||
dr["SLNo"] = i + 1;
|
||
dr["ChallanNo"] = temp != null ? temp.ChallanNo : "";
|
||
dr["ChallanDate"] = (temp != null ? temp.DepositDate.ToString("dd MMM yyyy") : "");
|
||
dr["BankName"] = temp != null ? temp.BankName : "";
|
||
dr["Amount"] = temp != null ? amnt : 0;
|
||
//dr["TotalAmount"] = temp != null ? temp.Amount : 0;
|
||
dr["EmpID"] = _employee.ID;
|
||
dTChallan2.Rows.Add(dr);
|
||
totalChallanAmount += amnt;
|
||
totalChallanAmountForChallan += (temp != null ? amnt : 0);
|
||
|
||
}
|
||
}
|
||
// dTChallan1.
|
||
}
|
||
_taxdeducted = totalChallanAmount;
|
||
oDRow["TotalDeduction"] = totalChallanAmount;
|
||
oDRow["TotalDeductionForChallan"] = payrollType == 1 ? totalChallanAmount : totalChallanAmountForChallan;
|
||
empBasic.Rows.Add(oDRow);
|
||
//IncomeTax oNetTaxdeducted = Get(_incometaxes, _employee.ID, EnumIncomeTaxItemGroup.Tax_Deducted,
|
||
// (int)EnumIncomeTaxItemGroup.Tax_Deducted);
|
||
//oDRow["TotalDeduction"] = oNetTaxdeducted!=null? oNetTaxdeducted.TotalAmount:0;
|
||
//empBasic.Rows.Add(oDRow);
|
||
}
|
||
|
||
#region incometax
|
||
//income tax section
|
||
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) continue;
|
||
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_SalaryIncome || oItem.Side == EnumIncomeTaxSide.Dec_SalaryIncome)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
|
||
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 (houseRent != null)
|
||
{
|
||
IncomeTax taxAmount = 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 = 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 = 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 = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Exemption_LFA_Allowance, (int)EnumIncomeTaxItemGroup.Exemption_LFA_Allowance);
|
||
if (taxAmount != null)
|
||
{
|
||
_TotalSalaryExempted += taxAmount.TotalAmount;
|
||
lfa["LessExaempted"] = GlobalFunctions.TakaFormat(taxAmount.TotalAmount);
|
||
}
|
||
}
|
||
|
||
IncomeTax salaryIncome = 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));
|
||
|
||
TotalSalaryExepted = dr;
|
||
|
||
TotalSalaryExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
}
|
||
foreach (IncomeTax oItem in _incometaxes)
|
||
{
|
||
if (oItem.Side == EnumIncomeTaxSide.Inc_AnnualIncome || oItem.Side == EnumIncomeTaxSide.Dec_AnnualIncome)
|
||
{
|
||
|
||
if (oItem.ItemID != -305)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARow(dr, oItem));
|
||
}
|
||
//_TotalAnnuaExempted = oItem.TotalAmount;
|
||
}
|
||
}
|
||
IncomeTax totalAnnualExemption = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.AnnualExemption, (int)EnumIncomeTaxItemGroup.AnnualExemption);
|
||
if (totalAnnualExemption != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
totalAnnualExemption.ProjectedAmount *= -1;
|
||
//totalAnnualExemption.TotalAmount *= -1;
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualExemption));
|
||
}
|
||
IncomeTax totalAnnualIncome = Get(_incometaxes, nEmpID,
|
||
EnumIncomeTaxItemGroup.Annual_Income, (int)EnumIncomeTaxItemGroup.Annual_Income);
|
||
|
||
if (totalAnnualIncome != null)
|
||
{
|
||
dr = dTable1.NewRow();
|
||
dTable1.Rows.Add(this.getARow(dr, totalAnnualIncome));
|
||
TotalAnnualExepted = dr;
|
||
TotalAnnualExepted["LessExaempted"] = _TotalSalaryExempted;
|
||
|
||
}
|
||
#endregion incometax
|
||
|
||
}
|
||
empBasic.TableName = "PayrollDataSet_PayslipBasicInfo";
|
||
resultDataSet.Tables.Add(empBasic);
|
||
|
||
dTable1.TableName = "PayrollDataSet_IncomeTax";
|
||
resultDataSet.Tables.Add(dTable1);
|
||
|
||
dTChallan1.TableName = "PayrollDataSet_TaxChallan1";
|
||
resultDataSet.Tables.Add(dTChallan1);
|
||
|
||
dTChallan2.TableName = "PayrollDataSet_TaxChallan2";
|
||
resultDataSet.Tables.Add(dTChallan2);
|
||
//rParam = new ReportParameter("TaxPeriod", TaxPeriod);
|
||
//reportParameters.Add(rParam);
|
||
//rParam = new ReportParameter("signature", signaturePath);
|
||
//reportParameters.Add(rParam);
|
||
|
||
//if (reportParameters != null)
|
||
// localReport.SetParameters(reportParameters);
|
||
//Warning[] warnings;
|
||
//string[] streamids;
|
||
//string mimeType;
|
||
//string encoding;
|
||
//string filenameExtension;
|
||
//bytes = localReport.Render(reportType, null, out mimeType, out encoding, out filenameExtension,
|
||
// out streamids, out warnings);
|
||
|
||
//dt.TableName = "PayrollDataSet_AnnualIncomeCertificate";
|
||
//resultDataSet.Tables.Add(dt);
|
||
//string rdlcName = "HRM.Report.RDLC.AnnualIncomeCertificate.rdlc";
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.showTaxCardForMultiple(null, resultDataSet, TaxPeriod, payrollType, reportType, assessmentYear, fiscalYear);
|
||
//return reportProcessor.CommonReportView(null, rdlcName, resultDataSet, null, reportParameters, true, payrollType, reportType);
|
||
}
|
||
|
||
public byte[] ShowTaxPerquisite(DateTime fromDate, DateTime toDate, string sEmpNo, int payrollTypeId, string reportType)
|
||
{
|
||
DateTime startDate, endDate;
|
||
startDate = endDate = DateTime.Now;
|
||
int nGroupID = 1;
|
||
|
||
startDate = fromDate.FirstDateOfMonth();
|
||
endDate = toDate.LastDateOfMonth();
|
||
|
||
MiscellaneousDatasetService miscellaneousDatasetService = new MiscellaneousDatasetService();
|
||
ArrearProcessService arrearProcessService = new ArrearProcessService();
|
||
DataRow oDR = null;
|
||
DataSet oPayrollPerquisite = null;
|
||
|
||
oEmployees = new EmployeeService().GetAllEmps();
|
||
oGrades = new GradeService().Get(EnumStatus.Active);
|
||
oDepartments = new DepartmentService().GetAll();
|
||
oDesignations = new DesignationService().GetAll();
|
||
oEmployeeCostCenters = new EmployeeCostCenterService().Get();
|
||
|
||
DataSet dsPerquisite = miscellaneousDatasetService.GetPerquisiteData(startDate, endDate, sEmpNo, payrollTypeId);
|
||
oArrearProcessDetails = arrearProcessService.GetArrearProcessDetails(sEmpNo, startDate, endDate, payrollTypeId);
|
||
|
||
PayrollDataSet.dsCompany.dtPerquisiteDataTable oDatatable = new PayrollDataSet.dsCompany.dtPerquisiteDataTable();
|
||
|
||
if (dsPerquisite.Tables[0].Rows.Count > 0)
|
||
{
|
||
nIndex = 0;
|
||
foreach (DataRow oRow in dsPerquisite.Tables["EmpWiseSalary"].Rows)
|
||
{
|
||
oDR = oDatatable.NewRow();
|
||
CreateNewRow(oDR, oRow, 1);
|
||
oDatatable.Rows.Add(oDR);
|
||
|
||
foreach (DataRow orr in oDatatable.Rows)
|
||
{
|
||
if (oDR["AmountDescription"].ToString() == orr["AmountDescription"].ToString())
|
||
{
|
||
if (orr["GroupID"].ToString() == "")
|
||
{
|
||
nGroupID++;
|
||
oDR["GroupID"] = nGroupID;
|
||
}
|
||
else
|
||
{
|
||
oDR["GroupID"] = Convert.ToInt32(orr["GroupID"]);
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
}
|
||
|
||
nIndex = 0;
|
||
|
||
foreach (DataRow oRow in dsPerquisite.Tables["EmpWiseBonus"].Rows)
|
||
{
|
||
oDR = oDatatable.NewRow();
|
||
CreateNewRow(oDR, oRow, 2);
|
||
oDatatable.Rows.Add(oDR);
|
||
|
||
foreach (DataRow orr in oDatatable.Rows)
|
||
{
|
||
if (oDR["AmountDescription"].ToString() == orr["AmountDescription"].ToString())
|
||
{
|
||
if (orr["GroupID"].ToString() == "")
|
||
{
|
||
nGroupID++;
|
||
oDR["GroupID"] = nGroupID;
|
||
}
|
||
else
|
||
{
|
||
oDR["GroupID"] = Convert.ToInt32(orr["GroupID"]);
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
nIndex = 0;
|
||
|
||
foreach (DataRow oRow in dsPerquisite.Tables["EmpWisePF"].Rows)
|
||
{
|
||
oDR = oDatatable.NewRow();
|
||
CreateNewRow(oDR, oRow, 3);
|
||
oDatatable.Rows.Add(oDR);
|
||
|
||
foreach (DataRow orr in oDatatable.Rows)
|
||
{
|
||
if (oDR["AmountDescription"].ToString() == orr["AmountDescription"].ToString())
|
||
{
|
||
if (orr["GroupID"].ToString() == "")
|
||
{
|
||
nGroupID++;
|
||
oDR["GroupID"] = nGroupID;
|
||
}
|
||
else
|
||
{
|
||
oDR["GroupID"] = Convert.ToInt32(orr["GroupID"]);
|
||
}
|
||
|
||
break;
|
||
}
|
||
}
|
||
}
|
||
|
||
string salaryMonth = startDate.ToString("MMM yyyy");
|
||
string salaryMonth2 = endDate.ToString("MMM yyyy");
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowPerquisiteReport(oDatatable, salaryMonth, salaryMonth2, payrollTypeId, reportType);
|
||
}
|
||
|
||
public byte[] GetDataReport177Quaterly(string sEmpNo, int payrollTypeId, DateTime SalaryMonthFrom, DateTime SalaryMonthTo, string reportType)
|
||
{
|
||
// TaxParameter otaxparam = new TaxParameterService().Get(nTaxParamID);
|
||
DataRow oDRow = null;
|
||
DataRow tempDr = null;
|
||
EnumerableRowCollection<DataRow> tempDrs = null;
|
||
PayrollDataSet.PayrollDataSet.Report108DataTable dTreport108 = new PayrollDataSet.PayrollDataSet.Report108DataTable();
|
||
MiscellaneousDatasetService miscellaneousDatasetService = new MiscellaneousDatasetService();
|
||
int nIndex;
|
||
int nCount = 1;
|
||
double GrandTotal;
|
||
List<IncomeTax> oIncomeTaxs = null;
|
||
IncomeTax oIncomeTax = new IncomeTax();
|
||
//_Employees = Employee.GetWithDiscontinue();
|
||
_Employees = new EmployeeService().GetByEmpIDs(sEmpNo);
|
||
double nAmount = 0;
|
||
double nFesAmount = 0;
|
||
double nRebAmount = 0;
|
||
double nPFCFAmount = 0;
|
||
double nBonusArrearLeaveOverTimeAmount = 0;
|
||
double nTempAmount = 0;
|
||
double nOthers = 0;
|
||
List<Designation> designations = new DesignationService().Get(EnumStatus.Regardless, payrollTypeId);
|
||
Designation desig = null;
|
||
double totalAnnualIncome = 0;
|
||
|
||
TaxParameter oTaxParameter = new TaxParameterService().GetByDate(SalaryMonthFrom, payrollTypeId);
|
||
List<ITEmpHead> itEmpHeads = new ITEmpHeadService().GetWithTaxParam(oTaxParameter.ID);
|
||
DataSet dsPerquisite = miscellaneousDatasetService.GetFor177DataQuarterly(GlobalFunctions.FirstDateOfMonth(SalaryMonthFrom), GlobalFunctions.LastDateOfMonth(SalaryMonthTo), sEmpNo, payrollTypeId);
|
||
|
||
|
||
string em = string.Empty;
|
||
foreach (DataRow rw in dsPerquisite.Tables["EmpWiseBonus"].Rows)
|
||
{
|
||
if (!_Employees.Any(x => x.ID.ToString() == rw["EmployeeId"].ToString()))
|
||
{
|
||
em = em + rw["EmployeeId"].ToString() + ",";
|
||
}
|
||
}
|
||
em = em.Trim(',');
|
||
if (em.Length > 0)
|
||
{
|
||
List<Employee> emps = new EmployeeService().GetByEmpIDs(em);
|
||
foreach (Employee emp in emps)
|
||
{
|
||
_Employees.Add(emp);
|
||
}
|
||
}
|
||
|
||
|
||
List<TaxMergeMaster> taxMergeMasters = new List<TaxMergeMaster>();
|
||
List<TaxMergeMaster> otherTaxMergeMasters = new List<TaxMergeMaster>();
|
||
List<TaxMergeMaster> oTBonousTaxMergeMasters = new List<TaxMergeMaster>();
|
||
taxMergeMasters = new TaxMergeMasterService().GetbyTaxParameter(oTaxParameter.ID, payrollTypeId);
|
||
//TaxMergeMaster taxMergeMaster = null;
|
||
TaxMergeMaster houseRentMergeMaster = null;
|
||
TaxMergeMaster conveyanceMergeMaster = null;
|
||
TaxMergeMaster medicalMergeMaster = null;
|
||
ITEmpHead oITEmpHead = new ITEmpHead();
|
||
if (dsPerquisite != null && dsPerquisite.Tables.Count > 0 && dsPerquisite.Tables[0].Rows.Count > 0)
|
||
{
|
||
otherTaxMergeMasters = taxMergeMasters.Where(titem => titem.ItemGroup != EnumIncomeTaxItemGroup.Basic_Salary
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Bonus
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_car
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Cmp_Provided_House
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.LFA_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.WPPF_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.TimeCard
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Business_Travel
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Conveyance_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_House_Rent_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Exemption_Medical_Allowance
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Tax_Deducted
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate
|
||
&& titem.ItemGroup != EnumIncomeTaxItemGroup.Company_Contri_PF).ToList(); // time card(OT)
|
||
|
||
oTBonousTaxMergeMasters = taxMergeMasters.Where(titem => titem.ItemGroup == EnumIncomeTaxItemGroup.TimeCard || titem.ItemGroup == EnumIncomeTaxItemGroup.Bonus).ToList(); // time card(OT)
|
||
houseRentMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.House_Rent_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.House_Rent_Allowance);
|
||
conveyanceMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Conveyance_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Conveyance_Allowance);
|
||
medicalMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Medical_Allowance && x.ItemID == (int)EnumIncomeTaxItemGroup.Medical_Allowance);
|
||
DataTable tempPerquisite = new DataTable();
|
||
double bonusTax = 0;
|
||
double TotalBonus = 0;
|
||
double TotalMothlyBonus = 0;
|
||
double TotalArear = 0;
|
||
|
||
foreach (Employee oEmp in _Employees)
|
||
{
|
||
|
||
GrandTotal = 0.0;
|
||
oDRow = dTreport108.NewRow();
|
||
|
||
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
GrandTotal = 0;
|
||
|
||
desig = designations.FirstOrDefault(x => x.ID == oEmp.DesignationID);
|
||
//nIndex = new IncomeTaxService().GetIndex(oEmp.ID);
|
||
oDRow["TIN"] = oEmp.TinNo;
|
||
oDRow["SLNo"] = nCount;//col 1
|
||
oDRow["EmpNo"] = oEmp.EmployeeNo;
|
||
oDRow["Name"] = oEmp.Name;//col 2
|
||
oDRow["PostalAdd"] = "";//Postal Address ,col 3
|
||
oDRow["NEmployee"] = desig != null ? desig.Name : "";//Designation of Employee ,col 4
|
||
if (dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().Any(x => x.Field<Int32>("Employeeid") == oEmp.ID))
|
||
{
|
||
tempPerquisite = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().Where(x => x.Field<Int32>("Employeeid") == oEmp.ID).CopyToDataTable();
|
||
#region Basic
|
||
//taxMergeMaster = taxMergeMasters.FirstOrDefault(x => x.ItemGroup == EnumIncomeTaxItemGroup.Basic_Salary && x.ItemID == (int)EnumIncomeTaxItemGroup.Basic_Salary);
|
||
// if (taxMergeMaster != null)
|
||
// {
|
||
// foreach (TaxMergeMaster.TaxMergeDetail item in taxMergeMaster.TaxMergeDetails)
|
||
// {
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -101 && x.Field<Int32>("ItemID") == -101 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
oDRow["Basic"] = tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0;
|
||
//oDRow["Basic"] = GlobalFunctions.TakaFormat(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
//}
|
||
// }
|
||
#endregion
|
||
|
||
#region HousRent
|
||
if (houseRentMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in houseRentMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["HREarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["HREarned"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
|
||
#region Conveyance
|
||
if (conveyanceMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in conveyanceMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["CEarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["CEarned"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
|
||
#region Medical
|
||
if (medicalMergeMaster != null)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in medicalMergeMaster.TaxMergeDetails)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["MEarned"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["MEarned"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
|
||
#region Others
|
||
if (otherTaxMergeMasters != null && otherTaxMergeMasters.Count > 0)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster otaxmarge in otherTaxMergeMasters)
|
||
{
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in otaxmarge.TaxMergeDetails)
|
||
{
|
||
if (item.Type == EnumTaxMergeType.Allowance)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
}
|
||
}
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["Others"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["Others"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
}
|
||
#region BonusArrearLeave
|
||
if (oTBonousTaxMergeMasters != null && oTBonousTaxMergeMasters.Count > 0)
|
||
{
|
||
nTempAmount = 0;
|
||
nAmount = 0;
|
||
foreach (TaxMergeMaster otBonustaxmarge in oTBonousTaxMergeMasters)
|
||
{
|
||
foreach (TaxMergeMaster.TaxMergeDetail item in otBonustaxmarge.TaxMergeDetails)
|
||
{
|
||
if (item.Type == EnumTaxMergeType.Allowance)
|
||
{
|
||
tempDr = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -113 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
TotalMothlyBonus = TotalMothlyBonus + nAmount;
|
||
}
|
||
else if (item.Type == EnumTaxMergeType.OT)
|
||
{
|
||
tempDr = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 1 && x.Field<Int32>("ItemCode") == -103 && x.Field<Int32>("ItemID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
}
|
||
else if (item.Type == EnumTaxMergeType.Bonus)
|
||
{
|
||
tempDr = dsPerquisite.Tables["EmpWiseBonus"].AsEnumerable().FirstOrDefault(x => x.Field<Int32>("BonusID") == item.ItemID && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
TotalBonus = TotalBonus + nAmount;
|
||
|
||
}
|
||
}
|
||
}
|
||
tempDrs = dsPerquisite.Tables["EmpWiseSalary"].AsEnumerable().Where(x => x.Field<Int32>("ItemGroup") == 8 && (x.Field<Int32>("ItemCode") == -113 || x.Field<Int32>("ItemCode") == -101 || x.Field<Int32>("ItemCode") == -103) && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
if (tempDrs != null && tempDrs.Count() > 0)
|
||
{
|
||
foreach (DataRow dr in tempDrs)
|
||
{
|
||
nAmount = GlobalFunctions.Round(dr != null ? Convert.ToDouble(dr["Amount"]) : 0);
|
||
nTempAmount = nTempAmount + nAmount;
|
||
TotalArear = TotalArear + nAmount;
|
||
}
|
||
|
||
}
|
||
|
||
GrandTotal = GrandTotal + nTempAmount;
|
||
//oDRow["BonusArrearLeaveOverTimeAmount"] = GlobalFunctions.TakaFormat(nTempAmount);
|
||
oDRow["BonusArrearLeaveOverTimeAmount"] = nTempAmount;
|
||
}
|
||
#endregion
|
||
if (tempPerquisite != null)
|
||
{
|
||
#region PF
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -128 && x.Field<Int32>("ItemID") == -128 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["CompanyPf"] = GlobalFunctions.TakaFormat(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
oDRow["CompanyPf"] = tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0;
|
||
#endregion
|
||
|
||
#region Non-Cash Benefit : Residence
|
||
if (oEmp.EmployeeNo == "08660")
|
||
{
|
||
nAmount = GlobalFunctions.Round(450000);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else if (oEmp.EmployeeNo == "08661")
|
||
{
|
||
nAmount = GlobalFunctions.Round(529165);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else if (oEmp.EmployeeNo == "08668")
|
||
{
|
||
nAmount = GlobalFunctions.Round(529165);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else if (oEmp.EmployeeNo == "08669")
|
||
{
|
||
nAmount = GlobalFunctions.Round(490000);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else if (oEmp.EmployeeNo == "08772")
|
||
{
|
||
nAmount = GlobalFunctions.Round(525000);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["BasicPercent"] = nAmount;
|
||
}
|
||
else
|
||
{
|
||
//oDRow["BasicPercent"] = GlobalFunctions.TakaFormat(0);
|
||
oDRow["BasicPercent"] = 0;
|
||
}
|
||
|
||
#endregion
|
||
|
||
#region Non-Cash Benefit : Transport
|
||
if (itEmpHeads != null && itEmpHeads.Count > 0)
|
||
{
|
||
oITEmpHead = itEmpHeads.Where(x => x.EmployeeID == oEmp.ID).FirstOrDefault();
|
||
nAmount = GlobalFunctions.Round(oITEmpHead != null ? Convert.ToDouble(oITEmpHead.HouseRent) : 0);
|
||
GrandTotal = GrandTotal + nAmount;
|
||
//oDRow["VechilesPercent"] = GlobalFunctions.TakaFormat(oITEmpHead != null ? Convert.ToDouble(oITEmpHead.HouseRent) : 0);
|
||
oDRow["VechilesPercent"] = oITEmpHead != null ? Convert.ToDouble(oITEmpHead.HouseRent) : 0;
|
||
}
|
||
#endregion
|
||
}
|
||
|
||
#region Tax Deduct
|
||
if (tempPerquisite != null)
|
||
{
|
||
tempDr = tempPerquisite.AsEnumerable().FirstOrDefault(x => x.Field<Int32>("ItemGroup") == 3 && x.Field<Int32>("ItemCode") == -129 && x.Field<Int32>("ItemID") == -129 && x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
nAmount = GlobalFunctions.Round(tempDr != null ? Convert.ToDouble(tempDr["Amount"]) : 0);
|
||
}
|
||
tempDrs = dsPerquisite.Tables["EmpWiseBonus"].AsEnumerable().Where(x => x.Field<Int32>("Employeeid") == oEmp.ID);
|
||
bonusTax = 0;
|
||
if (tempDrs != null && tempDrs.Count() > 0)
|
||
{
|
||
foreach (DataRow dr in tempDrs)
|
||
{
|
||
bonusTax = GlobalFunctions.Round(dr != null ? Convert.ToDouble(dr["TaxAmount"]) : 0);
|
||
nAmount = nAmount + bonusTax;
|
||
}
|
||
|
||
}
|
||
|
||
//oDRow["TaxActualDeduct"] = GlobalFunctions.TakaFormat(nAmount);
|
||
oDRow["TaxActualDeduct"] = nAmount;
|
||
#endregion
|
||
|
||
//oDRow["TotalAnnualIncome"] = GlobalFunctions.TakaFormat(GrandTotal);
|
||
oDRow["TotalAnnualIncome"] = GrandTotal;
|
||
dTreport108.Rows.Add(oDRow);
|
||
nCount++;
|
||
|
||
|
||
}
|
||
}
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowDlgForReport177(null, dTreport108, payrollTypeId, reportType, SalaryMonthFrom.ToString("MMMM yyyy - ") + SalaryMonthTo.ToString("MMMM yyyy"), true);
|
||
}
|
||
|
||
public byte[] showScheduleGReport(DataTable dataTable, int payrollTypeId, TaxParameter tp)
|
||
{
|
||
PayrollDataSet.PayrollDataSet.ScheduleGReportDataTable dtScheduleG = new PayrollDataSet.PayrollDataSet.ScheduleGReportDataTable();
|
||
|
||
DataSet ds_ScheduleGReport = new DataSet();
|
||
int SlNo = 1;
|
||
foreach (DataRow row in dataTable.Rows)
|
||
{
|
||
DataRow newRow = dtScheduleG.NewRow();
|
||
|
||
newRow["SLNo"] = SlNo;
|
||
newRow["EmployeeId"] = row["employeeId"];
|
||
newRow["EmployeeNo"] = row["employeeNo"];
|
||
newRow["Name"] = row["name"];
|
||
newRow["Designation"] = row["designation"];
|
||
newRow["Department"] = row["department"];
|
||
newRow["TinNo"] = row["tinNo"];
|
||
newRow["returnSubmissionDate"] = row["returnSubmissionDate"];
|
||
newRow["Serial"] = row["serial"];
|
||
newRow["Circle"] = row["circle"];
|
||
newRow["Remarks"] = string.Empty;
|
||
newRow["TaxUnit"] = row["taxUnit"];
|
||
newRow["Email"] = row["email"];
|
||
|
||
dtScheduleG.Rows.Add(newRow);
|
||
SlNo++;
|
||
}
|
||
|
||
dtScheduleG.TableName = "PayrollDataSet_ScheduleGReport";
|
||
|
||
ds_ScheduleGReport.Tables.Add(dtScheduleG);
|
||
|
||
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
//return [];
|
||
|
||
return reportProcessor.ShowDlgForScheduleGReport(ds_ScheduleGReport, payrollTypeId, tp);
|
||
|
||
}
|
||
}
|
||
} |