close #1845 Fixed: Wrong price when creating bills

This commit is contained in:
Cüneyt Şentürk 2021-02-10 17:38:58 +03:00
parent 8211a6ce43
commit 8cc2aeb9b9
5 changed files with 9 additions and 5 deletions

View File

@ -36,7 +36,7 @@ class SelectItemButton extends Component
public function render()
{
$items = Item::enabled()->orderBy('name')->take(setting('default.select_limit'))->get();
$price_type= $this->getPriceType($this->type, $this->isSale, $this->isPurchase);
$price_type = $this->getPriceType($this->type, $this->isSale, $this->isPurchase);
foreach ($items as $item) {
$price = $item->{$price_type . '_price'};
@ -44,7 +44,7 @@ class SelectItemButton extends Component
$item->price = $price;
}
$price = ($this->isPurchase) ? 'purchase_price' : 'sale_price';
$price = $price_type . '_price';
return view('components.select-item-button', compact('items', 'price'));
}
@ -55,7 +55,7 @@ class SelectItemButton extends Component
return 'sale';
}
if (!empty($is_sale)) {
if (!empty($is_purchase)) {
return 'purchase';
}

View File

@ -65,6 +65,8 @@
hide-discount="{{ $hideDiscount }}"
hide-amount="{{ $hideAmount }}"
text-amount="{{ $textAmount }}"
is-sale-price="{{ $isSalePrice }}"
is-purchase-price="{{ $isPurchasePrice }}"
/>
@if (!$hideFooter)

View File

@ -42,6 +42,8 @@
hide-discount="{{ $hideDiscount }}"
hide-amount="{{ $hideAmount }}"
text-amount="{{ $textAmount }}"
is-sale-price="{{ $isSalePrice }}"
is-purchase-price="{{ $isPurchasePrice }}"
/>
<x-documents.form.totals

View File

@ -3,7 +3,7 @@
@section('title', trans('general.title.new', ['type' => setting('bill.title', trans_choice('general.bills', 1))]))
@section('content')
<x-documents.form.content type="bill" hide-company hide-footer hide-edit-item-columns />
<x-documents.form.content type="bill" hide-company hide-footer hide-edit-item-columns is-purchase-price />
@endsection
@push('scripts_start')

View File

@ -3,7 +3,7 @@
@section('title', trans('general.title.edit', ['type' => trans_choice('general.bills', 1)]))
@section('content')
<x-documents.form.content type="bill" :document="$bill" hide-company hide-footer hide-edit-item-columns />
<x-documents.form.content type="bill" :document="$bill" hide-company hide-footer hide-edit-item-columns is-purchase-price />
@endsection
@push('scripts_start')