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