Пример #1
0
 public void can_create_payroll_of_active_employees()
 {
     using (var uow = new NHUnitOfWork()) {
         var ees    = _employees.FetchAllActive();
         var actual = ees.Count;
         var pr     = PayrollReport.Create(ees, Date.Now);
         EventBroker.getInstance().Command(new CommandIncludeSalaryDeductionInReport(pr));
         Assert.True(ees.Count > 0);
         Assert.Equal(pr.Records.Count, actual);
         _payrolls.Save(pr);
         uow.Commit();
     }
 }
Пример #2
0
        private void SavePayroll()
        {
            Payroll payroll = new Payroll();

            payroll.OtherAllowance         = decimal.Parse(txtOtherAllowance.Text == "" ? "0" : txtOtherAllowance.Text.Replace(".", ""));
            payroll.TotalFixedAllowance    = decimal.Parse(txtTotalFixed.Text == "" ? "0" : txtTotalFixed.Text.Replace(".", ""));
            payroll.FuelDay                = int.Parse(txtFuelDay.Text == "" ? "0" : txtFuelDay.Text);
            payroll.TotalFuel              = decimal.Parse(txtTotalFuel.Text == "" ? "0" : txtTotalFuel.Text.Replace(".", ""));
            payroll.VehicleDay             = int.Parse(txtVehicleDay.Text == "" ? "0" : txtVehicleDay.Text);
            payroll.TotalVehicle           = decimal.Parse(txtTotalVehicle.Text == "" ? "0" : txtTotalVehicle.Text.Replace(".", ""));
            payroll.LunchDay               = int.Parse(txtLunchDay.Text == "" ? "0" : txtLunchDay.Text);
            payroll.TotalLunch             = decimal.Parse(txtTotalLunch.Text == "" ? "0" : txtTotalLunch.Text.Replace(".", ""));
            payroll.TransportationDay      = int.Parse(txtTransportDay.Text == "" ? "0" : txtTransportDay.Text);
            payroll.TotalTransportation    = decimal.Parse(txtTotalTransport.Text == "" ? "0" : txtTotalTransport.Text.Replace(".", ""));
            payroll.TotalNonFixedAllowance = decimal.Parse(txtTotalNonFixed.Text == "" ? "0" : txtTotalNonFixed.Text.Replace(".", ""));
            payroll.PersonalDebt           = decimal.Parse(txtPersonalDebt.Text == "" ? "0" : txtPersonalDebt.Text.Replace(".", ""));
            payroll.OtherFee               = decimal.Parse(txtOtherFee.Text == "" ? "0" : txtOtherFee.Text.Replace(".", ""));
            payroll.TotalFee               = decimal.Parse(txtTotalFee.Text == "" ? "0" : txtTotalFee.Text.Replace(".", ""));
            payroll.GrandTotal             = decimal.Parse(txtGrandTotal.Text == "" ? "0" : txtGrandTotal.Text.Replace(".", ""));

            if (payroll.GrandTotal > 0)
            {
                string amountInWords = Store.GetAmounInWords(Convert.ToInt32(payroll.GrandTotal));
                string firstLetter   = amountInWords.Substring(0, 2).Trim().ToUpper();
                string theRest       = amountInWords.Substring(2, amountInWords.Length - 2);
                payroll.AmountInWords = firstLetter + theRest + " rupiah";
            }
            else
            {
                payroll.AmountInWords = "Nol rupiah";
            }

            if (formMode == FormMode.Add)
            {
                payrollRepository.Save(payroll);
                GetLastPayroll();
            }
            else if (formMode == FormMode.Edit)
            {
                payroll.ID = new Guid(txtID.Text);
                payrollRepository.UpdateValue(payroll);
            }

            GetLastPayroll();
            DisableForm();

            formMode  = FormMode.View;
            this.Text = "Penggajian";
        }