public SalarySlipController()
 {
     _salarySlipService       = new SalarySlipService(new SalarySlipRepository(), new SalarySlipValidator());
     _formulaService          = new FormulaService(new FormulaRepository(), new FormulaValidator());
     _salarySlipDetailService = new SalarySlipDetailService(new SalarySlipDetailRepository(), new SalarySlipDetailValidator());
     _salaryItemService       = new SalaryItemService(new SalaryItemRepository(), new SalaryItemValidator());
 }
Beispiel #2
0
        //public SalarySlipDetail VHasSalaryItem(SalarySlipDetail salarySlipDetail, ISalaryItemService _salaryItemService)
        //{
        //    SalaryItem salaryItem = _salaryItemService.GetObjectById(salarySlipDetail.SalaryItemId);
        //    if (salaryItem == null)
        //    {
        //        salarySlipDetail.Errors.Add("SalaryItem", "Tidak ada");
        //    }
        //    return salarySlipDetail;
        //}

        public SalarySlipDetail VHasFormula(SalarySlipDetail salarySlipDetail, IFormulaService _formulaService)
        {
            Formula formula = _formulaService.GetObjectById(salarySlipDetail.FormulaId);

            if (formula == null)
            {
                salarySlipDetail.Errors.Add("Formula", "Tidak ada");
            }
            return(salarySlipDetail);
        }
Beispiel #3
0
        public FormulaWindow()
        {
            InitializeComponent();

            _rUsersService = IoC.Container.Resolve <IUsersService>();

            _rFormulaService = IoC.Container.Resolve <IFormulaService>();

            Reset();
        }
Beispiel #4
0
        //public Formula VHasValidSign(Formula formula)
        //{
        //    if (formula.IsSecondValue && formula.ValueSign == 0)
        //    {
        //        formula.Errors.Add("ValueSign", "Tidak valid");
        //    }
        //    return formula;
        //}

        public bool ValidCreateObject(Formula formula, IFormulaService _formulaService, ISalaryItemService _salaryItemService)
        {
            //VHasParentSalaryItem(formula, _salaryItemService);
            //if (!isValid(formula)) { return false; }
            VHasFirstSalaryItem(formula, _salaryItemService);
            if (!isValid(formula))
            {
                return(false);
            }
            VHasSecondSalaryItem(formula, _salaryItemService);
            //if (!isValid(formula)) { return false; }
            //VHasValidSign(formula);
            return(isValid(formula));
        }
        public ProjectWindow()
        {
            InitializeComponent();

            _rUsersService = IoC.Container.Resolve <IUsersService>();

            _rProjectService = IoC.Container.Resolve <IProjectService>();

            _rFormulaService = IoC.Container.Resolve <IFormulaService>();

            _rCompanyService = IoC.Container.Resolve <ICompanyService>();

            Reset();
        }
        public SalarySlipDetail CreateObject(int SalarySlipId, int SalarySign, string FirstSalaryItemCode, string Operator, string SecondSalaryItemCode, decimal SecondValue,
                                             bool HasMinValue, decimal MinValue, bool HasMaxValue, decimal MaxValue,
                                             ISalarySlipService _salarySlipService, IFormulaService _formulaService, ISalaryItemService _salaryItemService)
        {
            SalaryItem salaryItem = _salaryItemService.GetObjectByCode(FirstSalaryItemCode);
            Formula    formula    = new Formula
            {
                FirstSalaryItemId = salaryItem.Id,
                FormulaOp         = Operator,
            };

            salaryItem = _salaryItemService.GetObjectByCode(SecondSalaryItemCode);
            if (salaryItem == null)
            {
                formula.IsSecondValue = true;
                formula.SecondValue   = SecondValue;
                //formula.ValueSign = (int)Constant.SalarySign.Income;
            }
            else
            {
                formula.SecondSalaryItemId = salaryItem.Id;
            }
            _formulaService.CreateObject(formula, _salaryItemService);

            SalarySlipDetail salarySlipDetail = new SalarySlipDetail
            {
                SalarySlipId = SalarySlipId,
                SalarySign   = SalarySign,
                FormulaId    = formula.Id,
                HasMinValue  = HasMinValue,
                MinValue     = MinValue,
                HasMaxValue  = HasMaxValue,
                MaxValue     = MaxValue,
            };

            CreateObject(salarySlipDetail, _salarySlipService, _formulaService);
            if (salarySlipDetail.Errors.Any())
            {
                _formulaService.DeleteObject(formula.Id);
            }
            else
            {
                formula.SalarySlipDetailId = salarySlipDetail.Id;
                _formulaService.UpdateObject(formula, _salaryItemService);
            }
            return(salarySlipDetail);
        }
Beispiel #7
0
 public SalaryProcessController()
 {
     _userAccountService          = new UserAccountService(new UserAccountRepository(), new UserAccountValidator());
     _companyInfoService          = new CompanyInfoService(new CompanyInfoRepository(), new CompanyInfoValidator());
     _branchOfficeService         = new BranchOfficeService(new BranchOfficeRepository(), new BranchOfficeValidator());
     _departmentService           = new DepartmentService(new DepartmentRepository(), new DepartmentValidator());
     _divisionService             = new DivisionService(new DivisionRepository(), new DivisionValidator());
     _titleInfoService            = new TitleInfoService(new TitleInfoRepository(), new TitleInfoValidator());
     _employeeService             = new EmployeeService(new EmployeeRepository(), new EmployeeValidator());
     _employeeEducationService    = new EmployeeEducationService(new EmployeeEducationRepository(), new EmployeeEducationValidator());
     _salaryItemService           = new SalaryItemService(new SalaryItemRepository(), new SalaryItemValidator());
     _formulaService              = new FormulaService(new FormulaRepository(), new FormulaValidator());
     _workingTimeService          = new WorkingTimeService(new WorkingTimeRepository(), new WorkingTimeValidator());
     _workingDayService           = new WorkingDayService(new WorkingDayRepository(), new WorkingDayValidator());
     _employeeWorkingTimeService  = new EmployeeWorkingTimeService(new EmployeeWorkingTimeRepository(), new EmployeeWorkingTimeValidator());
     _salaryStandardService       = new SalaryStandardService(new SalaryStandardRepository(), new SalaryStandardValidator());
     _salaryStandardDetailService = new SalaryStandardDetailService(new SalaryStandardDetailRepository(), new SalaryStandardDetailValidator());
     _salaryEmployeeService       = new SalaryEmployeeService(new SalaryEmployeeRepository(), new SalaryEmployeeValidator());
     _salaryEmployeeDetailService = new SalaryEmployeeDetailService(new SalaryEmployeeDetailRepository(), new SalaryEmployeeDetailValidator());
     _employeeAttendanceService   = new EmployeeAttendanceService(new EmployeeAttendanceRepository(), new EmployeeAttendanceValidator());
     //_employeeAttendanceDetailService = new EmployeeAttendanceDetailService(new EmployeeAttendanceDetailRepository(), new EmployeeAttendanceDetailValidator());
     _salarySlipService         = new SalarySlipService(new SalarySlipRepository(), new SalarySlipValidator());
     _salarySlipDetailService   = new SalarySlipDetailService(new SalarySlipDetailRepository(), new SalarySlipDetailValidator());
     _employeeLeaveService      = new EmployeeLeaveService(new EmployeeLeaveRepository(), new EmployeeLeaveValidator());
     _generalLeaveService       = new GeneralLeaveService(new GeneralLeaveRepository(), new GeneralLeaveValidator());
     _spklService               = new SPKLService(new SPKLRepository(), new SPKLValidator());
     _ptkpService               = new PTKPService(new PTKPRepository(), new PTKPValidator());
     _pph21sptService           = new PPH21SPTService(new PPH21SPTRepository(), new PPH21SPTValidator());
     _otherExpenseService       = new OtherExpenseService(new OtherExpenseRepository(), new OtherExpenseValidator());
     _otherExpenseDetailService = new OtherExpenseDetailService(new OtherExpenseDetailRepository(), new OtherExpenseDetailValidator());
     _otherIncomeService        = new OtherIncomeService(new OtherIncomeRepository(), new OtherIncomeValidator());
     _otherIncomeDetailService  = new OtherIncomeDetailService(new OtherIncomeDetailRepository(), new OtherIncomeDetailValidator());
     _thrService              = new THRService(new THRRepository(), new THRValidator());
     _thrDetailService        = new THRDetailService(new THRDetailRepository(), new THRDetailValidator());
     _slipGajiMiniService     = new SlipGajiMiniService(new SlipGajiMiniRepository(), new SlipGajiMiniValidator());
     _slipGajiDetailService   = new SlipGajiDetailService(new SlipGajiDetailRepository(), new SlipGajiDetailValidator());
     _slipGajiDetail1Service  = new SlipGajiDetail1Service(new SlipGajiDetail1Repository(), new SlipGajiDetail1Validator());
     _slipGajiDetail2AService = new SlipGajiDetail2AService(new SlipGajiDetail2ARepository(), new SlipGajiDetail2AValidator());
     _salaryProcessService    = new SalaryProcessService(new SalaryProcessValidator()
     {
         _employeeAttendanceService  = _employeeAttendanceService,
         _employeeLeaveService       = _employeeLeaveService,
         _employeeService            = _employeeService,
         _employeeWorkingTimeService = _employeeWorkingTimeService,
         _formulaService             = _formulaService,
         _generalLeaveService        = _generalLeaveService,
         _spklService               = _spklService,
         _ptkpService               = _ptkpService,
         _pph21sptService           = _pph21sptService,
         _otherExpenseService       = _otherExpenseService,
         _otherExpenseDetailService = _otherExpenseDetailService,
         _otherIncomeService        = _otherIncomeService,
         _otherIncomeDetailService  = _otherIncomeDetailService,
         _thrService                  = _thrService,
         _thrDetailService            = _thrDetailService,
         _workingDayService           = _workingDayService,
         _workingTimeService          = _workingTimeService,
         _salaryEmployeeDetailService = _salaryEmployeeDetailService,
         _salaryEmployeeService       = _salaryEmployeeService,
         _salaryItemService           = _salaryItemService,
         _salarySlipDetailService     = _salarySlipDetailService,
         _salarySlipService           = _salarySlipService,
         _slipGajiDetail1Service      = _slipGajiDetail1Service,
         _slipGajiDetail2AService     = _slipGajiDetail2AService,
         _slipGajiDetailService       = _slipGajiDetailService,
         _slipGajiMiniService         = _slipGajiMiniService,
     });
 }
 public SalarySlipDetail CreateObject(SalarySlipDetail salarySlipDetail, ISalarySlipService _salarySlipService, IFormulaService _formulaService)
 {
     salarySlipDetail.Errors = new Dictionary <String, String>();
     if (_validator.ValidCreateObject(salarySlipDetail, _salarySlipService, _formulaService))
     {
         salarySlipDetail.Index = GetQueryable().Count() + 1;
         _repository.CreateObject(salarySlipDetail);
     }
     return(salarySlipDetail);
 }
        public decimal CalcSalarySlipDetail(SalarySlipDetail salarySlipDetail, IDictionary <string, decimal> salaryItemsValue, IEnumerable <SalaryItem> salaryItems, IFormulaService _formulaService)
        {
            decimal val = 0;

            if (salarySlipDetail != null)
            {
                Formula formula = _formulaService.GetObjectById(salarySlipDetail.FormulaId);
                if (formula != null)
                {
                    val = /*Math.Abs*/ (_formulaService.CalcFormula(formula, salaryItemsValue, salaryItems));
                    if (salarySlipDetail.HasMinValue)
                    {
                        val = Math.Max(val, salarySlipDetail.MinValue);
                    }
                    if (salarySlipDetail.HasMaxValue)
                    {
                        val = Math.Min(val, salarySlipDetail.MaxValue);
                    }
                }
                salarySlipDetail.Value = val;
            }
            return(val);
        }
 public SalarySlipDetail UpdateObject(SalarySlipDetail salarySlipDetail, ISalarySlipService _salarySlipService, IFormulaService _formulaService)
 {
     return(salarySlipDetail = _validator.ValidUpdateObject(salarySlipDetail, _salarySlipService, _formulaService) ? _repository.UpdateObject(salarySlipDetail) : salarySlipDetail);
 }
Beispiel #11
0
 public FormulaController(IFormulaService formulaService)
 {
     _formulaService = formulaService;
 }
Beispiel #12
0
 public ApiControllerBase(IFormulaService <TEntity> service, UserManager <User> userManager, SignInManager <User> signInManager)
 {
     _service       = service;
     _userManager   = userManager;
     _signInManager = signInManager;
 }
 public FormulaModelDriver(
     IFormulaService formulaService
     )
 {
     _formulaService = formulaService;
 }
Beispiel #14
0
        //public decimal CalcSalaryItem(int salaryItemId, int employeeId, DateTime date, IFormulaService _formulaService,
        //                    ISalaryEmployeeDetailService _salaryEmployeeDetailService, IEmployeeAttendanceDetailService _employeeAttendanceDetailService)
        //{
        //    decimal val = 0;
        //    SalaryItem salaryItem = GetObjectById(salaryItemId);
        //    if (salaryItem != null)
        //    {
        //        if (salaryItem.FormulaId.GetValueOrDefault() > 0)
        //        {
        //            val = _formulaService.CalcFormula(salaryItem.FormulaId.GetValueOrDefault(), employeeId, date, this, _salaryEmployeeDetailService, _employeeAttendanceDetailService);
        //        }
        //        else
        //        {
        //            if (Enum.IsDefined(typeof(Constant.LegacySalaryItem), salaryItem.Code))
        //            {
        //                val = _salaryEmployeeDetailService.GetObjectByEmployeeIdAndSalaryItemId(employeeId, salaryItem.Id, date).Amount;
        //            }
        //            else if (Enum.IsDefined(typeof(Constant.LegacyAttendanceItem), salaryItem.Code))
        //            {
        //                val = _employeeAttendanceDetailService.GetObjectByEmployeeIdAndSalaryItemId(employeeId, salaryItem.Id, date).Amount;
        //            }
        //            else if (Enum.IsDefined(typeof(Constant.LegacyMonthlyItem), salaryItem.Code))
        //            {
        //                val = _employeeAttendanceDetailService.GetObjectByEmployeeIdAndSalaryItemId(employeeId, salaryItem.Id, date).Amount;
        //            }
        //            else
        //            {
        //                val = salaryItem.DefaultValue;
        //            }
        //        }
        //    }
        //    return val;
        //}

        /// <summary>
        /// Menghitung nilai Salary item
        /// </summary>
        /// <param name="salaryItem">Object salary item</param>
        /// <param name="salaryItemsValue">Pair antara salaryitem code dengan nilainya</param>
        /// <param name="_formulaService">Service formula</param>
        /// <returns></returns>
        public decimal CalcSalaryItem(SalaryItem salaryItem, IDictionary <string, decimal> salaryItemsValue, IFormulaService _formulaService)
        {
            decimal val = 0;

            //SalaryItem salaryItem = GetObjectById(salaryItemId);
            if (salaryItem != null)
            {
                try
                {
                    val = salaryItemsValue[salaryItem.Code];
                }
                catch
                {
                    if (salaryItem != null)
                    {
                        val = salaryItem.DefaultValue; // CurrentValue
                    }
                }
                //if (salaryItem.FormulaId.GetValueOrDefault() > 0)
                //{
                //    var salaryItems = GetQueryable();
                //    val = _formulaService.CalcFormula(salaryItem.Formula, salaryItemsValue, salaryItems);
                //}
                //else
                //{
                //    if (Enum.IsDefined(typeof(Constant.LegacySalaryItem), salaryItem.Code))
                //    {
                //        val = salaryItemsValue[salaryItem.Code]; // _salaryEmployeeDetailService.GetObjectByEmployeeIdAndSalaryItemId(employeeId, salaryItem.Id, date).Amount;
                //    }
                //    else if (Enum.IsDefined(typeof(Constant.LegacyAttendanceItem), salaryItem.Code))
                //    {
                //        val = salaryItemsValue[salaryItem.Code]; // _employeeAttendanceDetailService.GetObjectByEmployeeIdAndSalaryItemId(employeeId, salaryItem.Id, date).Amount;
                //    }
                //    else if (Enum.IsDefined(typeof(Constant.LegacyMonthlyItem), salaryItem.Code))
                //    {
                //        val = salaryItemsValue[salaryItem.Code]; // _employeeAttendanceDetailService.GetObjectByEmployeeIdAndSalaryItemId(employeeId, salaryItem.Id, date).Amount;
                //    }
                //    else
                //    {
                //        val = salaryItem.DefaultValue;
                //    }
                //}
            }
            return(val);
        }
 public FormulaModelDriver(
     IFormulaService formulaService
     ) {
         _formulaService = formulaService;
 }
Beispiel #16
0
 public bool ValidUpdateObject(SalarySlipDetail salarySlipDetail, ISalarySlipService _salarySlipService, IFormulaService _formulaService)
 {
     salarySlipDetail.Errors.Clear();
     ValidCreateObject(salarySlipDetail, _salarySlipService, _formulaService);
     return(isValid(salarySlipDetail));
 }
Beispiel #17
0
 public bool ValidCreateObject(SalarySlipDetail salarySlipDetail, ISalarySlipService _salarySlipService, IFormulaService _formulaService)
 {
     VHasSalarySlip(salarySlipDetail, _salarySlipService);
     if (!isValid(salarySlipDetail))
     {
         return(false);
     }
     VHasFormula(salarySlipDetail, _formulaService); // VHasSalaryItem
     if (!isValid(salarySlipDetail))
     {
         return(false);
     }
     VIsValidMaxValue(salarySlipDetail);
     return(isValid(salarySlipDetail));
 }
Beispiel #18
0
 public bool ValidUpdateObject(Formula formula, IFormulaService _formulaService, ISalaryItemService _salaryItemService)
 {
     formula.Errors.Clear();
     ValidCreateObject(formula, _formulaService, _salaryItemService);
     return(isValid(formula));
 }
Beispiel #19
0
 public TeamsController(IFormulaService <FormulaTeam> service, UserManager <User> userManager, SignInManager <User> signInManager)
     : base(service, userManager, signInManager)
 {
 }