diff --git a/HMS_MEDICAL_STORE_SESSION.md b/HMS_MEDICAL_STORE_SESSION.md index 9582e06..485b9be 100644 --- a/HMS_MEDICAL_STORE_SESSION.md +++ b/HMS_MEDICAL_STORE_SESSION.md @@ -25,7 +25,7 @@ ### HMS Admin Management - **URL:** [http://localhost:8080/setting/admin/medical-store](http://localhost:8080/setting/admin/medical-store) -- **Features:** Store configuration, DL 20B/21B licenses, GSTIN, Pharmacist details, ABDM HFR/HIP/HPR registries, 60-min OTP generator, terminal device authorization, and Marg ERP CSV import. +- **Features:** Store configuration, DL 20B/21B licenses, GSTIN, Pharmacist details, ABDM HFR/HIP/HPR registries, 60-min OTP generator, terminal device authorization, and Excel / CSV stock import. ### Direct Counter Desks (React PWA) - **Counter A (Main Hospital Block A):** @@ -59,15 +59,15 @@ - 80mm Thermal Slip (Fast 1–5 item OTC/OPD). - A5 Invoice (Normal OPD/Walk-in with GST summary). - A4 Hospital Tax Invoice (IPD admissions & large bills). -4. **Marg ERP Migration:** - - Supported CSV import with auto-detected columns. Sample test file: `scratch/test_marg_sample.csv`. +4. **Excel / CSV Stock Migration:** + - Supported CSV import with auto-detected columns. 5. **Double-Entry Accounting & Statutory Drug Register:** - Automated ledger postings, Daily Cash Book, GSTR-1 outward reports, and mandatory Schedule H1 drug register. 6. **Retail Loose Tablet & Unit Dispensing:** - Exact per-tablet pricing (`Strip MRP / units_per_pack`), exact stock deduction in individual tablets, and support for Loose Tab, Strip, and Combo sales. 7. **Split / Mixed Payment Mode & Audit:** - Supports partial payments (e.g. ₹35 Cash + ₹100 UPI) with 12-digit UTR and bank name capturing for bank reconciliation and audit. -8. **Keyboard-First Zero-Mouse POS Workflow (Marg ERP Standard):** +8. **Keyboard-First Zero-Mouse POS Workflow (Desktop Pharmacy Standard):** - High-contrast single-line Quick Keys ribbon. - Hotkeys: `F2` (Medicine Search), `F4` (Patient Search), `F7` (Whole Discount), `F8` (Payment Mode), `F9 / Ctrl+Enter` (Complete Sale & Print), `Alt+T` (Loose Tab), `Alt+S` (Strip), `Shift+Delete` (Remove Item). - Auto-focus on Medicine Search on page load; `Enter` on quantity immediately commits and jumps focus back to Medicine Lookup for the next scan. diff --git a/app/Config/Routes.php b/app/Config/Routes.php index 047c0bf..5fdf53a 100644 --- a/app/Config/Routes.php +++ b/app/Config/Routes.php @@ -1426,7 +1426,7 @@ $routes->group('setting', static function($routes) { $routes->post('admin/medical-store/generate-otp', 'Setting\\MedicalStoreAdmin::generateOtp'); $routes->post('admin/medical-store/regenerate-key', 'Setting\\MedicalStoreAdmin::regenerateSecurityKey'); $routes->post('admin/medical-store/revoke-device', 'Setting\\MedicalStoreAdmin::revokeDevice'); - $routes->post('admin/medical-store/import-marg', 'Setting\\MedicalStoreAdmin::importMarg'); + $routes->post('admin/medical-store/import-excel', 'Setting\\MedicalStoreAdmin::importExcel'); $routes->get('admin/bed-management', 'Setting\\BedManagement::index', ['filter' => $settingsBedFilter]); $routes->get('admin/departments', 'Setting\\BedManagement::departments', ['filter' => $settingsBedFilter]); @@ -1702,7 +1702,7 @@ $routes->group('api/v1', ['namespace' => 'App\Controllers\Api\v1'], static funct $routes->get('medical-store/compliance/schedule-h1-register', 'MedicalStoreApi::getScheduleH1Register'); $routes->post('medical-store/device/verify', 'MedicalStoreApi::verifyDevice'); $routes->post('medical-store/device/check', 'MedicalStoreApi::checkDeviceStatus'); - $routes->post('medical-store/stock/import-marg', 'MedicalStoreApi::importMarg'); + $routes->post('medical-store/stock/import-excel', 'MedicalStoreApi::importExcel'); $routes->get('medical-store/abdm/bundle/(:num)', 'MedicalStoreApi::getAbdmBundle/$1'); $routes->post('medical-store/abdm/link-abha', 'MedicalStoreApi::linkAbha'); $routes->get('medical-store/returns/lookup-invoice', 'MedicalStoreApi::lookupInvoiceForReturn'); diff --git a/app/Controllers/Api/v1/MedicalStoreApi.php b/app/Controllers/Api/v1/MedicalStoreApi.php index 1c1ff58..4efbe66 100644 --- a/app/Controllers/Api/v1/MedicalStoreApi.php +++ b/app/Controllers/Api/v1/MedicalStoreApi.php @@ -3481,10 +3481,10 @@ class MedicalStoreApi extends BaseController return $this->response->setJSON(['status' => 0, 'authorized' => false, 'message' => 'Device authorization revoked or not found.']); } - public function importMarg() + public function importExcel() { $admin = new \App\Controllers\Setting\MedicalStoreAdmin(); - return $admin->importMarg(); + return $admin->importExcel(); } // ========================================================================= diff --git a/app/Controllers/Setting/MedicalStoreAdmin.php b/app/Controllers/Setting/MedicalStoreAdmin.php index bd42d15..a61a1a9 100644 --- a/app/Controllers/Setting/MedicalStoreAdmin.php +++ b/app/Controllers/Setting/MedicalStoreAdmin.php @@ -235,9 +235,9 @@ class MedicalStoreAdmin extends BaseController } /** - * Marg Pharmacy Software / Excel CSV Inventory Import + * Excel / CSV Inventory Import */ - public function importMarg() + public function importExcel() { $storeId = (int)($this->request->getPost('store_id') ?? 0); if ($storeId <= 0) { @@ -251,7 +251,7 @@ class MedicalStoreAdmin extends BaseController $ext = strtolower($file->getClientExtension()); if (!in_array($ext, ['csv', 'txt'])) { - return $this->response->setJSON(['ok' => false, 'error' => 'Please upload CSV formatted export from Marg ERP or Excel.']); + return $this->response->setJSON(['ok' => false, 'error' => 'Please upload CSV formatted export from Excel or CSV file.']); } $handle = fopen($file->getTempName(), 'r'); @@ -322,7 +322,7 @@ class MedicalStoreAdmin extends BaseController $qty = ($colQty !== null) ? (int)preg_replace('/[^0-9]/', '', $row[$colQty] ?? '10') : 10; $barcode = ($colBarcode !== null) ? trim($row[$colBarcode] ?? '') : ''; - // Parse Marg Expiry formats (MM/YY, MM/YYYY, DD-MM-YYYY, YYYY-MM-DD) + // Parse standard date and expiry formats (MM/YY, MM/YYYY, DD-MM-YYYY, YYYY-MM-DD) $expiryDate = date('Y-12-31', strtotime('+1 year')); if (!empty($expRaw)) { if (preg_match('/^(\d{1,2})[\/\-](\d{2})$/', $expRaw, $m)) { @@ -418,7 +418,7 @@ class MedicalStoreAdmin extends BaseController // Record opening stock valuation journal voucher in double-entry ledgers if ($totalValuation > 0) { - $voucherNo = 'MARG-IMP-' . $storeId . '-' . date('YmdHis'); + $voucherNo = 'CSV-IMP-' . $storeId . '-' . date('YmdHis'); $stockHead = $this->db->table('mst_account_heads')->where('head_code', '1003')->get()->getRowArray(); $equityHead = $this->db->table('mst_account_heads')->where('head_code', '3004')->get()->getRowArray(); @@ -426,12 +426,12 @@ class MedicalStoreAdmin extends BaseController $this->db->table('mst_ledger_entries')->insert([ 'store_id' => $storeId, 'voucher_no' => $voucherNo, 'voucher_type' => 'OPENING_STOCK', 'voucher_date' => date('Y-m-d'), 'account_head_id' => $stockHead['head_id'], 'debit_amount' => $totalValuation, 'credit_amount' => 0, - 'narration' => "Marg ERP Opening Stock Inward ($importedRows lines)" + 'narration' => "Excel/CSV Opening Stock Inward ($importedRows lines)" ]); $this->db->table('mst_ledger_entries')->insert([ 'store_id' => $storeId, 'voucher_no' => $voucherNo, 'voucher_type' => 'OPENING_STOCK', 'voucher_date' => date('Y-m-d'), 'account_head_id' => $equityHead['head_id'], 'debit_amount' => 0, 'credit_amount' => $totalValuation, - 'narration' => "Marg ERP Opening Capital Credit" + 'narration' => "Excel/CSV Opening Capital Credit" ]); } } @@ -440,7 +440,7 @@ class MedicalStoreAdmin extends BaseController return $this->response->setJSON([ 'ok' => true, - 'message' => "Successfully imported {$importedRows} inventory lines from Marg Pharmacy file.", + 'message' => "Successfully imported {$importedRows} inventory lines from CSV file.", 'details' => [ 'imported_rows' => $importedRows, 'new_catalog_items'=> $newItems, diff --git a/app/Views/Setting/MedicalStore/medical_store_index.php b/app/Views/Setting/MedicalStore/medical_store_index.php index 0bcde6e..71c227e 100644 --- a/app/Views/Setting/MedicalStore/medical_store_index.php +++ b/app/Views/Setting/MedicalStore/medical_store_index.php @@ -5,8 +5,8 @@ Manage hospital building stores, Indian Drug Licenses (20B/21B), GSTIN, direct URLs, and machine terminal security