-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathhmrc-rti-eps.php
130 lines (101 loc) · 5.66 KB
/
hmrc-rti-eps.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
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
<?php
class hmrc_rti_eps extends hmrc_rti { // Employer Payment Summary - Send an EPS instead of an FPS if you've not paid any employees in a tax month.
private $employees = [];
public function message_class_get() {
return 'HMRC-PAYE-RTI-EPS';
}
public function request_body_get_xml() {
if ($this->details['year'] == 2013) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/13-14/2';
} else if ($this->details['year'] == 2014) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/14-15/1';
} else if ($this->details['year'] == 2015) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/15-16/1';
} else if ($this->details['year'] == 2016) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/16-17/1';
} else if ($this->details['year'] == 2017) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/17-18/1';
} else if ($this->details['year'] == 2018) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/18-19/1';
} else if ($this->details['year'] == 2019) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/19-20/1';
} else if ($this->details['year'] == 2020) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/20-21/1';
} else if ($this->details['year'] == 2021) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/21-22/1';
} else if ($this->details['year'] == 2022) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/22-23/1';
} else if ($this->details['year'] == 2023) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/23-24/1';
} else if ($this->details['year'] == 2024) {
$namespace = 'http://www.govtalk.gov.uk/taxation/PAYE/RTI/EmployerPaymentSummary/24-25/1';
} else {
exit_with_error('Namespace is unknown for year ' . $this->details['year']);
}
$period_range = substr($this->details['year'], -2);
$period_range = $period_range . '-' . ($period_range + 1);
$xml = '
<IRenvelope xmlns="' . xml($namespace) . '">' . $this->request_header_get_xml() . '
<EmployerPaymentSummary>
<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['corporation_tax_reference'] != '' && $this->details['year'] >= 2014) {
$xml .= '
<COTAXRef>' . xml($this->details['corporation_tax_reference']) . '</COTAXRef>';
}
$xml .= '
</EmpRefs>';
if (false) {
$xml .= '
<NoPaymentForPeriod>yes</NoPaymentForPeriod>'; // No payment due, as no employees paid in this pay period.
} else {
$xml .= '
<RecoverableAmountsYTD>
<SSPRecovered>' . xml($this->details['XXX']) . '</SSPRecovered>
<SMPRecovered>' . xml($this->details['XXX']) . '</SMPRecovered>
<SPPRecovered>' . xml($this->details['XXX']) . '</SPPRecovered>
<SAPRecovered>' . xml($this->details['XXX']) . '</SAPRecovered>
<ShPPRecovered>' . xml($this->details['XXX']) . '</ShPPRecovered>
<NICCompensationOnSMP>' . xml($this->details['XXX']) . '</NICCompensationOnSMP>
<NICCompensationOnSPP>' . xml($this->details['XXX']) . '</NICCompensationOnSPP>
<NICCompensationOnSAP>' . xml($this->details['XXX']) . '</NICCompensationOnSAP>
<NICCompensationOnShPP>' . xml($this->details['XXX']) . '</NICCompensationOnShPP>
<CISDeductionsSuffered>' . xml($this->details['XXX']) . '</CISDeductionsSuffered>
<NICsHoliday>' . xml($this->details['XXX']) . '</NICsHoliday>
</RecoverableAmountsYTD>';
}
// <ApprenticeshipLevy>
// <LevyDueYTD>1250.00</LevyDueYTD>
// <TaxMonth>3</TaxMonth>
// <AnnualAllce>15000.00</AnnualAllce>
// </ApprenticeshipLevy>
$xml .= '
<RelatedTaxYear>' . xml($period_range) . '</RelatedTaxYear>';
if (is_array($this->details['final'])) {
$xml .= '
<FinalSubmission>
<ForYear>yes</ForYear>
</FinalSubmission>';
if ($this->details['year'] < 2016) {
$xml .= '
<QuestionsAndDeclarations>
<FreeOfTaxPaymentsMadeToEmployee>' . xml($this->details['final']['free_of_tax_payments'] ? 'yes' : 'no') . '</FreeOfTaxPaymentsMadeToEmployee>
<ExpensesVouchersOrBenefitsFromOthers>' . xml($this->details['final']['expenses_and_benefits'] ? 'yes' : 'no') . '</ExpensesVouchersOrBenefitsFromOthers>
<PersonEmployedOutsideUKWorkedFor30DaysOrMore>' . xml($this->details['final']['employees_out_of_uk'] ? 'yes' : 'no') . '</PersonEmployedOutsideUKWorkedFor30DaysOrMore>
<PayToSomeoneElse>' . xml($this->details['final']['employees_pay_to_third_party'] ? 'yes' : 'no') . '</PayToSomeoneElse>
<P11DFormsDue>' . xml($this->details['final']['p11d_forms_due'] ? 'yes' : 'no') . '</P11DFormsDue>
<ServiceCompany>' . xml($this->details['final']['service_company'] ? 'yes' : 'no') . '</ServiceCompany>
</QuestionsAndDeclarations>';
}
} else if ($this->details['final'] !== false) {
exit_with_error('Invalid "final" value (should be false, or an array)');
}
$xml .= '
</FullPaymentSubmission>
</IRenvelope>';
return $xml;
}
}
?>