using System; using System.Collections.Generic; using System.Linq; using System.Text; using Ease.CoreV35.Model; using Ease.CoreV35; using Ease.CoreV35.DataAccess; using System.Windows.Forms; namespace Payroll.BO { [Serializable] public class BudgetProcess { private BudgetMaster _bugetMaster=new BudgetMaster(); private ObjectsTemplate _employees; private ObjectsTemplate _processMonthly; private ObjectsTemplate _empCostCenters=null; ObjectsTemplate _incomeTaxes = null; public BudgetProcess() { } public BudgetProcessMonthly createPRocessMonthly(Employee emp, DateTime processMonth) { BudgetProcessMonthly item = new BudgetProcessMonthly(); item.DepartmentID = emp.DepartmentID; item.GradeID = emp.GradeID; item.LocationID = emp.LocationID; item.IsConfirm =emp.IsConfirmed==true?1:0; item.Month = processMonth; item.NewJoinerName = emp.Name; if (emp.ID.IsUnassigned) { item.NewJoinerID = ID.FromInteger(Convert.ToInt32(emp.Name)); //item.EmployeeID = item.NewJoinerID; } else item.EmployeeID = emp.ID; return item; } public BudgetProcessMonthlyDetail CreateDetail(Employee emp, BudgetComponent component, DateTime processMonth,ID newJoinerID) { BudgetProcessMonthlyDetail item = new BudgetProcessMonthlyDetail(); if (emp.ID.IsUnassigned) item.EmployeeID = newJoinerID; else item.EmployeeID = emp.ID; item.Month = processMonth; item.BudgetComponentID = component.ID; item.Name = component.Name; //item.Side = EnumSide.Add; item.Calculatedamount = component.CalculateExceptionAmount(emp,processMonth); item.Changedamount = item.Calculatedamount; item.BugetComponent = component; if (component.OriginID != null) item.OriginID = component.OriginID; if (component.ComponentType == EnumBudgetComponent.Allowance) { item.BudgetGroup = EnumBudgetGroup.Gross; item.BudgetCode = EnumBudgetCode.Allowance; } else if (component.ComponentType == EnumBudgetComponent.Bonus) { item.BudgetGroup = EnumBudgetGroup.Gross; item.BudgetCode = EnumBudgetCode.Bonus; } else if (component.ComponentType == EnumBudgetComponent.OPI) { item.BudgetGroup = EnumBudgetGroup.Gross; item.BudgetCode = EnumBudgetCode.OPI; } else if (component.ComponentType == EnumBudgetComponent.Deduction) { item.BudgetGroup = EnumBudgetGroup.Deduction; item.BudgetCode = EnumBudgetCode.Deduction; } return item; } public BudgetMonthlyCC CreateMonthlyCC(Employee emp, BudgetCostCenter bcc, DateTime processMonth, ID newJoinerID) { BudgetMonthlyCC item = new BudgetMonthlyCC(); if (emp.ID.IsUnassigned) item.EmployeeID = newJoinerID; else item.EmployeeID = emp.ID; item.Month = processMonth; item.Percentage = bcc.Percentage; //ObjectsTemplate empCCs = new ObjectsTemplate(); //if (!emp.ID.IsUnassigned) //{ // empCCs = EmployeeCostCenter.GetByEmpID(emp.ID); // if (empCCs.Count > 0) // item.CCID = empCCs[0].CostCenterID; //} //else item.CCID = bcc.CostCenterID; return item; } public ObjectsTemplate GetNewJoinerEmployee(DateTime startdate) { ObjectsTemplate oEmployees = new ObjectsTemplate(); //int nCount = 0; int nCount = 0; List newJoiners = _bugetMaster.GetNewJoiner(startdate); foreach (BudgetNewJoiner newjo in newJoiners) { for (int i = 1; i <= newjo.NoofEmployee; i++) { nCount = nCount + 1; string sID = DateTime.Today.ToString("yy") + DateTime.Today.Month + DateTime.Today.Day; Employee emp = newjo.CreateEmployee(Convert.ToInt32(sID) + nCount); oEmployees.Add(emp); } } return oEmployees; } public void DoProcess(BudgetMaster _oItem, ProgressBar pgbar) { _empCostCenters = EmployeeCostCenter.Get(); string sDeptIDs = ""; _bugetMaster = _oItem; foreach (BudgetDepartment dept in _oItem.BudgetDepartments) { sDeptIDs = sDeptIDs + dept.DepartmentID.ToString() + ", "; } if (sDeptIDs != "") sDeptIDs = sDeptIDs.Substring(0, sDeptIDs.Length - 2); if (sDeptIDs == "") _employees = Employee.Get(); else _employees = Employee.GetByDeptIDs(sDeptIDs); DateTime startDate = _bugetMaster.FromDate; DateTime endDate = _bugetMaster.ToDate; _processMonthly = new ObjectsTemplate(); pgbar.Value = 0; TimeSpan ts = endDate - startDate; pgbar.Maximum = (ts.Days / 30) + 1 + _employees.Count+50; bool nSts; #region Create Budget Process Monthly Object while (startDate <= endDate) { ObjectsTemplate oNewJoiners = GetNewJoinerEmployee(startDate); foreach (Employee oemp in _employees) { nSts = false; // Create Basic Salary Item BudgetProcessMonthlyDetail basicSalaryItem = new BudgetProcessMonthlyDetail(); double nBasicSalary = oemp.BasicSalary; basicSalaryItem.Name = "Basic Salary"; basicSalaryItem.Calculatedamount = CalculateBasic(oemp); basicSalaryItem.Changedamount = basicSalaryItem.Calculatedamount; basicSalaryItem.BudgetGroup = EnumBudgetGroup.Gross; basicSalaryItem.BudgetCode = EnumBudgetCode.Basic_Salary; basicSalaryItem.EmployeeID = oemp.ID; basicSalaryItem.Month = startDate; oemp.BasicSalary = basicSalaryItem.Calculatedamount; // Create PF Item BudgetProcessMonthlyDetail pfItem = new BudgetProcessMonthlyDetail(); pfItem.Name = "PF"; pfItem.Calculatedamount = CalculatePF(oemp); pfItem.Changedamount = pfItem.Calculatedamount; pfItem.BudgetGroup = EnumBudgetGroup.Deduction; pfItem.BudgetCode = EnumBudgetCode.PF; pfItem.EmployeeID = oemp.ID; pfItem.Month = startDate; // check the employee have an exception on the month List exceptions = _bugetMaster.getException(startDate, oemp); foreach (BudgetIndivisualChange exp in exceptions) { if (exp != null) { // check which type of exception and update the employee; // if the type is discontinue then continue the process. switch ((int)exp.ButGetIndvChangeType) { case (int)EnumBudgetChangeType.Basic: oemp.BasicSalary = exp.ChangedBasic; break; case (int)EnumBudgetChangeType.CC: continue; break; case (int)EnumBudgetChangeType.Department: oemp.DepartmentID = exp.Value; break; case (int)EnumBudgetChangeType.Function: continue; break; case (int)EnumBudgetChangeType.Grade: oemp.GradeID = exp.Value; break; case (int)EnumBudgetChangeType.Location: oemp.LocationID = exp.Value; break; case (int)EnumBudgetChangeType.Discontinue: nSts = true; break; } } } // create a process monthly if (!nSts) { BudgetProcessMonthly pmonthly = createPRocessMonthly(oemp, startDate); pmonthly.OBudgetProcessMonthlyDetails.Add(basicSalaryItem); pmonthly.OBudgetProcessMonthlyDetails.Add(pfItem); // get applicable parameters/components List applicablecomponents = new List(); if (!oemp.GradeID.IsUnassigned) applicablecomponents = _bugetMaster.GetApplicableParameters(oemp, oemp.GradeID); #region Calcualte components and create monthly detail foreach (BudgetComponent ocomponent in applicablecomponents) { // add monthly detail to processMonthly pmonthly.OBudgetProcessMonthlyDetails.Add(CreateDetail(oemp, ocomponent, startDate, null)); } oemp.BasicSalary = nBasicSalary; #endregion #region Create costcenter information List oCCs = new List(); oCCs = _bugetMaster.GetCC(startDate); BudgetCostCenter oItem = oCCs.Find(delegate(BudgetCostCenter bcc) { return bcc.EmployeeID == oemp.ID; }); if (oItem == null) { EmployeeCostCenter empcc = _empCostCenters.Find(delegate(EmployeeCostCenter empcc1) { return empcc1.EmployeeID == oemp.ID; }); if (empcc != null) { BudgetCostCenter bcc1 = new BudgetCostCenter(); bcc1.CostCenterID = empcc.CostCenterID; bcc1.EmployeeID = empcc.EmployeeID; bcc1.FromMonth = empcc.MonthDate; bcc1.Percentage = empcc.Percentage; pmonthly.OBudgetMonthlyCCs.Add(CreateMonthlyCC(oemp, bcc1, startDate, null)); } } else pmonthly.OBudgetMonthlyCCs.Add(CreateMonthlyCC(oemp, oItem, startDate, null)); #endregion // Create CTC Item double nAmount = 0.0; double nDeductAmount = 0.0; BudgetProcessMonthlyDetail CTCItem = new BudgetProcessMonthlyDetail(); CTCItem.Name = "CTC"; foreach (BudgetProcessMonthlyDetail pd in pmonthly.OBudgetProcessMonthlyDetails) { if (pd.BudgetGroup == EnumBudgetGroup.Deduction) nDeductAmount += pd.Calculatedamount; } foreach (BudgetProcessMonthlyDetail pd in pmonthly.OBudgetProcessMonthlyDetails) { if (pd.BudgetGroup == EnumBudgetGroup.Gross) nAmount += pd.Calculatedamount; } CTCItem.Calculatedamount = nAmount - nDeductAmount; CTCItem.Changedamount = CTCItem.Calculatedamount; CTCItem.BudgetGroup = EnumBudgetGroup.Miscellanies; CTCItem.BudgetCode = EnumBudgetCode.CTC; CTCItem.EmployeeID = oemp.ID; CTCItem.Month = startDate; pmonthly.OBudgetProcessMonthlyDetails.Add(CTCItem); // Create Guranted Cash Item double nGurantedAmount = 0.0; //double nDeductAmount = 0.0; BudgetProcessMonthlyDetail GurantedCashItem = new BudgetProcessMonthlyDetail(); GurantedCashItem.Name = "Guranted Cash"; nGurantedAmount += basicSalaryItem.Calculatedamount; foreach (BudgetProcessMonthlyDetail pd in pmonthly.OBudgetProcessMonthlyDetails) { if (pd.BudgetCode == EnumBudgetCode.Allowance || pd.BudgetCode == EnumBudgetCode.Bonus) nGurantedAmount += pd.Calculatedamount; } GurantedCashItem.Calculatedamount = nGurantedAmount; GurantedCashItem.Changedamount = GurantedCashItem.Calculatedamount; GurantedCashItem.BudgetGroup = EnumBudgetGroup.Miscellanies; GurantedCashItem.BudgetCode = EnumBudgetCode.Guranted_Cash; GurantedCashItem.EmployeeID = oemp.ID; GurantedCashItem.Month = startDate; pmonthly.OBudgetProcessMonthlyDetails.Add(GurantedCashItem); // Create Income Tax Item BudgetProcessMonthlyDetail incomeItem = new BudgetProcessMonthlyDetail(); incomeItem.Name = "Income Tax"; incomeItem.Calculatedamount = 0; incomeItem.Changedamount = incomeItem.Calculatedamount; incomeItem.BudgetGroup = EnumBudgetGroup.Miscellanies; incomeItem.BudgetCode = EnumBudgetCode.IncomeTax; incomeItem.EmployeeID = oemp.ID; incomeItem.Month = startDate; pmonthly.OBudgetProcessMonthlyDetails.Add(incomeItem); _processMonthly.Add(pmonthly); } } #region Find out the new joiner employee on the month foreach (Employee newEmp in oNewJoiners) { if (Ease.CoreV35.Utility.Global.DateFunctions.FirstDateOfMonth(startDate) >= Ease.CoreV35.Utility.Global.DateFunctions.FirstDateOfMonth(newEmp.JoiningDate)) { // create a process monthly BudgetProcessMonthly pmonthly = createPRocessMonthly(newEmp, startDate); newEmp.SetObjectID(Convert.ToInt32(newEmp.Name)); BudgetProcessMonthlyDetail basicSalaryItem = new BudgetProcessMonthlyDetail(); basicSalaryItem.Name = "Basic Salary"; basicSalaryItem.Calculatedamount = newEmp.BasicSalary; basicSalaryItem.Changedamount = basicSalaryItem.Calculatedamount; basicSalaryItem.BudgetGroup = EnumBudgetGroup.Gross; basicSalaryItem.BudgetCode = EnumBudgetCode.Basic_Salary; basicSalaryItem.EmployeeID = newEmp.ID; basicSalaryItem.Month = startDate; newEmp.BasicSalary = basicSalaryItem.Calculatedamount; pmonthly.OBudgetProcessMonthlyDetails.Add(basicSalaryItem); // Create PF Item BudgetProcessMonthlyDetail pfItem = new BudgetProcessMonthlyDetail(); pfItem.Name = "PF"; pfItem.Calculatedamount = CalculatePF(newEmp); pfItem.Changedamount = pfItem.Calculatedamount; pfItem.BudgetGroup = EnumBudgetGroup.Deduction; pfItem.BudgetCode = EnumBudgetCode.PF; pfItem.EmployeeID = newEmp.ID; pfItem.Month = startDate; pmonthly.OBudgetProcessMonthlyDetails.Add(pfItem); // get applicable parameters/components List applicablecomponents = _bugetMaster.GetApplicableParameters(newEmp, newEmp.GradeID); // calcualte components and create monthly detail foreach (BudgetComponent ocomponent in applicablecomponents) { // add monthly detail to processMonthly pmonthly.OBudgetProcessMonthlyDetails.Add(CreateDetail(newEmp, ocomponent, startDate, pmonthly.NewJoinerID)); } //_processMonthly.Add(pmonthly); // create costcenter information string s = ""; List oNewCCs = new List(); oNewCCs = _bugetMaster.GetNewJoinerCC(startDate); foreach (BudgetNewJoinerCrG oItem in oNewCCs) { //BudgetNewJoinerCrG bnj=oNewCCs.Find(delegate(BudgetNewJoinerCrG nc){return nc.em BudgetCostCenter bcc = new BudgetCostCenter(); bcc.CostCenterID = oItem.CCID; bcc.Percentage = oItem.Percentage; pmonthly.OBudgetMonthlyCCs.Add(CreateMonthlyCC(newEmp, bcc, startDate, pmonthly.NewJoinerID)); } // Create CTC Item double nAmount = 0.0; double nDeductAmount = 0.0; BudgetProcessMonthlyDetail CTCItem = new BudgetProcessMonthlyDetail(); CTCItem.Name = "CTC"; foreach (BudgetProcessMonthlyDetail pd in pmonthly.OBudgetProcessMonthlyDetails) { if (pd.BudgetGroup == EnumBudgetGroup.Deduction) nDeductAmount += pd.Calculatedamount; } foreach (BudgetProcessMonthlyDetail pd in pmonthly.OBudgetProcessMonthlyDetails) { if (pd.BudgetGroup == EnumBudgetGroup.Gross) nAmount += pd.Calculatedamount; } CTCItem.Calculatedamount = nAmount - nDeductAmount; CTCItem.Changedamount = CTCItem.Calculatedamount; CTCItem.BudgetGroup = EnumBudgetGroup.Miscellanies; CTCItem.BudgetCode = EnumBudgetCode.CTC; CTCItem.EmployeeID = newEmp.ID; CTCItem.Month = startDate; pmonthly.OBudgetProcessMonthlyDetails.Add(CTCItem); // Create Guranted Cash Item double nGurantedAmount = 0.0; //double nDeductAmount = 0.0; BudgetProcessMonthlyDetail GurantedCashItem = new BudgetProcessMonthlyDetail(); GurantedCashItem.Name = "Guranted Cash"; nGurantedAmount += basicSalaryItem.Calculatedamount; foreach (BudgetProcessMonthlyDetail pd in pmonthly.OBudgetProcessMonthlyDetails) { if (pd.BudgetCode == EnumBudgetCode.Allowance || pd.BudgetCode == EnumBudgetCode.Bonus) nGurantedAmount += pd.Calculatedamount; } GurantedCashItem.Calculatedamount = nGurantedAmount; GurantedCashItem.Changedamount = GurantedCashItem.Calculatedamount; GurantedCashItem.BudgetGroup = EnumBudgetGroup.Miscellanies; GurantedCashItem.BudgetCode = EnumBudgetCode.Guranted_Cash; GurantedCashItem.EmployeeID = newEmp.ID; GurantedCashItem.Month = startDate; pmonthly.OBudgetProcessMonthlyDetails.Add(GurantedCashItem); // Create Income Tax Item BudgetProcessMonthlyDetail incomeItem = new BudgetProcessMonthlyDetail(); incomeItem.Name = "Income Tax"; incomeItem.Calculatedamount = 0; incomeItem.Changedamount = incomeItem.Calculatedamount; incomeItem.BudgetGroup = EnumBudgetGroup.Miscellanies; incomeItem.BudgetCode = EnumBudgetCode.IncomeTax; incomeItem.EmployeeID = newEmp.ID; incomeItem.Month = startDate; pmonthly.OBudgetProcessMonthlyDetails.Add(incomeItem); _processMonthly.Add(pmonthly); } } #endregion startDate = startDate.AddMonths(1); pgbar.Value += 1; pgbar.Refresh(); } #endregion //TaxCalculationForExistingEmployee(pgbar); //TaxCalculationForNewEmployee(pgbar); pgbar.Value = pgbar.Maximum; pgbar.Refresh(); _bugetMaster.BudgetProcessMonthlys = new ObjectsTemplate(); _bugetMaster.BudgetProcessMonthlys = _processMonthly; } private void TaxCalculationForExistingEmployee(ProgressBar pgbar) { DateTime startDate, endDate; List otaxRawItems = new List(); enumIncomeTaxItemType eTaxItemType = enumIncomeTaxItemType.None; int nTaxItemID = 0; TaxRawItem taxRawItem; foreach (Employee oemp in _employees) { otaxRawItems = new List(); startDate = _bugetMaster.FromDate; endDate = _bugetMaster.ToDate; _incomeTaxes = new ObjectsTemplate(); double _nTaxAmount = 0.0; List bpms = _processMonthly.FindAll(delegate(BudgetProcessMonthly item) { return item.EmployeeID == oemp.ID; }); foreach (BudgetProcessMonthly bp in bpms) { foreach (BudgetProcessMonthlyDetail detail in bp.OBudgetProcessMonthlyDetails) { eTaxItemType = enumIncomeTaxItemType.None; if (detail.BudgetCode == EnumBudgetCode.Allowance) { if (!detail.OriginID.IsUnassigned) { eTaxItemType = enumIncomeTaxItemType.Allowance; nTaxItemID = detail.OriginID.Integer; } } else if (detail.BudgetCode == EnumBudgetCode.Basic_Salary) { eTaxItemType = enumIncomeTaxItemType.Basic_Salary; nTaxItemID = (int)EnumIncomeTaxItemGroup.Basic_Salary; } else if (detail.BudgetCode == EnumBudgetCode.Bonus) { eTaxItemType = enumIncomeTaxItemType.Bonus; nTaxItemID = (int)EnumIncomeTaxItemGroup.Bonus; } else if (detail.BudgetCode == EnumBudgetCode.Deduction) { if (!detail.OriginID.IsUnassigned) { eTaxItemType = enumIncomeTaxItemType.Deduction; nTaxItemID = detail.OriginID.Integer; } } else if (detail.BudgetCode == EnumBudgetCode.OPI) { eTaxItemType = enumIncomeTaxItemType.OPI; //nTaxItemID = (int)EnumIncomeTaxItemGroup. } else if (detail.BudgetCode == EnumBudgetCode.PF) { eTaxItemType = enumIncomeTaxItemType.PF; nTaxItemID = (int)EnumIncomeTaxItemGroup.Company_Contri_PF; } taxRawItem = new TaxRawItem(); taxRawItem = TaxRawItem.Create(detail.Name, detail.Changedamount, eTaxItemType, nTaxItemID); otaxRawItems.Add(taxRawItem); } } TaxCalculator otaxCal = new TaxCalculator(); otaxCal.TaxParameter = TaxParameter.Get(Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID); otaxCal.Employee = oemp; try { _incomeTaxes = otaxCal.Calculate(otaxRawItems, ref _nTaxAmount); } catch (Exception exp) { throw new Exception(exp.ToString()); } while (startDate <= endDate) { int nProcessIndex = GetIndex(oemp.ID, startDate); if (nProcessIndex > 0) { int nIndex = GetIndex(EnumBudgetCode.IncomeTax, _processMonthly[nProcessIndex].OBudgetProcessMonthlyDetails); if (nIndex > 0) _processMonthly[nProcessIndex].OBudgetProcessMonthlyDetails[nIndex].Calculatedamount = (_nTaxAmount / 12) * 1; } startDate = startDate.AddMonths(1); } pgbar.Value += 1; pgbar.Refresh(); } } private void TaxCalculationForNewEmployee(ProgressBar pgbar) { DateTime startDate, endDate; startDate = _bugetMaster.FromDate; ObjectsTemplate oNewJs = GetNewJoinerEmployee(startDate); List otaxRawItems = new List(); enumIncomeTaxItemType eTaxItemType = enumIncomeTaxItemType.None; int nTaxItemID = 0; foreach (Employee newEmp in oNewJs) { otaxRawItems = new List(); startDate = _bugetMaster.FromDate; endDate = _bugetMaster.ToDate; newEmp.SetObjectID(Convert.ToInt32(newEmp.Name)); _incomeTaxes = new ObjectsTemplate(); double _nTaxAmount = 0.0; List bpmsNew = _processMonthly.FindAll(delegate(BudgetProcessMonthly item) { return item.EmployeeID == newEmp.ID ; }); foreach (BudgetProcessMonthly bp in bpmsNew) { foreach (BudgetProcessMonthlyDetail detail in bp.OBudgetProcessMonthlyDetails) { eTaxItemType = enumIncomeTaxItemType.None; if (detail.BudgetCode == EnumBudgetCode.Allowance) { eTaxItemType = enumIncomeTaxItemType.Allowance; nTaxItemID = detail.OriginID.Integer; } else if (detail.BudgetCode == EnumBudgetCode.Basic_Salary) { eTaxItemType = enumIncomeTaxItemType.Basic_Salary; nTaxItemID = (int)EnumIncomeTaxItemGroup.Basic_Salary; } else if (detail.BudgetCode == EnumBudgetCode.Bonus) { eTaxItemType = enumIncomeTaxItemType.Bonus; nTaxItemID = (int)EnumIncomeTaxItemGroup.Bonus; } else if (detail.BudgetCode == EnumBudgetCode.Deduction) { eTaxItemType = enumIncomeTaxItemType.Deduction; nTaxItemID = detail.OriginID.Integer; } else if (detail.BudgetCode == EnumBudgetCode.OPI) { eTaxItemType = enumIncomeTaxItemType.OPI; //nTaxItemID = (int)EnumIncomeTaxItemGroup. } else if (detail.BudgetCode == EnumBudgetCode.PF) { eTaxItemType = enumIncomeTaxItemType.PF; nTaxItemID = (int)EnumIncomeTaxItemGroup.Company_Contri_PF; } TaxRawItem taxRawItem = new TaxRawItem(); taxRawItem = TaxRawItem.Create(detail.Name, detail.Changedamount, eTaxItemType, nTaxItemID); otaxRawItems.Add(taxRawItem); } } TaxCalculator otaxCal = new TaxCalculator(); otaxCal.Employee = newEmp; otaxCal.TaxParameter = TaxParameter.Get(Payroll.BO.SystemInformation.CurrentSysInfo.TaxParamID); try { _incomeTaxes = otaxCal.Calculate(otaxRawItems, ref _nTaxAmount); } catch (Exception exp) { throw new Exception(exp.ToString()); } while (startDate <= endDate) { int nIndexProcess = GetIndex(newEmp.ID, startDate); if (nIndexProcess > 0) { int nIndex = GetIndex(EnumBudgetCode.IncomeTax, _processMonthly[nIndexProcess].OBudgetProcessMonthlyDetails); if (nIndex > 0) _processMonthly[nIndexProcess].OBudgetProcessMonthlyDetails[nIndex].Calculatedamount = (_nTaxAmount / 12) * 1; } startDate = startDate.AddMonths(1); } pgbar.Value += 1; pgbar.Refresh(); } } private int GetIndex(EnumBudgetCode budCode,ObjectsTemplate bds) { int i = 0; int nIndex = 0; foreach (BudgetProcessMonthlyDetail item in bds) { if (item.BudgetCode == budCode) { nIndex = i; break; } i++; } return nIndex; } private int GetIndex(ID empID, DateTime startdate) { int i = 0; int nIndex = 0; foreach (BudgetProcessMonthly item in _processMonthly) { if (item.EmployeeID == empID && item.Month.Date==startdate.Date) { nIndex = i; break; } i++; } return nIndex; } private double CalculateBasic(Employee oEmp) { BudgetGrade budGrade = _bugetMaster.BudgetGrades.Find(delegate(BudgetGrade item) { return item.GradeID == oEmp.GradeID; }); if (budGrade != null) { double nAmount = (oEmp.BasicSalary * budGrade.ChangedPercentage) / 100; oEmp.BasicSalary = oEmp.BasicSalary + nAmount; return oEmp.BasicSalary; } else return oEmp.BasicSalary; } private double CalculatePF(Employee oEmp) { double nAmount = 0.0; nAmount=(oEmp.BasicSalary * SystemInformation.CurrentSysInfo.pFContriCompany ) / 100; return nAmount; } public double GetBudgetAmountByCCEmp(int ccID, int empID, int budgetID) { BudgetMaster oBudMaster = BudgetMaster.Get(ID.FromInteger(budgetID)); List oBudProsMonths = oBudMaster.BudgetProcessMonthlys; double nAmount = 0.0; foreach (BudgetProcessMonthly budMonthly in oBudProsMonths) { BudgetMonthlyCC budCC = budMonthly.OBudgetMonthlyCCs.Find(delegate(BudgetMonthlyCC cc) { return cc.CCID.Integer == ccID && empID == cc.EmployeeID.Integer; }); if (budCC != null) { BudgetProcessMonthlyDetail oDetal = budMonthly.OBudgetProcessMonthlyDetails.Find(delegate(BudgetProcessMonthlyDetail opd) { return opd.BudgetProcessMonthlyID == budCC.BudgetProcessMonthlyID && opd.EmployeeID == budCC.EmployeeID; }); if (oDetal != null) { nAmount += oDetal.Calculatedamount; } } } return nAmount; } public double GetBudgetAmountByEmp(int empID, int budgetID) { double nAmount = 0.0; BudgetMaster oBudMaster = BudgetMaster.Get(ID.FromInteger(budgetID)); List oBudProsMonths = oBudMaster.BudgetProcessMonthlys; foreach (BudgetProcessMonthly budMonthly in oBudProsMonths) { BudgetProcessMonthlyDetail oDetal = budMonthly.OBudgetProcessMonthlyDetails.Find(delegate(BudgetProcessMonthlyDetail opd) { return opd.EmployeeID.Integer ==empID; }); if (oDetal != null) { nAmount += oDetal.Calculatedamount; } } return nAmount; } } public partial class BudgetTempCollection { public int position { get; set; } public EnumBudgetCode enumBudgetCode { get; set; } public int OriginID { get; set; } } }