withholding tax
This commit is contained in:
@@ -87,9 +87,23 @@ class CreateBillItem extends Job
|
||||
|
||||
$item_tax_total += $tax_amount;
|
||||
|
||||
break;
|
||||
case 'withholding':
|
||||
$tax_amount = 0 - $item_discounted_amount * ($tax->rate / 100);
|
||||
|
||||
$item_taxes[] = [
|
||||
'company_id' => $this->bill->company_id,
|
||||
'bill_id' => $this->bill->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->bill->company_id,
|
||||
@@ -167,7 +181,7 @@ class CreateBillItem extends Job
|
||||
|
||||
foreach ($item_taxes as $item_tax) {
|
||||
$item_tax['bill_item_id'] = $bill_item->id;
|
||||
$item_tax['amount'] = round($item_tax['amount'], $precision);
|
||||
$item_tax['amount'] = round(abs($item_tax['amount']), $precision);
|
||||
|
||||
BillItemTax::create($item_tax);
|
||||
}
|
||||
|
||||
@@ -3,7 +3,6 @@
|
||||
namespace App\Jobs\Purchase;
|
||||
|
||||
use App\Abstracts\Job;
|
||||
use App\Models\Purchase\Bill;
|
||||
use App\Models\Purchase\BillTotal;
|
||||
use App\Traits\Currencies;
|
||||
use App\Traits\DateTime;
|
||||
@@ -96,7 +95,7 @@ class CreateBillItemsAndTotals extends Job
|
||||
'bill_id' => $this->bill->id,
|
||||
'code' => 'tax',
|
||||
'name' => $tax['name'],
|
||||
'amount' => round($tax['amount'], $precision),
|
||||
'amount' => round(abs($total['amount']), $precision),
|
||||
'sort_order' => $sort_order,
|
||||
]);
|
||||
|
||||
@@ -117,7 +116,7 @@ class CreateBillItemsAndTotals extends Job
|
||||
$total['code'] = 'extra';
|
||||
}
|
||||
|
||||
$total['amount'] = round($total['amount'], $precision);
|
||||
$total['amount'] = round(abs($total['amount']), $precision);
|
||||
|
||||
BillTotal::create($total);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user