record log delivery

This commit is contained in:
Server D3 Linksehat
2024-10-14 10:13:09 +07:00
parent f3fd02671f
commit 6225c1c0e4

View File

@@ -378,6 +378,29 @@ class ApotekController extends Controller
'dUpdateOn' => date('Y-m-d H:i:s'),
]);
// Insert the log
$prescriptionOrder = DB::connection('oldlms')
->table('tx_prescription_orders')
->where('tx_prescription_orders.nID', '=', $id)
->join('tx_delivery_orders', 'tx_delivery_orders.nIDPrescriptionOrder', '=', 'tx_prescription_orders.nID')
->select('tx_prescription_orders.*', 'tx_delivery_orders.*', 'tx_delivery_orders.nID as nIDDelivery') // Add specific columns you want to select
->first();
if ($prescriptionOrder) {
$createdBy = $prescriptionOrder->sCreateBy;
$nIDPrescription = $prescriptionOrder->nIDPrescription;
$nIDDeliveryOrder = $prescriptionOrder->nIDDelivery;
// Insert data into the tx_delivery_log table
DB::connection('oldlms')->table('tx_delivery_log')->insert([
'sStatus' => $prescriptionOrder->sDeliveryStatus,
'sStatusPrescription' => $status,
'nIDDeliveryOrder' => $nIDDeliveryOrder,
'nIDPrescription' => $nIDPrescription,
'dCreatedOn' => now(),
]);
}
// Commit the transaction
DB::connection('oldlms')->commit();
@@ -668,4 +691,5 @@ class ApotekController extends Controller
$uuidV5 = Uuid::uuid5($namespace, $id_prescription_order);
return $uuidV5->toString();
}
}