-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathhmrc-rti-eas.php
90 lines (69 loc) · 2.34 KB
/
hmrc-rti-eas.php
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
<?php
class hmrc_rti_eas extends hmrc_rti { // Employer Alignment Submission
private $employees = [];
public function message_class_get() {
return 'HMRC-PAYE-RTI-EAS';
}
public function employee_add($details) {
$this->employees[] = array_merge(array(
'national_insurance_number' => NULL,
'name' => NULL,
'address' => NULL,
'birth_date' => NULL,
'gender' => NULL,
'pay_id' => NULL,
'payment_tax_code' => NULL,
), $details);
}
public function request_body_get_xml() {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerAlignmentSubmission/3';
$xml = '
<IRenvelope xmlns="' . xml($namespace) . '">' . $this->request_header_get_xml() . '
<EmployerAlignmentSubmission>
<EmpRefs>
<OfficeNo>' . xml($this->details['tax_office_number']) . '</OfficeNo>
<PayeRef>' . xml($this->details['tax_office_reference']) . '</PayeRef>
<AORef>' . xml($this->details['accounts_office_reference']) . '</AORef>';
if ($this->details['year'] >= 2014) {
$xml .= '
<COTAXRef>' . xml($this->details['corporation_tax_reference']) . '</COTAXRef>';
}
$xml .= '
</EmpRefs>
<NumberOfParts>1</NumberOfParts>';
foreach ($this->employees as $employee) {
$xml .= '
<Employee>
<EmployeeDetails>
<NINO>' . xml($employee['national_insurance_number']) . '</NINO>
<Name>
<Ttl>' . xml($employee['name']['title']) . '</Ttl>
<Fore>' . xml($employee['name']['forename']) . '</Fore>
<Sur>' . xml($employee['name']['surname']) . '</Sur>
</Name>
<Address>';
foreach ($employee['address']['lines'] as $line) {
$xml .= '
<Line>' . xml($line) . '</Line>';
}
$xml .= '
<UKPostcode>' . xml($employee['address']['postcode']) . '</UKPostcode>
</Address>
<BirthDate>' . xml($employee['birth_date']) . '</BirthDate>
<Gender>' . xml($employee['gender']) . '</Gender>
</EmployeeDetails>
<Employment>
<PayId>' . xml($employee['pay_id']) . '</PayId>
<Payment>
<TaxCode>' . xml($employee['payment_tax_code']) . '</TaxCode>
</Payment>
</Employment>
</Employee>';
}
$xml .= '
</EmployerAlignmentSubmission>
</IRenvelope>';
return $xml;
}
}
?>