Ejemplo n.º 1
0
    def test_hourly_union_member_service_charge(self):
        emp_id = EmpId(1)
        transaction = AddHourlyEmployee(emp_id,
                                        'Bill',
                                        'Home',
                                        hourly_rate=15.24)
        transaction.execute()
        member_id = MemberId(7734)
        transaction = ChangeMemberTransaction(emp_id, member_id, dues=9.42)
        transaction.execute()

        pay_date = date(2001, 11, 9)
        transaction = ServiceChargeTransaction(member_id,
                                               pay_date,
                                               charge=19.42)
        transaction.execute()
        transaction = TimecardTransaction(emp_id, pay_date, hours=8.0)
        transaction.execute()
        transaction = PaydayTransaction(pay_date)
        transaction.execute()

        paycheck = transaction.get_paycheck(emp_id)
        self.assertEqual(pay_date, paycheck.get_period_end_date())
        self.assertEqual(8 * 15.24, paycheck.get_gross_pay())
        self.assertEqual('Hold', paycheck.get_field('Disposition'))
        self.assertEqual(9.42 + 19.42, paycheck.get_deductions())
        self.assertEqual(8 * 15.24 - (9.42 + 19.42), paycheck.get_net_pay())
Ejemplo n.º 2
0
    def test_pay_single_hourly_employee_two_time_cards(self):
        emp_id = EmpId(2)
        transaction = AddHourlyEmployee(emp_id,
                                        'Bill',
                                        'Home',
                                        hourly_rate=15.25)
        transaction.execute()
        pay_date = date(2001, 11, 9)  # Friday

        transaction = TimecardTransaction(emp_id, pay_date, hours=2.0)
        transaction.execute()
        transaction = TimecardTransaction(emp_id, date(2001, 11, 8), hours=5.0)
        transaction.execute()
        transaction = PaydayTransaction(pay_date)
        transaction.execute()
        self.validate_paycheck(transaction, emp_id, pay_date,
                               (2.0 + 5.0) * 15.25)
Ejemplo n.º 3
0
    def test_pay_single_hourly_employee_with_time_cards_spanning_two_pay_periods(
            self):
        emp_id = EmpId(2)
        transaction = AddHourlyEmployee(emp_id,
                                        'Bill',
                                        'Home',
                                        hourly_rate=15.25)
        transaction.execute()
        pay_date = date(2001, 11, 9)  # Friday
        date_in_previous_pay_period = date(2001, 11, 2)

        transaction = TimecardTransaction(emp_id, pay_date, hours=2.0)
        transaction.execute()
        transaction = TimecardTransaction(emp_id,
                                          date_in_previous_pay_period,
                                          hours=5.0)
        transaction.execute()
        transaction = PaydayTransaction(pay_date)
        transaction.execute()
        self.validate_paycheck(transaction, emp_id, pay_date, 2.0 * 15.25)
Ejemplo n.º 4
0
    def test_pay_single_hourly_employee_one_wrong_date(self):
        emp_id = EmpId(2)
        transaction = AddHourlyEmployee(emp_id,
                                        'Bill',
                                        'Home',
                                        hourly_rate=15.25)
        transaction.execute()
        pay_date = date(2001, 11, 8)  # Thursday

        transaction = TimecardTransaction(emp_id, pay_date, hours=9.0)
        transaction.execute()
        transaction = PaydayTransaction(pay_date)
        transaction.execute()
        self.assertFalse(transaction.get_paycheck(emp_id))
Ejemplo n.º 5
0
    def test_timecard_transaction(self):
        emp_id = EmpId(2)
        transaction = AddHourlyEmployee(emp_id,
                                        'Bill',
                                        'Home',
                                        hourly_rate=15.25)
        transaction.execute()

        transaction = TimecardTransaction(emp_id, date=20011031, hours=8.0)
        transaction.execute()
        employee = g_payroll_database.get_employee(emp_id)
        classification = employee.get_classification()

        timecard = classification.get_timecard(date=20011031)
        self.assertTrue(timecard)
        self.assertEqual(8.0, timecard.get_hours())
Ejemplo n.º 6
0
    def test_service_charge_spanning_multiple_pay_periods(self):
        emp_id = EmpId(1)
        transaction = AddHourlyEmployee(emp_id,
                                        'Bill',
                                        'Home',
                                        hourly_rate=15.24)
        transaction.execute()
        member_id = MemberId(7734)
        transaction = ChangeMemberTransaction(emp_id, member_id, dues=9.42)
        transaction.execute()

        early_date = date(2001, 11, 2)  # previous Friday
        pay_date = date(2001, 11, 9)
        late_date = date(2001, 11, 16)  # next Friday
        transaction = ServiceChargeTransaction(member_id,
                                               pay_date,
                                               charge=19.42)
        transaction.execute()
        transaction = ServiceChargeTransaction(member_id,
                                               early_date,
                                               charge=100)
        transaction.execute()
        transaction = ServiceChargeTransaction(member_id,
                                               late_date,
                                               charge=200)
        transaction.execute()
        transaction = TimecardTransaction(emp_id, pay_date, hours=8.0)
        transaction.execute()
        transaction = PaydayTransaction(pay_date)
        transaction.execute()

        paycheck = transaction.get_paycheck(emp_id)
        self.assertEqual(pay_date, paycheck.get_period_end_date())
        self.assertEqual(8 * 15.24, paycheck.get_gross_pay())
        self.assertEqual('Hold', paycheck.get_field('Disposition'))
        self.assertEqual(9.42 + 19.42, paycheck.get_deductions())
        self.assertEqual(8 * 15.24 - (9.42 + 19.42), paycheck.get_net_pay())