diff --git a/application/controllers/klinik/doctorv5/Anamnesedoctor.php b/application/controllers/klinik/doctorv5/Anamnesedoctor.php index bc7b935c..a3d77d03 100644 --- a/application/controllers/klinik/doctorv5/Anamnesedoctor.php +++ b/application/controllers/klinik/doctorv5/Anamnesedoctor.php @@ -3296,18 +3296,23 @@ function get_data_order_anamnesis($orderID){ exit; } - $batch = trim($prm['batch_number'] ?? ''); - $expired = trim($prm['expired_date'] ?? ''); - $dosis = max(1, intval($prm['dosis'] ?? 1)); - $site_code = trim($prm['injection_site_code'] ?? ''); - $route_code = trim($prm['route_code'] ?? ''); - $petugas_id = isset($prm['petugas_id']) && $prm['petugas_id'] ? intval($prm['petugas_id']) : null; - $given_at = trim($prm['given_at'] ?? ''); - $next_date = trim($prm['next_date'] ?? ''); - $catatan = trim($prm['catatan'] ?? ''); - $kipi = trim($prm['kipi'] ?? ''); - $observasi15 = ($prm['observasi_15'] ?? false) ? 'Y' : 'N'; - $reaksi_alergi = ($prm['reaksi_alergi'] ?? false) ? 'Y' : 'N'; + $batch = trim($prm['batch_number'] ?? ''); + $expired = trim($prm['expired_date'] ?? ''); + $dosis = max(1, intval($prm['dosis'] ?? 1)); + $site_code = trim($prm['injection_site_code'] ?? ''); + $route_code = trim($prm['route_code'] ?? ''); + $petugas_id = isset($prm['petugas_id']) && $prm['petugas_id'] ? intval($prm['petugas_id']) : null; + $given_at = trim($prm['given_at'] ?? ''); + $next_date = trim($prm['next_date'] ?? ''); + $catatan = trim($prm['catatan'] ?? ''); + $kipi = trim($prm['kipi'] ?? ''); + $observasi15 = ($prm['observasi_15'] ?? false) ? 'Y' : 'N'; + $reaksi_alergi = ($prm['reaksi_alergi'] ?? false) ? 'Y' : 'N'; + $ss_price_mou_id = isset($prm['ss_price_mou_id']) && $prm['ss_price_mou_id'] ? intval($prm['ss_price_mou_id']) : null; + $bruto = floatval($prm['bruto'] ?? 0); + $disc_persen = floatval($prm['discountpersen'] ?? 0); + $disc_rp = floatval($prm['discountrp'] ?? 0); + $total = floatval($prm['total'] ?? 0); $given_at_sql = ($given_at && strtotime($given_at)) ? date('Y-m-d H:i:s', strtotime($given_at)) : date('Y-m-d H:i:s'); $expired_val = ($expired && strtotime($expired)) ? date('Y-m-d', strtotime($expired)) : null; @@ -3317,6 +3322,11 @@ function get_data_order_anamnesis($orderID){ $ok = $this->db_oneklinik->query( "UPDATE one_klinik.order_vaccine SET orderVaccineT_TestID = ?, + orderVaccineSsPriceMouID = ?, + orderVaccineBruto = ?, + orderVaccineDiscPersen = ?, + orderVaccineDiscRp = ?, + orderVaccineTotal = ?, orderVaccineBatchNumber = ?, orderVaccineExpiredDate = ?, orderVaccineDosis = ?, @@ -3332,7 +3342,8 @@ function get_data_order_anamnesis($orderID){ orderVaccineUserID = ? WHERE orderVaccineID = ? AND orderVaccineOrderID = ?", [ - $t_test_id, $batch ?: null, $expired_val, $dosis, + $t_test_id, $ss_price_mou_id, $bruto, $disc_persen, $disc_rp, $total, + $batch ?: null, $expired_val, $dosis, $site_code ?: null, $route_code ?: null, $petugas_id, $given_at_sql, $next_date_val, $catatan ?: null, $kipi ?: null, $observasi15, $reaksi_alergi, @@ -3342,15 +3353,20 @@ function get_data_order_anamnesis($orderID){ } else { $ok = $this->db_oneklinik->query( "INSERT INTO one_klinik.order_vaccine - (orderVaccineOrderID, orderVaccineT_TestID, orderVaccineBatchNumber, - orderVaccineExpiredDate, orderVaccineDosis, orderVaccineInjectionSiteCode, - orderVaccineRouteCode, orderVaccinePetugasM_StaffID, orderVaccineGivenAt, + (orderVaccineOrderID, orderVaccineT_TestID, + orderVaccineSsPriceMouID, orderVaccineBruto, orderVaccineDiscPersen, + orderVaccineDiscRp, orderVaccineTotal, + orderVaccineBatchNumber, orderVaccineExpiredDate, orderVaccineDosis, + orderVaccineInjectionSiteCode, orderVaccineRouteCode, + orderVaccinePetugasM_StaffID, orderVaccineGivenAt, orderVaccineNextDate, orderVaccineCatatan, orderVaccineKipi, orderVaccineObservasi15, orderVaccineReaksiAlergi, orderVaccineUserID) - VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", + VALUES (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)", [ - $orderid, $t_test_id, $batch ?: null, $expired_val, $dosis, + $orderid, $t_test_id, + $ss_price_mou_id, $bruto, $disc_persen, $disc_rp, $total, + $batch ?: null, $expired_val, $dosis, $site_code ?: null, $route_code ?: null, $petugas_id, $given_at_sql, $next_date_val, $catatan ?: null, $kipi ?: null, $observasi15, $reaksi_alergi, $userID diff --git a/sql/manual_changes/2026-06-11-alter-order-vaccine-add-price-fields.sql b/sql/manual_changes/2026-06-11-alter-order-vaccine-add-price-fields.sql new file mode 100644 index 00000000..929cee40 --- /dev/null +++ b/sql/manual_changes/2026-06-11-alter-order-vaccine-add-price-fields.sql @@ -0,0 +1,7 @@ +-- Tambah kolom harga vaksin dari ss_price_mou ke order_vaccine +ALTER TABLE one_klinik.order_vaccine + ADD COLUMN `orderVaccineSsPriceMouID` int(11) DEFAULT NULL COMMENT 'ref ss_price_mou.Ss_PriceMouID (no FK)' AFTER `orderVaccineT_TestID`, + ADD COLUMN `orderVaccineBruto` decimal(15,2) NOT NULL DEFAULT 0 COMMENT 'harga sebelum diskon' AFTER `orderVaccineSsPriceMouID`, + ADD COLUMN `orderVaccineDiscPersen` decimal(10,2) NOT NULL DEFAULT 0 COMMENT 'diskon %' AFTER `orderVaccineBruto`, + ADD COLUMN `orderVaccineDiscRp` decimal(15,2) NOT NULL DEFAULT 0 COMMENT 'diskon Rp' AFTER `orderVaccineDiscPersen`, + ADD COLUMN `orderVaccineTotal` decimal(15,2) NOT NULL DEFAULT 0 COMMENT 'harga setelah diskon' AFTER `orderVaccineDiscRp`;