3486 lines
189 KiB
C#
3486 lines
189 KiB
C#
using System;
|
||
using System.Collections.Generic;
|
||
using System.Data;
|
||
using System.Linq;
|
||
using Ease.Core.Model;
|
||
using HRM.BO;
|
||
using HRM.DA;
|
||
using Microsoft.Reporting.NETCore;
|
||
|
||
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;
|
||
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;
|
||
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 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;
|
||
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));
|
||
|
||
dTreport108.Rows.Add(oDRow);
|
||
nCount++;
|
||
|
||
}
|
||
}
|
||
ReportProcessor reportProcessor = new ReportProcessor();
|
||
return reportProcessor.ShowDlgForReport108(null, dTreport108, 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);
|
||
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[] 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();
|
||
DataRow dChallan = null;
|
||
dChallan = dTChallan.NewRow();
|
||
if (!ITStatus)
|
||
{
|
||
oTaxChallans = taxChallanService.Get(employeeId, nTaxParamID);
|
||
|
||
//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);
|
||
}
|
||
}
|
||
|
||
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);
|
||
if (companyName == "SGS Bangladesh Limited")
|
||
{
|
||
oTaxChallans = taxChallanService.GetByTaxParamId(nTaxParamID);
|
||
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;
|
||
}
|
||
}
|
||
|
||
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);
|
||
|
||
}
|
||
|
||
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 (companyName == "SGS Bangladesh Limited")
|
||
{
|
||
//if ((oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax) && oItem.ItemID != 4 && oItem.ItemID != 12)
|
||
//if ((oItem.Side == EnumIncomeTaxSide.Dec_GrossTax && oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment && oItem.ItemID == -210)
|
||
// || (oItem.Side == EnumIncomeTaxSide.Dec_GrossTax && oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate && oItem.ItemID == -227))
|
||
if (oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
{
|
||
oDRow = oDTable.NewRow();
|
||
//if (oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment)
|
||
if (oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
{
|
||
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);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
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);
|
||
|
||
}
|
||
}
|
||
|
||
|
||
#region SGS
|
||
|
||
//if (companyName == "SGS Bangladesh Limited")
|
||
//{
|
||
// double netAmmountSGS = ngrossTax;
|
||
// foreach (IncomeTax oItem in _incometaxes)
|
||
// {
|
||
// if (netAmmountSGS == 0)
|
||
// {
|
||
// break;
|
||
// }
|
||
// 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(oItem.TaxParameterID, _employee.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;
|
||
// }
|
||
// }
|
||
// if (oNetTaxPayable != null)
|
||
// {
|
||
// oDRow = oDTable.NewRow();
|
||
// oDRow["DataColumn1"] = oNetTaxPayable.Description;
|
||
// oDRow["DataColumn2"] = "";
|
||
// oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(netAmmountSGS);
|
||
// 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(netAmmountSGS);
|
||
// 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);
|
||
|
||
// }
|
||
// }
|
||
//}
|
||
//else
|
||
//{
|
||
// 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);
|
||
|
||
// }
|
||
// }
|
||
//}
|
||
|
||
#endregion SGS
|
||
|
||
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 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;
|
||
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);
|
||
}
|
||
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;
|
||
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);
|
||
}
|
||
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;
|
||
dr["AmountPerAnnum"] = GlobalFunctions.TakaFormat(oItem.TotalAmount); //oDRow["AmountPerannum"];
|
||
dr["ThisMonth"] = GlobalFunctions.TakaFormat(oItem.ThisMonthAmount);
|
||
dr["PaidTillDate"] = GlobalFunctions.TakaFormat(oItem.PreviousAmount);//oDRow["PaidTillDate"];
|
||
dr["Projected"] = GlobalFunctions.TakaFormat(oItem.ProjectedAmount);
|
||
dr["Position"] = oItem.Position;
|
||
dr["Side"] = oItem.Side;
|
||
if (!(oItem.ItemGroup == EnumIncomeTaxItemGroup.Company_Contri_PF))
|
||
{
|
||
_AmountPerAnnum += oItem.TotalAmount;
|
||
_ThisMonthAmount += oItem.ThisMonthAmount;
|
||
_PaidTillDateAmount += oItem.PreviousAmount;
|
||
_ProjectedAmount += oItem.ProjectedAmount;
|
||
|
||
}
|
||
_TAmountPerAnnum += oItem.TotalAmount;
|
||
_TThisMonthAmount += oItem.ThisMonthAmount;
|
||
_TPaidTillDateAmount += oItem.PreviousAmount;
|
||
_TProjectedAmount += oItem.ProjectedAmount;
|
||
dr["LessExaempted"] = "0";
|
||
dr["RowSequence"] = oItem.Position;
|
||
return dr;
|
||
}
|
||
}
|
||
|
||
public byte[] 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().Get(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);
|
||
|
||
//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("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 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().Get(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;
|
||
}
|
||
|
||
|
||
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 (companyName == "SGS Bangladesh Limited")
|
||
{
|
||
//if ((oItem.Side == EnumIncomeTaxSide.Inc_GrossTax || oItem.Side == EnumIncomeTaxSide.Dec_GrossTax) && oItem.ItemID != 4 && oItem.ItemID != 12)
|
||
if ((oItem.Side == EnumIncomeTaxSide.Dec_GrossTax && oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment && oItem.ItemID == -210)
|
||
|| (oItem.Side == EnumIncomeTaxSide.Dec_GrossTax && oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate && oItem.ItemID == -227))
|
||
{
|
||
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)
|
||
if (oItem.Side == EnumIncomeTaxSide.Dec_GrossTax)
|
||
oDRow["DataColumn3"] = "(" + GlobalFunctions.TakaFormat(oItem.TotalAmount) + ")";//.ToString("#,##")
|
||
|
||
else oDRow["DataColumn3"] = "(0.00)";
|
||
}
|
||
else
|
||
{
|
||
oDRow["DataColumn1"] = oItem.Description;
|
||
oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(oItem.TotalAmount);//.ToString("#,##");
|
||
}
|
||
oDRow["DataColumn2"] = "";
|
||
oDRow["EmpID"] = _employee.ID.ToString();
|
||
oDTable.Rows.Add(oDRow);
|
||
}
|
||
}
|
||
else
|
||
{
|
||
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);
|
||
}
|
||
}
|
||
|
||
////this condition is added for Sgs
|
||
//if (companyName == "SGS Bangladesh Limited")
|
||
//{
|
||
// double netAmmountSGS = ngrossTax;
|
||
// foreach (IncomeTax oItem in _incometaxes)
|
||
// {
|
||
// if (netAmmountSGS == 0)
|
||
// {
|
||
// break;
|
||
// }
|
||
// if ((oItem.Side == EnumIncomeTaxSide.Dec_GrossTax && oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Credit_On_Investment && oItem.ItemID == -210)
|
||
// || (oItem.Side == EnumIncomeTaxSide.Dec_GrossTax && oItem.ItemGroup == EnumIncomeTaxItemGroup.Tax_Gross_OtherRebate && oItem.ItemID == -227))
|
||
// netAmmountSGS = netAmmountSGS - oItem.TotalAmount;
|
||
// if (netAmmountSGS < 0 || (netAmmountSGS > 0 && netAmmountSGS < 5000))
|
||
// {
|
||
// DataTable dtTaxRegion = null;
|
||
|
||
// dtTaxRegion = new SGSExceptionReportService().GetTaxRegionDTByEmpId(oItem.TaxParameterID, _employee.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;
|
||
// }
|
||
// }
|
||
// if (oNetTaxPayable != null)
|
||
// {
|
||
// oDRow = oDTable.NewRow();
|
||
// oDRow["DataColumn1"] = oNetTaxPayable.Description;
|
||
// oDRow["DataColumn2"] = "";
|
||
// oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(netAmmountSGS);//.ToString("#,##");
|
||
// dNetTax = netAmmountSGS;
|
||
|
||
// oDRow["EmpID"] = _employee.ID.ToString();
|
||
// oDTable.Rows.Add(oDRow);
|
||
// }
|
||
|
||
// 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"] = GlobalFunctions.TakaFormat(netAmmountSGS);//.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(netAmmountSGS);
|
||
// oDRow["EmpID"] = _employee.ID.ToString();
|
||
// oDTable.Rows.Add(oDRow);
|
||
|
||
// oDRow = oDTable.NewRow();
|
||
// oDRow["DataColumn1"] = "Tax paid this month";
|
||
// oDRow["DataColumn2"] = "";
|
||
// oDRow["DataColumn3"] = GlobalFunctions.TakaFormat(netAmmountSGS);
|
||
// 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 - netAmmountSGS);
|
||
// }
|
||
// oDTable.Rows.Add(oDRow);
|
||
// }
|
||
// }
|
||
|
||
//}
|
||
//else
|
||
//{
|
||
//}
|
||
|
||
|
||
|
||
|
||
oDTable.TableName = "PayrollDataSet_IncomeTaxOther";
|
||
orootDataset.Tables.Add(oDTable);
|
||
|
||
//PayrollDataSet.PayrollDataSet.ITHeaderDataTable oMulIT = new Payroll.Report.PayrollDataSet.PayrollDataSet.ITHeaderDataTable();
|
||
//Employee oEmp = Employee.Get(nEmpID);
|
||
//oDRow = oMulIT.NewRow();
|
||
//oDRow["EmpNo"] = oEmp.EmployeeNo;
|
||
//oDRow["EmpName"] = oEmp.Name;
|
||
//oDRow["TINNo"] = oEmp.TinNo;
|
||
//oDRow["AssesmentYear"] = _taxParameter.AssessmentYear;
|
||
//oDRow["FiscalYear"] = _taxParameter.FiscalYear;
|
||
//oMulIT.Rows.Add(oDRow);
|
||
//oMulIT.TableName = "PayrollDataSet_ITHeader";
|
||
//orootDataset.Tables.Add(oMulIT);
|
||
|
||
|
||
return orootDataset;
|
||
}
|
||
private DataRow getARow(DataRow orow, IncomeTax oItem, 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 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);
|
||
}
|
||
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 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;
|
||
}
|
||
}
|
||
} |