예제 #1
0
        public StaffPayments StaffPayments(int EmpId, DateTime onDate, decimal curSalary)
        {
            using (AprajitaRetailsContext db = new AprajitaRetailsContext())
            {
                StaffPayments sPay = new StaffPayments();
                sPay.AdavcePayment      = db.StaffAdvancePayments.Where(c => c.EmployeeId == EmpId && DbFunctions.TruncateTime(c.PaymentDate).Value.Month == DbFunctions.TruncateTime(onDate).Value.Month).Sum(c => c.Amount);
                sPay.AdvaceReciepts     = db.StaffAdvanceReceipts.Where(c => c.EmployeeId == EmpId && DbFunctions.TruncateTime(c.ReceiptDate).Value.Month == DbFunctions.TruncateTime(onDate).Value.Month).Sum(c => c.Amount);
                sPay.SalaryPayment      = db.Salaries.Where(c => c.EmployeeId == EmpId && DbFunctions.TruncateTime(c.PaymentDate).Value.Month == DbFunctions.TruncateTime(onDate).Value.Month).Sum(c => c.Amount);
                sPay.CurrentMonthSalary = curSalary;
                sPay.NetSalary          = curSalary - (sPay.SalaryPayment + sPay.AdavcePayment - sPay.AdvaceReciepts);

                return(sPay);
            }
        }
예제 #2
0
        public List <StaffPayments> AllStaffPayments(DateTime onDate)
        {
            using (AprajitaRetailsContext db = new AprajitaRetailsContext())
            {
                var emp = db.Employees.Where(c => c.IsWorking).Select(c => c.EmployeeId);
                List <StaffPayments> lists = new List <StaffPayments>();
                foreach (var EmpId in emp)
                {
                    StaffPayments sPay = new StaffPayments();
                    sPay.AdavcePayment      = db.StaffAdvancePayments.Where(c => c.EmployeeId == EmpId && DbFunctions.TruncateTime(c.PaymentDate).Value.Month == DbFunctions.TruncateTime(onDate).Value.Month).Sum(c => c.Amount);
                    sPay.AdvaceReciepts     = db.StaffAdvanceReceipts.Where(c => c.EmployeeId == EmpId && DbFunctions.TruncateTime(c.ReceiptDate).Value.Month == DbFunctions.TruncateTime(onDate).Value.Month).Sum(c => c.Amount);
                    sPay.SalaryPayment      = db.Salaries.Where(c => c.EmployeeId == EmpId && DbFunctions.TruncateTime(c.PaymentDate).Value.Month == DbFunctions.TruncateTime(onDate).Value.Month).Sum(c => c.Amount);
                    sPay.CurrentMonthSalary = 0;//TODO: aad option here
                    sPay.NetSalary          = sPay.CurrentMonthSalary - (sPay.SalaryPayment + sPay.AdavcePayment - sPay.AdvaceReciepts);

                    lists.Add(sPay);
                }


                return(lists);
            }
        }