Invoice and bill create/update empty tax issue solved.
This commit is contained in:
parent
404c5ca41c
commit
f372e3636e
@ -59,6 +59,7 @@ class CreateBill
|
|||||||
$sub_total += $bill_item->total;
|
$sub_total += $bill_item->total;
|
||||||
|
|
||||||
// Set taxes
|
// Set taxes
|
||||||
|
if ($bill_item->item_taxes) {
|
||||||
foreach ($bill_item->item_taxes as $item_tax) {
|
foreach ($bill_item->item_taxes as $item_tax) {
|
||||||
if (isset($taxes) && array_key_exists($item_tax['tax_id'], $taxes)) {
|
if (isset($taxes) && array_key_exists($item_tax['tax_id'], $taxes)) {
|
||||||
$taxes[$item_tax['tax_id']]['amount'] += $item_tax['amount'];
|
$taxes[$item_tax['tax_id']]['amount'] += $item_tax['amount'];
|
||||||
@ -71,6 +72,7 @@ class CreateBill
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$s_total = $sub_total;
|
$s_total = $sub_total;
|
||||||
|
|
||||||
|
@ -180,8 +180,12 @@ class CreateBillItem
|
|||||||
'total' => $item_amount,
|
'total' => $item_amount,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!empty($this->data['tax_id'])) {
|
$bill_item->item_taxes = false;
|
||||||
|
$bill_item->inclusives = false;
|
||||||
|
$bill_item->compounds = false;
|
||||||
|
|
||||||
// set item_taxes for
|
// set item_taxes for
|
||||||
|
if (!empty($this->data['tax_id'])) {
|
||||||
$bill_item->item_taxes = $item_taxes;
|
$bill_item->item_taxes = $item_taxes;
|
||||||
$bill_item->inclusives = $inclusives;
|
$bill_item->inclusives = $inclusives;
|
||||||
$bill_item->compounds = $compounds;
|
$bill_item->compounds = $compounds;
|
||||||
|
@ -62,6 +62,7 @@ class UpdateBill
|
|||||||
$sub_total += $bill_item->total;
|
$sub_total += $bill_item->total;
|
||||||
|
|
||||||
// Set taxes
|
// Set taxes
|
||||||
|
if ($bill_item->item_taxes) {
|
||||||
foreach ($bill_item->item_taxes as $item_tax) {
|
foreach ($bill_item->item_taxes as $item_tax) {
|
||||||
if (isset($taxes) && array_key_exists($item_tax['tax_id'], $taxes)) {
|
if (isset($taxes) && array_key_exists($item_tax['tax_id'], $taxes)) {
|
||||||
$taxes[$item_tax['tax_id']]['amount'] += $item_tax['amount'];
|
$taxes[$item_tax['tax_id']]['amount'] += $item_tax['amount'];
|
||||||
@ -74,6 +75,7 @@ class UpdateBill
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$s_total = $sub_total;
|
$s_total = $sub_total;
|
||||||
|
|
||||||
|
@ -60,6 +60,7 @@ class CreateInvoice
|
|||||||
$sub_total += $invoice_item->total;
|
$sub_total += $invoice_item->total;
|
||||||
|
|
||||||
// Set taxes
|
// Set taxes
|
||||||
|
if ($invoice_item->item_taxes) {
|
||||||
foreach ($invoice_item->item_taxes as $item_tax) {
|
foreach ($invoice_item->item_taxes as $item_tax) {
|
||||||
if (isset($taxes) && array_key_exists($item_tax['tax_id'], $taxes)) {
|
if (isset($taxes) && array_key_exists($item_tax['tax_id'], $taxes)) {
|
||||||
$taxes[$item_tax['tax_id']]['amount'] += $item_tax['amount'];
|
$taxes[$item_tax['tax_id']]['amount'] += $item_tax['amount'];
|
||||||
@ -72,6 +73,7 @@ class CreateInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$s_total = $sub_total;
|
$s_total = $sub_total;
|
||||||
|
|
||||||
|
@ -207,8 +207,12 @@ class CreateInvoiceItem
|
|||||||
'total' => $item_amount,
|
'total' => $item_amount,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
if (!empty($this->data['tax_id'])) {
|
$invoice_item->item_taxes = false;
|
||||||
|
$invoice_item->inclusives = false;
|
||||||
|
$invoice_item->compounds = false;
|
||||||
|
|
||||||
// set item_taxes for
|
// set item_taxes for
|
||||||
|
if (!empty($this->data['tax_id'])) {
|
||||||
$invoice_item->item_taxes = $item_taxes;
|
$invoice_item->item_taxes = $item_taxes;
|
||||||
$invoice_item->inclusives = $inclusives;
|
$invoice_item->inclusives = $inclusives;
|
||||||
$invoice_item->compounds = $compounds;
|
$invoice_item->compounds = $compounds;
|
||||||
|
@ -63,6 +63,7 @@ class UpdateInvoice
|
|||||||
$sub_total += $invoice_item->total;
|
$sub_total += $invoice_item->total;
|
||||||
|
|
||||||
// Set taxes
|
// Set taxes
|
||||||
|
if ($invoice_item->item_taxes) {
|
||||||
foreach ($invoice_item->item_taxes as $item_tax) {
|
foreach ($invoice_item->item_taxes as $item_tax) {
|
||||||
if (isset($taxes) && array_key_exists($item_tax['tax_id'], $taxes)) {
|
if (isset($taxes) && array_key_exists($item_tax['tax_id'], $taxes)) {
|
||||||
$taxes[$item_tax['tax_id']]['amount'] += $item_tax['amount'];
|
$taxes[$item_tax['tax_id']]['amount'] += $item_tax['amount'];
|
||||||
@ -75,6 +76,7 @@ class UpdateInvoice
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
$s_total = $sub_total;
|
$s_total = $sub_total;
|
||||||
|
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
@stack('taxes_td_start')
|
@stack('taxes_td_start')
|
||||||
<td {{ $errors->has('item.' . $item_row . '.tax_id') ? 'class="has-error"' : '' }}>
|
<td {{ $errors->has('item.' . $item_row . '.tax_id') ? 'class="has-error"' : '' }}>
|
||||||
@stack('tax_id_input_start')
|
@stack('tax_id_input_start')
|
||||||
{!! Form::select('item[' . $item_row . '][tax_id][]', $taxes, empty($item) ? setting('general.default_tax') : $item->tax_id, ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control tax-select2', 'multiple' => 'true']) !!}
|
{!! Form::select('item[' . $item_row . '][tax_id][]', $taxes, (empty($item) || empty($item->tax_id)) ? setting('general.default_tax') : $item->tax_id, ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control tax-select2', 'multiple' => 'true']) !!}
|
||||||
{!! $errors->first('item.' . $item_row . '.tax_id', '<p class="help-block">:message</p>') !!}
|
{!! $errors->first('item.' . $item_row . '.tax_id', '<p class="help-block">:message</p>') !!}
|
||||||
@stack('tax_id_input_end')
|
@stack('tax_id_input_end')
|
||||||
</td>
|
</td>
|
||||||
|
@ -35,7 +35,7 @@
|
|||||||
@stack('taxes_td_start')
|
@stack('taxes_td_start')
|
||||||
<td {{ $errors->has('item.' . $item_row . '.tax_id') ? 'class="has-error"' : '' }}>
|
<td {{ $errors->has('item.' . $item_row . '.tax_id') ? 'class="has-error"' : '' }}>
|
||||||
@stack('tax_id_input_start')
|
@stack('tax_id_input_start')
|
||||||
{!! Form::select('item[' . $item_row . '][tax_id][]', $taxes, empty($item) ? setting('general.default_tax') : $item->tax_id, ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control tax-select2', 'multiple' => 'true']) !!}
|
{!! Form::select('item[' . $item_row . '][tax_id][]', $taxes, (empty($item) || empty($item->tax_id)) ? setting('general.default_tax') : $item->tax_id, ['id'=> 'item-tax-'. $item_row, 'class' => 'form-control tax-select2', 'multiple' => 'true']) !!}
|
||||||
{!! $errors->first('item.' . $item_row . '.tax_id', '<p class="help-block">:message</p>') !!}
|
{!! $errors->first('item.' . $item_row . '.tax_id', '<p class="help-block">:message</p>') !!}
|
||||||
@stack('tax_id_input_end')
|
@stack('tax_id_input_end')
|
||||||
</td>
|
</td>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user