withholding tax
This commit is contained in:
@@ -87,9 +87,23 @@ class CreateInvoiceItem extends Job
|
||||
|
||||
$item_tax_total += $tax_amount;
|
||||
|
||||
break;
|
||||
case 'withholding':
|
||||
$tax_amount = 0 - $item_discounted_amount * ($tax->rate / 100);
|
||||
|
||||
$item_taxes[] = [
|
||||
'company_id' => $this->invoice->company_id,
|
||||
'invoice_id' => $this->invoice->id,
|
||||
'tax_id' => $tax_id,
|
||||
'name' => $tax->name,
|
||||
'amount' => $tax_amount,
|
||||
];
|
||||
|
||||
$item_tax_total += $tax_amount;
|
||||
|
||||
break;
|
||||
default:
|
||||
$tax_amount = ($item_discounted_amount / 100) * $tax->rate;
|
||||
$tax_amount = $item_discounted_amount * ($tax->rate / 100);
|
||||
|
||||
$item_taxes[] = [
|
||||
'company_id' => $this->invoice->company_id,
|
||||
@@ -167,7 +181,7 @@ class CreateInvoiceItem extends Job
|
||||
|
||||
foreach ($item_taxes as $item_tax) {
|
||||
$item_tax['invoice_item_id'] = $invoice_item->id;
|
||||
$item_tax['amount'] = round($item_tax['amount'], $precision);
|
||||
$item_tax['amount'] = round(abs($item_tax['amount']), $precision);
|
||||
|
||||
InvoiceItemTax::create($item_tax);
|
||||
}
|
||||
|
||||
@@ -95,7 +95,7 @@ class CreateInvoiceItemsAndTotals extends Job
|
||||
'invoice_id' => $this->invoice->id,
|
||||
'code' => 'tax',
|
||||
'name' => $tax['name'],
|
||||
'amount' => round($tax['amount'], $precision),
|
||||
'amount' => round(abs($tax['amount']), $precision),
|
||||
'sort_order' => $sort_order,
|
||||
]);
|
||||
|
||||
@@ -116,7 +116,7 @@ class CreateInvoiceItemsAndTotals extends Job
|
||||
$total['code'] = 'extra';
|
||||
}
|
||||
|
||||
$total['amount'] = round($total['amount'], $precision);
|
||||
$total['amount'] = round(abs($total['amount']), $precision);
|
||||
|
||||
InvoiceTotal::create($total);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user