update
This commit is contained in:
@@ -153,7 +153,7 @@ class PrescriptionController extends Controller
|
|||||||
// delete item
|
// delete item
|
||||||
DB::beginTransaction();
|
DB::beginTransaction();
|
||||||
PrescriptionItemAso::where('prescription_id', $prescriptionAso->id)->delete();
|
PrescriptionItemAso::where('prescription_id', $prescriptionAso->id)->delete();
|
||||||
PrescriptionItem::where('nIDPrescription', $prescriptionAso->id)->delete();
|
PrescriptionItem::where('nIDPrescription', $prescription->nID)->delete();
|
||||||
foreach($medicine as $key => $value){
|
foreach($medicine as $key => $value){
|
||||||
$drugData = Drug::where('id', $value['drug_id'])->first();
|
$drugData = Drug::where('id', $value['drug_id'])->first();
|
||||||
$drug = '';
|
$drug = '';
|
||||||
@@ -165,15 +165,8 @@ class PrescriptionController extends Controller
|
|||||||
if ($unitData) {
|
if ($unitData) {
|
||||||
$unit = $unitData->name;
|
$unit = $unitData->name;
|
||||||
}
|
}
|
||||||
$data = [
|
|
||||||
'nIDPrescription' => $prescription->id,
|
|
||||||
'sItemName' => $drug,
|
|
||||||
'nQty' => $value['qty'],
|
|
||||||
'sSatuan' => $unit,
|
|
||||||
'sSigna' => $value['signa'],
|
|
||||||
'sNote' => $value['note'],
|
|
||||||
];
|
|
||||||
|
|
||||||
|
// Insert Data
|
||||||
$dataAso = [
|
$dataAso = [
|
||||||
'prescription_id' => $prescriptionAso->id,
|
'prescription_id' => $prescriptionAso->id,
|
||||||
'drug_id' => $value['drug_id'],
|
'drug_id' => $value['drug_id'],
|
||||||
@@ -182,7 +175,14 @@ class PrescriptionController extends Controller
|
|||||||
'signa' => $value['signa'],
|
'signa' => $value['signa'],
|
||||||
'note' => $value['note']
|
'note' => $value['note']
|
||||||
];
|
];
|
||||||
// Insert Data
|
$data = [
|
||||||
|
'nIDPrescription' => $prescription->nID,
|
||||||
|
'sItemName' => $drug,
|
||||||
|
'nQty' => $value['qty'],
|
||||||
|
'sSatuan' => $unit,
|
||||||
|
'sSigna' => $value['signa'],
|
||||||
|
'sNote' => $value['note'],
|
||||||
|
];
|
||||||
try {
|
try {
|
||||||
// Insert to ASO
|
// Insert to ASO
|
||||||
PrescriptionItemAso::create($dataAso);
|
PrescriptionItemAso::create($dataAso);
|
||||||
|
|||||||
Reference in New Issue
Block a user