Invoice/ bill item price row calculate..

This commit is contained in:
Cüneyt Şentürk
2020-02-10 00:24:18 +03:00
parent 1271a23755
commit a2cdc2c3d9
13 changed files with 259 additions and 78 deletions

View File

@@ -65,7 +65,10 @@
@stack('add_item_td_start')
<tr class="row" id="addItem">
<td class="col-md-1 action-column border-right-0 border-bottom-0"><button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i></button></td>
<td class="col-md-1 action-column border-right-0 border-bottom-0">
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button>
</td>
<td class="col-md-11 text-right border-bottom-0"></td>
</tr>
@stack('add_item_td_end')
@@ -76,6 +79,7 @@
<strong>{{ trans('bills.sub_total') }}</strong>
</td>
<td class="col-md-2 text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('sub_total', '', '', ['disabled' => 'disabled', 'required' => 'required', 'v-model' => 'totals.sub', 'currency' => $currency, 'dynamic-currency' => 'currency', 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="sub-total" v-html="totals.sub">0</span>
</td>
</tr>
@@ -112,7 +116,7 @@
<div class="discount card-footer">
<div class="row text-center">
<div class="col-md-12">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-icon btn-outline-secondary">
<a href="javascript:void(0)" @click="discount = false" class="btn btn-icon btn-outline-secondary">
<span class="btn-inner--icon"><i class="fas fa-times"></i></span>
<span class="btn-inner--text">{{ trans('general.cancel') }}</span>
</a>
@@ -138,6 +142,7 @@
<strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td>
<td class="col-md-2 text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('tax_total', '', '', ['disabled' => 'disabled', 'required' => 'required', 'v-model' => 'totals.tax', 'currency' => $currency, 'dynamic-currency' => 'currency', 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="tax-total" v-html="totals.tax">0</span>
</td>
</tr>
@@ -149,6 +154,7 @@
<strong>{{ trans('bills.total') }}</strong>
</td>
<td class="col-md-2 text-right long-texts">
{{ Form::moneyGroup('grand_total', '', '', ['disabled' => 'disabled', 'required' => 'required', 'v-model' => 'totals.total', 'currency' => $currency, 'dynamic-currency' => 'currency', 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="grand-total" v-html="totals.total">0</span>
</td>
</tr>

View File

@@ -66,7 +66,10 @@
@stack('add_item_td_start')
<tr class="row" id="addItem">
<td class="col-md-1 action-column border-right-0 border-bottom-0"><button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i></button></td>
<td class="col-md-1 action-column border-right-0 border-bottom-0">
<button type="button" @click="onAddItem" id="button-add-item" data-toggle="tooltip" title="{{ trans('general.add') }}" class="btn btn-icon btn-outline-success btn-lg" data-original-title="{{ trans('general.add') }}"><i class="fa fa-plus"></i>
</button>
</td>
<td class="col-md-11 text-right border-bottom-0"></td>
</tr>
@stack('add_item_td_end')
@@ -77,6 +80,7 @@
<strong>{{ trans('bills.sub_total') }}</strong>
</td>
<td class="col-md-2 text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('sub_total', '', '', ['disabled' => 'disabled', 'required' => 'required', 'v-model' => 'totals.sub', 'currency' => $currency, 'dynamic-currency' => 'currency', 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="sub-total" v-html="totals.sub">0</span>
</td>
</tr>
@@ -139,6 +143,7 @@
<strong>{{ trans_choice('general.taxes', 1) }}</strong>
</td>
<td class="col-md-2 text-right border-bottom-0 long-texts">
{{ Form::moneyGroup('tax_total', '', '', ['disabled' => 'disabled', 'required' => 'required', 'v-model' => 'totals.tax', 'currency' => $currency, 'dynamic-currency' => 'currency', 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="tax-total" v-html="totals.tax">0</span>
</td>
</tr>
@@ -150,6 +155,7 @@
<strong>{{ trans('bills.total') }}</strong>
</td>
<td class="col-md-2 text-right long-texts">
{{ Form::moneyGroup('grand_total', '', '', ['disabled' => 'disabled', 'required' => 'required', 'v-model' => 'totals.total', 'currency' => $currency, 'dynamic-currency' => 'currency', 'masked' => 'true'], 0.00, 'text-right d-none') }}
<span id="grand-total" v-html="totals.total">0</span>
</td>
</tr>

View File

@@ -21,7 +21,7 @@
:placeholder="'{{ trans('general.type_item_name') }}'"
:name="'item_id'"
:options="{{ json_encode($items) }}"
:value="'{{ old('item_id', '') }}'"
:value="form.items[index].item_id"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
@@ -69,15 +69,7 @@
@stack('price_td_start')
<td class="col-md-2 border-right-0 border-bottom-0">
@stack('price_input_start')
<input class="form-control text-right input-price"
autocomplete="off"
required="required"
data-item="price"
v-model.lazy="row.price"
v-money="money"
@input="onCalculateTotal"
name="items[][price]"
type="text">
{{ Form::moneyGroup('name', '', '', ['required' => 'required', 'v-model' => 'row.price', 'data-item' => 'price', 'currency' => $currency, 'dynamic-currency' => 'currency', 'change' => 'row.price = $event; onCalculateTotal'], 0.00, 'text-right input-price') }}
<input name="items[][currency]"
data-item="currency"
v-model="row.currency"
@@ -91,30 +83,55 @@
@stack('taxes_td_start')
<td class="col-md-3 border-right-0 border-bottom-0">
@stack('tax_id_input_start')
{{ Form::multiSelectAddNewGroup('tax_id', '', '', $taxes, '', [
'data-item' => 'tax_id',
'v-model' => 'row.tax_id',
'change' => 'onCalculateTotal',
'class' => 'form-control',
'collapse' => 'false',
'path' => route('modals.taxes.create')
], 'mb-0 select-tax') }}
<akaunting-select
class="mb-0 select-tax"
:form-classes="[{'has-error': form.errors.get('tax_id') }]"
:icon="''"
:title="''"
:placeholder="'{{ trans('general.form.select.field', ['field' => trans_choice('general.taxes', 1)]) }}'"
:name="'tax_id'"
:options="{{ json_encode($taxes) }}"
:value="row.tax_id"
:multiple="true"
:add-new="{{ json_encode([
'status' => true,
'text' => trans('general.add_new'),
'path' => route('modals.taxes.create'),
'type' => 'modal',
'field' => 'name',
'buttons' => [
'cancel' => [
'text' => trans('general.cancel'),
'icon' => 'fas fa-times',
'class' => 'btn-outline-secondary'
],
'confirm' => [
'text' => trans('general.save'),
'icon' => 'fas fa-save',
'class' => 'btn-success'
]
]
])}}"
:collapse="false"
@interface="row.tax_id = $event"
@change="onCalculateTotal($event)"
:form-error="form.errors.get('tax_id')"
:no-data-text="'{{ trans('general.no_data') }}'"
:no-matching-data-text="'{{ trans('general.no_matching_data') }}'"
></akaunting-select>
@stack('tax_id_input_end')
</td>
@stack('taxes_td_end')
@stack('total_td_start')
<td class="col-md-2 text-right total-column border-bottom-0 long-texts">
<input name="item[][total]"
data-item="total"
v-model.lazy="row.total"
v-money="money"
type="hidden">
{{ Form::moneyGroup('total', '', '', ['required' => 'required', 'v-model' => 'row.total', 'data-item' => 'total', 'currency' => $currency, 'dynamic-currency' => 'currency', 'masked' => 'true'], 0.00, 'text-right input-price d-none') }}
@stack('total_input_start')
<span id="item-total" v-if="row.total" v-html="row.total">0</span>
@if (empty($item) || !isset($item->total))
<span id="item-total" v-html="row.total">0</span>
<span id="item-total" v-else>@money(0, $currency->code, true)</span>
@else
<span id="item-total" v-html="row.total">@money($item->total, $bill->currency_code, true)</span>
<span id="item-total" v-else>@money($item->total, $bill->currency_code, true)</span>
@endif
@stack('total_input_end')
</td>