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