账单价格
This commit is contained in:
@@ -22,6 +22,7 @@ class BillDetailService
|
|||||||
{
|
{
|
||||||
$items = StoreOrderItemModel::query()
|
$items = StoreOrderItemModel::query()
|
||||||
->where('bill_id', $bill->id)
|
->where('bill_id', $bill->id)
|
||||||
|
->where('quantity', '>', 0)
|
||||||
->orderBy('id')
|
->orderBy('id')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -39,6 +40,7 @@ class BillDetailService
|
|||||||
{
|
{
|
||||||
$items = StoreOrderItemModel::query()
|
$items = StoreOrderItemModel::query()
|
||||||
->whereIn('bill_id', $billIds)
|
->whereIn('bill_id', $billIds)
|
||||||
|
->where('quantity', '>', 0)
|
||||||
->orderBy('id')
|
->orderBy('id')
|
||||||
->get();
|
->get();
|
||||||
|
|
||||||
@@ -73,15 +75,14 @@ class BillDetailService
|
|||||||
$weight = bcadd($weight, (string) $item->weight, 3);
|
$weight = bcadd($weight, (string) $item->weight, 3);
|
||||||
$amount = bcadd($amount, (string) $item->amount, 2);
|
$amount = bcadd($amount, (string) $item->amount, 2);
|
||||||
}
|
}
|
||||||
|
$price = bcdiv($amount, (string) $quantity, 2);
|
||||||
|
|
||||||
$rows[] = [
|
$rows[] = [
|
||||||
'product_id' => (int) $productId,
|
'product_id' => (int) $productId,
|
||||||
'product_name' => $first->product_name,
|
'product_name' => $first->product_name,
|
||||||
'product_spec' => $first->product_spec,
|
'product_spec' => $first->product_spec,
|
||||||
'unit' => $first->unit,
|
'unit' => $first->unit,
|
||||||
'price' => $quantity > 0
|
'price' => $price,
|
||||||
? bcdiv($amount, (string) $quantity, 2)
|
|
||||||
: (string) $first->price,
|
|
||||||
'quantity' => $quantity,
|
'quantity' => $quantity,
|
||||||
'weight' => $weight,
|
'weight' => $weight,
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
|
|||||||
Reference in New Issue
Block a user