コード例 #1
0
        private void GeneratePayroll(DateTime payrollStartDate, DateTime payrollEndDate)
        {
            //Generate Attendance
            Console.WriteLine("Generating Attendance...");
            _attendanceService.CreateWorkSchedules();

            //Compute employee hours
            Console.WriteLine("Computing daily employee hours for date " + payrollStartDate + " to " +
                              payrollEndDate);
            _employeeHoursService.GenerateEmployeeHours(payrollStartDate, payrollEndDate);

            //Compute total employee hours
            Console.WriteLine("Computing total employee hours for date " + payrollStartDate + " to " +
                              payrollEndDate);
            _totalEmployeeHoursService.GenerateTotalByDateRange(payrollStartDate, payrollEndDate);

            //Compute daily payroll

            /*Console.WriteLine("Computing daily payroll for date " + payrollStartDate + " to " + payrollEndDate);
             * _employeeDailyPayrollService.GenerateEmployeeDailySalaryByDateRange(payrollStartDate, payrollEndDate);*/

            //Generate payroll items
            Console.WriteLine("Computing payroll items for date " + payrollStartDate + " to " + payrollEndDate);
            var payrollDate = _employeePayrollService.GetNextPayrollReleaseDate(payrollEndDate);

            _employeePayrollItemservice.GenerateEmployeePayrollItemByDateRange(payrollDate, payrollStartDate, payrollEndDate);

            //Generate Payroll
            Console.WriteLine("Computing payroll for date " + payrollStartDate + " to " + payrollEndDate);
            _employeePayrollService.GeneratePayroll(payrollStartDate, payrollEndDate);
        }
コード例 #2
0
        public void Execute()
        {
            try
            {
                //Get payroll date range
                var payrollStartDate = _employeePayrollService
                                       .GetLatestPayrollStartDate().TruncateTime();
                var payrollEndDate = _employeePayrollService
                                     .GetNextPayrollEndDate(payrollStartDate).TruncateTime();

                //Compute total employee hours
                Console.WriteLine("Computing total employee hours for date " + payrollStartDate + " to " +
                                  payrollEndDate);
                _totalEmployeeHoursService.GenerateTotalByDateRange(payrollStartDate, payrollEndDate);

                //Compute daily payroll
                //Console.WriteLine("Computing daily payroll for date " + payrollStartDate + " to " + payrollEndDate);
                //_employeeDailyPayrollService.GenerateEmployeeDailySalaryByDateRange(payrollStartDate, payrollEndDate);
                //Generate payroll items
                Console.WriteLine("Computing payroll items for date " + payrollStartDate + " to " + payrollEndDate);
                var payrollDate = _employeePayrollService.GetNextPayrollReleaseDate(payrollEndDate);
                _employeePayrollItemService.GenerateEmployeePayrollItemByDateRange(payrollDate, payrollStartDate, payrollEndDate);

                //Compute total payroll
                Console.WriteLine("Computing total payroll for date " + payrollStartDate + " to " + payrollEndDate);
                _employeePayrollService.GeneratePayroll(payrollStartDate, payrollEndDate);

                LogSchedule(SchedulerLogType.Success);
            }
            catch (Exception ex)
            {
                LogSchedule(SchedulerLogType.Exception, ex.InnerException.Message);
            }
        }