Exemple #1
0
        public static DeductionPayment Create(Deduction deduction, MonetaryValue custom_payment = null)
        {
            var record = new DeductionPayment {
                _employee  = deduction.GetEmployee(),
                _deduction = deduction,
                // PaidAmount = (custom_payment is null) ? deduction.AmortizedAmount : custom_payment.PreciseValue
                PaidAmount = custom_payment ?? deduction.AmortizedAmount
            };

            // emit event
            EventBroker.getInstance().Emit(new EventDeductionPaymentCreated(record, deduction));

            return(record);
        }
Exemple #2
0
        // TODO: use CQRS Query
        private void onCommandIncludeSalaryDeductionInReport(object sender, Command cmd)
        {
            if (cmd is CommandIncludeSalaryDeductionInReport)
            {
                var args = cmd as CommandIncludeSalaryDeductionInReport;

                if (args.PayrollReport.Equals(this._payroll_report))
                {
                    foreach (var deduction in this._salary.ActiveDeductions)
                    {
                        // because deduction can be whole even if the payroll is half
                        // we include the MonthlyUnit for deduction payment in CQRS command
                        var amount  = deduction.AmortizedAmount.PreciseValue * (decimal)args.MonthlyUnit;
                        var payment = DeductionPayment.Create(deduction, MonetaryValue.of(deduction.MonetaryCode, amount));
                        this._deduction_payments.Add(payment);
                        this._gross_deduction += payment.PaidAmount.PreciseValue;

                        EventBroker.getInstance().Emit(new EventDeductionPaymentIncludedInPayroll(this._payroll_report, payment));
                    }
                }
            }
        }
Exemple #3
0
 public EventExcludedDeductionPayment(DeductionPayment payment, Employee employee, PayrollReport report)
 {
     this.DeductionPayment = payment;
     this.Employee         = employee;
     this.Report           = report;
 }
Exemple #4
0
 public EventDeductionPaymentCreated(DeductionPayment payment, Deduction deduction)
 {
     this.Deduction        = deduction;
     this.DeductionPayment = payment;
 }
Exemple #5
0
 public EventDeductionPaymentCreated(PayrollReport pr, Deduction d, DeductionPayment dp)
 {
     PayrollReport    = pr;
     Deduction        = d;
     DeductionPayment = dp;
 }
 public EventDeductionPaymentIncludedInPayroll(PayrollReport report, DeductionPayment payment)
 {
     this.PayrollReport    = report;
     this.DeductionPayment = payment;
 }