-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathmain.php
More file actions
executable file
·30 lines (25 loc) · 1.12 KB
/
main.php
File metadata and controls
executable file
·30 lines (25 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
<?php
include('PayslipProcessor.php');
include('PayslipOutter.php');
include('Employee.php');
include('PayslipInfo.php');
if (isset($_POST['csv_input'])) {
$csvFile = 'test.csv';
$employees = PayslipProcessor::readCSV($csvFile);
$processor = new PayslipProcessor($employees);
$payslipDetails = $processor->generatePayslip();
$out = new PayslipOutter();
$out->csvOutPut($payslipDetails);
} else {
$firstName = !empty($_POST['first_name']) ? $_POST['first_name'] : '';
$lastName = !empty($_POST['last_name']) ? $_POST['last_name'] : '';
$annualSalary = !empty($_POST['annual_salary']) ? $_POST['annual_salary'] : '';
$superRate = !empty($_POST['super_rate']) ? $_POST['super_rate'] : '';
$paymentStartDate = !empty($_POST['payment_start_date']) ? $_POST['payment_start_date'] : '';
$employee = new Employee($firstName, $lastName, $annualSalary, $superRate, $paymentStartDate);
$out = new PayslipOutter();
$processor = new PayslipProcessor([$employee]);
$payslipDetails = $processor->generatePayslip();
$out->stringOutPut($payslipDetails[0]);
}
?>