public static InsuranceSalary CalculateInsuranceSalary( SalaryConfig salaryConfig, EmployeeMonthlyRecord employeeMonthlyRecord) { var insurancePaidAmount = salaryConfig.IsInsurancePaidFullSalary ? employeeMonthlyRecord.GrossContractedSalary.Amount : salaryConfig.InsurancePaidAmount; var actualPaidAmount = employeeMonthlyRecord.IsEligibleForSocialInsurance() || employeeMonthlyRecord.IsOnProbation() ? insurancePaidAmount : Money.ZeroVND; return(new InsuranceSalary(actualPaidAmount)); }
private static Money Calculate( EmployeeMonthlyRecord employeeMonthlyRecord, Money minimumWage, decimal coefficientSocialCare, decimal rateOfDeductionOfCompulsoryInsurance, Money amount) { if (employeeMonthlyRecord.IsEligibleForSocialInsurance() is false || employeeMonthlyRecord.IsOnProbation()) { return(Money.ZeroVND); } var specifiedAmount = minimumWage * coefficientSocialCare; if (amount > specifiedAmount) { return(specifiedAmount * rateOfDeductionOfCompulsoryInsurance); } return(amount * rateOfDeductionOfCompulsoryInsurance); }