CEL_Payroll/Payroll.Report/UI/FSReport.cs

965 lines
43 KiB
C#
Raw Permalink Normal View History

2024-09-17 14:30:13 +06:00
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using Payroll.BO;
using Ease.CoreV35.Model;
using Ease.CoreV35;
using Microsoft.Reporting.WinForms;
using Ease.CoreV35.DataAccess;
using Payroll.Service;
namespace Payroll.Report
{
public partial class FSReport : Form
{
double nTotalTaka = 0.0;
ObjectsTemplate<FSTran> oFSTrans = new ObjectsTemplate<FSTran>();
private ReportItem _reportitem = null;
private EnumReportType _reportType = EnumReportType.None;
private EnumReportType _Type = EnumReportType.None;
ObjectsTemplate<FSTranDetail> oItemDetails = new ObjectsTemplate<FSTranDetail>();
ObjectsTemplate<Department> _oDepartments = new ObjectsTemplate<Department>();
int _nEmpID = 0;
double dues;
double less;
double amt1 = 0.0;
double amt2 = 0.0;
double amt3 = 0.0;
string sDivision = "";
string sDepartment = "";
string sUnit = "";
double nFracAmount = 0.0;
double nGrossAmount = 0.0;
double _nGrossPaid = 0;
private double _Amount = 0;
private EnumAllowOrDeduct _ADType = EnumAllowOrDeduct.Allowance;
Employee _oEmp = null;
public FSReport()
{
InitializeComponent();
}
public void ShowDlg(DateTime dt, int nEmpID)
{
dtpFrom.Value = dt;
dtpTo.Value = dt;
_nEmpID = nEmpID;
this.ShowDialog();
}
public EnumReportType Type
{
set
{
_Type = value;
}
}
private void btnRefresh_Click(object sender, EventArgs e)
{
lvwFss.Items.Clear();
Employee oEmp = new Employee();
ListViewItem li;
if (rdoSettleDate.Checked)
oFSTrans = FSTran.Get(dtpFrom.Value, dtpTo.Value, 1, "");
else if (rdoDiscontinueDate.Checked)
oFSTrans = FSTran.Get(dtpFrom.Value, dtpTo.Value, 2, "");
else if (rdoBatchNumber.Checked)
oFSTrans = FSTran.Get(dtpFrom.Value, dtpTo.Value, 3, txtBatchNumber.Text);
foreach (FSTran oItem in oFSTrans)
{
li = new ListViewItem();
oEmp = Employee.Get(oItem.EmployeeID);
if (oEmp.PayrollTypeID == Payroll.BO.SystemInformation.CurrentSysInfo.PayrollTypeID)
{
li.Text = oEmp.EmployeeNo;
li.SubItems.Add(oEmp.Name);
li.SubItems.Add(oItem.SettlementDate.ToString("dd MMM yyyy"));
li.SubItems.Add(oItem.DiscontinueDate.ToString("dd MMM yyyy"));
li.Tag = oItem;
lvwFss.Items.Add(li);
}
}
//if (_nEmpID > 0)
//{
// lvwFss.Items[0].Selected = true;
// btnPreview_Click(null, null);
// this.Close();
//}
}
private void btnClose_Click(object sender, EventArgs e)
{
this.Close();
}
private void FindDivisionDeparmentUnit(Department department)
{
sDivision = "";
sDepartment = "";
sUnit = "";
Department oItem = new Department();
if (department.Tier == 4)
{
oItem = _oDepartments.Find(delegate(Department dept) { return dept.ID == department.ParentID; });
sUnit = oItem.Name;
oItem = _oDepartments.Find(delegate(Department dept) { return dept.ID == department.ParentID; });
sDepartment = oItem.Name;
oItem = _oDepartments.Find(delegate(Department dept) { return dept.ID == oItem.ParentID; });
sDivision = oItem.Name;
}
else if (department.Tier == 3)
{
oItem = _oDepartments.Find(delegate(Department dept) { return dept.ID == department.ParentID; });
sDepartment = oItem.Name;
oItem = _oDepartments.Find(delegate(Department dept) { return dept.ID == department.ParentID; });
sDivision = oItem.Name;
}
else if (department.Tier == 2)
{
sDepartment = oItem.Name;
oItem = _oDepartments.Find(delegate(Department dept) { return dept.ID == department.ParentID; });
sDivision = oItem.Name;
}
else if (department.Tier == 1)
{
sDivision = department.Name;
}
}
private void btnPreview_Click(object sender, EventArgs e)
{
Cursor.Current = Cursors.WaitCursor;
DataRow dRow = null;
FSTran oItem = new FSTran();
if (lvwFss.SelectedItems.Count > 0)
{
oItem = (FSTran)lvwFss.SelectedItems[0].Tag;
}
else
{
MessageBox.Show("Please select an item");
return;
}
oItemDetails = FSTranDetail.GetDetail(oItem.ID);
_oEmp = new Employee();
_oEmp = Employee.Get(oItem.EmployeeID);
ObjectsTemplate<ADParameter> adParams = ADParameter.Get(_oEmp.GradeID, EnumEntitleType.Grade, EnumAllowOrDeduct.Allowance);
ObjectsTemplate<ADParameterEmployee> adParamEmps = ADParameterEmployee.GetByEmployee(_oEmp.ID, EnumAllowOrDeduct.Allowance, EnumADEmpType.AppliedToIndividual);
EmployeeGradeSalary ogs = EmployeeGradeSalary.GetBasicOnDate(_oEmp.ID, oItem.DiscontinueDate);
ObjectsTemplate<GrossDefination> grossDefinitions = GrossDefination.Get();
_nGrossPaid = BonusCalculator.GetMonthlyGrossAmount(_oEmp, adParams, adParamEmps, grossDefinitions, oItem.DiscontinueDate, ogs);
SalaryMonthly lastSalaryMonthly = SalaryMonthly.GetLastSalaryMonthDetails(_oEmp.ID);
#region Old Code
//dues = 0.0;
//less = 0.0;
//double nAddCount = 0;
//double nDeductCount = 0;
//double nAmount = 0.0;
//double nDeductAmount = 0.0;
//double nTaxAmount = 0.0;
//double nNetAmount = 0.0;
//double nReceivable = 0.0;
//double nPayable = 0.0;
//double nTotal = 0.0;
//double nALBalance = 0.0;
//double nEncashDays = 0.0;
//List<ReportDataSource> dataSource;
//Grade oGrade = new Grade();
//EmployeeHistory oEmployeeHistory = new EmployeeHistory();
//_oDepartments = Department.Get();
//FindDivisionDeparmentUnit(oEmp.Department);
//DataTable oBody = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSEmpDataTable();
//DataTable oBody1 = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSSAddItemDataTable();
//DataTable oBody2 = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSSDeductItemDataTable();
//dataSource = new List<ReportDataSource>();
//string sRequiredDays = oEmp.IsConfirmed ? oEmp.Grade.RequiredDays.ToString() + " Month(s)" : "15 Day(s)";
//oBody.Rows.Add("(Employee ID :" + oEmp.EmployeeNo + ") " + oEmp.Name, oEmp.Designation.Name, sDivision, sDepartment, sUnit, oEmp.Location.Name, oEmp.JoiningDate.ToString("dd MMM yyyy"), oEmp.Status.ToString(), oItem.NoticeDate.ToString("dd MMM yyyy"), oItem.DiscontinueDate.ToString("dd MMM yyyy"), sRequiredDays, oItem.ShortNoticePeriod.ToString(), oEmp.ServiceLengthsInWords((DateTime)oEmp.EndOfContractDate), oEmp.EmployeeNo);
//string embeddedResource = "Payroll.Report.RDLC.fsReport.rdlc";
//string caption = "Final Settlement Report";
//dataSource.Add(new ReportDataSource("dsEmpLeaveLedger_FSEmp", oBody));
//amt1 = 0.0;
//amt2 = 0.0;
//amt3 = 0.0;
////Gross Salary
//nGrossAmount = 0;
//DataRow drG = GetGrossSalary(oEmp, oBody1.NewRow(), "Gross Salary", EnumFSItemCode.Gross, EnumSide.Add);
//if (nGrossAmount == 0)
//{
// nGrossAmount = 0;
// drG = GetGrossSalary(oEmp, oBody2.NewRow(), "Gross Salary", EnumFSItemCode.Gross, EnumSide.Deduct);
//}
//else
//{
// nGrossAmount = 0;
// oBody1.Rows.Add(drG);
// nAddCount++;
//}
//if (nGrossAmount < 0)
//{
// oBody2.Rows.Add(drG);
// nDeductCount++;
//}
////Fractionate Salary
//nFracAmount = 0;
//DataRow dr = GetFracSalary(oEmp, oBody1.NewRow(), "Fractionate Salary", EnumFSItemCode.FractionateSalary, EnumSide.Add);
//if (nFracAmount == 0)
//{
// nFracAmount = 0;
// dr = GetFracSalary(oEmp, oBody2.NewRow(), "Fractionate Salary", EnumFSItemCode.FractionateSalary, EnumSide.Deduct);
//}
//else
//{
// nFracAmount = 0;
// oBody1.Rows.Add(dr);
// nAddCount++;
//}
//if (nFracAmount < 0)
//{
// oBody2.Rows.Add(dr);
// nDeductCount++;
//}
////OPI
//dr = GetFracSalary(oEmp, oBody1.NewRow(), "OPI", EnumFSItemCode.OPI, EnumSide.Add);
//if (nFracAmount == 0)
//{
// nFracAmount = 0;
// dr = GetFracSalary(oEmp, oBody2.NewRow(), "OPI", EnumFSItemCode.OPI, EnumSide.Deduct);
//}
//else
//{
// oBody1.Rows.Add(dr);
// nAddCount++;
//}
//if (nFracAmount < 0)
//{
// oBody2.Rows.Add(dr);
// nDeductCount++;
//}
////nAddCount++;
////if (Convert.ToDouble(dr[1].ToString()) > 0)
////{
//// oBody1.Rows.Add(dr);
//// nAddCount++;
////}
//oItemDetails.RemoveAll(delegate(FSTranDetail dta) { return dta.ItemCode == EnumFSItemCode.OPI; });
////Rest Items
//foreach (FSTranDetail fd in oItemDetails)
//{
// if (fd.AmountType == EnumValueType.Amount)
// {
// if (fd.ItemCode != EnumFSItemCode.FractionateSalary)
// {
// if (fd.ItemCode != EnumFSItemCode.Gross)
// {
// if (fd.FsTranType == EnumFSTranType.Fraction)
// {
// oBody1.Rows.Add(fd.Description, Math.Abs(fd.ChangedValue));
// amt1 += Math.Abs(fd.Amount);
// nAddCount++;
// }
// else if (fd.FsTranType == EnumFSTranType.Fraction)
// {
// oBody2.Rows.Add(fd.Description, Math.Abs(fd.ChangedValue));
// amt2 += Math.Abs(fd.Amount);
// nDeductCount++;
// }
// }
// }
// }
//}
//if (nAddCount > nDeductCount)
//{
// for (int i = 0; i < nAddCount - nDeductCount; i++)
// {
// oBody2.Rows.Add("", 0.0);
// }
//}
//if (nDeductCount > nAddCount)
//{
// for (int i = 0; i <= nDeductCount - nAddCount; i++)
// {
// oBody1.Rows.Add("", 0.0);
// }
//}
//dataSource.Add(new ReportDataSource("dsEmpLeaveLedger_FSSAddItem", oBody1));
//dataSource.Add(new ReportDataSource("dsEmpLeaveLedger_FSSDeductItem", oBody2));
//Cursor.Current = Cursors.WaitCursor;
//try
//{
// fReportViewer fViewer = new fReportViewer();
// fViewer.PreviewReport(_reportitem, dataSource, embeddedResource, caption);
//}
//catch (Exception exp)
//{
// throw new Exception(exp.Message);
//}
#endregion
fReportViewer form = new fReportViewer();
DataSet dSet = new DataSet();
DataTable dTable = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSEmpNewDataTable();
dRow = dTable.NewRow();
dRow["EmpNo"] = _oEmp.EmployeeNo;
dRow["EmpName"] = _oEmp.Name;
dRow["BasicSalary"] = Math.Round(lastSalaryMonthly.ThisMonthBasic);
dRow["Grade"] = _oEmp.Grade.Name;
dRow["JoiningDate"] = (_oEmp.JoiningDate).ToString("dd MMM yyyy");
dRow["LastWorkingDay"] = ((DateTime)_oEmp.EndOfContractDate).ToString("dd MMM yyyy");
dRow["PaperReceivedDay"] = (oItem.NoticeDate).ToString("dd MMM yyyy");
dRow["Designation"] = _oEmp.Designation == null ? "" : _oEmp.Designation.Name;
dRow["Department"] = _oEmp.Department == null ? "" : _oEmp.Department.Name;
dRow["Location"] = _oEmp.Location == null ? "" : _oEmp.Location.Name;
//EmployeeCostCenter cc = (EmployeeCostCenter.GetByEmpID(_oEmp.ID)).Find(x => x.IsCurrentCC == true);
dRow["CostCenter"] = _oEmp.Department == null ? "" : _oEmp.Department.RCCode;
dRow["Status"] = _oEmp.Category == null ? "" : _oEmp.Category.Name;
dRow["YearServed"] = _oEmp.ServiceLengthsInWords((DateTime)_oEmp.EndOfContractDate);
dRow["LastPaidMonth"] = lastSalaryMonthly.SalaryMonth.ToString("dd MMM yyyy");
dRow["BatchNumber"] = oItem.BatchNumber;
dRow["GrossSalary"] = Math.Round(_nGrossPaid);
dRow["Allowances"] = Math.Round(_nGrossPaid - _oEmp.BasicSalary);
dRow["Bank"] = _oEmp.BranchID==null?"": _oEmp.Branch.BankID==null?"":_oEmp.Branch.Bank.Name;
dRow["AccountNo"] = _oEmp.AccountNo;
dTable.Rows.Add(dRow);
dTable.TableName = "dsEmpLeaveLedger_FSEmpNew";
dSet.Tables.Add(dTable);
DataTable dTableAdd = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSAddItemNewDataTable();
DataTable dTableDeduct = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSDeductItemNewDataTable();
DataTable dTablePFDetails = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSPFDetailsDataTable();
DataTable dTableWPPFDetails = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSWPPFDetailsDataTable();
DataTable dTablePaymentItem = new Payroll.Report.PayrollDataSet.dsEmpLeaveLedger.FSPaymentItemDataTable();
//Entitle Payment
FSTranDetail Epd = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.EntitlePayment && x.AmountType==EnumValueType.Other);
FSTranDetail Ep = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.EntitlePayment && x.AmountType == EnumValueType.Amount);
if (Epd != null && Ep != null)
{
dRow = dTablePaymentItem.NewRow();
dRow["Description"] = Ep.Description;
dRow["Amount"] = Ep.ChangedValue;
dRow["PaymentMode"] = Epd.Description;
dTablePaymentItem.Rows.Add(dRow);
}
//PF Payment
FSTranDetail PFpd = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.PFPayment && x.AmountType == EnumValueType.Other);
FSTranDetail PFp = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.PFPayment && x.AmountType == EnumValueType.Amount);
if (PFpd != null && PFp != null)
{
dRow = dTablePaymentItem.NewRow();
dRow["Description"] = PFp.Description;
dRow["Amount"] = PFp.ChangedValue;
dRow["PaymentMode"] = PFpd.Description;
dTablePaymentItem.Rows.Add(dRow);
}
//GF Payment
//VRS
FSTranDetail vrs = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.VRS && x.AmountType == EnumValueType.Amount);
//FSTranDetail vrsDay = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.VRS && x.AmountType == EnumValueType.Other);
double nVRSAmount = 0;
if (vrs != null&& vrs.ChangedValue > 0)
{
nVRSAmount = vrs.ChangedValue;
}
FSTranDetail GFpd = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.GFPayment && x.AmountType == EnumValueType.Other);
FSTranDetail GFp = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.GFPayment && x.AmountType == EnumValueType.Amount);
if (GFpd != null && GFp != null)
{
dRow = dTablePaymentItem.NewRow();
dRow["Description"] = GFp.Description;
dRow["Amount"] = GFp.ChangedValue + nVRSAmount;
dRow["PaymentMode"] = GFpd.Description;
dTablePaymentItem.Rows.Add(dRow);
}
//WPPF Payment
FSTranDetail WPPFpd = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.WPPFPayment && x.AmountType == EnumValueType.Other);
FSTranDetail WPPFp = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.WPPFPayment && x.AmountType == EnumValueType.Amount);
if ( WPPFpd != null && WPPFp != null )
{
dRow = dTablePaymentItem.NewRow();
dRow["Description"] = WPPFp.Description;
dRow["Amount"] = WPPFp.ChangedValue;
dRow["PaymentMode"] = WPPFpd.Description;
dTablePaymentItem.Rows.Add(dRow);
}
//Fractionate Salary
FSTranDetail fractionateSalary = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.FractionateSalary && x.AmountType == EnumValueType.Amount);
FSTranDetail fractionateSalaryDay = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.FractionateSalary && x.AmountType == EnumValueType.Other);
if (fractionateSalary != null && fractionateSalaryDay != null && fractionateSalary.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = fractionateSalary.Description + " ( " + fractionateSalaryDay.ChangedValue.ToString() + " Day/s )";
dRow["AddAmount"] = fractionateSalary.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
//LeaveEncashment
FSTranDetail leaveEncashment = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.LeaveEncashment && x.AmountType == EnumValueType.Amount);
FSTranDetail leaveEncashmentDay = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.LeaveEncashment && x.AmountType == EnumValueType.Other);
if (leaveEncashment != null && leaveEncashmentDay != null && leaveEncashment.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = leaveEncashment.Description + " ( " + leaveEncashmentDay.ChangedValue.ToString() + " Day/s )";
dRow["AddAmount"] = leaveEncashment.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
//Festive Bonus
FSTranDetail festiveBonus = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.FestiveBonus && x.AmountType == EnumValueType.Amount);
if (festiveBonus != null && festiveBonus.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = festiveBonus.Description;
dRow["AddAmount"] = festiveBonus.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
//Quarterly Bonus
FSTranDetail quarterlyBonus = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.QuarterlyBonus && x.AmountType == EnumValueType.Amount);
if (quarterlyBonus!=null && quarterlyBonus.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = quarterlyBonus.Description ;
dRow["AddAmount"] = quarterlyBonus.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
//OT
FSTranDetail ot = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.OT && x.AmountType == EnumValueType.Amount);
if (ot!=null && ot.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = ot.Description;
dRow["AddAmount"] = ot.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
//Other
FSTranDetail other = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.Other && x.AmountType == EnumValueType.Amount);
if (other!=null && other.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = other.Description;
dRow["AddAmount"] = other.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
//Car/Fuel
FSTranDetail carFuel = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.CarFuel && x.AmountType == EnumValueType.Amount);
if (carFuel!=null && carFuel.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = carFuel.Description;
dRow["AddAmount"] = carFuel.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
//PF
FSTranDetail pf = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.PF && x.AmountType == EnumValueType.Amount);
if (pf!=null && pf.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = pf.Description;
dRow["AddAmount"] = pf.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
//GF
FSTranDetail gf = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.GF && x.AmountType == EnumValueType.Amount);
if (gf != null && gf.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = gf.Description;
dRow["AddAmount"] = gf.ChangedValue+nVRSAmount;
dTableAdd.Rows.Add(dRow);
}
//WPPF
FSTranDetail wppf = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.WPPF && x.AmountType == EnumValueType.Amount);
if (wppf!=null && wppf.ChangedValue > 0)
{
dRow = dTableAdd.NewRow();
dRow["AddDescription"] = wppf.Description;
dRow["AddAmount"] = wppf.ChangedValue;
dTableAdd.Rows.Add(dRow);
}
FSTranDetail pfOwn = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.PF && x.AmountType == EnumValueType.Other && x.Description == "PF - Own Contribution");
if (pfOwn != null)
{
dRow = dTablePFDetails.NewRow();
dRow["PFOwn"] = pfOwn.ChangedValue;
dTablePFDetails.Rows.Add(dRow);
}
FSTranDetail pfCompany = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.PF && x.AmountType == EnumValueType.Other && x.Description == "PF - Company Contribution");
if (pfCompany != null)
{
dRow = dTablePFDetails.NewRow();
dRow["PFCompany"] = pfCompany.ChangedValue;
dTablePFDetails.Rows.Add(dRow);
}
FSTranDetail pfLoan = oItemDetails.Find(x => x.ItemCode == EnumFSItemCode.PF && x.AmountType == EnumValueType.Other && x.Description == "PF - Loan Amount Deduction");
if (pfLoan != null)
{
dRow = dTablePFDetails.NewRow();
dRow["PFLoan"] = pfLoan.ChangedValue;
dTablePFDetails.Rows.Add(dRow);
}
foreach (FSTranDetail item in oItemDetails)
{
if (item.ItemCode == EnumFSItemCode.Deduction && item.AmountType == EnumValueType.Other)
{
dRow = dTableDeduct.NewRow();
dRow["DeductDescription"] = item.Description;
dRow["DeductAmount"] = item.ChangedValue;
dTableDeduct.Rows.Add(dRow);
}
//else if((item.ItemCode == EnumFSItemCode.FractionateSalary ||
// item.ItemCode == EnumFSItemCode.LeaveEncashment ||
// item.ItemCode == EnumFSItemCode.QuarterlyBonus ||
// item.ItemCode == EnumFSItemCode.FestiveBonus ||
// item.ItemCode == EnumFSItemCode.GF ||
// item.ItemCode == EnumFSItemCode.OT ||
// item.ItemCode == EnumFSItemCode.PF ||
// item.ItemCode == EnumFSItemCode.WPPF ||
// item.ItemCode == EnumFSItemCode.Other ||
// item.ItemCode == EnumFSItemCode.VRS ||
// item.ItemCode == EnumFSItemCode.CarFuel) && item.AmountType == EnumValueType.Amount)
//{
// if (item.ChangedValue > 0)
// {
// dRow = dTableAdd.NewRow();
// dRow["AddDescription"] = item.Description;
// dRow["AddAmount"] = item.ChangedValue;
// dTableAdd.Rows.Add(dRow);
// }
//}
//else if (item.ItemCode == EnumFSItemCode.PF && item.AmountType == EnumValueType.Other)
//{
// //if (item.ChangedValue > 0)
// //{
// dRow = dTablePFDetails.NewRow();
// dRow["Description"] = item.Description;
// dRow["Amount"] = item.ChangedValue;
// dTablePFDetails.Rows.Add(dRow);
// //}
//}
else if (item.ItemCode == EnumFSItemCode.WPPF && item.AmountType == EnumValueType.Other)
{
if (item.ChangedValue > 0)
{
dRow = dTableWPPFDetails.NewRow();
dRow["Description"] = item.Description;
dRow["Amount"] = item.ChangedValue;
dTableWPPFDetails.Rows.Add(dRow);
}
}
}
//if (dTablePaymentItem.Rows.Count>dTableDeduct.Rows.Count)
//{
// int nCount = dTablePaymentItem.Rows.Count - dTableDeduct.Rows.Count;
// for(int i=0;i<nCount;i++)
// {
// dTableDeduct.Rows.Add("", 0);
// }
//}
if (dTableAdd.Rows.Count > dTableDeduct.Rows.Count)
{
for (int i = 0; i < dTableAdd.Rows.Count - dTableDeduct.Rows.Count; i++)
dTableDeduct.Rows.Add("",0);
}
dTableAdd.TableName = "dsEmpLeaveLedger_FSAddItemNew";
dSet.Tables.Add(dTableAdd);
dTableDeduct.TableName = "dsEmpLeaveLedger_FSDeductItemNew";
dSet.Tables.Add(dTableDeduct);
dTablePFDetails.TableName = "dsEmpLeaveLedger_FSPFDetails";
dSet.Tables.Add(dTablePFDetails);
dTableWPPFDetails.TableName = "dsEmpLeaveLedger_FSWPPFDetails";
dSet.Tables.Add(dTableWPPFDetails);
dTablePaymentItem.TableName = "dsEmpLeaveLedger_FSPaymentItem";
dSet.Tables.Add(dTablePaymentItem);
//List<ReportParameter> parameters = new List<ReportParameter>();
//parameters.Add(new ReportParameter("BankName", _selectedParameter.Banks[0].Name));
form.CommonReportView(null, dSet, "Payroll.Report.RDLC.fsReportNew.rdlc", null);
}
private DataTable TakaInWords(DataTable dt2)
{
DataRow oRow = dt2.NewRow();
string tk = Ease.CoreV35.Utility.Global.NumericFunctions.TakaWords(GlobalFunctions.Round(dues - less));
oRow[0] = tk.Replace("Taka", " BDT");
dt2.Rows.Add(oRow);
return dt2;
}
private void FSReport_Load(object sender, EventArgs e)
{
this._reportType = _Type;
_reportitem = ReportItem.Get(ID.FromInteger(Convert.ToInt32(_reportType)));
rdoSettleDate.Checked = true;
btnRefresh_Click(null, null);
}
private DataTable GetSalaryComponent(Employee oEmp, DataTable dt2)
{
//DataRow oRow = dt2.NewRow();
//oRow[0] = GlobalFunctions.TakaFormat(oEmp.BasicSalary);
//oRow[9] = GlobalFunctions.TakaFormat(oEmp.BasicSalary*3);
//ObjectsTemplate<ADParameter> _oADParameters = ADParameter.Get(EnumStatus.Active, ID.FromInteger(14));
//List<ADParameter> _ADParameters = ADParameter.GetApplicableParameters(oEmp, oEmp.GradeID, _oADParameters);
//oRow[10] = GlobalFunctions.TakaFormat(_ADParameters[0].FlatAmount);
//ObjectsTemplate<ADParameter> adParams = ADParameter.Get(oEmp.GradeID, EnumEntitleType.Grade, EnumAllowOrDeduct.Allowance);
//if (adParams != null)
//{
// foreach (ADParameter adParam in adParams)
// {
// double nAmt = 0.0;
// nAmt = adParam.GetGradeDefinedAmount(oEmp, oEmp.BasicSalary, oEmp.GrossSalary);
// if (adParam.AllowDeductID.Integer == 3)
// oRow[1] =GlobalFunctions.TakaFormat(nAmt);
// else if (adParam.AllowDeductID.Integer == 9)
// oRow[2] = GlobalFunctions.TakaFormat(nAmt);
// else if (adParam.AllowDeductID.Integer == 5)
// oRow[3] = GlobalFunctions.TakaFormat(nAmt);
// else if (adParam.AllowDeductID.Integer == 41)
// oRow[4] = GlobalFunctions.TakaFormat(nAmt);
// else if (adParam.AllowDeductID.Integer == 4)
// oRow[5] = GlobalFunctions.TakaFormat(nAmt);
// else if (adParam.AllowDeductID.Integer == 6)
// oRow[6] = GlobalFunctions.TakaFormat(nAmt);
// else if (adParam.AllowDeductID.Integer ==7)
// oRow[7] = GlobalFunctions.TakaFormat(nAmt);
// else if (adParam.AllowDeductID.Integer == 8)
// oRow[8] = GlobalFunctions.TakaFormat(nAmt);
// nTotalTaka += GlobalFunctions.Round(nAmt);
// }
//}
//dt2.Rows.Add(oRow);
return dt2;
}
private DataTable GetPreviledgeLeave(Employee oEmp, DataTable dt2)
{
//DataRow oRow = dt2.NewRow();
//foreach (FSTranDetail fd in oItemDetails)
//{
// if (fd.ItemCode == EnumFSItemCode.Provision)
// continue;
// if (fd.ChangedValue > 0)
// {
// if (fd.ItemCode == EnumFSItemCode.Leave && fd.ItemID == -101 && fd.AmountType == EnumValueType.Amount)
// {
// oRow[0] = GlobalFunctions.TakaFormat(fd.ChangedValue);
// dues += GlobalFunctions.Round(fd.ChangedValue);
// }
// else if (fd.ItemCode == EnumFSItemCode.Leave && fd.ItemID == 3 && fd.AmountType == EnumValueType.Amount)
// {
// oRow[1] = GlobalFunctions.TakaFormat(fd.ChangedValue);
// dues += GlobalFunctions.Round(fd.ChangedValue);
// }
// else if (fd.ItemCode == EnumFSItemCode.Leave && fd.ItemID == 9 && fd.AmountType == EnumValueType.Amount)
// {
// oRow[2] = GlobalFunctions.TakaFormat(fd.ChangedValue);
// dues += GlobalFunctions.Round(fd.ChangedValue);
// }
// else if (fd.ItemCode == EnumFSItemCode.Leave && fd.ItemID == 5 && fd.AmountType == EnumValueType.Amount)
// {
// oRow[3] = GlobalFunctions.TakaFormat(fd.ChangedValue);
// dues += GlobalFunctions.Round(fd.ChangedValue);
// }
// else if (fd.ItemCode == EnumFSItemCode.Leave && fd.ItemID == 41 && fd.AmountType == EnumValueType.Amount)
// {
// oRow[4] = GlobalFunctions.TakaFormat(fd.ChangedValue);
// dues += GlobalFunctions.Round(fd.ChangedValue);
// }
// else if (fd.ItemCode == EnumFSItemCode.Leave && fd.ItemID == -101 && fd.AmountType == EnumValueType.Other)
// {
// oRow[5] = GlobalFunctions.TakaFormat(fd.ChangedValue);
// }
// nTotalTaka += GlobalFunctions.Round(fd.ChangedValue);
// }
//}
//dt2.Rows.Add(oRow);
return dt2;
}
private DataRow GetFracSalary(Employee oEmp, DataRow dr, string sName, EnumFSItemCode eItemCode, EnumSide eSide)
{
double nAmount = 0.0;
foreach (FSTranDetail fd in oItemDetails)
{
if (fd.ItemCode == EnumFSItemCode.Provision)
continue;
if (fd.Side == eSide)
{
if (fd.ItemCode == eItemCode && fd.AmountType == EnumValueType.Amount)
{
nAmount += Math.Abs(fd.ChangedValue);
}
}
}
amt1 += Math.Abs(nAmount);
dr[0] = sName;
dr[1] = GlobalFunctions.TakaFormat(Math.Abs(nAmount));
nFracAmount = Math.Abs(nAmount);
return dr;
}
public double GetGross(Employee emp)
{
try
{
ObjectsTemplate<ADParameter> adParams = null;
ObjectsTemplate<ADParameterEmployee> adParamEmps = null;
_Amount = 0;
_Amount += emp.BasicSalary;
adParams = ADParameter.Get(emp.GradeID, EnumEntitleType.Grade, _ADType);
if (adParams != null)
{
foreach (ADParameter adParam in adParams)
{
_Amount += adParam.GetGradeDefinedAmount(emp, emp.BasicSalary, emp.GrossSalary);
}
}
adParamEmps = ADParameterEmployee.GetByEmployee(emp.ID, _ADType, EnumADEmpType.AppliedToIndividual);
if (adParamEmps != null)
{
foreach (ADParameterEmployee adEmp in adParamEmps)
{
_Amount += adEmp.MonthlyAmount;
}
}
return _Amount;
}
catch (Exception ex)
{
return _Amount;
}
}
private DataRow GetGrossSalary(Employee oEmp, DataRow dr, string sName, EnumFSItemCode eItemCode, EnumSide eSide)
{
double nAmount = 0.0;
foreach (FSTranDetail fd in oItemDetails)
{
if (fd.ItemCode == EnumFSItemCode.Provision)
continue;
if (fd.Side == eSide)
{
if (fd.ItemCode == eItemCode && fd.AmountType == EnumValueType.Amount)
{
nAmount += Math.Abs(fd.ChangedValue);
}
}
}
amt1 += Math.Abs(nAmount);
dr[0] = sName;
dr[1] = GlobalFunctions.TakaFormat(Math.Abs(nAmount));
nGrossAmount = Math.Abs(nAmount);
return dr;
}
private DataTable GetItems(Employee oEmp, DataTable dt2, EnumSide eside)
{
ObjectsTemplate<FSTranDetail> details = new ObjectsTemplate<FSTranDetail>();
details = oItemDetails;
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Gross; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.FractionateSalary; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Leave; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.PF; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.CPF; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Gratuity; });
foreach (FSTranDetail fd in details)
{
if (fd.ItemCode == EnumFSItemCode.Provision)
continue;
if (fd.ItemCode != EnumFSItemCode.Other)
{
if (fd.ChangedValue > 0)
{
if (fd.Side == eside && fd.AmountType == EnumValueType.Amount)
{
DataRow oRow = dt2.NewRow();
oRow[0] = fd.Description;
oRow[1] = GlobalFunctions.TakaFormat(fd.ChangedValue);
nTotalTaka += GlobalFunctions.Round(fd.ChangedValue);
dues += GlobalFunctions.Round(fd.ChangedValue);
dt2.Rows.Add(oRow);
}
}
}
}
return dt2;
}
private DataTable GetItemsWithOther(Employee oEmp, DataTable dt2, EnumSide eside)
{
ObjectsTemplate<FSTranDetail> details = new ObjectsTemplate<FSTranDetail>();
details = oItemDetails;
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Gross; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.FractionateSalary; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Leave; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.PF; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.CPF; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Gratuity; });
foreach (FSTranDetail fd in details)
{
if (fd.ItemCode == EnumFSItemCode.Provision)
continue;
if (fd.ChangedValue > 0)
{
if (fd.Side == eside && fd.AmountType == EnumValueType.Amount)
{
if (fd.ItemCode == EnumFSItemCode.Loan && fd.ItemID == 1)
continue;
else
{
FSTranDetail item = null;
if (fd.ItemCode == EnumFSItemCode.NoticePay)
item = details.Find(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.NoticePay && td.AmountType == EnumValueType.Other; });
DataRow oRow = dt2.NewRow();
oRow[0] = item == null ? fd.Description : fd.Description + " " + item.ChangedValue + " day(s)";
oRow[1] = GlobalFunctions.TakaFormat(fd.ChangedValue);
nTotalTaka -= GlobalFunctions.Round(fd.ChangedValue);
less += GlobalFunctions.Round(fd.ChangedValue);
dt2.Rows.Add(oRow);
}
}
}
}
return dt2;
}
private void rdoSettleDate_CheckedChanged(object sender, EventArgs e)
{
if (rdoSettleDate.Checked)
HideControls(true);
else
HideControls(false);
}
private void rdoDiscontinueDate_CheckedChanged(object sender, EventArgs e)
{
if (rdoDiscontinueDate.Checked)
HideControls(true);
else
HideControls(false);
}
private void rdoBatchNumber_CheckedChanged(object sender, EventArgs e)
{
if (rdoBatchNumber.Checked)
HideControls(false);
else
HideControls(true);
}
private void HideControls(bool sts)
{
dtpFrom.Enabled = sts;
dtpTo.Enabled = sts;
txtBatchNumber.Enabled = !sts;
}
private DataTable GetOtherItems(Employee oEmp, DataTable dt2, EnumSide eside)
{
ObjectsTemplate<FSTranDetail> details = new ObjectsTemplate<FSTranDetail>();
details = oItemDetails;
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Gross; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.FractionateSalary; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Leave; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.PF; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.CPF; });
details.RemoveAll(delegate(FSTranDetail td) { return td.ItemCode == EnumFSItemCode.Gratuity; });
foreach (FSTranDetail fd in details)
{
if (fd.ItemCode == EnumFSItemCode.Provision)
continue;
if (fd.ItemCode == EnumFSItemCode.Other)
{
if (fd.ChangedValue > 0)
{
if (fd.Side == eside && fd.AmountType == EnumValueType.Amount)
{
DataRow oRow = dt2.NewRow();
oRow[0] = fd.Description;
oRow[1] = GlobalFunctions.TakaFormat(fd.ChangedValue);
dues += GlobalFunctions.Round(fd.ChangedValue);
dt2.Rows.Add(oRow);
}
else if (fd.Side == EnumSide.Deduct && fd.ItemCode == EnumFSItemCode.LFA)
{
DataRow oRow = dt2.NewRow();
oRow[0] = fd.Description;
oRow[1] = GlobalFunctions.TakaFormat(fd.ChangedValue);
dt2.Rows.Add(oRow);
}
}
}
}
return dt2;
}
}
}