Fix bugs
This commit is contained in:
parent
c12ef5ea18
commit
0ce46df5a9
|
@ -1035,17 +1035,16 @@ class HealthCareSheetController extends Controller
|
|||
DB::rollback();
|
||||
return $this->errorResponse(__('errors.prescription_already_invoiced', ['id' => $itemIndex + 1]));
|
||||
}
|
||||
if (isset($prescriptions[$itemIndex]['quantity'])) {
|
||||
$quantity_to_bill = $item->quantity - ($item->billed_quantity ?? 0);
|
||||
if ($prescriptions[$itemIndex]['quantity'] > $quantity_to_bill) {
|
||||
DB::rollback();
|
||||
return $this->errorResponse(__('errors.prescription_ordered_quantity_must_not_greater_than_ordered_quantity',
|
||||
['id' => $itemIndex + 1, 'quantity' => $quantity_to_bill]));
|
||||
}
|
||||
|
||||
$item->quantity = $prescriptions[$itemIndex]['quantity'];
|
||||
$i->billed_quantity += $item->quantity;
|
||||
$quantity = $prescriptions[$itemIndex]['quantity'] ?? $item->quantity;
|
||||
$quantity_to_bill = $item->quantity - ($item->billed_quantity ?? 0);
|
||||
if ($quantity > $quantity_to_bill) {
|
||||
DB::rollback();
|
||||
return $this->errorResponse(__('errors.prescription_ordered_quantity_must_not_greater_than_ordered_quantity',
|
||||
['id' => $itemIndex + 1, 'quantity' => $quantity_to_bill]));
|
||||
}
|
||||
$item->quantity = $quantity;
|
||||
$i->billed_quantity += $item->quantity;
|
||||
|
||||
$item->unit_price = $prescriptions[$itemIndex]['unit_price'];
|
||||
$item->billed_quantity = null;
|
||||
}
|
||||
|
|
|
@ -35,5 +35,6 @@ return [
|
|||
"ONE_TIME" => "ONCE",
|
||||
"DAILY" => "DAY",
|
||||
"MONTHLY" => "MONTH",
|
||||
"MODIFIED" => "MODIFIED"
|
||||
"MODIFIED" => "MODIFIED",
|
||||
'RENEWAL' => 'RENEWAL'
|
||||
];
|
||||
|
|
|
@ -35,5 +35,6 @@ return [
|
|||
"ONE_TIME" => "1 FOIS",
|
||||
"DAILY" => "JOUR",
|
||||
"MONTHLY" => "MOIS",
|
||||
"MODIFIED" => "MODIFIÉE"
|
||||
"MODIFIED" => "MODIFIÉE",
|
||||
'RENEWAL' => 'RENOUVELLEMENT'
|
||||
];
|
||||
|
|
Loading…
Reference in New Issue