Exemplo n.º 1
0
        public ActionResult confirmprocesspayroll(PayslipBatchHeader payslipbatchheader)
        {
            using (var dbcntx = new HrDataContext())
            {
                var salaryprocesslist = dbcntx.SalaryStructureHeaders
                                        .Join(dbcntx.SalaryStructureDetails,
                                              a => a.StructureID, b => b.StructureID,
                                              (a, b) => new { A = a, B = b }).
                                        Where(x => x.A.BranchId.Value == BRANCHID && x.A.EffectiveDate.Value.Month == payslipbatchheader.Month &&
                                              x.A.EffectiveDate.Value.Year == payslipbatchheader.Year && x.A.IsActive == true).
                                        Select(x => new ProcessTable
                {
                    EmployeeId       = x.A.EmployeeId.Value,
                    RegisterCode     = x.B.PaymentType,
                    ContributionCode = x.B.Code,
                    Amount           = x.B.Amount,
                }).ToList();

                var payslipheader = new PayslipBatchHeader()
                {
                    BatchNo     = payslipbatchheader.BatchNo,
                    BranchId    = BRANCHID,
                    Month       = payslipbatchheader.Month,
                    Year        = payslipbatchheader.Year,
                    ProcessDate = payslipbatchheader.ProcessDate,
                    TotalSalary = payslipbatchheader.TotalSalary,
                };
                //if (payrollvm.payslipBatchHeader == null)
                //   payrollvm.payslipBatchHeader = new PayslipBatchHeader();
                PayslipbatchheaderBo.Add(payslipheader);


                if (salaryprocesslist != null && salaryprocesslist.Count != 0)
                {
                    for (var i = 0; i < salaryprocesslist.Count; i++)
                    {
                        var payslipbatchdetail = new PayslipBatchDetail()
                        {
                            BatchHeaderId    = payslipheader.BatchHeaderId,
                            BatchNo          = payslipheader.BatchNo,
                            BranchId         = payslipheader.BranchId,
                            EmployeeId       = salaryprocesslist[i].EmployeeId,
                            RegisterCode     = salaryprocesslist[i].RegisterCode,
                            ContributionCode = salaryprocesslist[i].ContributionCode,
                            Amount           = salaryprocesslist[i].Amount,
                        };


                        payslipbatchdetailBo.Add(payslipbatchdetail);
                    }
                }
            }

            return(RedirectToAction("ProcessPayroll"));
        }
Exemplo n.º 2
0
 public void Delete(PayslipBatchDetail entity)
 {
     try
     {
         payslipbatchdetailrepository.Delete(entity);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
Exemplo n.º 3
0
 public void Add(PayslipBatchDetail entity)
 {
     try
     {
         entity.CreatedBy = sessionObj.USERID;
         entity.CreatedOn = UTILITY.SINGAPORETIME;
         //entity.BranchId = sessionObj.BRANCHID;
         //entity.EmployeeId = sessionObj.EMPLOYEEID;
         payslipbatchdetailrepository.Add(entity);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }