Skip to content

Commit

Permalink
Pull in changes from remote master
Browse files Browse the repository at this point in the history
  • Loading branch information
steveblamey committed Oct 11, 2021
2 parents f6e5b45 + 1f740fe commit a662baa
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions modules/public_pages/erp/ledger/vat/models/Vat.php
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,13 @@ function closePeriod($tax_period, $year, &$errors)

$this->tax_period_closed = true;

$values = $this->getVATvalues($year, $tax_period);
// added by MJS - we need to know the VAT return we're dealing so adjustments are included in getVATvalues()
// but we also do this further down to store those values so it may be we can change the order
$return = new VatReturn();
$return->loadVatReturn($year, $tax_period);

// We should now get back the correct box values INCLUDING adjustments if there are any
$values = $this->getVATvalues($year, $tax_period, $return->id);

$output_tax = $values['outputs']; //$this->getVATSum(1)

Expand Down Expand Up @@ -297,7 +303,7 @@ function getVATvalues($year=null, $tax_period=null, $return_id=null)
$qparams2 = $return_id;
$query2 = <<<'QUERY'
select coalesce(sum(vat_due_sales),0.00) as "Box1_adj", coalesce(sum(vat_reclaimed_curr_period), 0.00) as "Box4_adj", coalesce(sum(total_value_sales_ex_vat),0.00) as "Box6_adj",
coalesce(sum(total_value_purchase_ex_vat),0.00) as "Box7 adj"
coalesce(sum(total_value_purchase_ex_vat),0.00) as "Box7_adj"
from vat_adjustment
where vat_return_id=?
group by vat_return_id
Expand Down

0 comments on commit a662baa

Please sign in to comment.