commit 614713f76b3e229fded8ac02b9f689f00a8eaa7b
Author: DevSoftTech Server
Date: Fri Feb 27 19:44:36 2026 +0530
Implement OPD template builder, doctor template selection, and OPD print integration fixes
diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..87e86b9
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,126 @@
+#-------------------------
+# Operating Specific Junk Files
+#-------------------------
+
+# OS X
+.DS_Store
+.AppleDouble
+.LSOverride
+
+# OS X Thumbnails
+._*
+
+# Windows image file caches
+Thumbs.db
+ehthumbs.db
+Desktop.ini
+
+# Recycle Bin used on file shares
+$RECYCLE.BIN/
+
+# Windows Installer files
+*.cab
+*.msi
+*.msm
+*.msp
+
+# Windows shortcuts
+*.lnk
+
+# Linux
+*~
+
+# KDE directory preferences
+.directory
+
+# Linux trash folder which might appear on any partition or disk
+.Trash-*
+
+#-------------------------
+# Environment Files
+#-------------------------
+# These should never be under version control,
+# as it poses a security risk.
+.env
+.vagrant
+Vagrantfile
+
+#-------------------------
+# Temporary Files
+#-------------------------
+writable/cache/*
+!writable/cache/index.html
+
+writable/logs/*
+!writable/logs/index.html
+
+writable/session/*
+!writable/session/index.html
+
+writable/uploads/*
+!writable/uploads/index.html
+
+writable/debugbar/*
+!writable/debugbar/index.html
+
+php_errors.log
+
+#-------------------------
+# User Guide Temp Files
+#-------------------------
+user_guide_src/build/*
+user_guide_src/cilexer/build/*
+user_guide_src/cilexer/dist/*
+user_guide_src/cilexer/pycilexer.egg-info/*
+
+#-------------------------
+# Test Files
+#-------------------------
+tests/coverage*
+
+# Don't save phpunit under version control.
+phpunit
+
+#-------------------------
+# Composer
+#-------------------------
+vendor/
+
+#-------------------------
+# IDE / Development Files
+#-------------------------
+
+# Modules Testing
+_modules/*
+
+# phpenv local config
+.php-version
+
+# Jetbrains editors (PHPStorm, etc)
+.idea/
+*.iml
+
+# NetBeans
+/nbproject/
+/build/
+/nbbuild/
+/dist/
+/nbdist/
+/nbactions.xml
+/nb-configuration.xml
+/.nb-gradle/
+
+# Sublime Text
+*.tmlanguage.cache
+*.tmPreferences.cache
+*.stTheme.cache
+*.sublime-workspace
+*.sublime-project
+.phpintel
+/api/
+
+# Visual Studio Code
+.vscode/
+
+/results/
+/phpunit*.xml
diff --git a/LICENSE b/LICENSE
new file mode 100644
index 0000000..24728f6
--- /dev/null
+++ b/LICENSE
@@ -0,0 +1,22 @@
+The MIT License (MIT)
+
+Copyright (c) 2014-2019 British Columbia Institute of Technology
+Copyright (c) 2019-present CodeIgniter Foundation
+
+Permission is hereby granted, free of charge, to any person obtaining a copy
+of this software and associated documentation files (the "Software"), to deal
+in the Software without restriction, including without limitation the rights
+to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+copies of the Software, and to permit persons to whom the Software is
+furnished to do so, subject to the following conditions:
+
+The above copyright notice and this permission notice shall be included in
+all copies or substantial portions of the Software.
+
+THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+THE SOFTWARE.
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..45f98af
--- /dev/null
+++ b/README.md
@@ -0,0 +1,69 @@
+# CodeIgniter 4 Application Starter
+
+## What is CodeIgniter?
+
+CodeIgniter is a PHP full-stack web framework that is light, fast, flexible and secure.
+More information can be found at the [official site](https://codeigniter.com).
+
+This repository holds a composer-installable app starter.
+It has been built from the
+[development repository](https://github.com/codeigniter4/CodeIgniter4).
+
+More information about the plans for version 4 can be found in [CodeIgniter 4](https://forum.codeigniter.com/forumdisplay.php?fid=28) on the forums.
+
+You can read the [user guide](https://codeigniter.com/user_guide/)
+corresponding to the latest version of the framework.
+
+## Installation & updates
+
+`composer create-project codeigniter4/appstarter` then `composer update` whenever
+there is a new release of the framework.
+
+When updating, check the release notes to see if there are any changes you might need to apply
+to your `app` folder. The affected files can be copied or merged from
+`vendor/codeigniter4/framework/app`.
+
+## Setup
+
+Copy `env` to `.env` and tailor for your app, specifically the baseURL
+and any database settings.
+
+## Important Change with index.php
+
+`index.php` is no longer in the root of the project! It has been moved inside the *public* folder,
+for better security and separation of components.
+
+This means that you should configure your web server to "point" to your project's *public* folder, and
+not to the project root. A better practice would be to configure a virtual host to point there. A poor practice would be to point your web server to the project root and expect to enter *public/...*, as the rest of your logic and the
+framework are exposed.
+
+**Please** read the user guide for a better explanation of how CI4 works!
+
+## Repository Management
+
+We use GitHub issues, in our main repository, to track **BUGS** and to track approved **DEVELOPMENT** work packages.
+We use our [forum](http://forum.codeigniter.com) to provide SUPPORT and to discuss
+FEATURE REQUESTS.
+
+This repository is a "distribution" one, built by our release preparation script.
+Problems with it can be raised on our forum, or as issues in the main repository.
+
+## Server Requirements
+
+PHP version 8.2 or higher is required, with the following extensions installed:
+
+- [intl](http://php.net/manual/en/intl.requirements.php)
+- [mbstring](http://php.net/manual/en/mbstring.installation.php)
+
+> [!WARNING]
+> - The end of life date for PHP 7.4 was November 28, 2022.
+> - The end of life date for PHP 8.0 was November 26, 2023.
+> - The end of life date for PHP 8.1 was December 31, 2025.
+> - If you are still using below PHP 8.2, you should upgrade immediately.
+> - The end of life date for PHP 8.2 will be December 31, 2026.
+
+Additionally, make sure that the following extensions are enabled in your PHP:
+
+- json (enabled by default - don't turn it off)
+- [mysqlnd](http://php.net/manual/en/mysqlnd.install.php) if you plan to use MySQL
+- [libcurl](http://php.net/manual/en/curl.requirements.php) if you plan to use the HTTP\CURLRequest library
diff --git a/WORKLOG_COPILOT.md b/WORKLOG_COPILOT.md
new file mode 100644
index 0000000..200c30d
--- /dev/null
+++ b/WORKLOG_COPILOT.md
@@ -0,0 +1,521 @@
+# Worklog - HMS_CI4_OLD
+
+Date: 2026-02-08
+
+## Summary
+Ported OPD Charges, IPD Charges, and Package modules from CI3 to CI4 with consistent NiceAdmin UI, AJAX modal flows, Simple-DataTables, insurance rate handling, and print/Excel exports.
+
+## OPD Charges
+- Controller: app/Controllers/Item.php
+- Model: app/Models/ItemModel.php
+- Routes: app/Config/Routes.php (group: item)
+- Views: app/Views/Setting/Charges/OPD_Charges/
+ - item_search_V.php (header buttons: Charge Groups, Add New Charge; filters; print/export)
+ - item_search_adv.php (list partial with DataTable)
+ - item_profile_V.php (modal edit; insurance rates; refresh list on update)
+ - item_create_V.php
+ - item_type_search_v.php / item_type_profile.php / item_type_create.php
+ - item_item_list.php (print layout with heading, borders, base rate fallback)
+ - item_item_excel.php (Excel export)
+ - item_insurance_list.php (insurance rate table partial)
+- Model joins (no DB views):
+ - items: hc_items + hc_item_type
+ - insurance items: hc_items_insurance + hc_insurance, filter isdelete=0
+- Print: insurance selection adds Amount + Code; missing insurance uses Base Rate
+- Excel: output via response headers (no debug toolbar injection)
+
+## IPD Charges
+- Controller: app/Controllers/ItemIpd.php
+- Model: app/Models/ItemIpdModel.php
+- Routes: app/Config/Routes.php (groups: item-ipd + legacy Item_IPD)
+- Views: app/Views/Setting/Charges/IPD_Charges/
+ - item_search_V.php, item_search_adv.php
+ - item_profile_V.php, item_create_V.php
+ - item_type_search_v.php / item_type_profile.php / item_type_create.php
+ - item_item_list.php (print)
+ - item_item_excel.php (Excel)
+ - item_insurance_list.php
+- Model joins (no DB views):
+ - items: ipd_items + ipd_item_type
+ - insurance items: ipd_items_insurance + hc_insurance, filter isdelete=0
+
+## Package (IPD Package)
+- Controller: app/Controllers/Package.php
+- Model: app/Models/PackageModel.php
+- Routes: app/Config/Routes.php (groups: package + legacy Package + legacy IPD_Package)
+- Views: app/Views/Setting/Charges/Package/
+ - item_search_V.php, item_search_adv.php
+ - item_profile_V.php, item_create_V.php
+ - item_type_search_v.php / item_type_profile.php / item_type_create.php
+ - item_item_list.php (print)
+ - item_item_excel.php (Excel)
+ - item_insurance_list.php
+- Model joins (no DB views):
+ - packages: package, package_group
+ - insurance items: package_insurance + hc_insurance, filter isdelete=0
+- Audit tables: package_update and package_insurance_update
+ - If not present, audit insert skipped (prevents errors)
+
+## UI + Behavior
+- Charges tiles updated:
+ - setting/charges -> IPD tile uses item-ipd/search
+ - setting/charges -> Package tile uses package/search
+- Modal edits refresh list:
+ - OPD: window.refreshChargeList()
+ - IPD: window.refreshChargeList()
+ - Package: window.refreshPackageList()
+- Print buttons in header next to filter; export Excel added
+- Print layout: heading with group + insurance; no OPD/IPD or group columns; table borders
+- Base rate fallback: if insurance-specific rate missing, show base amount and Code column shows "Base Rate"
+
+## Known Tables Used
+- OPD: hc_items, hc_item_type, hc_items_insurance, hc_items_update, hc_items_insurance_update
+- IPD: ipd_items, ipd_item_type, ipd_items_insurance, ipd_items_update, ipd_items_insurance_update
+- Package: package, package_group, package_insurance, package_update, package_insurance_update
+- Insurance: hc_insurance
+
+## Notes for Next Session
+- If audit tables for Package are required, create migrations for package_update and package_insurance_update.
+- If isdelete column missing on insurance tables, remove filter.
+- Debug toolbar can break Excel; keep response headers to avoid injection.
+- Legacy routes are supported for old JS paths.
+
+---
+
+Date: 2026-02-16
+
+## Diagnosis CI3 → CI4 Endpoint Mapping (Lab_Report parity)
+
+### Fully mapped in CI4
+- `lab_master` → `Diagnosis::labMaster` via `Lab_Report/lab_master`
+- `lab_path/{lab_type}` → `Diagnosis::labPathLegacy` via `Lab_Report/lab_path/(:num)`
+- `search_lab_4/{lab_type}` → `Diagnosis::searchLab` via `Lab_Report/search_lab_4/(:num)`
+- `search_lab_4_srno/{lab_type}` → `Diagnosis::searchLabBySrno` via `Lab_Report/search_lab_4_srno/(:num)`
+- `search_lab_4_labno/{lab_type}` → `Diagnosis::searchLabByLabno` via `Lab_Report/search_lab_4_labno/(:num)`
+- `select_lab_invoice/{inv_id}/{lab_type}` → `Diagnosis::selectLabInvoicePath`
+- `select_lab_invoice_path/{inv_id}/{lab_type}` → `Diagnosis::selectLabInvoicePath`
+- `lab_date_show/{inv_id}/{lab_type}` → `Diagnosis::labDateShow`
+- `test_list/{inv_id}/{lab_type}` → `Diagnosis::testList`
+- `xray_test_list/{inv_id}/{lab_type}` → `Diagnosis::testList`
+- `lab_tab_1_process/{test_id}/{lab_type}` → `Diagnosis::labTab1Process`
+- `create_report_xray/{req_id}` → `Diagnosis::createReportXray`
+- `show_report_final/{req_id}` → `Diagnosis::showReportFinalXray`
+- `get_template_xray/{id}` → `Diagnosis::getTemplateXray`
+- `Final_Update_xray/{req_id}` → `Diagnosis::finalUpdateXray`
+- `confirm_report_xray/{req_id}` → `Diagnosis::confirmReportXray`
+
+### Missing legacy endpoints (not yet mapped)
+- `report_file_list/{inv_id}/{lab_type}/{delete?}`
+- `select_lab_radiology/{inv_id}/{lab_type}`
+
+### Notes
+- Current CI4 radiology flow uses `Diagnosis::selectLabInvoicePath` for detail screen and does not require a separate `select_lab_radiology` endpoint in active views.
+- File upload/list actions in CI4 diagnosis view are currently placeholders (`uploadFiles`, `showFiles`) and do not yet have controller endpoints.
+
+## Future Backlog: AI-assisted Image Diagnosis (Ultrasound / X-Ray / CT)
+
+### Goal
+- Add a professional image workspace where users can upload/scan images, review them, run AI-assisted analysis, and move AI draft findings into radiology report editor with doctor review.
+
+### Phase 1 (MVP - internal)
+- Build one modal workspace in diagnosis detail screen:
+ - Left panel: image preview, next/previous, zoom.
+ - Right panel: AI findings, AI impression, confidence, doctor editable text.
+- Wire existing action buttons:
+ - Upload Files -> open workspace + upload image.
+ - Scan -> open workspace + scan image flow.
+ - Show Files -> list previously uploaded/scanned images.
+- Add backend APIs in Diagnosis controller:
+ - uploadImage(reqId)
+ - listImages(reqId)
+ - scanImage(reqId)
+ - analyzeImageAi(reqId, fileId)
+ - saveAiDraft(reqId, fileId)
+ - acceptAiToReport(reqId)
+- Add DB table for AI result tracking (suggested: diagnosis_image_ai):
+ - id, req_id, file_id, ai_findings, ai_impression, confidence,
+ - model_name, model_version, status, reviewed_by, reviewed_at,
+ - created_at, updated_at.
+- Add visible safety label: AI Suggestion - Doctor Review Required.
+
+### Phase 2 (real AI integration)
+- Integrate external AI service endpoint (Python/FastAPI or equivalent).
+- Send selected image path to AI service and store structured response.
+- Add timeout/error handling and retry button in UI.
+
+### Phase 3 (clinical workflow hardening)
+- Add audit trail for accepted/edited AI content before final report verify.
+- Add role check so only authorized users can accept AI output.
+- Keep final confirm manual; AI never auto-verifies reports.
+
+### UI/Workflow Notes
+- AI output should prefill radiology editor, not directly replace final report.
+- Show per-image history for repeat review and comparison.
+- Keep terminology consistent with current imaging workflow labels.
+
+---
+
+Date: 2026-02-16
+
+## Pharmacy Module Kickoff (Legacy Medical)
+
+### What was verified
+- Legacy pharmacy dashboard source is in old code:
+ - `old_code_ci3/views/Medical/Dashboard.php`
+- Main legacy pharmacy controller is very large and feature-rich:
+ - `old_code_ci3/controllers/Medical.php` (~5k lines)
+- Related legacy controllers:
+ - `old_code_ci3/controllers/Medical_backpanel.php`
+ - `old_code_ci3/controllers/Medical_Report.php`
+ - `old_code_ci3/controllers/Medical_Print.php`
+ - `old_code_ci3/controllers/Payment_Medical.php`
+
+### Important routing finding
+- Current CI4 improved auto-routing is disabled (`app/Config/Routing.php` has `autoRoute = false`).
+- No explicit CI4 `/Medical` routes found in `app/Config/Routes.php`.
+- No current CI4 Medical controller files found under `app/Controllers`.
+
+### Legacy dashboard button map (from old Dashboard.php)
+- OPD Sale -> `/Medical/search_customer`
+- Invoice -> `/Medical/Invoice_Med_Draft`
+- IPD/Credit -> `/Medical/list_org_ipd`
+- Org. Credit -> `/Medical/list_org`
+- Return Counter Sale -> `/Medical/Invoice_Med_Return`
+- Day Report -> `/Medical_Report/Report_2`
+- Sale Day Report -> `/Medical_Report/Report_1`
+- Payment Report -> `/Medical_Report/Report_Payment_Recieved`
+- Store Stock -> `/Medical_backpanel/store_stock`
+- Store Main -> `/Medical/main_store`
+- Master -> `/Medical_backpanel`
+
+### Suggested migration order (phase wise)
+1. Dashboard + navigation tiles.
+2. OPD Sale + Invoice Draft list.
+3. Return invoice flow.
+4. Store stock and stock statement.
+5. Reports (day/sale/payment).
+6. Backpanel master screens.
+
+### SQL views received from user (confirmed)
+- `v_med_item_return`
+- `v_med_item_with_return`
+- `v_ipd_list`
+- `v_med_short_list`
+- `v_product_stock`
+- `v_product_stock_sub`
+- `v_sale_item`
+- `v_sale_item_sub`
+
+### Dependency note
+- `v_ipd_list` depends on `v_ipd_doc_list` (seen in view body join).
+- Before CI4 pharmacy migration, ensure `v_ipd_doc_list` exists in target DB with compatible schema.
+
+### Next implementation start point
+- Begin CI4 Pharmacy phase-1 with dashboard route/controller/view parity for `/Medical` tiles, then wire OPD Sale + Draft Invoice list endpoints.
+
+### Phase-1 implementation done (CI4)
+- Added controller: app/Controllers/Medical.php
+- Added routes:
+ - Medical
+ - Medical/search_customer
+ - Medical/Invoice_Med_Draft
+ - Medical/Invoice_Med_Return
+ - Medical/list_org_ipd
+ - Medical/list_org
+ - Medical/main_store
+ - Medical/store_stock
+ - Medical/master
+- Added views:
+ - app/Views/medical/dashboard.php
+ - app/Views/medical/search_customer.php
+ - app/Views/medical/invoice_med_draft.php
+ - app/Views/medical/placeholder.php
+- Status:
+ - Dashboard works at /Medical.
+ - OPD Sale and Invoice Draft panels are functional.
+ - Remaining tiles currently show migration placeholder pending deeper CI3 parity port.
+
+---
+
+Date: 2026-02-19
+
+## Pharmacy -> Master continuation
+
+### Fix completed
+- Module: `Drug Sale Customer Wise Report`
+- Endpoint: `Medical::drug_patient_distribute`
+- Root-cause fixed in `getDrugPatientDistributeRows()`:
+ - Legacy behavior: when Drug Name is blank and Schedule filter is blank, show all matching date-range records.
+ - CI4 regression: returned empty result unless at least one schedule was selected.
+ - Fix: schedule condition is now applied only when schedules are selected; blank schedule no longer forces empty result.
+
+### Validation
+- `php -l app/Controllers/Medical.php` passed (no syntax errors).
+
+### Step done: Med. Payment Edit Logs (legacy links)
+- Implemented legacy page endpoint: `Payment_Medical/payment_log`
+- Implemented legacy result endpoint: `Payment_Medical/payment_log_data`
+- Added CI4 controller methods in `app/Controllers/Payment_Medical.php`:
+ - `payment_log()` for filter page
+ - `payment_log_data()` for date-range log result table
+- Added CI4 views:
+ - `app/Views/medical/payment_log.php`
+ - `app/Views/medical/payment_log_data.php`
+- Updated routes in `app/Config/Routes.php`:
+ - `GET Payment_Medical/payment_log -> Payment_Medical::payment_log`
+ - `GET|POST Payment_Medical/payment_log_data -> Payment_Medical::payment_log_data`
+- Updated Master menu link in `app/Views/medical/master.php`:
+ - `Med. Payment Edit Logs` now opens `Payment_Medical/payment_log`
+
+### Step fix: Med. Payment Edit action buttons not working
+- Root cause: `payment_edit` HTML was injected using `innerHTML` in `payment_search`, so inline `
diff --git a/app/Views/Invoice/Case_Form_profile_V.php b/app/Views/Invoice/Case_Form_profile_V.php
new file mode 100644
index 0000000..824ccdf
--- /dev/null
+++ b/app/Views/Invoice/Case_Form_profile_V.php
@@ -0,0 +1,195 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Invoice/Case_List.php b/app/Views/Invoice/Case_List.php
new file mode 100644
index 0000000..9308464
--- /dev/null
+++ b/app/Views/Invoice/Case_List.php
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+ Case No.
+ Patient Name
+ Case Date
+ Card Holder Name
+ Insurance
+ OPD Amount
+ Invoice Amount
+ Status
+
+
+
+
+
+
+ =$searchdata[$i]->case_id_code ?>
+ =$searchdata[$i]->p_name ?>
+ =$searchdata[$i]->date_registration ?>
+ =$searchdata[$i]->insurance_card_name ?>
+ =$searchdata[$i]->insurance_company_name ?>
+ =$searchdata[$i]->OPD_Amount ?>
+ =$searchdata[$i]->Invoice_Amount ?>
+ =$searchdata[$i]->str_status ?>
+ Show It....
+
+
+
+
+
+ Case No.
+ Patient Name
+ Case Date
+ Card Holder Name
+ Insurance
+ OPD Amount
+ Invoice Amount
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Invoice/Invoice_org_payment.php b/app/Views/Invoice/Invoice_org_payment.php
new file mode 100644
index 0000000..8678b18
--- /dev/null
+++ b/app/Views/Invoice/Invoice_org_payment.php
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+ = H_Name ?>
+ = H_address_1 ?>, = H_address_2 ?>
+
+
+
+org_id ?? '').':'.($req_payment_order[0]->pay_id ?? '').':'.($req_payment_order[0]->payment_amount ?? '').':PT'.date('dmYhis');
+?>
+
+
+
+
+Org Payment Credit Receipt : = esc($req_payment_order[0]->pay_id ?? '') ?>
+
+
+
+
+ Patient Info.
+ UHID : = esc($patient_master[0]->p_code ?? '') ?>
+ Name : = esc($patient_master[0]->title ?? '') ?> = esc(strtoupper((string) ($patient_master[0]->p_fname ?? ''))) ?>
+ = esc($patient_master[0]->p_relative ?? '') ?> = esc(strtoupper((string) ($patient_master[0]->p_rname ?? ''))) ?>
+ Sex : = esc($patient_master[0]->xgender ?? '') ?> = esc($patient_master[0]->age ?? '') ?> P.No. := esc($patient_master[0]->mphone1 ?? '') ?>
+
+
+ Org. Case No. : = esc($req_payment_order[0]->org_code ?? '') ?>
+ Payment Date : = esc($req_payment_order[0]->payment_date_str ?? '') ?>
+
+
+
+
+
+ Org Case Payment Amount : Rs. = esc($req_payment_order[0]->payment_amount ?? '') ?>
+ Amount in Words : Rs.= number_to_word($req_payment_order[0]->payment_amount ?? 0) ?>
+
+
+ Prepared By : = esc($req_payment_order[0]->payment_accept_by ?? '') ?>
+
+
+ Signature
+
diff --git a/app/Views/Invoice/Org_Contingent_bill.php b/app/Views/Invoice/Org_Contingent_bill.php
new file mode 100644
index 0000000..8095eeb
--- /dev/null
+++ b/app/Views/Invoice/Org_Contingent_bill.php
@@ -0,0 +1,87 @@
+
+
diff --git a/app/Views/Invoice/Organization_Invoice_PathLab.php b/app/Views/Invoice/Organization_Invoice_PathLab.php
new file mode 100644
index 0000000..2c43b20
--- /dev/null
+++ b/app/Views/Invoice/Organization_Invoice_PathLab.php
@@ -0,0 +1,238 @@
+
+
+
+= csrf_field() ?>
+
+
+
+
+
+
+ Doctor Name
+
+ refer_by_id)?> >From Other Hospital
+ id.' '.combo_checked($row->id,$invoiceMaster[0]->refer_by_id).' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_type.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$row->item_amount.' ';
+ echo '-Remove ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal?>
+
+
+
+
+
+
+
+
+ Charges Group
+
+ itype_id.'>'.$row->desc.'';
+ }
+ ?>
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Invoice/Organization_Invoice_PathLab_final_V.php b/app/Views/Invoice/Organization_Invoice_PathLab_final_V.php
new file mode 100644
index 0000000..e941ab8
--- /dev/null
+++ b/app/Views/Invoice/Organization_Invoice_PathLab_final_V.php
@@ -0,0 +1,378 @@
+
+
+
+
+
+
+
+ From
+
+ = H_Name ?>
+ = H_address_1 ?>
+ = H_address_2 ?>
+ Phone: = H_phone_No ?>
+ Email: = H_Email ?>
+
+
+
+
+ To
+
+ =$patient_master[0]->p_fname ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+
+
+
+
+ Invoice #=$invoice_master[0]->invoice_code ?>
+
+ insurance_id>1)
+ {
+ echo ' Ins. Comp. : '.$insurance[0]->ins_company_name.' ';
+ if($invoice_master[0]->insurance_case_id>0)
+ {
+ echo ' Org.Case No. : '.$case_master[0]->case_id_code.' ';
+ }
+ }
+ ?>
+ Date : =$invoice_master[0]->inv_date ?>
+ Patient ID : =$patient_master[0]->p_code ?>
+ payment_id>0 )
+ {
+ echo 'Payment No. : '.$invoice_master[0]->payment_id.' ';
+ }
+ ?>
+
+ Refer By : =$invoice_master[0]->refer_by_other ?>
+
+ = csrf_field() ?>
+
+
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$row->item_amount.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ ?>
+
+
+ #
+ Amount received : =$invoice_master[0]->payment_part_received?>
+ Balance Amount : =$invoice_master[0]->payment_part_balance?>
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+
+
+
+
+
+ payment_status==0 || $invoice_master[0]->payment_part ==1 ) { ?>
+
+
+
+
+ Received Amount
+
+
+
+
+
+
+
+
+
+
+
+
+ Payment Method by : =$invoice_master[0]->payment_mode_desc ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Invoice/Organization_invoice_print_v.php b/app/Views/Invoice/Organization_invoice_print_v.php
new file mode 100644
index 0000000..0e55ac9
--- /dev/null
+++ b/app/Views/Invoice/Organization_invoice_print_v.php
@@ -0,0 +1,181 @@
+
+
+
+
+
+ = H_Name ?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Provisional Invoice #=$invoice_master[0]->invoice_code ?>
+ insurance_id>0)
+ {
+ echo '
Ins. Comp. : '.$insurance[0]->ins_company_name.'
';
+ if($invoice_master[0]->insurance_case_id>0)
+ {
+ echo '
Org.Case No. : '.$case_master[0]->case_id_code.'
';
+ if($invoice_master[0]->insurance_case_id==2)
+ {
+ echo '
Service No. : '.$case_master[0]->insurance_no_2.' ';
+ }
+ echo '
Claim ID/No : '.$case_master[0]->insurance_no_1.'
';
+ }
+ }
+ ?>
+
Date : =$invoice_master[0]->inv_date ?>
+
Patient ID : =$patient_master[0]->p_code ?>
+ payment_id>0 )
+ {
+ echo '
Payment No. : '.$invoice_master[0]->payment_id.'
';
+ }
+ ?>
+
+
+
+
+ From
+
+ = H_Name ?>
+ = H_address_1 ?>
+ = H_address_2 ?>
+ Phone: = H_phone_No ?>
+ Email: = H_Email ?>
+
+
+
+
+ To
+
+ =$patient_master[0]->p_fname ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+ Refer By : =$invoice_master[0]->refer_by_other ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ ?>
+
+
+ #
+ Amount received : =$invoice_master[0]->payment_part_received?>
+ Balance Amount : =$invoice_master[0]->payment_part_balance?>
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+
+
+
+ Signature
+
+
+
+
+
+
+
+ This is computer generated Provisional invoice , Signature and stamp not required
+
+
+
+
+
+
+
diff --git a/app/Views/Invoice/case_list_all.php b/app/Views/Invoice/case_list_all.php
new file mode 100644
index 0000000..e303b97
--- /dev/null
+++ b/app/Views/Invoice/case_list_all.php
@@ -0,0 +1,183 @@
+
+
+
+
+
Org. Case List
+
+
+
+
+ DataTable plugin is not loaded. Please include jQuery DataTables to enable filtering.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Invoice/caseinvoice_V.php b/app/Views/Invoice/caseinvoice_V.php
new file mode 100644
index 0000000..82e7c1c
--- /dev/null
+++ b/app/Views/Invoice/caseinvoice_V.php
@@ -0,0 +1,497 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+
Medical Bills
+
+
+
+
+
+ #
+ Invoice ID.
+ Inv.Date
+ Amount
+
+
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->inv_date.' ';
+ echo ''.$row->net_amount.' ';
+ echo ' Print ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+
+
+
+
+
+
+ Current Status :
+ status==0)
+ {
+ echo 'Pending ';
+ }
+ if($orgcase[0]->status==1)
+ {
+ echo 'Ready For Submission ';
+ }
+ if($orgcase[0]->status==2)
+ {
+ echo 'Submitted in Org. ';
+ }
+ ?>
+
+
+ org_submit_date=='')
+ {
+ $Dateofsubmit=date('d/m/Y');
+ }else{
+ $Dateofsubmit=MysqlDate_to_str($orgcase[0]->org_submit_date);
+ }
+ ?>
+
+ status==0){
+ ?>
+
Submit Date
+
+ ';
+ }
+ ?>
+
+
+
+
+ status==0)
+ {
+ echo ' ';
+ echo 'Case Process For Submit ';
+ }else if($orgcase[0]->status==1){
+ echo ' ';
+ echo 'Case Submitted To Org. ';
+ }else{
+ echo 'Org. Payment ';
+ }
+ ?>
+
+
+
+ case_type==0){ ?>
+
+
+
+
+ Create Payment Request
+
+
+
+
+
+ Create Payment
+ Request
+
+
+
+
+
+
+ Create Refund Request
+
+
+
+
+
+ Create Refund Request
+
+
+
+
+
+ 0){
+ echo "
Payment History ";
+ echo "
+
+
+ Pay ID
+ Date
+ Amount
+ Mode
+ Update By
+
+ ";
+
+ foreach($payment_history as $row){
+ echo "";
+ echo "".$row->id." ";
+ echo "".$row->str_date." ";
+ echo "".$row->Pay_mode." ";
+ echo "".$row->amount." ";
+ echo "".$row->update_by." ";
+ echo " ";
+ }
+ echo "
";
+ }
+ ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Invoice/caseinvoice_ipd_V.php b/app/Views/Invoice/caseinvoice_ipd_V.php
new file mode 100644
index 0000000..8df4b31
--- /dev/null
+++ b/app/Views/Invoice/caseinvoice_ipd_V.php
@@ -0,0 +1,148 @@
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Invoice/caseinvoice_print_V.php b/app/Views/Invoice/caseinvoice_print_V.php
new file mode 100644
index 0000000..28a774f
--- /dev/null
+++ b/app/Views/Invoice/caseinvoice_print_V.php
@@ -0,0 +1,186 @@
+
+
+
+
+
+
+
+
+
+ = H_Name ?>
+ = H_address_1 ?>, Uttarakhand
+
+
+
+ p_code.':'.$orgcase[0]->id .':P-'.date('Y-m-d H:i:s');
+ ?>
+
+
+
+
+Bill No.# :=$orgcase[0]->id?>
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Bill No.:=$orgcase[0]->id?> / UHID:=$person_info[0]->p_code ?> /Name : =$person_info[0]->p_fname ?>
+
+
+
+
+
+
+ To
+ Patient ID : =$person_info[0]->p_code ?>
+ =$person_info[0]->p_fname ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+
+
+
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Card / Insuranc No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Referral No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+ org_submit_date=='')
+ {
+ $Dateofsubmit=date('d/m/Y');
+ }else{
+ $Dateofsubmit=MysqlDate_to_str($orgcase[0]->org_submit_date);
+ }
+ ?>
+ Bill Submit Date : =$Dateofsubmit ?>
+
+
+
+
+
+
+ #
+ Date
+ Charges Type
+ Description
+ Org. Code
+ Qty
+ Rate
+ Sub Invoice Code
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->str_date.' ';
+ echo ''.$row->Charge_type.' ';
+ echo ''.$row->Description.' ';
+ echo ''.$row->orgcode.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->Code.' ';
+ echo ''.$row->Amount.' ';
+ echo '';
+ $Inv_total=$Inv_total+$row->Amount;
+ }
+
+ foreach($showinvoice2 as $row)
+ {
+ $srno=$srno+1;
+ if(($row->discount_amount ?? 0) > 0){
+ $readonly = 'readonly';
+ $disabled = 'disabled';
+ $rate = $row->d_rate ?? $row->item_rate;
+ $discription = $row->Description.' (Discounted) Rate : '.$row->item_rate;
+ }else{
+ $readonly = '';
+ $disabled = '';
+ $rate = $row->item_rate;
+ $discription = $row->Description;
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->str_date.' ';
+ echo ''.$row->Charge_type.' ';
+ echo ''.$discription.' ';
+ echo ''.$row->orgcode.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$rate.' ';
+ echo ''.$row->Code.' ';
+ echo ''.$row->Amount.' ';
+ echo ' ';
+ $Inv_total=$Inv_total+$row->Amount;
+ }
+
+ if(count($MedInvoice)>0 && $med_include==1)
+ {
+ $srno=$srno+1;
+ $Inv_total=Round($Inv_total,0)+Round($MedInvoice[0]->Med_Amount,0);
+ ?>
+
+ =$srno?>
+
+ Medicine Expense
+
+
+
+ =$MedInvoice[0]->Med_Amount?>
+
+
+
+
+ #
+ =number_to_word($Inv_total)?>
+ Gross Total
+ =number_format($Inv_total,2)?>
+
+
+
+
+
+
+
Authorized Signatory
\ No newline at end of file
diff --git a/app/Views/Invoice/org_case_payment.php b/app/Views/Invoice/org_case_payment.php
new file mode 100644
index 0000000..5fe45e7
--- /dev/null
+++ b/app/Views/Invoice/org_case_payment.php
@@ -0,0 +1,144 @@
+
+= csrf_field() ?>
+
+
+
+
+
+
+ Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->str_age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+
+
+
+
+
+
+
+ Org Code : =$org_info[0]->case_id_code?>
+ / Org. Name : =$org_info[0]->insurance_company_name?>
+ / Card No : =$org_info[0]->insurance_no?>
+ =$org_info[0]->insurance_no_1?>
+ =$org_info[0]->insurance_no_2?>
+
+
+
+
+ 0){ ?>
+
+
+
+ IPD Code : =$ipd_info[0]->ipd_code?>
+ / Admit Date : =$ipd_info[0]->str_register_date?>
+ / Dis. Date : =$ipd_info[0]->str_discharge_date?>
+ / Charge Amt : =$ipd_info[0]->charge_amount?>
+ / Medical Bill : =$ipd_info[0]->med_amount?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Invoice/payment_req_panel.php b/app/Views/Invoice/payment_req_panel.php
new file mode 100644
index 0000000..b02051a
--- /dev/null
+++ b/app/Views/Invoice/payment_req_panel.php
@@ -0,0 +1,145 @@
+= form_open() ?>
+
+
+
+
Name: = esc($person_info[0]->p_fname ?? '') ?> {= esc($person_info[0]->p_rname ?? '') ?>}
+
Age: = esc($person_info[0]->age ?? '') ?>
+
Gender: = esc($person_info[0]->xgender ?? '') ?>
+
P Code: = esc($person_info[0]->p_code ?? '') ?>
+
ORG. Code: = esc($org_info[0]->case_id_code ?? '') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Remark
+
+
+
+ Confirm Cash Received and Print Receipt
+
+
+
+
+
+
+
+
+
+
+
+ Payment By
+
+
+ = esc($row->pay_type ?? '') ?> [= esc($row->bank_name ?? '') ?>]
+
+
+
+
+ Tran. ID/Ref.
+
+
+
+ Payment Confirm By Bank/Online
+ Confirm Payment
+
+
+
+
+
+
+
+
+= form_close() ?>
+
diff --git a/app/Views/Invoice/payment_request_list.php b/app/Views/Invoice/payment_request_list.php
new file mode 100644
index 0000000..a10862f
--- /dev/null
+++ b/app/Views/Invoice/payment_request_list.php
@@ -0,0 +1,127 @@
+
+
+
+
+
Payment Paid Request
+
+
+
+
+ DataTable plugin is not loaded. Please include jQuery DataTables to enable filtering.
+
+
+
+
+
+
diff --git a/app/Views/Invoice/refund_amount_panel.php b/app/Views/Invoice/refund_amount_panel.php
new file mode 100644
index 0000000..e3cb3d9
--- /dev/null
+++ b/app/Views/Invoice/refund_amount_panel.php
@@ -0,0 +1,88 @@
+= form_open() ?>
+
+
+
+
+
+
+
CODE: = esc($refund_order[0]->refund_type_code ?? '') ?>
+
Patient Name: = esc($refund_order[0]->patient_name ?? '') ?>
+
+
+
Refund Reason: = esc($refund_order[0]->refund_type_reason ?? '') ?>
+
Refund Amount: Rs. = esc($refund_order[0]->refund_amount ?? '') ?>
+
+
+
Approved By: = esc($refund_order[0]->approved_by ?? '') ?>
+
Date Time: = esc($refund_order[0]->approved_datetime ?? '') ?>
+
+
+
+
+
+
+
+refund_process ?? 0) == 0) : ?>
+
+
+
+
+ Receiver Name
+
+
+
+ Receiver Phone Number
+
+
+
+ Refund Amount
+
+
+
+
+
+
+
+= form_close() ?>
+
+
diff --git a/app/Views/Invoice/refund_invoice.php b/app/Views/Invoice/refund_invoice.php
new file mode 100644
index 0000000..da1a846
--- /dev/null
+++ b/app/Views/Invoice/refund_invoice.php
@@ -0,0 +1,129 @@
+
+
+
+
+
Payment Refund Request
+
+
+
+
+ DataTable plugin is not loaded. Please include jQuery DataTables to enable filtering.
+
+
+
+
+
+
diff --git a/app/Views/PathLab_Report/_test_option_table.php b/app/Views/PathLab_Report/_test_option_table.php
new file mode 100644
index 0000000..1a78f29
--- /dev/null
+++ b/app/Views/PathLab_Report/_test_option_table.php
@@ -0,0 +1,38 @@
+
+
+
+ #
+ Code
+ Bold
+ Action
+
+
+
+
+
+ = esc($lab_test_option[$i]->sort_id ?? '') ?>
+ = esc($lab_test_option[$i]->option_value ?? '') ?>
+ = esc($lab_test_option[$i]->option_bold_str ?? '') ?>
+
+
+ Remove
+ id ?? 0;
+ $sort_current = $lab_test_option[$i]->sort_id ?? 0;
+ if ($i + 1 < count($lab_test_option ?? [])) {
+ $option_next = $lab_test_option[$i + 1]->id ?? 0;
+ $sort_next = $lab_test_option[$i + 1]->sort_id ?? 0;
+ echo 'Down ';
+ }
+ if ($i > 0) {
+ $option_prev = $lab_test_option[$i - 1]->id ?? 0;
+ $sort_prev = $lab_test_option[$i - 1]->sort_id ?? 0;
+ echo 'Up ';
+ }
+ ?>
+
+
+
+
+
+
diff --git a/app/Views/PathLab_Report/lab_report_edit.php b/app/Views/PathLab_Report/lab_report_edit.php
new file mode 100644
index 0000000..8597cf2
--- /dev/null
+++ b/app/Views/PathLab_Report/lab_report_edit.php
@@ -0,0 +1,135 @@
+= form_open() ?>
+
+
+
+
+
+
+ Report Name
+ 0) {
+ $repo_name = $labReport_master[0]->Title ?? '';
+ $repo_id = $labReport_master[0]->mstRepoKey ?? '0';
+ $HTMLData = $labReport_master[0]->HTMLData ?? '';
+ }
+ ?>
+
+
+
+
+
+
+ Attach Charge Name
+
+ 0) {
+ $sel_value = (int) ($labReport_master[0]->charge_id ?? 0);
+ }
+ echo 'No Attach ';
+ foreach (($hc_items ?? []) as $row) {
+ echo 'id ?? 0, $sel_value) . '>' . esc($row->idesc ?? '') . ' ';
+ }
+ ?>
+
+
+
+
+
+ Group
+
+ 0) {
+ $sel_value = (int) ($labReport_master[0]->GrpKey ?? 0);
+ }
+ foreach (($lab_rgroups ?? []) as $row) {
+ echo 'mstRGrpKey ?? 0, $sel_value) . '>' . esc($row->RepoGrp ?? '') . ' ';
+ }
+ ?>
+
+
+
+
+
+
+ = esc($HTMLData) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ id ?? 0) % max(1, count($color_name ?? []))]->code_code_2 ?? '#0f172a';
+ echo '
' . esc($lab_Rep_Item_List[$i]->Test ?? '') . ' [' . esc($lab_Rep_Item_List[$i]->TestID ?? '') . ']
';
+ } ?>
+
+
+
+
+
+= form_close() ?>
+
diff --git a/app/Views/PathLab_Report/lab_report_item_edit.php b/app/Views/PathLab_Report/lab_report_item_edit.php
new file mode 100644
index 0000000..bc67384
--- /dev/null
+++ b/app/Views/PathLab_Report/lab_report_item_edit.php
@@ -0,0 +1,264 @@
+ 0) {
+ $mstTestKey = $lab_test_parameter[0]->mstTestKey ?? 0;
+ $Test = $lab_test_parameter[0]->Test ?? '';
+ $TestID = $lab_test_parameter[0]->TestID ?? '';
+ $Result = $lab_test_parameter[0]->Result ?? '';
+ $Formula = $lab_test_parameter[0]->Formula ?? '';
+ $VRule = $lab_test_parameter[0]->VRule ?? '';
+ $VMsg = $lab_test_parameter[0]->VMsg ?? '';
+ $Unit = $lab_test_parameter[0]->Unit ?? '';
+ $FixedNormals = $lab_test_parameter[0]->FixedNormals ?? '';
+ $isGenderSpecific = (int) ($lab_test_parameter[0]->isGenderSpecific ?? 0);
+ $FixedNormalsWomen = $lab_test_parameter[0]->FixedNormalsWomen ?? '';
+
+ if ($isGenderSpecific == 1) {
+ $checkbox_checked = 'checked';
+ }
+}
+?>
+= form_open() ?>
+
+
+
+
+
+
+ Name of Test
+
+
+
+
+
+
+
+
+
+
+
+ Validation Rule
+
+
+
+
+
+
+
+
+
+ > Is Gender Specific
+
+
+
+
+ Fixed Normals For Women
+
+
+
+
+
+
+
+ = view('PathLab_Report/_test_option_table', ['lab_test_option' => $lab_test_option ?? [], 'mstTestKey' => $mstTestKey]) ?>
+
+
+
+
+
+
+= form_close() ?>
+
diff --git a/app/Views/PathLab_Report/lab_report_list.php b/app/Views/PathLab_Report/lab_report_list.php
new file mode 100644
index 0000000..1995c99
--- /dev/null
+++ b/app/Views/PathLab_Report/lab_report_list.php
@@ -0,0 +1,135 @@
+= form_open() ?>
+
+
+
+
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+ = esc($labReport_master[$i]->Title ?? '') ?>
+ = esc($labReport_master[$i]->RepoGrp ?? '') ?>
+
+ Test List
+ Edit
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+
+
+
+
+
+= form_close() ?>
+
+
diff --git a/app/Views/PathLab_Report/lab_report_test_list.php b/app/Views/PathLab_Report/lab_report_test_list.php
new file mode 100644
index 0000000..2ee5b3d
--- /dev/null
+++ b/app/Views/PathLab_Report/lab_report_test_list.php
@@ -0,0 +1,80 @@
+= form_open() ?>
+
+
+
+
+
+
+ #
+ Test Name
+ Test Code
+ Action
+
+
+
+
+
+ = $i + 1 ?>
+ = esc($lab_Rep_Item_List[$i]->Test ?? '') ?>
+ = esc($lab_Rep_Item_List[$i]->TestID ?? '') ?>
+
+
+
+ Edit
+
+
+ Remove
+
+ id ?? 0;
+ $sort_current = $lab_Rep_Item_List[$i]->EOrder ?? 0;
+ if ($i + 1 < count($lab_Rep_Item_List ?? [])) {
+ $option_next = $lab_Rep_Item_List[$i + 1]->id ?? 0;
+ $sort_next = $lab_Rep_Item_List[$i + 1]->EOrder ?? 0;
+ echo 'Down ';
+ }
+ if ($i > 0) {
+ $option_prev = $lab_Rep_Item_List[$i - 1]->id ?? 0;
+ $sort_prev = $lab_Rep_Item_List[$i - 1]->EOrder ?? 0;
+ echo 'Up ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+= form_close() ?>
+
diff --git a/app/Views/PathLab_Report/lab_test_search.php b/app/Views/PathLab_Report/lab_test_search.php
new file mode 100644
index 0000000..d01391c
--- /dev/null
+++ b/app/Views/PathLab_Report/lab_test_search.php
@@ -0,0 +1,55 @@
+= form_open() ?>
+
+= form_close() ?>
+
diff --git a/app/Views/PathLab_Report/ultrasound_report_edit.php b/app/Views/PathLab_Report/ultrasound_report_edit.php
new file mode 100644
index 0000000..115ff53
--- /dev/null
+++ b/app/Views/PathLab_Report/ultrasound_report_edit.php
@@ -0,0 +1,135 @@
+= form_open() ?>
+
+
+
+
+
+
+ Report Name
+ 0) {
+ $repo_id = $labReport_master[0]->id ?? '0';
+ $repo_name = $labReport_master[0]->template_name ?? '';
+ $repo_title = $labReport_master[0]->title ?? '';
+ $HTMLData = $labReport_master[0]->Findings ?? '';
+ $Impression = $labReport_master[0]->Impression ?? '';
+ }
+ ?>
+
+
+
+
+
+
+ Attach Charge Name
+
+ 0) {
+ $sel_value = (int) ($labReport_master[0]->charge_id ?? 0);
+ }
+ echo 'No Attach ';
+ foreach (($hc_items ?? []) as $row) {
+ echo 'id ?? 0, $sel_value) . '>' . esc($row->idesc ?? '') . ' ';
+ }
+ ?>
+
+
+
+
+
+ Print Report Name
+
+
+
+
+
+
+
+ Findings
+ = esc($HTMLData) ?>
+
+
+
+
+
+
+ Impression
+ = esc($Impression) ?>
+
+
+
+
+
+
+
+ Press Here to Save Data
+ Update
+
+
+
+
+
+= form_close() ?>
+
diff --git a/app/Views/PathLab_Report/ultrasound_template_list.php b/app/Views/PathLab_Report/ultrasound_template_list.php
new file mode 100644
index 0000000..280c703
--- /dev/null
+++ b/app/Views/PathLab_Report/ultrasound_template_list.php
@@ -0,0 +1,134 @@
+= form_open() ?>
+
+
+
+
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+ = esc($labReport_master[$i]->template_name ?? '') ?>
+ = esc($labReport_master[$i]->title ?? '') ?>
+
+ Edit
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+
+
+
+
+
+= form_close() ?>
+
+
diff --git a/app/Views/Setting/Admin/Doctor/temp/Doctor_Search_V.php b/app/Views/Setting/Admin/Doctor/temp/Doctor_Search_V.php
new file mode 100644
index 0000000..813527b
--- /dev/null
+++ b/app/Views/Setting/Admin/Doctor/temp/Doctor_Search_V.php
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ Phone Number
+ EMail
+ Action
+
+
+
+
+
+ =$data[$i]->p_title ?> =$data[$i]->p_fname ?>
+ =$data[$i]->mphone1 ?>
+ =$data[$i]->email1 ?>
+ Edit It....
+
+
+
+
+
+ Name
+ Phone Number
+ EMail
+ Action
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Setting/Admin/Doctor/temp/Doctor_V.php b/app/Views/Setting/Admin/Doctor/temp/Doctor_V.php
new file mode 100644
index 0000000..bb23567
--- /dev/null
+++ b/app/Views/Setting/Admin/Doctor/temp/Doctor_V.php
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Title
+
+ Dr.
+ Mr.
+ Ms.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Save
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Setting/Admin/Doctor/temp/Doctor_profile_V.php b/app/Views/Setting/Admin/Doctor/temp/Doctor_profile_V.php
new file mode 100644
index 0000000..a93029d
--- /dev/null
+++ b/app/Views/Setting/Admin/Doctor/temp/Doctor_profile_V.php
@@ -0,0 +1,300 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Title
+
+ p_title)?>>Dr.
+ p_title)?>>Mr.
+ p_title)?>>Ms.
+
+
+
+
+
+
+
+
+
+
+ Short Decription
+ =$data[0]->doc_sign ?>
+
+
+
+
+
+
+
+
+
+
+
+ ------Select-------
+ id.'">'.$row->SpecName.'';
+ }
+ ?>
+
+
+ Add +
+
+
+
+
+
+
+
+
+
+
+
+
+ '
');
+ $this->table->set_template($table_property);
+ $this->table->set_heading('Fee Type', 'Description', 'Amount');
+ foreach($doc_fee_list as $row)
+ {
+ if($row->id=='')
+ {
+ $button_code=' Not Define';
+ }else{
+ $button_code='Remove ';
+ }
+
+ $this->table->add_row($row->fee_type, $row->doc_fee_desc, $row->amount,$button_code);
+ }
+ echo $this->table->generate();
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Setting/Admin/UserManagement/create.php b/app/Views/Setting/Admin/UserManagement/create.php
new file mode 100644
index 0000000..13b1e07
--- /dev/null
+++ b/app/Views/Setting/Admin/UserManagement/create.php
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
Username
+
+
Username is required.
+
+
+
Email
+
+
Email is required.
+
+
+
Password
+
+
Password is required.
+
+
+
Role
+
+ Select role
+
+ $roleInfo) : ?>
+ >
+ = esc($roleInfo['title'] ?? $roleKey) ?>
+
+
+
+
+
Role is required.
+
+
+
+
+ Create User
+ Cancel
+
+
+
+
+
+
diff --git a/app/Views/Setting/Admin/UserManagement/edit.php b/app/Views/Setting/Admin/UserManagement/edit.php
new file mode 100644
index 0000000..43ab2f2
--- /dev/null
+++ b/app/Views/Setting/Admin/UserManagement/edit.php
@@ -0,0 +1,79 @@
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Save Changes
+ Cancel
+
+
+
+
+
+
diff --git a/app/Views/Setting/Admin/UserManagement/index.php b/app/Views/Setting/Admin/UserManagement/index.php
new file mode 100644
index 0000000..cfbee14
--- /dev/null
+++ b/app/Views/Setting/Admin/UserManagement/index.php
@@ -0,0 +1,145 @@
+
+
+
+
+
+
+
= esc($message) ?>
+
+
+
+
+
+
+ Filter by Person Name
+
+
+
+ Filter by Phone No.
+
+
+
+ Clear Filters
+
+
+
+
+
+
+ #
+ Login ID
+ Person Name
+ Phone No.
+ Email
+ Role
+ Status
+ Action
+
+
+
+
+
+ $user) : ?>
+ getEmailIdentity();
+ $email = $emailIdentity ? $emailIdentity->secret : '';
+ $personName = '';
+ $phoneNo = '';
+ if ($emailIdentity && isset($emailIdentity->extra)) {
+ $extra = $emailIdentity->extra;
+ if (is_string($extra) && trim($extra) !== '') {
+ $decodedExtra = json_decode($extra, true);
+ if (is_array($decodedExtra)) {
+ $personName = trim((string) ($decodedExtra['full_name'] ?? ''));
+ $phoneNo = trim((string) ($decodedExtra['phone_no'] ?? ''));
+ }
+ } elseif (is_array($extra)) {
+ $personName = trim((string) ($extra['full_name'] ?? ''));
+ $phoneNo = trim((string) ($extra['phone_no'] ?? ''));
+ }
+ }
+ $groups = $user->getGroups() ?? [];
+ $roleLabels = [];
+ foreach ($groups as $group) {
+ $roleLabels[] = $rolesConfig[$group]['title'] ?? $group;
+ }
+ $roleText = $roleLabels !== [] ? implode(', ', $roleLabels) : '-';
+ ?>
+
+ = $index + 1 ?>
+ = esc($user->username ?? '') ?>
+ = esc($personName !== '' ? $personName : '-') ?>
+ = esc($phoneNo !== '' ? $phoneNo : '-') ?>
+ = esc($email) ?>
+ = esc($roleText) ?>
+
+ active)) : ?>
+ Active
+
+ Inactive
+
+
+
+
+ Edit
+ Reset Password
+
+
+
+
+
+
+ No users loaded yet.
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Setting/Admin/UserManagement/permissions.php b/app/Views/Setting/Admin/UserManagement/permissions.php
new file mode 100644
index 0000000..8fbe2fb
--- /dev/null
+++ b/app/Views/Setting/Admin/UserManagement/permissions.php
@@ -0,0 +1,181 @@
+
+
+
+
+
+
+
= esc($message) ?>
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
User
+
+ Select user
+
+
+ getEmailIdentity();
+ $email = $emailIdentity ? $emailIdentity->secret : '';
+ $label = trim(($user->username ?? '') . ($email ? ' (' . $email . ')' : ''));
+ ?>
+ id === (int) $user->id ? 'selected' : '' ?>>
+ = esc($label) ?>
+
+
+
+
+
User is required.
+
+
+ Load Permissions
+
+
+
+
+
Permissions
+
+ Pharmacy module access is controlled by pharmacy.access .
+
+
+ getPermissions() ?? [];
+ }
+
+ $groupedPermissions = [];
+ $groupTitles = [
+ 'admin' => 'Admin',
+ 'users' => 'Users',
+ 'beta' => 'Beta',
+ 'template' => 'Templates',
+ 'pharmacy' => 'Pharmacy',
+ 'opd' => 'OPD Doctor Panel',
+ 'billing.opd' => 'OPD',
+ 'billing.charges' => 'Charges',
+ 'billing.ipd' => 'IPD Billing',
+ 'billing' => 'Billing',
+ 'other' => 'Other',
+ ];
+ foreach ($permissions as $permissionKey => $permissionLabel) {
+ $parts = explode('.', $permissionKey);
+ $groupKey = $parts[0] ?? 'other';
+ if ($groupKey === 'billing' && isset($parts[1])) {
+ $groupKey = $groupKey . '.' . $parts[1];
+ }
+
+ if (! isset($groupTitles[$groupKey])) {
+ $titleBase = str_replace(['-', '_'], ' ', $groupKey);
+ $titleBase = str_replace('billing ', '', $titleBase);
+ $groupTitles[$groupKey] = ucwords($titleBase);
+ }
+
+ if (! isset($groupedPermissions[$groupKey])) {
+ $groupedPermissions[$groupKey] = [];
+ }
+
+ $groupedPermissions[$groupKey][$permissionKey] = $permissionLabel;
+ }
+ if (! isset($groupedPermissions['other'])) {
+ $groupedPermissions['other'] = [];
+ }
+
+ $groupOrder = [
+ 'admin',
+ 'users',
+ 'template',
+ 'pharmacy',
+ 'opd',
+ 'billing.opd',
+ 'billing.charges',
+ 'billing.ipd',
+ 'billing',
+ 'beta',
+ 'other',
+ ];
+ ?>
+
+
+
+
+
+
= esc($groupTitles[$groupKey] ?? $groupKey) ?>
+ $permissionLabel) : ?>
+
+ >
+
+ = esc($permissionLabel) ?>
+
+
+
+
+
+
+
+
No permissions configured.
+
+
+
+
+
+ Save Permissions
+ Cancel
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Admin/UserManagement/reset_password.php b/app/Views/Setting/Admin/UserManagement/reset_password.php
new file mode 100644
index 0000000..cc5581a
--- /dev/null
+++ b/app/Views/Setting/Admin/UserManagement/reset_password.php
@@ -0,0 +1,106 @@
+
+
+
+
+
+
+
+
+
+
Login ID: = esc((string) ($user->username ?? '')) ?>
+
User ID: = esc((string) ($user->id ?? '')) ?>
+
Set a 6-digit temporary PIN. User will be forced to change password at next login.
+
+
+
+ = csrf_field() ?>
+
+
+
+ Generate PIN
+ Copy PIN
+ Use generated PIN or enter manually.
+
+
+
+ Set Temporary PIN
+ Cancel
+
+
+
+
+
+
diff --git a/app/Views/Setting/Admin/ai_settings.php b/app/Views/Setting/Admin/ai_settings.php
new file mode 100644
index 0000000..4ec835a
--- /dev/null
+++ b/app/Views/Setting/Admin/ai_settings.php
@@ -0,0 +1,227 @@
+
+
+
+ = csrf_field() ?>
+
+
Gemini (optional fallback)
+
+
+
Gemini API Key
+
+
+
+ Current key: = esc($gemini_key_masked ?? '') ?>
+
+ No API key configured yet.
+
+
+
+
+
+
How to get Gemini API key
+
+
+ Open Google AI Studio API Keys
+ Copy Link .
+
+ Sign in and click Create API key .
+ Copy the key and paste it in this field.
+ Click Save Key , then Test Connection .
+
+
If test fails, check internet access from server, remove extra spaces/newline in key, or regenerate key.
+
+
+
+
Azure OpenAI (Primary)
+
+ Azure OpenAI Endpoint
+
+
+
+
Azure OpenAI API Key
+
+
+
+ Current key: = esc($azure_openai_key_masked ?? '') ?>
+
+ No Azure OpenAI key configured yet.
+
+
+
+
+
+
+
OCR (Azure Document Intelligence)
+
+ Document Intelligence Endpoint
+
+
+
+
Document Intelligence Key
+
+
+
+ Current key: = esc($azure_docintel_key_masked ?? '') ?>
+
+ No Document Intelligence key configured yet.
+
+
+
+
+
+ Save Settings
+ Test Gemini
+ Test Azure OpenAI
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Admin/index.php b/app/Views/Setting/Admin/index.php
new file mode 100644
index 0000000..8e681e8
--- /dev/null
+++ b/app/Views/Setting/Admin/index.php
@@ -0,0 +1,106 @@
+
+
+
Admin Panel
+
+
+ Dashboard
+ Admin
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Bank/bank_search_v.php b/app/Views/Setting/Bank/bank_search_v.php
new file mode 100644
index 0000000..35d7540
--- /dev/null
+++ b/app/Views/Setting/Bank/bank_search_v.php
@@ -0,0 +1,339 @@
+
+
+
+ = csrf_field() ?>
+
+
+ Bank (Charge Type)
+
+ Select bank
+
+ = esc($bank->bank_name ?? '') ?>
+
+
+
+
+ Add Bank
+ Add Payment Source
+
+
+
+
+
+
+
+
+
Payment Sources (Items)
+
+
+
+
+ Pay Type
+
+
+
+
+
+ Select a bank to view payment sources.
+
+
+
+
+
+
+
+
+
+
+
+
+
Banks
+
+
+
+
+ Bank
+
+
+
+
+
+
+
+ = esc($bank->bank_name ?? '') ?>
+
+ Edit
+ Delete
+
+
+
+
+
+ No banks found.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bank Name
+
+
+
+ Payment Source Name (optional)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Payment Source Bank
+
+ Select bank
+
+ = esc($bank->bank_name ?? '') ?>
+
+
+
+
+ Payment Source Name
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Bed/assignment_history.php b/app/Views/Setting/Bed/assignment_history.php
new file mode 100644
index 0000000..a487b6a
--- /dev/null
+++ b/app/Views/Setting/Bed/assignment_history.php
@@ -0,0 +1,249 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Bed
+
+ Select bed
+ bed_code ?? '') . ' ' . ($bed->bed_number ?? ''));
+ ?>
+ = esc($label) ?>
+
+
+
+
+ Ward
+
+ Select ward
+
+ = esc($ward->ward_name ?? '') ?>
+
+
+
+
+ Assignment Type
+
+ Admission
+ Transfer
+ Discharge
+
+
+
+ Assigned Date
+
+
+
+ Released Date
+
+
+
+ Discharged Date
+
+
+
+ Total Days
+
+
+
+ Release Reason
+
+
+
+ IPD ID
+
+
+
+ Assigned By
+
+
+
+ Transfer From Bed
+
+ None
+ bed_code ?? '') . ' ' . ($bed->bed_number ?? ''));
+ ?>
+ = esc($label) ?>
+
+
+
+
+ Transfer Reason
+
+
+
+ Remarks
+
+
+
+ Save Assignment
+ Clear
+
+
+
+
+
+
+
+ All Wards
+
+
+
+
+ All Types
+
+
+
+
+
+
+
+ Bed
+ Ward
+ Type
+ Assigned
+ Released
+ Total Days
+ Reason
+ Action
+
+
+
+
+
+ = esc(($row->bed_code ?? '') . ' ' . ($row->bed_number ?? '')) ?>
+ = esc($row->ward_name ?? '') ?>
+ = esc($row->assignment_type ?? '') ?>
+ = esc($row->assigned_date ?? '') ?>
+ = esc($row->released_date ?? $row->discharged_date ?? '') ?>
+ = esc($row->total_days ?? '') ?>
+ = esc($row->release_reason ?? $row->transfer_reason ?? '') ?>
+
+ Edit
+ Delete
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Bed/bed_list.php b/app/Views/Setting/Bed/bed_list.php
new file mode 100644
index 0000000..4f7ab56
--- /dev/null
+++ b/app/Views/Setting/Bed/bed_list.php
@@ -0,0 +1,262 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Bed Code
+
+
+
+ Bed Number
+
+
+
+ Ward
+
+ Select ward
+
+ = esc($ward->ward_name ?? '') ?>
+
+
+
+
+ Category
+
+ Select category
+
+ = esc($cat->category_name ?? '') ?>
+
+
+
+
+ Bed Status
+
+ Available
+ Occupied
+ Reserved
+ Blocked
+ Under Maintenance
+ Cleaning
+
+
+
+ Position
+
+
+
+ Base Charge Override
+
+
+
+ Nursing Charge Override
+
+
+
+
+ Status
+
+ Active
+ Inactive
+
+
+
+ Remarks
+
+
+
+ Save Bed
+ Clear
+
+
+
+
+
+
+
+ All Wards
+
+
+
+
+ All Bed Status
+
+
+
+
+ All Active
+
+
+
+
+
+
+
+ Code
+ Number
+ Ward
+ Category
+ Status
+ Active
+ Action
+
+
+
+
+
+ = esc($row->bed_code ?? '') ?>
+ = esc($row->bed_number ?? '') ?>
+ = esc($row->ward_name ?? '') ?>
+ = esc($row->category_name ?? '') ?>
+ = esc($row->bed_status ?? '') ?>
+ = esc($row->status ?? '') ?>
+
+ Edit
+ Delete
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Bed/category_list.php b/app/Views/Setting/Bed/category_list.php
new file mode 100644
index 0000000..f5ed3ed
--- /dev/null
+++ b/app/Views/Setting/Bed/category_list.php
@@ -0,0 +1,213 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Category Code
+
+
+
+ Category Name
+
+
+
+ Category Type
+
+ General
+ Private
+ Semi-Private
+ Deluxe
+ ICU
+ NICU
+ PICU
+ HDU
+ ICCU
+ CCU
+ Suite
+ VIP
+
+
+
+ Base Charge/Day
+
+
+
+ Nursing Charge/Day
+
+
+
+ Amenities (JSON or comma list)
+
+
+
+ Description
+
+
+
+ Status
+
+ Active
+ Inactive
+
+
+
+ Save Category
+ Clear
+
+
+
+
+
+
+
+ All Types
+
+
+
+
+ All Status
+
+
+
+
+
+
+
+ Code
+ Name
+ Type
+ Charges
+ Status
+ Action
+
+
+
+
+
+ = esc($row->category_code ?? '') ?>
+ = esc($row->category_name ?? '') ?>
+ = esc($row->category_type ?? '') ?>
+ = esc($row->base_charge_per_day ?? '') ?> / = esc($row->nursing_charge_per_day ?? '') ?>
+ = esc($row->status ?? '') ?>
+
+ Edit
+ Delete
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Bed/index.php b/app/Views/Setting/Bed/index.php
new file mode 100644
index 0000000..807e943
--- /dev/null
+++ b/app/Views/Setting/Bed/index.php
@@ -0,0 +1,43 @@
+
+
+
Bed Management
+
+
+ Dashboard
+ Bed Management
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Bed/maintenance_list.php b/app/Views/Setting/Bed/maintenance_list.php
new file mode 100644
index 0000000..ecce522
--- /dev/null
+++ b/app/Views/Setting/Bed/maintenance_list.php
@@ -0,0 +1,233 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Bed
+
+ Select bed
+ bed_code ?? '') . ' ' . ($bed->bed_number ?? ''));
+ ?>
+ = esc($label) ?>
+
+
+
+
+ Type
+
+ Cleaning
+ Repair
+ Inspection
+ Replacement
+ Sanitization
+
+
+
+ Status
+
+ Pending
+ In Progress
+ Completed
+ Cancelled
+
+
+
+ Scheduled Date
+
+
+
+ Completed Date
+
+
+
+ Next Maintenance
+
+
+
+ Cost
+
+
+
+ Performed By
+
+
+
+ Issue
+
+
+
+ Action Taken
+
+
+
+ Save Log
+ Clear
+
+
+
+
+
+
+
+ All Wards
+
+
+
+
+ All Types
+
+
+
+
+ All Status
+
+
+
+
+
+
+
+ Bed
+ Ward
+ Type
+ Status
+ Scheduled
+ Completed
+ Action
+
+
+
+
+
+ = esc(($row->bed_code ?? '') . ' ' . ($row->bed_number ?? '')) ?>
+ = esc($row->ward_name ?? '') ?>
+ = esc($row->maintenance_type ?? '') ?>
+ = esc($row->status ?? '') ?>
+ = esc($row->scheduled_date ?? '') ?>
+ = esc($row->completed_date ?? '') ?>
+
+ Edit
+ Delete
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_create_V.php b/app/Views/Setting/Charges/IPD_Charges/item_create_V.php
new file mode 100644
index 0000000..eb19ca8
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_create_V.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Charge Name
+
+
+
+ Charges Group
+
+
+ = esc($row->group_desc ?? '') ?>
+
+
+
+
+ Amount
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_insurance_list.php b/app/Views/Setting/Charges/IPD_Charges/item_insurance_list.php
new file mode 100644
index 0000000..2fc3906
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_insurance_list.php
@@ -0,0 +1,24 @@
+
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+
+
+
+
+ = esc($row->ins_company_name ?? '') ?>
+ = esc($row->i_amount ?? '') ?>
+ = esc($row->code ?? '') ?>
+
+ Delete
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_item_excel.php b/app/Views/Setting/Charges/IPD_Charges/item_item_excel.php
new file mode 100644
index 0000000..6a3a825
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_item_excel.php
@@ -0,0 +1,33 @@
+
+ Rate List of = esc($data[0]->group_desc ?? 'Charges') ?> for = esc($insuranceName ?? '') ?>
+
+ Rate List of = esc($data[0]->group_desc ?? 'Charges') ?>
+
+
+
+
+ Charge Name
+ Charge Details
+
+ Amount
+ Code
+
+ Amount
+
+
+
+
+
+
+ = esc($row->idesc ?? '') ?>
+ = esc($row->idesc_detail ?? '') ?>
+
+ = esc($row->display_amount ?? $row->i_amount ?? $row->amount ?? '') ?>
+ = esc($row->code ?? ($row->i_amount === null ? 'Base Rate' : '')) ?>
+
+ = esc($row->amount ?? '') ?>
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_item_list.php b/app/Views/Setting/Charges/IPD_Charges/item_item_list.php
new file mode 100644
index 0000000..462c9e1
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_item_list.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+ IPD Charges
+
+
+
+
+
+
+
+
+
+ Rate List of = esc($data[0]->group_desc ?? 'Charges') ?> for = esc($insuranceName ?? '') ?>
+
+ Rate List of = esc($data[0]->group_desc ?? 'Charges') ?>
+
+
+
+
+ Charge Name
+ Charge Details
+
+ Amount
+ Code
+
+ Amount
+
+
+
+
+
+
+ = esc($row->idesc ?? '') ?>
+ = esc($row->idesc_detail ?? '') ?>
+
+ = esc($row->display_amount ?? $row->i_amount ?? '') ?>
+ = esc($row->code ?? ($row->i_amount === null ? 'Base Rate' : '')) ?>
+
+ = esc($row->amount ?? '') ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_profile_V.php b/app/Views/Setting/Charges/IPD_Charges/item_profile_V.php
new file mode 100644
index 0000000..c97ed10
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_profile_V.php
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Charge Name
+
+
+
+ Charges Group
+
+
+ itype ?? '', $row->itype_id ?? '') ?>>
+ = esc($row->group_desc ?? '') ?>
+
+
+
+
+
+ Amount
+
+
+
+
+
+ Description
+ = esc($data_item[0]->idesc_detail ?? '') ?>
+
+
+
+
+
+
+
+
+
+ = view('Setting/Charges/IPD_Charges/item_insurance_list', ['data_insurance_item' => $data_insurance_item]) ?>
+
+
+
+
+ Company Name
+
+
+ = esc($row->ins_company_name ?? '') ?>
+
+
+
+
+ Amount
+
+
+
+ Code
+
+
+
+ Add
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_search_V.php b/app/Views/Setting/Charges/IPD_Charges/item_search_V.php
new file mode 100644
index 0000000..5d1f875
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_search_V.php
@@ -0,0 +1,110 @@
+
+
+
+
+
+ Select Charge Type
+
+
+ itype_id ?? '') ?>>
+ = esc($row->group_desc ?? '') ?>
+
+
+
+
+
+ Insurance Company
+
+ Base Rate
+
+ = esc($row->ins_company_name ?? '') ?>
+
+
+
+
+
+
+ Export Excel
+
+
+
+ Print PDF
+
+
+
+
+
+
+ = view('Setting/Charges/IPD_Charges/item_search_adv', ['data' => $data, 'typeId' => $typeId]) ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_search_adv.php b/app/Views/Setting/Charges/IPD_Charges/item_search_adv.php
new file mode 100644
index 0000000..e8a43f7
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_search_adv.php
@@ -0,0 +1,43 @@
+
+
+
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+ = esc($row->group_desc ?? '') ?>
+ = esc($row->idesc ?? '') ?>
+ = esc($row->amount ?? '') ?>
+
+
+ Edit
+
+
+
+
+
+
+
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_type_create.php b/app/Views/Setting/Charges/IPD_Charges/item_type_create.php
new file mode 100644
index 0000000..f4c339b
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_type_create.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+ Charges Group Name
+
+
+
+ Add Record
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_type_profile.php b/app/Views/Setting/Charges/IPD_Charges/item_type_profile.php
new file mode 100644
index 0000000..3b99b98
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_type_profile.php
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Charges Group Name
+
+
+
+ Update Record
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/IPD_Charges/item_type_search_v.php b/app/Views/Setting/Charges/IPD_Charges/item_type_search_v.php
new file mode 100644
index 0000000..f1d5778
--- /dev/null
+++ b/app/Views/Setting/Charges/IPD_Charges/item_type_search_v.php
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+ Charges Group Name
+
+
+
+
+
+
+ = esc($row->group_desc ?? '') ?>
+
+ Edit
+
+
+
+
+
+
+ Charges Group Name
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_create_V.php b/app/Views/Setting/Charges/OPD_Charges/item_create_V.php
new file mode 100644
index 0000000..3a20f31
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_create_V.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Charge Name
+
+
+
+ Charges Group
+
+
+ = esc($row->group_desc ?? '') ?>
+
+
+
+
+ Amount
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_insurance_list.php b/app/Views/Setting/Charges/OPD_Charges/item_insurance_list.php
new file mode 100644
index 0000000..2fc3906
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_insurance_list.php
@@ -0,0 +1,24 @@
+
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+
+
+
+
+ = esc($row->ins_company_name ?? '') ?>
+ = esc($row->i_amount ?? '') ?>
+ = esc($row->code ?? '') ?>
+
+ Delete
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_item_excel.php b/app/Views/Setting/Charges/OPD_Charges/item_item_excel.php
new file mode 100644
index 0000000..6a3a825
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_item_excel.php
@@ -0,0 +1,33 @@
+
+ Rate List of = esc($data[0]->group_desc ?? 'Charges') ?> for = esc($insuranceName ?? '') ?>
+
+ Rate List of = esc($data[0]->group_desc ?? 'Charges') ?>
+
+
+
+
+ Charge Name
+ Charge Details
+
+ Amount
+ Code
+
+ Amount
+
+
+
+
+
+
+ = esc($row->idesc ?? '') ?>
+ = esc($row->idesc_detail ?? '') ?>
+
+ = esc($row->display_amount ?? $row->i_amount ?? $row->amount ?? '') ?>
+ = esc($row->code ?? ($row->i_amount === null ? 'Base Rate' : '')) ?>
+
+ = esc($row->amount ?? '') ?>
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_item_list.php b/app/Views/Setting/Charges/OPD_Charges/item_item_list.php
new file mode 100644
index 0000000..f0c3452
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_item_list.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+ OPD Charges
+
+
+
+
+
+
+
+
+
+ Rate List of = esc($data[0]->group_desc ?? 'Charges') ?> for = esc($insuranceName ?? '') ?>
+
+ Rate List of = esc($data[0]->group_desc ?? 'Charges') ?>
+
+
+
+
+ Charge Name
+ Charge Details
+
+ Amount
+ Code
+
+ Amount
+
+
+
+
+
+
+ = esc($row->idesc ?? '') ?>
+ = esc($row->idesc_detail ?? '') ?>
+
+ = esc($row->display_amount ?? $row->i_amount ?? '') ?>
+ = esc($row->code ?? ($row->i_amount === null ? 'Base Rate' : '')) ?>
+
+ = esc($row->amount ?? '') ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_profile_V.php b/app/Views/Setting/Charges/OPD_Charges/item_profile_V.php
new file mode 100644
index 0000000..d3b9e34
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_profile_V.php
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Charge Name
+
+
+
+ Charges Group
+
+
+ itype_id ?? '', $row->itype_id ?? '') ?>>
+ = esc($row->group_desc ?? '') ?>
+
+
+
+
+
+ Amount
+
+
+
+
+
+ Description
+ = esc($data_item[0]->idesc_detail ?? '') ?>
+
+
+
+
+
+
+
+
+
+ = view('Setting/Charges/OPD_Charges/item_insurance_list', ['data_insurance_item' => $data_insurance_item]) ?>
+
+
+
+
+ Company Name
+
+
+ = esc($row->ins_company_name ?? '') ?>
+
+
+
+
+ Amount
+
+
+
+ Code
+
+
+
+ Add
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_search_V.php b/app/Views/Setting/Charges/OPD_Charges/item_search_V.php
new file mode 100644
index 0000000..2998423
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_search_V.php
@@ -0,0 +1,110 @@
+
+
+
+
+
+ Select Charge Type
+
+
+ itype_id ?? '') ?>>
+ = esc($row->group_desc ?? '') ?>
+
+
+
+
+
+ Insurance Company
+
+ Base Rate
+
+ = esc($row->ins_company_name ?? '') ?>
+
+
+
+
+
+
+ Export Excel
+
+
+
+ Print PDF
+
+
+
+
+
+
+ = view('Setting/Charges/OPD_Charges/item_search_adv', ['data' => $data, 'typeId' => $typeId]) ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_search_adv.php b/app/Views/Setting/Charges/OPD_Charges/item_search_adv.php
new file mode 100644
index 0000000..e7eeffc
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_search_adv.php
@@ -0,0 +1,46 @@
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+ = esc($row->isIPD_OPD ?? '') ?>
+ = esc($row->group_desc ?? '') ?>
+ = esc($row->idesc ?? '') ?>
+ = esc($row->amount ?? '') ?>
+
+
+ Edit
+
+
+
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_type_create.php b/app/Views/Setting/Charges/OPD_Charges/item_type_create.php
new file mode 100644
index 0000000..d87dc23
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_type_create.php
@@ -0,0 +1,62 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+ Charges Group Name
+
+
+
+ Is IPD or OPD
+
+ Both OPD and IPD
+ Only OPD
+ Only IPD
+
+
+
+ Add Record
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_type_profile.php b/app/Views/Setting/Charges/OPD_Charges/item_type_profile.php
new file mode 100644
index 0000000..8a43a7d
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_type_profile.php
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Charges Group Name
+
+
+
+ Is IPD or OPD
+
+ is_ipd_opd ?? '') ?>>Both OPD and IPD
+ is_ipd_opd ?? '') ?>>Only OPD
+ is_ipd_opd ?? '') ?>>Only IPD
+
+
+
+ Update Record
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/OPD_Charges/item_type_search_v.php b/app/Views/Setting/Charges/OPD_Charges/item_type_search_v.php
new file mode 100644
index 0000000..e130c1b
--- /dev/null
+++ b/app/Views/Setting/Charges/OPD_Charges/item_type_search_v.php
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+ OPD or IPD
+ Charges Group Name
+
+
+
+
+
+
+ = esc($row->isIPD_OPD ?? '') ?>
+ = esc($row->group_desc ?? '') ?>
+
+ Edit
+
+
+
+
+
+
+ OPD or IPD
+ Charges Group Name
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_create_V.php b/app/Views/Setting/Charges/Package/item_create_V.php
new file mode 100644
index 0000000..fc8249c
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_create_V.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Package Name
+
+
+
+ Package Group
+
+
+ = esc($row->pakage_group_name ?? '') ?>
+
+
+
+
+ Amount
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_insurance_list.php b/app/Views/Setting/Charges/Package/item_insurance_list.php
new file mode 100644
index 0000000..2fc3906
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_insurance_list.php
@@ -0,0 +1,24 @@
+
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+
+
+
+
+ = esc($row->ins_company_name ?? '') ?>
+ = esc($row->i_amount ?? '') ?>
+ = esc($row->code ?? '') ?>
+
+ Delete
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_item_excel.php b/app/Views/Setting/Charges/Package/item_item_excel.php
new file mode 100644
index 0000000..bad6a4e
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_item_excel.php
@@ -0,0 +1,33 @@
+
+ Package Rate List for = esc($insuranceName ?? '') ?>
+
+ Package Rate List
+
+
+
+
+ Package Name
+ Description
+
+ Amount
+ Code
+
+ Amount
+
+
+
+
+
+
+ = esc($row->ipd_pakage_name ?? '') ?>
+ = esc($row->Pakage_description ?? '') ?>
+
+ = esc($row->display_amount ?? $row->i_amount ?? $row->Pakage_Min_Amount ?? '') ?>
+ = esc($row->code ?? ($row->i_amount === null ? 'Base Rate' : '')) ?>
+
+ = esc($row->Pakage_Min_Amount ?? '') ?>
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_item_list.php b/app/Views/Setting/Charges/Package/item_item_list.php
new file mode 100644
index 0000000..efdfcb5
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_item_list.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+ IPD Package
+
+
+
+
+
+
+
+
+
+ Package Rate List for = esc($insuranceName ?? '') ?>
+
+ Package Rate List
+
+
+
+
+ Package Name
+ Description
+
+ Amount
+ Code
+
+ Amount
+
+
+
+
+
+
+ = esc($row->ipd_pakage_name ?? '') ?>
+ = esc($row->Pakage_description ?? '') ?>
+
+ = esc($row->display_amount ?? $row->i_amount ?? '') ?>
+ = esc($row->code ?? ($row->i_amount === null ? 'Base Rate' : '')) ?>
+
+ = esc($row->Pakage_Min_Amount ?? '') ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_profile_V.php b/app/Views/Setting/Charges/Package/item_profile_V.php
new file mode 100644
index 0000000..167aff9
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_profile_V.php
@@ -0,0 +1,139 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ Description
+ = esc($data_item[0]->Pakage_description ?? '') ?>
+
+
+
+
+
+
+
+
+
+ = view('Setting/Charges/Package/item_insurance_list', ['data_insurance_item' => $data_insurance_item]) ?>
+
+
+
+
+ Company Name
+
+
+ = esc($row->ins_company_name ?? '') ?>
+
+
+
+
+ Amount
+
+
+
+ Code
+
+
+
+ Add
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_search_V.php b/app/Views/Setting/Charges/Package/item_search_V.php
new file mode 100644
index 0000000..7b5ede0
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_search_V.php
@@ -0,0 +1,110 @@
+
+
+
+
+
+ Select Package Group
+
+
+ pak_id ?? '') ?>>
+ = esc($row->pakage_group_name ?? '') ?>
+
+
+
+
+
+ Insurance Company
+
+ Base Rate
+
+ = esc($row->ins_company_name ?? '') ?>
+
+
+
+
+
+
+ Export Excel
+
+
+
+ Print PDF
+
+
+
+
+
+
+ = view('Setting/Charges/Package/item_search_adv', ['data' => $data, 'groupId' => $groupId]) ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_search_adv.php b/app/Views/Setting/Charges/Package/item_search_adv.php
new file mode 100644
index 0000000..aefeb6a
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_search_adv.php
@@ -0,0 +1,43 @@
+
+
+
+ Package Name
+ Charge Name
+ Amount
+
+
+
+
+
+
+ = esc($row->ipd_pakage_name ?? '') ?>
+ = esc($row->Pakage_description ?? '') ?>
+ = esc($row->Pakage_Min_Amount ?? '') ?>
+
+
+ Edit
+
+
+
+
+
+
+
+ Package Name
+ Charge Name
+ Amount
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_type_create.php b/app/Views/Setting/Charges/Package/item_type_create.php
new file mode 100644
index 0000000..f8f73f6
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_type_create.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+ Package Group Name
+
+
+
+ Add Record
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_type_profile.php b/app/Views/Setting/Charges/Package/item_type_profile.php
new file mode 100644
index 0000000..1f482c5
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_type_profile.php
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Package Group Name
+
+
+
+ Update Record
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/Package/item_type_search_v.php b/app/Views/Setting/Charges/Package/item_type_search_v.php
new file mode 100644
index 0000000..4a1431e
--- /dev/null
+++ b/app/Views/Setting/Charges/Package/item_type_search_v.php
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+ Package Group Name
+
+
+
+
+
+
+ = esc($row->pakage_group_name ?? '') ?>
+
+ Edit
+
+
+
+
+
+
+ Package Group Name
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Charges/index.php b/app/Views/Setting/Charges/index.php
new file mode 100644
index 0000000..a0411a1
--- /dev/null
+++ b/app/Views/Setting/Charges/index.php
@@ -0,0 +1,76 @@
+
+
+
Charges
+
+
+ Dashboard
+ Charges
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Doctor/Doctor_Search_V.php b/app/Views/Setting/Doctor/Doctor_Search_V.php
new file mode 100644
index 0000000..2fb1826
--- /dev/null
+++ b/app/Views/Setting/Doctor/Doctor_Search_V.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ Name
+ Phone Number
+ Email
+ Action
+
+
+
+
+
+
+ = esc(($row->p_title ?? '') . ' ' . ($row->p_fname ?? '')) ?>
+ = esc($row->mphone1 ?? '') ?>
+ = esc($row->email1 ?? '') ?>
+
+ Edit
+
+
+
+
+
+ No doctors found.
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Doctor/Doctor_V.php b/app/Views/Setting/Doctor/Doctor_V.php
new file mode 100644
index 0000000..d42f2a4
--- /dev/null
+++ b/app/Views/Setting/Doctor/Doctor_V.php
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+ Title
+
+ >Dr.
+ >Mr.
+ >Ms.
+
+
+
+ Full Name
+
+
+
+ Email
+
+
+
+
+
+
+
+
+
+ OPD Print Template
+
+ -- Select Template --
+
+ >= esc($tmpl) ?>
+
+
+
+
+
+
+
+ OPD Blank Head Template
+
+ -- Select Template --
+
+ >= esc($tmpl) ?>
+
+
+
+
+
+
+
+ Rx Pre-Print Letterhead
+
+ -- Select Template --
+
+ >= esc($tmpl) ?>
+
+
+
+
+
+
+
+ Rx Blank Letterhead
+
+ -- Select Template --
+
+ >= esc($tmpl) ?>
+
+
+
+
+
+
+
+ Rx Plain Paper
+
+ -- Select Template --
+
+ >= esc($tmpl) ?>
+
+
+
+
+
+
+
+ Save
+
+
+
+
+
+
diff --git a/app/Views/Setting/Doctor/Doctor_profile_V.php b/app/Views/Setting/Doctor/Doctor_profile_V.php
new file mode 100644
index 0000000..77019aa
--- /dev/null
+++ b/app/Views/Setting/Doctor/Doctor_profile_V.php
@@ -0,0 +1,433 @@
+{$regField}) && trim((string) $data[0]->{$regField}) !== '') {
+ $doctorRegNo = trim((string) $data[0]->{$regField});
+ break;
+ }
+ }
+
+ if ($doctorRegNo === '') {
+ $shortDescription = trim((string) ($data[0]->doc_sign ?? ''));
+ if ($shortDescription !== '') {
+ $normalizedShortDescription = preg_replace('/\s+/', ' ', $shortDescription);
+ if ($normalizedShortDescription !== null) {
+ if (preg_match('/(?:reg(?:istration)?\s*(?:no|number)?\s*[:\-]?\s*)([A-Z0-9\/-]{4,})/i', $normalizedShortDescription, $matches) === 1 && ! empty($matches[1])) {
+ $doctorRegNo = trim((string) $matches[1]);
+ }
+ }
+ }
+ }
+}
+?>
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Title
+
+ p_title ?? '') ?>>Dr.
+ p_title ?? '') ?>>Mr.
+ p_title ?? '') ?>>Ms.
+
+
+
+ Full Name
+
+
+
+ Email
+
+
+
+
+
+
+ Short Description
+ = esc($data[0]->doc_sign ?? '') ?>
+
+
+
+
+
+
+
+ OPD Print Template
+
+ -- Select Template --
+
+ opd_print_format ?? '')))) ?>>= esc($tmpl) ?>
+
+
+
+
+
+
+
+ OPD Blank Head Template
+
+ -- Select Template --
+
+ opd_blank_print ?? '')))) ?>>= esc($tmpl) ?>
+
+
+
+
+
+
+
+ Rx Pre-Print Letterhead
+
+ -- Select Template --
+
+ rx_pre_print_letter_head_format ?? '')))) ?>>= esc($tmpl) ?>
+
+
+
+
+
+
+
+ Rx Blank Letterhead
+
+ -- Select Template --
+
+ rx_blank_letter_head ?? '')))) ?>>= esc($tmpl) ?>
+
+
+
+
+
+
+
+ Rx Plain Paper
+
+ -- Select Template --
+
+ rx_plain_paper ?? '')))) ?>>= esc($tmpl) ?>
+
+
+
+
+
+
+
+ Save
+
+
+
+
+
Specility
+
+
+
+
+
+ Remove -
+
+
+
+
+
+
+ ------Select-------
+
+ = esc($row->SpecName ?? '') ?>
+
+
+ Add +
+
+
+
+
+
OPD Fees
+
+
+
Fee Type Description Amount ';
+ foreach ($doc_fee_list as $row) {
+ $button = 'Not Define';
+ if (! empty($row->id)) {
+ $button = 'Remove ';
+ }
+ $tableHtml .= '' . esc($row->fee_type ?? '') . ' ' . esc($row->doc_fee_desc ?? '') . ' ' . esc($row->amount ?? '') . ' ' . $button . ' ';
+ }
+ $tableHtml .= '
';
+ echo $tableHtml;
+ ?>
+
+
+
+ Fee Type
+
+
+ = esc($row->fee_type ?? '') ?>
+
+
+
+
+ Fee Description
+
+
+
+ Amount
+
+
+
+ +Add
+
+
+
+
+
IPD Fees
+
+
+
Fee Type Description Amount ';
+ foreach ($doc_ipd_fee_list as $row) {
+ $button = 'Not Define';
+ if (! empty($row->id)) {
+ $button = 'Remove ';
+ }
+ $ipdTableHtml .= '' . esc($row->fee_type ?? '') . ' ' . esc($row->doc_fee_desc ?? '') . ' ' . esc($row->amount ?? '') . ' ' . $button . ' ';
+ }
+ $ipdTableHtml .= ' ';
+ echo $ipdTableHtml;
+ ?>
+
+
+
+ Fee Type
+
+
+ = esc($row->fee_type ?? '') ?>
+
+
+
+
+ Fee Description
+
+
+
+ Amount
+
+
+
+ +Add
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Doctor/Ipd_FeeType_List.php b/app/Views/Setting/Doctor/Ipd_FeeType_List.php
new file mode 100644
index 0000000..6ffbb7c
--- /dev/null
+++ b/app/Views/Setting/Doctor/Ipd_FeeType_List.php
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
= esc($message) ?>
+
+
+
+
+
+
+ = csrf_field() ?>
+
+ IPD Fee Type
+
+
+
+ Add IPD Fee Type
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Doctor/Spec_List.php b/app/Views/Setting/Doctor/Spec_List.php
new file mode 100644
index 0000000..d706be1
--- /dev/null
+++ b/app/Views/Setting/Doctor/Spec_List.php
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
= esc($message) ?>
+
+
+
+
+
+
+ = csrf_field() ?>
+
+ Speciality Name
+
+
+
+ Add Speciality
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Insurance/insurance_create_V.php b/app/Views/Setting/Insurance/insurance_create_V.php
new file mode 100644
index 0000000..3917376
--- /dev/null
+++ b/app/Views/Setting/Insurance/insurance_create_V.php
@@ -0,0 +1,72 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Insurance/insurance_profile_V.php b/app/Views/Setting/Insurance/insurance_profile_V.php
new file mode 100644
index 0000000..36d6c7e
--- /dev/null
+++ b/app/Views/Setting/Insurance/insurance_profile_V.php
@@ -0,0 +1,185 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+
+ active ?? 0) ?>>
+ Active
+
+
+
+
+
+
+
+
+
+
+
+ opd_allowed ?? 0) ?>>
+ OPD Allow
+
+
+
+
OPD Rate Apply
+
+ opd_rate_direct ?? '') ?> type="radio">
+ Direct Customer Rate
+
+
+ opd_rate_direct ?? '') ?> type="radio">
+ Rate Specific Insurance Company
+
+
+
+
+
+ OPD Fee Description
+
+
+
+
+ opd_cash ?? 0) ?>>
+ Direct Allowed
+
+
+
+
+ opd_credit ?? 0) ?>>
+ Credit Allowed
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Rate Apply
+
+ charge_rate_direct ?? '') ?> type="radio">
+ Direct Customer Rate
+
+
+ charge_rate_direct ?? '') ?> type="radio">
+ Rate Specific Insurance Company
+
+
+
+
+
+ {if Direct Customer Rate} Discount
+
+
+
+
+ charge_credit ?? 0) ?>>
+ Charge Credit
+
+
+
+
+ med_credit ?? 0) ?>>
+ Medicine Credit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Insurance/insurance_search_v.php b/app/Views/Setting/Insurance/insurance_search_v.php
new file mode 100644
index 0000000..9c78b18
--- /dev/null
+++ b/app/Views/Setting/Insurance/insurance_search_v.php
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+ Company Name
+ Contact Number
+ OPD Fee
+ Active
+
+
+
+
+
+
+
+ = esc($row->ins_company_name ?? '') ?>
+ = esc($row->ins_contact_number ?? '') ?>
+ = esc($row->opd_fee ?? '') ?>
+ = esc($row->activestatus ?? '') ?>
+
+ Edit
+
+
+
+
+
+ No insurance companies found.
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/MedicalBank/bank_search_v.php b/app/Views/Setting/MedicalBank/bank_search_v.php
new file mode 100644
index 0000000..2b5240e
--- /dev/null
+++ b/app/Views/Setting/MedicalBank/bank_search_v.php
@@ -0,0 +1,339 @@
+
+
+
+ = csrf_field() ?>
+
+
+ Medical Bank
+
+ Select bank
+
+ = esc($bank->bank_name ?? '') ?>
+
+
+
+
+ Add Bank
+ Add Payment Source
+
+
+
+
+
+
+
+
+
Payment Sources
+
+
+
+
+ Pay Type
+
+
+
+
+
+ Select a bank to view payment sources.
+
+
+
+
+
+
+
+
+
+
+
+
+
Medical Banks
+
+
+
+
+ Bank
+
+
+
+
+
+
+
+ = esc($bank->bank_name ?? '') ?>
+
+ Edit
+ Delete
+
+
+
+
+
+ No banks found.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bank Name
+
+
+
+ Payment Source Name (optional)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Payment Source Bank
+
+ Select bank
+
+ = esc($bank->bank_name ?? '') ?>
+
+
+
+
+ Payment Source Name
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Reffer/reffer_add.php b/app/Views/Setting/Reffer/reffer_add.php
new file mode 100644
index 0000000..6249c9b
--- /dev/null
+++ b/app/Views/Setting/Reffer/reffer_add.php
@@ -0,0 +1,70 @@
+
+
+
+
+
+ = csrf_field() ?>
+
+
+ Title
+
+ Mr.
+ Mrs.
+ Ms.
+ Dr.
+
+
+
+ Name
+
+
+
+ Phone Number
+
+
+
+ Type
+
+
+ = esc($row->type_desc ?? '') ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Reffer/reffer_edit.php b/app/Views/Setting/Reffer/reffer_edit.php
new file mode 100644
index 0000000..d5981f1
--- /dev/null
+++ b/app/Views/Setting/Reffer/reffer_edit.php
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+ Title
+
+ title ?? '') ?>>Mr.
+ title ?? '') ?>>Mrs.
+ title ?? '') ?>>Ms.
+ title ?? '') ?>>Dr.
+
+
+
+ Name
+
+
+
+ Phone Number
+
+
+
+ Type
+
+
+ id ?? '', $data[0]->refer_type ?? '') ?>>= esc($row->type_desc ?? '') ?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Reffer/reffer_index.php b/app/Views/Setting/Reffer/reffer_index.php
new file mode 100644
index 0000000..3d3c966
--- /dev/null
+++ b/app/Views/Setting/Reffer/reffer_index.php
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+ Name
+ Type
+ Register Date
+ Status
+ Edit
+
+
+
+
+
+
+ = esc(($row->title ?? '') . ' ' . ($row->f_name ?? '')) ?>
+ = esc($row->type_desc ?? 'Others') ?>
+ = esc($row->str_dateadd ?? '') ?>
+
+ active)) : ?>
+ Active
+
+ Inactive
+
+
+
+ Edit
+
+
+
+
+
+ No referral clients found.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Reffer/reffer_type_list.php b/app/Views/Setting/Reffer/reffer_type_list.php
new file mode 100644
index 0000000..1cbcf16
--- /dev/null
+++ b/app/Views/Setting/Reffer/reffer_type_list.php
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+
= esc($message) ?>
+
+
+
+
+
+
+ = csrf_field() ?>
+
+ Type Name
+
+
+
+ Add Type
+
+
+
+
+
+
+
+
diff --git a/app/Views/Setting/Reffer/temp/hospital_refer/reffer_add.php b/app/Views/Setting/Reffer/temp/hospital_refer/reffer_add.php
new file mode 100644
index 0000000..2351380
--- /dev/null
+++ b/app/Views/Setting/Reffer/temp/hospital_refer/reffer_add.php
@@ -0,0 +1,78 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Setting/Reffer/temp/hospital_refer/reffer_edit.php b/app/Views/Setting/Reffer/temp/hospital_refer/reffer_edit.php
new file mode 100644
index 0000000..5107de5
--- /dev/null
+++ b/app/Views/Setting/Reffer/temp/hospital_refer/reffer_edit.php
@@ -0,0 +1,78 @@
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Setting/Reffer/temp/hospital_refer/reffer_index.php b/app/Views/Setting/Reffer/temp/hospital_refer/reffer_index.php
new file mode 100644
index 0000000..375a2a1
--- /dev/null
+++ b/app/Views/Setting/Reffer/temp/hospital_refer/reffer_index.php
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+ Name
+ Type
+ Register Date
+ Status
+ Edit
+
+
+
+
+
+ =$row->title.' '.$row->f_name?>
+ refer_type==0){
+ echo 'Person';
+ } elseif($row->refer_type==1){
+ echo 'Doctor';
+ }elseif($row->refer_type==2){
+ echo 'Staff';
+ }elseif($row->refer_type==3){
+ echo 'Hospital/Clinic';
+ }else{
+ echo 'Others';
+ }
+
+ ?>
+ =$row->str_dateadd?>
+
+ active){
+ echo "".lang('index_active_link')." ";
+ }else{
+ echo "".lang('index_inactive_link')." ";
+ }
+ ?>
+
+ Edit
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/Setting/Template/index.php b/app/Views/Setting/Template/index.php
new file mode 100644
index 0000000..d724ba1
--- /dev/null
+++ b/app/Views/Setting/Template/index.php
@@ -0,0 +1,202 @@
+user() : null;
+$canPathology = $user && method_exists($user, 'can') ? $user->can('template.pathology') : false;
+$canUltrasound = $user && method_exists($user, 'can') ? $user->can('template.ultrasound') : false;
+$canXray = $user && method_exists($user, 'can') ? $user->can('template.xray') : false;
+$canCt = $user && method_exists($user, 'can') ? $user->can('template.ct') : false;
+$canMri = $user && method_exists($user, 'can') ? $user->can('template.mri') : false;
+$canEcho = $user && method_exists($user, 'can') ? $user->can('template.echo') : false;
+$canOpdPrintTemplate = $user && method_exists($user, 'can') ? $user->can('billing.opd.edit') : false;
+
+if (! $canOpdPrintTemplate && $user && method_exists($user, 'inGroup')) {
+ $canOpdPrintTemplate = $user->inGroup('OPDEdit', 'admin', 'superadmin', 'developer');
+}
+
+$hasTemplateAccess = $canPathology || $canUltrasound || $canXray || $canCt || $canMri || $canEcho;
+?>
+
+
+
Templates Library
+
+
+ Dashboard
+ Template
+
+
+
+
+
+
+
+
+ You do not have access to any templates. Please contact your administrator.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/account/my_profile.php b/app/Views/account/my_profile.php
new file mode 100644
index 0000000..00c529b
--- /dev/null
+++ b/app/Views/account/my_profile.php
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+ username ?? ''));
+ if ($loginId === '') {
+ $loginId = trim((string) ($user->email ?? 'User'));
+ }
+ $personName = trim((string) ($person_name ?? ''));
+ ?>
+
+
+ Login ID
+
+
+
+ Person Name
+
+
+
+ User ID
+
+
+
+ Email
+
+
+
+ Phone No.
+
+
+
+
+
Change Password (Optional)
+
+ New Password
+
+
+
+ Confirm Password
+
+
+
+
+
+ Save Profile
+ Clear Password
+
+
Update your email, phone, and password here.
+
+
+
+
+
+
+
diff --git a/app/Views/auth/login.php b/app/Views/auth/login.php
new file mode 100644
index 0000000..d855656
--- /dev/null
+++ b/app/Views/auth/login.php
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
= lang('Auth.login') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
= lang('Auth.loginTitle') ?>
+
= lang('Auth.loginSubtitle') ?>
+
+
+
+
= esc(session('error')) ?>
+
+
+
+
+ = esc($error) ?>
+
+
+
+ = esc(session('errors')) ?>
+
+
+
+
+
+
= esc(session('message')) ?>
+
+
+
+ = csrf_field() ?>
+
+
+
= lang('Auth.username') ?>
+
+
+
+
+
= lang('Auth.password') ?>
+
+
Please enter your password!
+
+
+
+
+
+ checked>
+ = lang('Auth.rememberMe') ?>
+
+
+
+
+
+ = lang('Auth.login') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/auth/register.php b/app/Views/auth/register.php
new file mode 100644
index 0000000..f374327
--- /dev/null
+++ b/app/Views/auth/register.php
@@ -0,0 +1,65 @@
+= $this->extend(config('Auth')->views['layout']) ?>
+
+= $this->section('title') ?>= lang('Auth.register') ?> = $this->endSection() ?>
+
+= $this->section('main') ?>
+
+
+
+
+
= lang('Auth.register') ?>
+
+
+
= esc(session('error')) ?>
+
+
+
+
+ = esc($error) ?>
+
+
+
+ = esc(session('errors')) ?>
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ = lang('Auth.email') ?>
+
+
+
+
+
+ = lang('Auth.username') ?>
+
+
+
+
+
+ = lang('Auth.password') ?>
+
+
+
+
+
+ = lang('Auth.passwordConfirm') ?>
+
+
+
+ = lang('Auth.register') ?>
+
+
+ = lang('Auth.haveAccount') ?> = lang('Auth.login') ?>
+
+
+
+
+
+
+= $this->endSection() ?>
diff --git a/app/Views/billing/Patient_Cards_V.php b/app/Views/billing/Patient_Cards_V.php
new file mode 100644
index 0000000..a86a7f0
--- /dev/null
+++ b/app/Views/billing/Patient_Cards_V.php
@@ -0,0 +1,127 @@
+
+
Insurance Cards
+
+
+ Profile
+ Insurance
+
+
+
+
+
+
+
+
+
+
Patient: = esc($patient->p_fname ?? '') ?>
+
+ id ?? 0);
+ $insCompanyId = (int) ($card->insurance_id ?? ($selectedInsId ?? 0));
+ $insInsuranceNo = (string) ($card->insurance_no ?? '');
+ $cardHolderName = (string) ($card->card_holder_name ?? '');
+ $relationPatient = (string) ($card->relation_patient_cardholder ?? '');
+ $issueDate = !empty($card->issue_date) ? date('d/m/Y', strtotime($card->issue_date)) : date('d/m/Y');
+ $expiryDate = !empty($card->expiry_date) ? date('d/m/Y', strtotime($card->expiry_date)) : date('d/m/Y');
+ ?>
+
+
+ = csrf_field() ?>
+
+
+
+
+
+ Insurance
+
+
+ id ? 'selected' : '' ?>>
+ = esc($ins->ins_company_name ?? '') ?>
+
+
+
+
+
+ Insurance ID / No.
+
+
+
+ Insurance Card Holder Name
+
+
+
+ Issue Date
+
+
+
+ Expiry Date
+
+
+
+ Relation
+
+
+
+ Add or Update Record
+
+
+
+
+
+
No insurance cards found for this patient.
+
+
+
+
+
+ Company
+ Card No
+ Holder Name
+ Relation
+ Status
+
+
+
+
+
+ = esc($card->ins_company_name ?? '') ?>
+ = esc($card->insurance_no ?? '') ?>
+ = esc($card->card_holder_name ?? '') ?>
+ = esc($card->relation_patient_cardholder ?? '') ?>
+ = isset($card->status) ? esc((string) $card->status) : '' ?>
+
+
+
+
+
+
+
+
+ Use the insurance module to add or edit card details.
+
+
+
+
+
+
diff --git a/app/Views/billing/Patient_File_Upload_V.php b/app/Views/billing/Patient_File_Upload_V.php
new file mode 100644
index 0000000..68d17c2
--- /dev/null
+++ b/app/Views/billing/Patient_File_Upload_V.php
@@ -0,0 +1,20 @@
+
+
+
+
= esc($message) ?>
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ Select File
+
+
+ Upload
+
+
+
diff --git a/app/Views/billing/Patient_Profile_Image_V.php b/app/Views/billing/Patient_Profile_Image_V.php
new file mode 100644
index 0000000..0e736e5
--- /dev/null
+++ b/app/Views/billing/Patient_Profile_Image_V.php
@@ -0,0 +1,311 @@
+
+
Profile Image
+
+
+ Profile
+ Image
+
+
+
+
+
+
+
+
+
Patient: = esc($patient->p_fname ?? '') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Start Camera
+ Stop Camera
+ Capture
+ Retake
+
+
Camera is idle.
+
+
+
+
+
Captured image will appear here.
+
+
+
+
+
Recent Captures
+
Clear
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+ Upload
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/Patient_Profile_Opd_V.php b/app/Views/billing/Patient_Profile_Opd_V.php
new file mode 100644
index 0000000..74a5ac5
--- /dev/null
+++ b/app/Views/billing/Patient_Profile_Opd_V.php
@@ -0,0 +1,80 @@
+
+
OPD Scans
+
+
+ Profile
+ OPD Scans
+
+
+
+
+
+
+
+
+
Patient: = esc($patient->p_fname ?? '') ?>
+
+
+
No OPD scans found.
+
+
+
+
+
+ = esc($group['opd_code']) ?>
+ Dr. = esc($group['doc_name']) ?>
+
+
+ = esc($group['opd_date']) ?> = esc($group['queue_no']) ?>
+
+
+
+
+
No files for this OPD.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/Patient_Search_V.php b/app/Views/billing/Patient_Search_V.php
new file mode 100644
index 0000000..9db43ff
--- /dev/null
+++ b/app/Views/billing/Patient_Search_V.php
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+ Sr.No.
+ Patient/UHID Code
+ Name {Relative Name}
+ Age
+ Last Visit
+ Insurance
+
+
+
+
+
+ =$i+1?>
+ =$data[$i]->p_code ?>
+ =$data[$i]->p_fname ?> {=$data[$i]->p_rname ?>}
+ = esc(get_age_1($data[$i]->dob ?? null, $data[$i]->age ?? '', $data[$i]->age_in_month ?? '', $data[$i]->estimate_dob ?? '', $data[$i]->Last_Visit ?? null)) ?>
+ =$data[$i]->Last_Visit ?>
+ insurance_id==0 ? 'Self': 'Insuranced'); ?>
+
+
+
+
+
+ Sr.No.
+ Patient/UHID Code
+ Name {Relative Name}
+ Age
+ Last Visit
+ Insurance
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/billing/Patient_Search_opd.php b/app/Views/billing/Patient_Search_opd.php
new file mode 100644
index 0000000..5b32989
--- /dev/null
+++ b/app/Views/billing/Patient_Search_opd.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+ Sr.No.
+ OPD Code
+ Patient/UHID Code
+ Name {Relative Name}
+ Age
+ Visit Date
+ Doctor
+ Insurance
+
+
+
+
+ $row) : ?>
+
+ = $i + 1 ?>
+ = esc($row->opd_code ?? '') ?>
+ =$row->p_code ?>
+ = esc(($row->p_fname ?? '') . ' {' . ($row->p_rname ?? '') . '}') ?>
+ = esc(get_age_1($row->dob ?? null, $row->age ?? '', $row->age_in_month ?? '', $row->estimate_dob ?? '', $row->opd_Visit ?? null)) ?>
+ = esc($row->opd_Visit ?? '') ?>
+ = esc($row->doc_name ?? '') ?>
+ = esc($row->short_name ?? '') ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/Patient_V.php b/app/Views/billing/Patient_V.php
new file mode 100644
index 0000000..3f399e0
--- /dev/null
+++ b/app/Views/billing/Patient_V.php
@@ -0,0 +1,468 @@
+
+
+
+
+
+
+
Patient Management
+
+
+ Search
+
+
+ New Person
+
+
+ Last OPDs
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+
+ Title
+
+ Mr.
+ Mrs.
+ Ms.
+ Master
+ Baby
+ Baby Girl
+ Baby Boy
+ Mohd.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
>
+ Date of Birth
+
+
+
+
+
+
+
+
+ Relation
+
+ W/o
+ S/o
+ D/o
+ C/o
+ M/o
+
+
+
+
+
+
+ Blood Group
+
+
+
+ = $row->blood_group ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Go!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/billing/Person_Edit_V.php b/app/Views/billing/Person_Edit_V.php
new file mode 100644
index 0000000..a44c528
--- /dev/null
+++ b/app/Views/billing/Person_Edit_V.php
@@ -0,0 +1,404 @@
+
+
Person Profile - =$data[0]->p_fname; ?> =$data[0]->p_code; ?>
+
+
+ Home
+ Profile
+ Edit
+
+
+
+user();
+ $isAdmin = is_object($user) && method_exists($user, 'inGroup') ? $user->inGroup('admin') : false;
+ if ($data[0]->p_edit == 1 || $isAdmin) {
+ $readonly = '';
+ } else {
+ $readonly = 'readonly';
+ }
+?>
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ Title
+
+ title)?>>Mr.
+ title)?>>Mrs.
+ title)?>>Ms.
+ title)?>>Master
+ title)?>>Baby
+ title)?>>Baby Girl
+
+ title)?>>Baby Boy
+
+ title)?>>Mohd.
+
+
+
+
+
+
+
+
+
+
+ estimate_dob;
+ if($chk_age==1)
+ {
+ $checkbox_checked="checked";
+ $age_input_2='style="display: none;"';
+ $age_input_1='';
+ $DateofBirth='';
+ }else{
+ $checkbox_checked="";
+ $age_input_1='style="display: none;"';
+ $age_input_2='';
+ $DateofBirth=MysqlDate_to_str($data[0]->dob);
+ }
+ ?>
+
+
+
+
+
+
+
+ Relation
+
+ p_relative)?>>W/o
+
+ p_relative)?>>S/o
+
+ p_relative)?>>
+ D/o
+ p_relative)?>>C/o
+
+ p_relative)?>>M/o
+
+
+
+
+
+
+
+
+ Blood Group
+
+
+ blood_group,$data[0]->blood_group)?>>=$row->blood_group?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/billing/Person_profile_V.php b/app/Views/billing/Person_profile_V.php
new file mode 100644
index 0000000..a924c1b
--- /dev/null
+++ b/app/Views/billing/Person_profile_V.php
@@ -0,0 +1,354 @@
+
+
Profile
+
+
+ Home
+ Patient
+ Profile
+
+
+
+
+
+
+
+ = csrf_field() ?>
+ user();
+ $canEditOpd = is_object($user) && method_exists($user, 'can') ? $user->can('billing.opd.edit') : false;
+ $canChargeEdit = is_object($user) && method_exists($user, 'can') ? $user->can('billing.charges.edit') : false;
+ ?>
+
+
+
+
+
+
+
+
+
+
=ucwords($data[0]->p_fname) ?>
+
=$data[0]->p_code; ?>
+
+ Profile Edit
+ Edit Picture
+ OPD Scan
+
+
+
+ A ppointment For OPD
+
+ Add Charge
+
+ IPD
+
+
+
+
+
+
OPD Visits
+
= count($opd_List) ?>
+
+
+
Invoices
+
= count($invoice_list) ?>
+
+
+
Insurance
+
= ($data[0]->insurance_id ?? 0) > 0 ? 'Yes' : 'No' ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ Overview
+
+
+ Insurance
+
+ 0) { ?>
+
+ OPD
+
+
+ 0) { ?>
+
+ Invoices
+
+
+
+
+
+
+
Profile Details
+
+
Full Name
+
=ucwords($data[0]->p_fname) ?>
+
+
+
Gender / Age
+
=$data[0]->xgender?> / = esc(get_age_1($data[0]->dob ?? null, $data[0]->age ?? '', $data[0]->age_in_month ?? '', $data[0]->estimate_dob ?? '')) ?>
+
+
+
Relation
+
=$data[0]->p_relative?> =ucwords($data[0]->p_rname)?>
+
+
+
Aadhar No.
+
=$data[0]->udai?>
+
+
+
Phone
+
=$data[0]->mphone1?>
+
+
+
Email
+
=$data[0]->email1?>
+
+
+
Blood Group
+
=$data[0]->blood_group?>
+
+
+
Address
+
=$data[0]->add1?> =$data[0]->city ?> =$data[0]->district ?> =$data[0]->state ?> =$data[0]->zip ?>
+
+
+
Quick Update
+
+
+
Aadhar No.
+
+
+ Update
+
+
+
+ Insurance Update
+
+
+
+
+
+
Insurance Details
+ insurance_id>0) { ?>
+
+
Company
+
=$data_insurance_card[0]->ins_company_name?>
+
+
+
Card Holder
+
=$data[0]->card_holder_name?>
+
+
+
Relation
+
=$data[0]->relation_patient_cardholder?>
+
+
+
Insurance ID
+
=$data[0]->insurance_no?>
+
+
+
+ 0){ ?>
+
+
Case Code: =$case_master_opd[0]->case_id_code?>
+
Visit Date Start: =$case_master_opd[0]->str_date_registration?>
+
Claim/Case No.: =$case_master_opd[0]->insurance_no_1?>
+
Other IDs: =$case_master_opd[0]->insurance_no_2?>
+
Update Case Information
+
+ 0){ ?>
+
+
+
Case Code: =$case_master_ipd[0]->case_id_code?>
+
Org. Date Start: =$case_master_ipd[0]->str_date_registration?>
+
Claim/Case No.: =$case_master_ipd[0]->insurance_no_1?>
+
Other IDs: =$case_master_ipd[0]->insurance_no_2?>
+
IPD No: =$case_master_ipd[0]->ipd_code?>
+
IPD Admit Date: =$case_master_ipd[0]->str_date_registration?>
+
Update Case Information
+
+
+
+ Create Case for Credit IPD Bill
+ Create Case for Credit OPD Bill
+
+
+
+
+
+ opd_allowed==1) { ?>
+ OPD Insurance Rates / CASH
+
+ charge_cash==1 && $canChargeEdit) { ?>
+ Charge with Ins. Rate / CASH
+
+
+
+
No insurance details available.
+
+
+
+ 0) { ?>
+
+
OPD Registration
+ ';
+ echo '
'.$row->opd_code.' ';
+ echo '
';
+ echo '
Dr.'.$row->doc_name.' ';
+ echo '
D:'.$row->str_apointment_date.' ';
+ echo '
P:'.$row->p_fname.' ';
+
+ if($canEditOpd || $row->new_opd==1){
+ echo '
Edit OPD ';
+ echo '
Print Day Care ';
+ }
+ echo '
';
+ echo '
';
+ }
+ ?>
+
+
+
+ 0) { ?>
+
+
Charges Invoice
+ ';
+ echo '
'.$row->invoice_code.' ';
+ echo '
D:'.$row->str_inv_date.' ';
+ echo '
N:'.$row->inv_name.' ';
+ echo '
';
+ echo '
'.$row->Item_List.' ';
+ if($row->invoice_status==0)
+ {
+ if ($canChargeEdit) {
+ echo '
Edit Charges Invoice ';
+ echo '
Delete : Un-confirm Invoice ';
+ }
+ }else{
+ echo '
Show Charges Invoice ';
+ }
+ echo '
';
+ echo '
';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/billing/charges/charges_invoice_edit.php b/app/Views/billing/charges/charges_invoice_edit.php
new file mode 100644
index 0000000..0210f96
--- /dev/null
+++ b/app/Views/billing/charges/charges_invoice_edit.php
@@ -0,0 +1,266 @@
+
+
+
+= csrf_field() ?>
+user();
+ $canChargeDateEdit = is_object($user) && method_exists($user, 'can') ? $user->can('billing.charges.date-edit') : false;
+ $invoiceDateValue = '';
+ if (!empty($invoiceMaster[0]->inv_date)) {
+ $invoiceDateValue = date('Y-m-d', strtotime((string) $invoiceMaster[0]->inv_date));
+ }
+ $dateReadonly = $canChargeDateEdit ? '' : 'readonly';
+ $dateInputClass = $canChargeDateEdit ? 'form-control' : 'form-control bg-light';
+?>
+
+
+
+
+
+ Doctor Name
+
+ refer_by_id ?? '') ?>>From Other Hospital
+
+ id ?? '', $invoiceMaster[0]->refer_by_id ?? '') ?>>= esc($row->p_fname ?? '') ?>
+
+
+
+
+ Other Doctor
+
+
+
+ Invoice Date
+ />
+
+
+
+
+
+
+
+ Charge Type [D]
+
+ Select Type
+
+ = esc($row->group_desc ?? '') ?>
+
+
+
+
+
+
+ Charge Name
+
+ No Value
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/charges/charges_invoice_show.php b/app/Views/billing/charges/charges_invoice_show.php
new file mode 100644
index 0000000..2883839
--- /dev/null
+++ b/app/Views/billing/charges/charges_invoice_show.php
@@ -0,0 +1,520 @@
+user();
+ $canChargeView = is_object($user) && method_exists($user, 'can') ? $user->can('billing.charges.view') : false;
+ $canChargeEdit = is_object($user) && method_exists($user, 'can') ? $user->can('billing.charges.edit') : false;
+ $canChargePay = is_object($user) && method_exists($user, 'can') ? $user->can('billing.charges.pay') : false;
+ $canChargeCancel = is_object($user) && method_exists($user, 'can') ? $user->can('billing.charges.cancel') : false;
+ $canChargeCorrect = is_object($user) && method_exists($user, 'can') ? $user->can('billing.charges.correct') : false;
+?>
+
+= csrf_field() ?>
+
+
+
+
+
+
+ To
+
+ = esc($patient_master[0]->p_fname ?? '') ?>
+ = esc($patient_master[0]->p_relative ?? '') ?> : = esc($patient_master[0]->p_rname ?? '') ?>
+ Gender : = esc($patient_master[0]->xgender ?? '') ?>
+ Age : = esc($patient_master[0]->age ?? '') ?>
+ Phone No : = esc($patient_master[0]->mphone1 ?? '') ?>
+
+
+
+ Invoice #= esc($invoice_master[0]->invoice_code ?? '') ?>
+ insurance_id ?? 0) > 1) : ?>
+ Ins. Comp. : = esc($insurance[0]->ins_company_name ?? '') ?>
+ insurance_case_id ?? 0) > 0 && count($case_master) > 0) : ?>
+ Org.Case No. : = esc($case_master[0]->case_id_code ?? '') ?>
+
+
+ Date : = esc($invoice_master[0]->inv_date ?? '') ?>
+ Patient ID : = esc($patient_master[0]->p_code ?? '') ?>
+ Refer By : = esc($invoice_master[0]->refer_by_other ?? '') ?>
+
+
+
+
+
+
+
+
+
+
+payment_status ?? 0) == 0 && $canChargePay) : ?>
+
+
+
+
+
+
+ #
+ Amount received : = esc(number_format((float) ($paid_amount ?? 0), 2)) ?>
+ Balance Amount : = esc(number_format((float) ($pending_amount ?? 0), 2)) ?>
+
+
+
+
+
+
+
+
+
+
+ Received Amount
+
+
+
+
+
+
+
+
+
+
+
+payment_status ?? 0) == 1 && $canChargeView) : ?>
+
+
+
+
+
+ Edit Invoice Items
+
+
+
+
+ Cancel Invoice
+
+
+
+
+ payment_mode ?? 0) === 1 || (int) ($invoice_master[0]->payment_mode ?? 0) === 2)) : ?>
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/cash_balance.php b/app/Views/billing/ipd/cash_balance.php
new file mode 100644
index 0000000..af07052
--- /dev/null
+++ b/app/Views/billing/ipd/cash_balance.php
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+
+
+ DataTable plugin is not loaded. Please include jQuery DataTables to enable filtering.
+
+
+
+
+
+ Shows pending balances for direct customers within the date range.
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/cash_balance_table.php b/app/Views/billing/ipd/cash_balance_table.php
new file mode 100644
index 0000000..95e797f
--- /dev/null
+++ b/app/Views/billing/ipd/cash_balance_table.php
@@ -0,0 +1,56 @@
+
+
+
+
+ #
+ IPD Code
+ P Code
+ Person Name
+ Phone No.
+ Admit Date
+ Discharge Date
+ Doc. Name
+ Net Amount
+ Paid Amt.
+ Balance Amt.
+ Type
+
+
+
+
+
+
+
+ = $srNo ?>
+ = esc($row->ipd_code ?? '') ?>
+ = esc($row->p_code ?? '') ?>
+ = esc($row->p_fname ?? '') ?>
+ = esc($row->Contact_info ?? '') ?>
+ = esc($row->str_register_date ?? '') ?>
+ = esc($row->str_discharge_date ?? '') ?>
+ = esc($row->doc_name ?? '') ?>
+ = esc($row->net_amount ?? '') ?>
+ = esc($row->sum_of_paid ?? '') ?>
+ = esc($row->balance_amount ?? '') ?>
+ = esc($row->admit_type ?? '') ?>
+
+
+
+
+
+ #
+
+
+
+
+
+
+
+ Total
+ = esc(number_format((float) ($totals['total_paid'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($totals['total_balance'] ?? 0), 2)) ?>
+
+
+
+
+
diff --git a/app/Views/billing/ipd/current_admission.php b/app/Views/billing/ipd/current_admission.php
new file mode 100644
index 0000000..d7dcbb1
--- /dev/null
+++ b/app/Views/billing/ipd/current_admission.php
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+
+
+ DataTable plugin is not loaded. Please include jQuery DataTables to enable filtering.
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Bed No. [Type]
+ Register Date
+ No. of Days
+ Dr. Name
+ Admit Type
+ Amount
+
+
+
+
+
+
+ = esc($row->ipd_code ?? '') ?>
+ [= esc($row->p_code ?? '') ?>] = esc($row->p_fname ?? '') ?> = esc($row->p_rname ?? '') ?>
+ = esc($row->Bed_Desc ?? '') ?>
+ = esc($row->str_register_date ?? '') ?>
+ = esc($row->no_days ?? '') ?>
+ = esc($row->doc_name ?? '') ?>
+ = esc($row->admit_type ?? '') ?> = esc($row->Org_Status ?? '') ?> = esc($row->insurance_no_1 ?? '') ?>
+ C:= esc($row->charge_amount ?? '') ?>/M:= esc($row->med_amount ?? '') ?>/P:= esc($row->paid_amount ?? '') ?>/B:= esc($row->balance ?? '') ?>
+
+ id)) : ?>
+ View Invoice
+
+ View Invoice
+
+
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Bed No. [Type]
+ Register Date
+ No. of Days
+ Dr. Name
+ Admit Type
+ Amount
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/dashboard.php b/app/Views/billing/ipd/dashboard.php
new file mode 100644
index 0000000..fe2907f
--- /dev/null
+++ b/app/Views/billing/ipd/dashboard.php
@@ -0,0 +1,22 @@
+
+
+
+
IPD Billing
+
+
+ Current Admission
+
+
+ IPD Invoice (All IPDs)
+
+
+ Cash Balance
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/billing/ipd/invoice_list.php b/app/Views/billing/ipd/invoice_list.php
new file mode 100644
index 0000000..db7c6f1
--- /dev/null
+++ b/app/Views/billing/ipd/invoice_list.php
@@ -0,0 +1,180 @@
+
+
+
+
+
+
+
+
+
+
+
+ DataTable plugin is not loaded. Please include jQuery DataTables to enable filtering.
+
+
+
+
+
+ All
+ Admit
+ Discharge
+
+
+
+ Use filters to narrow results. Search per column below.
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/ipd_model_payment_box.php b/app/Views/billing/ipd/ipd_model_payment_box.php
new file mode 100644
index 0000000..d7511a5
--- /dev/null
+++ b/app/Views/billing/ipd/ipd_model_payment_box.php
@@ -0,0 +1,165 @@
+dob ?? null, $person->age ?? '', $person->age_in_month ?? '', $person->estimate_dob ?? '');
+}
+?>
+
+
+
+ Name : = esc($person->p_fname ?? '') ?> {= esc($person->p_rname ?? '') ?> }
+ / Age : = esc($age) ?>
+ / Gender : = esc($person->xgender ?? '') ?>
+ / P Code : = esc($person->p_code ?? '') ?>
+ / IPD Code : = esc($ipd->ipd_code ?? '') ?>
+ / No of Days : = esc($ipd->no_days ?? '') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Remark
+
+
+
+ Confirm Cash Received and Print Receipt
+
+
+
+
+
+
+
+
+
+
+
+ Payment By
+
+
+ = esc(($row->pay_type ?? '') . ' [' . ($row->bank_name ?? '') . ']') ?>
+
+
+
+
+ Tran. ID/Ref.
+
+
+
+ Confirm Payment
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/ipd_panel_deduction_payment.php b/app/Views/billing/ipd/ipd_panel_deduction_payment.php
new file mode 100644
index 0000000..3dae95f
--- /dev/null
+++ b/app/Views/billing/ipd/ipd_panel_deduction_payment.php
@@ -0,0 +1,133 @@
+
+
+
+
+
+
+
+
+
+
+
+ Remark
+
+
+
+ Confirm Cash Received and Print Receipt
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/ipd_panel_tpa_payment.php b/app/Views/billing/ipd/ipd_panel_tpa_payment.php
new file mode 100644
index 0000000..9c44574
--- /dev/null
+++ b/app/Views/billing/ipd/ipd_panel_tpa_payment.php
@@ -0,0 +1,75 @@
+id ?? 0));
+?>
+
+
+
+
+
+
+
+ Discount By Hospital
+
+
+
+ Remark
+
+
+
+
+
+ Discount By Doctor
+
+
+
+ Remark
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/ipd_payment_receipt_print.php b/app/Views/billing/ipd/ipd_payment_receipt_print.php
new file mode 100644
index 0000000..10a2f00
--- /dev/null
+++ b/app/Views/billing/ipd/ipd_payment_receipt_print.php
@@ -0,0 +1,28 @@
+
+
+
+
+
+
+
UHID : = esc($patient->p_code ?? '') ?>
+
Name : = esc($patient->title ?? '') ?> = esc($patient->p_fname ?? '') ?>
+
Sex : = esc($patient->xgender ?? '') ?> = esc($patient->age ?? '') ?>
+
Phone : = esc($patient->mphone1 ?? '') ?>
+
+
+
IPD No. : = esc($ipd->ipd_code ?? '') ?>
+
Date : = esc($payment->payment_date_str ?? '') ?>
+
+
+
+
IPD = esc($payment->Amount_str ?? '') ?> Amount : Rs. = esc($payment->amount ?? '') ?>
+
Amount in Words : Rs. = number_to_word((float) ($payment->amount ?? 0)) ?>
+
Prepared By : = esc($payment->update_by ?? '') ?>
+
+
diff --git a/app/Views/billing/ipd/panel.php b/app/Views/billing/ipd/panel.php
new file mode 100644
index 0000000..6d75882
--- /dev/null
+++ b/app/Views/billing/ipd/panel.php
@@ -0,0 +1,320 @@
+dob ?? null, $person->age ?? '', $person->age_in_month ?? '', $person->estimate_dob ?? '');
+}
+?>
+
+
+
+
+
+
+
+
+
+
+
+ Name : = esc($person->p_fname ?? '') ?> {= esc($person->p_rname ?? '') ?> }
+ / Age : = esc($age) ?>
+ / Gender : = esc($person->xgender ?? '') ?>
+ / UHID : = esc($person->p_code ?? '') ?>
+ / No of Days : = esc($ipd->no_days ?? '') ?>
+
+
+ Admit Date : = esc($ipd->str_register_date ?? '') ?>
+ / Discharge Date : = esc($ipd->str_discharge_date ?? '') ?>
+
+
+
+
+
+
+
+
+ Charges : = esc($ipd->charge_amount ?? '0') ?>
+ Pharmacy Cr. IPD : = esc($ipd->med_amount ?? '0') ?>
+ Net Amount : = esc($ipd->net_amount ?? '0') ?>
+
+
+ Total Paid : = esc($ipd->total_paid_amount ?? '0') ?>
+ Balance : = esc($ipd->balance_amount ?? '0') ?>
+
+ Payment Add
+ Payment Refund
+
+
+ Pharmacy Bill : = esc($ipd->cash_med_amount ?? '0') ?>
+ Paid Amount : = esc($ipd->med_paid ?? '0') ?>
+
+
+
Payment TPA And Others
+ ins_company_name ?? '') || ! empty($ipd->case_id_code ?? '') || ! empty($ipd->insurance_no ?? '') || ! empty($ipd->insurance_no_1 ?? '') || ! empty($ipd->insurance_no_2 ?? '')) : ?>
+
+ ins_company_name ?? '')) : ?>
+
+ Insurance: = esc($ipd->ins_company_name ?? '') ?>
+ ins_short_name ?? '')) : ?>
+ Short: = esc($ipd->ins_short_name ?? '') ?>
+
+
+
+ case_id_code ?? '')) : ?>
+ Org Case: = esc($ipd->case_id_code ?? '') ?>
+
+ insurance_no ?? '')) : ?>
+ Card No: = esc($ipd->insurance_no ?? '') ?>
+
+ insurance_no_1 ?? '')) : ?>
+ Claim ID: = esc($ipd->insurance_no_1 ?? '') ?>
+
+ insurance_no_2 ?? '')) : ?>
+ Service No: = esc($ipd->insurance_no_2 ?? '') ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ Admission Info
+
+
+ Bed Assign
+
+
+ IPD Charges
+
+
+ Package
+
+
+ Diagnosis Charges
+
+
+ Payments
+
+
+ Medical Bills
+
+
+ Bill Details
+
+
+ Discharge Process
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/Views/billing/ipd/panel_admission.php b/app/Views/billing/ipd/panel_admission.php
new file mode 100644
index 0000000..07dd8ea
--- /dev/null
+++ b/app/Views/billing/ipd/panel_admission.php
@@ -0,0 +1,34 @@
+dob ?? null, $person->age ?? '', $person->age_in_month ?? '', $person->estimate_dob ?? '');
+}
+?>
+
+
+
+
+
Patient
+
Name : = esc($person->p_fname ?? '') ?> {= esc($person->p_rname ?? '') ?>}
+
UHID : = esc($person->p_code ?? '') ?>
+
Gender : = esc($person->xgender ?? '') ?>
+
Age : = esc($age) ?>
+
Phone : = esc($person->mphone1 ?? '') ?>
+
+
+
+
+
+
+
Admission
+
IPD Code : = esc($ipd->ipd_code ?? '') ?>
+
Admit Date : = esc($ipd->str_register_date ?? '') ?>
+
Discharge Date : = esc($ipd->str_discharge_date ?? '') ?>
+
No. of Days : = esc($ipd->no_days ?? '') ?>
+
Insurance : = esc($ipd->ins_company_name ?? 'Direct') ?>
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_bed_assign.php b/app/Views/billing/ipd/panel_bed_assign.php
new file mode 100644
index 0000000..6910f68
--- /dev/null
+++ b/app/Views/billing/ipd/panel_bed_assign.php
@@ -0,0 +1,34 @@
+
+
+
+
+ Bed Code
+ Bed Number
+ Ward
+ Assigned Date
+ Released Date
+ Type
+ Remarks
+
+
+
+
+
+
+ = esc($row->bed_code ?? '') ?>
+ = esc($row->bed_number ?? '') ?>
+ = esc($row->ward_name ?? '') ?>
+ = esc($row->assigned_date ?? '') ?>
+ = esc($row->released_date ?? '') ?>
+ = esc($row->assignment_type ?? '') ?>
+ = esc($row->remarks ?? '') ?>
+
+
+
+
+ No bed assignments found.
+
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_bill_details.php b/app/Views/billing/ipd/panel_bill_details.php
new file mode 100644
index 0000000..b7e89c3
--- /dev/null
+++ b/app/Views/billing/ipd/panel_bill_details.php
@@ -0,0 +1,325 @@
+dob ?? null, $person->age ?? '', $person->age_in_month ?? '', $person->estimate_dob ?? '');
+}
+$discountTotal = 0.0;
+$extraCharge = 0.0;
+if ($ipd) {
+ $discountTotal = (float) ($ipd->Discount ?? 0) + (float) ($ipd->Discount2 ?? 0) + (float) ($ipd->Discount3 ?? 0);
+ $extraCharge = (float) ($ipd->chargeamount1 ?? 0) + (float) ($ipd->chargeamount2 ?? 0);
+}
+$billTotals = $bill_totals ?? ['gross' => 0.0, 'net' => 0.0];
+$paidTotal = (float) ($billTotals['paid'] ?? 0);
+$balanceTotal = (float) ($billTotals['balance'] ?? 0);
+$grossAmount = (float) ($ipd->gross_amount ?? 0);
+$netAmount = (float) ($ipd->net_amount ?? 0);
+ $balanceAmount = (float) ($ipd->balance_amount ?? 0);
+if ($grossAmount <= 0) {
+ $grossAmount = (float) ($billTotals['gross'] ?? 0);
+}
+if ($netAmount <= 0) {
+ $netAmount = (float) ($billTotals['net'] ?? 0);
+}
+if ($balanceAmount <= 0) {
+ $balanceAmount = $balanceTotal;
+}
+?>
+
+
+
+
+
+ Name : = esc($person->p_fname ?? '') ?>
+ / Age : = esc($age) ?>
+ / Gender : = esc($person->xgender ?? '') ?>
+ / P Code : = esc($person->p_code ?? '') ?>
+
+ / Ins. Comp. : = esc($insurance['ins_company_name'] ?? '') ?>
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+
+
+ ';
+ echo 'Package ';
+ echo ' ';
+ echo '';
+ $headDesc = 'Package';
+ $headTotal = 0.0;
+
+ foreach ($ipd_packages as $row) {
+ echo '';
+ echo '' . $srNo . ' ';
+ echo '' . esc($row->package_name ?? '') . ' ';
+ echo '' . esc($row->org_code ?? '') . ' ';
+ echo ' ';
+ echo ' ';
+ echo '' . esc(number_format((float) ($row->package_Amount ?? 0), 2)) . ' ';
+ $srNo++;
+ $headTotal += (float) ($row->package_Amount ?? 0);
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo 'Sub Total ';
+ echo '' . esc(number_format($headTotal, 2)) . ' ';
+ echo ' ';
+ }
+
+ $ipdItems = $ipd_invoice_items ?? [];
+ $ipdItemCount = count($ipdItems);
+ for ($i = 0; $i < $ipdItemCount; $i++) {
+ $row = $ipdItems[$i];
+ if ($headDesc !== ($row->group_desc ?? '')) {
+ echo '';
+ echo '' . esc($row->group_desc ?? '') . ' ';
+ echo ' ';
+ echo ' ';
+ $headDesc = (string) ($row->group_desc ?? '');
+ $headTotal = 0.0;
+ }
+
+ echo '';
+ echo '' . $srNo . ' ';
+ echo '' . esc(($row->item_name ?? '') . ' ' . ($row->comment ?? '')) . ' ';
+ echo '' . esc($row->org_code ?? '') . ' ';
+ echo '' . esc($row->item_qty ?? '') . ' ';
+ echo '' . esc(number_format((float) ($row->item_rate ?? 0), 2)) . ' ';
+ echo '' . esc(number_format((float) ($row->item_amount ?? 0), 2)) . ' ';
+ $srNo++;
+ $headTotal += (float) ($row->item_amount ?? 0);
+ echo ' ';
+
+ $next = $ipdItems[$i + 1] ?? null;
+ if ($next === null || ($headDesc !== ($next->group_desc ?? ''))) {
+ echo '';
+ echo ' ';
+ echo 'Sub Total ';
+ echo '' . esc(number_format($headTotal, 2)) . ' ';
+ echo ' ';
+ }
+ }
+
+ $showItems = $showinvoice ?? [];
+ $showCount = count($showItems);
+ for ($i = 0; $i < $showCount; $i++) {
+ $row = $showItems[$i];
+ if ($headDesc !== ($row->Charge_type ?? '')) {
+ echo '';
+ echo '' . esc($row->Charge_type ?? '') . ' ';
+ echo ' ';
+ echo ' ';
+ $headDesc = (string) ($row->Charge_type ?? '');
+ $headTotal = 0.0;
+ }
+
+ echo '';
+ echo '' . $srNo . ' ';
+ echo '' . esc($row->idesc ?? '') . ' ';
+ echo '' . esc($row->orgcode ?? '') . ' ';
+ echo '' . esc($row->no_qty ?? '') . ' ';
+ echo '' . esc(number_format((float) ($row->item_rate ?? 0), 2)) . ' ';
+ echo '' . esc(number_format((float) ($row->amount ?? 0), 2)) . ' ';
+ $srNo++;
+ $headTotal += (float) ($row->amount ?? 0);
+ echo ' ';
+
+ $next = $showItems[$i + 1] ?? null;
+ if ($next === null || ($headDesc !== ($next->Charge_type ?? ''))) {
+ echo '';
+ echo ' ';
+ echo 'Sub Total ';
+ echo '' . esc(number_format($headTotal, 2)) . ' ';
+ echo ' ';
+ }
+ }
+
+ if (! empty($inv_med_list)) {
+ echo '';
+ echo 'Medicine ';
+ echo ' ';
+ echo ' ';
+
+ $medTotal = 0.0;
+ foreach ($inv_med_list as $row) {
+ echo '';
+ echo '' . $srNo . ' ';
+ echo '' . esc($row->inv_med_code ?? '') . ' ';
+ echo ' ';
+ echo ' ';
+ echo '' . esc(number_format((float) ($row->net_amount ?? 0), 2)) . ' ';
+ $srNo++;
+ $medTotal += (float) ($row->net_amount ?? 0);
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo 'Med. Total ';
+ echo '' . esc(number_format($medTotal, 2)) . ' ';
+ echo ' ';
+ }
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ = esc(number_format($grossAmount, 2)) ?>
+
+ Discount ?? 0) > 0) : ?>
+
+ #
+ Remark : = esc($ipd->Discount_Remark ?? '') ?>
+
+ Deduction
+ = esc(number_format((float) ($ipd->Discount ?? 0), 2)) ?>
+
+
+ Discount2 ?? 0) > 0) : ?>
+
+ #
+ Remark : = esc($ipd->Discount_Remark2 ?? '') ?>
+
+ Deduction
+ = esc(number_format((float) ($ipd->Discount2 ?? 0), 2)) ?>
+
+
+ Discount3 ?? 0) > 0) : ?>
+
+ #
+ Remark : = esc($ipd->Discount_Remark3 ?? '') ?>
+
+ Deduction
+ = esc(number_format((float) ($ipd->Discount3 ?? 0), 2)) ?>
+
+
+ chargeamount1 ?? 0) > 0) : ?>
+
+ #
+ Remark : = esc($ipd->charge1 ?? '') ?>
+
+ Charge
+ = esc(number_format((float) ($ipd->chargeamount1 ?? 0), 2)) ?>
+
+
+ chargeamount2 ?? 0) > 0) : ?>
+
+ #
+ Remark : = esc($ipd->charge2 ?? '') ?>
+
+ Charge
+ = esc(number_format((float) ($ipd->chargeamount2 ?? 0), 2)) ?>
+
+
+
+ #
+
+
+
+ Net Amount
+ = esc(number_format($netAmount, 2)) ?>
+
+
+ #
+
+ Payment Recd.
+ id ?? '') . ':' . esc($row->pay_mode ?? '') . ':' . esc($row->pay_date_str ?? '') . ':' . esc($row->amount ?? '') . '] / ';
+ if ($i % 3 === 0) {
+ echo ' ';
+ }
+ }
+ ?>
+
+
+
+ = esc(number_format($paidTotal > 0 ? $paidTotal : (float) ($ipd->total_paid_amount ?? 0), 2)) ?>
+
+
+ #
+
+
+
+ Balance
+ = esc(number_format($balanceAmount, 2)) ?>
+
+ payable_by_tpa ?? 0) > 0) : ?>
+
+ #
+ Payable By TPA
+
+
+ = esc(number_format((float) ($ipd->payable_by_tpa ?? 0), 2)) ?>
+
+
+ discount_for_tpa ?? 0) > 0) : ?>
+
+ #
+ Discount For TPA
+
+
+ = esc(number_format((float) ($ipd->discount_for_tpa ?? 0), 2)) ?>
+
+
+ discount_by_hospital ?? 0) > 0) : ?>
+
+ #
+ Discount By Hospital
+ = esc($ipd->discount_by_hospital_remark ?? '') ?>
+
+ = esc(number_format((float) ($ipd->discount_by_hospital ?? 0), 2)) ?>
+
+
+ discount_by_hospital_2 ?? 0) > 0) : ?>
+
+ #
+ Discount By Hospital/ Doctor
+ = esc($ipd->discount_by_hospital_2_remark ?? '') ?>
+
+ = esc(number_format((float) ($ipd->discount_by_hospital_2 ?? 0), 2)) ?>
+
+
+
+ #
+
+
+
+ Final Balance
+ = esc(number_format((float) ($ipd->balance_discount_after ?? 0), 2)) ?>
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_diagnosis.php b/app/Views/billing/ipd/panel_diagnosis.php
new file mode 100644
index 0000000..3b9ffdb
--- /dev/null
+++ b/app/Views/billing/ipd/panel_diagnosis.php
@@ -0,0 +1,33 @@
+
+
+
+
+ #
+ Invoice Code
+ Date
+ Charge Type
+ Amount
+ Include
+
+
+
+
+
+
+
+ = $srNo++ ?>
+ = esc($row->invoice_code ?? $row->inv_id ?? '') ?>
+ = esc($row->str_date ?? '') ?>
+ = esc($row->charge_list ?? '') ?>
+ = esc($row->amount ?? '') ?>
+ = ((int) ($row->ipd_include ?? 0) > 0) ? 'Yes' : 'No' ?>
+
+
+
+
+ No diagnosis charges found.
+
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_discharge.php b/app/Views/billing/ipd/panel_discharge.php
new file mode 100644
index 0000000..9058934
--- /dev/null
+++ b/app/Views/billing/ipd/panel_discharge.php
@@ -0,0 +1,26 @@
+
+
+
+
+
+
Discharge Status
+
Status : = esc($discharge->status_desc ?? 'Pending') ?>
+
Discharge Date : = esc($discharge->discharge_date ?? '') ?>
+
Discharge Time : = esc($discharge->discharge_time ?? '') ?>
+
Discharge By : = esc($discharge->discharge_by ?? '') ?>
+
+
+
+
+
+
+
Remarks
+
Remark : = esc($discharge->discharge_remark ?? '') ?>
+
Balance User : = esc($discharge->discharge_balance_user ?? '') ?>
+
Balance Remark : = esc($discharge->discharge_balance_remark ?? '') ?>
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_ipd_charges.php b/app/Views/billing/ipd/panel_ipd_charges.php
new file mode 100644
index 0000000..5019363
--- /dev/null
+++ b/app/Views/billing/ipd/panel_ipd_charges.php
@@ -0,0 +1,312 @@
+id ?? 0);
+$packages = $ipd_packages ?? [];
+$hasPackage = ! empty($packages);
+$defaultPackageId = $hasPackage ? (int) ($packages[0]->id ?? 0) : 0;
+$csrfName = csrf_token();
+$csrfHash = csrf_hash();
+$today = date('Y-m-d');
+?>
+
+
+
+
+
+
+
+
+
+
+ itype_id ?? 0);
+ $items = $item_lists[$typeId] ?? [];
+ $collapseId = 'chargeType' . $typeId;
+ $headingId = 'heading' . $typeId;
+ $typeIndex = ($typeIndex + 1) % count($colorMap);
+ ?>
+
+
+
+
+
+ Charge Name
+
+ Select
+
+ display_amount ?? $item->amount ?? 0); ?>
+
+ = esc($item->idesc ?? '') ?> [= esc(number_format($displayRate, 2)) ?>]
+
+
+
+
+
+
+
+ Doctor
+
+ NONE
+
+ = esc($doc->DocSpecName ?? '') ?>
+
+
+
+
+ Comment
+
+
+
+
+ Add in List
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_medical_bills.php b/app/Views/billing/ipd/panel_medical_bills.php
new file mode 100644
index 0000000..73e92ae
--- /dev/null
+++ b/app/Views/billing/ipd/panel_medical_bills.php
@@ -0,0 +1,31 @@
+
+
+
+
+ #
+ Invoice Code
+ Date
+ Amount
+ Status
+
+
+
+
+
+
+
+ = $srNo++ ?>
+ = esc($row->inv_med_code ?? $row->id ?? '') ?>
+ = esc($row->inv_date ?? '') ?>
+ = esc($row->net_amount ?? '') ?>
+ = ((int) ($row->payment_status ?? 0) > 0) ? 'Paid' : 'Pending' ?>
+
+
+
+
+ No medical bills found.
+
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_package.php b/app/Views/billing/ipd/panel_package.php
new file mode 100644
index 0000000..e975076
--- /dev/null
+++ b/app/Views/billing/ipd/panel_package.php
@@ -0,0 +1,196 @@
+id ?? 0);
+$csrfName = csrf_token();
+$csrfHash = csrf_hash();
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Package Name
+
+
+
+ Comment
+
+
+
+ Rate
+
+
+
+ Add in List
+
+
+
+
+
+
+
+
+
+
+
+ Package Name
+
+ Select
+
+ amount1 ?? $row->Pakage_Min_Amount ?? 0); ?>
+
+ = esc(($row->ipd_pakage_name ?? '') . ' : ' . ($row->org_code ?? '')) ?>
+
+
+
+
+
+ Amount
+
+
+
+ Comment
+
+
+
+ Add in List
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_payments.php b/app/Views/billing/ipd/panel_payments.php
new file mode 100644
index 0000000..b61088d
--- /dev/null
+++ b/app/Views/billing/ipd/panel_payments.php
@@ -0,0 +1,40 @@
+
+
+
+
+
IPD Payments
+
+
+
+
+ #
+ ID
+ Date
+ Amount
+ Mode
+
+
+
+
+
+
+
+ = $srNo++ ?>
+ = esc($row->id ?? '') ?>
+ = esc($row->pay_date_str ?? '') ?>
+ = esc($row->amount ?? '') ?>
+ = esc($row->pay_mode ?? '') ?>
+
+
+
+
+ No payments found.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/ipd/panel_placeholder.php b/app/Views/billing/ipd/panel_placeholder.php
new file mode 100644
index 0000000..25c7350
--- /dev/null
+++ b/app/Views/billing/ipd/panel_placeholder.php
@@ -0,0 +1,3 @@
+
+ = esc($title ?? 'Section') ?>: This section is under migration.
+
diff --git a/app/Views/billing/main.php b/app/Views/billing/main.php
new file mode 100644
index 0000000..eeb682a
--- /dev/null
+++ b/app/Views/billing/main.php
@@ -0,0 +1,19 @@
+
+
Welcome
+
+
+ Home
+ Blank
+
+
+
+
+
+
+
+
Welcome
+
User ID: = esc((string) ($user->id ?? '')) ?>
+
Username: = esc($user->username ?? $user->email ?? 'User') ?>
+
+
+
\ No newline at end of file
diff --git a/app/Views/billing/opd_advice_workspace.php b/app/Views/billing/opd_advice_workspace.php
new file mode 100644
index 0000000..6a139ea
--- /dev/null
+++ b/app/Views/billing/opd_advice_workspace.php
@@ -0,0 +1,276 @@
+
+
+
+
+
+
+
+
+
+
+ ID
+ Advice (English)
+ Advice (Local)
+ Edit
+ Remove
+
+
+ No advice found
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Advice (English)
+
+
+
+
+
Advice (Local Language)
+
+
+ Hindi
+ Bengali
+ Marathi
+ Tamil
+ Telugu
+ Gujarati
+ Kannada
+ Malayalam
+ Punjabi
+ Odia
+ Assamese
+ Urdu
+
+ Translate
+
+
+
+
+
+
+ Save
+ Reset
+
+
+
Ready.
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_app_insurance_V.php b/app/Views/billing/opd_app_insurance_V.php
new file mode 100644
index 0000000..efca647
--- /dev/null
+++ b/app/Views/billing/opd_app_insurance_V.php
@@ -0,0 +1,150 @@
+
+
+
+
+
+
OPD Registration
+
+
+
+
No insurance found for this patient.
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+
+
+
Select Doctor
+
+
+
+
+ = esc($row->p_fname) ?> [= esc($row->SpecName) ?> ]
+
+
+
+
>Next to Fee
+
+
+
+
+
+
+
+ Back to Select Doctor
+ Confirm And Go for Payment
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_appointment_V.php b/app/Views/billing/opd_appointment_V.php
new file mode 100644
index 0000000..b3a6fcc
--- /dev/null
+++ b/app/Views/billing/opd_appointment_V.php
@@ -0,0 +1,147 @@
+
+
+
+
+
+
OPD Registration
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+
+
+
Select Doctor
+
+
+
+
+ = esc($row->p_fname) ?> [= esc($row->SpecName) ?> ]
+
+
+
+
Next to Fee
+
+
+
+
+
+
+
+ Back to Select Doctor
+ Confirm And Go for Payment
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_appointment_dashboard.php b/app/Views/billing/opd_appointment_dashboard.php
new file mode 100644
index 0000000..eba8722
--- /dev/null
+++ b/app/Views/billing/opd_appointment_dashboard.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+ color_code ?? 0) % 6)] ?? 'bg-primary';
+ $total = (int) ($row->No_opd ?? 0);
+ $textClass = in_array($colorClass, ['bg-warning', 'bg-info', 'bg-light'], true) ? 'text-dark' : 'text-white';
+ ?>
+
+
+
+
+
+ Booked = esc((int) ($row->count_booking ?? 0)) ?>
+ Waiting = esc((int) ($row->count_wait ?? 0)) ?>
+ Visited = esc((int) ($row->count_visit ?? 0)) ?>
+ Total = esc($total) ?>
+
+
+
+
+
+
+
+
No OPD appointment records found for selected date.
+
+
+
+
+
diff --git a/app/Views/billing/opd_appointment_list.php b/app/Views/billing/opd_appointment_list.php
new file mode 100644
index 0000000..7840742
--- /dev/null
+++ b/app/Views/billing/opd_appointment_list.php
@@ -0,0 +1,311 @@
+
+
+
+
+
+
Booked : = esc((int) ($doc->count_booking ?? 0)) ?>
+
Waiting : = esc((int) ($doc->count_wait ?? 0)) ?>
+
Visited : = esc((int) ($doc->count_visit ?? 0)) ?>
+
Cancelled : = esc((int) ($doc->count_cancel ?? 0)) ?>
+
Total : = esc((int) ($doc->No_opd ?? 0)) ?>
+
+
+
+ Booked
+ Waiting 0
+ Visited
+ Cancelled
+
+
+
+
+ = view('billing/opd_appointment_list_table', ['rows' => $opd_list_0, 'showQueue' => false, 'tabType' => 'booking', 'opd_date' => $opd_date, 'doc_id' => $doc_id]) ?>
+
+
+
+
+
+ Only Missing Vitals
+
+
+ = view('billing/opd_appointment_list_table', ['rows' => $opd_list_1, 'showQueue' => true, 'tabType' => 'waiting', 'opd_date' => $opd_date, 'doc_id' => $doc_id]) ?>
+
All waiting patients already have vitals.
+
+
+ = view('billing/opd_appointment_list_table', ['rows' => $opd_list_2, 'showQueue' => true, 'tabType' => 'visited', 'opd_date' => $opd_date, 'doc_id' => $doc_id]) ?>
+
+
+ = view('billing/opd_appointment_list_table', ['rows' => $opd_list_3, 'showQueue' => true, 'tabType' => 'cancelled', 'opd_date' => $opd_date, 'doc_id' => $doc_id]) ?>
+
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
Patient: -
+
+
+
Fill vitals and click Save.
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_appointment_list_table.php b/app/Views/billing/opd_appointment_list_table.php
new file mode 100644
index 0000000..b3fbac1
--- /dev/null
+++ b/app/Views/billing/opd_appointment_list_table.php
@@ -0,0 +1,85 @@
+user() : null;
+if ($authUser) {
+ if (method_exists($authUser, 'can') && $authUser->can('opd.doctor-panel.access')) {
+ $canOpenPrescription = true;
+ }
+}
+?>
+
+
+
+
+ OPD No.
+ Current Patient
+ Q No.
+ UHID
+ OPD Type
+ Action
+
+
+
+
+
+
+ = esc($row->opd_code ?? '') ?>
+ = esc(($row->P_name ?? '') . ' { ' . ($row->p_rname ?? '') . ' }') ?>
+ = esc((int) ($row->queue_no ?? 0)) ?>
+ = esc($row->p_code ?? '') ?>
+ = esc($row->opd_type ?? '') ?> / Amt: = esc($row->opd_fee_amount ?? '') ?>
+
+ has_vitals) && (int) $row->has_vitals === 1; ?>
+
+
+ Consult
+
+
+
+ = $hasVitals ? 'Vitals ✓' : 'Vitals' ?>
+
+
+ Scan
+
+
+ Upload
+
+
+ Profile
+
+
+
+ Visit Done
+
+
+
+ Visit Done
+
+
+
+
+
+
+ No records.
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_invoice_V.php b/app/Views/billing/opd_invoice_V.php
new file mode 100644
index 0000000..42e0703
--- /dev/null
+++ b/app/Views/billing/opd_invoice_V.php
@@ -0,0 +1,455 @@
+user();
+if ($user && method_exists($user, 'inGroup')) {
+ $canEdit = $user->inGroup('OPDEdit');
+}
+?>
+
+
+
+
+ = csrf_field() ?>
+
+
+ To
+
+ = esc(strtoupper($opd_master[0]->P_name ?? '')) ?>
+ = esc($patient_master[0]->p_relative ?? '') ?> : = esc($patient_master[0]->p_rname ?? '') ?>
+ OPD Book Date (y-m-d time) : = esc($opd_master[0]->opd_book_date ?? '') ?>
+ Gender : = esc($patient_master[0]->xgender ?? '') ?>
+ Age : = esc($patient_master[0]->age ?? '') ?>
+ Phone No : = esc($patient_master[0]->mphone1 ?? '') ?>
+
+
+
+ OPD ID: = esc($opd_master[0]->opd_code ?? '') ?>
+ Date of Appointment: = esc($opd_master[0]->str_apointment_date ?? '') ?>
+ Patient ID : = esc($patient_master[0]->p_code ?? '') ?>
+ insurance_id ?? 0) > 1 && !empty($insurance)) : ?>
+ Ins. Comp. : = esc($insurance[0]->ins_company_name ?? '') ?>
+
+
+ payment_id)) : ?>
+ Payment No. : = esc($opd_master[0]->payment_id ?? '') ?>
+
+
+
+
+
+
+ payment_status ?? 0) == 0 && ($refund_status ?? 0) == 0) : ?>
+
+
+
+
+
+
+ Payment Refund Status : Pending
+ opd_status ?? 0) == 3) : ?>
+
Status is Cancelled
+
+ Payment Method by : = esc($opd_master[0]->payment_mode_desc ?? '') ?>
+
+
+
+
+
+ opd_status ?? 0) === 1 || (int) ($opd_master[0]->opd_status ?? 0) === 2)) : ?>
+
+
+ opd_status ?? 0) === 1) : ?>
+
+
+
+
+ Cancel OPD
+
+
+
+ 0) : ?>
+
+ Credit To Org. [= esc($case_master[0]->case_id_code ?? '') ?>]
+
+
+
+
+
+ Change Doctor
+
+
+ id ?? '', $opd_master[0]->doc_id ?? '') ?>>= esc($row->p_fname ?? '') ?>
+
+
+
+
+ Date = esc(MysqlDate_to_str($opd_master[0]->apointment_date ?? '')) ?>
+
+
+
+ OPD Fee = esc($opd_master[0]->opd_fee_gross_amount ?? '') ?> / = esc($opd_master[0]->opd_fee_amount ?? '') ?>
+
+
+
+ Update Doctor and Date
+
+
+
+
+ payment_mode ?? 0) === 4)) : ?>
+ Reverse to Cash
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_invoice_pdf_v.php b/app/Views/billing/opd_invoice_pdf_v.php
new file mode 100644
index 0000000..10412b1
--- /dev/null
+++ b/app/Views/billing/opd_invoice_pdf_v.php
@@ -0,0 +1,266 @@
+ 42) {
+ $hospitalNameFontSize = 14;
+} elseif ($hospitalNameLen > 36) {
+ $hospitalNameFontSize = 16;
+} elseif ($hospitalNameLen > 30) {
+ $hospitalNameFontSize = 18;
+}
+
+$invoiceId = (string) ($opd->opd_code ?? '');
+$appointmentDate = (string) ($opd->str_apointment_date ?? '');
+$doctorName = trim((string) ($opd->doc_name ?? ''));
+$department = trim((string) ($opd->doc_spec ?? ''));
+$description = trim((string) ($opd->opd_fee_desc ?? ''));
+$grossAmount = (float) ($opd->opd_fee_gross_amount ?? $opd->opd_fee_amount ?? 0);
+$discount = (float) ($opd->opd_discount ?? 0);
+$netAmount = (float) ($opd->opd_fee_amount ?? 0);
+$paymentMode = trim((string) ($opd->payment_mode_desc ?? $opd->Payment_type_str ?? ''));
+$printedOn = date('d-m-Y h:i:s A');
+$invoiceStatus = ((int) ($opd->opd_status ?? 0) === 3) ? 'Cancelled' : (($paymentMode !== '' && strtolower($paymentMode) !== 'pending') ? 'Paid' : 'Pending');
+$currencyPrefix = 'Rs.';
+
+$logoPathCandidates = [];
+if ($hospitalLogoName !== '') {
+ $logoPathCandidates[] = FCPATH . 'assets/images/' . $hospitalLogoName;
+ $logoPathCandidates[] = FCPATH . 'assets/img/' . $hospitalLogoName;
+}
+$logoPathCandidates[] = FCPATH . 'assets/img/logo.png';
+
+$logoSrc = '';
+foreach ($logoPathCandidates as $candidate) {
+ if (is_file($candidate)) {
+ $logoSrc = str_replace('\\', '/', $candidate);
+ break;
+ }
+}
+
+$qrParts = [
+ 'Hospital:' . $hospitalName,
+ 'HospitalPhone:' . $hospitalPhone,
+ 'Invoice:' . ($invoiceId !== '' ? $invoiceId : ('OPD-' . (string) ($opd->opd_id ?? ''))),
+ 'Patient:' . (string) ($patient->p_code ?? ''),
+ 'Name:' . trim((string) (($patient->title ?? '') . ' ' . ($patient->p_fname ?? ''))),
+ 'Date:' . $appointmentDate,
+ 'Net:' . number_format($netAmount, 2, '.', ''),
+ 'PaymentID:' . (string) ($opd->payment_id ?? ''),
+ 'Status:' . $invoiceStatus,
+];
+$qrContent = implode(' | ', array_filter($qrParts, static fn ($v) => trim((string) $v) !== ''));
+$qrPackageAvailable = class_exists('\\Mpdf\\QrCode\\QrCode');
+?>
+
+
+
+
+ OPD Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+ = esc($hospitalName) ?>
+
+ = esc(trim($hospitalAddress1 . ', ' . $hospitalAddress2, ', ')) ?>
+
+
+
+ = $hospitalPhone !== '' ? ('Phone: ' . esc($hospitalPhone)) : '' ?>
+ = ($hospitalPhone !== '' && $hospitalEmail !== '') ? ' | ' : '' ?>
+ = $hospitalEmail !== '' ? ('Email: ' . esc($hospitalEmail)) : '' ?>
+
+
+
+
+
+
+
+
Scan for invoice info
+
+
+
+
QR unavailable (mpdf/qrcode not installed)
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Date
+ Doctor
+ Department
+ Description
+ Amount
+
+
+
+
+ = esc($appointmentDate) ?>
+ = esc($doctorName !== '' ? ('Dr. ' . $doctorName) : '') ?>
+ = esc($department) ?>
+ = esc($description) ?>
+ = esc($currencyPrefix) ?> = number_format($grossAmount, 2) ?>
+
+ 0) : ?>
+
+ Discount = !empty($opd->opd_disc_remark ?? '') ? (' - ' . esc((string) ($opd->opd_disc_remark ?? ''))) : '' ?>
+ -= esc($currencyPrefix) ?> = number_format($discount, 2) ?>
+
+
+
+
+
+
+
+ Amount is collected against OPD consultation and related visit charges.
+
+
+
+ Gross Amount
+ = esc($currencyPrefix) ?> = number_format($grossAmount, 2) ?>
+
+
+ Discount
+ -= esc($currencyPrefix) ?> = number_format($discount, 2) ?>
+
+
+ Net Amount
+ = esc($currencyPrefix) ?> = number_format($netAmount, 2) ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_invoice_print_v.php b/app/Views/billing/opd_invoice_print_v.php
new file mode 100644
index 0000000..6decc79
--- /dev/null
+++ b/app/Views/billing/opd_invoice_print_v.php
@@ -0,0 +1,96 @@
+
+
+
+
+ = defined('H_Name') ? H_Name : 'Hospital' ?> | OPD Invoice
+
+
+
+
+
+
+ = defined('H_Name') ? H_Name : 'Hospital' ?>
+ Printed on: = date('d-m-Y h:i:s A') ?>
+
+
+
+
+
+ OPD Invoice ID: = esc($opd_master[0]->opd_code ?? '') ?>
+ Patient ID: = esc($patient_master[0]->p_code ?? '') ?>
+ insurance_id ?? 0) > 1 && !empty($insurance)) : ?>
+ Ins. Comp.: = esc($insurance[0]->ins_company_name ?? '') ?>
+
+ insurance_case_id ?? 0) > 0 && !empty($case_master)) : ?>
+ Org. Case No.: = esc($case_master[0]->case_id_code ?? '') ?>
+
+ payment_id)) : ?>
+ Payment No.: = esc($opd_master[0]->payment_id ?? '') ?>
+
+
+
+ = defined('H_Name') ? H_Name : 'Hospital' ?>
+ = defined('H_address_1') ? H_address_1 : '' ?>
+ = defined('H_address_2') ? H_address_2 : '' ?>
+ = defined('H_phone_No') ? 'Phone: ' . H_phone_No : '' ?>
+ = defined('H_Email') ? 'Email: ' . H_Email : '' ?>
+
+
+ = esc(($patient_master[0]->title ?? '') . ' ' . strtoupper($patient_master[0]->p_fname ?? '')) ?>
+ Date: = esc($opd_master[0]->str_apointment_date ?? '') ?>
+ Gender: = esc($patient_master[0]->xgender ?? '') ?>
+ Age: = esc($patient_master[0]->age ?? '') ?>
+ Phone: = esc($patient_master[0]->mphone1 ?? '') ?>
+ Visit Count: = esc($opd_master[0]->no_visit ?? '') ?>
+
+
+
+
+
+
+
+ Date
+ Doctor
+ Department
+ Description
+ OPD Fee
+
+
+
+
+ = esc($opd_master[0]->apointment_date ?? '') ?>
+ Dr. = esc($opd_master[0]->doc_name ?? '') ?>
+ = esc($opd_master[0]->doc_spec ?? '') ?>
+ = esc($opd_master[0]->opd_fee_desc ?? '') ?>
+ = esc($opd_master[0]->opd_fee_gross_amount ?? '') ?>
+
+ opd_discount) && (float) ($opd_master[0]->opd_discount ?? 0) > 0) : ?>
+
+ Deduction
+ = esc($opd_master[0]->opd_disc_remark ?? '') ?>
+ -= esc($opd_master[0]->opd_discount ?? '') ?>
+
+
+
+
+
+
+ Net Amount
+ = esc($opd_master[0]->opd_fee_amount ?? '') ?>
+
+
+
+
+ opd_status ?? 0) === 3) : ?>
+ OPD Cancelled
+ = esc($opd_master[0]->opd_status_remark ?? '') ?>
+
+ Mode of Payment: = esc($opd_master[0]->payment_mode_desc ?? '') ?>
+
+
+
+
diff --git a/app/Views/billing/opd_letter_head.php b/app/Views/billing/opd_letter_head.php
new file mode 100644
index 0000000..211c549
--- /dev/null
+++ b/app/Views/billing/opd_letter_head.php
@@ -0,0 +1,237 @@
+
+
+
+
+ = defined('H_Name') ? constant('H_Name') : 'OPD Letter Head' ?>
+
+
+
+
+
+
+
+ UHID: = esc($patient_master[0]->p_code ?? '') ?>
+ Name: = esc(($patient_master[0]->title ?? '') . ' ' . strtoupper($patient_master[0]->p_fname ?? '')) ?>
+ = esc(($patient_master[0]->p_relative ?? '') . ' ' . strtoupper($patient_master[0]->p_rname ?? '')) ?>
+ Sex: = esc($patient_master[0]->xgender ?? '') ?>
+ / Age: = esc($patient_master[0]->age ?? '') ?>
+
+
+ OPD No.: = esc($opd_master[0]->opd_code ?? '') ?> / = esc($opd_master[0]->opd_id ?? '') ?>
+ OPD Fee: = esc($opd_master[0]->opd_fee_amount ?? '') ?> [= esc($opd_master[0]->opd_fee_desc ?? '') ?>]
+ Date: = esc($opd_master[0]->str_apointment_date ?? '') ?>
+ opd_fee_type ?? '') === '3' && !empty($old_opd)) : ?>
+ Valid Upto: = esc($old_opd[0]->opd_Exp_Date ?? '') ?>
+
+ Valid Upto: = esc($opd_master[0]->opd_Exp_Date ?? '') ?>
+
+
+
+ Sr No.: = esc($opd_master[0]->opd_no ?? '') ?>
+ Phone: = esc($patient_master[0]->mphone1 ?? '') ?>
+ Address: = esc(($patient_master[0]->add1 ?? '') . ',' . ($patient_master[0]->city ?? '')) ?>
+
+
+
+ 'No Pain',
+ '1' => 'Mild Pain',
+ '2' => 'Moderate',
+ '3' => 'Intense',
+ '4' => 'Worst Pain Possible',
+ ];
+ $painValue = (string) ($rx['pain_value'] ?? '');
+ $painText = $painLabels[$painValue] ?? '';
+
+ $complications = [];
+ if (!empty($rx['pregnancy'] ?? 0)) { $complications[] = 'Pregnancy'; }
+ if (!empty($rx['lactation'] ?? 0)) { $complications[] = 'Lactation'; }
+ if (!empty($rx['liver_insufficiency'] ?? 0)) { $complications[] = 'Liver Insufficiency'; }
+ if (!empty($rx['renal_insufficiency'] ?? 0)) { $complications[] = 'Renal Insufficiency'; }
+ if (!empty($rx['pulmonary_insufficiency'] ?? 0)) { $complications[] = 'Pulmonary Insufficiency'; }
+ if (!empty($rx['corona_suspected'] ?? 0)) { $complications[] = 'Corona Suspected'; }
+ if (!empty($rx['dengue'] ?? 0)) { $complications[] = 'Dengue'; }
+
+ $addictions = [];
+ if (!empty($patient_master[0]->is_smoking ?? 0)) { $addictions[] = 'Smoking'; }
+ if (!empty($patient_master[0]->is_alcohol ?? 0)) { $addictions[] = 'Alcohol'; }
+ if (!empty($patient_master[0]->is_drug_abuse ?? 0)) { $addictions[] = 'Drug Abuse'; }
+
+ $isFemale = strtoupper((string) ($patient_master[0]->xgender ?? '')) === 'F';
+ $womenRelatedProblems = trim((string) ($rx['women_related_problems'] ?? ''));
+ $womenLmp = trim((string) ($rx['women_lmp'] ?? ''));
+ $womenLastBaby = trim((string) ($rx['women_last_baby'] ?? ''));
+ $womenPregnancyRelated = trim((string) ($rx['women_pregnancy_related'] ?? ''));
+
+ $vitals = array_filter([
+ trim((string) ($rx['bp'] ?? '')) !== '' ? ('BP: ' . trim((string) ($rx['bp'] ?? '')) . '/' . trim((string) ($rx['diastolic'] ?? ''))) : '',
+ trim((string) ($rx['pulse'] ?? '')) !== '' ? ('Pulse: ' . trim((string) ($rx['pulse'] ?? '')) . '/min') : '',
+ trim((string) ($rx['temp'] ?? '')) !== '' ? ('Temp: ' . trim((string) ($rx['temp'] ?? ''))) : '',
+ trim((string) ($rx['spo2'] ?? '')) !== '' ? ('SpO2: ' . trim((string) ($rx['spo2'] ?? '')) . '%') : '',
+ trim((string) ($rx['rr_min'] ?? '')) !== '' ? ('RR: ' . trim((string) ($rx['rr_min'] ?? '')) . '/min') : '',
+ trim((string) ($rx['height'] ?? '')) !== '' ? ('Height: ' . trim((string) ($rx['height'] ?? ''))) : '',
+ trim((string) ($rx['weight'] ?? '')) !== '' ? ('Weight: ' . trim((string) ($rx['weight'] ?? ''))) : '',
+ trim((string) ($rx['waist'] ?? '')) !== '' ? ('Waist: ' . trim((string) ($rx['waist'] ?? ''))) : '',
+ ]);
+ ?>
+
+
+
+
+
Prescription Summary
+
+
+
Complaints: = nl2br(esc((string) ($rx['complaints'] ?? ''))) ?>
+
+
+
+
Diagnosis: = nl2br(esc((string) ($rx['diagnosis'] ?? ''))) ?>
+
+
+
+
Provisional Diagnosis: = nl2br(esc((string) ($rx['Provisional_diagnosis'] ?? ''))) ?>
+
+
+
+
Finding/Examination: = nl2br(esc((string) ($rx['Finding_Examinations'] ?? ''))) ?>
+
+
+
+
Vitals: = esc(implode(' | ', $vitals)) ?>
+
+
+
+
Pain Measurement Scale: = esc($painText) ?>= $painValue !== '' ? ' (' . esc($painValue) . ')' : '' ?>
+
+
+
+
Complication: = esc(implode(', ', $complications)) ?>
+
+
+
+
Addiction: = esc(implode(', ', $addictions)) ?>
+
+
+
+
Co-Morbidities: = esc(implode(', ', $selected_morbidities)) ?>
+
+
+
+
Women Related Problems: = nl2br(esc($womenRelatedProblems)) ?>
+
+
+
+
LMP (No. of days before): = esc($womenLmp) ?>
+
+
+
+
Last Baby: = esc($womenLastBaby) ?>
+
+
+
+
Pregnancy Related: = nl2br(esc($womenPregnancyRelated)) ?>
+
+
+
+
Investigation: = nl2br(esc((string) ($rx['investigation'] ?? ''))) ?>
+
+
+
+
Prescription Remarks: = nl2br(esc((string) ($rx['Prescriber_Remarks'] ?? ''))) ?>
+
+
+
+
Advice: = nl2br(esc((string) ($rx['advice'] ?? ''))) ?>
+
+
+
+
Next Visit: = esc((string) ($rx['next_visit'] ?? '')) ?>
+
+
+
+
Refer To: = esc((string) ($rx['refer_to'] ?? '')) ?>
+
+
+
+
+ Medicines
+
+
+
+ Medicine
+ Type
+ Dose
+ When
+ Frequency
+ Days
+ Qty
+ Remark
+
+
+
+
+
+ = esc((string) ($med['med_name'] ?? '')) ?>
+ = esc((string) ($med['med_type'] ?? '')) ?>
+ = esc((string) ($med['dosage'] ?? '')) ?>
+ = esc((string) ($med['dosage_when'] ?? '')) ?>
+ = esc((string) ($med['dosage_freq'] ?? '')) ?>
+ = esc((string) ($med['no_of_days'] ?? '')) ?>
+ = esc((string) ($med['qty'] ?? '')) ?>
+ = esc((string) ($med['remark'] ?? '')) ?>
+
+
+
+
+
+
+
+ Investigations
+
+
+
+ Code
+ Investigation Name
+
+
+
+
+
+ = esc((string) ($inv['investigation_code'] ?? '')) ?>
+ = esc((string) ($inv['investigation_name'] ?? '')) ?>
+
+
+
+
+
+
+
+ Advice List
+
+
+
+ Advice
+
+
+
+
+
+ = esc((string) ($adv['advice_txt'] ?? ($adv['advice'] ?? ''))) ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_letter_head_pdf.php b/app/Views/billing/opd_letter_head_pdf.php
new file mode 100644
index 0000000..9063c84
--- /dev/null
+++ b/app/Views/billing/opd_letter_head_pdf.php
@@ -0,0 +1,417 @@
+p_fname ?? ''));
+$doctorDegree = trim((string) ($doctor->qualification ?? ($doctor->degree ?? '')));
+$doctorSpec = trim((string) ($doctor->SpecName ?? ''));
+
+$doctorRegNo = '';
+if ($doctor !== null) {
+ foreach (['nmc_reg_no', 'mci_reg_no', 'registration_no', 'reg_no', 'doctor_reg_no', 'doc_reg_no', 'council_reg_no'] as $field) {
+ if (isset($doctor->{$field}) && trim((string) $doctor->{$field}) !== '') {
+ $doctorRegNo = trim((string) $doctor->{$field});
+ break;
+ }
+ }
+
+ if ($doctorRegNo === '') {
+ $shortDescription = trim((string) ($doctor->doc_sign ?? ''));
+ if ($shortDescription !== '') {
+ $normalizedShortDescription = preg_replace('/\s+/', ' ', $shortDescription);
+ if ($normalizedShortDescription !== null) {
+ if (preg_match('/(?:reg(?:istration)?\s*(?:no|number)?\s*[:\-]?\s*)([A-Z0-9\/-]{4,})/i', $normalizedShortDescription, $matches) === 1 && ! empty($matches[1])) {
+ $doctorRegNo = trim((string) $matches[1]);
+ }
+ }
+ }
+ }
+}
+
+$vitals = [];
+if (trim((string) ($rx['bp'] ?? '')) !== '') {
+ $vitals[] = 'BP: ' . trim((string) ($rx['bp'] ?? '')) . (trim((string) ($rx['diastolic'] ?? '')) !== '' ? '/' . trim((string) ($rx['diastolic'] ?? '')) : '');
+}
+if (trim((string) ($rx['pulse'] ?? '')) !== '') {
+ $vitals[] = 'Pulse: ' . trim((string) ($rx['pulse'] ?? '')) . '/min';
+}
+if (trim((string) ($rx['temp'] ?? '')) !== '') {
+ $vitals[] = 'Temp: ' . trim((string) ($rx['temp'] ?? ''));
+}
+if (trim((string) ($rx['spo2'] ?? '')) !== '') {
+ $vitals[] = 'SpO2: ' . trim((string) ($rx['spo2'] ?? '')) . '%';
+}
+
+$visitDate = (string) ($opd->str_apointment_date ?? '');
+$visitDateTime = '';
+if (!empty($opd->apointment_date ?? '')) {
+ $ts = strtotime((string) $opd->apointment_date);
+ if ($ts !== false) {
+ $visitDateTime = date('d-m-Y h:i A', $ts);
+ }
+}
+$validUpto = (string) ($opd->opd_Exp_Date ?? '');
+$nextVisit = trim((string) ($rx['next_visit'] ?? ''));
+$investigationText = trim((string) ($rx['investigation'] ?? ''));
+$printedOn = date('d-m-Y h:i A');
+$layoutMode = strtolower((string) ($print_layout_mode ?? 'full'));
+$showPart1 = in_array($layoutMode, ['full', 'header_meta'], true);
+$showPart2 = in_array($layoutMode, ['full', 'meta_content', 'header_meta', 'meta_only'], true);
+$showPart3 = in_array($layoutMode, ['full', 'meta_content', 'content_only'], true);
+$topSpacerMm = in_array($layoutMode, ['content_only', 'meta_content', 'meta_only'], true) ? 22 : 0;
+$drugAllergyStatus = trim((string) ($rx['drug_allergy_status'] ?? ''));
+$drugAllergyDetails = trim((string) ($rx['drug_allergy_details'] ?? ''));
+$adrHistory = trim((string) ($rx['adr_history'] ?? ''));
+$currentMedications = trim((string) ($rx['current_medications'] ?? ''));
+$painScaleMap = [
+ '0' => 'No Pain',
+ '1' => 'Mild Pain',
+ '2' => 'Moderate',
+ '3' => 'Intense',
+ '4' => 'Worst Pain Possible',
+];
+$painValue = trim((string) ($rx['pain_value'] ?? ''));
+$painLabel = $painScaleMap[$painValue] ?? '';
+
+$toLocalText = static function (string $input): string {
+ $text = trim($input);
+ if ($text === '') {
+ return '';
+ }
+
+ $map = [
+ 'before food' => 'भोजन से पहले',
+ 'after food' => 'भोजन के बाद',
+ 'after breakfast' => 'नाश्ते के बाद',
+ 'before breakfast' => 'नाश्ते से पहले',
+ 'after lunch' => 'दोपहर के भोजन के बाद',
+ 'before lunch' => 'दोपहर के भोजन से पहले',
+ 'after dinner' => 'रात के भोजन के बाद',
+ 'before dinner' => 'रात के भोजन से पहले',
+ 'morning' => 'सुबह',
+ 'afternoon' => 'दोपहर',
+ 'evening' => 'शाम',
+ 'night' => 'रात',
+ 'once daily' => 'दिन में एक बार',
+ 'twice daily' => 'दिन में दो बार',
+ 'thrice daily' => 'दिन में तीन बार',
+ 'daily' => 'रोज',
+ 'for' => 'के लिए',
+ 'days' => 'दिन',
+ 'day' => 'दिन',
+ 'tab' => 'टैब',
+ 'cap' => 'कैप',
+ 'syp' => 'सिरप',
+ 'inj' => 'इंजेक्शन',
+ 'apply' => 'लगाएं',
+ 'continue' => 'जारी रखें',
+ 'rest' => 'आराम करें',
+ 'hydrate' => 'पर्याप्त पानी लें',
+ 'avoid oily food' => 'तैलीय भोजन से बचें',
+ 'follow up' => 'फॉलो-अप करें',
+ 'review' => 'पुनः जांच',
+ ];
+
+ $translated = $text;
+ uksort($map, static function ($a, $b) {
+ return strlen((string) $b) <=> strlen((string) $a);
+ });
+ foreach ($map as $en => $local) {
+ $translated = preg_replace('/\\b' . preg_quote($en, '/') . '\\b/i', $local, $translated) ?? $translated;
+ }
+
+ return $translated;
+};
+?>
+
+
+
+
+ OPD Consult Note
+
+
+
+
+
+
+
+
+ = esc($hospitalName) ?>
+
+ = esc(trim($hospitalAddress1 . ', ' . $hospitalAddress2, ', ')) ?>
+
+
+ Phone: = esc($hospitalPhone) ?>
+
+
+
+
+ Dr. = esc($doctorName) ?>
+
+
+ = esc($doctorDegree) ?>
+
+
+ = esc($doctorSpec) ?>
+
+
+ Reg. No.:
+
+ = esc($doctorRegNo) ?>
+
+ ADD_DOCTOR_REG_NO
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Complaint : = nl2br(esc((string) ($rx['complaints'] ?? ''))) ?>
+
+
+
+
Vitals : = esc(implode(' | ', $vitals)) ?>
+
+
+
+
Pain Measurement Scale : = esc($painLabel) ?>= $painValue !== '' ? ' (' . esc($painValue) . ')' : '' ?>
+
+
+
+
Finding : = nl2br(esc((string) ($rx['Finding_Examinations'] ?? ''))) ?>
+
+
+
+
Drug Allergy Status : = esc($drugAllergyStatus !== '' ? $drugAllergyStatus : 'Not Documented') ?>
+
+
Drug Allergy Details : = esc($drugAllergyDetails) ?>
+
+
+
ADR History : = esc($adrHistory) ?>
+
+
+
Current Medications : = esc($currentMedications) ?>
+
+
+
+
+
Diagnosis : = nl2br(esc((string) ($rx['Provisional_diagnosis'] ?? ''))) ?>
+
+
Diagnosis : = nl2br(esc((string) ($rx['diagnosis'] ?? ''))) ?>
+
+
+
Rx :
+
+
+
+
+ #
+ Medicine Name
+ Dose / Frequency
+ Qty
+ Day
+ Instruction
+
+
+
+ $med) : ?>
+
+
+ = esc((string) ($idx + 1)) ?>
+
+ = esc((string) ($med['med_name'] ?? '')) ?>
+
+ Salt/Generic: = esc($genericText) ?>
+
+
+
+ = esc($doseText) ?>
+
+ = esc($doseLocal) ?>
+
+
+ = esc((string) ($med['qty'] ?? '')) ?>
+ = esc((string) ($med['no_of_days'] ?? '')) ?>
+
+ = esc($instruction) ?>
+
+ = esc($instructionLocal) ?>
+
+
+
+
+
+
+
+
No medicines prescribed.
+
+
+
+
+
+
Investigation Advised : = esc(implode(', ', $investigationList)) ?>
+
+
+
+
+
+
+
Advice : = esc($adviceEng) ?>
+
+
सलाह : = esc(implode(' | ', $adviceLocalLine)) ?>
+
+
+
+
+
Advice : = nl2br(esc($adviceEng)) ?>
+
+
सलाह : = nl2br(esc($adviceLocal)) ?>
+
+
+
+
+
Next Visit : = esc($nextVisit) ?>
+
+
+
+
+
BP : __________ Pulse Rate : __________ SPO2 : __________ Ht : __________ Wt. : __________ RBS : __________
+
+
+
+
+
+
Dr. = esc($doctorName) ?>
+
+
+
= esc($doctorDegree) ?>
+
+
+
= esc($doctorSpec) ?>
+
+
+ Reg. No.:
+
+ = esc($doctorRegNo) ?>
+
+ ADD_DOCTOR_REG_NO
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_medicince_workspace.php b/app/Views/billing/opd_medicince_workspace.php
new file mode 100644
index 0000000..cd47027
--- /dev/null
+++ b/app/Views/billing/opd_medicince_workspace.php
@@ -0,0 +1,618 @@
+
+
+
+
+
+
+
Duplicate scan not run yet.
+
+
+
+
+
+
+ ID
+ Fav
+ Name
+ Used
+ Last Used
+ Generic Name
+ Company Name
+ Edit
+ Remove
+
+
+ No medicine found
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ Count
+ IDs
+ Action
+
+
+ Click Check Duplicates to scan.
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Medicine Name
+
+
+
+ Formulation
+
+
+
+ Generic Name
+
+
+
+ Salt Name
+
+
+
+ Dosage Restriction
+
+
+
+ Company Name
+
+
+
+
+
+ Update
+ Use AI
+ Reset
+
+
+
Ready.
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_parts/content/default.html b/app/Views/billing/opd_parts/content/default.html
new file mode 100644
index 0000000..46ff213
--- /dev/null
+++ b/app/Views/billing/opd_parts/content/default.html
@@ -0,0 +1,13 @@
+
+ {{painscale_img}}
+ {{vital_content}}
+ {{Complaint}}
+ {{diagnosis}}
+ {{Finding_Examinations}}
+ {{medical}}
+ {{investigation}}
+ {{Prescriber_Remarks}}
+ {{advice}}
+ {{next_visit}}
+ {{refer_to}}
+
diff --git a/app/Views/billing/opd_parts/hospital/default.html b/app/Views/billing/opd_parts/hospital/default.html
new file mode 100644
index 0000000..8cfd6ca
--- /dev/null
+++ b/app/Views/billing/opd_parts/hospital/default.html
@@ -0,0 +1,23 @@
+
+
+{{hospital_section}}
+
+
+Print Time : {{print_time}}
+
+{{patient_section}}
+
+{{content_section}}
diff --git a/app/Views/billing/opd_parts/layout/default.html b/app/Views/billing/opd_parts/layout/default.html
new file mode 100644
index 0000000..8cfd6ca
--- /dev/null
+++ b/app/Views/billing/opd_parts/layout/default.html
@@ -0,0 +1,23 @@
+
+
+{{hospital_section}}
+
+
+Print Time : {{print_time}}
+
+{{patient_section}}
+
+{{content_section}}
diff --git a/app/Views/billing/opd_parts/patient/default.html b/app/Views/billing/opd_parts/patient/default.html
new file mode 100644
index 0000000..d1db10f
--- /dev/null
+++ b/app/Views/billing/opd_parts/patient/default.html
@@ -0,0 +1,10 @@
+
+
+
+Patient Name :
+
+
+{{pName}}
+
+
+
\ No newline at end of file
diff --git a/app/Views/billing/opd_parts/patient/edit.html b/app/Views/billing/opd_parts/patient/edit.html
new file mode 100644
index 0000000..196a8b7
--- /dev/null
+++ b/app/Views/billing/opd_parts/patient/edit.html
@@ -0,0 +1,18 @@
+
+
+
+ {{pName}}
+ {{pRelative}}
+ {{age_sex}}
+ {{p_address}}
+ Phone: {{phoneno}}
+
+
+ UHID: {{uhid_no}}
+ OPD: {{opd_no}}
+ SR: {{opd_sr_no}}
+ Date: {{opd_date}}
+ {{exp_date}}
+
+
+
diff --git a/app/Views/billing/opd_parts/patient/list.html b/app/Views/billing/opd_parts/patient/list.html
new file mode 100644
index 0000000..73e668c
--- /dev/null
+++ b/app/Views/billing/opd_parts/patient/list.html
@@ -0,0 +1,26 @@
+
+
+
+ Name : {{pName}}
+ {{pRelative}}
+ Gender/Age : {{age_sex}}
+ Mob : {{phoneno}}
+ Address : {{p_address}}
+
+
+ UHID : {{uhid_no}}
+ Sr No.: {{opd_sr_no}}
+ OPD No.: {{opd_no}}
+ Date: {{opd_date}}
+ {{exp_date}}
+
+
+ Department:
+ {{SpecName}}
+ {{opd_fee_desc}}
+ No. of Visit: {{total_no_visit}}
+ {{last_opdvisit_date}}
+ Book Time : {{str_opd_book_date}}
+
+
+
diff --git a/app/Views/billing/opd_prescription_basic.php b/app/Views/billing/opd_prescription_basic.php
new file mode 100644
index 0000000..2436148
--- /dev/null
+++ b/app/Views/billing/opd_prescription_basic.php
@@ -0,0 +1,3783 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+ Not Saved
+ No local changes
+
+
+
New OPD Session
+
Restore Draft
+
Clinical Assist (Local)
+
AI Draft (Full Form)
+
Save Consult
+
+ 🖨 Print
+
+
+
📄 FHIR History
+
Back to Invoice
+
+
+
+
+
+
+
+
+
+
+
+ Use Ctrl+S to save quickly.
+ Draft auto-saves locally every few seconds.
+ Unsaved changes are warned before leaving.
+
+
+
+
+
+
+
+
+
+
= esc($historyAlert['type'] ?? 'History') ?>:
+
= esc($historyAlert['message'] ?? '') ?>
+
+
+
+
No significant prior alerts found.
+
+
+
+
+
+
+
+
+
+
= esc($remarkRow['remark'] ?? '') ?>
+
= esc($remarkRow['insert_by'] ?? '') ?> = esc($remarkRow['insert_time'] ?? '') ?>
+
+
+
+
No remarks available.
+
+
+
+
+
+
+
No AI draft preview yet.
+
+
+
+
+
+
No local assist generated yet.
+
+
+
+
+
+
+
+
+ Generated At Generated By Session JSON
+
+
+ No FHIR export found
+
+
+
+
+
+
+
+
+
Loading scan history...
+
+
+
+
+
+
+
Current OPD Uploaded Scans
+
+
+
+
+
+
+
+
+
+ = esc((string) ($scan['document_type'] ?? $scan['scan_type'] ?? 'General')) ?>
+
+ AI Ready
+ AI Failed
+ Alert
+
+
+
= esc((string) ($scan['report_text'] ?? '')) ?>
+
Use Report
+
+
Report details are not available yet.
+
+
= esc((string) ($scan['insert_date'] ?? '')) ?>
+
+
+
+
+
+
+
+
No uploaded scan found for this OPD yet.
+
+
+
+
+
+
+
+
+
+
+
+
= esc($oldRow['opd_code'] ?? '') ?> = esc($oldRow['opd_date'] ?? '') ?>
+
+
+ All
+
+
+
+
C: = esc($oldComplaints) ?>
+
+
+
D: = esc($oldDiagnosis) ?>
+
+
+
+
+
+
+ #
+ Medicine Name
+ Action
+
+
+
+ $oldMed) { ?>
+
+ = (int) $indexMed + 1 ?>
+ = esc((string) ($oldMed['med_name'] ?? '')) ?>
+
+
+ +
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
No old consult record found.
+
+
+
No old consult record found.
+
+
+
+
Extracted Scan Text
+
+
+ Copy to Finding
+ Copy to Investigation
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General Examination
+
+
+
+
+
+
+
+
Drug Allergy / ADR (NABH)
+
Required: Drug Allergy Status is mandatory. If status is Known, Drug Allergy Details are mandatory.
+
+
+
Drug Allergy Status *
+ drug_allergy_status ?? ''))); ?>
+
+ Select status
+ >Known
+ >Allergies Not Known
+ >No Known Drug Allergy
+
+
+
+
+
Drug Allergy Details * (when status = Known)
+
+
+
+
+ ADR History
+
+
+
+ Current Medications
+
+
+
+
+
+
+
+
Co-Morbidities
+
+
+
+
+ >
+ = esc($morbidityRow['name'] ?? '') ?>
+
+
+
+
+
Prefilled from patient history.
+
+
+
No co-morbidities master data found.
+
+
+
+ xgender ?? '')) === 'female'; ?>
+
+
+
+
Women Related Problems
+
+
= esc($opd_prescription[0]->women_related_problems ?? '') ?>
+
0/4000
+
+
+
+
+
+
+
Smart Complaints Picker (English + Hinglish)
+
+
+ Add
+ AI Draft
+
+
+
+
+
+
Complaints
+ Hinglish -> English
+
+
= esc($opd_prescription[0]->complaints ?? '') ?>
+
0/4000
+
+
+
+
Examination
+
+
AI Assist is optional. Use it only if you want cleaner clinical wording; manual typing works as usual.
+
+ AI Assist
+ Past Data
+ Load Template
+ Save as Template
+ Clear
+
+
= esc($opd_prescription[0]->Finding_Examinations ?? '') ?>
+
0/4000
+
+
+
+
Diagnosis
+
+
+ AI Assist
+ Past Data
+ Load Template
+ Save as Template
+ Clear
+
+
= esc($opd_prescription[0]->diagnosis ?? '') ?>
+
0/4000
+
+
+
+
Provisional Diagnosis
+
+
+ AI Assist
+ Past Data
+ Load Template
+ Save as Template
+ Clear
+
+
= esc($opd_prescription[0]->Provisional_diagnosis ?? '') ?>
+
0/4000
+
+
+
+
Prescription
+
+
+ AI Assist
+ Past Data
+ Load Template
+ Save as Template
+ Clear
+
+
+
+
+
+
+
= esc($opd_prescription[0]->investigation ?? '') ?>
+
0/4000
+
+
+
+
+
+
Advice Add
+
+ AI Assist
+ Past Data
+ Load Template
+ Save as Template
+ Clear
+
+
= esc($opd_prescription[0]->advice ?? '') ?>
+
0/4000
+
+
+
+
+
Pre define Advise
+
+ Refresh
+ Show
+
+
+
+
+
Loading predefined advice...
+
+
+
+
+
+
+
+ Advice Action
+ No advice added
+
+
+
+
+
+
+ 3 Days
+ 4 Days
+ 5 Days
+ 1 Week
+ 10 Days
+ 15 Days
+ 20 Days
+ 1 Month
+ 2 Months
+
+
+
+
+
+ Advise Investigation
+
+
+
+
+
+ Cardiac Profile
+ Viral Infection
+ Create Profile
+
+ Load custom profile...
+
+ Apply
+
+
+
+
+
+
+ Search investigation...
+
+
+
+
+
+ Add
+ Remove All
+
+
+
+
+ Test Name Code Action
+ No investigation added
+
+
+
+
+
+
+
+
+ Rx Group
+ No Rx-Group selected
+
+
+ Select group and preview medicines before add.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Add
+ Cancel
+
+
+
+ Active
+ Favorites
+ All
+ Search shows most-used medicines first.
+
+
+
+ Substitute Medicines
+
+
+
No substitute found.
+
+
+
+ Before Food
+ After Food
+ With Food
+ OD
+ BD
+ TDS
+ HS
+ 3 Days
+ 5 Days
+ 7 Days
+
+
+
+
+
+ Medicine Type Dose When Freq Days Qty Remark Action
+
+
+ No medicine added
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Suggested Templates
+
+ No suggestion available.
+
+
Select Template
+
+
Apply Mode
+
+ Replace field text
+ Append to existing text
+
+
Preview
+
+
+
+
+
+
+
+
+
+
+
+
+ Template Name
+
+ Template Scope
+
+ My Template (Doctor/Consultant only)
+ Master Template (Visible to all users)
+
+ Preview
+
+
+
+
+
+
+
+
+
+
+
+
+ Profile Name
+
+ Tests (comma or new line separated)
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_rx_group_workspace.php b/app/Views/billing/opd_rx_group_workspace.php
new file mode 100644
index 0000000..8a11c6f
--- /dev/null
+++ b/app/Views/billing/opd_rx_group_workspace.php
@@ -0,0 +1,239 @@
+
+
+
+
+
+
+
+
+ Rx-Group Name Access Action
+ No data
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Rx-Group Name
+
+
+
+ Complaints
+
+
+
+ Diagnosis
+
+
+
+ Investigation
+
+
+
+ Finding Examinations
+
+
+
+
+ Save Rx-Group
+ Save AS New Rx-Group
+ Add & Edit Medicine
+
+
+
Ready.
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_scan_history_panel.php b/app/Views/billing/opd_scan_history_panel.php
new file mode 100644
index 0000000..4ecd1fe
--- /dev/null
+++ b/app/Views/billing/opd_scan_history_panel.php
@@ -0,0 +1,56 @@
+
+ No scan history found for this patient.
+
+
+
+
+
+ = esc((string) (($scan['opd_code'] ?? '') !== '' ? $scan['opd_code'] : ('OPD #' . ((int) ($scan['opd_id'] ?? 0)))) ) ?> = esc((string) ($scan['opd_date'] ?? '')) ?>
+ = esc((string) ($scan['insert_date'] ?? '')) ?>
+
+
+
+
+
+
Open PDF
+
+
+
+
+
Expand
+
+
+
+
+
+ = esc((string) (($scan['document_type'] ?? '') !== '' ? $scan['document_type'] : (($scan['scan_type'] ?? '') !== '' ? $scan['scan_type'] : 'General'))) ?>
+
+
+ AI = esc(ucfirst($status)) ?>
+
+ AI Ready
+
+ AI Failed
+
+ AI Not Run
+
+
+
+
+ ⚠ = esc((string) ($scan['ai_alert_text'] ?? '')) ?>
+
+
+
+ = esc((string) ($scan['report_text'] ?? '')) ?>
+
+
+
+ Use Report
+ Run AI
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_scan_last_list.php b/app/Views/billing/opd_scan_last_list.php
new file mode 100644
index 0000000..c30ad96
--- /dev/null
+++ b/app/Views/billing/opd_scan_last_list.php
@@ -0,0 +1,38 @@
+
+ No recent scans.
+
+
+
+
+
+
+
Open PDF
+
+
+
+
+
+
+
⚠ Alert = esc($item['ai_alert_text'] ?? 'Abnormal report detected') ?>
+
+
+ = esc($item['document_type'] ?? ($item['scan_type'] ?? 'General')) ?>
+
+
+ AI = esc(ucfirst($status)) ?>
+
+ AI Ready
+
+ AI Failed
+
+
+
+
= nl2br(esc((string) ($item['content_description'] ?? ''))) ?>
+
+
= esc($item['insert_date'] ?? '') ?>
+
Hide
+
+
+
+
+
diff --git a/app/Views/billing/opd_scan_modal_body.php b/app/Views/billing/opd_scan_modal_body.php
new file mode 100644
index 0000000..3bf37a4
--- /dev/null
+++ b/app/Views/billing/opd_scan_modal_body.php
@@ -0,0 +1,289 @@
+
+
+
Name : = esc($person_info[0]->p_fname ?? '') ?>
+ / Age : = esc($person_info[0]->age ?? '') ?>
+ / Gender : = esc($person_info[0]->xgender ?? '') ?>
+ / P Code : = esc($person_info[0]->p_code ?? '') ?>
+ / OPD : = esc($opd_master[0]->opd_code ?? '') ?>
+
+
+
+
+
+
+
+
+ Capture
+ Stop
+
+
+ Upload File (PDF/Image)
+
+ Upload File
+
+
+
+
Captured image will appear here.
+
+
+
+
+
+
+
+
AI analysis runs automatically in background after each scan/upload.
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_template_builder.php b/app/Views/billing/opd_template_builder.php
new file mode 100644
index 0000000..92715b0
--- /dev/null
+++ b/app/Views/billing/opd_template_builder.php
@@ -0,0 +1,159 @@
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+ Template Name
+
+
+
+ New
+ Edit
+ Save
+
+
+
+
+ Existing Templates
+
+ -- Select existing template --
+
+ >= esc($nm) ?>
+
+
+
+
+ Use Selected
+
+
+
+
+ HTML Content
+ = esc($template_content ?? '') ?>
+
+
+
+
+
+
+
+
+
+
+ {{= esc($ph) ?>}}
+
+
+
+
+ Old-style (recommended): save a name (example: opd_print_parcha_chamunda_hospital_ksp ), then set that name in doctor master fields:
+ opd_print_format, opd_blank_print, rx_pre_print_letter_head_format, rx_blank_letter_head, rx_plain_paper.
+ Optional composed mode: use compose_default with type-specific parts.
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_template_builder_list.php b/app/Views/billing/opd_template_builder_list.php
new file mode 100644
index 0000000..0837e91
--- /dev/null
+++ b/app/Views/billing/opd_template_builder_list.php
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Template Name
+ Action
+
+
+
+
+
+ No templates found. Click "Add New Template".
+
+
+ $nm) : ?>
+
+ = (int) $idx + 1 ?>
+ = esc($nm) ?>
+
+ Edit
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_template_workspace.php b/app/Views/billing/opd_template_workspace.php
new file mode 100644
index 0000000..b1c2a46
--- /dev/null
+++ b/app/Views/billing/opd_template_workspace.php
@@ -0,0 +1,464 @@
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ Section
+
+ Examination
+ Diagnosis
+ Provisional Diagnosis
+ Consult
+ Advice
+
+
+
+ Scope
+
+ Doctor
+ Master
+
+
+
+ Doctor Name
+
+ Select doctor
+
+
+
+ Template Name
+
+
+
+
+
+ Template Text
+
+
+
+
+ Save New
+ Update
+ Reset
+ Refresh Monitor
+
+
+
+
+
+ Monitor Section
+
+ All
+ Examination
+ Diagnosis
+ Provisional Diagnosis
+ Consult
+ Advice
+
+
+
+ Monitor Scope
+
+ Master + My templates
+ Master only
+ Doctor only
+
+
+
+ Doctor
+
+ All doctors
+
+
+
+ Apply Filter
+
+
+
+
+
+
+ Usage Analytics (Doctor-wise)
+ No usage data yet.
+
+
+
+
+
+
+
+ Template
+ Section
+ Scope
+ Uses
+ Last Used
+
+
+ No usage data yet.
+
+
+
+
+
+
+
+
+ Section
+ Templates
+ Uses
+
+
+ No section data.
+
+
+
+
+
+
+
Use this workspace to maintain templates.
+
+
+
+
+
+ ID
+ Scope
+ Section
+ Name
+ Text
+ Updated
+ Action
+
+
+
+ No template data yet.
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/billing/opd_templates/opd_info_print_letter_head.html b/app/Views/billing/opd_templates/opd_info_print_letter_head.html
new file mode 100644
index 0000000..97bcfb2
--- /dev/null
+++ b/app/Views/billing/opd_templates/opd_info_print_letter_head.html
@@ -0,0 +1 @@
+Hello World
\ No newline at end of file
diff --git a/app/Views/billing/opd_templates/opd_info_print_letter_head_1.html b/app/Views/billing/opd_templates/opd_info_print_letter_head_1.html
new file mode 100644
index 0000000..97bcfb2
--- /dev/null
+++ b/app/Views/billing/opd_templates/opd_info_print_letter_head_1.html
@@ -0,0 +1 @@
+Hello World
\ No newline at end of file
diff --git a/app/Views/billing/opd_templates/opd_print_info_letter_head.html b/app/Views/billing/opd_templates/opd_print_info_letter_head.html
new file mode 100644
index 0000000..d87d360
--- /dev/null
+++ b/app/Views/billing/opd_templates/opd_print_info_letter_head.html
@@ -0,0 +1 @@
+Test
\ No newline at end of file
diff --git a/app/Views/billing/opd_templates/opd_print_parcha_chamunda_hospital_ksp.php b/app/Views/billing/opd_templates/opd_print_parcha_chamunda_hospital_ksp.php
new file mode 100644
index 0000000..7184541
--- /dev/null
+++ b/app/Views/billing/opd_templates/opd_print_parcha_chamunda_hospital_ksp.php
@@ -0,0 +1,74 @@
+title ?? '') . ' ' . ($patient->p_fname ?? ''))));
+$pRelative = trim((string) (($patient->p_relative ?? '') . ' ' . ($patient->p_rname ?? '')));
+$ageSex = trim((string) (($patient->xgender ?? '') . ' / ' . ($patient->age ?? '')));
+$phone = (string) ($patient->mphone1 ?? '');
+$pAddress = trim((string) (($patient->add1 ?? '') . ', ' . ($patient->add2 ?? '') . ', ' . ($patient->city ?? '')), ' ,');
+
+$uhidNo = (string) ($patient->p_code ?? '');
+$opdSrNo = (string) ($opd->opd_no ?? '');
+$opdNo = (string) ($opd->opd_code ?? '');
+$opdDate = (string) ($opd->str_apointment_date ?? '');
+$expDate = (string) ($opd->opd_Exp_Date ?? '');
+
+$specName = trim((string) ($doctor->SpecName ?? $opd->doc_spec ?? ''));
+$opdFeeDesc = trim((string) ($opd->opd_fee_desc ?? ''));
+$totalNoVisit = (string) ($opd->no_visit ?? '');
+$lastVisitDate = trim((string) (($old_opd[0]->str_apointment_date ?? '') ?: ''));
+$bookTime = (string) ($opd->apointment_date ?? '');
+
+$lastVisitLine = $lastVisitDate !== '' ? (' Last Visit : ' . esc($lastVisitDate)) : '';
+$expDateLine = $expDate !== '' ? ('Valid Upto : ' . esc($expDate)) : '';
+?>
+
+
+
+
+
+
+
+ Print Time : = date('d-m-Y H:i:s') ?>
+
+
+
+
+
+ Name : = esc($pName) ?>
+ = esc($pRelative) ?>
+ Gender/Age : = esc($ageSex) ?>
+ Mob : = esc($phone) ?>
+ Address : = esc($pAddress) ?>
+
+
+ UHID : = esc($uhidNo) ?>
+ Sr No.: = esc($opdSrNo) ?>
+ OPD No.: = esc($opdNo) ?>
+ Date: = esc($opdDate) ?>
+ = $expDateLine ?>
+
+
+ DEPARTMENT :
+ = esc($specName) ?>
+ = esc($opdFeeDesc) ?>
+ No. of Visit : = esc($totalNoVisit) ?>
+ = $lastVisitLine ?>
+ Book Time : = esc($bookTime) ?>
+
+
+
diff --git a/app/Views/billing/opd_templates/rx_print_chamunda_plain_paper.html b/app/Views/billing/opd_templates/rx_print_chamunda_plain_paper.html
new file mode 100644
index 0000000..170ced1
--- /dev/null
+++ b/app/Views/billing/opd_templates/rx_print_chamunda_plain_paper.html
@@ -0,0 +1 @@
+Test again
\ No newline at end of file
diff --git a/app/Views/billing/rx_group_medicine_workspace.php b/app/Views/billing/rx_group_medicine_workspace.php
new file mode 100644
index 0000000..a22a64f
--- /dev/null
+++ b/app/Views/billing/rx_group_medicine_workspace.php
@@ -0,0 +1,426 @@
+
+
+
+
+
+
+
+
+
+
+ Medicine
+ Salt/Generic
+ Dose Plan
+ Edit
+ Remove
+
+
+ No medicine rows found.
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+ Medicine Name (Brand)
+
+
+
+
+
+ Type
+
+
+
+
+ Salt / Generic Name
+
+
+
+
+
+
+
+ Dose
+
+
+
+
+ When
+
+
+
+
+ Frequency
+
+
+
+
+
+
+
+ Remark
+
+
+
+
+ Add / Update
+ Reset
+
+
+
Ready.
+
+
+
+
+
+
+
diff --git a/app/Views/billing/search_adv_data.php b/app/Views/billing/search_adv_data.php
new file mode 100644
index 0000000..0cf03d2
--- /dev/null
+++ b/app/Views/billing/search_adv_data.php
@@ -0,0 +1,11 @@
+
+
+
+
+ = esc($row->Sresult ?? '') ?>
+
+
+
+
+ No matching records.
+
diff --git a/app/Views/dashboard/index.php b/app/Views/dashboard/index.php
new file mode 100644
index 0000000..8d536e5
--- /dev/null
+++ b/app/Views/dashboard/index.php
@@ -0,0 +1,315 @@
+
+
+
+
Dashboard
+
+
+ Home
+ Dashboard
+
+
+
+
+
+
+
+
+
+
OPD | Today
+
+
+
+
+
+
= esc((string) $opdToday) ?>
+ Last 7 days: = esc((string) $opdLast7Days) ?>
+
+
+
+
+
+
+
+
+
+
Admit & Discharge | Today
+
+
+
+
+
+
= esc((string) $admitToday) ?> / = esc((string) $dischargeToday) ?>
+ Admit / Discharge
+
+
+
+
+
+
+
+
+
+
Current IPD | In-house
+
+
+
+
+
+
= esc((string) $currentIpd) ?>
+ Org cases: = esc((string) $currentOrgIpd) ?>
+
+
+
+
+
+
+
+
+
+
Daily Trend | Current Month
+
+
+
+
+
+
= esc((string) array_sum($trendOpd)) ?> / = esc((string) array_sum($trendIpd)) ?>
+ OPD / IPD total (this month)
+
+
+
+
+
+
+
+
+
+
+
+
Daily Case Trend (Current Month)
+
+
+
+
+
+
+
+
+
+
+
+
+
OPD by Organization
+
+
+
+
+ Organization
+ Cases
+
+
+
+
+
+
+ = esc($row->org_name ?? 'Direct') ?>
+ = esc((string) $row->total_cases) ?>
+
+
+
+
+ No data
+
+
+
+
+
+
+
+
+
+
+
OPD by Doctor
+
+
+
+
+ Doctor
+ Total
+ Direct
+ Org
+
+
+
+
+
+
+ = esc($row->doc_name) ?>
+ = esc((string) $row->total_cases) ?>
+ = esc((string) $row->direct_cases) ?>
+ = esc((string) $row->org_cases) ?>
+
+
+
+
+ No data
+
+
+
+
+
+
+
+
+
+
+
+
+
IPD Doctors
+
+
+
+
+ Doctor
+ Cases
+
+
+
+
+
+
+ = esc($row->doc_name) ?>
+ = esc((string) $row->total_cases) ?>
+
+
+
+
+ No data
+
+
+
+
+
+
+
+
+
+
+
+
+
IPD by Organization
+
+
+
+
+ Organization
+ Cases
+
+
+
+
+
+
+ = esc($row->org_name ?? 'Direct') ?>
+ = esc((string) $row->total_cases) ?>
+
+
+
+
+ No data
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/index.php b/app/Views/diagnosis/index.php
new file mode 100644
index 0000000..c37eedb
--- /dev/null
+++ b/app/Views/diagnosis/index.php
@@ -0,0 +1,97 @@
+
+
Diagnosis
+
+
+ Home
+ Diagnosis
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/lab_ai_extracted_values.php b/app/Views/diagnosis/lab_ai_extracted_values.php
new file mode 100644
index 0000000..353b76d
--- /dev/null
+++ b/app/Views/diagnosis/lab_ai_extracted_values.php
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
No AI extraction found yet for this invoice.
+
+
+ Batch #= esc((string) ($batchRow['id'] ?? '')) ?> |
+ Panel: = esc((string) ($batchRow['panel_name'] ?? 'N/A')) ?> |
+ Model: = esc((string) ($batchRow['model_name'] ?? 'N/A')) ?> |
+ Created: = esc((string) ($batchRow['created_at'] ?? '')) ?>
+
+
+
+
+
+
+ Test
+ Value
+ Unit
+ Reference
+ Flag
+
+
+
+
+
+
+ = esc((string) ($row['test_name'] ?? '')) ?>
+ = esc((string) ($row['test_value'] ?? '')) ?>
+ = esc((string) ($row['unit'] ?? '')) ?>
+ = esc((string) ($row['reference_range'] ?? '')) ?>
+ = esc((string) ($row['abnormal_flag'] ?? '')) ?>
+
+
+
+
+ No extracted values found in latest batch.
+
+
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/lab_date_show.php b/app/Views/diagnosis/lab_date_show.php
new file mode 100644
index 0000000..9b5c289
--- /dev/null
+++ b/app/Views/diagnosis/lab_date_show.php
@@ -0,0 +1,40 @@
+ 0) {
+ $collectedTime = $lab_invoice_request[0]->collected_time ?? '';
+ $reportedTime = $lab_invoice_request[0]->reported_time ?? '';
+}
+?>
+
+
+
+
+
+
+ Sample Collection Time
+
+
+
+
+ Report Time
+
+
+
+
+
+ Update Time
+
+
+
diff --git a/app/Views/diagnosis/lab_final_report_show.php b/app/Views/diagnosis/lab_final_report_show.php
new file mode 100644
index 0000000..779e022
--- /dev/null
+++ b/app/Views/diagnosis/lab_final_report_show.php
@@ -0,0 +1,20 @@
+
+
+
+ Report not found.
+
+
+ = csrf_field() ?>
+
+
+ Report
+ = $report->Report_Data ?? '' ?>
+
+
+
+ Save
+ Verified
+
+
diff --git a/app/Views/diagnosis/lab_final_report_show_xray.php b/app/Views/diagnosis/lab_final_report_show_xray.php
new file mode 100644
index 0000000..975845c
--- /dev/null
+++ b/app/Views/diagnosis/lab_final_report_show_xray.php
@@ -0,0 +1,85 @@
+
+
+
+ Report not found.
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ Report
+ = $report->Report_Data ?? '' ?>
+
+
+
+ Impression
+ = $report->report_data_Impression ?? '' ?>
+
+
+
+ Save
+ Verified
+
+
+
+
+
Templates
+
+
+
+
+
+
+
No templates found
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/lab_invoice_main_test_list.php b/app/Views/diagnosis/lab_invoice_main_test_list.php
new file mode 100644
index 0000000..171eee9
--- /dev/null
+++ b/app/Views/diagnosis/lab_invoice_main_test_list.php
@@ -0,0 +1,145 @@
+ 0) {
+ $labInvoiceData = $lab_invoice_request[0];
+ $labReqId = $labInvoiceData->id ?? '';
+ $labTestNo = $labInvoiceData->lab_test_no ?? '';
+}
+?>
+
+
+
+
+
+ 0): ?>
+
+
+
Sr. No.
+
daily_sr_no ?? ''); ?>
+
+
+
+
+
+ Update Lab No.
+
+
+
+
+
+ 0): ?>
+
+ status ?? 0); ?>
+
+
+
+
item_name ?? ''); ?>
+
+ check_sample) || $test->check_sample < 1): ?>
+
Sample Collection Pending
+
+
+
+
+
In Progress
+
+
Completed
+
+
+
+
+ check_sample) || $test->check_sample < 1): ?>
+
+ Sample Collection
+
+
+
+
+ print_combine) && $test->print_combine > 0) ? 'checked' : ''; ?>>
+
+ Print Combine
+
+
+
+
+
+
+
+ Print Single Report
+
+
+ Remove
+
+
+
+
+ Open Report Editor
+
+
+
+ Data Pending
+
+
+
+ Edit
+
+
+ Remove
+
+
+
+
+
+ More
+
+
+
+
+
+ Upload Files
+
+
+ Scan
+
+
+ Show Files
+
+
+
+ Open for Edit
+
+
+
+
+
+
+
+
+
+
+
+ No tests found for this invoice.
+
+
diff --git a/app/Views/diagnosis/lab_report_file_list.php b/app/Views/diagnosis/lab_report_file_list.php
new file mode 100644
index 0000000..eb233e1
--- /dev/null
+++ b/app/Views/diagnosis/lab_report_file_list.php
@@ -0,0 +1,148 @@
+
+
Created Report History
+
+
+
+ Image-assisted AI (Doctor verify first): Use "AI Extract Values" on report image/scan to capture LFT/KFT values into DB for doctor support only.
+
+
View Latest Extracted Values
+
+
+
+
+ id ?? 0);
+ $fullPath = (string) ($row->full_path ?? '');
+ $filePath = str_replace('hms_uploads', 'uploads', $fullPath);
+ $fileDesc = (string) ($row->file_desc ?? 'File');
+ $fileName = (string) ($row->file_name ?? 'View');
+ $insertTime = (string) ($row->insert_time ?? '');
+ ?>
+
+ = esc($fileDesc) ?>
+ [= esc($fileName) ?> ]
+ / Created := esc($insertTime) ?>
+ AI Extract Values
+
+
+
+
No report files found.
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/lab_report_tab.php b/app/Views/diagnosis/lab_report_tab.php
new file mode 100644
index 0000000..cf2e064
--- /dev/null
+++ b/app/Views/diagnosis/lab_report_tab.php
@@ -0,0 +1,110 @@
+
+
+
Diagnosis Report List
+
+
+
+
+ No records found - Try searching with different criteria.
+
+
+
+
+
+
+
+ Invoice No.
+ Day Sr.No.
+ Lab Test No.
+ Person Name
+ Date
+ Tests Name
+ Action
+
+
+
+
+
+ = esc($row->invoice_code ?? '-') ?>
+ = esc($row->daily_sr_no ?? '-') ?>
+ = esc($row->lab_test_no ?? '-') ?>
+ = esc($row->inv_name ?? '-') ?> | = esc($row->age ?? '-') ?>
+ = esc($row->inv_date ?? '-') ?>
+
+ data_array)) {
+ $dataArray = explode('#', $row->data_array);
+ $hasBadge = false;
+ foreach ($dataArray as $value) {
+ if (!empty($value)) {
+ $valueArray = explode(';', $value);
+ if (count($valueArray) >= 4) {
+ $testName = $valueArray[0] ?? '';
+ $isRequested = isset($valueArray[3]) ? $valueArray[3] : 0;
+
+ if ($isRequested < 1) {
+ echo '' . esc($testName) . ' ';
+ } else {
+ echo '' . esc($testName) . ' ';
+ }
+ $hasBadge = true;
+ }
+ }
+ }
+ if (!$hasBadge) {
+ echo '-';
+ }
+ } else {
+ echo '-';
+ }
+ ?>
+
+
+
+ Select
+
+
+
+
+
+
+
+ Invoice No.
+ Day Sr.No.
+ Lab Test No.
+ Person Name
+ Date
+ Tests Name
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/lab_report_tab_path.php b/app/Views/diagnosis/lab_report_tab_path.php
new file mode 100644
index 0000000..d73bca0
--- /dev/null
+++ b/app/Views/diagnosis/lab_report_tab_path.php
@@ -0,0 +1,116 @@
+
+
+
Pathology Report List
+
+
+
+
+ No records found - Try searching with different criteria.
+
+
+
+
+
+
+
+ Invoice No.
+ Day Sr.No.
+ Lab Test No.
+ Person Name
+ Date
+ Tests Name
+ Action
+
+
+
+
+
+ = esc($row->invoice_code ?? '-') ?>
+ = esc($row->daily_sr_no ?? '-') ?>
+ = esc($row->lab_test_no ?? '-') ?>
+ = esc($row->inv_name ?? '-') ?> | = esc($row->age ?? '-') ?>
+ = esc($row->inv_date ?? '-') ?>
+
+ data_array)) {
+ $dataArray = explode('#', $row->data_array);
+ $hasBadge = false;
+ foreach ($dataArray as $value) {
+ if (!empty($value)) {
+ $valueArray = explode(';', $value);
+ if (count($valueArray) >= 4) {
+ $testName = $valueArray[0] ?? '';
+ $isRequested = isset($valueArray[3]) ? $valueArray[3] : 0;
+
+ if ($isRequested < 1) {
+ echo '' . esc($testName) . ' ';
+ } else {
+ if (isset($valueArray[4]) && $valueArray[4] > 0) {
+ echo '' . esc($testName) . ' ';
+ } else {
+ echo '' . esc($testName) . ' ';
+ }
+ }
+ $hasBadge = true;
+ }
+ }
+ }
+ if (!$hasBadge) {
+ echo '-';
+ }
+ } else {
+ echo '-';
+ }
+ ?>
+
+
+
+ Select
+
+
+
+
+
+
+
+ Invoice No.
+ Day Sr.No.
+ Lab Test No.
+ Person Name
+ Date
+ Tests Name
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/pathology_detail.php b/app/Views/diagnosis/pathology_detail.php
new file mode 100644
index 0000000..5b9b863
--- /dev/null
+++ b/app/Views/diagnosis/pathology_detail.php
@@ -0,0 +1,1008 @@
+
+
+
+
= esc($currentLabTypeName) ?> - = esc($flowTypeLabel) ?> Invoice Details
+
+
+ Diagnosis
+ = esc($currentLabTypeName) ?>
+ Invoice #invoice_code ?? ''); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Patient Name:
+ p_fname . ' ' . ($invoice->p_rname ?? '')); ?>
+
+
+ Patient Code:
+ p_code ?? 'N/A'); ?>
+
+
+ Gender:
+ gender ?? 'N/A'); ?>
+
+
+ Age:
+
+ age_in_month) && intval($invoice->age_in_month) > 0) {
+ echo htmlspecialchars($invoice->age_in_month . ' months');
+ } elseif (!empty($invoice->age)) {
+ echo htmlspecialchars($invoice->age . ' years');
+ } else {
+ echo 'N/A';
+ }
+ ?>
+
+
+
+ Aadhar:
+ udai ?? 'N/A'); ?>
+
+
+ Phone:
+ phone_number ?? 'N/A'); ?>
+
+
+ Email:
+ email ?? 'N/A'); ?>
+
+
+ Address:
+
+ address_line1)) $address[] = $invoice->address_line1;
+ if (!empty($invoice->city)) $address[] = $invoice->city;
+ if (!empty($invoice->state)) $address[] = $invoice->state;
+ echo htmlspecialchars(implode(', ', $address) ?: 'N/A');
+ ?>
+
+
+
+ Invoice Date:
+ inv_date ?? ''))); ?>
+
+
+
+
+
+ No patient information found.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Compile Report
+
+
+
+
+ Report in Letterhead
+
+
+
+
+ Report in Plain Paper
+
+
+
+
+ Upload PDF
+
+
+
+
+ Scan Report
+
+
+
+
+ Show Reports
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Test Name
+
+
+
+ Collection Time
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/print_compiled_report.php b/app/Views/diagnosis/print_compiled_report.php
new file mode 100644
index 0000000..28360ea
--- /dev/null
+++ b/app/Views/diagnosis/print_compiled_report.php
@@ -0,0 +1,65 @@
+
+
+
+
+
+ = esc($invoice->invoice_code ?? 'Report') ?>
+
+
+
+
+
+
+ Print
+
+
+
+
+
+
+
= esc($hospitalName) ?>
+
= esc($hospitalAddress) ?>
+
= esc($hospitalPhone) ?>
+
+
Letterhead
+
+
+
+
+
+
+
+ report_header)): ?>
+
= $invoiceRequest->report_header ?>
+
+
+
= $invoiceRequest->report_data ?? '' ?>
+
+
+
diff --git a/app/Views/diagnosis/print_single_report.php b/app/Views/diagnosis/print_single_report.php
new file mode 100644
index 0000000..32284d8
--- /dev/null
+++ b/app/Views/diagnosis/print_single_report.php
@@ -0,0 +1,37 @@
+
+
+
+
+
+ Print Single Report
+
+
+
+
+ Print
+
+
+
+
+
+ Report_Data)): ?>
+ = $report->Report_Data ?>
+
+
No report data available for this request.
+
+
+
+
diff --git a/app/Views/diagnosis/request_list.php b/app/Views/diagnosis/request_list.php
new file mode 100644
index 0000000..07c6d81
--- /dev/null
+++ b/app/Views/diagnosis/request_list.php
@@ -0,0 +1,206 @@
+
+
+
+
= esc($lab_type_name) ?>
+
+
+ Home
+ Diagnosis
+ = esc($lab_type_name) ?>
+
+
+
+
+
+
+
diff --git a/app/Views/diagnosis/test_data_entry_form.php b/app/Views/diagnosis/test_data_entry_form.php
new file mode 100644
index 0000000..9c2e22f
--- /dev/null
+++ b/app/Views/diagnosis/test_data_entry_form.php
@@ -0,0 +1,51 @@
+item_name ?? '';
+$patientName = $test->p_fname ?? '';
+$patientCode = $test->p_code ?? '';
+$invoiceCode = $test->invoice_code ?? '';
+$status = $test->status ?? 0;
+?>
+
+
+
+
+
+
+
+
+
+ Test Remarks / Findings
+
+ Enter the laboratory findings and observations for this test.
+
+
+
+
+ Status
+
+ >Pending
+ >In Progress
+ >Completed
+
+
+
+
+
+ Cancel
+
+ Save Test Data
+
+
+
+
diff --git a/app/Views/diagnosis/test_data_entry_table.php b/app/Views/diagnosis/test_data_entry_table.php
new file mode 100644
index 0000000..a8b6eb6
--- /dev/null
+++ b/app/Views/diagnosis/test_data_entry_table.php
@@ -0,0 +1,75 @@
+
+
+
+ No test request data found.
+
+
+ = csrf_field() ?>
+
+
+
Patient Name := esc($master->patient_name ?? '') ?>
+ / = esc($master->invoice_code ?? '') ?>
+
+
+
+
+
+
+
+
No test parameters mapped for this report template.
+
+
+
+
+ Save & Next
+
+
+
diff --git a/app/Views/errors/cli/error_404.php b/app/Views/errors/cli/error_404.php
new file mode 100644
index 0000000..456ea3e
--- /dev/null
+++ b/app/Views/errors/cli/error_404.php
@@ -0,0 +1,7 @@
+getFile()) . ':' . $exception->getLine(), 'green'));
+CLI::newLine();
+
+$last = $exception;
+
+while ($prevException = $last->getPrevious()) {
+ $last = $prevException;
+
+ CLI::write(' Caused by:');
+ CLI::write(' [' . $prevException::class . ']', 'red');
+ CLI::write(' ' . $prevException->getMessage());
+ CLI::write(' at ' . CLI::color(clean_path($prevException->getFile()) . ':' . $prevException->getLine(), 'green'));
+ CLI::newLine();
+}
+
+// The backtrace
+if (defined('SHOW_DEBUG_BACKTRACE') && SHOW_DEBUG_BACKTRACE) {
+ $backtraces = $last->getTrace();
+
+ if ($backtraces) {
+ CLI::write('Backtrace:', 'green');
+ }
+
+ foreach ($backtraces as $i => $error) {
+ $padFile = ' '; // 4 spaces
+ $padClass = ' '; // 7 spaces
+ $c = str_pad($i + 1, 3, ' ', STR_PAD_LEFT);
+
+ if (isset($error['file'])) {
+ $filepath = clean_path($error['file']) . ':' . $error['line'];
+
+ CLI::write($c . $padFile . CLI::color($filepath, 'yellow'));
+ } else {
+ CLI::write($c . $padFile . CLI::color('[internal function]', 'yellow'));
+ }
+
+ $function = '';
+
+ if (isset($error['class'])) {
+ $type = ($error['type'] === '->') ? '()' . $error['type'] : $error['type'];
+ $function .= $padClass . $error['class'] . $type . $error['function'];
+ } elseif (! isset($error['class']) && isset($error['function'])) {
+ $function .= $padClass . $error['function'];
+ }
+
+ $args = implode(', ', array_map(static fn ($value): string => match (true) {
+ is_object($value) => 'Object(' . $value::class . ')',
+ is_array($value) => $value !== [] ? '[...]' : '[]',
+ $value === null => 'null', // return the lowercased version
+ default => var_export($value, true),
+ }, array_values($error['args'] ?? [])));
+
+ $function .= '(' . $args . ')';
+
+ CLI::write($function);
+ CLI::newLine();
+ }
+}
diff --git a/app/Views/errors/cli/production.php b/app/Views/errors/cli/production.php
new file mode 100644
index 0000000..7db744e
--- /dev/null
+++ b/app/Views/errors/cli/production.php
@@ -0,0 +1,5 @@
+
+
+
+
+ = lang('Errors.badRequest') ?>
+
+
+
+
+
+
400
+
+
+
+ = nl2br(esc($message)) ?>
+
+ = lang('Errors.sorryBadRequest') ?>
+
+
+
+
+
diff --git a/app/Views/errors/html/error_404.php b/app/Views/errors/html/error_404.php
new file mode 100644
index 0000000..e506f08
--- /dev/null
+++ b/app/Views/errors/html/error_404.php
@@ -0,0 +1,84 @@
+
+
+
+
+ = lang('Errors.pageNotFound') ?>
+
+
+
+
+
+
404
+
+
+
+ = nl2br(esc($message)) ?>
+
+ = lang('Errors.sorryCannotFind') ?>
+
+
+
+
+
diff --git a/app/Views/errors/html/error_exception.php b/app/Views/errors/html/error_exception.php
new file mode 100644
index 0000000..2c4e009
--- /dev/null
+++ b/app/Views/errors/html/error_exception.php
@@ -0,0 +1,429 @@
+
+
+
+
+
+
+
+ = esc($title) ?>
+
+
+
+
+
+
+
+
+
+
+
+
= esc(clean_path($file)) ?> at line = esc($line) ?>
+
+
+
+ = static::highlightFile($file, $line, 15); ?>
+
+
+
+
+
+ getPrevious()) {
+ $last = $prevException;
+ ?>
+
+
+ Caused by:
+ = esc($prevException::class), esc($prevException->getCode() ? ' #' . $prevException->getCode() : '') ?>
+
+ = nl2br(esc($prevException->getMessage())) ?>
+ getMessage())) ?>"
+ rel="noreferrer" target="_blank">search →
+ = esc(clean_path($prevException->getFile()) . ':' . $prevException->getLine()) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ $row) : ?>
+
+
+
+
+
+
+
+ {PHP internal code}
+
+
+
+
+ — = esc($row['class'] . $row['type'] . $row['function']) ?>
+
+
+ ( arguments )
+
+
+
+ getParameters();
+ }
+
+ foreach ($row['args'] as $key => $value) : ?>
+
+ = esc(isset($params[$key]) ? '$' . $params[$key]->name : "#{$key}") ?>
+ = esc(print_r($value, true)) ?>
+
+
+
+
+
+
+ ()
+
+
+
+
+ — = esc($row['function']) ?>()
+
+
+
+
+
+
+ = static::highlightFile($row['file'], $row['line']) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
$= esc($var) ?>
+
+
+
+
+ Key
+ Value
+
+
+
+ $value) : ?>
+
+ = esc($key) ?>
+
+
+ = esc($value) ?>
+
+ = esc(print_r($value, true)) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
Constants
+
+
+
+
+ Key
+ Value
+
+
+
+ $value) : ?>
+
+ = esc($key) ?>
+
+
+ = esc($value) ?>
+
+ = esc(print_r($value, true)) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Path
+ = esc($request->getUri()) ?>
+
+
+ HTTP Method
+ = esc($request->getMethod()) ?>
+
+
+ IP Address
+ = esc($request->getIPAddress()) ?>
+
+
+ Is AJAX Request?
+ = $request->isAJAX() ? 'yes' : 'no' ?>
+
+
+ Is CLI Request?
+ = $request->isCLI() ? 'yes' : 'no' ?>
+
+
+ Is Secure Request?
+ = $request->isSecure() ? 'yes' : 'no' ?>
+
+
+ User Agent
+ = esc($request->getUserAgent()->getAgentString()) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
$= esc($var) ?>
+
+
+
+
+ Key
+ Value
+
+
+
+ $value) : ?>
+
+ = esc($key) ?>
+
+
+ = esc($value) ?>
+
+ = esc(print_r($value, true)) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ No $_GET, $_POST, or $_COOKIE Information to show.
+
+
+
+
+ headers(); ?>
+
+
+
Headers
+
+
+
+
+ Header
+ Value
+
+
+
+ $value) : ?>
+
+ = esc($name, 'html') ?>
+
+ getValueLine(), 'html');
+ } else {
+ foreach ($value as $i => $header) {
+ echo ' ('. $i+1 . ') ' . esc($header->getValueLine(), 'html');
+ }
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+ setStatusCode(http_response_code());
+ ?>
+
+
+
+ Response Status
+ = esc($response->getStatusCode() . ' - ' . $response->getReasonPhrase()) ?>
+
+
+
+ headers(); ?>
+
+
Headers
+
+
+
+
+ Header
+ Value
+
+
+
+ $value) : ?>
+
+ = esc($name, 'html') ?>
+
+ getHeaderLine($name), 'html');
+ } else {
+ foreach ($value as $i => $header) {
+ echo ' ('. $i+1 . ') ' . esc($header->getValueLine(), 'html');
+ }
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = esc(clean_path($file)) ?>
+
+
+
+
+
+
+
+
+
+
+ Memory Usage
+ = esc(static::describeMemory(memory_get_usage(true))) ?>
+
+
+ Peak Memory Usage:
+ = esc(static::describeMemory(memory_get_peak_usage(true))) ?>
+
+
+ Memory Limit:
+ = esc(ini_get('memory_limit')) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/errors/html/production.php b/app/Views/errors/html/production.php
new file mode 100644
index 0000000..2f59a8d
--- /dev/null
+++ b/app/Views/errors/html/production.php
@@ -0,0 +1,25 @@
+
+
+
+
+
+
+ = lang('Errors.whoops') ?>
+
+
+
+
+
+
+
+
= lang('Errors.whoops') ?>
+
+
= lang('Errors.weHitASnag') ?>
+
+
+
+
+
+
diff --git a/app/Views/medical/company_edit.php b/app/Views/medical/company_edit.php
new file mode 100644
index 0000000..11f9d20
--- /dev/null
+++ b/app/Views/medical/company_edit.php
@@ -0,0 +1,70 @@
+id ?? 0);
+ $companyName = (string) ($row->company_name ?? '');
+ $contactPersonName = (string) ($row->contact_person_name ?? '');
+ $contactPhoneNo = (string) ($row->contact_phone_no ?? '');
+}
+?>
+
+
+
+
diff --git a/app/Views/medical/company_master.php b/app/Views/medical/company_master.php
new file mode 100644
index 0000000..7e6f993
--- /dev/null
+++ b/app/Views/medical/company_master.php
@@ -0,0 +1,17 @@
+
+
+
+
Company Master
+ Add New
+
+
+
+
+
+ = view('medical/company_master_sub', ['med_company' => $med_company ?? []]) ?>
+
+
+
+
+
+
diff --git a/app/Views/medical/company_master_sub.php b/app/Views/medical/company_master_sub.php
new file mode 100644
index 0000000..4e92991
--- /dev/null
+++ b/app/Views/medical/company_master_sub.php
@@ -0,0 +1,34 @@
+
+
+
+ Company Name
+ Person/Phone
+ Action
+
+
+
+
+
+ = esc($row->company_name ?? '') ?>
+ = esc(($row->contact_person_name ?? '') . '/' . ($row->contact_phone_no ?? '')) ?>
+
+ Edit
+
+
+
+
+
+
+
diff --git a/app/Views/medical/counter_sale_form.php b/app/Views/medical/counter_sale_form.php
new file mode 100644
index 0000000..b5554af
--- /dev/null
+++ b/app/Views/medical/counter_sale_form.php
@@ -0,0 +1,127 @@
+
+
+
diff --git a/app/Views/medical/dashboard.php b/app/Views/medical/dashboard.php
new file mode 100644
index 0000000..07f755e
--- /dev/null
+++ b/app/Views/medical/dashboard.php
@@ -0,0 +1,40 @@
+
+
Medical Store
+
+
+ Dashboard
+
+
+
+
+
diff --git a/app/Views/medical/drug_master_list.php b/app/Views/medical/drug_master_list.php
new file mode 100644
index 0000000..84b749b
--- /dev/null
+++ b/app/Views/medical/drug_master_list.php
@@ -0,0 +1,27 @@
+
+
+ = csrf_field() ?>
+
+
+
+
+ Search Product
+
+
+ Add New Product
+
+
+
+
+
+
+
diff --git a/app/Views/medical/expiry_stock_list.php b/app/Views/medical/expiry_stock_list.php
new file mode 100644
index 0000000..506565b
--- /dev/null
+++ b/app/Views/medical/expiry_stock_list.php
@@ -0,0 +1,139 @@
+ 0,
+ 'd30' => 0,
+ 'd60' => 0,
+ 'later' => 0,
+];
+
+foreach ($rows as $summaryRow) {
+ $expiryTs = strtotime((string) ($summaryRow->expiry_date ?? ''));
+ if ($expiryTs === false) {
+ $expirySummary['later']++;
+ continue;
+ }
+
+ $daysToExpiry = (int) floor(($expiryTs - $todayTs) / 86400);
+ if ($daysToExpiry < 0) {
+ $expirySummary['expired']++;
+ } elseif ($daysToExpiry <= 30) {
+ $expirySummary['d30']++;
+ } elseif ($daysToExpiry <= 60) {
+ $expirySummary['d60']++;
+ } else {
+ $expirySummary['later']++;
+ }
+}
+?>
+
+
+
+
+
Nearest Expiry / Expired Medicine Stock
+
+
+
+
+ Expired
+ Expiring in 30 days
+ Expiring in 2 months
+ Above 2 months
+
+
+
+
+
+
Expired
+
= esc((string) ($expirySummary['expired'] ?? 0)) ?>
+
+
+
+
+
Expiring in 30 days
+
= esc((string) ($expirySummary['d30'] ?? 0)) ?>
+
+
+
+
+
Expiring in 2 months
+
= esc((string) ($expirySummary['d60'] ?? 0)) ?>
+
+
+
+
+
Above 2 months
+
= esc((string) ($expirySummary['later'] ?? 0)) ?>
+
+
+
+
+
+
+
+
+ #
+ Item
+ Supplier
+ Pur. Date
+ Batch
+ Exp. Dt
+ Rate
+ Qty
+ C.Qty
+ Status
+
+
+
+ expiry_date ?? '');
+ $expiryTs = strtotime($expiryDateRaw);
+ $daysToExpiry = null;
+
+ if ($expiryTs !== false) {
+ $daysToExpiry = (int) floor(($expiryTs - $todayTs) / 86400);
+
+ if ($daysToExpiry < 0) {
+ $statusLabel = 'Expired';
+ $statusClass = 'table-danger';
+ } elseif ($daysToExpiry <= 30) {
+ $statusLabel = 'Expiring in 30 days';
+ $statusClass = 'table-warning';
+ } elseif ($daysToExpiry <= 60) {
+ $statusLabel = 'Expiring in 2 months';
+ $statusClass = 'table-info';
+ }
+ }
+ ?>
+
+ = esc((string) $srno++) ?>
+ = esc($row->item_name ?? $row->Item_name ?? '') ?>
+ = esc($row->name_supplier ?? '') ?>
+ = esc($row->str_date_of_invoice ?? '') ?>
+ = esc($row->batch_no ?? '') ?>
+ = esc($row->exp_date ?? '') ?>
+ = esc(number_format((float) ($row->mrp ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->tqty ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->cur_qty ?? 0), 2)) ?>
+
+ = esc($statusLabel) ?>
+
+ (= esc((string) $daysToExpiry) ?> days)
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/expiry_stock_pdf.php b/app/Views/medical/expiry_stock_pdf.php
new file mode 100644
index 0000000..327f96a
--- /dev/null
+++ b/app/Views/medical/expiry_stock_pdf.php
@@ -0,0 +1,119 @@
+ 0,
+ 'd30' => 0,
+ 'd60' => 0,
+ 'later' => 0,
+];
+
+foreach ($rows as $summaryRow) {
+ $expiryTs = strtotime((string) ($summaryRow->expiry_date ?? ''));
+ if ($expiryTs === false) {
+ $expirySummary['later']++;
+ continue;
+ }
+
+ $daysToExpiry = (int) floor(($expiryTs - $todayTs) / 86400);
+ if ($daysToExpiry < 0) {
+ $expirySummary['expired']++;
+ } elseif ($daysToExpiry <= 30) {
+ $expirySummary['d30']++;
+ } elseif ($daysToExpiry <= 60) {
+ $expirySummary['d60']++;
+ } else {
+ $expirySummary['later']++;
+ }
+}
+?>
+
+
+
+Expiry Medicine Report
+Generated: = esc((string) ($generated_at ?? date('d-m-Y H:i'))) ?>
+
+
+
+ Expired
+ Expiring in 30 days
+ Expiring in 2 months
+ Above 2 months
+
+
+ = esc((string) ($expirySummary['expired'] ?? 0)) ?>
+ = esc((string) ($expirySummary['d30'] ?? 0)) ?>
+ = esc((string) ($expirySummary['d60'] ?? 0)) ?>
+ = esc((string) ($expirySummary['later'] ?? 0)) ?>
+
+
+
+
+
+
+ #
+ Item
+ Supplier
+ Pur. Date
+ Batch
+ Exp. Dt
+ Rate
+ Qty
+ C.Qty
+ Status
+
+
+
+
+ expiry_date ?? ''));
+ if ($expiryTs !== false) {
+ $daysToExpiry = (int) floor(($expiryTs - $todayTs) / 86400);
+ $daysText = ' (' . $daysToExpiry . ' days)';
+
+ if ($daysToExpiry < 0) {
+ $statusLabel = 'Expired';
+ $rowClass = 'expired-row';
+ } elseif ($daysToExpiry <= 30) {
+ $statusLabel = 'Expiring in 30 days';
+ $rowClass = 'd30-row';
+ } elseif ($daysToExpiry <= 60) {
+ $statusLabel = 'Expiring in 2 months';
+ $rowClass = 'd60-row';
+ }
+ }
+ ?>
+
+ = esc((string) $srno++) ?>
+ = esc((string) ($row->item_name ?? $row->Item_name ?? '')) ?>
+ = esc((string) ($row->name_supplier ?? '')) ?>
+ = esc((string) ($row->str_date_of_invoice ?? '')) ?>
+ = esc((string) ($row->batch_no ?? '')) ?>
+ = esc((string) ($row->exp_date ?? '')) ?>
+ = esc(number_format((float) ($row->mrp ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->tqty ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->cur_qty ?? 0), 2)) ?>
+ = esc($statusLabel . $daysText) ?>
+
+
+
+
diff --git a/app/Views/medical/invoice_edit.php b/app/Views/medical/invoice_edit.php
new file mode 100644
index 0000000..6b732f6
--- /dev/null
+++ b/app/Views/medical/invoice_edit.php
@@ -0,0 +1,778 @@
+ipd_id ?? 0) > 0); ?>
+
+
+
+
+
+
+
+
+
= esc($message) ?>
+
+
+
+
+
+
Invoice is finalized. Edit actions are locked.
+
+
+
+ Name : = esc($invoice->inv_name ?? '-') ?> /
+ P Code : = esc($invoice->patient_code ?? '-') ?> /
+ ipd_id ?? 0) > 0): ?>
+ IPD ID : = esc((string) ((int)($invoice->ipd_id ?? 0))) ?> /
+
+ Invoice No. : = esc($invoice->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) ((int)($invoice->id ?? 0)), -7, 7), 7, '0', STR_PAD_LEFT))) ?> /
+ Date : = esc(!empty($invoice->inv_date) ? date('d/m/Y', strtotime((string)$invoice->inv_date)) : '-') ?>
+
+
+
+
+ = csrf_field() ?>
+
+
+ Doctor ID
+
+
+
+ Doctor Name
+
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ Rate
+ S.Qty.
+ Qty
+ Disc.
+ Amount
+ Action
+
+
+
+ item_code ?? '');
+ if ($codeKey !== '') {
+ $itemCodeCounts[$codeKey] = ($itemCodeCounts[$codeKey] ?? 0) + 1;
+ }
+ }
+ }
+ ?>
+
+ $item): ?>
+ sale_return ?? 0) === 1)
+ || ((float) ($item->amount ?? 0) < 0)
+ || ((float) ($item->tamount ?? 0) < 0)
+ || ((float) ($item->twdisc_amount ?? 0) < 0);
+
+ if ($isReturnRow) {
+ $rowStyle = 'background:orange;';
+ }
+
+ $expiryDays = 1000;
+ if (!empty($item->expiry)) {
+ $expiryTs = strtotime((string) $item->expiry);
+ if ($expiryTs !== false) {
+ $expiryDays = (int) floor(($expiryTs - strtotime(date('Y-m-d'))) / 86400);
+ }
+ }
+
+ if ($expiryDays < 90) {
+ $rowStyle = 'color:red;';
+ }
+
+ $sQty = (float) ($item->s_qty ?? 0);
+ if ($sQty < 6) {
+ $rowStyle = 'color:red;';
+ }
+
+ $itemCode = (string) ($item->item_code ?? '');
+ if ($itemCode !== '' && (int) ($itemCodeCounts[$itemCode] ?? 0) > 1) {
+ $itemNameStyle = 'color:green;';
+ }
+ ?>
+ >
+ = $i + 1 ?>
+ >= esc($item->item_Name ?? '-') ?>
+ = esc($item->batch_no ?? '-') ?>
+ = esc(!empty($item->expiry) ? date('Y-m-d', strtotime((string)$item->expiry)) : '-') ?>
+ = esc(number_format((float)($item->price ?? 0), 2)) ?>
+ = esc(number_format((float)($item->qty ?? 0), 0, '.', '')) ?>
+
+ sale_return ?? 0) === 0): ?>
+
+ = csrf_field() ?>
+
+
+
+ ✎
+
+
+ = esc(number_format((float)($item->qty ?? 0), 2)) ?>
+
+
+ = esc(number_format((float)($item->disc_amount ?? 0), 2)) ?>
+ = esc(number_format((float)($item->tamount ?? 0), 2)) ?>
+
+
+
+ = csrf_field() ?>
+
+
+ ✖
+
+
+ Locked
+
+
+
+
+
+
+ No items in invoice.
+
+
+
+
+
+ Gross Total
+ = esc(number_format((float)($totals->gross ?? 0), 2)) ?>
+
+
+
+ Net Total
+ = esc(number_format((float)($totals->net ?? 0), 2)) ?>
+
+
+
+
+
+
+
+
+
Product Search
+
+
+
+
+ Product Search:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ Unit Rate
+
+
+
+ Qty
+
+
+
+ Disc %
+
+
+
+ Add
+
+
+
+
+
+
+
+
+
No stock items found for search.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ patient_id) && !empty($oldInvoices)): ?>
+
+ patient_id)): ?>
+
No old invoices for this patient.
+
+
Walk-in invoice. Previous patient history is unavailable.
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/invoice_item_log.php b/app/Views/medical/invoice_item_log.php
new file mode 100644
index 0000000..713f2a8
--- /dev/null
+++ b/app/Views/medical/invoice_item_log.php
@@ -0,0 +1,62 @@
+
+
+
+
+
+
Medical Invoice Item Log
+
Back to Master
+
+
+
+
+ From
+
+
+
+ To
+
+
+
+
+ Show
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/invoice_item_log_data.php b/app/Views/medical/invoice_item_log_data.php
new file mode 100644
index 0000000..b630b5b
--- /dev/null
+++ b/app/Views/medical/invoice_item_log_data.php
@@ -0,0 +1,112 @@
+
+
+
+
+ #
+ Invoice Code
+ Invoice Date
+ Name
+ Item Deleted
+ Payment Log
+ Update Log
+
+
+
+
+
+ = esc((string) $i++) ?>
+ = esc($row->inv_med_code ?? '') ?>
+ = esc($row->inv_date ?? '') ?>
+ = esc($row->inv_name ?? '') ?>
+
+ del_item_list ?? '')));
+ $itemAmountTotal = 0.0;
+ ?>
+
+
+
+
+ Item Name
+ Qty
+ Price
+ Amount
+ Delete By
+
+
+
+
+
+ = esc($item[0] ?? '') ?>
+ = esc(number_format((float) ($item[1] ?? 0), 2)) ?>
+ = esc(number_format((float) ($item[2] ?? 0), 2)) ?>
+ = esc(number_format($amount, 2)) ?>
+ = esc($item[5] ?? '') ?>
+
+
+
+ Total Amount
+ = esc(number_format($itemAmountTotal, 2)) ?>
+
+
+
+
+
+ No Item Deleted
+
+
+
+ payment_log ?? ''))); ?>
+
+
+
+
+ Payment Type
+ Amount
+ Payment By
+
+
+
+
+
+ = esc($payType) ?>
+ = esc(number_format((float) ($item[1] ?? 0), 2)) ?>
+ = esc($item[2] ?? '') ?>
+
+
+
+
+
+ No Payment Log
+
+
+ = esc((string) ($row->log ?? '')) ?>
+
+
+
+
+
+
+
diff --git a/app/Views/medical/invoice_master_edit.php b/app/Views/medical/invoice_master_edit.php
new file mode 100644
index 0000000..214b2dd
--- /dev/null
+++ b/app/Views/medical/invoice_master_edit.php
@@ -0,0 +1,438 @@
+
+
+
+
+
= esc($message) ?>
+
+
+
+ = csrf_field() ?>
+
+
+
+
+
+
+
+
+
+
+
+ Change Date
+
+
+
+ Update Invoice Date
+
+
+
+
+ ipd_id ?? 0) > 0): ?>
+
+
Credit Type
+
+ ipd_credit ?? 0) === 0) ? 'checked' : '' ?>>
+ Cash / Direct
+
+
+ ipd_credit ?? 0) === 1) ? 'checked' : '' ?>>
+ Credit To Hospital
+
+
+
+ Update Credit Type
+
+ case_id ?? 0) > 0): ?>
+
+
Credit Type
+
+ case_credit ?? 0) === 0) ? 'checked' : '' ?>>
+ Cash
+
+
+ case_credit ?? 0) === 1) ? 'checked' : '' ?>>
+ Credit
+
+
+
+
+
+
+
+
+
+
+
+
+ Patient Name
+
+
+
+ Patient Phone No.
+
+
+
+ Update Name
+
+
+
+
+
+
+
+
+
+
+ UHID /Patient Code
+
+
+
+
Patient Information
+
= esc($invoice->inv_name ?? '-') ?> / = esc($invoice->inv_phone_number ?? '-') ?>
+
+
+ Update UHID Record
+
+
+
+
+
+
+
+
+
+
+ IPD No./Code
+
+
+
+
Patient Information
+
= esc($invoice->inv_name ?? '-') ?>
+
+
+ Update IPD NO. Record
+
+
+
+
+
+
+
+
+
+
+ Org.Case No./Code
+
+
+
+
Patient Information
+
= esc($invoice->inv_name ?? '-') ?>
+
+
+ Update Org NO. Record
+
+
+
+
+
+
+
+
+ Doctor
+
+ Select
+
+ doc_id ?? 0) === (int)($doc->id ?? 0)) ? 'selected' : '' ?>>
+ = esc($doc->p_fname ?? ('Doctor #' . ($doc->id ?? ''))) ?>
+
+
+
+
+
+
+
+
Update Invoice Header
+
Cancel
+
+
+
+
+
+
+
diff --git a/app/Views/medical/invoice_med_draft.php b/app/Views/medical/invoice_med_draft.php
new file mode 100644
index 0000000..5a9250e
--- /dev/null
+++ b/app/Views/medical/invoice_med_draft.php
@@ -0,0 +1,115 @@
+
+
+
Invoice Draft List
+
+
+
= esc($message) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+ Search
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/invoice_print.php b/app/Views/medical/invoice_print.php
new file mode 100644
index 0000000..5ada468
--- /dev/null
+++ b/app/Views/medical/invoice_print.php
@@ -0,0 +1,116 @@
+
+
+
+
+
+ Medical Invoice = esc($invoice->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) ((int)($invoice->id ?? 0)), -7, 7), 7, '0', STR_PAD_LEFT))) ?>
+
+
+
+
+ Print
+ Close
+
+
+ Medical Invoice
+ Invoice No: = esc($invoice->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) ((int)($invoice->id ?? 0)), -7, 7), 7, '0', STR_PAD_LEFT))) ?>
+
+
+
+
Date: = esc($invoice->inv_date ?? '-') ?>
+
Patient: = esc($invoice->inv_name ?? '-') ?>
+
Patient Code: = esc($invoice->patient_code ?? '-') ?>
+
+
+
Doctor: = esc($invoice->doc_name ?? '-') ?>
+
Phone: = esc($invoice->inv_phone_number ?? ($patient->mphone1 ?? '-')) ?>
+
Type: = ((int)($invoice->ipd_credit ?? 0) === 1) ? 'Credit' : 'Cash' ?>
+
+
+
+
+
+
+ #
+ Item
+ Batch
+ Qty
+ Rate
+ Discount
+ Amount
+ Net
+
+
+
+
+
+ $item): ?>
+ amount ?? 0);
+ $rowDisc = (float) ($item->disc_amount ?? 0);
+ $rowNet = (float) ($item->tamount ?? 0);
+ $gross += $rowGross;
+ $discount += $rowDisc;
+ $net += $rowNet;
+ ?>
+
+ = $idx + 1 ?>
+ = esc($item->item_Name ?? '-') ?>= !empty($item->formulation) ? ' / ' . esc($item->formulation) : '' ?>
+ = esc($item->batch_no ?? '-') ?>
+ = esc(number_format((float)($item->qty ?? 0), 2)) ?>
+ = esc(number_format((float)($item->price ?? 0), 2)) ?>
+ = esc(number_format($rowDisc, 2)) ?>
+ = esc(number_format($rowGross, 2)) ?>
+ = esc(number_format($rowNet, 2)) ?>
+
+
+
+
+ No items found.
+
+
+
+
+
+ Gross
+ = esc(number_format((float)($invoice->gross_amount ?? $gross), 2)) ?>
+
+
+ Discount
+ = esc(number_format((float)($invoice->disc_amount ?? $discount), 2)) ?>
+
+
+ Net Amount
+ = esc(number_format((float)($invoice->net_amount ?? $net), 2)) ?>
+
+
+
+
+
+
Prepared By: _____________________
+
Authorized Sign: _____________________
+
+
+
diff --git a/app/Views/medical/invoice_print_pdf.php b/app/Views/medical/invoice_print_pdf.php
new file mode 100644
index 0000000..e399d53
--- /dev/null
+++ b/app/Views/medical/invoice_print_pdf.php
@@ -0,0 +1,194 @@
+inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) ((int) ($invoice->id ?? 0)), -7, 7), 7, '0', STR_PAD_LEFT)));
+$invoiceDate = ! empty($invoice->inv_date) ? date('d-m-Y', strtotime((string) $invoice->inv_date)) : date('d-m-Y');
+
+$pharmacyName = defined('M_store') ? (string) M_store : 'Medical Store';
+$pharmacyAddress = defined('M_address') ? (string) M_address : '';
+$pharmacyPhone = defined('M_Phone_Number') ? (string) M_Phone_Number : '';
+$pharmacyState = defined('M_State') ? (string) M_State : '';
+$pharmacyGst = defined('H_Med_GST') ? (string) H_Med_GST : '';
+
+$customerName = trim((string) ($invoice->inv_name ?? 'Walk-in Customer'));
+$customerCode = trim((string) ($invoice->patient_code ?? ''));
+$customerPhone = trim((string) ($invoice->inv_phone_number ?? ($patient->mphone1 ?? '')));
+$doctorName = trim((string) ($invoice->doc_name ?? ''));
+
+$grossTotal = 0.0;
+$discountTotal = 0.0;
+$cgstTotal = 0.0;
+$sgstTotal = 0.0;
+$netTotal = 0.0;
+
+$compact = in_array((int) ($printFormat ?? 0), [1, 2, 3], true);
+$baseFont = $compact ? '10px' : '11px';
+$titleFont = $compact ? '16px' : '20px';
+$thPad = $compact ? '5px 4px' : '6px 5px';
+$tdPad = $compact ? '4px 4px' : '5px 5px';
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Code
+ Item Name
+ Batch
+ Exp.
+ Qty
+ Rate
+ Gross
+ Disc
+ Inc. GST
+ Net
+
+
+
+
+ $item): ?>
+ amount ?? 0);
+ $disc = (float) ($item->disc_amount ?? ($item->twdisc_amount ?? 0));
+ $net = (float) ($item->twdisc_amount ?? $item->tamount ?? ($item->net_amount ?? 0));
+
+ $cgstPer = (float) ($item->CGST_per ?? 0);
+ $sgstPer = (float) ($item->SGST_per ?? 0);
+ $gstPerTotal = $cgstPer + $sgstPer;
+
+ $cgst = (float) ($item->CGST ?? ($item->c_gst_amt ?? 0));
+ $sgst = (float) ($item->SGST ?? ($item->s_gst_amt ?? 0));
+
+ if (($cgst <= 0 || $sgst <= 0) && $gstPerTotal > 0 && $net > 0) {
+ $taxableFromInclusive = $net * 100 / (100 + $gstPerTotal);
+ $taxTotal = $net - $taxableFromInclusive;
+ $cgst = $taxTotal * ($cgstPer / $gstPerTotal);
+ $sgst = $taxTotal * ($sgstPer / $gstPerTotal);
+ } elseif (($cgst <= 0 || $sgst <= 0) && $gstPerTotal > 0 && $gross > 0) {
+ $cgst = $gross * $cgstPer / 100;
+ $sgst = $gross * $sgstPer / 100;
+ }
+
+ $grossTotal += $gross;
+ $discountTotal += $disc;
+ $cgstTotal += $cgst;
+ $sgstTotal += $sgst;
+ $netTotal += $net;
+ ?>
+
+ = (int) $index + 1 ?>
+ = esc((string) ($item->item_code ?? '-')) ?>
+ = esc((string) ($item->item_Name ?? '-')) ?>
+ = esc((string) ($item->batch_no ?? '-')) ?>
+ = esc((string) ($item->expiry ?? '-')) ?>
+ = esc(number_format((float) ($item->qty ?? 0), 2)) ?>
+ = esc(number_format((float) ($item->price ?? 0), 2)) ?>
+ = esc(number_format($gross, 2)) ?>
+ = esc(number_format($disc, 2)) ?>
+ = esc(number_format($cgst + $sgst, 2)) ?>
+ = esc(number_format($net, 2)) ?>
+
+
+
+
+ No items available.
+
+
+
+
+
+ gross_amount ?? $grossTotal);
+ $discFinal = (float) ($invoice->disc_amount ?? $discountTotal);
+ $netFinal = (float) ($invoice->net_amount ?? $netTotal);
+ ?>
+
+
+
+ Gross Total
+ ₹ = esc(number_format($grossFinal, 2)) ?>
+ Discount Total
+ ₹ = esc(number_format($discFinal, 2)) ?>
+
+
+ Inc. GST Total
+ ₹ = esc(number_format($cgstTotal + $sgstTotal, 2)) ?>
+
+
+
+
+ Net Amount
+ ₹ = esc(number_format($netFinal, 2)) ?>
+
+
+
+
+
+
+
+ Customer Signature
+ Authorized Signatory
+
+
+
+
+
diff --git a/app/Views/medical/ipd_org_list.php b/app/Views/medical/ipd_org_list.php
new file mode 100644
index 0000000..ae2e766
--- /dev/null
+++ b/app/Views/medical/ipd_org_list.php
@@ -0,0 +1,87 @@
+
+
+
+
IPD List (Current Admit)
+
+ High Balance: = (int) $highBalanceCount ?>
+
+
+
+
+
+
+
+ IPD Code
+ Name / Patient Code
+ Bed No.[Type]
+ Register Date
+ No. of Days
+ Dr. Name
+ Admit Type
+ Amount
+ Action
+
+
+
+
+
+ id ?? 0);
+ $ipdCode = (string) ($row->ipd_code ?? ('IPD-' . $ipdId));
+ $patientCode = (string) ($row->p_code ?? '-');
+ $patientName = (string) ($row->p_fname ?? '-');
+ $patientRelative = (string) ($row->p_rname ?? '');
+ $bedDesc = (string) ($row->Bed_Desc ?? ($row->bed_desc ?? '-'));
+ $regDate = (string) ($row->str_register_date ?? '');
+ if ($regDate === '' && !empty($row->register_date)) {
+ $ts = strtotime((string) $row->register_date);
+ $regDate = $ts ? date('d-m-Y', $ts) : (string) $row->register_date;
+ }
+ $noDays = (string) ($row->no_days ?? '-');
+ $docName = (string) ($row->doc_name ?? '-');
+ $admitType = (string) ($row->admit_type ?? '-');
+ $orgStatus = (string) ($row->Org_Status ?? ($row->org_status ?? ''));
+ $medAmount = (float) ($row->med_amount ?? 0);
+ ?>
+
+ = esc($ipdCode) ?>
+ [= esc($patientCode) ?>] = esc($patientName) ?>= $patientRelative !== '' ? ' ' . esc($patientRelative) : '' ?>
+ = esc($bedDesc) ?>
+ = esc($regDate !== '' ? $regDate : '-') ?>
+ = esc($noDays) ?>
+ = esc($docName) ?>
+ = esc($admitType) ?>= $orgStatus !== '' ? ' ' . esc($orgStatus) : '' ?>
+ M:= esc(number_format($medAmount, 2)) ?>
+
+ Open Invoices
+
+
+
+
+
+ No currently admitted IPD records found.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/ipd_print_report.php b/app/Views/medical/ipd_print_report.php
new file mode 100644
index 0000000..47c20cf
--- /dev/null
+++ b/app/Views/medical/ipd_print_report.php
@@ -0,0 +1,607 @@
+ 'IPD Medical Invoice (Cash)',
+ 'cash-return' => 'IPD Medical Invoice (Cash With Return)',
+ 'credit' => 'IPD Medical Invoice (Credit)',
+ 'package' => 'IPD Medical Invoice (Package)',
+ 'med-list' => 'Consolidated Medicine List',
+ 'med-list-date' => 'Medicine List Datewise',
+ 'pagewise' => 'IPD Medical Invoice (Page Wise)',
+ 'return-list' => 'Return Medicine List',
+];
+
+$title = $modeTitleMap[$mode] ?? 'IPD Medical Print';
+$ipdCode = (string) ($ipd->ipd_code ?? ('IPD-' . (int) ($ipdId ?? 0)));
+$isPdf = (bool) ($isPdf ?? false);
+
+$pharmacyName = defined('M_store') ? (string) M_store : 'Medical Store';
+$pharmacyAddress = defined('M_address') ? (string) M_address : '';
+$pharmacyPhone = defined('M_Phone_Number') ? (string) M_Phone_Number : '';
+$pharmacyEmail = defined('H_Email') ? (string) H_Email : '';
+$pharmacyGst = defined('H_Med_GST') ? (string) H_Med_GST : '';
+$pharmacyLic = defined('M_LIC') ? (string) M_LIC : '';
+
+$patientName = trim((string) ($patient->p_fname ?? ($ipd->p_name ?? '-')));
+$patientCode = trim((string) ($patient->p_code ?? '-'));
+$doctorName = trim((string) ($ipd->doc_name ?? '-'));
+$orgCode = trim((string) ($orgCase->case_id_code ?? '-'));
+$orgName = trim((string) ($orgCase->insurance_company_name ?? '-'));
+
+$invoiceMap = [];
+foreach (($invoices ?? []) as $inv) {
+ $invoiceMap[(int) ($inv->id ?? 0)] = $inv;
+}
+
+$itemsByInvoice = $itemsByInvoice ?? [];
+$invoiceItemTotals = $invoiceItemTotals ?? [];
+$invoiceTotals = $invoiceTotals ?? ['gross' => 0, 'discount' => 0, 'net' => 0, 'balance' => 0];
+$itemTotals = $itemTotals ?? ['qty' => 0, 'amount' => 0];
+$itemsByDate = $itemsByDate ?? [];
+$paymentHistory = $paymentHistory ?? [];
+$paymentSummary = $paymentSummary ?? [
+ 'total_received' => 0.0,
+ 'balance' => (float) ($invoiceTotals['net'] ?? 0),
+];
+
+$abs = static function ($value): float {
+ return abs((float) $value);
+};
+
+$fmtDate = static function ($value, string $format = 'd-m-Y'): string {
+ if (empty($value)) {
+ return '-';
+ }
+ $ts = strtotime((string) $value);
+ return $ts ? date($format, $ts) : '-';
+};
+
+$fmtMoney = static function ($value): string {
+ return number_format((float) $value, 2);
+};
+
+$docType = in_array($mode, ['med-list', 'med-list-date', 'return-list'], true) ? 'LIST REPORT' : 'TAX INVOICE';
+?>
+
+
+
+
+
+
+
+ = esc($pharmacyName) ?>
+
+ = esc($pharmacyAddress) ?>
+ | Phone: = esc($pharmacyPhone) ?>
+ | Email: = esc($pharmacyEmail) ?>
+ GST: = esc($pharmacyGst) ?>
+ | L.No: = esc($pharmacyLic) ?>
+
+ = esc($title) ?>
+
+
+
+
+ Patient
+ : = esc($patientName !== '' ? $patientName : '-') ?>
+
+
+ UHID
+ : = esc($patientCode !== '' ? $patientCode : '-') ?>
+
+
+ IPD Code
+ : = esc($ipdCode) ?>
+
+
+ Refer By
+ : = esc($doctorName !== '' ? $doctorName : '-') ?>
+
+ org_id ?? 0) > 0): ?>
+
+ Org. Code
+ : = esc($orgCode) ?>
+
+
+ Org. Name
+ : = esc($orgName) ?>
+
+
+
+ Printed On
+ : = esc(date('d-m-Y H:i')) ?>
+
+
+
+
+
+
+
+
+
+
+
+ IPD: = esc($ipdCode) ?> | UHID: = esc($patientCode !== '' ? $patientCode : '-') ?>
+ Page {PAGENO}/{nbpg}
+
+
+
+
+
+
+
= esc($title) ?> (= esc($ipdCode) ?>)
+
+
+
+
+
+
+
+
+ $dateItems): ?>
+ Date: = esc($fmtDate($dateKey, 'd-m-Y')) ?>
+
+
+
+ #
+ Invoice
+ Item Name
+ Batch
+ Exp.
+ Qty
+ Rate
+ Amount
+
+
+
+
+ $item): ?>
+ inv_med_id ?? 0);
+ $inv = $invoiceMap[$invId] ?? null;
+ $invCode = (string) ($inv->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) $invId, -7, 7), 7, '0', STR_PAD_LEFT)));
+ $amt = (float) ($item->tamount ?? $item->amount ?? 0);
+ $dateAmount += $amt;
+ ?>
+
+ = (int) $index + 1 ?>
+ = esc($invCode) ?>
+ = esc(trim((string) (($item->item_Name ?? '-') . ' ' . ($item->formulation ?? '')))) ?>
+ = esc((string) ($item->batch_no ?? '-')) ?>
+ = esc($fmtDate($item->expiry, 'm-Y')) ?>
+ = esc($fmtMoney($item->qty ?? 0)) ?>
+ = esc($fmtMoney($item->price ?? 0)) ?>
+ = esc($fmtMoney($amt)) ?>
+
+
+
+ Date Total
+ = esc($fmtMoney($dateAmount)) ?>
+
+
+
+
+
+
+
+
+ #
+ Invoice
+ Date
+ Item Name
+ Batch
+ Exp.
+ Qty
+ Rate
+ Amount
+
+
+
+
+ $item): ?>
+ inv_med_id ?? 0);
+ $inv = $invoiceMap[$invId] ?? null;
+ $invCode = (string) ($inv->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) $invId, -7, 7), 7, '0', STR_PAD_LEFT)));
+ $invDate = $inv->inv_date ?? null;
+ $amount = (float) ($item->tamount ?? $item->amount ?? 0);
+ if ($mode === 'return-list') {
+ $amount = -1 * $abs($amount);
+ }
+ ?>
+
+ = (int) $index + 1 ?>
+ = esc($invCode) ?>
+ = esc($fmtDate($invDate)) ?>
+ = esc(trim((string) (($item->item_Name ?? '-') . ' ' . ($item->formulation ?? '')))) ?>
+ = esc((string) ($item->batch_no ?? '-')) ?>
+ = esc($fmtDate($item->expiry, 'm-Y')) ?>
+ = esc($fmtMoney($item->qty ?? 0)) ?>
+ = esc($fmtMoney($item->price ?? 0)) ?>
+ = esc($fmtMoney($amount)) ?>
+
+
+
+ No rows found.
+
+
+
+
+ Total
+ = esc($fmtMoney($itemTotals['qty'] ?? 0)) ?>
+
+ = esc($fmtMoney($itemTotals['amount'] ?? 0)) ?>
+
+
+
+
+
+
+ $invoice): ?>
+ id ?? 0);
+ $invoiceCode = (string) ($invoice->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) $invoiceId, -7, 7), 7, '0', STR_PAD_LEFT)));
+ $invoiceDate = $fmtDate($invoice->inv_date ?? null);
+ $invoiceItems = $itemsByInvoice[$invoiceId] ?? [];
+ $invTotals = $invoiceItemTotals[$invoiceId] ?? ['qty' => 0, 'gross' => 0, 'discount' => 0, 'gst' => 0, 'net' => 0];
+ $netAmount = (float) ($invoice->net_amount ?? $invTotals['net']);
+ ?>
+
+
+ Invoice: = esc($invoiceCode) ?>
+ Date: = esc($invoiceDate) ?> | Type: = ((int) ($invoice->ipd_credit ?? 0) > 0) ? 'Credit' : 'Cash' ?>
+
+
+
+
+
+ #
+ Item Name
+ Batch
+ Exp.
+ Qty
+ Rate
+ Gross
+ Disc.
+ Inc. GST
+ Net
+
+
+
+
+ $item): ?>
+ amount ?? 0);
+ $disc = (float) (($item->disc_amount ?? 0) + ($item->disc_whole ?? 0));
+ if ($disc == 0.0) {
+ $disc = (float) ($item->twdisc_amount ?? 0) > 0 ? ($gross - (float) ($item->twdisc_amount ?? 0)) : 0.0;
+ }
+ $net = (float) ($item->twdisc_amount ?? ($item->tamount ?? $gross));
+
+ $cgstPer = (float) ($item->CGST_per ?? 0);
+ $sgstPer = (float) ($item->SGST_per ?? 0);
+ $gstPer = $cgstPer + $sgstPer;
+ $cgst = (float) ($item->CGST ?? 0);
+ $sgst = (float) ($item->SGST ?? 0);
+
+ if (($cgst + $sgst) <= 0.0 && $gstPer > 0.0 && $net > 0.0) {
+ $taxableFromInclusive = $net * 100 / (100 + $gstPer);
+ $taxTotal = $net - $taxableFromInclusive;
+ $cgst = $taxTotal * ($cgstPer / $gstPer);
+ $sgst = $taxTotal * ($sgstPer / $gstPer);
+ }
+
+ $rowIsReturn = ((float) ($item->amount ?? 0) < 0)
+ || ((float) ($item->tamount ?? 0) < 0)
+ || ((int) ($item->sale_return ?? 0) === 1);
+ ?>
+
+ = (int) $rowIndex + 1 ?>
+ = esc(trim((string) (($item->item_Name ?? '-') . ' ' . ($item->formulation ?? '')))) ?>
+ = esc((string) ($item->batch_no ?? '-')) ?>
+ = esc($fmtDate($item->expiry, 'm-Y')) ?>
+ = esc($fmtMoney($item->qty ?? 0)) ?>
+ = esc($fmtMoney($item->price ?? 0)) ?>
+ = esc($fmtMoney($gross)) ?>
+ = esc($fmtMoney($disc)) ?>
+ = esc($fmtMoney($cgst + $sgst)) ?>
+ = esc($fmtMoney($net)) ?>
+
+
+
+ No item rows available.
+
+
+ Invoice Total
+ = esc($fmtMoney($invTotals['qty'] ?? 0)) ?>
+
+ = esc($fmtMoney($invTotals['gross'] ?? 0)) ?>
+ = esc($fmtMoney($invTotals['discount'] ?? 0)) ?>
+ = esc($fmtMoney($invTotals['gst'] ?? 0)) ?>
+ = esc($fmtMoney($invTotals['net'] ?? 0)) ?>
+
+
+
+
+
+
+ Gross Amount
+ ₹ = esc($fmtMoney($invoice->gross_amount ?? $invTotals['gross'])) ?>
+ Discount
+ ₹ = esc($fmtMoney((($invoice->disc_amount ?? 0) + ($invoice->discount_amount ?? 0)))) ?>
+ Inc. GST
+ ₹ = esc($fmtMoney($invTotals['gst'] ?? 0)) ?>
+
+
+ Net Amount
+ ₹ = esc($fmtMoney($netAmount)) ?>
+
+
+
+
+
+
+
+
+
+ Grand Summary
+
+
+ Gross Total
+ ₹ = esc($fmtMoney($invoiceTotals['gross'] ?? 0)) ?>
+ Discount Total
+ ₹ = esc($fmtMoney($invoiceTotals['discount'] ?? 0)) ?>
+
+
+ Net Total
+ ₹ = esc($fmtMoney($invoiceTotals['net'] ?? 0)) ?>
+ Total Payment Received
+ ₹ = esc($fmtMoney($paymentSummary['total_received'] ?? 0)) ?>
+
+
+ Balance Total
+ ₹ = esc($fmtMoney($paymentSummary['balance'] ?? ($invoiceTotals['balance'] ?? 0))) ?>
+
+
+
+
+
+ No invoices found for selected print mode.
+
+
+
+
+ Payment Details
+
+
+
+ #
+ Date
+ Mode
+ Ref No
+ Remark
+ Amount
+ Signed Amount
+
+
+
+
+
+ payment_mode ?? 1) === 2) ? 'Bank Card' : 'Cash';
+ if ((int) ($pay->payment_mode ?? 0) > 2) {
+ $payMode = 'Other';
+ }
+ if ((int) ($pay->credit_debit ?? 0) > 0) {
+ $payMode .= ' Return';
+ }
+ $signed = (float) ($pay->paid_amount ?? $pay->amount ?? 0);
+ $payTotal += $signed;
+ ?>
+
+ = esc((string) ($pay->id ?? '-')) ?>
+ = esc($fmtDate($pay->payment_date ?? $pay->entry_date ?? null, 'd-m-Y H:i')) ?>
+ = esc($payMode) ?>
+ = esc((string) ($pay->card_trans_id ?? $pay->card_tran_id ?? '-')) ?>
+ = esc((string) ($pay->payment_desc ?? $pay->payment_remark ?? '-')) ?>
+ = esc($fmtMoney($pay->amount ?? 0)) ?>
+ = esc($fmtMoney($signed)) ?>
+
+
+
+ Total Paid (Signed)
+ = esc($fmtMoney($payTotal)) ?>
+
+
+
+
+
+
+ This is a computer-generated document. Please verify medicine name, batch, and quantity at issue time.
+
+
+
+
+ Patient/Relative Signature
+ For = esc($pharmacyName) ?> (Authorized Signatory)
+
+
diff --git a/app/Views/medical/ipd_return_medicine.php b/app/Views/medical/ipd_return_medicine.php
new file mode 100644
index 0000000..c06fc93
--- /dev/null
+++ b/app/Views/medical/ipd_return_medicine.php
@@ -0,0 +1,143 @@
+id ?? 0);
+ $ipdCode = (string) ($ipd->ipd_code ?? ('IPD-' . $ipdId));
+ $patientName = (string) ($patient->p_fname ?? '-');
+ $patientCode = (string) ($patient->p_code ?? '-');
+ $modeLabel = (string) ($modeLabel ?? 'Medicine Reurn');
+
+ $totalInvoices = !empty($invoices) ? count($invoices) : 0;
+ $totalItems = 0;
+ $totalReturnedItems = 0;
+ foreach (($invoices ?? []) as $invRow) {
+ $invId = (int) ($invRow->id ?? 0);
+ $totalItems += (int) ($itemCountMap[$invId] ?? 0);
+ $totalReturnedItems += (int) ($returnCountMap[$invId] ?? 0);
+ }
+ $pendingItems = max(0, $totalItems - $totalReturnedItems);
+?>
+
+
+
+
+
+
+
Patient Code : = esc($patientCode) ?> /
+
Customer Name : = esc($patientName) ?> /
+
IPD Code :
+
= esc($ipdCode) ?>
+
+
+
+ Search Invoice / Code
+
+
+
+
+
+
+
Invoices
+
= esc((string) $totalInvoices) ?>
+
+
+
+
+
Total Items
+
= esc((string) $totalItems) ?>
+
+
+
+
+
Returned Items
+
= esc((string) $totalReturnedItems) ?>
+
+
+
+
+
Pending
+
= esc((string) $pendingItems) ?>
+
+
+
+
+
+
+
+
+ #
+ Invoice ID
+ Date
+ Total Items
+ Returned Items
+ Status
+ Net Amount
+ Action
+
+
+
+
+ $row): ?>
+ id ?? 0);
+ $totalItems = (int) ($itemCountMap[$invId] ?? 0);
+ $returnedItems = (int) ($returnCountMap[$invId] ?? 0);
+ $pendingForInvoice = max(0, $totalItems - $returnedItems);
+ ?>
+
+ = $i + 1 ?>
+ = esc($row->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) $invId, -7, 7), 7, '0', STR_PAD_LEFT))) ?>
+ = esc(!empty($row->inv_date) ? date('Y-m-d', strtotime((string)$row->inv_date)) : '-') ?>
+ = esc((string) $totalItems) ?>
+ = esc((string) $returnedItems) ?>
+
+ 0): ?>
+ Pending = esc((string) $pendingForInvoice) ?>
+
+ Completed
+
+
+ = esc(number_format((float)($row->net_amount ?? 0), 2)) ?>
+
+ Open Bill For Return
+ Final View
+
+
+
+
+
+ No invoices found for this IPD.
+
+
+
+
+
+
+
+ Open bill for return, then use right-side R.Qty flow to add return items.
+
+
+
+
+
diff --git a/app/Views/medical/main_store_dashboard.php b/app/Views/medical/main_store_dashboard.php
new file mode 100644
index 0000000..d32e480
--- /dev/null
+++ b/app/Views/medical/main_store_dashboard.php
@@ -0,0 +1,69 @@
+
+
Store Main Panel
+
+
+
diff --git a/app/Views/medical/master.php b/app/Views/medical/master.php
new file mode 100644
index 0000000..154016b
--- /dev/null
+++ b/app/Views/medical/master.php
@@ -0,0 +1,123 @@
+
+
Pharmacy Master Panel
+
+
+ Medical Store
+ Master
+
+
+
+
+
diff --git a/app/Views/medical/master_report.php b/app/Views/medical/master_report.php
new file mode 100644
index 0000000..f338164
--- /dev/null
+++ b/app/Views/medical/master_report.php
@@ -0,0 +1,35 @@
+
+
+
+
= esc($title ?? 'Master Report') ?>
+
Back to Master
+
+
+
+
= esc($note) ?>
+
+
+
+
+
+
+
+
+ = esc((string) $col) ?>
+
+
+
+
+
+
+
+ = esc((string) ($row[$col] ?? '')) ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/med_model_payment.php b/app/Views/medical/med_model_payment.php
new file mode 100644
index 0000000..aad4e09
--- /dev/null
+++ b/app/Views/medical/med_model_payment.php
@@ -0,0 +1,219 @@
+id ?? 0);
+ $patientName = (string) ($patient->p_fname ?? '-');
+ $patientRelative = (string) ($patient->p_rname ?? '');
+ $patientCode = (string) ($patient->p_code ?? '-');
+ $genderValue = (string) ($patient->xgender ?? ($patient->gender ?? ''));
+ if ($genderValue === '1') {
+ $genderValue = 'Male';
+ } elseif ($genderValue === '0' || $genderValue === '2') {
+ $genderValue = 'Female';
+ }
+ $patientAge = '';
+ if (!empty($patient)) {
+ $patientAge = get_age_1(
+ $patient->dob ?? null,
+ $patient->age ?? '',
+ $patient->age_in_month ?? '',
+ $patient->estimate_dob ?? '',
+ $ipd->register_date ?? null
+ );
+ }
+ $ipdCode = (string) ($ipd->ipd_code ?? ('IPD-' . $ipdId));
+ $groupId = (int) ($group->med_group_id ?? 0);
+ $netAmount = (float) ($paymentSummary['net_amount'] ?? ($group->net_amount ?? 0));
+ $paidAmount = (float) ($paymentSummary['paid_amount'] ?? ($group->payment_received ?? 0));
+ $balanceAmount = (float) ($paymentSummary['balance_amount'] ?? ($group->payment_balance ?? ($netAmount - $paidAmount)));
+?>
+
+
+
+
+
+
+ Name : = esc($patientName) ?>= $patientRelative !== '' ? ' {' . esc($patientRelative) . '}' : '' ?> /
+ Age : = esc($patientAge !== '' ? $patientAge : '-') ?> /
+ Gender : = esc($genderValue !== '' ? $genderValue : '-') ?> /
+ Patient Code / UHID : = esc($patientCode) ?> /
+ IPD Code : = esc($ipdCode) ?>
+
+
+
+
+
+
+
+
+
+ Date of Payment
+
+
+
+ Type
+
+ Credit Amount
+ Debit / Return Amount
+
+
+
+ Amount
+
+
+
+ Remark
+
+
+
+
+
+
Cash
+
Confirm Cash Payment
+
+
+
+
Credit / Debit Card
+
+
+ Payment By
+
+
+
+ = esc(($row->pay_type ?? 'Source') . (!empty($row->bank_name) ? ' [' . $row->bank_name . ']' : '')) ?>
+
+
+ Default
+
+
+
+
+ Tran. ID / Ref.
+
+
+
+ Confirm Card Payment
+
+
+
+
+
Use Debit/Return when refunding amount.
+
+
+
+
+
+
+
+
+
Pharmacy Bill Amount: Rs. = esc(number_format($netAmount, 2)) ?>
+
Total Amount Paid: Rs. = esc(number_format($paidAmount, 2)) ?>
+
Balance Amount: Rs. = esc(number_format($balanceAmount, 2)) ?>
+
+
+
+
+
+
+
+
+
+
+ Pay.No.
+ Mode
+ Date
+ Amount
+
+
+
+
+
+
+ = esc((string) ($row->id ?? '')) ?>
+ = esc($row->Payment_type_str ?? '-') ?>
+ = esc(!empty($row->payment_date) ? date('d-m-Y', strtotime((string) $row->payment_date)) : '-') ?>
+ = esc(number_format((float) ($row->paid_amount ?? 0), 2)) ?>
+
+
+
+ No payment entries.
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/medical_final_invoice.php b/app/Views/medical/medical_final_invoice.php
new file mode 100644
index 0000000..d397af4
--- /dev/null
+++ b/app/Views/medical/medical_final_invoice.php
@@ -0,0 +1,419 @@
+id ?? 0);
+ $balance = (float) ($paymentSummary['balance'] ?? 0);
+ $net = (float) ($paymentSummary['net'] ?? ($invoice->net_amount ?? 0));
+ $paid = (float) ($paymentSummary['paid'] ?? ($invoice->payment_received ?? 0));
+ $deduction = (float) ($paymentSummary['extra_discount'] ?? ($invoice->discount_amount ?? 0));
+ $deductionRemark = (string) ($paymentSummary['discount_remark'] ?? ($invoice->discount_remark ?? ''));
+ $allowPaymentMode = ((int) ($invoice->ipd_credit ?? 0) === 0) && ((int) ($invoice->case_credit ?? 0) === 0) && ((int) ($invoice->group_invoice_id ?? 0) === 0);
+?>
+
+
+
+
+
+
+
= esc($message) ?>
+
+
+
+
+
Name : = esc($invoice->inv_name ?? '-') ?> /
+
P Code : = esc($invoice->patient_code ?? '-') ?> /
+
Invoice No. : = esc($invoice->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) $invoiceId, -7, 7), 7, '0', STR_PAD_LEFT))) ?> /
+
Date : = esc(!empty($invoice->inv_date) ? date('d/m/Y', strtotime((string)$invoice->inv_date)) : '-') ?>
+ ipd_code)): ?> /
IPD : = esc($ipd->ipd_code) ?>
+ case_id_code)): ?> /
Org Case : = esc($orgCase->case_id_code) ?>
+
+
Open Bill For Edit
+
+
+
Open Bill For Edit
+
+
+
+
+
+
+
+
+
+ #
+ Item code
+ Item Name
+ Formulation
+ Batch No
+ Exp.
+ Rate
+ Qty.
+ Gross
+ Disc.
+ HSNCODE/GST%
+ Inc. GST
+ Net Amount
+
+
+
+
+
+ $item): ?>
+ twdisc_amount ?? $item->tamount ?? $item->amount ?? 0);
+ $lineBase = (float) ($item->amount ?? 0);
+ $cgstPer = (float) ($item->CGST_per ?? 0);
+ $sgstPer = (float) ($item->SGST_per ?? 0);
+
+ $cgstValue = (float) ($item->CGST ?? ($item->c_gst_amt ?? 0));
+ $sgstValue = (float) ($item->SGST ?? ($item->s_gst_amt ?? 0));
+
+ $gstPerTotal = $cgstPer + $sgstPer;
+ if (($cgstValue <= 0 || $sgstValue <= 0) && $gstPerTotal > 0 && $lineNet > 0) {
+ $taxableFromInclusive = $lineNet * 100 / (100 + $gstPerTotal);
+ $taxTotal = $lineNet - $taxableFromInclusive;
+ $cgstValue = $taxTotal * ($cgstPer / $gstPerTotal);
+ $sgstValue = $taxTotal * ($sgstPer / $gstPerTotal);
+ } elseif (($cgstValue <= 0 || $sgstValue <= 0) && $gstPerTotal > 0 && $lineBase > 0) {
+ $cgstValue = $lineBase * $cgstPer / 100;
+ $sgstValue = $lineBase * $sgstPer / 100;
+ }
+
+ $rowCgstTotal += (float) $cgstValue;
+ $rowSgstTotal += (float) $sgstValue;
+ ?>
+
+ = $i + 1 ?>
+ = esc($item->item_code ?? '-') ?>
+ = esc($item->item_Name ?? '-') ?>
+ = esc($item->formulation ?? '-') ?>
+ = esc($item->batch_no ?? '-') ?>
+ = esc(!empty($item->expiry) ? date('Y-m-d', strtotime((string)$item->expiry)) : '-') ?>
+ = esc(number_format((float)($item->price ?? 0), 2)) ?>
+ = esc(number_format((float)($item->qty ?? 0), 2)) ?>
+ = esc(number_format((float)($item->amount ?? 0), 2)) ?>
+ = esc(number_format((float)($item->disc_whole ?? $item->disc_amount ?? 0), 2)) ?>
+ = esc(($item->HSNCODE ?? '-') . '/' . number_format((float) (($item->CGST_per ?? 0) + ($item->SGST_per ?? 0)), 2)) ?>
+ = esc(number_format($cgstValue + $sgstValue, 2)) ?>
+ = esc(number_format((float)($item->twdisc_amount ?? $item->tamount ?? 0), 2)) ?>
+
+
+
+ No item rows.
+
+
+
+ CGST_Tamount ?? 0);
+ $invoiceSgstTotal = (float) ($invoice->SGST_Tamount ?? 0);
+ if ($invoiceCgstTotal <= 0 && $rowCgstTotal > 0) {
+ $invoiceCgstTotal = $rowCgstTotal;
+ }
+ if ($invoiceSgstTotal <= 0 && $rowSgstTotal > 0) {
+ $invoiceSgstTotal = $rowSgstTotal;
+ }
+ ?>
+
+ #
+ Gross Total
+ = esc(number_format((float)($invoice->gross_amount ?? 0), 2)) ?>
+ = esc(number_format((float)($invoice->disc_amount ?? 0), 2)) ?>
+
+ = esc(number_format($invoiceCgstTotal + $invoiceSgstTotal, 2)) ?>
+ = esc(number_format($net, 2)) ?>
+
+
+
+
+
+
+
+
+
+
+ #
+ Amount received : = esc(number_format($paid, 2)) ?>
+
+
+ [= esc($pay->id ?? '-') ?>:= esc($pay->Payment_type_str ?? '-') ?>:= esc(number_format((float)($pay->paid_amount ?? 0), 2)) ?>:= esc($pay->payment_date ?? '-') ?>]
+
+
+
+ Balance Amount : = esc(number_format($balance, 2)) ?>
+ Net Amount : = esc(number_format($net, 2)) ?>
+
+
+
+
+ 0.0001): ?>
+
+ Received Amount
+
+
+
+
+
+
Payment Mode
+ 0): ?>
+
+
+
+ Confirm Cash Received and Print Receipt
+
+
+
+
+
+
+
+
+ Payment By
+
+
+
+ = esc(($source->pay_type ?? 'Bank') . ' [' . ($source->bank_name ?? '-') . ']') ?>
+
+
+ Bank
+
+
+
+
+ Tran. ID/Ref.
+
+
+
+ Confirm Payment
+
+
+
+
+
+
+
+
+ Confirm Cash Return and Print Receipt
+
+
+
+
+
+
+
+
+
+
+
+= csrf_field() ?>
+
+
diff --git a/app/Views/medical/medical_invoice_list.php b/app/Views/medical/medical_invoice_list.php
new file mode 100644
index 0000000..f53039c
--- /dev/null
+++ b/app/Views/medical/medical_invoice_list.php
@@ -0,0 +1,298 @@
+id ?? 0);
+ $ipdCode = (string) ($ipd->ipd_code ?? ('IPD-' . $ipdId));
+ $patientName = (string) ($patient->p_fname ?? '-');
+ $patientRelative = (string) ($patient->p_rname ?? '');
+ $patientCode = (string) ($patient->p_code ?? '-');
+ $age = '';
+ if (!empty($patient)) {
+ $age = get_age_1(
+ $patient->dob ?? null,
+ $patient->age ?? '',
+ $patient->age_in_month ?? '',
+ $patient->estimate_dob ?? '',
+ $ipd->register_date ?? null
+ );
+ }
+ $genderValue = (string) ($patient->xgender ?? ($patient->gender ?? ''));
+ if ($genderValue === '1') {
+ $genderValue = 'Male';
+ } elseif ($genderValue === '0' || $genderValue === '2') {
+ $genderValue = 'Female';
+ }
+
+ $admitDate = '';
+ if (!empty($ipd->register_date)) {
+ $ts = strtotime((string) $ipd->register_date);
+ $admitDate = $ts ? date('d-m-Y H:i', $ts) : (string) $ipd->register_date;
+ }
+
+ $dischargeDate = '';
+ if (!empty($ipd->discharge_date)) {
+ $ts = strtotime((string) $ipd->discharge_date);
+ $dischargeDate = $ts ? date('d-m-Y H:i', $ts) : (string) $ipd->discharge_date;
+ }
+
+ $noDays = 0;
+ if (!empty($ipd->register_date)) {
+ $noDays = max(1, (int) floor((time() - strtotime((string) $ipd->register_date)) / 86400));
+ }
+
+ $docName = (string) ($ipd->doc_name ?? '-');
+ $status = ((int) ($ipd->ipd_status ?? 0) === 0) ? 'Admit' : 'Discharge';
+ $lockMedical = (int) ($ipd->lock_medical ?? 0);
+?>
+
+
+
+
+
+
+
+ Name : = esc($patientName) ?> = $patientRelative !== '' ? '{' . esc($patientRelative) . '}' : '' ?>
+ / Age : = esc($age !== '' ? $age : '-') ?>
+ / Gender : = esc($genderValue !== '' ? $genderValue : '-') ?>
+ / P Code : = esc($patientCode) ?>
+
+
+
+ IPD Code : = esc($ipdCode) ?>
+ Admit Date : = esc($admitDate !== '' ? $admitDate : '-') ?>
+ / Discharge Date : = esc($dischargeDate !== '' ? $dischargeDate : '-') ?>
+ / No. of Days : = esc((string) $noDays) ?>
+ / Status : = esc($status) ?>
+
+
+
+
+
+
+ #
+ Invoice ID.
+ Inv.Date
+ Inv.Desc
+ Credit/Cash
+ Package
+ Amount
+ Action
+
+
+
+
+ $row): ?>
+ id ?? 0);
+ $ipdCredit = (int)($row->ipd_credit ?? 0);
+ $groupInvoiceId = (int)($row->group_invoice_id ?? 0);
+ $creditText = ($ipdCredit > 0) ? 'Credit' : 'CASH';
+ $packageText = ($ipdCredit > 0 && $groupInvoiceId > 0) ? 'Yes' : 'No';
+ $editMeta = $invoiceEditMeta[$invoiceId] ?? ['can_edit' => true, 'reason' => ''];
+ $canEditRow = !empty($editMeta['can_edit']);
+ $editReason = (string) ($editMeta['reason'] ?? 'Invoice is view-only.');
+ ?>
+
+ = $i + 1 ?>
+ = esc($row->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) $invoiceId, -7, 7), 7, '0', STR_PAD_LEFT))) ?>
+ = esc(!empty($row->inv_date) ? date('Y-m-d', strtotime((string)$row->inv_date)) : '-') ?>
+ = esc($row->remark_ipd ?? '-') ?>
+ = esc($creditText) ?>
+ = esc($packageText) ?>
+ = esc(number_format((float)($row->net_amount ?? 0), 2)) ?>
+
+
+ Edit
+
+ Edit
+
+
+ PDF
+
+ PDF
+
+
+
+
+
+
+ No invoices found for this IPD.
+
+
+
+
+
+ Total Cash : = esc(number_format((float)($cashTotal ?? 0), 2)) ?>
+
+ / Total Balance : = esc(number_format((float)($balanceTotal ?? 0), 2)) ?>
+ / Total CASH Discount : = esc(number_format((float)($discountTotal ?? 0), 2)) ?>
+
+
+
+ Total Credit : = esc(number_format((float)($creditTotal ?? 0), 2)) ?>
+ / Total Package : = esc(number_format((float)($packageTotal ?? 0), 2)) ?>
+ / Total Amount : = esc(number_format((float)($amountTotal ?? 0), 2)) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+= csrf_field() ?>
+
+
diff --git a/app/Views/medical/medical_org_invoicelist.php b/app/Views/medical/medical_org_invoicelist.php
new file mode 100644
index 0000000..cd85f15
--- /dev/null
+++ b/app/Views/medical/medical_org_invoicelist.php
@@ -0,0 +1,106 @@
+id ?? 0);
+$orgCode = (string) ($orgcase->case_id_code ?? ('ORG-' . $orgId));
+$patientName = (string) ($orgcase->p_fname ?? '-');
+$patientRel = (string) ($orgcase->p_rname ?? '');
+$patientCode = (string) ($orgcase->p_code ?? '-');
+$insuranceName = (string) ($orgcase->insurance_company_name ?? '-');
+$amountTotal = (float) ($totals['amount_total'] ?? 0);
+$balanceTotal = (float) ($totals['balance_total'] ?? 0);
+$hasRows = !empty($invoices);
+?>
+
+
+
+
+
+
+ Name : = esc($patientName) ?>= $patientRel !== '' ? ' {' . esc($patientRel) . '}' : '' ?>
+ / P Code : = esc($patientCode) ?>
+ / Insurance : = esc($insuranceName) ?>
+
+
+
+
+
+
+ #
+ Invoice ID
+ Inv.Date
+ Inv.Desc
+ Credit/Cash
+ Amount
+ Balance
+ Action
+
+
+
+
+ $row): ?>
+ id ?? 0); ?>
+
+ = $i + 1 ?>
+ = esc((string) ($row->inv_med_code ?? ('M' . date('ym') . str_pad((string) $invoiceId, 7, '0', STR_PAD_LEFT)))) ?>
+ = esc(!empty($row->inv_date) ? date('d-m-Y', strtotime((string) $row->inv_date)) : '-') ?>
+ = esc((string) ($row->remark_ipd ?? '-')) ?>
+ = ((int) ($row->case_credit ?? 0) > 0) ? 'CREDIT' : 'CASH' ?>
+ = esc(number_format((float) ($row->net_amount ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->payment_balance ?? 0), 2)) ?>
+
+ Edit
+ PDF
+
+
+
+
+
+
+
+
+ No org credit invoices found for this case.
+
+
+
+
+
+
+
+
+
+
+
+ Total Amount: = esc(number_format($amountTotal, 2)) ?>
+ / Total Balance: = esc(number_format($balanceTotal, 2)) ?>
+
+
+
+
+
diff --git a/app/Views/medical/medicine_category_edit.php b/app/Views/medical/medicine_category_edit.php
new file mode 100644
index 0000000..ff25214
--- /dev/null
+++ b/app/Views/medical/medicine_category_edit.php
@@ -0,0 +1,57 @@
+id ?? 0);
+ $medCatDesc = (string) ($row->med_cat_desc ?? '');
+}
+?>
+
+
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+ Medicine Category Name
+
+
+
+
+ Add & Update Category
+
+
+
+
+
+
diff --git a/app/Views/medical/medicine_category_master.php b/app/Views/medical/medicine_category_master.php
new file mode 100644
index 0000000..117fa1f
--- /dev/null
+++ b/app/Views/medical/medicine_category_master.php
@@ -0,0 +1,17 @@
+
+
+
+
Medicine Category Master
+ Add New
+
+
+
+
+
+ = view('medical/medicine_category_sub', ['med_product_cat_master' => $med_product_cat_master ?? []]) ?>
+
+
+
+
+
+
diff --git a/app/Views/medical/medicine_category_sub.php b/app/Views/medical/medicine_category_sub.php
new file mode 100644
index 0000000..f730898
--- /dev/null
+++ b/app/Views/medical/medicine_category_sub.php
@@ -0,0 +1,32 @@
+
+
+
+ Category Name
+ Action
+
+
+
+
+
+ = esc($row->med_cat_desc ?? '') ?>
+
+ Edit
+
+
+
+
+
+
+
diff --git a/app/Views/medical/merge_product.php b/app/Views/medical/merge_product.php
new file mode 100644
index 0000000..ee1cff3
--- /dev/null
+++ b/app/Views/medical/merge_product.php
@@ -0,0 +1,152 @@
+
+
+
+
Product Merge
+
Back to Master
+
+
+
+
+
+
+ From Product ID
+
+
+
+
+
+
+ To Product ID
+
+
+
+
+
+
+ Merge Product
+
+
+
+
+
Recent Product Merge Logs
+
+
+
+
+ ID
+ Summary
+ By
+ At
+
+
+
+ Loading...
+
+
+
+
+
+
+
diff --git a/app/Views/medical/mini_invoice.php b/app/Views/medical/mini_invoice.php
new file mode 100644
index 0000000..21b2db0
--- /dev/null
+++ b/app/Views/medical/mini_invoice.php
@@ -0,0 +1,130 @@
+
+
+
+
+
Already Created Today
+
Add New Invoice
+
+
+
+
+
+
+ #
+ Invoice
+ Date
+ Net Amount
+ Action
+
+
+
+
+ $inv): ?>
+ id ?? 0);
+ $editMeta = $invoiceEditMeta[$invId] ?? ['can_edit' => true, 'reason' => ''];
+ $canEditRow = !empty($editMeta['can_edit']);
+ $editReason = (string) ($editMeta['reason'] ?? 'Invoice is view-only.');
+ ?>
+
+ = (int)$idx + 1 ?>
+ = esc($inv->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) $invId, -7, 7), 7, '0', STR_PAD_LEFT))) ?>
+ = esc($inv->inv_date ?? '-') ?>
+ = esc(number_format((float)($inv->net_amount ?? 0), 2)) ?>
+
+
+ Edit
+
+ Edit
+
+
+
+
+
+
+
+
+ #
+ Item
+ Batch/Exp.
+ Rate
+ Qty
+ Net Amt.
+
+
+
+
+
+ $item): ?>
+
+ = (int)$i + 1 ?>
+ = esc($item->item_Name ?? '-') ?>
+ = esc($item->batch_no ?? '-') ?> / = esc(!empty($item->expiry) ? date('m-Y', strtotime((string)$item->expiry)) : '-') ?>
+ = esc(number_format((float)($item->price ?? 0), 2)) ?>
+ = esc(number_format((float)($item->qty ?? 0), 2)) ?>
+ = esc(number_format((float)($item->twdisc_amount ?? $item->tamount ?? 0), 2)) ?>
+
+
+
+
+ No items in this invoice.
+
+
+
+
+
+
+
+
+
+ No invoice found for today.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/new_purchase_invoice.php b/app/Views/medical/new_purchase_invoice.php
new file mode 100644
index 0000000..f5b595f
--- /dev/null
+++ b/app/Views/medical/new_purchase_invoice.php
@@ -0,0 +1,60 @@
+
+
+
+
+ = csrf_field() ?>
+
+
+ Supplier
+
+
+ = esc($row->name_supplier ?? '') ?>
+
+
+
+
+
+ Bill Type
+
+ Invoice
+ Challan
+
+
+
+
+ Invoice / Challan ID
+
+
+
+
+ Date of Invoice
+
+
+
+
+ Create
+
+
+
+
+
+
diff --git a/app/Views/medical/org_list.php b/app/Views/medical/org_list.php
new file mode 100644
index 0000000..877c1b4
--- /dev/null
+++ b/app/Views/medical/org_list.php
@@ -0,0 +1,60 @@
+
+
+
ORG List
+
+
+
+
+
+ ORG Code
+ Name / Patient Code
+ Register Date
+ Insurance Company
+ Action
+
+
+
+
+
+ org_id ?? 0);
+ $orgCode = (string) ($row->case_id_code ?? ('ORG-' . $orgId));
+ ?>
+
+ = esc($orgCode) ?>
+ [= esc($row->p_code ?? '-') ?>] = esc($row->p_fname ?? '-') ?>= !empty($row->p_rname) ? ' ' . esc($row->p_rname) : '' ?>
+ = esc($row->str_register_date ?? '-') ?>
+ = esc($row->insurance_company_name ?? '-') ?>
+
+ Open Invoices
+
+
+
+
+
+ No active organization credit records found.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/patient_search_result.php b/app/Views/medical/patient_search_result.php
new file mode 100644
index 0000000..4bb768a
--- /dev/null
+++ b/app/Views/medical/patient_search_result.php
@@ -0,0 +1,41 @@
+
+
+
Result
+
+
+
+
+ Sr.No.
+ Patient/UHID Code
+ Name
+ Age
+ Last Visit
+ Phone No.
+ Action
+
+
+
+
+ $row): ?>
+
+ = (int)$i + 1 ?>
+ = esc($codeField ? ($row->{$codeField} ?? '-') : '-') ?>
+ = esc($nameField ? ($row->{$nameField} ?? '-') : '-') ?>
+ = esc($ageField ? ($row->{$ageField} ?? '-') : '-') ?>
+ = esc($lastVisitField ? ($row->{$lastVisitField} ?? '-') : '-') ?>
+ = esc($phoneField ? ($row->{$phoneField} ?? '-') : '-') ?>
+
+ Sale
+
+
+
+
+
+ No patient records found.
+
+
+
+
+
+
+
diff --git a/app/Views/medical/payment_edit.php b/app/Views/medical/payment_edit.php
new file mode 100644
index 0000000..d4c0d8f
--- /dev/null
+++ b/app/Views/medical/payment_edit.php
@@ -0,0 +1,126 @@
+
+
+
+
+
Payment ID : = esc((string) ($rec_no ?? '')) ?>
+
+
+
Invoice Type : = esc((string) ($inv_Type ?? '')) ?>
+
IPD/OPD No : = esc((string) ($invoice_no ?? '')) ?>
+
Invoice To : = esc(ucwords((string) ($invoice_to_name ?? ''))) ?>
+
Amount : Rs. = esc(number_format($amountStr, 2)) ?>
+
Mode of Payment. : = $paymentMode === 1 ? 'CASH' : 'BANK' ?>
+
+
+
+
+
+
+
Payment Mode Correction
+
+
+
+
+ Payment By Bank/Online
+
+
+
+ 0 ? ('Source #' . $sourceId) : 'Default Bank Source';
+ }
+ ?>
+ >= esc($label) ?>
+
+
+ Default Bank Source
+
+
+
+
+ Tran. ID / Ref.
+
+
+
+ Change to Bank/Online
+
+
+
+ Current Bank Source
+
+
+
+ 0 ? ('Source #' . $sourceId) : 'Default Bank Source';
+ }
+ ?>
+ >= esc($label) ?>
+
+
+ Bank/Online
+
+
+
+
+ Change to CASH
+
+
+
+
+
+
+
+
+
+ Select User
+
+
+
+ >= esc($label) ?>
+
+
+
+
+ Change User
+
+
+
+
+
+
+
Change/Correct Amount
+
+
+
+ Amount Value
+
+
+
+ Change Amount
+
+
+
+
+
+
+
diff --git a/app/Views/medical/payment_log.php b/app/Views/medical/payment_log.php
new file mode 100644
index 0000000..8167787
--- /dev/null
+++ b/app/Views/medical/payment_log.php
@@ -0,0 +1,71 @@
+
+
Med. Payment Edit Logs Panel
+
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+ Show
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/payment_log_data.php b/app/Views/medical/payment_log_data.php
new file mode 100644
index 0000000..c94054b
--- /dev/null
+++ b/app/Views/medical/payment_log_data.php
@@ -0,0 +1,66 @@
+
+
+
+ Date Range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+ Total Logs: = esc((string) count($rows)) ?>
+
+
+
+ No payment logs found for selected date range.
+
+
+
+
+
+ #
+ Bill No
+ Invoice Code
+ Bill Type
+ Insert Date Time
+ Log Insert
+ Update Log
+ Amount / New Amount
+ Log Type
+ Update By
+
+
+
+ $row): ?>
+
+ = esc((string) ($index + 1)) ?>
+ = esc((string) ($row['id'] ?? '-')) ?>
+ = esc((string) ($row['invoice_code'] ?? ($row['Inv_code'] ?? '-'))) ?>
+ = esc((string) ($row['bill_type'] ?? '-')) ?>
+ = esc((string) ($row['insert_time'] ?? '-')) ?>
+ = esc((string) ($row['log_insert'] ?? '-')) ?>
+ = esc((string) ($row['update_log'] ?? '-')) ?>
+ = esc((string) ($row['amount'] ?? '0')) ?>
+ = esc((string) ($row['log_type'] ?? '-')) ?>
+ = esc((string) ($row['update_by'] ?? '-')) ?>
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/payment_search.php b/app/Views/medical/payment_search.php
new file mode 100644
index 0000000..18bcb5b
--- /dev/null
+++ b/app/Views/medical/payment_search.php
@@ -0,0 +1,113 @@
+
+
+
Med. Payment Edit
+
+
+
+ Payment ID
+
+
+
+ Search Payment
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/placeholder.php b/app/Views/medical/placeholder.php
new file mode 100644
index 0000000..42b22ee
--- /dev/null
+++ b/app/Views/medical/placeholder.php
@@ -0,0 +1,8 @@
+
+
+
= esc($title ?? 'Medical Module') ?>
+
+ This section is queued for migration from CI3 to CI4.
+
+
+
diff --git a/app/Views/medical/print_bill_on_uhid.php b/app/Views/medical/print_bill_on_uhid.php
new file mode 100644
index 0000000..51a7309
--- /dev/null
+++ b/app/Views/medical/print_bill_on_uhid.php
@@ -0,0 +1,80 @@
+
+
Report Panel
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+ UHID / Patient ID
+
+
+
+ Show
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/product_edit.php b/app/Views/medical/product_edit.php
new file mode 100644
index 0000000..ca0732a
--- /dev/null
+++ b/app/Views/medical/product_edit.php
@@ -0,0 +1,160 @@
+id ?? 0);
+$selectedCatIds = array_map('intval', (array) ($selected_cat_ids ?? []));
+
+$formulationValue = (string) ($product->formulation ?? '');
+$itemName = (string) ($product->item_name ?? '');
+$genericName = (string) ($product->genericname ?? '');
+$packing = (string) ($product->packing ?? '');
+$reOrderQty = (string) ($product->re_order_qty ?? '');
+$hsnCode = (string) ($product->HSNCODE ?? '');
+$cgst = (string) ($product->CGST_per ?? '');
+$sgst = (string) ($product->SGST_per ?? '');
+$rackNo = (string) ($product->rack_no ?? '');
+$shelfNo = (string) ($product->shelf_no ?? '');
+$coldStorage = (string) ($product->cold_storage ?? '');
+$companyId = (int) ($product->company_id ?? 0);
+$relatedDrugId = (int) ($product->related_drug_id ?? 0);
+
+$flag = static function ($v): string {
+ return ((int) $v === 1) ? 'checked' : '';
+};
+?>
+
+
+
+
diff --git a/app/Views/medical/product_search_result.php b/app/Views/medical/product_search_result.php
new file mode 100644
index 0000000..b55eed7
--- /dev/null
+++ b/app/Views/medical/product_search_result.php
@@ -0,0 +1,42 @@
+
+
+
+
+ Prod. ID
+ Name
+ Formulation
+ Generic Name
+ Packing Type
+ Action
+
+
+
+
+
+ = (int) ($row->id ?? 0) ?>
+ = esc($row->item_name ?? '') ?>
+ = esc($row->formulation ?? '') ?>
+ = esc($row->genericname ?? '') ?>
+ = esc($row->packing ?? '') ?>
+
+ Edit
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/purchase_challan_list.php b/app/Views/medical/purchase_challan_list.php
new file mode 100644
index 0000000..9b2e9e4
--- /dev/null
+++ b/app/Views/medical/purchase_challan_list.php
@@ -0,0 +1,32 @@
+
+
+
No challan items available for this supplier.
+
+
+
+
+ id ?? 0)): ?>
+
+ Challan No: = esc((string) ($row->Invoice_no ?? '')) ?> / Date: = esc((string) ($row->str_date_of_invoice ?? '')) ?> / Net Amount: = esc((string) ($row->tamount ?? 0)) ?>
+
+
+ Item Name
+ Qty + Free
+ MRP
+ Add
+
+
+
+
+ = esc($row->Item_name ?? '') ?>
+ = esc((string) ($row->qty ?? 0)) ?> + = esc((string) ($row->qty_free ?? 0)) ?>
+ = esc((string) ($row->mrp ?? 0)) ?>
+ Add
+
+
+ id ?? 0); ?>
+
+
+
+
+
diff --git a/app/Views/medical/purchase_invoice_edit.php b/app/Views/medical/purchase_invoice_edit.php
new file mode 100644
index 0000000..f56b3f7
--- /dev/null
+++ b/app/Views/medical/purchase_invoice_edit.php
@@ -0,0 +1,428 @@
+
+
+
+
+ Purchase invoice not found.
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ inv_status ?? 0) === 0): ?>
+
+
+
+
+
+
+
Select a product to view last 5 purchase orders.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/purchase_invoice_item.php b/app/Views/medical/purchase_invoice_item.php
new file mode 100644
index 0000000..b47d078
--- /dev/null
+++ b/app/Views/medical/purchase_invoice_item.php
@@ -0,0 +1,62 @@
+
+
+
+
+
+ #
+ RecNo
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+
+
+
+
+ item_return ?? 0) === 1) ? 'style="color:red;"' : '' ?>>
+ = $srno ?>
+ = (int) ($row->id ?? 0) ?>
+ = esc($row->Item_name ?? '') ?>
+ = esc($row->batch_no ?? '') ?>
+ = esc($row->exp_date_str ?? '') ?>
+ = esc((string) ($row->mrp ?? 0)) ?>
+ = esc((string) ($row->qty ?? 0)) ?> + = esc((string) ($row->qty_free ?? 0)) ?>
+ = esc((string) ($row->purchase_price ?? 0)) ?>
+ = esc((string) ($row->amount ?? 0)) ?>
+ = esc((string) ($row->discount ?? 0)) ?>
+ = esc((string) ($row->taxable_amount ?? 0)) ?>
+ = esc((string) ($row->CGST_per ?? 0)) ?>
+ = esc((string) ($row->SGST_per ?? 0)) ?>
+ = esc((string) ($row->net_amount ?? 0)) ?>
+
+ inv_status ?? 0) === 0): ?>
+
+
+ old_purchase_id ?? 0) > 0): ?>
+
+
+
+
+
+
+
+
+ Total
+ = esc((string) ($invoice->Taxable_Amt ?? 0)) ?>
+ = esc((string) ($invoice->CGST_Amt ?? 0)) ?>
+ = esc((string) ($invoice->SGST_Amt ?? 0)) ?>
+ = esc((string) ($invoice->T_Net_Amount ?? 0)) ?>
+
+
+
+
+
diff --git a/app/Views/medical/purchase_invoice_master_edit.php b/app/Views/medical/purchase_invoice_master_edit.php
new file mode 100644
index 0000000..f0d1f81
--- /dev/null
+++ b/app/Views/medical/purchase_invoice_master_edit.php
@@ -0,0 +1,156 @@
+Purchase invoice not found.';
+ return;
+}
+
+$invStatus = (int) ($inv->inv_status ?? 0);
+$canUpdatePurchaseStatus = (bool) ($can_update_purchase_status ?? false);
+?>
+
+
+
+
+
+ = csrf_field() ?>
+
+
+
+
+ Supplier
+
+
+ sid ?? 0) === (int) ($inv->sid ?? 0)) ? 'selected' : '' ?>>= esc($row->name_supplier ?? '') ?>
+
+
+
+
+ Bill Type
+
+ ischallan ?? 0) === 0) ? 'selected' : '' ?>>Invoice
+ ischallan ?? 0) === 1) ? 'selected' : '' ?>>Challan
+
+
+
+ Invoice ID
+
+
+
+ Date of Invoice
+
+
+
+ U pdate
+
+
+
+
Supplier
+
= esc($inv->name_supplier ?? '-') ?>
+
+
+
Invoice ID
+
= esc((string) ($inv->Invoice_no ?? '')) ?>
+
+
+
Date of Invoice
+
= !empty($inv->date_of_invoice) ? esc(date('d/m/Y', strtotime((string) $inv->date_of_invoice))) : '' ?>
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+
+
+
+ item_return ?? 0) === 1) ? 'style="color:red;"' : '' ?>>
+ = $sr ?>
+ = esc($row->Item_name ?? '') ?>
+ = esc($row->batch_no ?? '') ?>
+ = esc((string) ($row->expiry_date ?? '')) ?>
+ = esc((string) ($row->mrp ?? 0)) ?>
+ = esc((string) ($row->qty ?? 0)) ?>+= esc((string) ($row->qty_free ?? 0)) ?>
+ = esc((string) ($row->purchase_price ?? 0)) ?>
+ = esc((string) ($row->amount ?? 0)) ?>
+ = esc((string) ($row->discount ?? 0)) ?>
+ = esc((string) ($row->taxable_amount ?? 0)) ?>
+ = esc((string) ($row->CGST_per ?? 0)) ?>
+ = esc((string) ($row->SGST_per ?? 0)) ?>
+ = esc((string) ($row->net_amount ?? 0)) ?>
+
+
+
+ Total
+ = esc((string) ($inv->Taxable_Amt ?? 0)) ?>
+ = esc((string) ($inv->CGST_Amt ?? 0)) ?>
+ = esc((string) ($inv->SGST_Amt ?? 0)) ?>
+ = esc((string) ($inv->T_Net_Amount ?? 0)) ?>
+
+
+
+
+
+
+
+
+ Edit Items
+
+
+
+
+
+ >Pending Entry
+ >Final and Checked
+
+
+
+ Update Status
+
+
+
+
Invoice Status
+
= $invStatus === 1 ? 'Final and Checked' : 'Pending Entry' ?>
+
+
+
+
+
+
+
diff --git a/app/Views/medical/purchase_item_old.php b/app/Views/medical/purchase_item_old.php
new file mode 100644
index 0000000..2616fcf
--- /dev/null
+++ b/app/Views/medical/purchase_item_old.php
@@ -0,0 +1,39 @@
+Item_name ?? '');
+}
+?>
+
+
+No purchase history found for selected product.
+
+
+Item : = esc($itemName) ?> Last 5 Purchase Orders
+
+
+
+
+ Date
+ MRP
+ Qty
+ Rate
+ SCH/Disc
+ P.U.Rate
+ Supplier/Invoice
+
+
+
+
+
+ = esc($row->date_of_invoice_str ?? '') ?>
+ = esc((string) ($row->mrp ?? 0)) ?>
+ = esc((string) ($row->qty ?? 0)) ?> + = esc((string) ($row->qty_free ?? 0)) ?>
+ = esc((string) ($row->purchase_price ?? 0)) ?>
+ = esc((string) ($row->sch_disc_per ?? 0)) ?> / = esc((string) ($row->discount ?? 0)) ?>
+ = esc((string) ($row->purchase_unit_rate ?? 0)) ?>
+ = esc(($row->name_supplier ?? '-') . '/' . ($row->Invoice_no ?? '')) ?>
+
+
+
+
diff --git a/app/Views/medical/purchase_supp_list.php b/app/Views/medical/purchase_supp_list.php
new file mode 100644
index 0000000..10ff1ed
--- /dev/null
+++ b/app/Views/medical/purchase_supp_list.php
@@ -0,0 +1,57 @@
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+ Amount
+ Action
+
+
+
+
+ ischallan ?? 0) === 1) ? 'style="color:red;"' : '' ?>>
+ = esc((string) ($row->Invoice_no ?? '')) ?>
+ = esc($row->name_supplier ?? '') ?>
+ = esc((string) ($row->str_date_of_invoice ?? $row->date_of_invoice ?? '')) ?>
+ = esc((string) ($row->tamount ?? 0)) ?>
+
+ View & Edit
+ tamount ?? 0) == 0.0): ?>
+ Delete
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/purchase_supplier_list.php b/app/Views/medical/purchase_supplier_list.php
new file mode 100644
index 0000000..3ea5f6b
--- /dev/null
+++ b/app/Views/medical/purchase_supplier_list.php
@@ -0,0 +1,27 @@
+
+
+ = csrf_field() ?>
+
+
+
+
+ Search Purchase Invoice
+
+
+ New Purchase/Challan Invoice
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_company_med_sale.php b/app/Views/medical/report_company_med_sale.php
new file mode 100644
index 0000000..709f951
--- /dev/null
+++ b/app/Views/medical/report_company_med_sale.php
@@ -0,0 +1,108 @@
+
+
Company Wise Medicine Sale Report
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+ Company
+
+
+ = esc((string) ($company->company_name ?? ('Company-' . ($company->id ?? '')))) ?>
+
+
+
+
+
+ Show
+ Excel
+ Print
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_company_med_sale_data.php b/app/Views/medical/report_company_med_sale_data.php
new file mode 100644
index 0000000..2fe0429
--- /dev/null
+++ b/app/Views/medical/report_company_med_sale_data.php
@@ -0,0 +1,114 @@
+
+
+
+ Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ #
+ Item Code
+ Item Name
+ Sale Qty
+ Sale Amt
+ Pur. Amt
+ Sale GST
+ Return Qty
+ Return Amt
+ Return Pur. Amt
+
+
+
+
+ $row): ?>
+
+ = (int) $idx + 1 ?>
+ = esc((string) ($row['item_code'] ?? '-')) ?>
+ = esc((string) ($row['item_name'] ?? '-')) ?>
+ = esc(number_format((float) ($row['sale_qty'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['purchase_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_gst'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['return_qty'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['return_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['return_purchase_amount'] ?? 0), 2)) ?>
+
+
+
+
+ No records found for selected filters.
+
+
+
+
+
+
+ #
+
+
+ Total Sale
+ = esc(number_format($totalSaleAmount, 2)) ?>
+ = esc(number_format($totalPurchaseAmount, 2)) ?>
+ = esc(number_format($totalSaleGst, 2)) ?>
+ Total Return
+ = esc(number_format($totalReturnAmount, 2)) ?>
+ = esc(number_format($totalReturnPurchaseAmount, 2)) ?>
+
+
+
+
+
+
+Total Margin (Sale - Purchase - Return + ReturnPurchase - NetGST): Rs. = esc(number_format($totalMargin, 2)) ?>
+Net GST = Sale GST (= esc(number_format($totalSaleGst, 2)) ?>) - Return GST (= esc(number_format($totalReturnGst, 2)) ?>)
+
+
+
+
diff --git a/app/Views/medical/report_daily_med_sale.php b/app/Views/medical/report_daily_med_sale.php
new file mode 100644
index 0000000..2a2bdf6
--- /dev/null
+++ b/app/Views/medical/report_daily_med_sale.php
@@ -0,0 +1,99 @@
+
+
Daily Medicine Sale Report
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+
+ Show
+ Excel
+ Print
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_daily_med_sale_data.php b/app/Views/medical/report_daily_med_sale_data.php
new file mode 100644
index 0000000..a93f539
--- /dev/null
+++ b/app/Views/medical/report_daily_med_sale_data.php
@@ -0,0 +1,117 @@
+
+
+
+ Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ #
+ Item Code
+ Item Name
+ Sale Qty
+ Sale Amt
+ Pur. Amt
+ Sale GST
+ Return Qty
+ Return Amt
+ Return Pur. Amt
+ Cur.Qty
+
+
+
+
+ $row): ?>
+
+ = (int) $idx + 1 ?>
+ = esc((string) ($row['item_code'] ?? '-')) ?>
+ = esc((string) ($row['item_name'] ?? '-')) ?>
+ = esc(number_format((float) ($row['sale_qty'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['purchase_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_gst'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['return_qty'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['return_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['return_purchase_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cur_qty'] ?? 0), 2)) ?>
+
+
+
+
+ No records found for selected date range.
+
+
+
+
+
+
+ #
+
+
+ Total Sale
+ = esc(number_format($totalSaleAmount, 2)) ?>
+ = esc(number_format($totalPurchaseAmount, 2)) ?>
+ = esc(number_format($totalSaleGst, 2)) ?>
+ Total Return
+ = esc(number_format($totalReturnAmount, 2)) ?>
+ = esc(number_format($totalReturnPurchaseAmount, 2)) ?>
+
+
+
+
+
+
+
+Total Margin (Sale - Purchase - Return + ReturnPurchase - NetGST): Rs. = esc(number_format($totalMargin, 2)) ?>
+Net GST = Sale GST (= esc(number_format($totalSaleGst, 2)) ?>) - Return GST (= esc(number_format($totalReturnGst, 2)) ?>)
+
+
+
+
diff --git a/app/Views/medical/report_daily_med_sale_doc.php b/app/Views/medical/report_daily_med_sale_doc.php
new file mode 100644
index 0000000..ff72df2
--- /dev/null
+++ b/app/Views/medical/report_daily_med_sale_doc.php
@@ -0,0 +1,109 @@
+
+
Daily Medicine Sale Report
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+ Doctor Name
+
+ All Doctors
+
+ = esc((string) ($row->p_fname ?? $row->name ?? ('Doctor-' . (int) ($row->id ?? 0)))) ?>
+
+
+
+
+
+ Show
+ Excel
+ Print
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_daily_med_sale_doc_data.php b/app/Views/medical/report_daily_med_sale_doc_data.php
new file mode 100644
index 0000000..ef6a252
--- /dev/null
+++ b/app/Views/medical/report_daily_med_sale_doc_data.php
@@ -0,0 +1,104 @@
+
+
+
+ Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ #
+ Doc. Name
+ Item Code
+ Item Name
+ Sale Qty
+ Sale Amt
+ Pur. Amt
+ Sale GST
+ Cur.Qty
+
+
+
+
+ $row): ?>
+
+ = (int) $idx + 1 ?>
+ = esc((string) ($row['doc_name'] ?? '-')) ?>
+ = esc((string) ($row['item_code'] ?? '-')) ?>
+ = esc((string) ($row['item_name'] ?? '-')) ?>
+ = esc(number_format((float) ($row['sale_qty'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['purchase_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_gst'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cur_qty'] ?? 0), 2)) ?>
+
+
+
+
+ No records found for selected filters.
+
+
+
+
+
+
+ #
+
+
+
+ Total Sale
+ = esc(number_format($totalSaleAmount, 2)) ?>
+ = esc(number_format($totalPurchaseAmount, 2)) ?>
+ = esc(number_format($totalSaleGst, 2)) ?>
+
+
+
+
+
+
+
+Total Margin (Sale - Purchase - SaleGST): Rs. = esc(number_format($totalMargin, 2)) ?>
+
+
+
+
diff --git a/app/Views/medical/report_gst_invoice_hsn_data.php b/app/Views/medical/report_gst_invoice_hsn_data.php
new file mode 100644
index 0000000..45ba1cb
--- /dev/null
+++ b/app/Views/medical/report_gst_invoice_hsn_data.php
@@ -0,0 +1,65 @@
+
+
+
+ Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ HSN Code
+ Item Qty
+ Tax Per.
+ Tot.Amt.
+ Tot.Tax.Amt
+ Tax.Amt.5%
+ CGST 2.5%
+ SGST 2.5%
+ Tax.Amt.12%
+ CGST 6%
+ SGST 6%
+ Tax.Amt.18%
+ CGST 9%
+ SGST 9%
+ Tax.Amt.28%
+ CGST 14%
+ SGST 14%
+ Tax.Amt.0%
+
+
+
+
+
+
+ = esc((string) ($row['hsn_code'] ?? '-')) ?>
+ = esc(number_format((float) ($row['no_of_qty'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_per'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['total_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['total_taxable_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_5_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_2_5'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sgst_2_5'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_12_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_6'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sgst_6'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_18_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_9'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sgst_9'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_28_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_14'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sgst_14'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_0_amount'] ?? 0), 2)) ?>
+
+
+
+ No records found.
+
+
+
+
diff --git a/app/Views/medical/report_gst_invoice_list.php b/app/Views/medical/report_gst_invoice_list.php
new file mode 100644
index 0000000..eabb520
--- /dev/null
+++ b/app/Views/medical/report_gst_invoice_list.php
@@ -0,0 +1,144 @@
+
+
GST Invoice List Panel
+
+
+
+
+
+
+
+
Discharge Date Range
+
+
+
+
+
+ Invoice Show
+ Invoice Excel
+ Invoice Print
+
+
+
+
+ HSN Wise Show
+ HSN Wise Excel
+ HSN Wise Print
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_gst_invoice_list_data.php b/app/Views/medical/report_gst_invoice_list_data.php
new file mode 100644
index 0000000..2450ca7
--- /dev/null
+++ b/app/Views/medical/report_gst_invoice_list_data.php
@@ -0,0 +1,69 @@
+
+
+
+ Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ Invoice ID
+ Inv.Date
+ Inv.Name
+ Invoice Type
+ Qty
+ Tot.Amt.
+ Tot.Tax.Amt
+ Tax.Amt.5%
+ CGST 2.5%
+ SGST 2.5%
+ Tax.Amt.12%
+ CGST 6%
+ SGST 6%
+ Tax.Amt.18%
+ CGST 9%
+ SGST 9%
+ Tax.Amt.28%
+ CGST 14%
+ SGST 14%
+ Tax.Amt.0%
+
+
+
+
+
+
+ = esc((string) ($row['inv_med_code'] ?? '-')) ?>
+ = esc((string) ($row['inv_date'] ?? '-')) ?>
+ = esc((string) ($row['inv_name'] ?? '-')) ?>
+ = esc((string) ($row['invoice_type'] ?? '-')) ?>
+ = esc(number_format((float) ($row['no_of_qty'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['total_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['total_taxable_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_5_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_2_5'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sgst_2_5'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_12_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_6'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sgst_6'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_18_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_9'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sgst_9'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_28_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cgst_14'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sgst_14'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_0_amount'] ?? 0), 2)) ?>
+
+
+
+ No records found.
+
+
+
+
diff --git a/app/Views/medical/report_gst_sale.php b/app/Views/medical/report_gst_sale.php
new file mode 100644
index 0000000..8d9c7b2
--- /dev/null
+++ b/app/Views/medical/report_gst_sale.php
@@ -0,0 +1,132 @@
+
+
Sale GST Report Panel
+
+
+
+
+
+
+
+ `H_Med_GST` is empty. Please set GSTIN in constants before using GSTR1 JSON export.
+
+
+
+
+
+
+ GSTIN
+
+
+
+
+ Show
+ Excel
+ Print
+ GSTR1 JSON
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_gst_sale_data.php b/app/Views/medical/report_gst_sale_data.php
new file mode 100644
index 0000000..36883e1
--- /dev/null
+++ b/app/Views/medical/report_gst_sale_data.php
@@ -0,0 +1,54 @@
+
+
+
+ Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ #
+ CGST Per
+ T. CGST
+ SGST Per
+ T. SGST
+ Total GST
+ Taxable Amount
+ Amount
+ Item Qty
+
+
+
+
+
+
+
+
+ = $isTotal ? '#' : esc((string) $sr) ?>
+ = $isTotal ? 'Grand Total : ' : esc((string) ($row['cgst_per'] ?? '-')) ?>
+ = esc(number_format((float) ($row['tcgst'] ?? 0), 2)) ?>
+ = $isTotal ? '' : esc((string) ($row['sgst_per'] ?? '-')) ?>
+ = esc(number_format((float) ($row['tsgst'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['tgst'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['taxable_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['t_qty'] ?? 0), 2)) ?>
+
+
+
+ No records found.
+
+
+
+
diff --git a/app/Views/medical/report_gst_sale_data_pdf.php b/app/Views/medical/report_gst_sale_data_pdf.php
new file mode 100644
index 0000000..d1cc48f
--- /dev/null
+++ b/app/Views/medical/report_gst_sale_data_pdf.php
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+Sale GST Report
+Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+ #
+ CGST Per
+ T. CGST
+ SGST Per
+ T. SGST
+ Total GST
+ Taxable Amount
+ Amount
+ Item Qty
+
+
+
+
+
+
+
+
+ = $isTotal ? '#' : esc((string) $sr) ?>
+ = $isTotal ? 'Grand Total' : esc((string) ($row['cgst_per'] ?? '-')) ?>
+ = esc(number_format((float) ($row['tcgst'] ?? 0), 2)) ?>
+ = $isTotal ? '-' : esc((string) ($row['sgst_per'] ?? '-')) ?>
+ = esc(number_format((float) ($row['tsgst'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['tgst'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['taxable_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['t_qty'] ?? 0), 2)) ?>
+
+
+
+
+ No records found.
+
+
+
+
+
+
diff --git a/app/Views/medical/report_ipd_credit.php b/app/Views/medical/report_ipd_credit.php
new file mode 100644
index 0000000..60fda88
--- /dev/null
+++ b/app/Views/medical/report_ipd_credit.php
@@ -0,0 +1,116 @@
+
+
IPD Invoice Panel
+
+
+
+
+
+
+
+ Discharge From Date
+
+
+
+ Discharge To Date
+
+
+
+
+ Bill Type
+
+ ALL
+ CASH
+ Credit to Hospital
+ Package
+
+
+
+
+ Show
+ Excel
+ Print
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_ipd_credit_data.php b/app/Views/medical/report_ipd_credit_data.php
new file mode 100644
index 0000000..db8e9fa
--- /dev/null
+++ b/app/Views/medical/report_ipd_credit_data.php
@@ -0,0 +1,115 @@
+ (string) ($row['ipd_code'] ?? '-'),
+ 'patient_code' => (string) ($row['patient_code'] ?? '-'),
+ 'patient_name' => (string) ($row['patient_name'] ?? '-'),
+ 'tpa_name' => (string) ($row['tpa_name'] ?? '-'),
+ 'items' => [],
+ 'subtotal' => 0.0,
+ ];
+ }
+
+ $amount = (float) ($row['ipd_total_amount'] ?? 0);
+ $grouped[$ipdId]['items'][] = $row;
+ $grouped[$ipdId]['subtotal'] += $amount;
+ $grandTotal += $amount;
+}
+?>
+
+
+ Discharge date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ IPD Code
+ Patient Code
+ Patient Name
+ TPA Name
+
+
+ Inv.No.
+ Inv.Date
+ Amount
+ Type
+
+
+
+
+
+
+ = esc($group['ipd_code']) ?>
+ = esc($group['patient_code']) ?>
+ = esc($group['patient_name']) ?>
+ = esc($group['tpa_name']) ?>
+
+
+
+
+ = esc((string) ($item['inv_med_code'] ?? '-')) ?>
+ = esc((string) ($item['inv_date_str'] ?? '-')) ?>
+ = esc(number_format((float) ($item['ipd_total_amount'] ?? 0), 2)) ?>
+ = esc((string) ($item['bill_type'] ?? '-')) ?>
+
+
+
+
+ Total
+ = esc(number_format((float) ($group['subtotal'] ?? 0), 2)) ?>
+
+
+
+
+
+
+ Grand Total
+ = esc(number_format($grandTotal, 2)) ?>
+
+
+
+
+ No records found for selected filters.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_ipd_discharge.php b/app/Views/medical/report_ipd_discharge.php
new file mode 100644
index 0000000..d4bd7b3
--- /dev/null
+++ b/app/Views/medical/report_ipd_discharge.php
@@ -0,0 +1,103 @@
+
+
IPD Discharge Report Panel
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+
+ Show
+ Excel
+ Print A4-L
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_ipd_discharge_data.php b/app/Views/medical/report_ipd_discharge_data.php
new file mode 100644
index 0000000..74becc2
--- /dev/null
+++ b/app/Views/medical/report_ipd_discharge_data.php
@@ -0,0 +1,100 @@
+
+
+Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+ IPD Code
+ Patient Code
+ Patient Name
+ Admit Dt.
+ Discharge Dt.
+ TPA Name
+ Cash
+ Paid Amt.
+ Cash Balance
+ Credit
+ Package
+
+
+
+
+
+
+ = esc((string) ($row['ipd_code'] ?? '-')) ?>
+ = esc((string) ($row['p_code'] ?? '-')) ?>
+ = esc((string) ($row['p_name'] ?? '-')) ?>
+ = esc((string) ($row['admit_date'] ?? '-')) ?>
+ = esc((string) ($row['discharge_date'] ?? '-')) ?>
+ = esc((string) ($row['tpa_name'] ?? '-')) ?>
+ = esc(number_format((float) ($row['ipd_cash_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['paid_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['cash_balance'] ?? 0), 0)) ?>
+ = esc(number_format((float) ($row['ipd_credit_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['ipd_package_amount'] ?? 0), 2)) ?>
+
+
+
+
+ No discharged IPD records found for selected date range.
+
+
+
+
+
+
+ Total
+ = esc(number_format($totalCash, 2)) ?>
+ = esc(number_format($totalPaid, 2)) ?>
+ = esc(number_format($totalBalance, 0)) ?>
+ = esc(number_format($totalCredit, 2)) ?>
+ = esc(number_format($totalPackage, 2)) ?>
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_ipd_sale.php b/app/Views/medical/report_ipd_sale.php
new file mode 100644
index 0000000..d7836ce
--- /dev/null
+++ b/app/Views/medical/report_ipd_sale.php
@@ -0,0 +1,103 @@
+
+
IPD Invoice Panel
+
+
+
+
+
+
+
+ Discharge From Date
+
+
+
+ Discharge To Date
+
+
+
+
+
+ Show
+ Excel
+ Print
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_ipd_sale_data.php b/app/Views/medical/report_ipd_sale_data.php
new file mode 100644
index 0000000..d23d657
--- /dev/null
+++ b/app/Views/medical/report_ipd_sale_data.php
@@ -0,0 +1,123 @@
+ 0.0,
+ 'credit' => 0.0,
+ 'package' => 0.0,
+ 'total' => 0.0,
+];
+
+foreach ($rows as $row) {
+ $ipdId = (string) ($row['ipd_id'] ?? '0');
+ if (!isset($grouped[$ipdId])) {
+ $grouped[$ipdId] = [
+ 'ipd_code' => (string) ($row['ipd_code'] ?? '-'),
+ 'patient_code' => (string) ($row['patient_code'] ?? '-'),
+ 'patient_name' => (string) ($row['patient_name'] ?? '-'),
+ 'tpa_name' => (string) ($row['tpa_name'] ?? '-'),
+ 'items' => [],
+ ];
+ }
+
+ $grouped[$ipdId]['items'][] = $row;
+ $totals['cash'] += (float) ($row['ipd_cash_amount'] ?? 0);
+ $totals['credit'] += (float) ($row['ipd_credit_amount'] ?? 0);
+ $totals['package'] += (float) ($row['ipd_package_amount'] ?? 0);
+ $totals['total'] += (float) ($row['ipd_total_amount'] ?? 0);
+}
+?>
+
+
+ Discharge date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ IPD Code
+ Patient Code
+ Patient Name
+ TPA Name
+
+
+
+ Inv.No.
+ Inv.Date
+ Cash
+ Credit
+ Package
+ Total
+
+
+
+
+
+
+ = esc($group['ipd_code']) ?>
+ = esc($group['patient_code']) ?>
+ = esc($group['patient_name']) ?>
+ = esc($group['tpa_name']) ?>
+
+
+
+
+
+ = esc((string) ($item['inv_med_code'] ?? '-')) ?>
+ = esc((string) ($item['inv_date_str'] ?? '-')) ?>
+ = esc(number_format((float) ($item['ipd_cash_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($item['ipd_credit_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($item['ipd_package_amount'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($item['ipd_total_amount'] ?? 0), 2)) ?>
+
+
+
+
+
+
+
+ IPD Total
+ = esc(number_format($totals['cash'], 2)) ?>
+ = esc(number_format($totals['credit'], 2)) ?>
+ = esc(number_format($totals['package'], 2)) ?>
+ = esc(number_format($totals['total'], 2)) ?>
+
+
+
+ No records found for selected date range.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_med_patient.php b/app/Views/medical/report_med_patient.php
new file mode 100644
index 0000000..f04f9af
--- /dev/null
+++ b/app/Views/medical/report_med_patient.php
@@ -0,0 +1,154 @@
+
+
Report Drug Sale to Patient Panel
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+ Type of medicine
+
+ Schedule H
+ Schedule H1
+ Schedule X
+ Schedule G
+ Narcotic
+ High Risk
+
+
+
+ Drug Name / Batch
+
+
+
+
+
+
+ Show Report
+ Export
+ Print A4
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_med_patient_data.php b/app/Views/medical/report_med_patient_data.php
new file mode 100644
index 0000000..0e4081e
--- /dev/null
+++ b/app/Views/medical/report_med_patient_data.php
@@ -0,0 +1,81 @@
+ (string) ($row['shed_x_h'] ?? ''),
+ 'rows' => [],
+ 'total_qty' => 0.0,
+ ];
+ }
+
+ $qty = (float) ($row['t_qty'] ?? 0);
+ $groups[$itemName]['rows'][] = $row;
+ $groups[$itemName]['total_qty'] += $qty;
+
+ if ($groups[$itemName]['head'] === '' && !empty($row['shed_x_h'])) {
+ $groups[$itemName]['head'] = (string) $row['shed_x_h'];
+ }
+}
+?>
+
+
+ Date Range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+ Total Items: = esc((string) count($groups)) ?>
+
+
+
+ No records found for selected filters.
+
+
+
+
+
+ Inv.No.
+ Inv.Date
+ IPD No.
+ P Code/Name
+ Exp. Date
+ Batch
+ Qty
+
+
+
+ $group): ?>
+
+
+ = esc($itemName) ?>
+
+ [ = esc((string) $group['head']) ?> ]
+
+
+
+
+
+ = esc((string) ($row['inv_med_code'] ?? '-')) ?>
+ = esc((string) ($row['str_inv_date'] ?? '-')) ?>
+ = esc((string) ($row['ipd_code'] ?? '-')) ?>
+ = esc((string) ($row['patient_code'] ?? '-')) ?> / = esc((string) ($row['inv_name'] ?? '-')) ?>
+ = esc((string) ($row['exp_date'] ?? '-')) ?>
+ = esc((string) ($row['batch_no'] ?? '-')) ?>
+ = esc(number_format((float) ($row['t_qty'] ?? 0), 2)) ?>
+
+
+
+ Total Qty (= esc($itemName) ?>)
+ = esc(number_format((float) ($group['total_qty'] ?? 0), 2)) ?>
+
+
+
+
+
+
diff --git a/app/Views/medical/report_med_patient_pdf.php b/app/Views/medical/report_med_patient_pdf.php
new file mode 100644
index 0000000..01da6dd
--- /dev/null
+++ b/app/Views/medical/report_med_patient_pdf.php
@@ -0,0 +1,114 @@
+ (string) ($row['shed_x_h'] ?? ''),
+ 'rows' => [],
+ 'total_qty' => 0.0,
+ ];
+ }
+
+ $qty = (float) ($row['t_qty'] ?? 0);
+ $groups[$itemName]['rows'][] = $row;
+ $groups[$itemName]['total_qty'] += $qty;
+
+ if ($groups[$itemName]['head'] === '' && !empty($row['shed_x_h'])) {
+ $groups[$itemName]['head'] = (string) $row['shed_x_h'];
+ }
+}
+
+$pharmacyName = defined('M_store') ? (string) M_store : 'Medical Store';
+?>
+
+
+
+
+
+
+
+ = esc($pharmacyName) ?>
+ Drug Sale Customer Wise Report
+
+ Date Range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+ | Drug/Batch: = esc($searchText) ?>
+
+
+ | Schedule Filter: = esc($scheduleId) ?>
+
+ | Total Items: = esc((string) count($groups)) ?>
+
+
+
+
+ No records found for selected filters.
+
+
+
+
+
+ Inv.No.
+ Inv.Date
+ IPD No.
+ P Code/Name
+ Exp. Date
+ Batch
+ Qty
+
+
+
+ $group): ?>
+
+
+ = esc($itemName) ?>
+
+ [ = esc((string) $group['head']) ?> ]
+
+
+
+
+
+ = esc((string) ($row['inv_med_code'] ?? '-')) ?>
+ = esc((string) ($row['str_inv_date'] ?? '-')) ?>
+ = esc((string) ($row['ipd_code'] ?? '-')) ?>
+ = esc((string) ($row['patient_code'] ?? '-')) ?> / = esc((string) ($row['inv_name'] ?? '-')) ?>
+ = esc((string) ($row['exp_date'] ?? '-')) ?>
+ = esc((string) ($row['batch_no'] ?? '-')) ?>
+ = esc(number_format((float) ($row['t_qty'] ?? 0), 2)) ?>
+
+
+
+ Total Qty (= esc($itemName) ?>)
+ = esc(number_format((float) ($group['total_qty'] ?? 0), 2)) ?>
+
+
+
+
+
+
+ Generated on = esc(date('d-m-Y H:i')) ?>
+
+
diff --git a/app/Views/medical/report_org_bills.php b/app/Views/medical/report_org_bills.php
new file mode 100644
index 0000000..563f9db
--- /dev/null
+++ b/app/Views/medical/report_org_bills.php
@@ -0,0 +1,113 @@
+
+
Org. Invoice Panel
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+ Insurance
+
+ All Org.
+
+ = esc((string) ($row->ins_company_name ?? ($row->short_name ?? ('Insurance-' . ($row->id ?? ''))))) ?>
+
+
+
+
+
+ Show
+ Excel
+ Print
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_org_bills_data.php b/app/Views/medical/report_org_bills_data.php
new file mode 100644
index 0000000..7638bde
--- /dev/null
+++ b/app/Views/medical/report_org_bills_data.php
@@ -0,0 +1,79 @@
+
+
+
+ Invoice date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ Inv. ID
+ Org.Code
+ P Code
+ P Name
+ Amount
+ Org. Name
+
+
+
+
+
+
+ = esc((string) ($row['inv_med_code'] ?? '-')) ?>
+ = esc((string) ($row['case_id_code'] ?? '-')) ?>
+ = esc((string) ($row['p_code'] ?? '-')) ?>
+ = esc((string) ($row['p_fname'] ?? '-')) ?>
+ = esc(number_format((float) ($row['net_amount'] ?? 0), 2)) ?>
+ = esc((string) ($row['ins_company_name'] ?? '-')) ?>
+
+
+
+ Total
+ = esc(number_format($totalAmt, 2)) ?>
+
+
+
+
+ No records found for selected filters.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_purchase_invoice.php b/app/Views/medical/report_purchase_invoice.php
new file mode 100644
index 0000000..0d65314
--- /dev/null
+++ b/app/Views/medical/report_purchase_invoice.php
@@ -0,0 +1,233 @@
+
+
Report Purchase Invoice Panel
+
+
+
+
+
+
+
+ `H_Med_GST` is empty. Please set GSTIN in constants before using GSTR-2B/GSTR-3B export.
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+ Supplier
+
+ ALL
+
+ = esc($row->name_supplier ?? '') ?>
+
+
+
+
+ GSTIN
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_purchase_invoice_data.php b/app/Views/medical/report_purchase_invoice_data.php
new file mode 100644
index 0000000..e7e445a
--- /dev/null
+++ b/app/Views/medical/report_purchase_invoice_data.php
@@ -0,0 +1,108 @@
+'
+ . '# '
+ . 'Total of : ' . esc($supplierName) . ' '
+ . '' . esc(number_format($taxable, 2)) . ' '
+ . '' . esc(number_format($gst, 2)) . ' '
+ . '' . esc(number_format($amount, 0, '.', '')) . ' '
+ . '';
+};
+?>
+
+
+ Date: = esc($dateFrom ?? '') ?> to = esc($dateTo ?? '') ?>
+
+
+
+
+
+
+ _
+
+
+ _ ';
+ }
+
+ $currentSupplier = $supplierName;
+ $currentGst = $gstNo;
+ $currentState = $state;
+ $supplierSr = 0;
+ $supplierTaxable = 0.0;
+ $supplierGst = 0.0;
+ $supplierAmount = 0.0;
+ ?>
+
+ = esc($currentSupplier) ?> / GST No. = esc($currentGst) ?> / State : = esc($currentState) ?>
+
+
+ #
+ Purchase. Inv. ID
+ Inv. Date
+ Taxable Amt
+ Tax Amt
+ Inv. Amount
+
+
+
+ = esc((string) $supplierSr) ?>
+ = esc((string) ($row['invoice_no'] ?? '')) ?>
+ = esc((string) ($row['str_date_of_invoice'] ?? '')) ?>
+ = esc(number_format($taxable, 2)) ?>
+ = esc(number_format($gst, 2)) ?>
+ = esc(number_format($amount, 0, '.', '')) ?>
+
+
+
+
+ = $printSupplierTotal($currentSupplier, $supplierTaxable, $supplierGst, $supplierAmount) ?>
+
+
+
+ #
+
+ Grand Total
+ = esc(number_format($totalTaxable, 2)) ?>
+ = esc(number_format($totalGst, 2)) ?>
+ = esc(number_format($totalAmount, 0, '.', '')) ?>
+
+
+
+
diff --git a/app/Views/medical/report_purchase_invoice_data_gst.php b/app/Views/medical/report_purchase_invoice_data_gst.php
new file mode 100644
index 0000000..fbec376
--- /dev/null
+++ b/app/Views/medical/report_purchase_invoice_data_gst.php
@@ -0,0 +1,66 @@
+
+
+ Date: = esc($dateFrom ?? '') ?> to = esc($dateTo ?? '') ?>
+
+
+
+
+
+ #
+ Invoice
+ Supplier
+ Date
+ Taxable Amt
+ GST Amt
+ Inv Amount
+ 0%
+ 5%
+ 12%
+ 18%
+ 28%
+ CGST
+ SGST/IGST
+
+
+
+
+
+ = esc((string) $i++) ?>
+ = esc((string) ($row['invoice_no'] ?? '')) ?>
+ = esc((string) ($row['name_supplier'] ?? '')) ?>
+ = esc((string) ($row['str_date_of_invoice'] ?? '')) ?>
+ = esc(number_format($taxable, 2)) ?>
+ = esc(number_format($gst, 2)) ?>
+ = esc(number_format($amount, 2)) ?>
+ = esc(number_format((float) ($row['tot_gst_0'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['tot_gst_5'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['tot_gst_12'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['tot_gst_18'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['tot_gst_28'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['total_cgst'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['total_sgst'] ?? 0), 2)) ?>
+
+
+
+
+
+ Total
+ = esc(number_format($totalTaxable, 2)) ?>
+ = esc(number_format($totalGst, 2)) ?>
+ = esc(number_format($totalAmount, 2)) ?>
+
+
+
+
+
diff --git a/app/Views/medical/report_purchase_invoice_data_gst_pdf.php b/app/Views/medical/report_purchase_invoice_data_gst_pdf.php
new file mode 100644
index 0000000..6a8e11d
--- /dev/null
+++ b/app/Views/medical/report_purchase_invoice_data_gst_pdf.php
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+
+
+Purchase Invoice GST Rate Report
+Date: = esc($dateFrom ?? '') ?> to = esc($dateTo ?? '') ?>
+
+
+
+
+ #
+ Invoice
+ Supplier
+ Date
+ Taxable
+ GST
+ Amount
+ 0%
+ 5%
+ 12%
+ 18%
+ 28%
+ CGST
+ SGST/IGST
+
+
+
+
+
+ = esc((string) $i++) ?>
+ = esc((string) ($row['invoice_no'] ?? '')) ?>
+ = esc((string) ($row['name_supplier'] ?? '')) ?>
+ = esc((string) ($row['str_date_of_invoice'] ?? '')) ?>
+ = esc(number_format($taxable, 2)) ?>
+ = esc(number_format($gst, 2)) ?>
+ = esc(number_format($amount, 2)) ?>
+ = esc(number_format($zero, 2)) ?>
+ = esc(number_format($five, 2)) ?>
+ = esc(number_format($twelve, 2)) ?>
+ = esc(number_format($eighteen, 2)) ?>
+ = esc(number_format($twentyEight, 2)) ?>
+ = esc(number_format($cgst, 2)) ?>
+ = esc(number_format($sgst, 2)) ?>
+
+
+
+
+
+ Total
+ = esc(number_format($totalTaxable, 2)) ?>
+ = esc(number_format($totalGst, 2)) ?>
+ = esc(number_format($totalAmount, 2)) ?>
+ = esc(number_format($totalZero, 2)) ?>
+ = esc(number_format($totalFive, 2)) ?>
+ = esc(number_format($totalTwelve, 2)) ?>
+ = esc(number_format($totalEighteen, 2)) ?>
+ = esc(number_format($totalTwentyEight, 2)) ?>
+ = esc(number_format($totalCgst, 2)) ?>
+ = esc(number_format($totalSgst, 2)) ?>
+
+
+
+
+
diff --git a/app/Views/medical/report_purchase_invoice_data_pdf.php b/app/Views/medical/report_purchase_invoice_data_pdf.php
new file mode 100644
index 0000000..dc09120
--- /dev/null
+++ b/app/Views/medical/report_purchase_invoice_data_pdf.php
@@ -0,0 +1,118 @@
+'
+ . '# '
+ . 'Total of : ' . esc($supplierName) . ' '
+ . '' . esc(number_format($taxable, 2)) . ' '
+ . '' . esc(number_format($gst, 2)) . ' '
+ . '' . esc(number_format($amount, 0, '.', '')) . ' '
+ . '';
+};
+?>
+
+
+
+
+
+
+
+Purchase Invoice Report
+Date: = esc($dateFrom ?? '') ?> to = esc($dateTo ?? '') ?>
+
+
+
+ _
+
+ _ ';
+ }
+
+ $currentSupplier = $supplierName;
+ $currentGst = $gstNo;
+ $currentState = $state;
+ $supplierSr = 0;
+ $supplierTaxable = 0.0;
+ $supplierGst = 0.0;
+ $supplierAmount = 0.0;
+ ?>
+
+ = esc($currentSupplier) ?> / GST No. = esc($currentGst) ?> / State : = esc($currentState) ?>
+
+
+ #
+ Purchase. Inv. ID
+ Inv. Date
+ Taxable Amt
+ Tax Amt
+ Inv. Amount
+
+
+
+ = esc((string) $supplierSr) ?>
+ = esc((string) ($row['invoice_no'] ?? '')) ?>
+ = esc((string) ($row['str_date_of_invoice'] ?? '')) ?>
+ = esc(number_format($taxable, 2)) ?>
+ = esc(number_format($gst, 2)) ?>
+ = esc(number_format($amount, 0, '.', '')) ?>
+
+
+
+
+ = $printSupplierTotal($currentSupplier, $supplierTaxable, $supplierGst, $supplierAmount) ?>
+
+
+
+ #
+
+ Grand Total
+ = esc(number_format($totalTaxable, 2)) ?>
+ = esc(number_format($totalGst, 2)) ?>
+ = esc(number_format($totalAmount, 0, '.', '')) ?>
+
+
+
+
+
diff --git a/app/Views/medical/report_short_medicine.php b/app/Views/medical/report_short_medicine.php
new file mode 100644
index 0000000..90174e2
--- /dev/null
+++ b/app/Views/medical/report_short_medicine.php
@@ -0,0 +1,119 @@
+
+
Medicine Short Report
+
+
+
+
+
+
+
+ From Date
+
+
+
+ To Date
+
+
+
+
+
Formulation
+
+
+ = esc((string) ($row->formulation_length ?? ($row->formulation ?? ('Formulation-' . ($row->id ?? ''))))) ?>
+
+
+
Blank = All formulations
+
+
+
+ Show
+ Excel
+ Print
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/report_short_medicine_data.php b/app/Views/medical/report_short_medicine_data.php
new file mode 100644
index 0000000..1cae003
--- /dev/null
+++ b/app/Views/medical/report_short_medicine_data.php
@@ -0,0 +1,69 @@
+
+
+
+ Date range: = esc($dateFrom) ?> to = esc($dateTo) ?>
+
+
+
+
+
+
+ ID
+ Date
+ Item Name
+ Formulation
+ Qty
+ Supplier
+
+
+
+
+
+
+ = esc((string) ($row['id'] ?? '')) ?>
+ = esc((string) ($row['str_short_date'] ?? '')) ?>
+ = esc((string) ($row['item_name'] ?? '-')) ?>
+ = esc((string) ($row['formulation'] ?? '-')) ?>
+ = esc(number_format((float) ($row['cur_qty'] ?? 0), 0)) ?>
+ = esc((string) ($row['supplier_name'] ?? '-')) ?>
+
+
+
+
+ No records found for selected filters.
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/search_customer.php b/app/Views/medical/search_customer.php
new file mode 100644
index 0000000..af64d2e
--- /dev/null
+++ b/app/Views/medical/search_customer.php
@@ -0,0 +1,62 @@
+
+
+
OPD Sale - Patient Search
+
+
+ = csrf_field() ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/stock_statement.php b/app/Views/medical/stock_statement.php
new file mode 100644
index 0000000..a0fde10
--- /dev/null
+++ b/app/Views/medical/stock_statement.php
@@ -0,0 +1,109 @@
+
+
+
+
+
+
Item Stock Statement
+
Back to Master
+
+
+
+
+ Supplier
+
+ All
+
+ = esc($row->name_supplier ?? '') ?>
+
+
+
+
+ From
+
+
+
+ To
+
+
+
+ Search Items
+
+
+
+ Search
+
+
+ Search Items Excel
+ Items BatchWise Excel
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/stock_statement_data.php b/app/Views/medical/stock_statement_data.php
new file mode 100644
index 0000000..28f0c65
--- /dev/null
+++ b/app/Views/medical/stock_statement_data.php
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+ Item Name
+ Pur Pak.
+ Pur Cost
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Lost Unit
+ Package/Re-Order Qty
+
+
+
+
+
+ = esc($row->item_name ?? '') ?>
+ = esc(number_format((float) ($row->total_pak_qty ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->purchase_cost ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->C_Pak_Qty ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->C_Unit_Stock_Qty ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->C_Pak_Sale_Qty ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->sale_unit ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->total_lost_unit ?? 0), 2)) ?>
+ = esc((string) ($row->packing ?? 0)) ?>/= esc((string) ($row->re_order_qty ?? 0)) ?>
+
+
+
+
+
+
+
diff --git a/app/Views/medical/stock_transfer.php b/app/Views/medical/stock_transfer.php
new file mode 100644
index 0000000..dfabe2a
--- /dev/null
+++ b/app/Views/medical/stock_transfer.php
@@ -0,0 +1,174 @@
+
+
+
+
Purchase Item Transfer
+
Back to Master
+
+
+
+
+
+
+ From Purchase SSNO
+
+
+
+
+
+
+
+ To Purchase SSNO
+
+
+
+
+
+
+
+ Qty (unit)
+
+
+
+ Transfer Sale
+
+
+
+
+
Recent Transfer Logs
+
+
+
+
+ ID
+ Summary
+ By
+ At
+
+
+
+ Loading...
+
+
+
+
+
+
+
diff --git a/app/Views/medical/store_stock_result.php b/app/Views/medical/store_stock_result.php
new file mode 100644
index 0000000..94119c1
--- /dev/null
+++ b/app/Views/medical/store_stock_result.php
@@ -0,0 +1,478 @@
+ 0, 'd0_30' => 0, 'd31_60' => 0, 'd61_90' => 0];
+$topSaleRows = $top_sale_rows ?? [];
+$topSaleLabels = $top_sale_labels ?? [];
+$topSaleValues = $top_sale_values ?? [];
+$ratioRows = $ratio_rows ?? [];
+$ratioLabels = $ratio_labels ?? [];
+$ratioValues = $ratio_values ?? [];
+?>
+
+
+
+
+
Total Items
+
= esc((string) $totalItems) ?>
+
+
+
+
+
Low Stock Items
+
= esc((string) $lowStockItems) ?>
+
+
+
+
+
+
+
Pharmacy Stock Graph (Top 10 by Current Unit Qty)
+
+
+
+
+
+
+
+
+
+
Expired Units
+
= esc(number_format((float) ($expirySummary['expired'] ?? 0), 2)) ?>
+
+
+
+
+
Due 0-30 Days
+
= esc(number_format((float) ($expirySummary['d0_30'] ?? 0), 2)) ?>
+
+
+
+
+
Due 31-60 Days
+
= esc(number_format((float) ($expirySummary['d31_60'] ?? 0), 2)) ?>
+
+
+
+
+
Due 61-90 Days
+
= esc(number_format((float) ($expirySummary['d61_90'] ?? 0), 2)) ?>
+
+
+
+
+
+
+
Near Expiry Graph (Current Units)
+
+
+
+
+
+
+
+
+
+
+
Highest Sale Medicines (Last 30 Days)
+
+
+
+
+
+
+
+ Medicine
+ Sale Qty (30d)
+
+
+
+
+
+
+ = esc((string) ($row['item_name'] ?? '')) ?>
+ = esc(number_format((float) ($row['sale_qty_30'] ?? 0), 2)) ?>
+
+
+
+
+ No sale data found for last 30 days.
+
+
+
+
+
+
+
+
+
+
+
+
+
High Stock / Low Sale Ratio
+
+
+
+
+
+
+
+ Medicine
+ Current Stock
+ Sale Qty (30d)
+ Ratio
+
+
+
+
+
+
+ = esc((string) ($row['item_name'] ?? '')) ?>
+ = esc(number_format((float) ($row['current_unit_qty'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['sale_qty_30'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($row['stock_sale_ratio'] ?? 0), 2)) ?>
+
+
+
+
+ No stock ratio data found.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Item Name
+ Generic Name
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Lost Unit
+ Package/Re-Order Qty
+
+
+
+
+
+
+ = esc($row->item_name ?? '') ?>
+ = esc($row->genericname ?? '') ?>
+ = esc((string) ($row->C_Pak_Qty ?? 0)) ?>
+ = esc(number_format((float) ($row->C_Unit_Stock_Qty ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->C_Pak_Sale_Qty ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->sale_unit ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->total_lost_unit ?? 0), 2)) ?>
+ = esc((string) ($row->packing ?? 0)) ?>/= esc((string) ($row->re_order_qty ?? 0)) ?>
+
+
+
+
+ No stock items found for selected filters.
+
+
+
+
+
+
+
diff --git a/app/Views/medical/store_stock_search.php b/app/Views/medical/store_stock_search.php
new file mode 100644
index 0000000..3e3ae98
--- /dev/null
+++ b/app/Views/medical/store_stock_search.php
@@ -0,0 +1,146 @@
+
+
+
+
Store Stock : Pharmacy
+
Datewise Statement
+
+
+
+
+ Supplier
+
+ Select Supplier
+
+
+ = esc($supplier->name_supplier ?? '') ?>
+
+
+
+
+
+
+ Schedule
+
+ Schedule H
+ Schedule H1
+ Schedule X
+ Schedule G
+ Narcotic
+ High Risk
+
+
+
+
Search
+
+
+ Search Items
+ Search Items Excel
+ Items BatchWise Excel
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/supplier_account.php b/app/Views/medical/supplier_account.php
new file mode 100644
index 0000000..a5ccd53
--- /dev/null
+++ b/app/Views/medical/supplier_account.php
@@ -0,0 +1,51 @@
+
+
+
+
Supplier List
+
Back to Master
+
+
+
+
+
+
+ Name
+ Balance
+ Last Inv. Date
+ Last Payment Date
+
+
+
+
+
+ Tot_Balance ?? 0); ?>
+
+ = esc($row->name_supplier ?? '') ?>
+ = esc(number_format(abs($balance), 2)) ?> = $balance < 0 ? 'Dr ' : 'Cr ' ?>
+ = esc($row->Last_InvDate ?? '') ?>
+ = esc($row->Last_Payment ?? '') ?>
+
+ Open
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/supplier_account_add_entry.php b/app/Views/medical/supplier_account_add_entry.php
new file mode 100644
index 0000000..865b046
--- /dev/null
+++ b/app/Views/medical/supplier_account_add_entry.php
@@ -0,0 +1,51 @@
+
+
+
+ = esc((string) $error) ?>
+
+
+
+
+
+
+
+ Cr/Dr
+
+ >Credit
+ >Debit
+
+
+
+
+ Mode
+
+
+ bank_id ?? 0); ?>
+ >= esc(trim((string) (($row->bank_account_name ?? '') . ' ' . ($row->bank_name ?? '')))) ?>
+
+
+
+
+
+ Date Of Tran.
+
+
+
+
+ Amount
+
+
+
+
+ Remark/Chq. No.
+ = esc((string) ($old['tran_desc'] ?? '')) ?>
+
+
+
+ Save
+
+
diff --git a/app/Views/medical/supplier_account_detail.php b/app/Views/medical/supplier_account_detail.php
new file mode 100644
index 0000000..c5a4aae
--- /dev/null
+++ b/app/Views/medical/supplier_account_detail.php
@@ -0,0 +1,256 @@
+sid ?? 0);
+$today = date('Y-m-d');
+$defaultDateFrom = (string) ($default_date_from ?? $today);
+$defaultDateTo = (string) ($default_date_to ?? $today);
+?>
+
+
+
+
+
+ Ledger Account: = esc($supplier->name_supplier ?? '-') ?>
+ Balance: = esc(number_format((float) ($supplier->Tot_Balance ?? 0), 2)) ?>
+
+
+
+
+
+
+ From
+
+
+
+ To
+
+
+
+ Show
+ Print
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/medical/supplier_account_edit_entry.php b/app/Views/medical/supplier_account_edit_entry.php
new file mode 100644
index 0000000..fa1dff3
--- /dev/null
+++ b/app/Views/medical/supplier_account_edit_entry.php
@@ -0,0 +1,52 @@
+
+
+
+ = esc((string) $error) ?>
+
+
+
+
+
+
+
+
+ Cr/Dr
+
+ >Credit
+ >Debit
+
+
+
+
+ Mode
+
+
+ bank_id ?? 0); ?>
+ >= esc(trim((string) (($row->bank_account_name ?? '') . ' ' . ($row->bank_name ?? '')))) ?>
+
+
+
+
+
+ Date Of Tran.
+
+
+
+
+ Amount
+
+
+
+
+ Remark/Chq. No.
+ = esc((string) ($old['tran_desc'] ?? '')) ?>
+
+
+
+ Update
+
+
diff --git a/app/Views/medical/supplier_account_ledger_data.php b/app/Views/medical/supplier_account_ledger_data.php
new file mode 100644
index 0000000..cca5668
--- /dev/null
+++ b/app/Views/medical/supplier_account_ledger_data.php
@@ -0,0 +1,35 @@
+
+ Opening Balance: = esc(number_format((float) ($balance_till_date ?? 0), 2)) ?>
+ | Total Credit: = esc(number_format((float) ($cr_total ?? 0), 2)) ?>
+ | Total Debit: = esc(number_format((float) ($dr_total ?? 0), 2)) ?>
+ | Closing Balance: = esc(number_format((float) ($balance_till_date_close ?? 0), 2)) ?>
+
+
+
+
+
+
+ ID
+ Date Tran
+ Description
+ Credit
+ Debit
+ Actions
+
+
+
+
+
+ = esc((string) $i) ?>
+ = esc(!empty($row->tran_date) ? date('d-m-Y', strtotime((string) $row->tran_date)) : '') ?>
+ = esc(trim((string) (($row->mode_desc ?? '') . ' ' . ($row->tran_desc ?? '')))) ?>
+ = (int) ($row->credit_debit ?? 0) === 0 ? esc(number_format((float) ($row->amount ?? 0), 2)) : '' ?>
+ = (int) ($row->credit_debit ?? 0) === 1 ? esc(number_format((float) ($row->amount ?? 0), 2)) : '' ?>
+
+ Edit Entry
+
+
+
+
+
+
diff --git a/app/Views/medical/supplier_account_ledger_pdf.php b/app/Views/medical/supplier_account_ledger_pdf.php
new file mode 100644
index 0000000..3e30cef
--- /dev/null
+++ b/app/Views/medical/supplier_account_ledger_pdf.php
@@ -0,0 +1,119 @@
+
+
+
+
+ Supplier Ledger
+
+
+
+
+
+
+
= esc($pharmacyName !== '' ? $pharmacyName : 'Pharmacy') ?>
+
= esc($pharmacyAddress) ?>= $pharmacyState !== '' ? ', ' . esc($pharmacyState) : '' ?>
+
+
+ Phone: = esc($pharmacyPhone) ?>
+
+ |
+
+ GST No.: = esc($pharmacyGst) ?>
+
+
+
+
+ Supplier Ledger: = esc($supplier->name_supplier ?? '-') ?>
+ {$addrField} ?? '')) {
+ $supplierAddress = trim((string) $supplier->{$addrField});
+ break;
+ }
+ }
+
+ $supplierCity = trim((string) ($supplier->city ?? ''));
+ $supplierState = trim((string) ($supplier->state ?? ''));
+ $supplierPhone = trim((string) ($supplier->contact_no ?? ''));
+ $supplierGst = trim((string) ($supplier->gst_no ?? ''));
+
+ $supplierAddressLine = $supplierAddress;
+ if ($supplierCity !== '') {
+ $supplierAddressLine .= ($supplierAddressLine !== '' ? ', ' : '') . $supplierCity;
+ }
+ if ($supplierState !== '') {
+ $supplierAddressLine .= ($supplierAddressLine !== '' ? ', ' : '') . $supplierState;
+ }
+ ?>
+
+
+ Supplier Address: = esc($supplierAddressLine) ?>
+
+
+ Supplier Phone: = esc($supplierPhone) ?>
+
+ |
+
+ Supplier GST No.: = esc($supplierGst) ?>
+
+
+ Date Range: = esc((string) ($dateFrom ?? '')) ?> to = esc((string) ($dateTo ?? '')) ?>
+
+
+ Opening Balance: = esc(number_format((float) ($balance_till_date ?? 0), 2)) ?>
+ | Total Credit: = esc(number_format((float) ($cr_total ?? 0), 2)) ?>
+ | Total Debit: = esc(number_format((float) ($dr_total ?? 0), 2)) ?>
+ | Closing Balance: = esc(number_format((float) ($balance_till_date_close ?? 0), 2)) ?>
+
+
+
+
+
+ #
+ Date Tran
+ Description
+ Credit
+ Debit
+
+
+
+
+
+ = esc((string) $i) ?>
+ = esc(!empty($row->tran_date) ? date('d-m-Y', strtotime((string) $row->tran_date)) : '') ?>
+ = esc(trim((string) (($row->mode_desc ?? '') . ' ' . ($row->tran_desc ?? '')))) ?>
+ = (int) ($row->credit_debit ?? 0) === 0 ? esc(number_format((float) ($row->amount ?? 0), 2)) : '' ?>
+ = (int) ($row->credit_debit ?? 0) === 1 ? esc(number_format((float) ($row->amount ?? 0), 2)) : '' ?>
+
+
+
+
+
+
diff --git a/app/Views/medical/supplier_edit.php b/app/Views/medical/supplier_edit.php
new file mode 100644
index 0000000..e5da5bb
--- /dev/null
+++ b/app/Views/medical/supplier_edit.php
@@ -0,0 +1,103 @@
+sid ?? 0);
+ $nameSupplier = (string) ($row->name_supplier ?? '');
+ $shortName = (string) ($row->short_name ?? '');
+ $contactNo = (string) ($row->contact_no ?? '');
+ $gstNo = (string) ($row->gst_no ?? '');
+ $city = (string) ($row->city ?? '');
+ $state = (string) ($row->state ?? '');
+ $active = (int) ($row->active ?? 1);
+}
+?>
+
+
+
+
diff --git a/app/Views/medical/supplier_master.php b/app/Views/medical/supplier_master.php
new file mode 100644
index 0000000..2d4f773
--- /dev/null
+++ b/app/Views/medical/supplier_master.php
@@ -0,0 +1,17 @@
+
+
+
+
Supplier Master
+ Add New
+
+
+
+
+
+ = view('medical/supplier_master_sub', ['supplier_data' => $supplier_data ?? []]) ?>
+
+
+
+
+
+
diff --git a/app/Views/medical/supplier_master_sub.php b/app/Views/medical/supplier_master_sub.php
new file mode 100644
index 0000000..f5f337c
--- /dev/null
+++ b/app/Views/medical/supplier_master_sub.php
@@ -0,0 +1,34 @@
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+ = esc($row->name_supplier ?? '') ?>
+ = esc($row->gst_no ?? '') ?>
+
+ Edit
+
+
+
+
+
+
+
diff --git a/app/Views/medical/uhid_report_pdf.php b/app/Views/medical/uhid_report_pdf.php
new file mode 100644
index 0000000..997d560
--- /dev/null
+++ b/app/Views/medical/uhid_report_pdf.php
@@ -0,0 +1,155 @@
+ 0, 'paid' => 0, 'balance' => 0];
+
+$pharmacyName = defined('M_store') ? (string) M_store : 'Medical Store';
+$pharmacyAddress = defined('M_address') ? (string) M_address : '';
+$pharmacyPhone = defined('M_Phone_Number') ? (string) M_Phone_Number : '';
+$pharmacyGst = defined('H_Med_GST') ? (string) H_Med_GST : '';
+
+$patientName = (string) ($patient->p_fname ?? '-');
+$patientCode = (string) ($patient->p_code ?? $searchUhid ?: '-');
+?>
+
+
+
+
+
+
+
+ = esc($pharmacyName) ?>
+
+ = esc($pharmacyAddress) ?>
+ | Phone: = esc($pharmacyPhone) ?>
+ | GST: = esc($pharmacyGst) ?>
+ Print Bill on UHID | Date Range: = esc($dateFrom) ?> to = esc($dateTo) ?> | UHID: = esc($patientCode) ?> | Patient: = esc($patientName) ?>
+
+
+
+
+
+
+ id ?? 0);
+ $invoiceCode = (string) ($invoice->inv_med_code ?? ('M' . date('ym') . str_pad(substr((string) $invoiceId, -7, 7), 7, '0', STR_PAD_LEFT)));
+ $invoiceDate = !empty($invoice->inv_date) ? date('d-m-Y', strtotime((string) $invoice->inv_date)) : '-';
+ $docName = trim((string) ($invoice->doc_name ?? '-'));
+ $itemRows = $itemsByInvoice[$invoiceId] ?? [];
+ $paymentRows = $paymentsByInvoice[$invoiceId] ?? [];
+ ?>
+
+ Invoice: = esc($invoiceCode) ?> | Date: = esc($invoiceDate) ?> | Doctor: = esc($docName !== '' ? $docName : '-') ?>
+
+
+
+
+ #
+ Item Name
+ Batch
+ Exp.
+ Qty
+ Rate
+ Gross
+ Disc.
+ Inc. GST
+ Net
+
+
+
+
+ No items
+
+ $item): ?>
+ amount ?? 0);
+ $disc = (float) (($item->disc_amount ?? 0) + ($item->disc_whole ?? 0));
+ $net = (float) ($item->twdisc_amount ?? $item->tamount ?? $gross);
+ $cgst = (float) ($item->CGST ?? 0);
+ $sgst = (float) ($item->SGST ?? 0);
+ ?>
+
+ = (int) $idx + 1 ?>
+ = esc(trim((string) (($item->item_Name ?? $item->item_name ?? '-') . ' ' . ($item->formulation ?? '')))) ?>
+ = esc((string) ($item->batch_no ?? '-')) ?>
+ = esc(!empty($item->expiry) ? date('m-Y', strtotime((string) $item->expiry)) : '-') ?>
+ = esc(number_format((float) ($item->qty ?? 0), 2)) ?>
+ = esc(number_format((float) ($item->price ?? 0), 2)) ?>
+ = esc(number_format($gross, 2)) ?>
+ = esc(number_format($disc, 2)) ?>
+ = esc(number_format($cgst + $sgst, 2)) ?>
+ = esc(number_format($net, 2)) ?>
+
+
+
+
+
+
+ Invoice Total
+ = esc(number_format((float) ($invoice->gross_amount ?? 0), 2)) ?>
+ = esc(number_format((float) (($invoice->disc_amount ?? 0) + ($invoice->discount_amount ?? 0)), 2)) ?>
+ = esc(number_format((float) (($invoice->CGST_Tamount ?? 0) + ($invoice->SGST_Tamount ?? 0)), 2)) ?>
+ = esc(number_format((float) ($invoice->net_amount ?? 0), 2)) ?>
+
+
+
+
+
+
+
+ Payment Details:
+
+ payment_mode ?? 1) === 2) ? 'Bank Card' : 'Cash';
+ if ((int) ($pay->payment_mode ?? 0) > 2) {
+ $mode = 'Other';
+ }
+ if ((int) ($pay->credit_debit ?? 0) > 0) {
+ $mode .= ' Return';
+ }
+ ?>
+ [= esc((string) ($pay->id ?? '-')) ?>:= esc($mode) ?>:= esc(number_format((float) ($pay->amount ?? 0), 2)) ?>]
+
+
+
+
+
+
+
+
+
+
+
+ Total Net Amount
+ Paid Amount
+ Balance Amount
+
+
+ = esc(number_format((float) ($grand['net'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($grand['paid'] ?? 0), 2)) ?>
+ = esc(number_format((float) ($grand['balance'] ?? 0), 2)) ?>
+
+
+
+
+
diff --git a/app/Views/org_packing/cases_list.php b/app/Views/org_packing/cases_list.php
new file mode 100644
index 0000000..6d08eee
--- /dev/null
+++ b/app/Views/org_packing/cases_list.php
@@ -0,0 +1,66 @@
+
+
+ No cases added to this packing yet. Use the search above to add cases.
+
+
+
+
+
+
+ Sr.
+ Case Code
+ UHID
+ Patient Name
+ Age
+ Type
+ Insurance Co.
+ Insurance No
+ Action
+
+
+
+
+
+ = $sr++ ?>
+ = esc($case->case_id_code) ?>
+ = esc($case->p_code) ?>
+ = esc($case->p_fname) ?>
+ = esc($case->age) ?>
+
+ ipd_opd == 'OPD'): ?>
+ OPD
+
+ IPD
+
+
+ = esc($case->insurance_company_name) ?>
+
+ = esc($case->insurance_no) ?>
+ insurance_no_1)): ?>
+ = esc($case->insurance_no_1) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Total Cases: = count($cases) ?>
+
+
+
+
+
+
diff --git a/app/Views/org_packing/create.php b/app/Views/org_packing/create.php
new file mode 100644
index 0000000..8b434fe
--- /dev/null
+++ b/app/Views/org_packing/create.php
@@ -0,0 +1,122 @@
+
+
+
+ Create New Packing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Organization Type *
+
+ Select Type
+ OPD
+ IPD
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/org_packing/edit.php b/app/Views/org_packing/edit.php
new file mode 100644
index 0000000..5765cd5
--- /dev/null
+++ b/app/Views/org_packing/edit.php
@@ -0,0 +1,231 @@
+
+
+
+ Edit Packing
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Label No *
+
+
+
+ Date Created *
+
+
+
+ Organization Type *
+
+ org_type == 0 ? 'selected' : '' ?>>OPD
+ org_type == 1 ? 'selected' : '' ?>>IPD
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Search and Select Case
+
+ Type to search by case code, patient name, or UHID
+
+
+
+
+ Add to Packing
+
+
+
+
+
+
+
+
+
+
+ = view('org_packing/cases_list', ['cases' => $cases, 'packing_id' => $packing_id]) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/org_packing/index.php b/app/Views/org_packing/index.php
new file mode 100644
index 0000000..973215e
--- /dev/null
+++ b/app/Views/org_packing/index.php
@@ -0,0 +1,130 @@
+
+
+
+ Organization Packing Management
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Enter search term or leave blank to show recent packings
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/org_packing/print_ipd.php b/app/Views/org_packing/print_ipd.php
new file mode 100644
index 0000000..a40bf4f
--- /dev/null
+++ b/app/Views/org_packing/print_ipd.php
@@ -0,0 +1,137 @@
+
+
+
+ IPD Packing List - = esc($packing->label_no) ?>
+
+
+
+
+
+
+
+
+ Print
+
+ Close
+
+
+
+
+
+
+
+
+
+ Total Cases: = count($cases) ?>
+
+
+ Type: IPD TPA Cases
+
+
+
+
+
+
+
+
+
+ Sr.
+ Case Code
+ IPD Code
+ UHID
+ Patient Name
+ Age
+ Admit Date
+ Discharge Date
+ Insurance No
+ Claim Amount
+
+
+
+ claim_amt;
+ ?>
+
+ = $sr++ ?>
+ = esc($case->case_id_code) ?>
+ = esc($case->ipd_code ?? '-') ?>
+ = esc($case->p_code) ?>
+ = esc($case->p_fname) ?>
+ = esc($case->age) ?>
+ = esc($case->admit_date ?? '-') ?>
+ = esc($case->discharge_date ?? '-') ?>
+
+ = esc($case->insurance_no) ?>
+ insurance_no_1)): ?>
+ = esc($case->insurance_no_1) ?>
+
+
+ = number_format($case->claim_amt, 2) ?>
+
+
+
+
+
+ Total Claim Amount:
+ = number_format($totalClaim, 2) ?>
+
+
+
+
+
No cases in this packing
+
+
+
+
+
+ Prepared By
+ = date('d-m-Y H:i') ?>
+
+
+ Verified By
+
+
+ Approved By
+
+
+
+
+
+
+
diff --git a/app/Views/org_packing/print_opd.php b/app/Views/org_packing/print_opd.php
new file mode 100644
index 0000000..212060e
--- /dev/null
+++ b/app/Views/org_packing/print_opd.php
@@ -0,0 +1,133 @@
+
+
+
+ OPD Packing List - = esc($packing->label_no) ?>
+
+
+
+
+
+
+
+
+ Print
+
+ Close
+
+
+
+
+
+
+
+
+
+ Total Cases: = count($cases) ?>
+
+
+ Type: OPD Organization Cases
+
+
+
+
+
+
+
+
+
+ Sr.
+ Case Code
+ UHID
+ Patient Name
+ Age
+ OPD Date
+ Insurance No
+ Claim Amount
+
+
+
+ claim_amt;
+ ?>
+
+ = $sr++ ?>
+ = esc($case->case_id_code) ?>
+ = esc($case->p_code) ?>
+ = esc($case->p_fname) ?>
+ = esc($case->age) ?>
+ = esc($case->opd_date ?? '-') ?>
+
+ = esc($case->insurance_no) ?>
+ insurance_no_1)): ?>
+ = esc($case->insurance_no_1) ?>
+
+
+ = number_format($case->claim_amt, 2) ?>
+
+
+
+
+
+ Total Claim Amount:
+ = number_format($totalClaim, 2) ?>
+
+
+
+
+
No cases in this packing
+
+
+
+
+
+ Prepared By
+ = date('d-m-Y H:i') ?>
+
+
+ Verified By
+
+
+ Approved By
+
+
+
+
+
+
+
diff --git a/app/Views/org_packing/search_result.php b/app/Views/org_packing/search_result.php
new file mode 100644
index 0000000..1b1aaf7
--- /dev/null
+++ b/app/Views/org_packing/search_result.php
@@ -0,0 +1,67 @@
+
+
+ No packing records found
+
+
+
+
+
+
+ Sr.
+ Label No
+ Date Created
+ Type
+ No. of Cases
+ Status
+ Actions
+
+
+
+
+
+ = $sr++ ?>
+ = esc($packing->label_no) ?>
+ = esc($packing->date_created) ?>
+
+ list_type == 'OPD'): ?>
+ = $packing->list_type ?>
+
+ = $packing->list_type ?>
+
+
+ = $packing->no_records ?>
+
+ files_status == 1): ?>
+ Completed
+
+ Pending
+
+
+
+
+
+
+
+
+
+
+
+ Showing = count($packings) ?> packing record(s)
+
+
diff --git a/app/Views/partials/header.php b/app/Views/partials/header.php
new file mode 100644
index 0000000..a091ba8
--- /dev/null
+++ b/app/Views/partials/header.php
@@ -0,0 +1,78 @@
+
\ No newline at end of file
diff --git a/app/Views/partials/sidebar.php b/app/Views/partials/sidebar.php
new file mode 100644
index 0000000..5cba00d
--- /dev/null
+++ b/app/Views/partials/sidebar.php
@@ -0,0 +1,215 @@
+user() : null;
+$canTemplate = false;
+if ($user && method_exists($user, 'can')) {
+ $canTemplate = $user->can('template.pathology')
+ || $user->can('template.ultrasound')
+ || $user->can('template.xray')
+ || $user->can('template.ct')
+ || $user->can('template.mri')
+ || $user->can('template.echo')
+ || $user->can('template.*');
+}
+
+if (! $canTemplate && $user && method_exists($user, 'inGroup')) {
+ $canTemplate = $user->inGroup('superadmin', 'admin', 'developer');
+}
+
+$canIpdBilling = $user && method_exists($user, 'can')
+ ? ($user->can('billing.ipd.access')
+ || $user->can('billing.ipd.current-admission')
+ || $user->can('billing.ipd.invoice')
+ || $user->can('billing.ipd.cash-balance')
+ || $user->can('billing.access'))
+ : false;
+
+$canPharmacy = true;
+if ($user && method_exists($user, 'can')) {
+ $canPharmacy = $user->can('pharmacy.access')
+ || $user->can('billing.access');
+}
+
+if (! $canPharmacy && $user && method_exists($user, 'inGroup')) {
+ $canPharmacy = $user->inGroup('superadmin', 'admin', 'developer');
+}
+?>
+
\ No newline at end of file
diff --git a/app/Views/report/collection_report.php b/app/Views/report/collection_report.php
new file mode 100644
index 0000000..020c4b3
--- /dev/null
+++ b/app/Views/report/collection_report.php
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+ Employee Name
+
+ All Employees
+
+ = esc($row->username ?? '') ?>
+
+
+
+
+ Payment Mode
+
+ Cash & Bank
+
+ = esc($row->mode_desc ?? '') ?>
+
+
+
+
+
+
+ Show
+ Export
+
+
+
+
+
+
+
Select filters and click Show.
+
+
+
+
+
diff --git a/app/Views/report/collection_report_table.php b/app/Views/report/collection_report_table.php
new file mode 100644
index 0000000..6b58758
--- /dev/null
+++ b/app/Views/report/collection_report_table.php
@@ -0,0 +1,59 @@
+
+
+Date(YYYY-MM-DD h:m) between = esc($minRange) ?> and = esc($maxRange) ?>
+
+
+ No records found for the selected filters.
+
+
+
+
+ PayID
+ Date
+ Type of Payment
+ OPD/IPD/In. Code
+ Pay Mode
+ Amt (Cr.)
+ Amt (Dr.)
+ Bank/Source
+ Remark
+ Employee
+
+
+
+
+
+ = esc($row->pay_id ?? '') ?>
+ = esc($row->str_payment_date ?? '') ?>
+ = esc($row->pay_type ?? '') ?>
+ = esc(($row->payof_code ?? '') . ' ' . ($row->patient_name ?? '')) ?>
+ = esc($row->pay_mode ?? '') ?>
+ = esc(number_format((float) ($row->cr_amount ?? 0), 2)) ?>
+ = esc(number_format((float) ($row->dr_amount ?? 0), 2)) ?>
+ = esc(trim(($row->bank_name ?? '') . ' ' . ($row->bank_type ?? ''))) ?>
+ = esc($row->remark ?? '') ?>
+ = esc($row->update_by ?? '') ?>
+
+
+
+
+
+ Total
+ = esc(number_format($totalCr, 2)) ?>
+ = esc(number_format($totalDr, 2)) ?>
+
+
+
+
+
+
+
+ Total Amount : = esc(number_format($netTotal, 2)) ?>
+
diff --git a/app/Views/report/diagnosis_report.php b/app/Views/report/diagnosis_report.php
new file mode 100644
index 0000000..eaf7273
--- /dev/null
+++ b/app/Views/report/diagnosis_report.php
@@ -0,0 +1,116 @@
+
+
+
+
+
+
+
+
+ Invoice Type
+
+ All Types
+ IPD
+ OPD
+ Organization
+
+
+
+ Diagnosis Head
+
+ All Diagnosis
+
+ = esc($row->group_desc ?? '') ?>
+
+
+
+
+
+
+ Show
+ Export
+
+
+
+
+
+
+
Select filters and click Show.
+
+
+
+
+
diff --git a/app/Views/report/diagnosis_report_table.php b/app/Views/report/diagnosis_report_table.php
new file mode 100644
index 0000000..eeaeba9
--- /dev/null
+++ b/app/Views/report/diagnosis_report_table.php
@@ -0,0 +1,111 @@
+
+
+
+
Date Range: = esc($minRange) ?> to = esc($maxRange) ?>
+
Invoice Type: = esc($invoiceTypeLabel) ?>
+
+
+
+ No data found for the selected criteria.
+
+
+
+
+ #
+ Diagnosis Group
+ Test Name
+ No. of Qty
+ Amount
+ Cost Amt
+
+
+
+ group_desc ?? '';
+ $itemName = $row->item_name ?? '';
+ $noQty = (float) ($row->no_qty ?? 0);
+ $totalAmount = (float) ($row->total_amount ?? 0);
+ $totalActAmount = (float) ($row->total_act_amount ?? 0);
+
+ // Diagnosis group header
+ if ($groupDesc !== $diagnosisHead) {
+ // Show previous group total if not first group
+ if ($diagnosisHead !== '') {
+ echo '';
+ echo ' ';
+ echo 'Total of ' . esc($diagnosisHead) . ' ';
+ echo '' . number_format($diagnosisQtyTotal, 0) . ' ';
+ echo '' . number_format($diagnosisHeadTotal, 2) . ' ';
+ echo '' . number_format($diagnosisActHeadTotal, 2) . ' ';
+ echo ' ';
+
+ $diagnosisHeadTotal = 0.0;
+ $diagnosisActHeadTotal = 0.0;
+ $diagnosisQtyTotal = 0.0;
+ }
+
+ echo '';
+ echo '' . esc($groupDesc) . ' ';
+ echo ' ';
+ $diagnosisHead = $groupDesc;
+ }
+
+ // Item row
+ $rowNum++;
+ echo '';
+ echo '' . $rowNum . ' ';
+ echo ' ';
+ echo '' . esc($itemName) . ' ';
+ echo '' . number_format($noQty, 0) . ' ';
+ echo '' . number_format($totalAmount, 2) . ' ';
+ echo '' . number_format($totalActAmount, 2) . ' ';
+ echo ' ';
+
+ // Update totals
+ $diagnosisHeadTotal += $totalAmount;
+ $diagnosisActHeadTotal += $totalActAmount;
+ $diagnosisQtyTotal += $noQty;
+ $grandTotal += $totalAmount;
+ $grandActTotal += $totalActAmount;
+ $grandQtyTotal += $noQty;
+ }
+
+ // Show last group total
+ if ($diagnosisHead !== '' && $rowCount > 0) {
+ echo '';
+ echo ' ';
+ echo 'Total of ' . esc($diagnosisHead) . ' ';
+ echo '' . number_format($diagnosisQtyTotal, 0) . ' ';
+ echo '' . number_format($diagnosisHeadTotal, 2) . ' ';
+ echo '' . number_format($diagnosisActHeadTotal, 2) . ' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+ Grand Total
+ = number_format($grandQtyTotal, 0) ?>
+ = number_format($grandTotal, 2) ?>
+ = number_format($grandActTotal, 2) ?>
+
+
+
+
diff --git a/app/Views/report/insurance_combined_report.php b/app/Views/report/insurance_combined_report.php
new file mode 100644
index 0000000..5778ebb
--- /dev/null
+++ b/app/Views/report/insurance_combined_report.php
@@ -0,0 +1,111 @@
+
+
+
+
+
+
+
+
+ Case Type
+
+ All Types
+ OPD Only
+ IPD Only
+
+
+
+ Insurance Company
+
+ All Companies
+
+
+ = esc($row->tpa_group ?? '') ?>
+
+
+
+
+ = esc($row->short_name ?? '') ?>
+
+
+
+
+
+
+ Show
+
+
+
+
+
+
+ Export Excel
+
+
+
+
+
+
+
+
+
+
+
Select filters and click Show to generate report
+
+
+
+
+
+
+
diff --git a/app/Views/report/insurance_combined_report_table.php b/app/Views/report/insurance_combined_report_table.php
new file mode 100644
index 0000000..b000ce4
--- /dev/null
+++ b/app/Views/report/insurance_combined_report_table.php
@@ -0,0 +1,186 @@
+
+
+
+
Date Range: = esc($minRange) ?> to = esc($maxRange) ?>
+
+
+
+ No data found for the selected criteria.
+
+
+
+
+ OPD Organization Cases Summary
+
+
+
+
+ #
+ Insurance Company
+ Total Cases
+ Total Charge
+ Total Medicine
+ Total Net
+
+
+
+ $row) {
+ $cases = (int) ($row->total_cases ?? 0);
+ $charge = (float) ($row->total_charge ?? 0);
+ $med = (float) ($row->total_med ?? 0);
+ $net = (float) ($row->total_net ?? 0);
+
+ $opdTotalCases += $cases;
+ $opdTotalCharge += $charge;
+ $opdTotalMed += $med;
+ $opdTotalNet += $net;
+
+ echo '';
+ echo '' . ($index + 1) . ' ';
+ echo '' . esc($row->insurance_company ?? '') . ' ';
+ echo '' . number_format($cases) . ' ';
+ echo '' . number_format($charge, 2) . ' ';
+ echo '' . number_format($med, 2) . ' ';
+ echo '' . number_format($net, 2) . ' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+ OPD Total:
+ = number_format($opdTotalCases) ?>
+ = number_format($opdTotalCharge, 2) ?>
+ = number_format($opdTotalMed, 2) ?>
+ = number_format($opdTotalNet, 2) ?>
+
+
+
+
+
+
+
+ IPD TPA Cases Summary
+
+
+
+
+ #
+ Insurance Company
+ Cases
+ Charge
+ Medicine
+ Discount
+ Net
+ Received
+ Deducted
+ Balance
+
+
+
+ $row) {
+ $cases = (int) ($row->total_cases ?? 0);
+ $charge = (float) ($row->total_charge ?? 0);
+ $med = (float) ($row->total_med ?? 0);
+ $discount = (float) ($row->total_discount ?? 0);
+ $net = (float) ($row->total_net ?? 0);
+ $received = (float) ($row->total_received ?? 0);
+ $deducted = (float) ($row->total_deducted ?? 0);
+ $balance = $net - $received;
+
+ $ipdTotalCases += $cases;
+ $ipdTotalCharge += $charge;
+ $ipdTotalMed += $med;
+ $ipdTotalDiscount += $discount;
+ $ipdTotalNet += $net;
+ $ipdTotalReceived += $received;
+ $ipdTotalDeducted += $deducted;
+
+ echo '';
+ echo '' . ($index + 1) . ' ';
+ echo '' . esc($row->insurance_company ?? '') . ' ';
+ echo '' . number_format($cases) . ' ';
+ echo '' . number_format($charge, 2) . ' ';
+ echo '' . number_format($med, 2) . ' ';
+ echo '' . number_format($discount, 2) . ' ';
+ echo '' . number_format($net, 2) . ' ';
+ echo '' . number_format($received, 2) . ' ';
+ echo '' . number_format($deducted, 2) . ' ';
+ echo '' . number_format($balance, 2) . ' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+ IPD Total:
+ = number_format($ipdTotalCases) ?>
+ = number_format($ipdTotalCharge, 2) ?>
+ = number_format($ipdTotalMed, 2) ?>
+ = number_format($ipdTotalDiscount, 2) ?>
+ = number_format($ipdTotalNet, 2) ?>
+ = number_format($ipdTotalReceived, 2) ?>
+ = number_format($ipdTotalDeducted, 2) ?>
+ = number_format($ipdTotalNet - $ipdTotalReceived, 2) ?>
+
+
+
+
+
+
+
+
+
+ Grand Summary
+
+
+
+
+
+ Total Cases (OPD + IPD):
+ = number_format($opdTotalCases + $ipdTotalCases) ?>
+
+
+ Total Net Amount:
+ = number_format($opdTotalNet + $ipdTotalNet, 2) ?>
+
+
+
+
+
+
+ IPD Amount Received:
+ = number_format($ipdTotalReceived, 2) ?>
+
+
+ IPD Balance Pending:
+ = number_format($ipdTotalNet - $ipdTotalReceived, 2) ?>
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/report/insurance_credit_main.php b/app/Views/report/insurance_credit_main.php
new file mode 100644
index 0000000..1f270ed
--- /dev/null
+++ b/app/Views/report/insurance_credit_main.php
@@ -0,0 +1,100 @@
+
+
+
+
+
Select a report type to view insurance credit details
+
+
+
+
+
+
+
+
+
+
OPD Organization Cases
+
+ View OPD cases submitted to insurance organizations
+
+
+ Open Report
+
+
+
+
+
+
+
+
+
+
+
+
+
IPD TPA Cases
+
+ View IPD cases submitted to TPA/Insurance companies
+
+
+ Open Report
+
+
+
+
+
+
+
+
+
+
+
+
+
Combined Summary
+
+ View combined OPD & IPD insurance summary
+
+
+ Open Report
+
+
+
+
+
+
+
+
+
+
+
+ Report Information
+
+
+ OPD Organization Cases: Shows outpatient cases with insurance coverage (case_type = 0)
+ IPD TPA Cases: Shows inpatient cases with TPA/insurance coverage (case_type = 1)
+ Combined Summary: Consolidated view of all insurance cases with totals
+ Status Types: Pending (0), Bill Complete (1), Submitted to Organization (2)
+
+
+
+
+
+
+
+
+
+
diff --git a/app/Views/report/insurance_ipd_report.php b/app/Views/report/insurance_ipd_report.php
new file mode 100644
index 0000000..36fe945
--- /dev/null
+++ b/app/Views/report/insurance_ipd_report.php
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+ Insurance Company
+
+ All Companies
+
+
+ = esc($row->tpa_group ?? '') ?>
+
+
+
+
+ = esc($row->short_name ?? '') ?>
+
+
+
+
+
+ Case Status
+
+ All Status
+ Pending
+ Bill Complete
+ Submitted to Org.
+
+
+
+
+ Show
+
+
+
+
+
+
+ Export Excel
+
+
+
+
+
+
+
+
+
+
+
Select filters and click Show to generate report
+
+
+
+
+
+
+
diff --git a/app/Views/report/insurance_ipd_report_table.php b/app/Views/report/insurance_ipd_report_table.php
new file mode 100644
index 0000000..ffde03c
--- /dev/null
+++ b/app/Views/report/insurance_ipd_report_table.php
@@ -0,0 +1,100 @@
+
+
+
+
Date Range: = esc($minRange) ?> to = esc($maxRange) ?>
+
Type: = esc($caseType) ?> TPA Cases
+
+
+
+ No data found for the selected criteria.
+
+
+
+
+ #
+ Case Info
+ IPD Code
+ UHID
+ Patient Name
+ Insurance
+ Status
+ Admit Date
+ Discharge
+ Charge
+ Med
+ Disc.
+ Net Amt
+ Received
+ Deducted
+
+
+
+ $row) {
+ $chargeAmt = (float) ($row->charge_amount ?? 0);
+ $medAmt = (float) ($row->med_amount ?? 0);
+ $discount = (float) ($row->discount ?? 0);
+ $netAmt = (float) ($row->net_amount ?? 0);
+ $received = (float) ($row->amount_recived ?? 0);
+ $deducted = (float) ($row->amount_deduction ?? 0);
+
+ $totalCharge += $chargeAmt;
+ $totalMed += $medAmt;
+ $totalDiscount += $discount;
+ $totalNet += $netAmt;
+ $totalReceived += $received;
+ $totalDeducted += $deducted;
+
+ echo '';
+ echo '' . ($index + 1) . ' ';
+ echo '' . esc($row->case_info ?? '') . ' ';
+ echo '' . esc($row->ipd_code ?? '') . ' ';
+ echo '' . esc($row->p_code ?? '') . ' ';
+ echo '' . esc($row->p_fname ?? '') . ' ';
+ echo '' . esc($row->insurance_company ?? '') . ' ';
+ echo '' . esc($row->org_submit_status ?? '') . ' ';
+ echo '' . esc($row->str_register_date ?? '') . ' ';
+ echo '' . esc($row->str_discharge_date ?? '-') . ' ';
+ echo '' . number_format($chargeAmt, 2) . ' ';
+ echo '' . number_format($medAmt, 2) . ' ';
+ echo '' . number_format($discount, 2) . ' ';
+ echo '' . number_format($netAmt, 2) . ' ';
+ echo '' . number_format($received, 2) . ' ';
+ echo '' . number_format($deducted, 2) . ' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+ Total:
+ = number_format($totalCharge, 2) ?>
+ = number_format($totalMed, 2) ?>
+ = number_format($totalDiscount, 2) ?>
+ = number_format($totalNet, 2) ?>
+ = number_format($totalReceived, 2) ?>
+ = number_format($totalDeducted, 2) ?>
+
+
+ Total Cases:
+ = count($rows) ?>
+
+
+ Balance (Net - Received):
+ = number_format($totalNet - $totalReceived, 2) ?>
+
+
+
+
diff --git a/app/Views/report/insurance_opd_report.php b/app/Views/report/insurance_opd_report.php
new file mode 100644
index 0000000..1348f0c
--- /dev/null
+++ b/app/Views/report/insurance_opd_report.php
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+ Insurance Company
+
+ All Companies
+
+
+ = esc($row->tpa_group ?? '') ?>
+
+
+
+
+ = esc($row->short_name ?? '') ?>
+
+
+
+
+
+ Case Status
+
+ All Status
+ Pending
+ Bill Complete
+ Submitted to Org.
+
+
+
+
+ Show
+
+
+
+
+
+
+ Export Excel
+
+
+
+
+
+
+
+
+
+
+
Select filters and click Show to generate report
+
+
+
+
+
+
+
diff --git a/app/Views/report/insurance_opd_report_table.php b/app/Views/report/insurance_opd_report_table.php
new file mode 100644
index 0000000..259d458
--- /dev/null
+++ b/app/Views/report/insurance_opd_report_table.php
@@ -0,0 +1,78 @@
+
+
+
+
Date Range: = esc($minRange) ?> to = esc($maxRange) ?>
+
Type: = esc($caseType) ?> Organization Cases
+
+
+
+ No data found for the selected criteria.
+
+
+
+
+ #
+ Bill No.
+ Case Info
+ Org. Code
+ UHID
+ Patient Name
+ Insurance Company
+ Date
+ Status
+ Charge Amt
+ Med Amt
+ Net Amt
+
+
+
+ $row) {
+ $chargeAmt = (float) ($row->charge_amount ?? 0);
+ $medAmt = (float) ($row->med_amount ?? 0);
+ $netAmt = (float) ($row->net_amount ?? 0);
+
+ $totalCharge += $chargeAmt;
+ $totalMed += $medAmt;
+ $totalNet += $netAmt;
+
+ echo '';
+ echo '' . ($index + 1) . ' ';
+ echo '' . esc($row->id ?? '') . ' ';
+ echo '' . esc($row->case_info ?? '') . ' ';
+ echo '' . esc($row->case_id_code ?? '') . ' ';
+ echo '' . esc($row->p_code ?? '') . ' ';
+ echo '' . esc($row->p_fname ?? '') . ' ';
+ echo '' . esc($row->insurance_company ?? '') . ' ';
+ echo '' . esc($row->str_date_registration ?? '') . ' ';
+ echo '' . esc($row->org_submit_status ?? '') . ' ';
+ echo '' . number_format($chargeAmt, 2) . ' ';
+ echo '' . number_format($medAmt, 2) . ' ';
+ echo '' . number_format($netAmt, 2) . ' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+ Total:
+ = number_format($totalCharge, 2) ?>
+ = number_format($totalMed, 2) ?>
+ = number_format($totalNet, 2) ?>
+
+
+ Total Cases:
+ = count($rows) ?>
+
+
+
+
diff --git a/app/Views/welcome_message.php b/app/Views/welcome_message.php
new file mode 100644
index 0000000..9e36c00
--- /dev/null
+++ b/app/Views/welcome_message.php
@@ -0,0 +1,264 @@
+
+
+
+
+
+
+
+ Welcome
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ user(); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/index.html b/app/index.html
new file mode 100644
index 0000000..69df4e1
--- /dev/null
+++ b/app/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/builds b/builds
new file mode 100644
index 0000000..cc2ca08
--- /dev/null
+++ b/builds
@@ -0,0 +1,125 @@
+#!/usr/bin/env php
+ 'vcs',
+ 'url' => GITHUB_URL,
+ ];
+ }
+
+ $array['require']['codeigniter4/codeigniter4'] = 'dev-develop';
+ unset($array['require']['codeigniter4/framework']);
+ } else {
+ unset($array['minimum-stability']);
+
+ if (isset($array['repositories'])) {
+ foreach ($array['repositories'] as $i => $repository) {
+ if ($repository['url'] === GITHUB_URL) {
+ unset($array['repositories'][$i]);
+ break;
+ }
+ }
+
+ if (empty($array['repositories'])) {
+ unset($array['repositories']);
+ }
+ }
+
+ $array['require']['codeigniter4/framework'] = LATEST_RELEASE;
+ unset($array['require']['codeigniter4/codeigniter4']);
+ }
+
+ file_put_contents($file, json_encode($array, JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES) . PHP_EOL);
+
+ $modified[] = $file;
+ } else {
+ echo 'Warning: Unable to decode composer.json! Skipping...' . PHP_EOL;
+ }
+ } else {
+ echo 'Warning: Unable to read composer.json! Skipping...' . PHP_EOL;
+ }
+}
+
+$files = [
+ __DIR__ . DIRECTORY_SEPARATOR . 'app/Config/Paths.php',
+ __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml.dist',
+ __DIR__ . DIRECTORY_SEPARATOR . 'phpunit.xml',
+];
+
+foreach ($files as $file) {
+ if (is_file($file)) {
+ $contents = file_get_contents($file);
+
+ if ($dev) {
+ $contents = str_replace('vendor/codeigniter4/framework', 'vendor/codeigniter4/codeigniter4', $contents);
+ } else {
+ $contents = str_replace('vendor/codeigniter4/codeigniter4', 'vendor/codeigniter4/framework', $contents);
+ }
+
+ file_put_contents($file, $contents);
+
+ $modified[] = $file;
+ }
+}
+
+if ($modified === []) {
+ echo 'No files modified.' . PHP_EOL;
+} else {
+ echo 'The following files were modified:' . PHP_EOL;
+
+ foreach ($modified as $file) {
+ echo " * {$file}" . PHP_EOL;
+ }
+
+ echo 'Run `composer update` to sync changes with your vendor folder.' . PHP_EOL;
+}
diff --git a/composer.json b/composer.json
new file mode 100644
index 0000000..94c54ff
--- /dev/null
+++ b/composer.json
@@ -0,0 +1,46 @@
+{
+ "name": "codeigniter4/appstarter",
+ "description": "CodeIgniter4 starter app",
+ "license": "MIT",
+ "type": "project",
+ "homepage": "https://codeigniter.com",
+ "support": {
+ "forum": "https://forum.codeigniter.com/",
+ "source": "https://github.com/codeigniter4/CodeIgniter4",
+ "slack": "https://codeigniterchat.slack.com"
+ },
+ "require": {
+ "php": "^8.2",
+ "codeigniter4/framework": "^4.7",
+ "codeigniter4/shield": "^1.2",
+ "mpdf/mpdf": "^8.2",
+ "mpdf/qrcode": "^1.2"
+ },
+ "require-dev": {
+ "fakerphp/faker": "^1.9",
+ "mikey179/vfsstream": "^1.6",
+ "phpunit/phpunit": "^10.5.16"
+ },
+ "autoload": {
+ "psr-4": {
+ "App\\": "app/",
+ "Config\\": "app/Config/"
+ },
+ "exclude-from-classmap": [
+ "**/Database/Migrations/**"
+ ]
+ },
+ "autoload-dev": {
+ "psr-4": {
+ "Tests\\Support\\": "tests/_support"
+ }
+ },
+ "config": {
+ "optimize-autoloader": true,
+ "preferred-install": "dist",
+ "sort-packages": true
+ },
+ "scripts": {
+ "test": "phpunit"
+ }
+}
diff --git a/composer.lock b/composer.lock
new file mode 100644
index 0000000..d933b6e
--- /dev/null
+++ b/composer.lock
@@ -0,0 +1,2656 @@
+{
+ "_readme": [
+ "This file locks the dependencies of your project to a known state",
+ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies",
+ "This file is @generated automatically"
+ ],
+ "content-hash": "b1a7e3eeff0fc159e79f74e5ddedf77e",
+ "packages": [
+ {
+ "name": "codeigniter4/framework",
+ "version": "v4.7.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/codeigniter4/framework.git",
+ "reference": "e7753bc03f8b74af428f46b5e2bb74925487c930"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/codeigniter4/framework/zipball/e7753bc03f8b74af428f46b5e2bb74925487c930",
+ "reference": "e7753bc03f8b74af428f46b5e2bb74925487c930",
+ "shasum": ""
+ },
+ "require": {
+ "ext-intl": "*",
+ "ext-mbstring": "*",
+ "laminas/laminas-escaper": "^2.18",
+ "php": "^8.2",
+ "psr/log": "^3.0"
+ },
+ "require-dev": {
+ "codeigniter/coding-standard": "^1.7",
+ "fakerphp/faker": "^1.24",
+ "friendsofphp/php-cs-fixer": "^3.47.1",
+ "kint-php/kint": "^6.1",
+ "mikey179/vfsstream": "^1.6.12",
+ "nexusphp/cs-config": "^3.6",
+ "phpunit/phpunit": "^10.5.16 || ^11.2",
+ "predis/predis": "^3.0"
+ },
+ "suggest": {
+ "ext-apcu": "If you use Cache class ApcuHandler",
+ "ext-curl": "If you use CURLRequest class",
+ "ext-dom": "If you use TestResponse",
+ "ext-exif": "If you run Image class tests",
+ "ext-fileinfo": "Improves mime type detection for files",
+ "ext-gd": "If you use Image class GDHandler",
+ "ext-imagick": "If you use Image class ImageMagickHandler",
+ "ext-libxml": "If you use TestResponse",
+ "ext-memcache": "If you use Cache class MemcachedHandler with Memcache",
+ "ext-memcached": "If you use Cache class MemcachedHandler with Memcached",
+ "ext-mysqli": "If you use MySQL",
+ "ext-oci8": "If you use Oracle Database",
+ "ext-pcntl": "If you use Signals",
+ "ext-pgsql": "If you use PostgreSQL",
+ "ext-posix": "If you use Signals",
+ "ext-readline": "Improves CLI::input() usability",
+ "ext-redis": "If you use Cache class RedisHandler",
+ "ext-simplexml": "If you format XML",
+ "ext-sodium": "If you use Encryption SodiumHandler",
+ "ext-sqlite3": "If you use SQLite3",
+ "ext-sqlsrv": "If you use SQL Server",
+ "ext-xdebug": "If you use CIUnitTestCase::assertHeaderEmitted()"
+ },
+ "type": "project",
+ "autoload": {
+ "psr-4": {
+ "CodeIgniter\\": "system/"
+ },
+ "exclude-from-classmap": [
+ "**/Database/Migrations/**"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "The CodeIgniter framework v4",
+ "homepage": "https://codeigniter.com",
+ "support": {
+ "forum": "https://forum.codeigniter.com/",
+ "slack": "https://codeigniterchat.slack.com",
+ "source": "https://github.com/codeigniter4/CodeIgniter4"
+ },
+ "time": "2026-02-01T20:39:35+00:00"
+ },
+ {
+ "name": "codeigniter4/settings",
+ "version": "v2.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/codeigniter4/settings.git",
+ "reference": "2748f2b4572d44a940f98c31847d65272cac5666"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/codeigniter4/settings/zipball/2748f2b4572d44a940f98c31847d65272cac5666",
+ "reference": "2748f2b4572d44a940f98c31847d65272cac5666",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.4 || ^8.0"
+ },
+ "require-dev": {
+ "codeigniter4/devkit": "^1.1.2",
+ "codeigniter4/framework": "^4.2.3",
+ "rector/rector": "0.18.13"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "CodeIgniter\\Settings\\": "src"
+ },
+ "exclude-from-classmap": [
+ "**/Database/Migrations/**"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Lonnie Ezell",
+ "email": "lonnieje@gmail.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "Settings library for CodeIgniter 4",
+ "homepage": "https://github.com/codeigniter4/settings",
+ "keywords": [
+ "Settings",
+ "codeigniter",
+ "codeigniter4"
+ ],
+ "support": {
+ "issues": "https://github.com/codeigniter4/settings/issues",
+ "source": "https://github.com/codeigniter4/settings/tree/v2.2.0"
+ },
+ "time": "2024-01-06T07:10:58+00:00"
+ },
+ {
+ "name": "codeigniter4/shield",
+ "version": "v1.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/codeigniter4/shield.git",
+ "reference": "2d1b2177a914dcd490f54a6706792eacabd9e3e8"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/codeigniter4/shield/zipball/2d1b2177a914dcd490f54a6706792eacabd9e3e8",
+ "reference": "2d1b2177a914dcd490f54a6706792eacabd9e3e8",
+ "shasum": ""
+ },
+ "require": {
+ "codeigniter4/settings": "^2.1",
+ "php": "^8.1"
+ },
+ "provide": {
+ "codeigniter4/authentication-implementation": "1.0"
+ },
+ "require-dev": {
+ "codeigniter/phpstan-codeigniter": "^1.3",
+ "codeigniter4/devkit": "^1.3",
+ "codeigniter4/framework": ">=4.3.5 <4.5.0 || ^4.5.1",
+ "firebase/php-jwt": "^6.4",
+ "mikey179/vfsstream": "^1.6.7",
+ "mockery/mockery": "^1.0",
+ "phpstan/phpstan-strict-rules": "^2.0"
+ },
+ "suggest": {
+ "ext-curl": "Required to use the password validation rule via PwnedValidator class.",
+ "ext-openssl": "Required to use the JWT Authenticator."
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "CodeIgniter\\Shield\\": "src"
+ },
+ "exclude-from-classmap": [
+ "**/Database/Migrations/**"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Lonnie Ezell",
+ "email": "lonnieje@gmail.com",
+ "role": "Developer"
+ }
+ ],
+ "description": "Authentication and Authorization for CodeIgniter 4",
+ "homepage": "https://github.com/codeigniter4/shield",
+ "keywords": [
+ "Authentication",
+ "authorization",
+ "codeigniter",
+ "codeigniter4"
+ ],
+ "support": {
+ "docs": "https://codeigniter4.github.io/shield/",
+ "forum": "https://github.com/codeigniter4/shield/discussions",
+ "issues": "https://github.com/codeigniter4/shield/issues",
+ "slack": "https://codeigniterchat.slack.com",
+ "source": "https://github.com/codeigniter4/shield"
+ },
+ "time": "2025-07-14T10:26:03+00:00"
+ },
+ {
+ "name": "laminas/laminas-escaper",
+ "version": "2.18.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/laminas/laminas-escaper.git",
+ "reference": "06f211dfffff18d91844c1f55250d5d13c007e18"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/laminas/laminas-escaper/zipball/06f211dfffff18d91844c1f55250d5d13c007e18",
+ "reference": "06f211dfffff18d91844c1f55250d5d13c007e18",
+ "shasum": ""
+ },
+ "require": {
+ "ext-ctype": "*",
+ "ext-mbstring": "*",
+ "php": "~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0"
+ },
+ "conflict": {
+ "zendframework/zend-escaper": "*"
+ },
+ "require-dev": {
+ "infection/infection": "^0.31.0",
+ "laminas/laminas-coding-standard": "~3.1.0",
+ "phpunit/phpunit": "^11.5.42",
+ "psalm/plugin-phpunit": "^0.19.5",
+ "vimeo/psalm": "^6.13.1"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Laminas\\Escaper\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "description": "Securely and safely escape HTML, HTML attributes, JavaScript, CSS, and URLs",
+ "homepage": "https://laminas.dev",
+ "keywords": [
+ "escaper",
+ "laminas"
+ ],
+ "support": {
+ "chat": "https://laminas.dev/chat",
+ "docs": "https://docs.laminas.dev/laminas-escaper/",
+ "forum": "https://discourse.laminas.dev",
+ "issues": "https://github.com/laminas/laminas-escaper/issues",
+ "rss": "https://github.com/laminas/laminas-escaper/releases.atom",
+ "source": "https://github.com/laminas/laminas-escaper"
+ },
+ "funding": [
+ {
+ "url": "https://funding.communitybridge.org/projects/laminas-project",
+ "type": "community_bridge"
+ }
+ ],
+ "time": "2025-10-14T18:31:13+00:00"
+ },
+ {
+ "name": "mpdf/mpdf",
+ "version": "v8.2.7",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mpdf/mpdf.git",
+ "reference": "b59670a09498689c33ce639bac8f5ba26721dab3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mpdf/mpdf/zipball/b59670a09498689c33ce639bac8f5ba26721dab3",
+ "reference": "b59670a09498689c33ce639bac8f5ba26721dab3",
+ "shasum": ""
+ },
+ "require": {
+ "ext-gd": "*",
+ "ext-mbstring": "*",
+ "mpdf/psr-http-message-shim": "^1.0 || ^2.0",
+ "mpdf/psr-log-aware-trait": "^2.0 || ^3.0",
+ "myclabs/deep-copy": "^1.7",
+ "paragonie/random_compat": "^1.4|^2.0|^9.99.99",
+ "php": "^5.6 || ^7.0 || ~8.0.0 || ~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
+ "psr/http-message": "^1.0 || ^2.0",
+ "psr/log": "^1.0 || ^2.0 || ^3.0",
+ "setasign/fpdi": "^2.1"
+ },
+ "require-dev": {
+ "mockery/mockery": "^1.3.0",
+ "mpdf/qrcode": "^1.1.0",
+ "squizlabs/php_codesniffer": "^3.5.0",
+ "tracy/tracy": "~2.5",
+ "yoast/phpunit-polyfills": "^1.0"
+ },
+ "suggest": {
+ "ext-bcmath": "Needed for generation of some types of barcodes",
+ "ext-xml": "Needed mainly for SVG manipulation",
+ "ext-zlib": "Needed for compression of embedded resources, such as fonts"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/functions.php"
+ ],
+ "psr-4": {
+ "Mpdf\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "GPL-2.0-only"
+ ],
+ "authors": [
+ {
+ "name": "Matěj Humpál",
+ "role": "Developer, maintainer"
+ },
+ {
+ "name": "Ian Back",
+ "role": "Developer (retired)"
+ }
+ ],
+ "description": "PHP library generating PDF files from UTF-8 encoded HTML",
+ "homepage": "https://mpdf.github.io",
+ "keywords": [
+ "pdf",
+ "php",
+ "utf-8"
+ ],
+ "support": {
+ "docs": "https://mpdf.github.io",
+ "issues": "https://github.com/mpdf/mpdf/issues",
+ "source": "https://github.com/mpdf/mpdf"
+ },
+ "funding": [
+ {
+ "url": "https://www.paypal.me/mpdf",
+ "type": "custom"
+ }
+ ],
+ "time": "2025-12-01T10:18:02+00:00"
+ },
+ {
+ "name": "mpdf/psr-http-message-shim",
+ "version": "v2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mpdf/psr-http-message-shim.git",
+ "reference": "f25a0153d645e234f9db42e5433b16d9b113920f"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mpdf/psr-http-message-shim/zipball/f25a0153d645e234f9db42e5433b16d9b113920f",
+ "reference": "f25a0153d645e234f9db42e5433b16d9b113920f",
+ "shasum": ""
+ },
+ "require": {
+ "psr/http-message": "^2.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Mpdf\\PsrHttpMessageShim\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mark Dorison",
+ "email": "mark@chromatichq.com"
+ },
+ {
+ "name": "Kristofer Widholm",
+ "email": "kristofer@chromatichq.com"
+ },
+ {
+ "name": "Nigel Cunningham",
+ "email": "nigel.cunningham@technocrat.com.au"
+ }
+ ],
+ "description": "Shim to allow support of different psr/message versions.",
+ "support": {
+ "issues": "https://github.com/mpdf/psr-http-message-shim/issues",
+ "source": "https://github.com/mpdf/psr-http-message-shim/tree/v2.0.1"
+ },
+ "time": "2023-10-02T14:34:03+00:00"
+ },
+ {
+ "name": "mpdf/psr-log-aware-trait",
+ "version": "v3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mpdf/psr-log-aware-trait.git",
+ "reference": "a633da6065e946cc491e1c962850344bb0bf3e78"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mpdf/psr-log-aware-trait/zipball/a633da6065e946cc491e1c962850344bb0bf3e78",
+ "reference": "a633da6065e946cc491e1c962850344bb0bf3e78",
+ "shasum": ""
+ },
+ "require": {
+ "psr/log": "^3.0"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Mpdf\\PsrLogAwareTrait\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Mark Dorison",
+ "email": "mark@chromatichq.com"
+ },
+ {
+ "name": "Kristofer Widholm",
+ "email": "kristofer@chromatichq.com"
+ }
+ ],
+ "description": "Trait to allow support of different psr/log versions.",
+ "support": {
+ "issues": "https://github.com/mpdf/psr-log-aware-trait/issues",
+ "source": "https://github.com/mpdf/psr-log-aware-trait/tree/v3.0.0"
+ },
+ "time": "2023-05-03T06:19:36+00:00"
+ },
+ {
+ "name": "mpdf/qrcode",
+ "version": "v1.2.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/mpdf/qrcode.git",
+ "reference": "d4fa19117a7241c30ac84902b6236a02c7a3f268"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/mpdf/qrcode/zipball/d4fa19117a7241c30ac84902b6236a02c7a3f268",
+ "reference": "d4fa19117a7241c30ac84902b6236a02c7a3f268",
+ "shasum": ""
+ },
+ "require": {
+ "paragonie/random_compat": "^1.4|^2.0|^9.99.99",
+ "php": "^5.6 || ^7.0 || ^8.0"
+ },
+ "require-dev": {
+ "mockery/mockery": "^0.9.5 || ^1.0",
+ "squizlabs/php_codesniffer": "^3.4",
+ "tracy/tracy": "^2.5",
+ "yoast/phpunit-polyfills": "^1.0"
+ },
+ "suggest": {
+ "ext-gd": "To output QR codes to PNG files",
+ "ext-simplexml": "To output QR codes to SVG files"
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Mpdf\\QrCode\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "LGPL-2.1-or-later"
+ ],
+ "authors": [
+ {
+ "name": "Matěj Humpál",
+ "role": "maintainer"
+ },
+ {
+ "name": "Laurent Minguet",
+ "role": "author"
+ }
+ ],
+ "description": "QR code generator for mPDF",
+ "keywords": [
+ "mpdf",
+ "pdf",
+ "php",
+ "qr",
+ "qrcode"
+ ],
+ "support": {
+ "issues": "https://github.com/mpdf/qrcode/issues",
+ "source": "https://github.com/mpdf/qrcode/tree/v1.2.2"
+ },
+ "funding": [
+ {
+ "url": "https://www.paypal.me/mpdf",
+ "type": "custom"
+ }
+ ],
+ "time": "2025-12-19T16:21:49+00:00"
+ },
+ {
+ "name": "myclabs/deep-copy",
+ "version": "1.13.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/myclabs/DeepCopy.git",
+ "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/myclabs/DeepCopy/zipball/07d290f0c47959fd5eed98c95ee5602db07e0b6a",
+ "reference": "07d290f0c47959fd5eed98c95ee5602db07e0b6a",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.1 || ^8.0"
+ },
+ "conflict": {
+ "doctrine/collections": "<1.6.8",
+ "doctrine/common": "<2.13.3 || >=3 <3.2.2"
+ },
+ "require-dev": {
+ "doctrine/collections": "^1.6.8",
+ "doctrine/common": "^2.13.3 || ^3.2.2",
+ "phpspec/prophecy": "^1.10",
+ "phpunit/phpunit": "^7.5.20 || ^8.5.23 || ^9.5.13"
+ },
+ "type": "library",
+ "autoload": {
+ "files": [
+ "src/DeepCopy/deep_copy.php"
+ ],
+ "psr-4": {
+ "DeepCopy\\": "src/DeepCopy/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "description": "Create deep copies (clones) of your objects",
+ "keywords": [
+ "clone",
+ "copy",
+ "duplicate",
+ "object",
+ "object graph"
+ ],
+ "support": {
+ "issues": "https://github.com/myclabs/DeepCopy/issues",
+ "source": "https://github.com/myclabs/DeepCopy/tree/1.13.4"
+ },
+ "funding": [
+ {
+ "url": "https://tidelift.com/funding/github/packagist/myclabs/deep-copy",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-08-01T08:46:24+00:00"
+ },
+ {
+ "name": "paragonie/random_compat",
+ "version": "v9.99.100",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/paragonie/random_compat.git",
+ "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/paragonie/random_compat/zipball/996434e5492cb4c3edcb9168db6fbb1359ef965a",
+ "reference": "996434e5492cb4c3edcb9168db6fbb1359ef965a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">= 7"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "4.*|5.*",
+ "vimeo/psalm": "^1"
+ },
+ "suggest": {
+ "ext-libsodium": "Provides a modern crypto API that can be used to generate random bytes."
+ },
+ "type": "library",
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Paragon Initiative Enterprises",
+ "email": "security@paragonie.com",
+ "homepage": "https://paragonie.com"
+ }
+ ],
+ "description": "PHP 5.x polyfill for random_bytes() and random_int() from PHP 7",
+ "keywords": [
+ "csprng",
+ "polyfill",
+ "pseudorandom",
+ "random"
+ ],
+ "support": {
+ "email": "info@paragonie.com",
+ "issues": "https://github.com/paragonie/random_compat/issues",
+ "source": "https://github.com/paragonie/random_compat"
+ },
+ "time": "2020-10-15T08:29:30+00:00"
+ },
+ {
+ "name": "psr/http-message",
+ "version": "2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/http-message.git",
+ "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71",
+ "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Http\\Message\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for HTTP messages",
+ "homepage": "https://github.com/php-fig/http-message",
+ "keywords": [
+ "http",
+ "http-message",
+ "psr",
+ "psr-7",
+ "request",
+ "response"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/http-message/tree/2.0"
+ },
+ "time": "2023-04-04T09:54:51+00:00"
+ },
+ {
+ "name": "psr/log",
+ "version": "3.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/log.git",
+ "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
+ "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.0.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "3.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Log\\": "src"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common interface for logging libraries",
+ "homepage": "https://github.com/php-fig/log",
+ "keywords": [
+ "log",
+ "psr",
+ "psr-3"
+ ],
+ "support": {
+ "source": "https://github.com/php-fig/log/tree/3.0.2"
+ },
+ "time": "2024-09-11T13:17:53+00:00"
+ },
+ {
+ "name": "setasign/fpdi",
+ "version": "v2.6.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/Setasign/FPDI.git",
+ "reference": "4b53852fde2734ec6a07e458a085db627c60eada"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/Setasign/FPDI/zipball/4b53852fde2734ec6a07e458a085db627c60eada",
+ "reference": "4b53852fde2734ec6a07e458a085db627c60eada",
+ "shasum": ""
+ },
+ "require": {
+ "ext-zlib": "*",
+ "php": "^7.1 || ^8.0"
+ },
+ "conflict": {
+ "setasign/tfpdf": "<1.31"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7",
+ "setasign/fpdf": "~1.8.6",
+ "setasign/tfpdf": "~1.33",
+ "squizlabs/php_codesniffer": "^3.5",
+ "tecnickcom/tcpdf": "^6.8"
+ },
+ "suggest": {
+ "setasign/fpdf": "FPDI will extend this class but as it is also possible to use TCPDF or tFPDF as an alternative. There's no fixed dependency configured."
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "setasign\\Fpdi\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Jan Slabon",
+ "email": "jan.slabon@setasign.com",
+ "homepage": "https://www.setasign.com"
+ },
+ {
+ "name": "Maximilian Kresse",
+ "email": "maximilian.kresse@setasign.com",
+ "homepage": "https://www.setasign.com"
+ }
+ ],
+ "description": "FPDI is a collection of PHP classes facilitating developers to read pages from existing PDF documents and use them as templates in FPDF. Because it is also possible to use FPDI with TCPDF, there are no fixed dependencies defined. Please see suggestions for packages which evaluates the dependencies automatically.",
+ "homepage": "https://www.setasign.com/fpdi",
+ "keywords": [
+ "fpdf",
+ "fpdi",
+ "pdf"
+ ],
+ "support": {
+ "issues": "https://github.com/Setasign/FPDI/issues",
+ "source": "https://github.com/Setasign/FPDI/tree/v2.6.4"
+ },
+ "funding": [
+ {
+ "url": "https://tidelift.com/funding/github/packagist/setasign/fpdi",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-08-05T09:57:14+00:00"
+ }
+ ],
+ "packages-dev": [
+ {
+ "name": "fakerphp/faker",
+ "version": "v1.24.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/FakerPHP/Faker.git",
+ "reference": "e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/FakerPHP/Faker/zipball/e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5",
+ "reference": "e0ee18eb1e6dc3cda3ce9fd97e5a0689a88a64b5",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.4 || ^8.0",
+ "psr/container": "^1.0 || ^2.0",
+ "symfony/deprecation-contracts": "^2.2 || ^3.0"
+ },
+ "conflict": {
+ "fzaninotto/faker": "*"
+ },
+ "require-dev": {
+ "bamarni/composer-bin-plugin": "^1.4.1",
+ "doctrine/persistence": "^1.3 || ^2.0",
+ "ext-intl": "*",
+ "phpunit/phpunit": "^9.5.26",
+ "symfony/phpunit-bridge": "^5.4.16"
+ },
+ "suggest": {
+ "doctrine/orm": "Required to use Faker\\ORM\\Doctrine",
+ "ext-curl": "Required by Faker\\Provider\\Image to download images.",
+ "ext-dom": "Required by Faker\\Provider\\HtmlLorem for generating random HTML.",
+ "ext-iconv": "Required by Faker\\Provider\\ru_RU\\Text::realText() for generating real Russian text.",
+ "ext-mbstring": "Required for multibyte Unicode string functionality."
+ },
+ "type": "library",
+ "autoload": {
+ "psr-4": {
+ "Faker\\": "src/Faker/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "François Zaninotto"
+ }
+ ],
+ "description": "Faker is a PHP library that generates fake data for you.",
+ "keywords": [
+ "data",
+ "faker",
+ "fixtures"
+ ],
+ "support": {
+ "issues": "https://github.com/FakerPHP/Faker/issues",
+ "source": "https://github.com/FakerPHP/Faker/tree/v1.24.1"
+ },
+ "time": "2024-11-21T13:46:39+00:00"
+ },
+ {
+ "name": "mikey179/vfsstream",
+ "version": "v1.6.12",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/bovigo/vfsStream.git",
+ "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/bovigo/vfsStream/zipball/fe695ec993e0a55c3abdda10a9364eb31c6f1bf0",
+ "reference": "fe695ec993e0a55c3abdda10a9364eb31c6f1bf0",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.1.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^7.5||^8.5||^9.6",
+ "yoast/phpunit-polyfills": "^2.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "1.6.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-0": {
+ "org\\bovigo\\vfs\\": "src/main/php"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Frank Kleine",
+ "homepage": "http://frankkleine.de/",
+ "role": "Developer"
+ }
+ ],
+ "description": "Virtual file system to mock the real file system in unit tests.",
+ "homepage": "http://vfs.bovigo.org/",
+ "support": {
+ "issues": "https://github.com/bovigo/vfsStream/issues",
+ "source": "https://github.com/bovigo/vfsStream/tree/master",
+ "wiki": "https://github.com/bovigo/vfsStream/wiki"
+ },
+ "time": "2024-08-29T18:43:31+00:00"
+ },
+ {
+ "name": "nikic/php-parser",
+ "version": "v5.7.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/nikic/PHP-Parser.git",
+ "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82",
+ "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82",
+ "shasum": ""
+ },
+ "require": {
+ "ext-ctype": "*",
+ "ext-json": "*",
+ "ext-tokenizer": "*",
+ "php": ">=7.4"
+ },
+ "require-dev": {
+ "ircmaxell/php-yacc": "^0.0.7",
+ "phpunit/phpunit": "^9.0"
+ },
+ "bin": [
+ "bin/php-parse"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "5.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "PhpParser\\": "lib/PhpParser"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Nikita Popov"
+ }
+ ],
+ "description": "A PHP parser written in PHP",
+ "keywords": [
+ "parser",
+ "php"
+ ],
+ "support": {
+ "issues": "https://github.com/nikic/PHP-Parser/issues",
+ "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0"
+ },
+ "time": "2025-12-06T11:56:16+00:00"
+ },
+ {
+ "name": "phar-io/manifest",
+ "version": "2.0.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phar-io/manifest.git",
+ "reference": "54750ef60c58e43759730615a392c31c80e23176"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phar-io/manifest/zipball/54750ef60c58e43759730615a392c31c80e23176",
+ "reference": "54750ef60c58e43759730615a392c31c80e23176",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-libxml": "*",
+ "ext-phar": "*",
+ "ext-xmlwriter": "*",
+ "phar-io/version": "^3.0.1",
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Heuer",
+ "email": "sebastian@phpeople.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "Component for reading phar.io manifest information from a PHP Archive (PHAR)",
+ "support": {
+ "issues": "https://github.com/phar-io/manifest/issues",
+ "source": "https://github.com/phar-io/manifest/tree/2.0.4"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/theseer",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-03T12:33:53+00:00"
+ },
+ {
+ "name": "phar-io/version",
+ "version": "3.2.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/phar-io/version.git",
+ "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/phar-io/version/zipball/4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
+ "reference": "4f7fd7836c6f332bb2933569e566a0d6c4cbed74",
+ "shasum": ""
+ },
+ "require": {
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Heuer",
+ "email": "sebastian@phpeople.de",
+ "role": "Developer"
+ },
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "Library for handling version information and constraints",
+ "support": {
+ "issues": "https://github.com/phar-io/version/issues",
+ "source": "https://github.com/phar-io/version/tree/3.2.1"
+ },
+ "time": "2022-02-21T01:04:05+00:00"
+ },
+ {
+ "name": "phpunit/php-code-coverage",
+ "version": "10.1.16",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-code-coverage.git",
+ "reference": "7e308268858ed6baedc8704a304727d20bc07c77"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-code-coverage/zipball/7e308268858ed6baedc8704a304727d20bc07c77",
+ "reference": "7e308268858ed6baedc8704a304727d20bc07c77",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-libxml": "*",
+ "ext-xmlwriter": "*",
+ "nikic/php-parser": "^4.19.1 || ^5.1.0",
+ "php": ">=8.1",
+ "phpunit/php-file-iterator": "^4.1.0",
+ "phpunit/php-text-template": "^3.0.1",
+ "sebastian/code-unit-reverse-lookup": "^3.0.0",
+ "sebastian/complexity": "^3.2.0",
+ "sebastian/environment": "^6.1.0",
+ "sebastian/lines-of-code": "^2.0.2",
+ "sebastian/version": "^4.0.1",
+ "theseer/tokenizer": "^1.2.3"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.1"
+ },
+ "suggest": {
+ "ext-pcov": "PHP extension that provides line coverage",
+ "ext-xdebug": "PHP extension that provides line coverage as well as branch and path coverage"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "10.1.x-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that provides collection, processing, and rendering functionality for PHP code coverage information.",
+ "homepage": "https://github.com/sebastianbergmann/php-code-coverage",
+ "keywords": [
+ "coverage",
+ "testing",
+ "xunit"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-code-coverage/issues",
+ "security": "https://github.com/sebastianbergmann/php-code-coverage/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-code-coverage/tree/10.1.16"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-08-22T04:31:57+00:00"
+ },
+ {
+ "name": "phpunit/php-file-iterator",
+ "version": "4.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-file-iterator.git",
+ "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-file-iterator/zipball/a95037b6d9e608ba092da1b23931e537cadc3c3c",
+ "reference": "a95037b6d9e608ba092da1b23931e537cadc3c3c",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "FilterIterator implementation that filters files based on a list of suffixes.",
+ "homepage": "https://github.com/sebastianbergmann/php-file-iterator/",
+ "keywords": [
+ "filesystem",
+ "iterator"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-file-iterator/issues",
+ "security": "https://github.com/sebastianbergmann/php-file-iterator/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-file-iterator/tree/4.1.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-08-31T06:24:48+00:00"
+ },
+ {
+ "name": "phpunit/php-invoker",
+ "version": "4.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-invoker.git",
+ "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-invoker/zipball/f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7",
+ "reference": "f5e568ba02fa5ba0ddd0f618391d5a9ea50b06d7",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "ext-pcntl": "*",
+ "phpunit/phpunit": "^10.0"
+ },
+ "suggest": {
+ "ext-pcntl": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Invoke callables with a timeout",
+ "homepage": "https://github.com/sebastianbergmann/php-invoker/",
+ "keywords": [
+ "process"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-invoker/issues",
+ "source": "https://github.com/sebastianbergmann/php-invoker/tree/4.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T06:56:09+00:00"
+ },
+ {
+ "name": "phpunit/php-text-template",
+ "version": "3.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-text-template.git",
+ "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-text-template/zipball/0c7b06ff49e3d5072f057eb1fa59258bf287a748",
+ "reference": "0c7b06ff49e3d5072f057eb1fa59258bf287a748",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Simple template engine.",
+ "homepage": "https://github.com/sebastianbergmann/php-text-template/",
+ "keywords": [
+ "template"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-text-template/issues",
+ "security": "https://github.com/sebastianbergmann/php-text-template/security/policy",
+ "source": "https://github.com/sebastianbergmann/php-text-template/tree/3.0.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-08-31T14:07:24+00:00"
+ },
+ {
+ "name": "phpunit/php-timer",
+ "version": "6.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/php-timer.git",
+ "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/php-timer/zipball/e2a2d67966e740530f4a3343fe2e030ffdc1161d",
+ "reference": "e2a2d67966e740530f4a3343fe2e030ffdc1161d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "6.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Utility class for timing",
+ "homepage": "https://github.com/sebastianbergmann/php-timer/",
+ "keywords": [
+ "timer"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/php-timer/issues",
+ "source": "https://github.com/sebastianbergmann/php-timer/tree/6.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T06:57:52+00:00"
+ },
+ {
+ "name": "phpunit/phpunit",
+ "version": "10.5.63",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/phpunit.git",
+ "reference": "33198268dad71e926626b618f3ec3966661e4d90"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/phpunit/zipball/33198268dad71e926626b618f3ec3966661e4d90",
+ "reference": "33198268dad71e926626b618f3ec3966661e4d90",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-json": "*",
+ "ext-libxml": "*",
+ "ext-mbstring": "*",
+ "ext-xml": "*",
+ "ext-xmlwriter": "*",
+ "myclabs/deep-copy": "^1.13.4",
+ "phar-io/manifest": "^2.0.4",
+ "phar-io/version": "^3.2.1",
+ "php": ">=8.1",
+ "phpunit/php-code-coverage": "^10.1.16",
+ "phpunit/php-file-iterator": "^4.1.0",
+ "phpunit/php-invoker": "^4.0.0",
+ "phpunit/php-text-template": "^3.0.1",
+ "phpunit/php-timer": "^6.0.0",
+ "sebastian/cli-parser": "^2.0.1",
+ "sebastian/code-unit": "^2.0.0",
+ "sebastian/comparator": "^5.0.5",
+ "sebastian/diff": "^5.1.1",
+ "sebastian/environment": "^6.1.0",
+ "sebastian/exporter": "^5.1.4",
+ "sebastian/global-state": "^6.0.2",
+ "sebastian/object-enumerator": "^5.0.0",
+ "sebastian/recursion-context": "^5.0.1",
+ "sebastian/type": "^4.0.0",
+ "sebastian/version": "^4.0.1"
+ },
+ "suggest": {
+ "ext-soap": "To be able to generate mocks based on WSDL files"
+ },
+ "bin": [
+ "phpunit"
+ ],
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "10.5-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "src/Framework/Assert/Functions.php"
+ ],
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "The PHP Unit Testing framework.",
+ "homepage": "https://phpunit.de/",
+ "keywords": [
+ "phpunit",
+ "testing",
+ "xunit"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/phpunit/issues",
+ "security": "https://github.com/sebastianbergmann/phpunit/security/policy",
+ "source": "https://github.com/sebastianbergmann/phpunit/tree/10.5.63"
+ },
+ "funding": [
+ {
+ "url": "https://phpunit.de/sponsors.html",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/phpunit/phpunit",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2026-01-27T05:48:37+00:00"
+ },
+ {
+ "name": "psr/container",
+ "version": "2.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/php-fig/container.git",
+ "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963",
+ "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=7.4.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-master": "2.0.x-dev"
+ }
+ },
+ "autoload": {
+ "psr-4": {
+ "Psr\\Container\\": "src/"
+ }
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "PHP-FIG",
+ "homepage": "https://www.php-fig.org/"
+ }
+ ],
+ "description": "Common Container Interface (PHP FIG PSR-11)",
+ "homepage": "https://github.com/php-fig/container",
+ "keywords": [
+ "PSR-11",
+ "container",
+ "container-interface",
+ "container-interop",
+ "psr"
+ ],
+ "support": {
+ "issues": "https://github.com/php-fig/container/issues",
+ "source": "https://github.com/php-fig/container/tree/2.0.2"
+ },
+ "time": "2021-11-05T16:47:00+00:00"
+ },
+ {
+ "name": "sebastian/cli-parser",
+ "version": "2.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/cli-parser.git",
+ "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/cli-parser/zipball/c34583b87e7b7a8055bf6c450c2c77ce32a24084",
+ "reference": "c34583b87e7b7a8055bf6c450c2c77ce32a24084",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for parsing CLI options",
+ "homepage": "https://github.com/sebastianbergmann/cli-parser",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/cli-parser/issues",
+ "security": "https://github.com/sebastianbergmann/cli-parser/security/policy",
+ "source": "https://github.com/sebastianbergmann/cli-parser/tree/2.0.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-02T07:12:49+00:00"
+ },
+ {
+ "name": "sebastian/code-unit",
+ "version": "2.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit.git",
+ "reference": "a81fee9eef0b7a76af11d121767abc44c104e503"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit/zipball/a81fee9eef0b7a76af11d121767abc44c104e503",
+ "reference": "a81fee9eef0b7a76af11d121767abc44c104e503",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Collection of value objects that represent the PHP code units",
+ "homepage": "https://github.com/sebastianbergmann/code-unit",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/code-unit/issues",
+ "source": "https://github.com/sebastianbergmann/code-unit/tree/2.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T06:58:43+00:00"
+ },
+ {
+ "name": "sebastian/code-unit-reverse-lookup",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/code-unit-reverse-lookup.git",
+ "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/code-unit-reverse-lookup/zipball/5e3a687f7d8ae33fb362c5c0743794bbb2420a1d",
+ "reference": "5e3a687f7d8ae33fb362c5c0743794bbb2420a1d",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Looks up which function or method a line of code belongs to",
+ "homepage": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/issues",
+ "source": "https://github.com/sebastianbergmann/code-unit-reverse-lookup/tree/3.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T06:59:15+00:00"
+ },
+ {
+ "name": "sebastian/comparator",
+ "version": "5.0.5",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/comparator.git",
+ "reference": "55dfef806eb7dfeb6e7a6935601fef866f8ca48d"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/comparator/zipball/55dfef806eb7dfeb6e7a6935601fef866f8ca48d",
+ "reference": "55dfef806eb7dfeb6e7a6935601fef866f8ca48d",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-mbstring": "*",
+ "php": ">=8.1",
+ "sebastian/diff": "^5.0",
+ "sebastian/exporter": "^5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@2bepublished.at"
+ }
+ ],
+ "description": "Provides the functionality to compare PHP values for equality",
+ "homepage": "https://github.com/sebastianbergmann/comparator",
+ "keywords": [
+ "comparator",
+ "compare",
+ "equality"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/comparator/issues",
+ "security": "https://github.com/sebastianbergmann/comparator/security/policy",
+ "source": "https://github.com/sebastianbergmann/comparator/tree/5.0.5"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/sebastian/comparator",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2026-01-24T09:25:16+00:00"
+ },
+ {
+ "name": "sebastian/complexity",
+ "version": "3.2.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/complexity.git",
+ "reference": "68ff824baeae169ec9f2137158ee529584553799"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/complexity/zipball/68ff824baeae169ec9f2137158ee529584553799",
+ "reference": "68ff824baeae169ec9f2137158ee529584553799",
+ "shasum": ""
+ },
+ "require": {
+ "nikic/php-parser": "^4.18 || ^5.0",
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.2-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for calculating the complexity of PHP code units",
+ "homepage": "https://github.com/sebastianbergmann/complexity",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/complexity/issues",
+ "security": "https://github.com/sebastianbergmann/complexity/security/policy",
+ "source": "https://github.com/sebastianbergmann/complexity/tree/3.2.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-12-21T08:37:17+00:00"
+ },
+ {
+ "name": "sebastian/diff",
+ "version": "5.1.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/diff.git",
+ "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e",
+ "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0",
+ "symfony/process": "^6.4"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Kore Nordmann",
+ "email": "mail@kore-nordmann.de"
+ }
+ ],
+ "description": "Diff implementation",
+ "homepage": "https://github.com/sebastianbergmann/diff",
+ "keywords": [
+ "diff",
+ "udiff",
+ "unidiff",
+ "unified diff"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/diff/issues",
+ "security": "https://github.com/sebastianbergmann/diff/security/policy",
+ "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-02T07:15:17+00:00"
+ },
+ {
+ "name": "sebastian/environment",
+ "version": "6.1.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/environment.git",
+ "reference": "8074dbcd93529b357029f5cc5058fd3e43666984"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/environment/zipball/8074dbcd93529b357029f5cc5058fd3e43666984",
+ "reference": "8074dbcd93529b357029f5cc5058fd3e43666984",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "suggest": {
+ "ext-posix": "*"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "6.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Provides functionality to handle HHVM/PHP environments",
+ "homepage": "https://github.com/sebastianbergmann/environment",
+ "keywords": [
+ "Xdebug",
+ "environment",
+ "hhvm"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/environment/issues",
+ "security": "https://github.com/sebastianbergmann/environment/security/policy",
+ "source": "https://github.com/sebastianbergmann/environment/tree/6.1.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-23T08:47:14+00:00"
+ },
+ {
+ "name": "sebastian/exporter",
+ "version": "5.1.4",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/exporter.git",
+ "reference": "0735b90f4da94969541dac1da743446e276defa6"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/exporter/zipball/0735b90f4da94969541dac1da743446e276defa6",
+ "reference": "0735b90f4da94969541dac1da743446e276defa6",
+ "shasum": ""
+ },
+ "require": {
+ "ext-mbstring": "*",
+ "php": ">=8.1",
+ "sebastian/recursion-context": "^5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.1-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Volker Dusch",
+ "email": "github@wallbash.com"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ },
+ {
+ "name": "Bernhard Schussek",
+ "email": "bschussek@gmail.com"
+ }
+ ],
+ "description": "Provides the functionality to export PHP variables for visualization",
+ "homepage": "https://www.github.com/sebastianbergmann/exporter",
+ "keywords": [
+ "export",
+ "exporter"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/exporter/issues",
+ "security": "https://github.com/sebastianbergmann/exporter/security/policy",
+ "source": "https://github.com/sebastianbergmann/exporter/tree/5.1.4"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/sebastian/exporter",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-09-24T06:09:11+00:00"
+ },
+ {
+ "name": "sebastian/global-state",
+ "version": "6.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/global-state.git",
+ "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/global-state/zipball/987bafff24ecc4c9ac418cab1145b96dd6e9cbd9",
+ "reference": "987bafff24ecc4c9ac418cab1145b96dd6e9cbd9",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1",
+ "sebastian/object-reflector": "^3.0",
+ "sebastian/recursion-context": "^5.0"
+ },
+ "require-dev": {
+ "ext-dom": "*",
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "6.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Snapshotting of global state",
+ "homepage": "https://www.github.com/sebastianbergmann/global-state",
+ "keywords": [
+ "global state"
+ ],
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/global-state/issues",
+ "security": "https://github.com/sebastianbergmann/global-state/security/policy",
+ "source": "https://github.com/sebastianbergmann/global-state/tree/6.0.2"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2024-03-02T07:19:19+00:00"
+ },
+ {
+ "name": "sebastian/lines-of-code",
+ "version": "2.0.2",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/lines-of-code.git",
+ "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/lines-of-code/zipball/856e7f6a75a84e339195d48c556f23be2ebf75d0",
+ "reference": "856e7f6a75a84e339195d48c556f23be2ebf75d0",
+ "shasum": ""
+ },
+ "require": {
+ "nikic/php-parser": "^4.18 || ^5.0",
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "2.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library for counting the lines of code in PHP source code",
+ "homepage": "https://github.com/sebastianbergmann/lines-of-code",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/lines-of-code/issues",
+ "security": "https://github.com/sebastianbergmann/lines-of-code/security/policy",
+ "source": "https://github.com/sebastianbergmann/lines-of-code/tree/2.0.2"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-12-21T08:38:20+00:00"
+ },
+ {
+ "name": "sebastian/object-enumerator",
+ "version": "5.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-enumerator.git",
+ "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-enumerator/zipball/202d0e344a580d7f7d04b3fafce6933e59dae906",
+ "reference": "202d0e344a580d7f7d04b3fafce6933e59dae906",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1",
+ "sebastian/object-reflector": "^3.0",
+ "sebastian/recursion-context": "^5.0"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Traverses array structures and object graphs to enumerate all referenced objects",
+ "homepage": "https://github.com/sebastianbergmann/object-enumerator/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/object-enumerator/issues",
+ "source": "https://github.com/sebastianbergmann/object-enumerator/tree/5.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T07:08:32+00:00"
+ },
+ {
+ "name": "sebastian/object-reflector",
+ "version": "3.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/object-reflector.git",
+ "reference": "24ed13d98130f0e7122df55d06c5c4942a577957"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/object-reflector/zipball/24ed13d98130f0e7122df55d06c5c4942a577957",
+ "reference": "24ed13d98130f0e7122df55d06c5c4942a577957",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "3.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ }
+ ],
+ "description": "Allows reflection of object attributes, including inherited and non-public ones",
+ "homepage": "https://github.com/sebastianbergmann/object-reflector/",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/object-reflector/issues",
+ "source": "https://github.com/sebastianbergmann/object-reflector/tree/3.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T07:06:18+00:00"
+ },
+ {
+ "name": "sebastian/recursion-context",
+ "version": "5.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/recursion-context.git",
+ "reference": "47e34210757a2f37a97dcd207d032e1b01e64c7a"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/recursion-context/zipball/47e34210757a2f37a97dcd207d032e1b01e64c7a",
+ "reference": "47e34210757a2f37a97dcd207d032e1b01e64c7a",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.5"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "5.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de"
+ },
+ {
+ "name": "Jeff Welch",
+ "email": "whatthejeff@gmail.com"
+ },
+ {
+ "name": "Adam Harvey",
+ "email": "aharvey@php.net"
+ }
+ ],
+ "description": "Provides functionality to recursively process PHP variables",
+ "homepage": "https://github.com/sebastianbergmann/recursion-context",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/recursion-context/issues",
+ "security": "https://github.com/sebastianbergmann/recursion-context/security/policy",
+ "source": "https://github.com/sebastianbergmann/recursion-context/tree/5.0.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ },
+ {
+ "url": "https://liberapay.com/sebastianbergmann",
+ "type": "liberapay"
+ },
+ {
+ "url": "https://thanks.dev/u/gh/sebastianbergmann",
+ "type": "thanks_dev"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/sebastian/recursion-context",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2025-08-10T07:50:56+00:00"
+ },
+ {
+ "name": "sebastian/type",
+ "version": "4.0.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/type.git",
+ "reference": "462699a16464c3944eefc02ebdd77882bd3925bf"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/type/zipball/462699a16464c3944eefc02ebdd77882bd3925bf",
+ "reference": "462699a16464c3944eefc02ebdd77882bd3925bf",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "require-dev": {
+ "phpunit/phpunit": "^10.0"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Collection of value objects that represent the types of the PHP type system",
+ "homepage": "https://github.com/sebastianbergmann/type",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/type/issues",
+ "source": "https://github.com/sebastianbergmann/type/tree/4.0.0"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-03T07:10:45+00:00"
+ },
+ {
+ "name": "sebastian/version",
+ "version": "4.0.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/sebastianbergmann/version.git",
+ "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/sebastianbergmann/version/zipball/c51fa83a5d8f43f1402e3f32a005e6262244ef17",
+ "reference": "c51fa83a5d8f43f1402e3f32a005e6262244ef17",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "type": "library",
+ "extra": {
+ "branch-alias": {
+ "dev-main": "4.0-dev"
+ }
+ },
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Sebastian Bergmann",
+ "email": "sebastian@phpunit.de",
+ "role": "lead"
+ }
+ ],
+ "description": "Library that helps with managing the version number of Git-hosted PHP projects",
+ "homepage": "https://github.com/sebastianbergmann/version",
+ "support": {
+ "issues": "https://github.com/sebastianbergmann/version/issues",
+ "source": "https://github.com/sebastianbergmann/version/tree/4.0.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/sebastianbergmann",
+ "type": "github"
+ }
+ ],
+ "time": "2023-02-07T11:34:05+00:00"
+ },
+ {
+ "name": "symfony/deprecation-contracts",
+ "version": "v3.6.0",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/symfony/deprecation-contracts.git",
+ "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/63afe740e99a13ba87ec199bb07bbdee937a5b62",
+ "reference": "63afe740e99a13ba87ec199bb07bbdee937a5b62",
+ "shasum": ""
+ },
+ "require": {
+ "php": ">=8.1"
+ },
+ "type": "library",
+ "extra": {
+ "thanks": {
+ "url": "https://github.com/symfony/contracts",
+ "name": "symfony/contracts"
+ },
+ "branch-alias": {
+ "dev-main": "3.6-dev"
+ }
+ },
+ "autoload": {
+ "files": [
+ "function.php"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "MIT"
+ ],
+ "authors": [
+ {
+ "name": "Nicolas Grekas",
+ "email": "p@tchwork.com"
+ },
+ {
+ "name": "Symfony Community",
+ "homepage": "https://symfony.com/contributors"
+ }
+ ],
+ "description": "A generic function and convention to trigger deprecation notices",
+ "homepage": "https://symfony.com",
+ "support": {
+ "source": "https://github.com/symfony/deprecation-contracts/tree/v3.6.0"
+ },
+ "funding": [
+ {
+ "url": "https://symfony.com/sponsor",
+ "type": "custom"
+ },
+ {
+ "url": "https://github.com/fabpot",
+ "type": "github"
+ },
+ {
+ "url": "https://tidelift.com/funding/github/packagist/symfony/symfony",
+ "type": "tidelift"
+ }
+ ],
+ "time": "2024-09-25T14:21:43+00:00"
+ },
+ {
+ "name": "theseer/tokenizer",
+ "version": "1.3.1",
+ "source": {
+ "type": "git",
+ "url": "https://github.com/theseer/tokenizer.git",
+ "reference": "b7489ce515e168639d17feec34b8847c326b0b3c"
+ },
+ "dist": {
+ "type": "zip",
+ "url": "https://api.github.com/repos/theseer/tokenizer/zipball/b7489ce515e168639d17feec34b8847c326b0b3c",
+ "reference": "b7489ce515e168639d17feec34b8847c326b0b3c",
+ "shasum": ""
+ },
+ "require": {
+ "ext-dom": "*",
+ "ext-tokenizer": "*",
+ "ext-xmlwriter": "*",
+ "php": "^7.2 || ^8.0"
+ },
+ "type": "library",
+ "autoload": {
+ "classmap": [
+ "src/"
+ ]
+ },
+ "notification-url": "https://packagist.org/downloads/",
+ "license": [
+ "BSD-3-Clause"
+ ],
+ "authors": [
+ {
+ "name": "Arne Blankerts",
+ "email": "arne@blankerts.de",
+ "role": "Developer"
+ }
+ ],
+ "description": "A small library for converting tokenized PHP source code into XML and potentially other formats",
+ "support": {
+ "issues": "https://github.com/theseer/tokenizer/issues",
+ "source": "https://github.com/theseer/tokenizer/tree/1.3.1"
+ },
+ "funding": [
+ {
+ "url": "https://github.com/theseer",
+ "type": "github"
+ }
+ ],
+ "time": "2025-11-17T20:03:58+00:00"
+ }
+ ],
+ "aliases": [],
+ "minimum-stability": "stable",
+ "stability-flags": {},
+ "prefer-stable": false,
+ "prefer-lowest": false,
+ "platform": {
+ "php": "^8.2"
+ },
+ "platform-dev": {},
+ "plugin-api-version": "2.6.0"
+}
diff --git a/env b/env
new file mode 100644
index 0000000..f359ec2
--- /dev/null
+++ b/env
@@ -0,0 +1,69 @@
+#--------------------------------------------------------------------
+# Example Environment Configuration file
+#
+# This file can be used as a starting point for your own
+# custom .env files, and contains most of the possible settings
+# available in a default install.
+#
+# By default, all of the settings are commented out. If you want
+# to override the setting, you must un-comment it by removing the '#'
+# at the beginning of the line.
+#--------------------------------------------------------------------
+
+#--------------------------------------------------------------------
+# ENVIRONMENT
+#--------------------------------------------------------------------
+
+# CI_ENVIRONMENT = production
+
+#--------------------------------------------------------------------
+# APP
+#--------------------------------------------------------------------
+
+# app.baseURL = ''
+# If you have trouble with `.`, you could also use `_`.
+# app_baseURL = ''
+# app.forceGlobalSecureRequests = false
+# app.CSPEnabled = false
+
+#--------------------------------------------------------------------
+# DATABASE
+#--------------------------------------------------------------------
+
+# database.default.hostname = localhost
+# database.default.database = ci4
+# database.default.username = root
+# database.default.password = root
+# database.default.DBDriver = MySQLi
+# database.default.DBPrefix =
+# database.default.port = 3306
+
+# If you use MySQLi as tests, first update the values of Config\Database::$tests.
+# database.tests.hostname = localhost
+# database.tests.database = ci4_test
+# database.tests.username = root
+# database.tests.password = root
+# database.tests.DBDriver = MySQLi
+# database.tests.DBPrefix =
+# database.tests.charset = utf8mb4
+# database.tests.DBCollat = utf8mb4_general_ci
+# database.tests.port = 3306
+
+#--------------------------------------------------------------------
+# ENCRYPTION
+#--------------------------------------------------------------------
+
+# encryption.key =
+
+#--------------------------------------------------------------------
+# SESSION
+#--------------------------------------------------------------------
+
+# session.driver = 'CodeIgniter\Session\Handlers\FileHandler'
+# session.savePath = null
+
+#--------------------------------------------------------------------
+# LOGGER
+#--------------------------------------------------------------------
+
+# logger.threshold = 4
diff --git a/old_code_ci3/controllers/Auth.php b/old_code_ci3/controllers/Auth.php
new file mode 100644
index 0000000..937e659
--- /dev/null
+++ b/old_code_ci3/controllers/Auth.php
@@ -0,0 +1,825 @@
+load->database();
+ $this->load->library(array('ion_auth','form_validation'));
+ $this->load->helper(array('url','language'));
+
+ $this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));
+
+ $this->lang->load('auth');
+ }
+
+ // redirect if needed, otherwise display the user list
+ public function index()
+ {
+
+ if (!$this->ion_auth->logged_in())
+ {
+ // redirect them to the login page
+ redirect('auth/login', 'refresh');
+ }
+ elseif (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
+ {
+ // redirect them to the home page because they must be an administrator to view this
+ return show_error('You must be an administrator to view this page.');
+ }
+ else
+ {
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ //list the users
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth/index', $this->data);
+ }
+ }
+
+ // log the user in
+ public function login()
+ {
+ $this->data['title'] = $this->lang->line('login_heading');
+
+ //validate form input
+ $this->form_validation->set_rules('identity', str_replace(':', '', $this->lang->line('login_identity_label')), 'required');
+ $this->form_validation->set_rules('password', str_replace(':', '', $this->lang->line('login_password_label')), 'required');
+
+ if ($this->form_validation->run() == true)
+ {
+ // check to see if the user is logging in
+ // check for "remember me"
+ $remember = (bool) $this->input->post('remember');
+
+ if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember))
+ {
+ //if the login is successful
+ //redirect them back to the home page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ //redirect('/', 'refresh');
+
+
+ redirect('welcome',$user);
+ }
+ else
+ {
+ // if the login was un-successful
+ // redirect them back to the login page
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect('auth/login', 'refresh'); // use redirects instead of loading views for compatibility with MY_Controller libraries
+ }
+ }
+ else
+ {
+ // the user is not logging in so display the login page
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ $this->data['identity'] = array('name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('identity'),
+ );
+ $this->data['password'] = array('name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ );
+
+ $this->_render_page('auth/login', $this->data);
+ }
+ }
+
+ // log the user out
+ public function logout()
+ {
+ $this->data['title'] = "Logout";
+
+ // log the user out
+ $logout = $this->ion_auth->logout();
+
+ // redirect them to the login page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ redirect('auth/login', 'refresh');
+ }
+
+ // change password
+ public function change_password()
+ {
+ $this->form_validation->set_rules('old', $this->lang->line('change_password_validation_old_password_label'), 'required');
+ $this->form_validation->set_rules('new', $this->lang->line('change_password_validation_new_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[new_confirm]');
+ $this->form_validation->set_rules('new_confirm', $this->lang->line('change_password_validation_new_password_confirm_label'), 'required');
+
+ if (!$this->ion_auth->logged_in())
+ {
+ redirect('auth/login', 'refresh');
+ }
+
+ $user = $this->ion_auth->user()->row();
+
+ if ($this->form_validation->run() == false)
+ {
+ // display the form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ $this->data['min_password_length'] = $this->config->item('min_password_length', 'ion_auth');
+ $this->data['old_password'] = array(
+ 'name' => 'old',
+ 'id' => 'old',
+ 'type' => 'password',
+ );
+ $this->data['new_password'] = array(
+ 'name' => 'new',
+ 'id' => 'new',
+ 'type' => 'password',
+ 'pattern' => '^.{'.$this->data['min_password_length'].'}.*$',
+ );
+ $this->data['new_password_confirm'] = array(
+ 'name' => 'new_confirm',
+ 'id' => 'new_confirm',
+ 'type' => 'password',
+ 'pattern' => '^.{'.$this->data['min_password_length'].'}.*$',
+ );
+ $this->data['user_id'] = array(
+ 'name' => 'user_id',
+ 'id' => 'user_id',
+ 'type' => 'hidden',
+ 'value' => $user->id,
+ );
+
+ // render
+ $this->_render_page('auth/change_password', $this->data);
+ }
+ else
+ {
+ $identity = $this->session->userdata('identity');
+
+ $change = $this->ion_auth->change_password($identity, $this->input->post('old'), $this->input->post('new'));
+
+ if ($change)
+ {
+ //if the password was successfully changed
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ $this->logout();
+ }
+ else
+ {
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect('auth/change_password', 'refresh');
+ }
+ }
+ }
+
+ // forgot password
+ public function forgot_password()
+ {
+ // setting validation rules by checking whether identity is username or email
+ if($this->config->item('identity', 'ion_auth') != 'email' )
+ {
+ $this->form_validation->set_rules('identity', $this->lang->line('forgot_password_identity_label'), 'required');
+ }
+ else
+ {
+ $this->form_validation->set_rules('identity', $this->lang->line('forgot_password_validation_email_label'), 'required|valid_email');
+ }
+
+
+ if ($this->form_validation->run() == false)
+ {
+ $this->data['type'] = $this->config->item('identity','ion_auth');
+ // setup the input
+ $this->data['identity'] = array('name' => 'identity',
+ 'id' => 'identity',
+ );
+
+ if ( $this->config->item('identity', 'ion_auth') != 'email' ){
+ $this->data['identity_label'] = $this->lang->line('forgot_password_identity_label');
+ }
+ else
+ {
+ $this->data['identity_label'] = $this->lang->line('forgot_password_email_identity_label');
+ }
+
+ // set any errors and display the form
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+ $this->_render_page('auth/forgot_password', $this->data);
+ }
+ else
+ {
+ $identity_column = $this->config->item('identity','ion_auth');
+ $identity = $this->ion_auth->where($identity_column, $this->input->post('identity'))->users()->row();
+
+ if(empty($identity)) {
+
+ if($this->config->item('identity', 'ion_auth') != 'email')
+ {
+ $this->ion_auth->set_error('forgot_password_identity_not_found');
+ }
+ else
+ {
+ $this->ion_auth->set_error('forgot_password_email_not_found');
+ }
+
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect("auth/forgot_password", 'refresh');
+ }
+
+ // run the forgotten password method to email an activation code to the user
+ $forgotten = $this->ion_auth->forgotten_password($identity->{$this->config->item('identity', 'ion_auth')});
+
+ if ($forgotten)
+ {
+ // if there were no errors
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ redirect("auth/login", 'refresh'); //we should display a confirmation page here instead of the login page
+ }
+ else
+ {
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect("auth/forgot_password", 'refresh');
+ }
+ }
+ }
+
+ // reset password - final step for forgotten password
+ public function reset_password($code = NULL)
+ {
+ if (!$code)
+ {
+ show_404();
+ }
+
+ $user = $this->ion_auth->forgotten_password_check($code);
+
+ if ($user)
+ {
+ // if the code is valid then display the password reset form
+
+ $this->form_validation->set_rules('new', $this->lang->line('reset_password_validation_new_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[new_confirm]');
+ $this->form_validation->set_rules('new_confirm', $this->lang->line('reset_password_validation_new_password_confirm_label'), 'required');
+
+ if ($this->form_validation->run() == false)
+ {
+ // display the form
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ $this->data['min_password_length'] = $this->config->item('min_password_length', 'ion_auth');
+ $this->data['new_password'] = array(
+ 'name' => 'new',
+ 'id' => 'new',
+ 'type' => 'password',
+ 'pattern' => '^.{'.$this->data['min_password_length'].'}.*$',
+ );
+ $this->data['new_password_confirm'] = array(
+ 'name' => 'new_confirm',
+ 'id' => 'new_confirm',
+ 'type' => 'password',
+ 'pattern' => '^.{'.$this->data['min_password_length'].'}.*$',
+ );
+ $this->data['user_id'] = array(
+ 'name' => 'user_id',
+ 'id' => 'user_id',
+ 'type' => 'hidden',
+ 'value' => $user->id,
+ );
+ $this->data['csrf'] = $this->_get_csrf_nonce();
+ $this->data['code'] = $code;
+
+ // render
+ $this->_render_page('auth/reset_password', $this->data);
+ }
+ else
+ {
+ // do we have a valid request?
+ if ($this->_valid_csrf_nonce() === FALSE || $user->id != $this->input->post('user_id'))
+ {
+
+ // something fishy might be up
+ $this->ion_auth->clear_forgotten_password_code($code);
+
+ show_error($this->lang->line('error_csrf'));
+
+ }
+ else
+ {
+ // finally change the password
+ $identity = $user->{$this->config->item('identity', 'ion_auth')};
+
+ $change = $this->ion_auth->reset_password($identity, $this->input->post('new'));
+
+ if ($change)
+ {
+ // if the password was successfully changed
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ redirect("auth/login", 'refresh');
+ }
+ else
+ {
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect('auth/reset_password/' . $code, 'refresh');
+ }
+ }
+ }
+ }
+ else
+ {
+ // if the code is invalid then send them back to the forgot password page
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect("auth/forgot_password", 'refresh');
+ }
+ }
+
+ // activate the user
+ public function activate($id, $code=false)
+ {
+ if ($code !== false)
+ {
+ $activation = $this->ion_auth->activate($id, $code);
+ }
+ else if ($this->ion_auth->is_admin())
+ {
+ $activation = $this->ion_auth->activate($id);
+ }
+
+ if ($activation)
+ {
+ // redirect them to the auth page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ redirect("auth", 'refresh');
+ }
+ else
+ {
+ // redirect them to the forgot password page
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect("auth/forgot_password", 'refresh');
+ }
+ }
+
+ // deactivate the user
+ public function deactivate($id = NULL)
+ {
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ // redirect them to the home page because they must be an administrator to view this
+ return show_error('You must be an administrator to view this page.');
+ }
+
+ $id = (int) $id;
+
+ $this->load->library('form_validation');
+ $this->form_validation->set_rules('confirm', $this->lang->line('deactivate_validation_confirm_label'), 'required');
+ $this->form_validation->set_rules('id', $this->lang->line('deactivate_validation_user_id_label'), 'required|alpha_numeric');
+
+ if ($this->form_validation->run() == FALSE)
+ {
+ // insert csrf check
+ $this->data['csrf'] = $this->_get_csrf_nonce();
+ $this->data['user'] = $this->ion_auth->user($id)->row();
+
+ $this->_render_page('auth/deactivate_user', $this->data);
+ }
+ else
+ {
+ // do we really want to deactivate?
+ if ($this->input->post('confirm') == 'yes')
+ {
+ // do we have a valid request?
+ if ($this->_valid_csrf_nonce() === FALSE || $id != $this->input->post('id'))
+ {
+ show_error($this->lang->line('error_csrf'));
+ }
+
+ // do we have the right userlevel?
+ if ($this->ion_auth->logged_in() && $this->ion_auth->is_admin())
+ {
+ $this->ion_auth->deactivate($id);
+ }
+ }
+
+ // redirect them back to the auth page
+ redirect('auth', 'refresh');
+ }
+ }
+
+ // create a new user
+ public function create_user()
+ {
+ $this->data['title'] = $this->lang->line('create_user_heading');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth', 'refresh');
+ }
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+ // validate form input
+ $this->form_validation->set_rules('first_name', $this->lang->line('create_user_validation_fname_label'), 'required');
+ $this->form_validation->set_rules('last_name', $this->lang->line('create_user_validation_lname_label'), 'required');
+ if($identity_column!=='email')
+ {
+ $this->form_validation->set_rules('identity',$this->lang->line('create_user_validation_identity_label'),'required|is_unique['.$tables['users'].'.'.$identity_column.']');
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email');
+ }
+ else
+ {
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email|is_unique[' . $tables['users'] . '.email]');
+ }
+ $this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'trim');
+ //$this->form_validation->set_rules('company', $this->lang->line('create_user_validation_company_label'), 'trim');
+ $this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('create_user_validation_password_confirm_label'), 'required');
+
+ if ($this->form_validation->run() == true)
+ {
+ $email = strtolower($this->input->post('email'));
+ $identity = ($identity_column==='email') ? $email : $this->input->post('identity');
+ $password = $this->input->post('password');
+
+ $additional_data = array(
+ 'first_name' => $this->input->post('first_name'),
+ 'last_name' => $this->input->post('last_name'),
+ 'company' => $this->input->post('company'),
+ 'phone' => $this->input->post('phone'),
+ );
+ }
+ if ($this->form_validation->run() == true && $this->ion_auth->register($identity, $password, $email, $additional_data))
+ {
+ // check to see if we are creating the user
+ // redirect them back to the admin page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ redirect("auth", 'refresh');
+
+ }
+ else
+ {
+ // display the create user form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ $this->data['first_name'] = array(
+ 'name' => 'first_name',
+ 'id' => 'first_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('first_name'),
+ );
+ $this->data['last_name'] = array(
+ 'name' => 'last_name',
+ 'id' => 'last_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('last_name'),
+ );
+ $this->data['identity'] = array(
+ 'name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('identity'),
+ );
+
+ $this->data['email'] = array(
+ 'name' => 'email',
+ 'id' => 'email',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('email'),
+ );
+
+ $this->data['phone'] = array(
+ 'name' => 'phone',
+ 'id' => 'phone',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('phone'),
+ );
+ $this->data['password'] = array(
+ 'name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('password'),
+ );
+ $this->data['password_confirm'] = array(
+ 'name' => 'password_confirm',
+ 'id' => 'password_confirm',
+ 'type' => 'password',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('password_confirm'),
+ );
+
+ $this->_render_page('auth/create_user', $this->data);
+ }
+ }
+
+ // edit a user
+ public function edit_user($id)
+ {
+ $this->data['title'] = $this->lang->line('edit_user_heading');
+
+ if (!$this->ion_auth->logged_in() || (!$this->ion_auth->is_admin() && !($this->ion_auth->user()->row()->id == $id)))
+ {
+ redirect('auth', 'refresh');
+ }
+
+ $user = $this->ion_auth->user($id)->row();
+ $groups=$this->ion_auth->groups()->result_array();
+ $currentGroups = $this->ion_auth->get_users_groups($id)->result();
+
+ // validate form input
+ $this->form_validation->set_rules('first_name', $this->lang->line('edit_user_validation_fname_label'), 'required');
+ $this->form_validation->set_rules('last_name', $this->lang->line('edit_user_validation_lname_label'), 'required');
+ $this->form_validation->set_rules('phone', $this->lang->line('edit_user_validation_phone_label'), 'required');
+ $this->form_validation->set_rules('company', $this->lang->line('edit_user_validation_company_label'), 'required');
+
+ if (isset($_POST) && !empty($_POST))
+ {
+ // do we have a valid request?
+ if ($this->_valid_csrf_nonce() === FALSE || $id != $this->input->post('id'))
+ {
+ show_error($this->lang->line('error_csrf'));
+ }
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $this->form_validation->set_rules('password', $this->lang->line('edit_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('edit_user_validation_password_confirm_label'), 'required');
+ }
+
+ if ($this->form_validation->run() === TRUE)
+ {
+ $data = array(
+ 'first_name' => $this->input->post('first_name'),
+ 'last_name' => $this->input->post('last_name'),
+ 'company' => $this->input->post('company'),
+ 'phone' => $this->input->post('phone'),
+ );
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $data['password'] = $this->input->post('password');
+ }
+
+
+
+ // Only allow updating groups if user is admin
+ if ($this->ion_auth->is_admin())
+ {
+ //Update the groups user belongs to
+ $groupData = $this->input->post('groups');
+
+ if (isset($groupData) && !empty($groupData)) {
+
+ $this->ion_auth->remove_from_group('', $id);
+
+ foreach ($groupData as $grp) {
+ $this->ion_auth->add_to_group($grp, $id);
+ }
+
+ }
+ }
+
+ // check to see if we are updating the user
+ if($this->ion_auth->update($user->id, $data))
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->messages() );
+ if ($this->ion_auth->is_admin())
+ {
+ redirect('auth', 'refresh');
+ }
+ else
+ {
+ redirect('/', 'refresh');
+ }
+
+ }
+ else
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->errors() );
+ if ($this->ion_auth->is_admin())
+ {
+ redirect('auth', 'refresh');
+ }
+ else
+ {
+ redirect('/', 'refresh');
+ }
+
+ }
+
+ }
+ }
+
+ // display the edit user form
+ $this->data['csrf'] = $this->_get_csrf_nonce();
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ // pass the user to the view
+ $this->data['user'] = $user;
+ $this->data['groups'] = $groups;
+ $this->data['currentGroups'] = $currentGroups;
+
+ $this->data['first_name'] = array(
+ 'name' => 'first_name',
+ 'id' => 'first_name',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('first_name', $user->first_name),
+ );
+ $this->data['last_name'] = array(
+ 'name' => 'last_name',
+ 'id' => 'last_name',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('last_name', $user->last_name),
+ );
+ $this->data['company'] = array(
+ 'name' => 'company',
+ 'id' => 'company',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('company', $user->company),
+ );
+ $this->data['phone'] = array(
+ 'name' => 'phone',
+ 'id' => 'phone',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('phone', $user->phone),
+ );
+ $this->data['password'] = array(
+ 'name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password'
+ );
+ $this->data['password_confirm'] = array(
+ 'name' => 'password_confirm',
+ 'id' => 'password_confirm',
+ 'type' => 'password'
+ );
+
+ $this->_render_page('auth/edit_user', $this->data);
+ }
+
+ // create a new group
+ public function create_group()
+ {
+ $this->data['title'] = $this->lang->line('create_group_title');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth', 'refresh');
+ }
+
+ // validate form input
+ $this->form_validation->set_rules('group_name', $this->lang->line('create_group_validation_name_label'), 'required|alpha_dash');
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $new_group_id = $this->ion_auth->create_group($this->input->post('group_name'), $this->input->post('description'));
+ if($new_group_id)
+ {
+ // check to see if we are creating the group
+ // redirect them back to the admin page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ redirect("auth", 'refresh');
+ }
+ }
+ else
+ {
+ // display the create group form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ $this->data['group_name'] = array(
+ 'name' => 'group_name',
+ 'id' => 'group_name',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_name'),
+ );
+ $this->data['description'] = array(
+ 'name' => 'description',
+ 'id' => 'description',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('description'),
+ );
+
+ $this->_render_page('auth/create_group', $this->data);
+ }
+ }
+
+ // edit a group
+ public function edit_group($id)
+ {
+ // bail if no group id given
+ if(!$id || empty($id))
+ {
+ redirect('auth', 'refresh');
+ }
+
+ $this->data['title'] = $this->lang->line('edit_group_title');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth', 'refresh');
+ }
+
+ $group = $this->ion_auth->group($id)->row();
+
+ // validate form input
+ $this->form_validation->set_rules('group_name', $this->lang->line('edit_group_validation_name_label'), 'required|alpha_dash');
+
+ if (isset($_POST) && !empty($_POST))
+ {
+ if ($this->form_validation->run() === TRUE)
+ {
+ $group_update = $this->ion_auth->update_group($id, $_POST['group_name'], $_POST['group_description']);
+
+ if($group_update)
+ {
+ $this->session->set_flashdata('message', $this->lang->line('edit_group_saved'));
+ }
+ else
+ {
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ }
+ redirect("auth", 'refresh');
+ }
+ }
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ // pass the user to the view
+ $this->data['group'] = $group;
+
+ $readonly = $this->config->item('admin_group', 'ion_auth') === $group->name ? 'readonly' : '';
+
+ $this->data['group_name'] = array(
+ 'name' => 'group_name',
+ 'id' => 'group_name',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_name', $group->name),
+ $readonly => $readonly,
+ );
+ $this->data['group_description'] = array(
+ 'name' => 'group_description',
+ 'id' => 'group_description',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_description', $group->description),
+ );
+
+ $this->_render_page('auth/edit_group', $this->data);
+ }
+
+
+ public function _get_csrf_nonce()
+ {
+ $this->load->helper('string');
+ $key = random_string('alnum', 8);
+ $value = random_string('alnum', 20);
+ $this->session->set_flashdata('csrfkey', $key);
+ $this->session->set_flashdata('csrfvalue', $value);
+
+ return array($key => $value);
+ }
+
+ public function _valid_csrf_nonce()
+ {
+ if ($this->input->post($this->session->flashdata('csrfkey')) !== FALSE &&
+ $this->input->post($this->session->flashdata('csrfkey')) == $this->session->flashdata('csrfvalue'))
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+ public function _render_page($view, $data=null, $returnhtml=false)//I think this makes more sense
+ {
+
+ $this->viewdata = (empty($data)) ? $this->data: $data;
+
+ $view_html = $this->load->view($view, $this->viewdata, $returnhtml);
+
+ if ($returnhtml) return $view_html;//This will return html on 3rd argument being true
+ }
+
+}
diff --git a/old_code_ci3/controllers/Auth_dst copy.php b/old_code_ci3/controllers/Auth_dst copy.php
new file mode 100644
index 0000000..89337e9
--- /dev/null
+++ b/old_code_ci3/controllers/Auth_dst copy.php
@@ -0,0 +1,796 @@
+load->database();
+ $this->load->library(array('ion_auth','form_validation'));
+ $this->load->helper(array('url','language'));
+
+ $this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));
+
+ $this->lang->load('auth');
+ }
+
+ // log the user in
+ public function login()
+ {
+ $this->data['title'] = $this->lang->line('login_heading');
+
+ //validate form input
+ $this->form_validation->set_rules('identity', str_replace(':', '', $this->lang->line('login_identity_label')), 'required');
+ $this->form_validation->set_rules('password', str_replace(':', '', $this->lang->line('login_password_label')), 'required');
+
+ if ($this->form_validation->run() == true)
+ {
+ // check to see if the user is logging in
+ // check for "remember me"
+ $remember = (bool) $this->input->post('remember');
+
+ if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember))
+ {
+ //if the login is successful
+ //redirect them back to the home page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ //redirect('/', 'refresh');
+
+ redirect('welcome');
+ }
+ else
+ {
+ // if the login was un-successful
+ // redirect them back to the login page
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect('auth_dst/login', 'refresh'); // use redirects instead of loading views for compatibility with MY_Controller libraries
+ }
+ }
+ else
+ {
+ // the user is not logging in so display the login page
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ $this->data['identity'] = array('name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('identity'),
+ );
+ $this->data['password'] = array('name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ );
+
+ $this->_render_page('auth_dst/login', $this->data);
+ }
+ }
+
+ // log the user out
+ public function logout()
+ {
+ $this->data['title'] = "Logout";
+
+ // log the user out
+ $logout = $this->ion_auth->logout();
+
+ // redirect them to the login page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ public function create_user_form()
+ {
+ $this->data['title'] = $this->lang->line('create_user_heading');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth_dst', 'refresh');
+ }
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+ // validate form input
+ $this->form_validation->set_rules('first_name', $this->lang->line('create_user_validation_fname_label'), 'required');
+ $this->form_validation->set_rules('last_name', $this->lang->line('create_user_validation_lname_label'), 'required');
+ if($identity_column!=='email')
+ {
+ $this->form_validation->set_rules('identity',$this->lang->line('create_user_validation_identity_label'),'required|is_unique['.$tables['users'].'.'.$identity_column.']');
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email');
+ }
+ else
+ {
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email|is_unique[' . $tables['users'] . '.email]');
+ }
+ $this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'trim');
+ //$this->form_validation->set_rules('company', $this->lang->line('create_user_validation_company_label'), 'trim');
+ $this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('create_user_validation_password_confirm_label'), 'required');
+
+ if ($this->form_validation->run() == true)
+ {
+ $email = strtolower($this->input->post('email'));
+ $identity = ($identity_column==='email') ? $email : $this->input->post('identity');
+ $password = $this->input->post('password');
+
+ $additional_data = array(
+ 'first_name' => $this->input->post('first_name'),
+ 'last_name' => $this->input->post('last_name'),
+ 'company' => $this->input->post('company'),
+ 'phone' => $this->input->post('phone'),
+ );
+ }
+ if ($this->form_validation->run() == true && $this->ion_auth->register($identity, $password, $email, $additional_data))
+ {
+ // check to see if we are creating the user
+ // redirect them back to the admin page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ //redirect("auth_dst", 'refresh');
+
+ $rvar=array(
+ 'insertid' =>1
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else
+ {
+ // display the create user form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+ $error_text=$this->data['message'];
+
+ $this->data['first_name'] = array(
+ 'name' => 'first_name',
+ 'id' => 'first_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('first_name'),
+ );
+
+ $this->data['last_name'] = array(
+ 'name' => 'last_name',
+ 'id' => 'last_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('last_name'),
+ );
+ $this->data['identity'] = array(
+ 'name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('identity'),
+ );
+
+ $this->data['email'] = array(
+ 'name' => 'email',
+ 'id' => 'email',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('email'),
+ );
+
+ $this->data['phone'] = array(
+ 'name' => 'phone',
+ 'id' => 'phone',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('phone'),
+ );
+ $this->data['password'] = array(
+ 'name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('password'),
+ );
+ $this->data['password_confirm'] = array(
+ 'name' => 'password_confirm',
+ 'id' => 'password_confirm',
+ 'type' => 'password',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('password_confirm'),
+ );
+
+ $this->_render_page('auth_dst/create_user', $this->data);
+ }
+ }
+
+ public function save_new_user()
+ {
+ $this->data['title'] = $this->lang->line('create_user_heading');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth_dst', 'refresh');
+ }
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+ // validate form input
+ $this->form_validation->set_rules('first_name', $this->lang->line('create_user_validation_fname_label'), 'required');
+ $this->form_validation->set_rules('last_name', $this->lang->line('create_user_validation_lname_label'), 'required');
+ if($identity_column!=='email')
+ {
+ $this->form_validation->set_rules('identity',$this->lang->line('create_user_validation_identity_label'),'required|is_unique['.$tables['users'].'.'.$identity_column.']');
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email');
+ }
+ else
+ {
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email|is_unique[' . $tables['users'] . '.email]');
+ }
+ $this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'trim');
+ //$this->form_validation->set_rules('company', $this->lang->line('create_user_validation_company_label'), 'trim');
+ $this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('create_user_validation_password_confirm_label'), 'required');
+
+ if ($this->form_validation->run() == true)
+ {
+ $email = strtolower($this->input->post('email'));
+ $identity = ($identity_column==='email') ? $email : $this->input->post('identity');
+ $password = $this->input->post('password');
+
+ $additional_data = array(
+ 'first_name' => $this->input->post('first_name'),
+ 'last_name' => $this->input->post('last_name'),
+ 'company' => $this->input->post('company'),
+ 'phone' => $this->input->post('phone'),
+ );
+ }
+ if ($this->form_validation->run() == true && $this->ion_auth->register($identity, $password, $email, $additional_data))
+ {
+ // check to see if we are creating the user
+ // redirect them back to the admin page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ //redirect("auth_dst", 'refresh');
+
+ $rvar=array(
+ 'insertid' =>1
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else
+ {
+ // display the create user form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+ $error_text=$this->data['message'];
+
+ $rvar=array(
+ 'insertid' =>0,
+ 'error_text'=>$error_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ }
+
+ // edit a user
+ public function edit_user($id)
+ {
+ $this->data['title'] = $this->lang->line('edit_user_heading');
+
+ if (!$this->ion_auth->logged_in() || (!$this->ion_auth->is_admin() && !($this->ion_auth->user()->row()->id == $id)))
+ {
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ $user = $this->ion_auth->user($id)->row();
+ $groups=$this->ion_auth->groups()->result_array();
+ $currentGroups = $this->ion_auth->get_users_groups($id)->result();
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+
+ // validate form input
+ $this->form_validation->set_rules('first_name', $this->lang->line('edit_user_validation_fname_label'), 'required');
+ $this->form_validation->set_rules('last_name', $this->lang->line('edit_user_validation_lname_label'), 'required');
+ $this->form_validation->set_rules('phone', $this->lang->line('edit_user_validation_phone_label'), 'required');
+
+ if (isset($_POST) && !empty($_POST))
+ {
+ // do we have a valid request?
+ /*if ($this->_valid_csrf_nonce() === FALSE || $id != $this->input->post('id'))
+ {
+ show_error($this->lang->line('error_csrf'));
+ }
+ */
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $this->form_validation->set_rules('password', $this->lang->line('edit_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('edit_user_validation_password_confirm_label'), 'required');
+ }
+
+ if ($this->form_validation->run() === TRUE)
+ {
+ $data = array(
+ 'first_name' => $this->input->post('first_name'),
+ 'last_name' => $this->input->post('last_name'),
+ 'phone' => $this->input->post('phone'),
+ );
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $data['password'] = $this->input->post('password');
+ }
+
+ // Only allow updating groups if user is admin
+ if ($this->ion_auth->is_admin())
+ {
+ //Update the groups user belongs to
+ $groupData = $this->input->post('groups');
+
+ if (isset($groupData) && !empty($groupData)) {
+
+ $this->ion_auth->remove_from_group('', $id);
+
+ foreach ($groupData as $grp) {
+ $this->ion_auth->add_to_group($grp, $id);
+ }
+
+ }
+ }
+
+ // check to see if we are updating the user
+ if($this->ion_auth->update($user->id, $data))
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->messages() );
+ $this->data['message']=$this->ion_auth->messages();
+ if ($this->ion_auth->is_admin())
+ {
+ if (!$this->ion_auth->logged_in())
+ {
+ // redirect them to the login page
+ redirect('auth_dst/login', 'refresh');
+ }
+ elseif (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
+ {
+ // redirect them to the home page because they must be an administrator to view this
+ return show_error('You must be an administrator to view this page.');
+ }
+ else
+ {
+ // set the flash data error message if there is one
+ //$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ //list the users
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ return;
+ }
+ }
+ else
+ {
+ //$this->_render_page('/', 'refresh');
+
+ }
+
+ }
+ else
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->errors() );
+ $this->data['message']=$this->ion_auth->errors();
+ if ($this->ion_auth->is_admin())
+ {
+ if (!$this->ion_auth->logged_in())
+ {
+ // redirect them to the login page
+ redirect('auth_dst/login', 'refresh');
+ }
+ elseif (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
+ {
+ // redirect them to the home page because they must be an administrator to view this
+ return show_error('You must be an administrator to view this page.');
+ }
+ else
+ {
+ // set the flash data error message if there is one
+ //$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ //list the users
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ return;
+ }
+ }
+ else
+ {
+ $this->_render_page('/', 'refresh');
+ }
+
+ }
+
+ }
+ }
+
+ // display the edit user form
+ $this->data['csrf'] = $this->_get_csrf_nonce();
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ // pass the user to the view
+ $this->data['user'] = $user;
+ $this->data['groups'] = $groups;
+ $this->data['currentGroups'] = $currentGroups;
+
+ $this->data['first_name'] = array(
+ 'name' => 'first_name',
+ 'id' => 'first_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('first_name', $user->first_name),
+ );
+ $this->data['last_name'] = array(
+ 'name' => 'last_name',
+ 'id' => 'last_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('last_name', $user->last_name),
+ );
+
+ $this->data['phone'] = array(
+ 'name' => 'phone',
+ 'id' => 'phone',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('phone', $user->phone),
+ );
+ $this->data['password'] = array(
+ 'name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ 'class' => 'form-control'
+ );
+
+ $this->data['password_confirm'] = array(
+ 'name' => 'password_confirm',
+ 'id' => 'password_confirm',
+ 'type' => 'password',
+ 'class' => 'form-control'
+ );
+
+ $this->data['identity'] = array(
+ 'name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'readonly' => 'true',
+ 'value' => $this->form_validation->set_value('identity',$user->username),
+ );
+
+ $this->_render_page('auth_dst/edit_user', $this->data);
+ }
+
+ public function edit_user_self($id)
+ {
+ $this->data['title'] = $this->lang->line('edit_user_heading');
+
+ if (!$this->ion_auth->logged_in() || !($this->ion_auth->user()->row()->id == $id))
+ {
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ $user = $this->ion_auth->user($id)->row();
+ $groups=$this->ion_auth->groups()->result_array();
+ $currentGroups = $this->ion_auth->get_users_groups($id)->result();
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+ if (isset($_POST) && !empty($_POST))
+ {
+ // do we have a valid request?
+ /*if ($this->_valid_csrf_nonce() === FALSE || $id != $this->input->post('id'))
+ {
+ show_error($this->lang->line('error_csrf'));
+ }
+ */
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $this->form_validation->set_rules('password', $this->lang->line('edit_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('edit_user_validation_password_confirm_label'), 'required');
+ }
+
+ if ($this->form_validation->run() === TRUE)
+ {
+ $data = array();
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $data['password'] = $this->input->post('password');
+ }
+
+ // Only allow updating groups if user is admin
+
+
+ // check to see if we are updating the user
+ if($this->ion_auth->update($user->id, $data))
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->messages() );
+ $this->data['message']=$this->ion_auth->messages();
+
+
+ }
+ else
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->errors() );
+ $this->data['message']=$this->ion_auth->errors();
+ $this->_render_page('/', 'refresh');
+
+ }
+
+ }
+ }
+
+ // display the edit user form
+ $this->data['csrf'] = $this->_get_csrf_nonce();
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ // pass the user to the view
+ $this->data['user'] = $user;
+ $this->data['groups'] = $groups;
+ $this->data['currentGroups'] = $currentGroups;
+
+ $this->data['password'] = array(
+ 'name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ 'class' => 'form-control'
+ );
+
+ $this->data['password_confirm'] = array(
+ 'name' => 'password_confirm',
+ 'id' => 'password_confirm',
+ 'type' => 'password',
+ 'class' => 'form-control'
+ );
+
+ $this->data['identity'] = array(
+ 'name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'readonly' => 'true',
+ 'value' => $this->form_validation->set_value('identity',$user->username),
+ );
+
+ $this->_render_page('auth_dst/profile_update', $this->data);
+ }
+
+
+ // redirect if needed, otherwise display the user list
+ public function search()
+ {
+
+ if (!$this->ion_auth->logged_in())
+ {
+ // redirect them to the login page
+ redirect('auth_dst/login', 'refresh');
+ }
+ elseif (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
+ {
+ // redirect them to the home page because they must be an administrator to view this
+ return show_error('You must be an administrator to view this page.');
+ }
+ else
+ {
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ //list the users
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ }
+ }
+
+ public function create_group()
+ {
+ $this->data['title'] = $this->lang->line('create_group_title');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ // validate form input
+ $this->form_validation->set_rules('group_name', $this->lang->line('create_group_validation_name_label'), 'required|alpha_dash');
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $new_group_id = $this->ion_auth->create_group($this->input->post('group_name'), $this->input->post('description'));
+ if($new_group_id)
+ {
+ // check to see if we are creating the group
+ // redirect them back to the admin page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ $this->data['message']=$this->ion_auth->messages();
+ //redirect("auth", 'refresh');
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ return;
+ }
+ }
+ else
+ {
+ // display the create group form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ $this->data['group_name'] = array(
+ 'name' => 'group_name',
+ 'id' => 'group_name',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_name'),
+ );
+ $this->data['description'] = array(
+ 'name' => 'description',
+ 'id' => 'description',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('description'),
+ );
+
+ $this->_render_page('auth_dst/create_group', $this->data);
+ }
+ }
+
+ // edit a group
+ public function edit_group($id)
+ {
+ // bail if no group id given
+ if(!$id || empty($id))
+ {
+ redirect('auth', 'refresh');
+ }
+
+ $this->data['title'] = $this->lang->line('edit_group_title');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth', 'refresh');
+ }
+
+ $group = $this->ion_auth->group($id)->row();
+
+ // validate form input
+ $this->form_validation->set_rules('group_name', $this->lang->line('edit_group_validation_name_label'), 'required|alpha_dash');
+
+ if (isset($_POST) && !empty($_POST))
+ {
+ if ($this->form_validation->run() === TRUE)
+ {
+ $group_update = $this->ion_auth->update_group($id, $_POST['group_name'], $_POST['group_description']);
+
+ if($group_update)
+ {
+ $this->session->set_flashdata('message', $this->lang->line('edit_group_saved'));
+ $this->data['message']=$this->lang->line('edit_group_saved');
+ }
+ else
+ {
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ $this->data['message']=$this->ion_auth->errors();
+ }
+
+ //redirect("auth", 'refresh');
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ return;
+ }
+ }
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ // pass the user to the view
+ $this->data['group'] = $group;
+
+ $readonly = $this->config->item('admin_group', 'ion_auth') === $group->name ? 'readonly' : '';
+
+ $this->data['group_name'] = array(
+ 'name' => 'group_name',
+ 'id' => 'group_name',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_name', $group->name),
+ $readonly => $readonly,
+ );
+ $this->data['group_description'] = array(
+ 'name' => 'group_description',
+ 'id' => 'group_description',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_description', $group->description),
+ );
+
+ $this->_render_page('auth_dst/edit_group', $this->data);
+ }
+
+
+ public function _get_csrf_nonce()
+ {
+ $this->load->helper('string');
+ $key = random_string('alnum', 8);
+ $value = random_string('alnum', 20);
+ $this->session->set_flashdata('csrfkey', $key);
+ $this->session->set_flashdata('csrfvalue', $value);
+
+ return array($key => $value);
+ }
+
+ public function _valid_csrf_nonce()
+ {
+ if ($this->input->post($this->session->flashdata('csrfkey')) !== FALSE &&
+ $this->input->post($this->session->flashdata('csrfkey')) == $this->session->flashdata('csrfvalue'))
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+
+ public function _render_page($view, $data=null, $returnhtml=false)//I think this makes more sense
+ {
+
+ $this->viewdata = (empty($data)) ? $this->data: $data;
+
+ $view_html = $this->load->view($view, $this->viewdata, $returnhtml);
+
+ if ($returnhtml) return $view_html;//This will return html on 3rd argument being true
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Auth_dst.php b/old_code_ci3/controllers/Auth_dst.php
new file mode 100644
index 0000000..89fdf72
--- /dev/null
+++ b/old_code_ci3/controllers/Auth_dst.php
@@ -0,0 +1,813 @@
+load->database();
+ $this->load->library(array('ion_auth','form_validation'));
+ $this->load->helper(array('url','language'));
+
+ $this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));
+
+ $this->lang->load('auth');
+ }
+
+ // log the user in
+ public function login()
+ {
+ $this->data['title'] = $this->lang->line('login_heading');
+
+ //validate form input
+ $this->form_validation->set_rules('identity', str_replace(':', '', $this->lang->line('login_identity_label')), 'required');
+ $this->form_validation->set_rules('password', str_replace(':', '', $this->lang->line('login_password_label')), 'required');
+
+ if ($this->form_validation->run() == true)
+ {
+ // check to see if the user is logging in
+ // check for "remember me"
+ $remember = (bool) $this->input->post('remember');
+
+ if ($this->ion_auth->login($this->input->post('identity'), $this->input->post('password'), $remember))
+ {
+ //if the login is successful
+ //redirect them back to the home page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ //redirect('/', 'refresh');
+
+ redirect('welcome');
+ }
+ else
+ {
+ // if the login was un-successful
+ // redirect them back to the login page
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ redirect('auth_dst/login', 'refresh'); // use redirects instead of loading views for compatibility with MY_Controller libraries
+ }
+ }
+ else
+ {
+ // the user is not logging in so display the login page
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ $this->data['identity'] = array('name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('identity'),
+ );
+ $this->data['password'] = array('name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ );
+
+ $this->_render_page('auth_dst/login', $this->data);
+ }
+ }
+
+ public function activate_status($user_id,$status)
+ {
+ $data = array(
+ 'active' => $status,
+ );
+
+ $this->ion_auth->update($user_id, $data);
+ redirect('Auth_dst/search');
+
+ }
+ // log the user out
+ public function logout()
+ {
+ $this->data['title'] = "Logout";
+
+ // log the user out
+ $logout = $this->ion_auth->logout();
+
+ // redirect them to the login page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ public function create_user_form()
+ {
+ $this->data['title'] = $this->lang->line('create_user_heading');
+
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth_dst', 'refresh');
+ }
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+ // validate form input
+ $this->form_validation->set_rules('first_name', $this->lang->line('create_user_validation_fname_label'), 'required');
+ $this->form_validation->set_rules('last_name', $this->lang->line('create_user_validation_lname_label'), 'required');
+ if($identity_column!=='email')
+ {
+ $this->form_validation->set_rules('identity',$this->lang->line('create_user_validation_identity_label'),'required|is_unique['.$tables['users'].'.'.$identity_column.']');
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email');
+ }
+ else
+ {
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email|is_unique[' . $tables['users'] . '.email]');
+ }
+ $this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'trim');
+ //$this->form_validation->set_rules('company', $this->lang->line('create_user_validation_company_label'), 'trim');
+ $this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('create_user_validation_password_confirm_label'), 'required');
+
+ if ($this->form_validation->run() == true)
+ {
+ $email = strtolower($this->input->post('email'));
+ $identity = ($identity_column==='email') ? $email : $this->input->post('identity');
+ $password = $this->input->post('password');
+
+ $additional_data = array(
+ 'first_name' => $this->input->post('first_name'),
+ 'last_name' => $this->input->post('last_name'),
+ 'company' => $this->input->post('company'),
+ 'phone' => $this->input->post('phone'),
+ );
+ }
+ if ($this->form_validation->run() == true && $this->ion_auth->register($identity, $password, $email, $additional_data))
+ {
+ // check to see if we are creating the user
+ // redirect them back to the admin page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ //redirect("auth_dst", 'refresh');
+
+ $rvar=array(
+ 'insertid' =>1
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else
+ {
+ // display the create user form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+ $error_text=$this->data['message'];
+
+ $this->data['first_name'] = array(
+ 'name' => 'first_name',
+ 'id' => 'first_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('first_name'),
+ );
+
+ $this->data['last_name'] = array(
+ 'name' => 'last_name',
+ 'id' => 'last_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('last_name'),
+ );
+ $this->data['identity'] = array(
+ 'name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('identity'),
+ );
+
+ $this->data['email'] = array(
+ 'name' => 'email',
+ 'id' => 'email',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('email'),
+ );
+
+ $this->data['phone'] = array(
+ 'name' => 'phone',
+ 'id' => 'phone',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('phone'),
+ );
+ $this->data['password'] = array(
+ 'name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('password'),
+ );
+ $this->data['password_confirm'] = array(
+ 'name' => 'password_confirm',
+ 'id' => 'password_confirm',
+ 'type' => 'password',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('password_confirm'),
+ );
+
+ $this->_render_page('auth_dst/create_user', $this->data);
+ }
+ }
+
+ public function save_new_user()
+ {
+ $this->data['title'] = $this->lang->line('create_user_heading');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth_dst', 'refresh');
+ }
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+ // validate form input
+ $this->form_validation->set_rules('first_name', $this->lang->line('create_user_validation_fname_label'), 'required');
+ $this->form_validation->set_rules('last_name', $this->lang->line('create_user_validation_lname_label'), 'required');
+ if($identity_column!=='email')
+ {
+ $this->form_validation->set_rules('identity',$this->lang->line('create_user_validation_identity_label'),'required|is_unique['.$tables['users'].'.'.$identity_column.']');
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email');
+ }
+ else
+ {
+ $this->form_validation->set_rules('email', $this->lang->line('create_user_validation_email_label'), 'required|valid_email|is_unique[' . $tables['users'] . '.email]');
+ }
+ $this->form_validation->set_rules('phone', $this->lang->line('create_user_validation_phone_label'), 'trim');
+ //$this->form_validation->set_rules('company', $this->lang->line('create_user_validation_company_label'), 'trim');
+ $this->form_validation->set_rules('password', $this->lang->line('create_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('create_user_validation_password_confirm_label'), 'required');
+
+ if ($this->form_validation->run() == true)
+ {
+ $email = strtolower($this->input->post('email'));
+ $identity = ($identity_column==='email') ? $email : $this->input->post('identity');
+ $password = $this->input->post('password');
+
+ $additional_data = array(
+ 'first_name' => $this->input->post('first_name'),
+ 'last_name' => $this->input->post('last_name'),
+ 'company' => $this->input->post('company'),
+ 'phone' => $this->input->post('phone'),
+ );
+ }
+ if ($this->form_validation->run() == true && $this->ion_auth->register($identity, $password, $email, $additional_data))
+ {
+ // check to see if we are creating the user
+ // redirect them back to the admin page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ //redirect("auth_dst", 'refresh');
+
+ $rvar=array(
+ 'insertid' =>1
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else
+ {
+ // display the create user form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+ $error_text=$this->data['message'];
+
+ $rvar=array(
+ 'insertid' =>0,
+ 'error_text'=>$error_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ }
+
+ // edit a user
+ public function edit_user($id)
+ {
+ $this->data['title'] = $this->lang->line('edit_user_heading');
+
+ if (!$this->ion_auth->logged_in() || (!$this->ion_auth->is_admin() && !($this->ion_auth->user()->row()->id == $id)))
+ {
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ $user = $this->ion_auth->user($id)->row();
+ $groups=$this->ion_auth->groups()->result_array();
+ $currentGroups = $this->ion_auth->get_users_groups($id)->result();
+
+ $sql = "SELECT g.*,m.module_name
+ FROM groups g JOIN module_master m ON g.head_group=m.id order by m.id";
+ $query = $this->db->query($sql);
+ $this->data['groups_data']= $query->result();
+
+
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+ // validate form input
+ $this->form_validation->set_rules('first_name', $this->lang->line('edit_user_validation_fname_label'), 'required');
+ $this->form_validation->set_rules('last_name', $this->lang->line('edit_user_validation_lname_label'), 'required');
+ $this->form_validation->set_rules('phone', $this->lang->line('edit_user_validation_phone_label'), 'required');
+
+ if (isset($_POST) && !empty($_POST))
+ {
+ // do we have a valid request?
+ /*if ($this->_valid_csrf_nonce() === FALSE || $id != $this->input->post('id'))
+ {
+ show_error($this->lang->line('error_csrf'));
+ }
+ */
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $this->form_validation->set_rules('password', $this->lang->line('edit_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('edit_user_validation_password_confirm_label'), 'required');
+ }
+
+ if ($this->form_validation->run() === TRUE)
+ {
+ $data = array(
+ 'first_name' => $this->input->post('first_name'),
+ 'last_name' => $this->input->post('last_name'),
+ 'phone' => $this->input->post('phone'),
+ );
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $data['password'] = $this->input->post('password');
+ }
+
+ // Only allow updating groups if user is admin
+ if ($this->ion_auth->is_admin())
+ {
+ //Update the groups user belongs to
+ $groupData = $this->input->post('groups');
+
+ if (isset($groupData) && !empty($groupData)) {
+
+ $this->ion_auth->remove_from_group('', $id);
+
+ foreach ($groupData as $grp) {
+ $this->ion_auth->add_to_group($grp, $id);
+ }
+
+ }
+ }
+
+ // check to see if we are updating the user
+ if($this->ion_auth->update($user->id, $data))
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->messages() );
+ $this->data['message']=$this->ion_auth->messages();
+ if ($this->ion_auth->is_admin())
+ {
+ if (!$this->ion_auth->logged_in())
+ {
+ // redirect them to the login page
+ redirect('auth_dst/login', 'refresh');
+ }
+ elseif (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
+ {
+ // redirect them to the home page because they must be an administrator to view this
+ return show_error('You must be an administrator to view this page.');
+ }
+ else
+ {
+ // set the flash data error message if there is one
+ //$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ //list the users
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ return;
+ }
+ }
+ else
+ {
+ //$this->_render_page('/', 'refresh');
+
+ }
+
+ }
+ else
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->errors() );
+ $this->data['message']=$this->ion_auth->errors();
+ if ($this->ion_auth->is_admin())
+ {
+ if (!$this->ion_auth->logged_in())
+ {
+ // redirect them to the login page
+ redirect('auth_dst/login', 'refresh');
+ }
+ elseif (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
+ {
+ // redirect them to the home page because they must be an administrator to view this
+ return show_error('You must be an administrator to view this page.');
+ }
+ else
+ {
+ // set the flash data error message if there is one
+ //$this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ //list the users
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ return;
+ }
+ }
+ else
+ {
+ $this->_render_page('/', 'refresh');
+ }
+
+ }
+
+ }
+ }
+
+ // display the edit user form
+ $this->data['csrf'] = $this->_get_csrf_nonce();
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ // pass the user to the view
+ $this->data['user'] = $user;
+ $this->data['groups'] = $groups;
+ $this->data['currentGroups'] = $currentGroups;
+
+ $this->data['first_name'] = array(
+ 'name' => 'first_name',
+ 'id' => 'first_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('first_name', $user->first_name),
+ );
+ $this->data['last_name'] = array(
+ 'name' => 'last_name',
+ 'id' => 'last_name',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('last_name', $user->last_name),
+ );
+
+ $this->data['phone'] = array(
+ 'name' => 'phone',
+ 'id' => 'phone',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'value' => $this->form_validation->set_value('phone', $user->phone),
+ );
+ $this->data['password'] = array(
+ 'name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ 'class' => 'form-control'
+ );
+
+ $this->data['password_confirm'] = array(
+ 'name' => 'password_confirm',
+ 'id' => 'password_confirm',
+ 'type' => 'password',
+ 'class' => 'form-control'
+ );
+
+ $this->data['identity'] = array(
+ 'name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'readonly' => 'true',
+ 'value' => $this->form_validation->set_value('identity',$user->username),
+ );
+
+ $this->_render_page('auth_dst/edit_user', $this->data);
+ }
+
+ public function edit_user_self($id)
+ {
+ $this->data['title'] = $this->lang->line('edit_user_heading');
+
+ if (!$this->ion_auth->logged_in() || !($this->ion_auth->user()->row()->id == $id))
+ {
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ $user = $this->ion_auth->user($id)->row();
+ $groups=$this->ion_auth->groups()->result_array();
+ $currentGroups = $this->ion_auth->get_users_groups($id)->result();
+
+ $tables = $this->config->item('tables','ion_auth');
+ $identity_column = $this->config->item('identity','ion_auth');
+ $this->data['identity_column'] = $identity_column;
+
+ if (isset($_POST) && !empty($_POST))
+ {
+ // do we have a valid request?
+ /*if ($this->_valid_csrf_nonce() === FALSE || $id != $this->input->post('id'))
+ {
+ show_error($this->lang->line('error_csrf'));
+ }
+ */
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $this->form_validation->set_rules('password', $this->lang->line('edit_user_validation_password_label'), 'required|min_length[' . $this->config->item('min_password_length', 'ion_auth') . ']|max_length[' . $this->config->item('max_password_length', 'ion_auth') . ']|matches[password_confirm]');
+ $this->form_validation->set_rules('password_confirm', $this->lang->line('edit_user_validation_password_confirm_label'), 'required');
+ }
+
+ if ($this->form_validation->run() === TRUE)
+ {
+ $data = array();
+
+ // update the password if it was posted
+ if ($this->input->post('password'))
+ {
+ $data['password'] = $this->input->post('password');
+ }
+
+ // Only allow updating groups if user is admin
+
+
+ // check to see if we are updating the user
+ if($this->ion_auth->update($user->id, $data))
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->messages() );
+ $this->data['message']=$this->ion_auth->messages();
+
+
+ }
+ else
+ {
+ // redirect them back to the admin page if admin, or to the base url if non admin
+ $this->session->set_flashdata('message', $this->ion_auth->errors() );
+ $this->data['message']=$this->ion_auth->errors();
+ $this->_render_page('/', 'refresh');
+
+ }
+
+ }
+ }
+
+ // display the edit user form
+ $this->data['csrf'] = $this->_get_csrf_nonce();
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ // pass the user to the view
+ $this->data['user'] = $user;
+ $this->data['groups'] = $groups;
+ $this->data['currentGroups'] = $currentGroups;
+
+ $this->data['password'] = array(
+ 'name' => 'password',
+ 'id' => 'password',
+ 'type' => 'password',
+ 'class' => 'form-control'
+ );
+
+ $this->data['password_confirm'] = array(
+ 'name' => 'password_confirm',
+ 'id' => 'password_confirm',
+ 'type' => 'password',
+ 'class' => 'form-control'
+ );
+
+ $this->data['identity'] = array(
+ 'name' => 'identity',
+ 'id' => 'identity',
+ 'type' => 'text',
+ 'class' => 'form-control',
+ 'readonly' => 'true',
+ 'value' => $this->form_validation->set_value('identity',$user->username),
+ );
+
+ $this->_render_page('auth_dst/profile_update', $this->data);
+ }
+
+
+ // redirect if needed, otherwise display the user list
+ public function search()
+ {
+
+ if (!$this->ion_auth->logged_in())
+ {
+ // redirect them to the login page
+ redirect('auth_dst/login', 'refresh');
+ }
+ elseif (!$this->ion_auth->is_admin()) // remove this elseif if you want to enable this for non-admins
+ {
+ // redirect them to the home page because they must be an administrator to view this
+ return show_error('You must be an administrator to view this page.');
+ }
+ else
+ {
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors()) ? validation_errors() : $this->session->flashdata('message');
+
+ //list the users
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ }
+ }
+
+ public function create_group()
+ {
+ $this->data['title'] = $this->lang->line('create_group_title');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ // validate form input
+ $this->form_validation->set_rules('group_name', $this->lang->line('create_group_validation_name_label'), 'required|alpha_dash');
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $new_group_id = $this->ion_auth->create_group($this->input->post('group_name'), $this->input->post('description'));
+ if($new_group_id)
+ {
+ // check to see if we are creating the group
+ // redirect them back to the admin page
+ $this->session->set_flashdata('message', $this->ion_auth->messages());
+ $this->data['message']=$this->ion_auth->messages();
+ //redirect("auth", 'refresh');
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ return;
+ }
+ }
+ else
+ {
+ // display the create group form
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ $this->data['group_name'] = array(
+ 'name' => 'group_name',
+ 'id' => 'group_name',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_name'),
+ );
+ $this->data['description'] = array(
+ 'name' => 'description',
+ 'id' => 'description',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('description'),
+ );
+
+ $this->_render_page('auth_dst/create_group', $this->data);
+ }
+ }
+
+ // edit a group
+ public function edit_group($id)
+ {
+ // bail if no group id given
+ if(!$id || empty($id))
+ {
+ redirect('auth', 'refresh');
+ }
+
+ $this->data['title'] = $this->lang->line('edit_group_title');
+
+ if (!$this->ion_auth->logged_in() || !$this->ion_auth->is_admin())
+ {
+ redirect('auth', 'refresh');
+ }
+
+ $group = $this->ion_auth->group($id)->row();
+
+ // validate form input
+ $this->form_validation->set_rules('group_name', $this->lang->line('edit_group_validation_name_label'), 'required|alpha_dash');
+
+ if (isset($_POST) && !empty($_POST))
+ {
+ if ($this->form_validation->run() === TRUE)
+ {
+ $group_update = $this->ion_auth->update_group($id, $_POST['group_name'], $_POST['group_description']);
+
+ if($group_update)
+ {
+ $this->session->set_flashdata('message', $this->lang->line('edit_group_saved'));
+ $this->data['message']=$this->lang->line('edit_group_saved');
+ }
+ else
+ {
+ $this->session->set_flashdata('message', $this->ion_auth->errors());
+ $this->data['message']=$this->ion_auth->errors();
+ }
+
+ //redirect("auth", 'refresh');
+ $this->data['users'] = $this->ion_auth->users()->result();
+ foreach ($this->data['users'] as $k => $user)
+ {
+ $this->data['users'][$k]->groups = $this->ion_auth->get_users_groups($user->id)->result();
+ }
+
+ $this->_render_page('auth_dst/index', $this->data);
+ return;
+ }
+ }
+
+ // set the flash data error message if there is one
+ $this->data['message'] = (validation_errors() ? validation_errors() : ($this->ion_auth->errors() ? $this->ion_auth->errors() : $this->session->flashdata('message')));
+
+ // pass the user to the view
+ $this->data['group'] = $group;
+
+ $readonly = $this->config->item('admin_group', 'ion_auth') === $group->name ? 'readonly' : '';
+
+ $this->data['group_name'] = array(
+ 'name' => 'group_name',
+ 'id' => 'group_name',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_name', $group->name),
+ $readonly => $readonly,
+ );
+ $this->data['group_description'] = array(
+ 'name' => 'group_description',
+ 'id' => 'group_description',
+ 'type' => 'text',
+ 'value' => $this->form_validation->set_value('group_description', $group->description),
+ );
+
+ $this->_render_page('auth_dst/edit_group', $this->data);
+ }
+
+
+ public function _get_csrf_nonce()
+ {
+ $this->load->helper('string');
+ $key = random_string('alnum', 8);
+ $value = random_string('alnum', 20);
+ $this->session->set_flashdata('csrfkey', $key);
+ $this->session->set_flashdata('csrfvalue', $value);
+
+ return array($key => $value);
+ }
+
+ public function _valid_csrf_nonce()
+ {
+ if ($this->input->post($this->session->flashdata('csrfkey')) !== FALSE &&
+ $this->input->post($this->session->flashdata('csrfkey')) == $this->session->flashdata('csrfvalue'))
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+
+ public function _render_page($view, $data=null, $returnhtml=false)//I think this makes more sense
+ {
+
+ $this->viewdata = (empty($data)) ? $this->data: $data;
+
+ $view_html = $this->load->view($view, $this->viewdata, $returnhtml);
+
+ if ($returnhtml) return $view_html;//This will return html on 3rd argument being true
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/C_test.php b/old_code_ci3/controllers/C_test.php
new file mode 100644
index 0000000..6277aa1
--- /dev/null
+++ b/old_code_ci3/controllers/C_test.php
@@ -0,0 +1,95 @@
+load->library("Pdf");
+ }
+
+ public function create_pdf() {
+
+
+ // create new PDF document
+ $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+
+ // set document information
+ $pdf->SetCreator(PDF_CREATOR);
+ $pdf->SetAuthor('IHC:D.S.Bisht');
+ $pdf->SetTitle('TCPDF Example 001');
+ $pdf->SetSubject('TCPDF Tutorial');
+ $pdf->SetKeywords('TCPDF, PDF, example, test, guide');
+
+ // set default header data
+ $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
+ $pdf->setFooterData(array(0,64,0), array(0,64,128));
+
+ // set header and footer fonts
+ $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+ $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+ // set default monospaced font
+ $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+ // set auto page breaks
+ $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+ // set image scale factor
+ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // set some language-dependent strings (optional)
+ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
+ require_once(dirname(__FILE__).'/lang/eng.php');
+ $pdf->setLanguageArray($l);
+ }
+
+ // ---------------------------------------------------------
+
+ // set default font subsetting mode
+ $pdf->setFontSubsetting(true);
+
+ // Set font
+ // dejavusans is a UTF-8 Unicode font, if you only need to
+ // print standard ASCII chars, you can use core fonts like
+ // helvetica or times to reduce file size.
+ $pdf->SetFont('dejavusans', '', 14, '', true);
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ // set text shadow effect
+ $pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
+
+ $test= 'Report Sample Page TEsted ';
+ // Set some content to print
+ $html = <<
+ This is the first example of Report.
+
+ Please check the source code documentation and other examples for further information.
+
+EOD;
+
+ // Print text using writeHTMLCell()
+ $pdf->writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+ // ---------------------------------------------------------
+
+ // Close and output PDF document
+ // This method has several options, check the source code documentation for more information.
+ $pdf->Output('example_002.pdf', 'I');
+
+ //============================================================+
+ // END OF FILE
+ //============================================================+
+ }
+}
+
+/* End of file c_test.php */
+/* Location: ./application/controllers/c_test.php */
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Dashboard.php b/old_code_ci3/controllers/Dashboard.php
new file mode 100644
index 0000000..8e94a84
--- /dev/null
+++ b/old_code_ci3/controllers/Dashboard.php
@@ -0,0 +1,133 @@
+1,i.ins_company_name,\'Direct\') as Ins_name,
+ if(o.insurance_id>1,i.short_name,\'Direct\') as Ins_short_name,
+ count(o.opd_id) as No_OPD
+ from opd_master o left join hc_insurance i on o.insurance_id=i.id
+ where date(o.apointment_date) =curdate() and (payment_mode>0 or running_opd=1)
+ group by o.insurance_id';
+
+ $query = $this->db->query($sql);
+ $data['opd_count']= $query->result();
+
+ $sql='select count(*) as T_opd
+ from opd_master o left join hc_insurance i on o.insurance_id=i.id
+ where date(o.apointment_date) =curdate() and (payment_mode>0 or running_opd=1) ';
+
+ $query = $this->db->query($sql);
+ $data['opd_count_total']= $query->result();
+
+ $sql="select v.doc_name,v.doc_list,count(v.id) as No_patient,
+ sum(if(v.ipd_status=0,1,0)) as Admit_Current,
+ sum(if(v.discharge_date=curdate(),1,0)) as Discharge_Day,
+ sum(if(v.register_date=curdate(),1,0)) as Admit_Day
+ from v_ipd_list v
+ where curdate() between v.register_date and if(v.discharge_date is null,sysdate(),v.discharge_date)
+ group by v.doc_list
+ order by v.doc_name";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_total']= $query->result();
+
+
+ $sql="select d.id as doc_id, d.p_fname,count(DISTINCT o.opd_id) as No_opd,
+ sum(if(o.payment_mode=4,1,0)) as Org_OPD,
+ sum(if(o.payment_mode IN (1,2),1,0)) as Direct_OPD,
+ MOD(d.id,5) as color_code
+ from (doctor_master d
+ join opd_master o on d.id=o.doc_id and o.apointment_date =CURDATE())
+ group by d.id
+ having count(DISTINCT o.opd_id)>0
+ order by d.p_fname";
+ $query = $this->db->query($sql);
+ $data['opd_doc_wise']= $query->result();
+
+ if (stristr(PHP_OS, 'win')) {
+ $load = "3";
+ $memory_usage="4";
+ $disksize="";
+ $disksizetotal="";
+ $bytesPer="";
+ } else {
+ //Disk Size Status
+ $bytes = disk_free_space(".");
+ $bytestotal=disk_total_space(".");
+
+ $si_prefix = array( 'B', 'KB', 'MB', 'GB', 'TB', 'EB', 'ZB', 'YB' );
+ $base = 1024;
+ $class = min((int)log($bytes , $base) , count($si_prefix) - 1);
+
+ $bytesPer=round($bytes*100/$bytestotal,2);
+
+ $disksize= sprintf('%1.2f' , $bytes / pow($base,$class)) . ' ' . $si_prefix[$class] . ' ';
+ $disksizetotal= sprintf('%1.2f' , $bytestotal / pow($base,$class)) . ' ' . $si_prefix[$class] . ' ';
+
+
+ $free = shell_exec('free');
+ $free = (string)trim($free);
+ $free_arr = explode("\n", $free);
+ $mem = explode(" ", $free_arr[1]);
+ $mem = array_filter($mem);
+ $mem = array_merge($mem);
+ $memory_usage = round($mem[2]/$mem[1]*100,2);
+
+ $sys_load = sys_getloadavg();
+ $load = $sys_load[0];
+
+ }
+
+ $data['load'] = $load;
+ $data['mem'] = $memory_usage ;
+ $data['dsize'] = $disksize ;
+ $data['dsizetot'] = $disksizetotal ;
+ $data['bytesPer'] = $bytesPer ;
+
+ $sql="select count(*) as no_rec from ipd_master where ipd_status=0";
+ $query = $this->db->query($sql);
+ $data['ipd_count']= $query->result();
+
+ $data['no_admit_ipd']=$data['ipd_count'][0]->no_rec;
+
+ $sql="select count(*) as no_rec from ipd_master where ipd_status=1 and discharge_date=Date(sysdate())";
+ $query = $this->db->query($sql);
+ $data['ipd_count']= $query->result();
+
+ $data['no_admit_ipd_discharge']=$data['ipd_count'][0]->no_rec;
+
+ $sql="select count(*) as no_rec from ipd_master where register_date=Date(sysdate())";
+ $query = $this->db->query($sql);
+ $data['ipd_count']= $query->result();
+
+ $data['no_admit_ipd_admit']=$data['ipd_count'][0]->no_rec;
+
+ $sql="select count(*) as no_rec from ipd_master where ipd_status=0 and case_id>0";
+ $query = $this->db->query($sql);
+ $data['ipd_count']= $query->result();
+
+ $data['no_admit_ipd_org']=$data['ipd_count'][0]->no_rec;
+
+ $sql="select o.insurance_id,
+ i.ins_company_name ,
+ i.short_name,
+ count(o.id) as No_IPD
+ from (organization_case_master o join hc_insurance i on o.insurance_id=i.id)
+ join ipd_master m on o.id=m.case_id
+ where ipd_status=0 and m.case_id>0 and o.insurance_id>0
+ group by o.insurance_id";
+ $query = $this->db->query($sql);
+ $data['ipd_org_list']= $query->result();
+
+ $this->load->view('dashboard/dash1',$data);
+ }
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Data.php b/old_code_ci3/controllers/Data.php
new file mode 100644
index 0000000..e6abe35
--- /dev/null
+++ b/old_code_ci3/controllers/Data.php
@@ -0,0 +1,156 @@
+load->database();
+ }
+
+ public function index()
+ {
+ $sql="select * from payment_mode";
+ $query = $this->db->query($sql);
+ $data['pay_mode']= $query->result();
+
+ $this->load->view('Report/opd_report_v',$data);
+ }
+
+ public function getTable()
+ {
+
+ $requestData= $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 =>'opd_code',
+ 1 => 'P_name',
+ 2 => 'p_code',
+ 3=> 'App_Date',
+ 4=> 'doc_name',
+ 5=> 'Inv_Type',
+ 6=> 'PaymentMode',
+ 7=> 'opd_fee_amount'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select o.opd_code,o.P_name,o.p_id,Date_Format(o.apointment_date,'%d-%m-%Y') as App_Date,
+ o.doc_name,if(o.insurance_id>1,'Org.','Direct') as Inv_Type,p_code,
+ o.insurance_id,o.insurance_credit,
+ m.mode_desc as PaymentMode,o.payment_mode,
+ o.opd_fee_gross_amount,o.opd_discount,o.opd_fee_amount,o.apointment_date,o.payment_mode";
+
+ $sql_count="Select count(*) as no_rec,sum(o.opd_fee_amount) as t_opd_fee_amount ";
+
+ $sql_from=" from opd_master o join payment_mode m join patient_master p on o.payment_mode=m.id and p.id=o.p_id";
+
+ $total_sql=$sql_count.$sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec']= $query->result();
+ $totalData=$data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where=" WHERE 1 = 1";
+
+ $sql_where_flag=0;
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][0]['search']['value']) ){ //name
+ $sql_where.=" AND o.opd_code LIKE '%".$requestData['columns'][0]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][1]['search']['value']) ){ //salary
+ $sql_where.=" AND o.P_name LIKE '%".$requestData['columns'][1]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][3]['search']['value']) ){ //salary
+ $sql_where.=" AND o.doc_name LIKE '%".$requestData['columns'][3]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][2]['search']['value']) ){ //salary
+ $sql_where.=" AND p_code LIKE '%".$requestData['columns'][2]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][4]['search']['value']) ){ //age
+
+ if($requestData['columns'][4]['search']['value']=='1')
+ {
+ $sql_where.=" AND o.insurance_id<=1 ";
+ }else
+ {
+ $sql_where.=" AND o.insurance_id>1 ";
+ }
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][5]['search']['value'])){ //age
+ $sql_where.=" AND o.payment_mode=".$requestData['columns'][5]['search']['value'];
+ $sql_where_flag=1;
+ }elseif($requestData['columns'][5]['search']['value']=='0')
+ {
+ $sql_where.=" AND o.payment_mode=".$requestData['columns'][5]['search']['value'];
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][6]['search']['value']) )
+ { //OPD Date Range
+ $rangeArray = explode("/",$requestData['columns'][6]['search']['value']);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+ $sql_where.=" AND ( Date(o.apointment_date) between '".$minRange."' AND '".$maxRange."' ) ";
+ $sql_where_flag=1;
+ }
+
+ if($sql_where_flag==0)
+ {
+ $sql_where.=" AND Date(o.apointment_date) = curdate() ";
+ }
+
+ $total_filer_sql=$sql_count.$sql_from.$sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered=$data['total_rec_filter'][0]->no_rec;
+ $foot_t_sum=$data['total_rec_filter'][0]->t_opd_fee_amount;
+
+ $sql_order=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+ $Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata= $query->result_array();
+
+ $output = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "foot_t_sum" => $foot_t_sum,
+ "sql" => $Result_sql
+ );
+
+ foreach($rdata as $aRow)
+ {
+ $row = array();
+
+ foreach($columns as $col)
+ {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Doc_Admin.php b/old_code_ci3/controllers/Doc_Admin.php
new file mode 100644
index 0000000..39eb8d1
--- /dev/null
+++ b/old_code_ci3/controllers/Doc_Admin.php
@@ -0,0 +1,348 @@
+db->query($sql);
+ $data['doc_master']= $query->result();
+
+ $this->load->view('DocAdmin/doc_list',$data);
+ }
+
+ public function docedit_load($doc_id=0)
+ {
+ $sql="select * from doc_format_master where df_id=".$doc_id;
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+
+ $sql="select m.df_id,m.doc_name,s.input_name,s.input_code,s.short_order,s.id as item_id
+ from (doc_format_master m join doc_format_sub s on m.df_id=s.doc_format_id)
+ where m.df_id=".$doc_id. " order by s.short_order" ;
+ $query = $this->db->query($sql);
+ $data['doc_Item_List']= $query->result();
+
+ $sql="select * from doc_pre_input";
+ $query = $this->db->query($sql);
+ $data['doc_pre_input']= $query->result();
+
+
+ $sql="select * from color ";
+ $query = $this->db->query($sql);
+ $data['color_name']= $query->result();
+
+ $this->load->view('DocAdmin/doc_master_edit',$data);
+ }
+
+ public function report_insert()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('DocFormat_M');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_docname',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[1]|max_length[100]|is_unique[lab_repo.Title]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ $insertid=0;
+ $showcontent="";
+ if ($this->form_validation->run() == TRUE)
+ {
+ $id_key=$this->input->post('df_id');
+ $data = array(
+ 'doc_name'=> $this->input->post('input_docname'),
+ 'doc_desc'=> $this->input->post('input_doc_desc'),
+ 'doc_raw_format'=> $this->input->post('HTMLData')
+ );
+ $insertid=$this->DocFormat_M->insert_master($data);
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+
+
+ }else{
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+ $rvar=array(
+ 'insertid' => $insertid,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function report_update()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('DocFormat_M');
+
+ $id_key=$this->input->post('df_id');
+
+ $update_record=0;
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_docname',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[1]|max_length[100]|is_unique[lab_repo.Title]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $data = array(
+ 'doc_name'=> $this->input->post('input_docname'),
+ 'doc_desc'=> $this->input->post('input_doc_desc'),
+ 'doc_raw_format'=> $this->input->post('HTMLData')
+ );
+
+ $this->DocFormat_M->update_master($data,$id_key);
+
+ $update_record=1;
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+ }else{
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+
+ $rvar=array(
+ 'update_record' => $update_record,
+ 'showcontent' => $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function doc_input_list($doc_id)
+ {
+ $sql="select m.df_id,s.id,m.doc_name,s.input_name,s.input_code,s.short_order,s.id as item_id
+ from (doc_format_master m join doc_format_sub s on m.df_id=s.doc_format_id)
+ where m.df_id=".$doc_id. " order by s.short_order" ;
+ $query = $this->db->query($sql);
+ $data['doc_Item_List']= $query->result();
+
+ $data['doc_id']=$doc_id;
+
+ $this->load->view('DocAdmin/doc_input_list',$data);
+ }
+
+ public function input_parameter_load($item_id,$doc_id)
+ {
+ $sql="select m.df_id,s.id,m.doc_name,s.input_name,s.input_code,s.short_order,s.id as item_id,s.input_type,s.input_default_value
+ from (doc_format_master m join doc_format_sub s on m.df_id=s.doc_format_id)
+ where m.df_id=".$doc_id. " and s.id=".$item_id." order by s.short_order" ;
+ $query = $this->db->query($sql);
+ $data['input_parameter']= $query->result();
+
+ $data['doc_id']=$doc_id;
+
+ $this->load->view('DocAdmin/doc_item_edit',$data);
+ }
+
+ public function input_parameter_edit()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('DocFormat_M');
+
+ $doc_id=$this->input->post('doc_id');
+ $doc_sub_id=$this->input->post('doc_sub_id');
+ $input_input_code=$this->input->post('input_input_code');
+
+ $sql="select * from doc_format_sub where id=".$doc_sub_id." and input_code='".$input_input_code."' and doc_format_id=".$doc_id;
+ $query = $this->db->query($sql);
+ $doc_input_list= $query->result();
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_input_name',
+ 'label' => 'Input Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_input_code',
+ 'label' => 'Input Code',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ $update_value=1;
+ $showcontent="";
+ if ($this->form_validation->run() == TRUE)
+ {
+ $udata = array(
+ 'doc_format_id'=> $this->input->post('doc_id'),
+ 'input_name'=> $this->input->post('input_input_name'),
+ 'input_code'=> $this->input->post('input_input_code'),
+ 'input_type'=> $this->input->post('input_type'),
+ 'input_default_value'=> $this->input->post('input_default_value')
+ );
+
+ $this->DocFormat_M->update_sub($udata,$doc_sub_id);
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+ }else{
+ $update_value=0;
+
+ if(count($doc_input_list)>0)
+ {
+ $showcontent =Show_Alert('danger','Error','Already Exist');
+ }else{
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+ }
+
+ $rvar=array(
+ 'update_value' => $update_value,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function input_parameter_add()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('DocFormat_M');
+
+ $doc_id=$this->input->post('doc_id');
+ $input_input_code=$this->input->post('input_input_code');
+
+ $sql="select * from doc_format_sub where input_code='".$input_input_code."' and doc_format_id=".$doc_id;
+ $query = $this->db->query($sql);
+ $doc_input_list= $query->result();
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_input_name',
+ 'label' => 'Input Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_input_code',
+ 'label' => 'Input Code',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ $insert_id=0;
+ $showcontent="";
+ if ($this->form_validation->run() == TRUE && count($doc_input_list)==0 )
+ {
+ $sql="select max(short_order) as max_short_order from doc_format_sub where doc_format_id=".$doc_id;
+ $query = $this->db->query($sql);
+ $doc_short_order= $query->result();
+
+ $MEOrder=0;
+ if(count($doc_short_order)>0)
+ {
+ $MEOrder=$doc_short_order[0]->max_short_order;
+ }
+
+ if($MEOrder === NULL)
+ {
+ $MEOrder=1;
+ }else{
+ $MEOrder=$MEOrder+1;
+ }
+
+ $udata = array(
+ 'doc_format_id'=> $this->input->post('doc_id'),
+ 'input_name'=> $this->input->post('input_input_name'),
+ 'input_code'=> $this->input->post('input_input_code'),
+ 'input_type'=> $this->input->post('input_type'),
+ 'input_default_value'=> $this->input->post('input_default_value') ,
+ 'short_order'=> $MEOrder
+ );
+
+ $insert_id=$this->DocFormat_M->insert_sub($udata);
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+ }else{
+ $insert_id=0;
+ if(count($doc_input_list)>0)
+ {
+ $showcontent =Show_Alert('danger','Error','Already Exist');
+ }else{
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+ }
+
+
+ $rvar=array(
+ 'insert_id' => $insert_id,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function change_sort_item($doc_id,$option_id,$current,$change_option_id,$change)
+ {
+ $this->load->model('DocFormat_M');
+
+ $udata = array(
+ 'short_order'=> 0
+ );
+ $this->DocFormat_M->update_sub($udata,$option_id);
+
+ $udata = array(
+ 'short_order'=> $current
+ );
+ $this->DocFormat_M->update_sub($udata,$change_option_id);
+
+ $udata = array(
+ 'short_order'=> $change
+ );
+ $this->DocFormat_M->update_sub($udata,$option_id);
+
+ $sql="select m.df_id,m.doc_name,s.input_name,s.input_code,s.short_order,s.id as item_id
+ from (doc_format_master m join doc_format_sub s on m.df_id=s.doc_format_id)
+ where m.df_id=".$doc_id. " order by s.short_order" ;
+ $query = $this->db->query($sql);
+ $data['doc_Item_List']= $query->result();
+
+ $data['doc_id']=$doc_id;
+
+ $this->load->view('DocAdmin/doc_input_list',$data);
+
+ }
+
+ public function remove_input_item($doc_id,$doc_sub_id)
+ {
+ $this->db->delete("doc_format_sub", "doc_format_id=".$doc_id." and id=".$doc_sub_id);
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Doctor.php b/old_code_ci3/controllers/Doctor.php
new file mode 100644
index 0000000..daac2e7
--- /dev/null
+++ b/old_code_ci3/controllers/Doctor.php
@@ -0,0 +1,303 @@
+load->view('Doctor_Profile/Doctor_V');
+ }
+
+ public function search()
+ {
+
+ $sql = "SELECT * FROM doctor_master ";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('Doctor_Profile/Doctor_Search_V',$data);
+
+ }
+
+ function doctor_record($pno)
+ {
+
+ $sql="select * from doctor_master where id=$pno";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select m.SpecName,m.id,d.doc_id,d.med_spec_id,d.id as doc_spec_id
+ from med_spec m join doc_spec d on m.id =d.med_spec_id where d.doc_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['doc_spec_a']= $query->result();
+
+ $sql="select * from med_spec order by SpecName";
+ $query = $this->db->query($sql);
+ $data['doc_spec_l']= $query->result();
+
+ $sql="select * from doc_fee_type order by fee_type";
+ $query = $this->db->query($sql);
+ $data['doc_fee_type']= $query->result();
+
+ $sql="select d.id ,f.fee_type ,d.doc_fee_desc,d.amount
+ from doc_opd_fee d right join doc_fee_type f on d.doc_fee_type=f.id and d.doc_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['doc_fee_list']= $query->result();
+
+
+ $this->load->view('Doctor_Profile/Doctor_profile_V',$data);
+ }
+
+ function doctor_record_spec()
+ {
+
+ $this->load->model('Doctor_M');
+
+ if($this->input->post('isadd')==1)
+ {
+ $sql="select * from doc_spec where doc_id='".$this->input->post('doc_id')."' and med_spec_id='".$this->input->post('doc_spec')."'";
+ $query = $this->db->query($sql);
+ $no_rec= $query->num_rows();
+ if($no_rec==0)
+ {
+ $data = array(
+ 'doc_id' => $this->input->post('doc_id'),
+ 'med_spec_id' => $this->input->post('doc_spec')
+ );
+ $inser_id=$this->Doctor_M->insert_spec($data);
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ }
+
+ }else{
+
+ $this->db->delete("doc_spec", "id=".$this->input->post('doc_spec_id'));
+ }
+
+
+ $sql="select m.SpecName,m.id,d.doc_id,d.med_spec_id,d.id as doc_spec_id from med_spec m join doc_spec d on m.id =d.med_spec_id where d.doc_id=".$this->input->post('doc_id');
+ $query = $this->db->query($sql);
+ $data['doc_spec_a']= $query->result();
+
+ $show_Specility_list="";
+
+ foreach($data['doc_spec_a'] as $row)
+ {
+
+ $show_Specility_list.= '';
+ $show_Specility_list.= ' ';
+ $show_Specility_list.= ' ';
+ $show_Specility_list.= ' Remove - ';
+ $show_Specility_list.= '
';
+ }
+
+ $rvar=array(
+ 'update' =>1,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ 'show_Specility_list' => $show_Specility_list
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+
+ }
+
+ public function UpdateRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Doctor_M');
+ $data = array(
+ 'p_title' => $this->input->post('select_title'),
+ 'mphone1' => $this->input->post('input_mphone1'),
+ 'p_fname' => $this->input->post('input_name'),
+ 'gender' => $this->input->post('optionsRadios_gender'),
+ 'dob' => str_to_MysqlDate($this->input->post('datepicker_dob')),
+ 'zip' => $this->input->post('input_zip'),
+ 'doc_sign' => $this->input->post('txt_doc_sign'),
+ 'email1' => $this->input->post('input_email')
+ );
+ $old_id=$this->input->post('doc_id');
+ $update=$this->Doctor_M->update($data,$old_id);
+
+ if($update>0)
+ {
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=> Show_Alert('success','Saved','Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function AddNew()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->library('form_validation');
+
+ $this->form_validation->set_rules('p_fname','Dr. Name','alpha_numeric_spaces|');
+ $this->form_validation->set_rules('email1','Email','valid_email');
+ $this->form_validation->set_rules('mphone1','MPhone','numeric');
+
+ $this->load->model('Doctor_M');
+
+ if($this->form_validation->run())
+ {
+ $data = array(
+ 'p_title' => $this->input->post('select_title'),
+ 'mphone1' => $this->input->post('input_mphone1'),
+ 'p_fname' => $this->input->post('input_name'),
+ 'gender' => $this->input->post('optionsRadios_gender'),
+ 'dob' => str_to_MysqlDate($this->input->post('datepicker_dob')),
+ 'zip' => $this->input->post('input_zip'),
+ 'email1' => $this->input->post('input_email')
+ );
+
+ $inser_id=$this->Doctor_M->insert($data);
+
+ redirect('Doctor/doctor_record/'.$inser_id);
+
+ }else{
+ $this->load->view('Doctor_Profile/Doctor_V');
+ }
+ }
+
+ public function remove_fee()
+ {
+ $this->load->model('Doctor_M');
+
+ $old_id=$this->input->post('rid');
+ $update=$this->Doctor_M->delete_fee($old_id);
+
+ $sql="select d.id ,f.fee_type ,d.doc_fee_desc,d.amount
+ from doc_opd_fee d join doc_fee_type f on d.doc_fee_type=f.id and d.doc_id=".$this->input->post('doc_id');;
+ $query = $this->db->query($sql);
+ $data['doc_fee_list']= $query->result();
+
+ $table_property = array('table_open' => '');
+ $this->table->set_template($table_property);
+ $this->table->set_heading('Fee Type', 'description', 'Amount');
+ foreach($data['doc_fee_list'] as $row)
+ {
+ if($row->id=='')
+ {
+ $button_code=' Not Define';
+ }else{
+ $button_code='Remove ';
+ }
+
+ $this->table->add_row($row->fee_type, $row->doc_fee_desc, $row->amount,$button_code);
+ }
+ $show_fee_list= $this->table->generate();
+
+ if($update>0)
+ {
+ $rvar=array(
+ 'update' =>1,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ 'showcontent'=> Show_Alert('success','Remove','Fee Removed successfully'),
+ 'show_fee_list' => $show_fee_list
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }else{
+ $rvar=array(
+ 'update' =>0,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ 'showcontent'=> Show_Alert('danger','Error','Please Check')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function AddNew_fee()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+ $this->load->model('Doctor_M');
+ $data = array(
+ 'doc_id' => $this->input->post('doc_id'),
+ 'doc_fee_desc' => $this->input->post('input_fee_desc'),
+ 'doc_fee_type' => $this->input->post('fee_type'),
+ 'amount' => $this->input->post('input_fee_amount')
+ );
+
+
+ $sql="select * from doc_opd_fee where
+ doc_id=".$this->input->post('doc_id'). " and doc_fee_type = ".$this->input->post('fee_type');
+ $query = $this->db->query($sql);
+ $doc_fee_update= $query->result();
+
+ if(count($doc_fee_update)>0)
+ {
+ $old_id=$doc_fee_update[0]->id;
+ $update=$this->Doctor_M->delete_fee($old_id);
+ }
+
+ $inser_id=$this->Doctor_M->insert_fee($data);
+
+ $sql="select d.id ,f.fee_type ,d.doc_fee_desc,d.amount
+ from doc_opd_fee d join doc_fee_type f on d.doc_fee_type=f.id
+ and d.doc_id=".$this->input->post('doc_id')." order by f.id";
+ $query = $this->db->query($sql);
+ $data['doc_fee_list']= $query->result();
+
+ $table_property = array('table_open' => '');
+ $this->table->set_template($table_property);
+ $this->table->set_heading('Fee Type', 'description', 'Amount');
+ foreach($data['doc_fee_list'] as $row)
+ {
+ if($row->id=='')
+ {
+ $button_code=' Not Define';
+ }else{
+ $button_code='Remove ';
+ }
+
+ $this->table->add_row($row->fee_type, $row->doc_fee_desc, $row->amount,$button_code);
+
+ }
+
+ $show_fee_list= $this->table->generate();
+
+ if($inser_id>0)
+ {
+ $rvar=array(
+ 'inser_id' =>1,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ 'showcontent'=> Show_Alert('success','Added','Fee added successfully'),
+ 'show_fee_list' => $show_fee_list
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }else{
+ $rvar=array(
+ 'inser_id' =>0,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ 'showcontent'=> Show_Alert('danger','Error','Please Check')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+
+
+}
+
diff --git a/old_code_ci3/controllers/Document_Patient.php b/old_code_ci3/controllers/Document_Patient.php
new file mode 100644
index 0000000..5bd89b6
--- /dev/null
+++ b/old_code_ci3/controllers/Document_Patient.php
@@ -0,0 +1,418 @@
+load->model('DocFormat_M');
+ }
+
+ function p_doc_record($pno)
+ {
+ $sql = "select *,IFNULL(GET_AGE_BY_DOB(dob),age) as str_age,Date_Format(insert_date,'%Y-%m-%d') as str_regdate,if(gender=1,'Male','Female') as xgender from patient_master where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $sql = "select * from doc_format_master where active=1 ";
+ $query = $this->db->query($sql);
+ $data['doc_format'] = $query->result();
+
+ $sql = "select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist'] = $query->result();
+
+ $sql = "select patient_doc.*,date_format(patient_doc.date_issue,'%d-%m-%Y') as str_date_issue,doc_format_master.doc_name
+ from patient_doc join doc_format_master
+ on patient_doc.doc_format_id = doc_format_master.df_id
+ where p_id=" . $pno . " order by date_issue desc";
+ $query = $this->db->query($sql);
+ $data['patient_doc'] = $query->result();
+
+ $data['pno'] = $pno;
+
+
+ $this->load->view('DocumentPatient/Patient_Doc_master', $data);
+ }
+
+ function create_doc()
+ {
+
+ $pno = $this->input->post('patient_id');
+ $document_format_id = $this->input->post('document_format_id');
+ $dr_id = $this->input->post('doc_id');
+ $doc_issue_date = $this->input->post('doc_issue_date');
+
+ $sql = "Select * from doc_format_master where df_id=" . $document_format_id;
+ $query = $this->db->query($sql);
+ $data_report_format = $query->result();
+
+ if (count($data_report_format) > 0) {
+ $Report_string = $data_report_format[0]->doc_raw_format;
+ } else {
+ $Report_string = "";
+ }
+
+ $sql = "Select * from doc_pre_input where table_name='patient_master_exten'";
+ $query = $this->db->query($sql);
+ $data_pre_input = $query->result();
+
+ $sql = "Select * from doctor_master where id='" . $dr_id . "'";
+ $query = $this->db->query($sql);
+ $data_doctor_master = $query->result();
+
+ $sql = "Select * from patient_master_exten where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data_patient_master = $query->result_array();;
+
+ if (count($data_doctor_master) > 0) {
+ $Report_string = str_replace('{dr_name}', '' . $data_doctor_master[0]->p_fname, $Report_string);
+ $Report_string = str_replace('{dr_sign}', '' . $data_doctor_master[0]->doc_sign, $Report_string);
+ }
+
+ $Report_string = str_replace('{current_date}', date('d-m-Y'), $Report_string);
+ $Report_string = str_replace('{issue_date}', $doc_issue_date, $Report_string);
+
+ for ($i = 0; $i < count($data_pre_input); ++$i) {
+ if (isset($data_patient_master[0][$data_pre_input[$i]->field_name])) {
+ $Change_Value = $data_patient_master[0][$data_pre_input[$i]->field_name];
+ $Report_string = str_replace('{' . $data_pre_input[$i]->input_code . '}', $Change_Value, $Report_string);
+ }
+ }
+
+ $udata = array(
+ 'raw_data' => $Report_string,
+ 'doc_format_id' => $document_format_id,
+ 'p_id' => $pno,
+ 'dr_id' => $dr_id,
+ 'date_issue' => str_to_MysqlDate($doc_issue_date)
+ );
+
+ $insert_id = $this->DocFormat_M->insert_patient_doc($udata);
+
+ $sql = "select * from doc_format_sub s where doc_format_id=" . $document_format_id;
+ $query = $this->db->query($sql);
+ $doc_format_sub = $query->result_array();;
+
+ foreach ($doc_format_sub as $row) {
+ $sql = "select * from patient_doc_raw
+ where p_id=" . $pno . " and p_doc_id=" . $insert_id . " and p_doc_sub_id='" . $row['id'] . "' ";
+ $query = $this->db->query($sql);
+ $chktestlist = $query->result();
+
+ if (count($chktestlist) < 1) {
+ $udata = array(
+ 'p_id' => $pno,
+ 'p_doc_id' => $insert_id,
+ 'p_doc_sub_id' => $row['id'],
+ 'p_doc_raw_value' => $row['input_default_value'],
+ );
+
+ $insert_sub_id = $this->DocFormat_M->insert_patient_doc_raw($udata);
+ }
+ }
+
+ echo $insert_id;
+ }
+
+ function re_create_doc($doc_id)
+ {
+ $sql = "Select *,date_format(date_issue,'%d-%m-%Y') as str_date_issue from patient_doc where id=" . $doc_id;
+ $query = $this->db->query($sql);
+ $patient_doc = $query->result();
+
+ $pno = $patient_doc[0]->p_id;
+ $document_format_id = $patient_doc[0]->doc_format_id;
+ $dr_id = $patient_doc[0]->dr_id;
+ $doc_issue_date = $patient_doc[0]->str_date_issue;
+
+ $sql = "Select * from doc_format_master where df_id=" . $document_format_id;
+ $query = $this->db->query($sql);
+ $data_report_format = $query->result();
+
+ if (count($data_report_format) > 0) {
+ $Report_string = $data_report_format[0]->doc_raw_format;
+ } else {
+ $Report_string = "";
+ }
+
+ $sql = "Select * from doc_pre_input where table_name='patient_master_exten'";
+ $query = $this->db->query($sql);
+ $data_pre_input = $query->result();
+
+ $sql = "Select * from doctor_master where id='" . $dr_id . "'";
+ $query = $this->db->query($sql);
+ $data_doctor_master = $query->result();
+
+ $sql = "Select * from patient_master_exten where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data_patient_master = $query->result_array();;
+
+ if (count($data_doctor_master) > 0) {
+ $Report_string = str_replace('{dr_name}', '' . $data_doctor_master[0]->p_fname, $Report_string);
+ $Report_string = str_replace('{dr_sign}', '' . nl2br($data_doctor_master[0]->doc_sign), $Report_string);
+ }
+
+ $Report_string = str_replace('{current_date}', date('d-m-Y'), $Report_string);
+ $Report_string = str_replace('{issue_date}', $doc_issue_date, $Report_string);
+
+ for ($i = 0; $i < count($data_pre_input); ++$i) {
+ if (isset($data_patient_master[0][$data_pre_input[$i]->field_name])) {
+ $Change_Value = $data_patient_master[0][$data_pre_input[$i]->field_name];
+ $Report_string = str_replace('{' . $data_pre_input[$i]->input_code . '}', $Change_Value, $Report_string);
+ }
+ }
+
+ $udata = array(
+ 'raw_data' => $Report_string,
+ 'doc_format_id' => $document_format_id,
+ 'p_id' => $pno,
+ );
+
+ $update_id = $this->DocFormat_M->update_patient_doc($udata, $doc_id);
+
+ redirect('/Document_Patient/Pre_Data/' . $doc_id);
+ }
+
+ function Pre_Data($patient_doc_id)
+ {
+ $sql = "Select * from patient_doc where id=" . $patient_doc_id;
+ $query = $this->db->query($sql);
+ $data['patient_doc'] = $query->result();
+
+ $doc_format_id = $data['patient_doc'][0]->doc_format_id;
+ $pno = $data['patient_doc'][0]->p_id;
+
+ $sql = "select p.*,s.input_name,s.input_type
+ from (patient_doc_raw p join patient_doc m on m.id=p.p_doc_id)
+ join doc_format_sub s on s.doc_format_id=m.doc_format_id and p.p_doc_sub_id=s.id
+ where p.p_doc_id=" . $patient_doc_id;
+ $query = $this->db->query($sql);
+ $data['doc_format_sub'] = $query->result();
+
+ $sql = "select *,IFNULL(GET_AGE_BY_DOB(dob),age) as str_age,
+ Date_Format(insert_date,'%Y-%m-%d') as str_regdate,if(gender=1,'Male','Female') as xgender
+ from patient_master where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $data['patient_doc_id'] = $patient_doc_id;
+
+ $this->load->view('DocumentPatient/Doc_update_pre_value', $data);
+ }
+
+ public function Entry_Update()
+ {
+ $test_id = $this->input->post('test_id');
+ $test_value = $this->input->post('test_value');
+
+ $udata = array(
+ 'p_doc_raw_value' => $test_value,
+ 'update_data' => '1',
+ );
+
+ $this->DocFormat_M->update_patient_doc_raw($udata, $test_id);
+
+ $sql = "select p_doc_raw_value from patient_doc_raw where id=" . $test_id;
+ $query = $this->db->query($sql);
+ $data_value = $query->result();
+
+ echo $data_value[0]->p_doc_raw_value;
+ }
+
+ public function update_doc_field($p_doc_id)
+ {
+ $sql = "SELECT * from patient_doc_raw where update_data=0 and p_doc_id=" . $p_doc_id;
+ $query = $this->db->query($sql);
+ $data_value_pending = $query->result();
+
+ if (count($data_value_pending) > 0) {
+ $rvar = array(
+ 'update' => 0,
+ 'error_text' => 'Some Field Pending',
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $sql = "Select * from patient_doc where id=" . $p_doc_id;
+ $query = $this->db->query($sql);
+ $data_report_format = $query->result();
+
+ if (count($data_report_format) > 0) {
+ $Report_string = $data_report_format[0]->raw_data;
+ } else {
+ $Report_string = "";
+ }
+
+ $sql = "SELECT p.*,s.input_name,s.input_code from patient_doc_raw p join doc_format_sub s ON p.p_doc_sub_id=s.id
+ where p_doc_id=" . $p_doc_id;
+ $query = $this->db->query($sql);
+ $data_value = $query->result();
+
+ for ($i = 0; $i < count($data_value); ++$i) {
+ if (isset($data_value[$i]->p_doc_raw_value)) {
+ $Change_Value = nl2br($data_value[$i]->p_doc_raw_value);
+ $Report_string = str_replace('{' . $data_value[$i]->input_code . '}', $Change_Value, $Report_string);
+ }
+ }
+
+ $udata = array(
+ 'raw_data' => $Report_string,
+ 'update_pre_value' => 1,
+ );
+
+ $this->DocFormat_M->update_patient_doc($udata, $p_doc_id);
+
+ $rvar = array(
+ 'update' => 1,
+ 'error_text' => 'Complie Done',
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+
+ function load_doc($patient_doc_id)
+ {
+ $sql = "Select * from patient_doc where id=" . $patient_doc_id;
+ $query = $this->db->query($sql);
+ $data['patient_doc'] = $query->result();
+
+ $pno = 0;
+
+ if (count($data['patient_doc']) > 0) {
+ $pno = $data['patient_doc'][0]->p_id;
+ }
+
+ $sql = "Select * from patient_master_exten where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $this->load->view('DocumentPatient/Patient_Doc_Edit', $data);
+ }
+
+ function create_final($patient_doc_id, $print_on_type = 0)
+ {
+ $sql = "Select *,date_format(date_issue,'%d-%m-%Y') as str_date_issue from patient_doc where id=" . $patient_doc_id;
+ $query = $this->db->query($sql);
+ $patient_doc = $query->result();
+
+ $sql = "Select count(*) as No_Rec from file_upload_data where doc_id=" . $patient_doc_id;
+ $query = $this->db->query($sql);
+ $print_doc = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $print_no_rec = $print_doc[0]->No_Rec + 1;
+ $doc_issue_date = $patient_doc[0]->str_date_issue;
+
+ $content = '';
+ if (count($patient_doc) > 0) {
+ $content = '
+
+
+ Document Ref. No.' . date('Y') . '/' . $print_no_rec . '/' . $patient_doc_id . '
+ Date : ' . $doc_issue_date . '
+
+
+
';
+
+ $content .= $patient_doc[0]->raw_data;
+ $data['bar_content'] = 'Document Ref. No.' . date('Y') . '/' . $print_no_rec . '/' . $patient_doc_id . '/' . $doc_issue_date;
+ }
+
+ $data['content'] = $content;
+ $data['print_on_type'] = $print_on_type;
+
+ $folder_name = 'uploads/' . date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $report_head = 'Patient Document';
+
+ $file_name = 'Document-' . $patient_doc_id . "-" . $print_no_rec . "-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $folder_name . '/' . $file_name;
+
+ $udata = array(
+ 'file_name' => $file_name,
+ 'file_type' => 'pdf',
+ 'file_path' => $folder_name,
+ 'full_path' => $filepath,
+ 'orig_name' => $file_name,
+ 'client_name' => 'system_genrate',
+ 'file_ext' => '.pdf',
+ 'upload_by' => $user_name,
+ 'pid' => $patient_doc[0]->p_id,
+ 'doc_id' => $patient_doc_id,
+ 'case_id' => 0,
+ 'file_desc' => $report_head,
+ 'charge_id' => 0
+ );
+
+ $this->load->model('File_M');
+
+ $this->File_M->insert($udata);
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ if ($print_on_type == 1) {
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = true;
+ }
+
+ $doc_content = $this->load->view('DocAdmin/doc_letterhead_print', $data, TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($doc_content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ }
+
+ function update_doc()
+ {
+ $document_id = $this->input->post('document_id');
+ $HTMLData = $this->input->post('HTMLData');
+
+ $udata = array(
+ 'raw_data' => $HTMLData
+ );
+
+ $update_value = 1;
+ $showcontent = "";
+
+ $update_value = $this->DocFormat_M->update_patient_doc($udata, $document_id);
+
+ if ($update_value > 0) {
+ $showcontent = Show_Alert('success', 'Saved', 'Data Saved successfully');
+ } else {
+ $showcontent = Show_Alert('danger', 'Error', validation_errors());
+ }
+
+ $rvar = array(
+ 'update_value' => $update_value,
+ 'showcontent' => $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+}
diff --git a/old_code_ci3/controllers/DotPrint.php b/old_code_ci3/controllers/DotPrint.php
new file mode 100644
index 0000000..64f6f2a
--- /dev/null
+++ b/old_code_ci3/controllers/DotPrint.php
@@ -0,0 +1,165 @@
+db->query($sql);
+ $invoiceDetails= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $invoiceGtotal= $query->result();
+
+ $sql="select *,(case payment_mode when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'IPD Credit' when 4 then 'Org. Credit' else 'Pending' end) as Payment_type_str from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,if(age is null,Get_Age(dob),Concat(age,' ',age_in)) AS age from patient_master where id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $patient_master= $query->result();
+
+ $sql="select *,(case payment_mode when 1 then 'Cash' when 2 then 'Bank Card' when 3 then 'Return Cash ' when 4 then 'Bank Return' else 'Other' end) as Payment_type_str from payment_history where payof_type=2 and payof_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $PrintData=' SOBAN SINGH JEEN BASE HOSPITAL , HALDWANI'.PHP_EOL;
+ $PrintData.='------------------------------------------------------------------------------'.PHP_EOL;
+
+ $PatientID= 'Patient ID : '.$patient_master[0]->p_code;
+ $PatientName='Patient Name : '.$patient_master[0]->p_fname;
+ $PatientGA='Gender / Age : '.$patient_master[0]->xgender.'/'.$patient_master[0]->age;
+ $InoviceID= 'Invoice ID : '.$invoice_master[0]->invoice_code;
+
+
+ $PrintData.=str_pad($PatientID,35,' ',STR_PAD_RIGHT);
+ $PrintData.=str_pad($PatientName,35,' ',STR_PAD_RIGHT).PHP_EOL;
+
+ $PrintData.=str_pad($InoviceID,35,' ',STR_PAD_RIGHT);
+ $PrintData.=str_pad($PatientGA,35,' ',STR_PAD_RIGHT).PHP_EOL;
+
+ $PrintData.='------------------------------------------------------------------------------'.PHP_EOL;
+ $PrintData.=' '.PHP_EOL;
+ $PrintData.='# LAB Charge Name Rate Qty Amount '.PHP_EOL;
+ $PrintData.='------------------------------------------------------------------------------'.PHP_EOL;
+
+ $srno=1;
+ foreach($invoiceDetails as $row)
+ {
+ $line='';
+ $line.=str_pad($srno,3,' ',STR_PAD_RIGHT);
+ $line.=str_pad($row->group_desc,12,' ',STR_PAD_RIGHT);
+ $line.=str_pad($row->item_name,35,' ',STR_PAD_RIGHT);
+ $line.=str_pad($row->item_rate,10,' ',STR_PAD_LEFT);
+ $line.=str_pad($row->item_qty,7,' ',STR_PAD_LEFT);
+ $line.=str_pad($row->item_amount,10,' ',STR_PAD_LEFT);
+
+ $srno=$srno+1;
+ $PrintData.=$line.PHP_EOL;
+ }
+
+ $PrintData.='------------------------------------------------------------------------------'.PHP_EOL;
+
+ $PrintData.=str_pad('Gross Total : '.$invoiceGtotal[0]->Gtotal,77,' ',STR_PAD_LEFT).PHP_EOL;
+
+ if($invoice_master[0]->discount_amount>0)
+ {
+ $PrintData.=PHP_EOL;
+ $PrintData.=str_pad('Gross Total : '.$invoice_master[0]->discount_amount,77,' ',STR_PAD_LEFT).PHP_EOL ;
+ }
+
+ if($invoice_master[0]->ipd_id<1) {
+
+ $PrintData.=str_pad('Received Amt.:'.$invoice_master[0]->payment_part_received,26,' ',STR_PAD_RIGHT);
+ $PrintData.=str_pad('Balance Amt : '.$invoice_master[0]->payment_part_balance,26,' ',STR_PAD_RIGHT);
+ $PrintData.=str_pad('Net Amt : '.$invoice_master[0]->net_amount,26,' ',STR_PAD_LEFT).PHP_EOL;
+ }
+
+ if($invoice_master[0]->correction_amount>0)
+ {
+ $PrintData.=str_pad('Correction : '.$invoice_master[0]->correction_remark,44,' ',STR_PAD_RIGHT);
+ $PrintData.=str_pad('Correction Amt : '.$invoice_master[0]->correction_amount,22,' ',STR_PAD_Left);
+
+ $PrintData.=str_pad('Final Amount : '.$invoice_master[0]->correction_net_amount,77,' ',STR_PAD_LEFT).PHP_EOL;
+ }
+
+
+ $folder_name='uploads/printtemp';
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $output_dir = $folder_name;
+ $filename=date('Ymdhis').$invoice_master[0]->invoice_code.'.TXT';
+ $PrintData.=PHP_EOL;
+ if($invoice_master[0]->payment_mode>2) {
+ $PrintData.='Payment Details : '.$invoice_master[0]->Payment_type_str.' '.PHP_EOL;
+ }else{
+ $PrintData.='Payment Details :';
+
+ foreach($payment_history as $row)
+ {
+ $PrintData.='['.$row->id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ $PrintData.=' '.PHP_EOL .PHP_EOL .PHP_EOL ;
+ }
+
+ $PrintData.=str_pad('Prepared By : '.$invoice_master[0]->prepared_by,40,' ',STR_PAD_RIGHT).' ';
+ $PrintData.=str_pad(' Signature ',35,' ',STR_PAD_LEFT).' '.PHP_EOL;
+
+ $myfile = fopen($output_dir.'/'.$filename, "w") or die("Unable to open file!");
+ fwrite($myfile, $PrintData);
+ fclose($myfile);
+
+ $this->load->model('DotPrint_M');
+
+ $insertdata = array(
+ 'created_by'=> $user_id,
+ 'file_type'=> 'TEXT',
+ 'file_name'=> $filename,
+ 'file_location'=>$folder_name
+ );
+
+ $inser_id=$this->DotPrint_M->insert( $insertdata);
+
+ echo 'File Send To DotMatrix Printer / File ID : '.$inser_id;
+ }
+
+ function read_dot_date($userid)
+ {
+ $user_id=str_replace('S',',',$userid);
+
+ $sql="select id,file_type,file_name,file_location from dot_printer where print_status=0 and created_by in (".$user_id.")";
+ $query = $this->db->query($sql);
+ $file_list= $query->result();
+
+ header('Content-type: application/json');
+ echo json_encode($file_list);
+ }
+
+ function printdone_dot($fileid,$print_by)
+ {
+ $this->load->model('DotPrint_M');
+
+ $updatedata = array(
+ 'print_status'=> '1',
+ 'print_by'=> $print_by
+ );
+
+ $updatestatus=$this->DotPrint_M->update( $updatedata,$fileid);
+ echo $updatestatus;
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/IPD_Nursing.php b/old_code_ci3/controllers/IPD_Nursing.php
new file mode 100644
index 0000000..97352d0
--- /dev/null
+++ b/old_code_ci3/controllers/IPD_Nursing.php
@@ -0,0 +1,139 @@
+db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('IPD_Nursing/IPDList_V',$data);
+ }
+
+ public function ipd_panel($ipdcode,$stype=0)
+ {
+
+ if($stype > 0)
+ {
+ $sql="select id from ipd_master where ipd_code='".$ipdcode."' ";
+ $query = $this->db->query($sql);
+ $get_ipd_no= $query->result();
+
+ $ipdno=$get_ipd_no[0]->id;
+ }else{
+ $ipdno=$ipdcode;
+ }
+
+ //calculate_IPD
+
+ $this->load->model('Ipd_M');
+ $this->Ipd_M->calculate_IPD($ipdno);
+
+ $sql="select * from v_ipd_list where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $p_id=$data['ipd_info'][0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age
+ from patient_master where id='".$p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *
+ from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id
+ where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select *
+ from organization_case_master
+ where status=0 and case_type=1 and ipd_id=$ipdno and p_id=".$p_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $data['ipd_master']=$ipd_master;
+
+ $sql="select *,Date_Format(payment_date,'%d-%M-%Y') as pay_date_str,
+ Concat(if(payment_mode=1,'Cash','BANK'),if(credit_debit=0,'','-Return')) as pay_mode
+ from payment_history
+ where payof_type=4 and payof_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment_history']= $query->result();
+
+ $this->load->view('IPD_Nursing/IPD_Panel',$data);
+ }
+
+ public function ipd_main_panel($ipdno)
+ {
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select * from v_ipd_list where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_list']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *,concat_ws(' ','Dr.',p_fname,p_mname,p_lname) as doc_name from doctor_master where id='".$data['ipd_info'][0]->r_doc_id."' ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select i.id,d.p_fname,d.id as doc_id from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select * from organization_case_master
+ where id=".$data['ipd_info'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from organization_case_master
+ where status=0 and case_type=1 and ipd_id=0 and p_id=".$data['ipd_info'][0]->p_id;
+ $query = $this->db->query($sql);
+ $data['case_master_open']= $query->result();
+
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from org_approved_status ";
+ $query = $this->db->query($sql);
+ $data['org_approved_status']= $query->result();
+
+ $sql="select * from refer_master ";
+ $query = $this->db->query($sql);
+ $data['refer_master']= $query->result();
+
+
+
+ $this->load->view('IPD_Nursing/ipd_main_panel',$data);
+ }
+
+ function ipd_treatment($ipd_id)
+ {
+ $sql="select * from ipd_treatment_chart where ipd_id=$ipd_id order by t_datetime";
+ $query = $this->db->query($sql);
+ $data['ipd_treatment_chart']= $query->result();
+
+
+ $this->load->view('IPD_Nursing/ipd_treatment',$data);
+ }
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Insurance.php b/old_code_ci3/controllers/Insurance.php
new file mode 100644
index 0000000..1e53d71
--- /dev/null
+++ b/old_code_ci3/controllers/Insurance.php
@@ -0,0 +1,98 @@
+1 ";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+ $this->load->view('insurance/insurance_search_v',$data);
+ }
+
+ function insurance_record($id)
+ {
+
+ $sql="select * from hc_insurance where id=".$id;
+ $query = $this->db->query($sql);
+ $data['data_insurance']= $query->result();
+
+ $this->load->view('insurance/insurance_profile_V',$data);
+ }
+
+ public function UpdateRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('insurance_M');
+ $data = array(
+ 'ins_company_name' => $this->input->post('input_comp_name'),
+ 'short_name' => $this->input->post('input_short_name'),
+ 'ins_contact_number' => $this->input->post('input_mphone1'),
+ 'ins_contact_person_name' => $this->input->post('input_cname'),
+ 'ins_email' => $this->input->post('input_email'),
+ 'active' => $this->input->post('chk_active'),
+ 'opd_allowed' => $this->input->post('chk_opd_allowed'),
+ 'opd_fee' => $this->input->post('input_opd_fee'),
+ 'opd_rate_direct' => $this->input->post('optionsRadios_opd_rate_direct'),
+ 'opd_desc' => $this->input->post('input_opd_fee_desc'),
+ 'opd_master_rate_discount' => $this->input->post('input_opd_master_rate_discount'),
+ 'opd_credit' => $this->input->post('chk_opd_credit'),
+ 'opd_cash' => $this->input->post('chk_opd_cash'),
+ 'charge_credit' => $this->input->post('chk_charge_credit'),
+ 'charge_rate_direct' => $this->input->post('optionsRadios_charge_rate_direct'),
+ 'charge_rate_dicount' => $this->input->post('input_charge_rate_dicount'),
+ 'med_credit' => $this->input->post('chk_med_credit'),
+
+ );
+ $old_id=$this->input->post('p_id');
+ $update=$this->insurance_M->update($data,$old_id);
+
+ if($update>0)
+ {
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=> Show_Alert('success','Saved','Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function AddRecord()
+ {
+ $this->load->view('insurance/insurance_create_V');
+ }
+
+ public function CreateRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('insurance_M');
+ $data = array(
+ 'ins_company_name' => $this->input->post('input_comp_name'),
+ 'ins_contact_number' => $this->input->post('input_mphone1'),
+ 'ins_contact_person_name' => $this->input->post('input_cname'),
+ 'ins_email' => $this->input->post('input_email')
+ );
+
+ $inser_id=$this->insurance_M->insert($data);
+
+ if($inser_id>0)
+ {
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Invoice.php b/old_code_ci3/controllers/Invoice.php
new file mode 100644
index 0000000..f387cca
--- /dev/null
+++ b/old_code_ci3/controllers/Invoice.php
@@ -0,0 +1,879 @@
+load->view('Invoice/Invoice_opd');
+ }
+
+ public function chargeslist()
+ {
+ $this->load->view('Invoice/Invoice_charges');
+ }
+
+ public function search_opd()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ $sql = "select o.opd_id, o.doc_name,o.opd_code,o.P_name,o.p_id,Date_Format(o.apointment_date,'%d-%m-%Y') as App_Date,
+ p.p_code,p.mphone1,p.email1 ,if(o.insurance_id>1,'Org.','Direct') as Inv_Type,
+ if(o.payment_status=1,m.mode_desc,'Pending') as PaymentMode,o.payment_mode
+ from (opd_master o join patient_master p on o.p_id=p.id ) join payment_mode m on o.payment_mode=m.id
+ WHERE opd_code like '%".$sdata."' or p_code like '%".$sdata."' or P_name like '%".$sdata."%' or
+ mphone1 = '".$sdata."' or email1 = '".$sdata."' order by o.opd_id desc limit 100";
+
+ $query = $this->db->query($sql);
+ $data['opd_list']= $query->result();
+
+ $this->load->view('Invoice/Invoice_opd_list',$data);
+ }
+
+ public function search_charges()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_\-]/', '', $sdata);
+
+ $sql = "select i.id as inv_id, i.refer_by_other,i.invoice_code,p.p_fname,i.attach_id,
+ Date_Format(i.inv_date,'%d-%m-%Y') as Inv_Date,p.p_code,p.mphone1,p.email1,
+ if(i.insurance_id>1,'Org.','Direct') as Inv_Type,i.invoice_status,
+ m.mode_desc as PaymentMode,i.payment_mode,i.payment_part_balance,i.net_amount
+ from invoice_master i join patient_master p join payment_mode m
+ on i.attach_id=p.id and i.attach_type=0 and i.payment_mode=m.id
+ WHERE invoice_code like '%".$sdata."' or p_code like '%".$sdata."' or p_fname like '%".$sdata."%' or
+ mphone1 = '".$sdata."' or email1 = '".$sdata."' order by i.id desc limit 100";
+
+ $query = $this->db->query($sql);
+ $data['charges_list']= $query->result();
+
+ $this->load->view('Invoice/Invoice_charges_list',$data);
+ }
+
+ public function opdinvoice($opdid)
+ {
+ $sql="select *,(case payment_status when 1 Then 'cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$data['opd_master'][0]->p_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where status=0 and p_id=".$data['patient_master'][0]->id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$data['opd_master'][0]->insurance_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+
+ $this->load->view('Invoice/Invoice_opd_correction',$data);
+ }
+
+
+ public function showinvoice($invoice_id)
+ {
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $ins_comp_id=$data['invoice_master'][0]->insurance_id;
+ $ins_id=$data['invoice_master'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=2 and payof_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $this->load->view('Invoice/Invoice_Charges_correction',$data);
+ }
+
+
+ public function update_correction()
+ {
+ $oid=$this->input->post('oid');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $opd_correction=$this->input->post('input_corr_amt');
+
+ $sql="select * from opd_master where opd_id=".$oid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $flag=true;
+
+ if($this->input->post('optionsRadios_crdr')==1)
+ {
+ if($opd_correction>0 && $data['opd_master'][0]->opd_fee_gross_amount>=$opd_correction)
+ {
+ $opd_fee_amount=$data['opd_master'][0]->opd_fee_gross_amount-$opd_correction;
+ $opd_fee_amount=$opd_fee_amount-$data['opd_master'][0]->opd_discount;
+ }else{
+ $flag=false;
+ }
+ }else{
+ $opd_fee_amount=$data['opd_master'][0]->opd_fee_gross_amount+$opd_correction;
+ $opd_fee_amount=$opd_fee_amount-$data['opd_master'][0]->opd_discount;
+ }
+
+ if($flag)
+ {
+ $dataupdate = array(
+ 'opd_correction_amount' => $this->input->post('input_corr_amt'),
+ 'opd_correction_remark' => $this->input->post('input_corr_desc'),
+ 'opd_correction_user' => $user_name,
+ 'opd_correction_crdr' => $this->input->post('optionsRadios_crdr'),
+ 'opd_correction_datetime' => date('Y-m-d H:i:s'),
+ 'opd_fee_amount' => $opd_fee_amount
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$oid);
+
+ $this->load->model('Payment_M');
+
+ if($this->input->post('optionsRadios_crdr')==1)
+ {
+ $credit_debit=1;
+ }
+ else{
+ $credit_debit=0;
+ }
+
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'1',
+ 'payof_id'=>$oid,
+ 'payof_code'=>$data['opd_master'][0]->opd_code,
+ 'credit_debit'=>$credit_debit,
+ 'amount'=>$this->input->post('input_corr_amt'),
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$this->input->post('input_corr_desc'),
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+ }else{
+
+ }
+ }
+
+
+ public function update_correction_charges()
+ {
+ $invoice_id=$this->input->post('invoice_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $correction=$this->input->post('input_corr_amt');
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $flag=true;
+
+ if($correction>0 && $data['invoice_master'][0]->net_amount>=$correction)
+ {
+ $net_amount=$data['invoice_master'][0]->net_amount-$correction;
+ }else{
+ $flag=false;
+ }
+
+ if($flag)
+ {
+ $dataupdate = array(
+ 'correction_amount' => $this->input->post('input_corr_amt'),
+ 'correction_remark' => $this->input->post('input_corr_desc'),
+ 'correction_user' => $user_name,
+ 'correction_crdr' => $this->input->post('optionsRadios_crdr'),
+ 'correction_datetime' => date('Y-m-d H:i:s'),
+ 'correction_net_amount' => $fee_amount,
+ 'invoice_status' => '3'
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+
+ $this->load->model('Payment_M');
+
+ $paydata = array(
+ 'payment_mode'=> '3',
+ 'payof_type'=>'2',
+ 'payof_id'=>$invoice_id,
+ 'payof_code'=>$data['invoice_master'][0]->invoice_code,
+ 'credit_debit'=>1,
+ 'amount'=>$this->input->post('input_corr_amt'),
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$this->input->post('input_corr_desc'),
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+ $insert_id=$this->Payment_M->insert($paydata);
+ }
+
+ }
+
+
+
+ public function list_refund()
+ {
+ $this->load->view('Invoice/refund_invoice');
+ }
+
+
+
+ public function getRequestTable()
+ {
+
+ $requestData= $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 =>'id',
+ 1 => 'org_code',
+ 2 => 'patient_name',
+ 3 => 'org_date_str',
+ 4=> 'payment_amount',
+ 5=> 'payment_process_str'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select *,
+ date_format(payment_request_datetime,'%d-%m-%Y %h:%i:%s') as org_date_str,
+ if(payment_process=0,'Pending','Complete') as payment_process_str " ;
+
+ $sql_count="Select count(*) as no_rec ";
+
+ $sql_from=" from org_payment_request ";
+
+ $total_sql=$sql_count.$sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec']= $query->result();
+ $totalData=$data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where=" WHERE 1 = 1";
+
+ $sql_where_flag=0;
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][0]['search']['value']) ){ //CaseCode-InsuranceCard-ClaimNo
+ $sql_where.=" AND id = '".$requestData['columns'][0]['search']['value']."' ";
+ $sql_where_flag=1;
+ }
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][1]['search']['value']) ){ //CaseCode-InsuranceCard-ClaimNo
+ $sql_where.=" AND org_code LIKE '%".$requestData['columns'][1]['search']['value']."' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][2]['search']['value']) ){ //p_code-P-Name
+ $sql_where.=" AND ( patient_name LIKE '".$requestData['columns'][2]['search']['value']."%') ";
+
+ $sql_where_flag=1;
+ }
+
+ $total_filer_sql=$sql_count.$sql_from.$sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered=$data['total_rec_filter'][0]->no_rec;
+
+ $sql_order=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+ $Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata= $query->result_array();
+
+ $output = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach($rdata as $aRow)
+ {
+ $row = array();
+
+ foreach($columns as $col)
+ {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function getRefundTable()
+ {
+
+ $requestData= $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 =>'id',
+ 1 => 'refund_type_code',
+ 2 => 'refund_type_str',
+ 3 => 'patient_name',
+ 4=> 'approved_datetime',
+ 5=> 'refund_amount',
+ 6=> 'refund_process_str'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select *,
+ (case refund_type when 1 then 'OPD' when 2 then 'Charge' when 3 then 'Org.Inv.' else 'Other' end ) as refund_type_str ,
+ if(refund_process<1,'Pending','Complete') as refund_process_str";
+
+ $sql_count="Select count(*) as no_rec ";
+
+ $sql_from=" from refund_order ";
+
+ $total_sql=$sql_count.$sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec']= $query->result();
+ $totalData=$data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where=" WHERE 1 = 1";
+
+ $sql_where_flag=0;
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][0]['search']['value']) ){ //CaseCode-InsuranceCard-ClaimNo
+ $sql_where.=" AND refund_type_code LIKE '%".$requestData['columns'][0]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][1]['search']['value']) ){ //p_code-P-Name
+ $sql_where.=" AND ( patient_name LIKE '%".$requestData['columns'][1]['search']['value']."%') ";
+
+ $sql_where_flag=1;
+ }
+
+ $total_filer_sql=$sql_count.$sql_from.$sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered=$data['total_rec_filter'][0]->no_rec;
+
+ $sql_order=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+ $Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata= $query->result_array();
+
+ $output = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach($rdata as $aRow)
+ {
+ $row = array();
+
+ foreach($columns as $col)
+ {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function refund_form($rid)
+ {
+ $sql="select * from refund_order where id=".$rid;
+ $query = $this->db->query($sql);
+ $data['refund_order']= $query->result();
+
+ $this->load->view('Invoice/refund_amount_panel',$data);
+ }
+
+
+
+ public function refund_process()
+ {
+ $r_id=$this->input->post('r_id');
+ $r_name=$this->input->post('r_name');
+ $r_phone=$this->input->post('r_phone');
+
+ $this->load->model('Invoice_M');
+ $this->load->model('Payment_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.' '. $user->last_name;
+
+ $sql="select * from refund_order where id=".$r_id;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($refund_order)>0)
+ {
+ if($refund_order[0]->refund_process>0)
+ {
+ $showcontent='Already Done ';
+ $rvar=array(
+ 'update' =>0,
+ 'showcontent'=>$showcontent
+ );
+ $encode_data = json_encode($rvar);
+ }else{
+
+ if($refund_order[0]->refund_type==2)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'2',
+ 'payof_id'=>$refund_order[0]->refund_type_id,
+ 'payof_code'=>$refund_order[0]->refund_type_code,
+ 'credit_debit'=>'1',
+ 'amount'=>$refund_order[0]->refund_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$refund_order[0]->refund_type_reason,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $inv_id=$refund_order[0]->refund_type_id;
+
+ $data = array(
+ 'refund_process'=> '1',
+ 'refund_by'=>$user_name.'['.$user_id.']',
+ 'refund_by_id'=>$user_id,
+ 'refund_datetime'=>date('Y-m-d H:i:s'),
+ 'pay_id'=>$insert_id
+ );
+
+ $this->Payment_M->update_refundorder($data,$r_id);
+
+ $showcontent='Refund Update';
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+ $encode_data = json_encode($rvar);
+
+ $this->Invoice_M->update_invoice_final($refund_order[0]->refund_type_id);
+ }
+
+ if($refund_order[0]->refund_type==1)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'1',
+ 'payof_id'=>$refund_order[0]->refund_type_id,
+ 'payof_code'=>$refund_order[0]->refund_type_code,
+ 'credit_debit'=>'1',
+ 'amount'=>$refund_order[0]->refund_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$refund_order[0]->refund_type_reason,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $inv_id=$refund_order[0]->refund_type_id;
+
+ $data = array(
+ 'refund_process'=> '1',
+ 'refund_by'=>$user_name.'['.$user_id.']',
+ 'refund_by_id'=>$user_id,
+ 'refund_datetime'=>date('Y-m-d H:i:s'),
+ 'pay_id'=>$insert_id
+ );
+
+ $this->Payment_M->update_refundorder($data,$r_id);
+
+ $showcontent='Refund Update';
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+ $encode_data = json_encode($rvar);
+ }
+
+ if($refund_order[0]->refund_type==3)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'3',
+ 'payof_id'=>$refund_order[0]->refund_type_id,
+ 'payof_code'=>$refund_order[0]->refund_type_code,
+ 'credit_debit'=>'1',
+ 'amount'=>$refund_order[0]->refund_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$refund_order[0]->refund_type_reason,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $inv_id=$refund_order[0]->refund_type_id;
+
+ $data = array(
+ 'refund_process'=> '1',
+ 'refund_by'=>$user_name.'['.$user_id.']',
+ 'refund_by_id'=>$user_id,
+ 'refund_datetime'=>date('Y-m-d H:i:s'),
+ 'pay_id'=>$insert_id
+ );
+
+ $this->Payment_M->update_refundorder($data,$r_id);
+
+ $showcontent='Refund Update';
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+ $encode_data = json_encode($rvar);
+ }
+ }
+ }else{
+ $showcontent='No Record Found ';
+
+ $rvar=array(
+ 'update' =>0,
+ 'showcontent'=>$showcontent
+ );
+ $encode_data = json_encode($rvar);
+ }
+
+ echo $encode_data;
+ }
+
+ public function list_req_payment()
+ {
+ $this->load->view('Invoice/payment_request_list');
+ }
+
+ public function req_payment_process()
+ {
+ $mode=$this->input->post('mode');
+ $amount=$this->input->post('amount');
+ $req_payment_id=$this->input->post('req_payment_id');
+ $cash_remark=$this->input->post('cash_remark');
+
+ $input_card_mac=$this->input->post('input_card_mac');
+ $input_card_bank=$this->input->post('input_card_bank');
+ $input_card_digit=$this->input->post('input_card_digit');
+ $input_card_tran=$this->input->post('input_card_tran');
+
+ $this->load->model('Invoice_M');
+ $this->load->model('Payment_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.' '. $user->last_name;
+
+ $sql="select * from org_payment_request where id=".$req_payment_id;
+ $query = $this->db->query($sql);
+ $org_payment_request= $query->result();
+
+ if(count($org_payment_request)>0)
+ {
+ if($org_payment_request[0]->payment_process>0)
+ {
+ $showcontent='Already Done : Print Invoice ';
+ $rvar=array(
+ 'update' =>0,
+ 'showcontent'=>$showcontent
+ );
+
+ }else{
+
+ $paydata = array(
+ 'payment_mode'=> $mode,
+ 'payof_type'=>'3',
+ 'payof_id'=>$org_payment_request[0]->org_id,
+ 'payof_code'=>$org_payment_request[0]->org_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$org_payment_request[0]->payment_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$cash_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id,
+ 'card_bank'=>$input_card_mac,
+ 'card_remark'=>$input_card_bank,
+ 'cust_card'=>$input_card_digit,
+ 'card_tran_id'=>$input_card_tran,
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ if($insert_id>0)
+ {
+ $data = array(
+ 'payment_process'=> '1',
+ 'payment_accept_by'=>$user_name.'['.$user_id.']',
+ 'payment_accept_by_id'=>$user_id,
+ 'payment_datetime'=>date('Y-m-d H:i:s'),
+ 'pay_id'=>$insert_id
+ );
+
+ $this->Payment_M->update_org_payment($data,$req_payment_id);
+
+ $showcontent='Amount Receipt : Print Invoice ';
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent,
+ 'payid'=>$insert_id,
+ );
+ }
+
+
+
+ }
+ }else{
+ $showcontent='No Record Found ';
+
+ $rvar=array(
+ 'update' =>0,
+ 'showcontent'=>$showcontent,
+ 'payid'=>0,
+ );
+
+ }
+
+ $encode_data = json_encode($rvar);
+
+ echo $encode_data;
+ }
+
+ public function payment_form($req_id)
+ {
+ $sql="select * from org_payment_request where id=".$req_id;
+ $query = $this->db->query($sql);
+ $data['req_payment_order']= $query->result();
+
+ if(count($data['req_payment_order'])>0)
+ {
+ $sql="select * from organization_case_master
+ where id='".$data['req_payment_order'][0]->org_id."' ";
+ $query = $this->db->query($sql);
+ $data['org_info']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) as str_age from patient_master where id='".$data['req_payment_order'][0]->patient_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ if($data['req_payment_order'][0]->payment_process>0){
+ $showcontent='Amount Receipt : Print Payment Reciept ';
+ echo $showcontent;
+
+ }else{
+ $this->load->view('Invoice/payment_req_panel',$data);
+ }
+ }else{
+ echo 'No Record Found';
+ }
+ }
+
+ public function getReqPaymentTable()
+ {
+
+ $requestData= $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 =>'id',
+ 1 => 'org_code',
+ 2 => 'payment_type_str',
+ 3 => 'patient_name',
+ 4=> 'payment_request_datetime',
+ 5=> 'payment_amount',
+ 6=> 'payment_process_str'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select *,
+ (case payment_type when 1 then 'ORG' else 'Other' end ) as payment_type_str ,
+ if(payment_process<1,'Pending','Complete') as payment_process_str";
+
+ $sql_count="Select count(*) as no_rec ";
+
+ $sql_from=" from org_payment_request ";
+
+ $total_sql=$sql_count.$sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec']= $query->result();
+ $totalData=$data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where=" WHERE 1 = 1";
+
+ $sql_where_flag=0;
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][0]['search']['value']) ){ //CaseCode-InsuranceCard-ClaimNo
+ $sql_where.=" AND org_code LIKE '%".$requestData['columns'][0]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][1]['search']['value']) ){ //p_code-P-Name
+ $sql_where.=" AND ( patient_name LIKE '%".$requestData['columns'][1]['search']['value']."%') ";
+
+ $sql_where_flag=1;
+ }
+
+ $total_filer_sql=$sql_count.$sql_from.$sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered=$data['total_rec_filter'][0]->no_rec;
+
+ $sql_order=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+ $Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata= $query->result_array();
+
+ $output = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach($rdata as $aRow)
+ {
+ $row = array();
+
+ foreach($columns as $col)
+ {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function print_org_payment_invoice($req_id)
+ {
+ $sql="select *,
+ date_format(payment_datetime,'%d-%m-%Y %h:%i:%s') as payment_date_str
+ from org_payment_request where id=".$req_id;
+ $query = $this->db->query($sql);
+ $data['req_payment_order']= $query->result();
+
+ if(count($data['req_payment_order'])>0)
+ {
+ $sql="select * from organization_case_master where id='".$data['req_payment_order'][0]->org_id."' ";
+ $query = $this->db->query($sql);
+ $data['org_info']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) as str_age from patient_master where id='".$data['req_payment_order'][0]->patient_id."' ";
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name='Invoice-Org-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+ $content=$this->load->view('Invoice/Invoice_org_payment',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+ echo 'No Record Found';
+ }
+
+
+ }
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/InvoiceShow.php b/old_code_ci3/controllers/InvoiceShow.php
new file mode 100644
index 0000000..4722e7a
--- /dev/null
+++ b/old_code_ci3/controllers/InvoiceShow.php
@@ -0,0 +1,60 @@
+db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select * from inv_med_item where inv_med_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select sum(tamount) as Gtotal,sum(amount) as amt,sum(vamount) as vamt from inv_med_item where inv_med_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$data['invoice_master'][0]->patient_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where status=0 and p_id=".$data['invoice_master'][0]->patient_id;
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $this->load->view('invoiceshow/invoice_medical',$data);
+ }
+
+
+ public function invoice_charges($invoice_id)
+ {
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select *,(case payment_status when 1 Then 'cash' when 2 then 'Bank Card' when 3 then 'Org Credit' else 'Pending' end) as Payment_type_str from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $this->load->view('invoiceshow/invoice_charges',$data);
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Ipd.php b/old_code_ci3/controllers/Ipd.php
new file mode 100644
index 0000000..29f1005
--- /dev/null
+++ b/old_code_ci3/controllers/Ipd.php
@@ -0,0 +1,2202 @@
+load->view('IPD/ipd_dashboard');
+ }
+
+ public function ipd_panel_payment($ipdno)
+ {
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $discount=$data['ipd_master'][0]->Discount;
+ $discount2=$data['ipd_master'][0]->Discount2;
+ $discount3=$data['ipd_master'][0]->Discount3;
+
+ $tdiscount=$discount+$discount2+$discount3;
+
+ $charge1=$data['ipd_master'][0]->chargeamount1;
+ $charge2=$data['ipd_master'][0]->chargeamount2;
+ $tcharge=$charge1+$charge2;
+
+ $sql="select *,Date_Format(pay_date,'%d-%M') as pay_date_str,
+ case payment_mode when 1 then 'Cash'
+ when 2 then 'Bank Card'
+ when 3 then 'Cash Return'
+ when 4 then 'Bank Return'
+ else 'Other' end as pay_mode from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+ $sql="select * from invoice_med_master where payment_status=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_master']= $query->result();
+
+ $sql="select i.id as inv_id,i.invoice_code,sum(t.item_amount) as amount,i.refer_by_other,
+ date_format(i.inv_date,'%d-%m-%Y') as str_date,i.ipd_include,
+ group_concat(distinct c.group_desc) as charge_list
+ from invoice_master i left join
+ (invoice_item t join hc_item_type c on t.item_type=c.itype_id)
+ on i.id =t.inv_master_id
+ where payment_status=1 and ipd_id = ".$ipdno." group by i.id ";
+
+ $query = $this->db->query($sql);
+ $data['inv_master']= $query->result();
+
+ $total_med=0.00;
+ $total_charges=0.00;
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_med_master where payment_status=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_total']= $query->result();
+
+ $total_med=$data['inv_med_total'][0]->tnet_amount;
+
+ $sql="select sum(total_amount) as tnet_amount from invoice_master where payment_status=1 and ipd_include=0 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_charge_not_total']= $query->result();
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_master where payment_status=1 and ipd_include=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_charge_total']= $query->result();
+
+ $total_charges=$data['inv_charge_total'][0]->tnet_amount;
+
+ $sql="select sum(if(credit_debit=0,amount,amount*-1)) as t_ipd_pay from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['inv_payment_total']= $query->result();
+
+ $total_payment=$data['inv_payment_total'][0]->t_ipd_pay;
+
+ $balance=$total_payment-($total_charges+$tcharge-$tdiscount);
+
+ $data['inv_total']=array(
+ 'total_med' => $total_med,
+ 'total_charges' => $total_charges,
+ 'total_payment' => $total_payment,
+ 'ipd_id' => $ipdno,
+ 'discount' => $tdiscount,
+ 'balance' => $balance,
+ 'charge' => $tcharge
+ );
+
+ $this->load->view('IPD/ipd_payment',$data);
+ }
+
+ public function ipd_panel_invoice_show()
+ {
+ $inv_id=$this->input->post('invid');
+ $inv_type=$this->input->post('invtype');
+
+ if($inv_type == 0)
+ {
+ redirect('InvoiceShow/invoice_med/'.$inv_id);
+ }else{
+ redirect('InvoiceShow/invoice_charges/'.$inv_id);
+ }
+ }
+
+ public function show_account($ipdno)
+ {
+ $total_med=0.00;
+ $total_charges=0.00;
+
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $discount=$data['ipd_master'][0]->Discount;
+ $discount2=$data['ipd_master'][0]->Discount2;
+ $discount3=$data['ipd_master'][0]->Discount3;
+
+ $tdiscount=$discount+$discount2+$discount3;
+
+ $charge1=$data['ipd_master'][0]->chargeamount1;
+ $charge2=$data['ipd_master'][0]->chargeamount2;
+ $tcharge=$charge1+$charge2;
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_med_master where ipd_credit=1 and ipd_credit_type<2 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_total']= $query->result();
+
+ $total_med=$data['inv_med_total'][0]->tnet_amount;
+
+ $sql="select sum(total_amount) as tnet_amount from invoice_master where payment_status=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_charge_total']= $query->result();
+
+ $total_charges=$data['inv_charge_total'][0]->tnet_amount;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as tnet_amount from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['inv_payment_total']= $query->result();
+
+ $total_payment=$data['inv_payment_total'][0]->tnet_amount;
+
+ $total_balance_amount=$total_payment-($total_charges+$total_med+$tcharge-$tdiscount);
+
+ $data['inv_total']=array(
+ 'total_med' => $total_med,
+ 'total_charges' => $total_charges,
+ 'total_payment' => $total_payment,
+ 'total_balance_amount' => $total_balance_amount,
+ 'discount' => $tdiscount,
+ 'charge' => $tcharge,
+ 'ipd_id' => $ipdno
+ );
+
+ $this->load->view('IPD/ipd_account_panel',$data);
+
+ }
+
+ public function ipd_complete_invoice($ipdno,$print=0)
+ {
+ $this->db->query("CALL p_cal_ipd_master(".$ipdno.")");
+ $sql="select * from ipd_master where id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipdmaster']= $query->result();
+
+ $sql="select * from v_ipd_list where id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipd_list']= $query->result();
+
+ $sql="select b.ipd_id,b.bed_id,b.TDate,m.room_name,m.bed_no
+ from ipd_bed_assign b left join hc_bed_master m on b.bed_id=m.id
+ where b.ipd_id=".$ipdno." order by TDate desc";
+ $query = $this->db->query($sql);
+ $data['bed_list']= $query->result();
+
+ $pno=$data['ipdmaster'][0]->p_id;
+ $case_id=$data['ipdmaster'][0]->case_id;
+
+ $discount=$data['ipdmaster'][0]->Discount;
+ $discount2=$data['ipdmaster'][0]->Discount2;
+ $discount3=$data['ipdmaster'][0]->Discount3;
+
+ $charge1=$data['ipdmaster'][0]->chargeamount1;
+ $charge2=$data['ipdmaster'][0]->chargeamount2;
+ $tcharge=$charge1+$charge2;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $total_med=0.00;
+ $total_charges=0.00;
+
+ if($data['ipdmaster'][0]->case_id>0)
+ {
+ $sql="select * from organization_case_master where id='".$data['ipdmaster'][0]->case_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id='".$inc_card_id."'";
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id='".$ins_comp_id."'";
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+ }
+
+ $sql="select * from v_ipd_bill_invoice v
+ where v.ipd_id=".$ipdno." order by v.Charge_type ";
+
+ $query = $this->db->query($sql);
+ $data['showinvoice']= $query->result();
+
+ $sql="select * from invoice_med_master where ipd_credit=1 and ipd_credit_type=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_list']= $query->result();
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_med_master
+ where ipd_credit=1 and ipd_credit_type=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_total']= $query->result();
+
+ $total_med=$data['inv_med_total'][0]->tnet_amount;
+
+ $sql="select sum(total_amount) as tnet_amount from invoice_master
+ where payment_status=1 and ipd_include=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_charge_total']= $query->result();
+
+ $sql="select *,h.id as pay_id,Date_Format(pay_date,'%d-%M') as pay_date_str,
+ case p.payment_mode when 1 then 'Cash'
+ when 2 then 'Bank Card'
+ when 3 then 'Return Cash '
+ when 4 then 'Bank Return' else 'Other' end as pay_mode
+ from ipd_payment p join payment_history h on p.payment_id=h.id and h.payof_type=4 where p.ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+ $sql="select sum(if(credit_debit=0,amount,amount*-1)) as t_ipd_pay
+ from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment_total']= $query->result();
+
+ $total_charges=$data['inv_charge_total'][0]->tnet_amount;
+
+ $total_payment=$data['ipd_payment_total'][0]->t_ipd_pay;
+
+ $total_gross_amount=($total_charges+round($total_med,0));
+
+ $tdiscount=$discount+$discount2+$discount3;
+
+ $net_amount=($total_gross_amount+$tcharge)-$tdiscount;
+
+ $balance=$net_amount-$total_payment;
+
+ $data['inv_total']=array(
+ 'total_med' => $total_med,
+ 'total_charges' => $total_gross_amount,
+ 'total_payment' => $total_payment,
+ 'ipd_id' => $ipdno,
+ 'discount' => $tdiscount,
+ 'charge'=>$tcharge,
+ 'balance' => $balance,
+ 'net_amount' => $net_amount
+ );
+
+
+ $Check_Discount=1;
+
+ if($print==1)
+ {
+ $this->load->view('IPD/Ipd_invoice_print_V',$data);
+
+ }elseif($print==2){
+ $this->load->view('IPD/ipd_invoice_print_wo_payment',$data);
+ }else{
+ $this->load->view('IPD/Ipd_invoice_V',$data);
+ }
+
+ }
+
+ public function ipd_short_invoice($ipdno,$print=0)
+ {
+ $sql="select * from ipd_master where id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipdmaster']= $query->result();
+
+ $pno=$data['ipdmaster'][0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ if($data['ipdmaster'][0]->case_id>0)
+ {
+ $sql="select * from organization_case_master where id='".$data['ipdmaster'][0]->case_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id='".$inc_card_id."'";
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id='".$ins_comp_id."'";
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+ }
+
+ $sql="select * from v_ipd_invoice v
+ where v.ipd_id=".$ipdno." order by Charge_type,inv_date ";
+ $query = $this->db->query($sql);
+ $data['showinvoice']= $query->result();
+
+ $sql="select sum(amount) as GTotal from v_ipd_invoice v
+ where v.ipd_id=".$ipdno." ";
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select *,case payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end as pay_mode from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+
+ if($print>0)
+ {
+ $this->load->view('IPD/Ipd_invoice_print_V',$data);
+
+ }else{
+ $this->load->view('IPD/Ipd_invoice_V',$data);
+ }
+ }
+
+ public function ipd_confirm_payment()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+ $this->load->model('Payment_M');
+
+ $ipd_id=$this->input->post('ipd_id');
+ $amount=$this->input->post('amount');
+
+ $sql="select * from ipd_master where id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $pay_remark=$this->input->post('cash_remark');
+
+ $pay_datetime=str_to_MysqlDate($this->input->post('date_payment')).' '.date('H:i:s');
+
+ if($this->input->post('mode')==1)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$amount,
+ 'payment_date'=>$pay_datetime,
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $ipdpaymentdata = array(
+ 'payment_mode'=> '1',
+ 'payment_id'=>$insert_id,
+ 'payment_mode_desc'=>'Cash',
+ 'pay_date'=>$pay_datetime,
+ 'enter_pay_date' => date('Y-m-d H:i:s'),
+ 'ipd_id' => $ipd_id,
+ 'amount' => $amount,
+ 'remark'=>$pay_remark,
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $insert_ipdpay_id=$this->Ipd_M->insert_payment_ipd( $ipdpaymentdata);
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_ipdpay_id,
+ 'pay_date' =>$pay_datetime
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==2)
+ {
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_mac',
+ 'label' => 'Card Bank Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ )
+ /*,
+ array(
+ 'field' => 'input_card_digit',
+ 'label' => 'Card Last 4 Digit ',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_card_bank',
+ 'label' => 'Bank Name ',
+ 'rules' => 'required|min_length[1]|max_length[50]'
+ ),
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[1]|max_length[15]'
+ )*/
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_master[0]->id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'0',
+ 'amount' => $amount,
+ 'payment_date'=>$pay_datetime,
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'cust_card'=>$this->input->post('input_card_bank'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '2',
+ 'payment_mode_desc'=>'Bank Card',
+ 'payment_id'=>$insert_id,
+ 'pay_date'=>$pay_datetime,
+ 'enter_pay_date' => date('Y-m-d H:i:s'),
+ 'ipd_id' => $ipd_id,
+ 'amount' => $amount,
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'cust_card'=>$this->input->post('input_card_bank'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $insert_ipdpay_id=$this->Ipd_M->insert_payment_ipd( $data);
+
+ $status='Bank Card';
+
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_ipdpay_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+ if($this->input->post('mode')==5)
+ {
+ $FormRules = array(
+ array(
+ 'field' => 'input_person_name',
+ 'label' => 'Name on Chq.',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_bank_tran',
+ 'label' => 'Chq. Number',
+ 'rules' => 'required|min_length[1]|max_length[15]'
+ )
+ /*,
+ array(
+ 'field' => 'input_card_digit',
+ 'label' => 'Card Last 4 Digit ',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_card_bank',
+ 'label' => 'Bank Name ',
+ 'rules' => 'required|min_length[1]|max_length[50]'
+ ),
+ */
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $pay_remark='Chq Payment';
+
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_master[0]->id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'0',
+ 'amount' => $amount,
+ 'payment_date'=>$pay_datetime,
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'card_bank'=>$this->input->post('input_bank_hospital'),
+ 'cust_card'=>$this->input->post('input_bank_name'),
+ 'card_remark'=>$this->input->post('input_person_name'),
+ 'card_tran_id'=>$this->input->post('input_bank_tran'),
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '2',
+ 'payment_mode_desc'=>'Bank Chq.-Draft',
+ 'payment_id'=>$insert_id,
+ 'pay_date'=>$pay_datetime,
+ 'enter_pay_date' => date('Y-m-d H:i:s'),
+ 'ipd_id' => $ipd_id,
+ 'amount' => $amount,
+ 'card_bank'=>$this->input->post('input_bank_hospital'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'cust_card'=>$this->input->post('input_bank_name'),
+ 'card_tran_id'=>$this->input->post('input_bank_tran'),
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $insert_ipdpay_id=$this->Ipd_M->insert_payment_ipd( $data);
+
+ $status='Bank Card';
+
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_ipdpay_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+ }
+
+ public function ipd_ded_payment()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+ $this->load->model('Payment_M');
+
+ $ipd_id=$this->input->post('ipd_id');
+ $amount=$this->input->post('amount');
+
+ $sql="select * from ipd_master where id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $pay_remark=$this->input->post('cash_remark');
+
+ if($this->input->post('mode')==3)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'1',
+ 'amount'=>$amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $ipdpaymentdata = array(
+ 'payment_mode'=> '3',
+ 'payment_id'=>$insert_id,
+ 'payment_mode_desc'=>'Cash Return',
+ 'pay_date'=>date('Y-m-d H:i:s'),
+ 'ipd_id' => $ipd_id,
+ 'credit_debit'=>'1',
+ 'amount' => $amount,
+ 'remark'=>$pay_remark,
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $insert_ipdpay_id=$this->Ipd_M->insert_payment_ipd( $ipdpaymentdata);
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_ipdpay_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ if($this->input->post('mode')==4)
+ {
+ $paydata = array(
+ 'payment_mode'=> '4',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'1',
+ 'amount'=>$amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $ipdpaymentdata = array(
+ 'payment_mode'=> '4',
+ 'payment_id'=>$insert_id,
+ 'payment_mode_desc'=>'Bank Return',
+ 'pay_date'=>date('Y-m-d H:i:s'),
+ 'ipd_id' => $ipd_id,
+ 'credit_debit'=>'1',
+ 'amount' => $amount,
+ 'remark'=>$pay_remark,
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $insert_ipdpay_id=$this->Ipd_M->insert_payment_ipd( $ipdpaymentdata);
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_ipdpay_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ }
+
+ public function ipd_org_status_update()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $this->load->model('Ocasemaster_M');
+ $data['master'] = array(
+ 'org_approved_amount' => $this->input->post('amount'),
+ 'org_approved_status_id' => $this->input->post('org_status'),
+ 'org_status_update_by' => $user_name
+ );
+
+ $case_id=$this->input->post('case_id');
+ $this->Ocasemaster_M->update($data['master'],$case_id);
+
+ $rvar=array(
+ 'update' =>'1',
+ 'msg' => 'Update Done '.$case_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function ipd_main_panel($ipdno)
+ {
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select * from v_ipd_list where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_list']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *,concat_ws(' ','Dr.',p_fname,p_mname,p_lname) as doc_name from doctor_master where id='".$data['ipd_info'][0]->r_doc_id."' ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select i.id,d.p_fname,d.id as doc_id from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select * from organization_case_master where status=0 and p_id=".$data['ipd_info'][0]->p_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from org_approved_status ";
+ $query = $this->db->query($sql);
+ $data['org_approved_status']= $query->result();
+
+ $this->load->view('IPD/ipd_main_panel',$data);
+ }
+
+ public function ipd_account_panel($ipdno)
+ {
+
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $discount=$data['ipd_info'][0]->Discount;
+ $discount2=$data['ipd_info'][0]->Discount2;
+ $discount3=$data['ipd_info'][0]->Discount3;
+
+ $charge1=$data['ipd_info'][0]->chargeamount1;
+ $charge2=$data['ipd_info'][0]->chargeamount2;
+ $tcharge=$charge1+$charge2;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *,concat_ws(' ','Dr.',p_fname,p_mname,p_lname) as doc_name from doctor_master where id='".$data['ipd_info'][0]->r_doc_id."' ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select * from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select * from organization_case_master where status=0 and p_id=".$data['ipd_info'][0]->p_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $total_med=0.00;
+ $total_charges=0.00;
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_med_master where ipd_credit=1 and ipd_credit_type>0 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_total_credit']= $query->result();
+
+ $sql="select sum(net_amount) as tnet_amount,sum(payment_received) as t_payment_received from invoice_med_master where ipd_credit=0 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_total_cash']= $query->result();
+
+ $total_med_credit=$data['inv_med_total_credit'][0]->tnet_amount;
+ $total_med_cash=$data['inv_med_total_cash'][0]->tnet_amount;
+ $total_med_cash_paid=$data['inv_med_total_cash'][0]->t_payment_received;
+
+ $sql="select sum(total_amount) as tnet_amount from invoice_master where payment_status=1 and ipd_include=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_charge_total']= $query->result();
+
+ $total_charges=$data['inv_charge_total'][0]->tnet_amount;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as tnet_amount from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['inv_payment_total']= $query->result();
+
+ $total_payment=$data['inv_payment_total'][0]->tnet_amount;
+ $tdiscount=$discount+$discount2+$discount3;
+
+ $total_balance_amount=$total_payment-($total_charges+$total_med_credit+$tcharge-$tdiscount);
+
+ $data['inv_total']=array(
+ 'total_med_credit' => $total_med_credit,
+ 'total_med_cash' => $total_med_cash,
+ 'total_med_cash_paid' => $total_med_cash_paid,
+ 'total_charges' => $total_charges,
+ 'total_payment' => $total_payment,
+ 'total_balance_amount' => $total_balance_amount,
+ 'discount' => $tdiscount,
+ 'charge' => $tcharge,
+ 'ipd_id' => $ipdno
+ );
+
+
+ $this->load->view('IPD/ipd_account_panel',$data);
+ }
+
+ public function ipd_panel($ipdcode,$stype=0)
+ {
+ if($stype > 0)
+ {
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days from ipd_master where ipd_code='".$ipdcode."' ";
+ }else{
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days from ipd_master where id='".$ipdcode."' ";
+ }
+
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ if($stype > 0)
+ {
+ $sql="select * from v_ipd_list where ipd_code='".$ipdcode."' ";
+
+ }else{
+ $sql="select * from v_ipd_list where id='".$ipdcode."' ";
+ }
+
+ $query = $this->db->query($sql);
+ $data['ipd_list']= $query->result();
+
+ $discount=$data['ipd_info'][0]->Discount;
+ $discount2=$data['ipd_info'][0]->Discount2;
+ $discount3=$data['ipd_info'][0]->Discount3;
+
+ $charge1=$data['ipd_info'][0]->chargeamount1;
+ $charge2=$data['ipd_info'][0]->chargeamount2;
+ $tcharge=$charge1+$charge2;
+
+ $ipdno=$data['ipd_info'][0]->id;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *,concat_ws(' ','Dr.',p_fname,p_mname,p_lname) as doc_name from doctor_master where id='".$data['ipd_info'][0]->r_doc_id."' ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select * from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select * from organization_case_master where status=0 and p_id=".$data['ipd_info'][0]->p_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $total_med=0.00;
+ $total_charges=0.00;
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_med_master where ipd_credit=1 and ipd_credit_type>0 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_total_credit']= $query->result();
+
+ $sql="select sum(net_amount) as tnet_amount,sum(payment_received) as t_payment_received from invoice_med_master where ipd_credit=0 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_total_cash']= $query->result();
+
+ $sql="select * from invoice_med_master where ipd_credit=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_master_credit']= $query->result();
+
+ $total_med_credit=$data['inv_med_total_credit'][0]->tnet_amount;
+ $total_med_cash=$data['inv_med_total_cash'][0]->tnet_amount;
+ $total_med_cash_paid=$data['inv_med_total_cash'][0]->t_payment_received;
+
+ $sql="select sum(total_amount) as tnet_amount from invoice_master where payment_status=1 and ipd_include=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_charge_total']= $query->result();
+
+ $total_charges=$data['inv_charge_total'][0]->tnet_amount;
+
+ $sql="select sum(if(credit_debit=0,amount,amount*-1)) as tnet_amount from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['inv_payment_total']= $query->result();
+
+ $total_payment=$data['inv_payment_total'][0]->tnet_amount;
+
+ $tdiscount=$discount+$discount2+$discount3;
+
+ $total_balance_amount=$total_payment-($total_charges+$total_med_credit+$tcharge-($tdiscount));
+
+ $data['inv_total']=array(
+ 'total_med_credit' => $total_med_credit,
+ 'total_med_cash' => $total_med_cash,
+ 'total_med_cash_paid' => $total_med_cash_paid,
+ 'total_charges' => $total_charges,
+ 'total_payment' => $total_payment,
+ 'total_balance_amount' => $total_balance_amount,
+ 'discount' => $tdiscount,
+ 'charge' => $tcharge,
+ 'ipd_id' => $ipdno
+ );
+
+ $sql="select *,Date_Format(pay_date,'%d-%M') as pay_date_str,case payment_mode when 1 then 'Cash' when 2 then 'Bank Card' when 3 then 'Cash Return' else 'Other' end as pay_mode from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+ if ($this->ion_auth->in_group('admin1') || $this->ion_auth->in_group('IPDAdmit') ) {
+ if($data['ipd_info'][0]->ipd_status==0)
+ {
+ $this->load->view('IPD/Ipdpanel_V',$data);
+ }else{
+ if($this->ion_auth->in_group('IPDReAdmit'))
+ {
+ $this->load->view('IPD/Ipdpanel_V',$data);
+ }else{
+ $this->load->view('IPD/IPD_View',$data);
+ }
+ }
+ }else{
+ $this->load->view('IPD/IPD_View',$data);
+ }
+ }
+
+ public function IpdList()
+ {
+ $sql = "select *,(paid_amount-(charge_amount+med_amount)) as balance from v_ipd_list where ipd_status=0 ";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('IPD2/IPDList_V',$data);
+ }
+
+ public function ipd_room_status()
+ {
+ $sql="select b.room_name,b.room_rent,count(b.id) as Total_Bed,sum(if(b.bed_used_p_id=0,1,0)) as FreeBed
+ from hc_bed_master b group by b.room_name";
+ $query = $this->db->query($sql);
+ $data['roomdata']= $query->result();
+
+ $this->load->view('IPD/ipd_bed_status',$data);
+ }
+
+ public function add_remove_doc($ipd_doc_id)
+ {
+ if ($this->ion_auth->in_group('IPDAdmit')) {
+ $this->db->delete("ipd_master_doc_list", "id=".$ipd_doc_id);
+ }
+ }
+
+ public function add_add_doc($ipd_id,$doc_id)
+ {
+ if ($this->ion_auth->in_group('IPDAdmit')) {
+
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+
+ $data = array(
+ 'ipd_id' => $ipd_id,
+ 'doc_id' => $doc_id
+ );
+ $inser_id=$this->Ipd_M->add_ipd_doc($data);
+ }
+ }
+
+ public function show_ipd_form1($ipdno)
+ {
+ $sql="select *,if(case_type=1,'MLC','Non MLC') as case_type_s,
+ Date_format(register_date,'%d-%m-%Y') as str_register_date ,
+ Date_format(discharge_date,'%d-%m-%Y') as str_discharge_date
+ from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *,concat_ws(' ','Dr.',p_fname,p_mname,p_lname) as doc_name from doctor_master where id='".$data['ipd_info'][0]->r_doc_id."' ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select i.id,d.p_fname,d.id as doc_id from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select * from organization_case_master where id='".$data['ipd_info'][0]->case_id."' ";
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $d= $this->ion_auth->user()->row();
+
+ $data['user'] = $d;
+
+
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+ $file_name='Report-FaceForm-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('IPD/print_ipd_form1',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function addipd($pno)
+ {
+ $sql="select count(*) as no_ipd from ipd_master where ipd_status=0 and p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['ipd_master_rec']= $query->result();
+
+ if ($data['ipd_master_rec'][0]->no_ipd > 0)
+ {
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ redirect('Ipd/ipd_panel/'.$data['ipd_info'][0]->id);
+ }else{
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_spec_l']= $query->result();
+
+ $sql="select id,concat('Bed No:',bed_no,'/','[',room_name,']') as Bed_Desc from hc_bed_master where bed_used_p_id=0";
+ $query = $this->db->query($sql);
+ $data['ipd_bed_list']= $query->result();
+
+ $sql="select * from hc_insurance ";
+ $query = $this->db->query($sql);
+ $data['insur_list']= $query->result();
+
+ $sql="select * from organization_case_master
+ where status=0 and ipd_id=0 and case_type=1 and p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $this->load->view('IPD/Ipd_Registration_V',$data);
+ }
+
+ }
+
+ public function ipd_bed_assign_list($ipdno)
+ {
+ $sql="select m.bed_no,m.room_name,b.Fdate,b.TDate,b.Remark
+ from ipd_bed_assign b join hc_bed_master m on b.bed_id=m.id where b.ipd_id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipd_bed_assign']= $query->result();
+
+ $sql="select id,concat('Bed No:',bed_no,'/','[',room_name,']') as Bed_Desc from hc_bed_master where bed_used_p_id=0";
+ $query = $this->db->query($sql);
+ $data['ipd_bed_list']= $query->result();
+
+
+ $this->load->view('IPD/ipd_bed_assign',$data);
+
+ }
+
+ public function ipd_cash_print($ipd_id,$payid,$print=0)
+ {
+ $sql="select * from ipd_payment where id=".$payid;
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+ $payment_id=$data['ipd_payment'][0]->payment_id;
+
+ $sql="select * from ipd_master where id =".$data['ipd_payment'][0]->ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $pno=$data['ipd_master'][0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ if($print==0)
+ {
+ $this->load->view('IPD/print_payment_receipt_ipd',$data);
+ }else{
+ redirect('IpdNew/ipd_cash_print_pdf/'.$ipd_id.'/'.$payment_id);
+ //$this->load->view('IPD/ipd_payment_receipt_print',$data);
+ }
+ }
+
+ public function load_model_box($ipd_id)
+ {
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days,if(case_type=1,'MLC','Non MLC') as case_type_s, Date_format(register_date,'%d-%m-%Y') as str_register_date from ipd_master where id='".$ipd_id."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) as str_age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $this->load->view('IPD/ipd_model_payment_box',$data);
+ }
+
+ public function ipd_bed_list()
+ {
+ $sql="select id,concat('Bed No:',bed_no,'/','[',room_name,']') as Bed_Desc from hc_bed_master where bed_used_p_id=0";
+
+ $query = $this->db->query($sql);
+ $ipd_bed_list= $query->result();
+
+ echo '';
+
+ foreach($ipd_bed_list as $row)
+ {
+ echo ''.$row->Bed_Desc.' ';
+ }
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ }
+
+ public function load_model_ded_box()
+ {
+ $this->load->view('IPD/ipd_panel_deduction_payment');
+ }
+
+ public function AddNew() {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+ $this->load->model('Ipd_M');
+
+ $data['master'] = array(
+ 'p_id' => $this->input->post('pid'),
+ 'P_name' => $this->input->post('pname'),
+ 'relation' => $this->input->post('r_relation'),
+ 'contact_person_Name' => $this->input->post('rp_name'),
+ 'insurance_id' => $this->input->post('insur_list'),
+ 'policy_no' => $this->input->post('insur_no'),
+ 'register_date' => str_to_MysqlDate($this->input->post('res_date')),
+ 'problem' => $this->input->post('problem'),
+ 'remark' => $this->input->post('remark'),
+ 'P_mobile1' => $this->input->post('phone1'),
+ 'P_mobile2' => $this->input->post('phone2'),
+ 'case_type' => $this->input->post('optionsRadios_mlc'),
+ 'case_id' => $this->input->post('optionsRadios_org'),
+ 'reg_time' => $this->input->post('res_time')
+ );
+
+ $groupData = $this->input->post('doc_id');
+
+ if (isset($groupData) && !empty($groupData)) {
+ $data['doc_list']=$groupData;
+
+ $inser_id=$this->Ipd_M->insert($data);
+
+ $data['BedData'] = array(
+ 'ipd_id' => $inser_id,
+ 'Fdate' => date('Y-m-d h:i:s'),
+ 'TDate' => date('Y-m-d h:i:s'),
+ 'bed_id' => $this->input->post('room_list')
+ );
+
+ if($this->input->post('room_list')<>"")
+ {
+ $inser_bed_id=$this->Ipd_M->bedassign($data['BedData']);
+ }
+ }
+ else
+ {
+ $inser_id=0;
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function discharge_update()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+ $this->load->model('Ipd_M');
+ $this->load->model('Ocasemaster_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $discharge_by=$user_name.'['.$user_id.']';
+
+ $data['master'] = array(
+ 'discharge_by' => $discharge_by,
+ 'discharge_remark' => $this->input->post('discharge_remark'),
+ 'discharge_balance_user' => $this->input->post('input_bal_user'),
+ 'discharge_balance_remark' => $this->input->post('input_bal_remark'),
+ 'ipd_status' => '1',
+ 'discharge_date' => str_to_MysqlDate($this->input->post('dis_date')),
+ 'discharge_time' => $this->input->post('dis_time'),
+ 'discarge_patient_status' => $this->input->post('p_status')
+ );
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ //Update Org. Status Update
+ $sql="select * from ipd_master where id='".$ipd_id."' ";
+ $query = $this->db->query($sql);
+ $ipd_info= $query->result();
+
+ if($ipd_info[0]->case_id>0)
+ {
+ $case_id=$ipd_info[0]->case_id;
+
+ $sql="select * from organization_case_master where id='".$case_id."'";
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+
+ if(count($case_master)>0)
+ {
+ $log=$case_master[0]->log.'\nUpdate Status:'.$this->input->post('status').'-Upd By:'.$user_name.'['.$user_id.']'.date('d/m/Y H:m:s');
+
+ $data = array(
+ 'status'=> 1,
+ 'log'=>$log,
+ );
+
+ $this->Ocasemaster_M->update( $data,$case_id);
+ }
+
+ }
+
+ //Update Org. Stop
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Discharge Status Updated."
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function discharge_request()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+ $this->load->model('Ipd_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $discharge_by=$user_name.'['.$user_id.']';
+
+ $data['master'] = array(
+ 'ipd_status' => '0',
+ 'discharge_date' => str_to_MysqlDate($this->input->post('dis_date')),
+ 'discharge_time' => $this->input->post('dis_time'),
+ 'discarge_patient_status' => $this->input->post('p_status'),
+ 'dept_id' => $this->input->post('dept_id')
+ );
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ echo "Discharge Status Updated";
+ }
+
+ public function update_surgery()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $ipd_id=$this->input->post('ipd_id');
+ $issurgery=$this->input->post('issurgery');
+ $surgery_name=$this->input->post('surgery_name');
+ $surgery_date=$this->input->post('surgery_date');
+
+
+
+ $content="";
+
+ $dataupdate = array(
+ 'issurgery' => $issurgery,
+ 'surgery_name' => $surgery_name,
+ 'surgery_date' => str_to_MysqlDate($surgery_date)
+ );
+
+ $this->Ipd_M->update($dataupdate,$ipd_id);
+
+ $content="Update Done";
+
+
+ echo $content;
+ }
+
+
+ public function update_delivery()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $ipd_id=$this->input->post('ipd_id');
+ $isdelivery=$this->input->post('isdelivery');
+ $delivery_date=$this->input->post('delivery_date');
+ $delivery_time=$this->input->post('delivery_time');
+ $delivery_sex_of_baby=$this->input->post('delivery_sex_of_baby');
+
+
+ $dataupdate = array(
+ 'isdelivery' => $isdelivery,
+ 'delivery_time' => $delivery_time,
+ 'delivery_date' => str_to_MysqlDate($delivery_date),
+ 'delivery_sex_of_baby' => $delivery_sex_of_baby
+ );
+
+ $this->Ipd_M->update($dataupdate,$ipd_id);
+ $content="Update Done";
+
+ echo $content;
+ }
+
+
+ public function update_ipdadmit_time()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+ $this->load->model('Ipd_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $discharge_by=$user_name.'['.$user_id.']';
+
+ $ipd_id=$this->input->post('Ipd_ID');
+
+ $data['master'] = array(
+ 'register_date' => str_to_MysqlDate($this->input->post('strdate')),
+ 'reg_time' => $this->input->post('strtime')
+ );
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Admit Date Updated"
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function discharge_ipd($ipdno)
+ {
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select * from ipd_discharg_status ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_status']= $query->result();
+
+ $discount=$data['ipd_info'][0]->Discount;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+
+ if($data['ipd_info'][0]->ipd_status == 0 )
+ {
+ $this->load->view('IPD/ipd_discharge',$data);
+ }else{
+ $this->load->view('IPD/ipd_discharged_status',$data);
+ }
+
+
+ }
+
+ public function getIpdTable()
+ {
+
+ $requestData= $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 =>'ipd_code',
+ 1 => 'p_code',
+ 2 => 'p_fname',
+ 3=> 'P_mobile1',
+ 4=> 'doc_name',
+ 5=> 'Disstatus',
+ 6=> 'str_register_date',
+ 7=> 'str_discharge_date',
+ 8=> 'Disstatus'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select * ";
+
+ $sql_count="Select count(*) as no_rec ";
+
+ $sql_from=" from v_ipd_list ";
+
+ $total_sql=$sql_count.$sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec']= $query->result();
+ $totalData=$data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where=" WHERE 1 = 1";
+
+ $sql_where_flag=0;
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][0]['search']['value']) ){ //ipd_code
+ $sql_where.=" AND ipd_code LIKE '%".$requestData['columns'][0]['search']['value']."' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][1]['search']['value']) ){ //p_code
+ $sql_where.=" AND p_code LIKE '".$requestData['columns'][1]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][2]['search']['value']) ){ //p_fname
+ $sql_where.=" AND p_fname LIKE '%".$requestData['columns'][2]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][3]['search']['value']) ){ //P_mobile1
+ $sql_where.=" AND P_mobile1 LIKE '%".$requestData['columns'][3]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][4]['search']['value']) ){ //P_mobile1
+ $sql_where.=" AND doc_name LIKE '%".$requestData['columns'][4]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][7]['search']['value']) )
+ { //IPD Admit Date Range
+ $rangeArray = explode("/",$requestData['columns'][7]['search']['value']);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+ $admitType = $rangeArray[2];
+ if($admitType==0){
+ $sql_where.=" AND ( Date(register_date) between '".$minRange."' AND '".$maxRange."' ) ";
+ }elseif($admitType==1){
+ $sql_where.=" AND ( Date(discharge_date) between '".$minRange."' AND '".$maxRange."' ) ";
+ }else{
+ $sql_where.=" AND (( Date(register_date) between '".$minRange."' AND '".$maxRange."' ) ";
+ $sql_where.=" OR ( Date(discharge_date) between '".$minRange."' AND '".$maxRange."' )) ";
+ }
+
+ $sql_where_flag=1;
+ }
+
+ $total_filer_sql=$sql_count.$sql_from.$sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered=$data['total_rec_filter'][0]->no_rec;
+
+ $sql_order=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+ $Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata= $query->result_array();
+
+ $output = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach($rdata as $aRow)
+ {
+ $row = array();
+
+ foreach($columns as $col)
+ {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function discount_update($dis_no)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $Discount_By=$user_name.'['.$user_id.']'.date('d-m-Y');
+
+ if($dis_no==1)
+ {
+ $data['master'] = array(
+ 'Discount_By' => $Discount_By,
+ 'Discount_Remark' => $this->input->post('Discount_Remark'),
+ 'Discount' => $this->input->post('Discount')
+ );
+ }elseif($dis_no==2){
+ $data['master'] = array(
+ 'Discount_By2' => $Discount_By,
+ 'Discount_Remark2' => $this->input->post('Discount_Remark'),
+ 'Discount2' => $this->input->post('Discount')
+ );
+ }elseif($dis_no==3){
+ $data['master'] = array(
+ 'Discount_By3' => $Discount_By,
+ 'Discount_Remark3' => $this->input->post('Discount_Remark'),
+ 'Discount3' => $this->input->post('Discount')
+ );
+ }
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Discount Status Updated."
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function charge_update($dis_no)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $charge_by=$user_name.'['.$user_id.']'.date('d-m-Y');
+
+ if($dis_no==1)
+ {
+ $data['master'] = array(
+ 'charge_by1' => $charge_by,
+ 'charge1' => $this->input->post('input_charge_remark1'),
+ 'chargeamount1' => $this->input->post('input_charge_Amount1')
+ );
+ }elseif($dis_no==2){
+ $data['master'] = array(
+ 'charge_by2' => $charge_by,
+ 'charge2' => $this->input->post('input_charge_remark2'),
+ 'chargeamount2' => $this->input->post('input_charge_Amount2')
+ );
+ }
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Charge Status Updated."
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function readmit($dis_no)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $charge_by=$user_name.'['.$user_id.']'.date('d-m-Y');
+
+ if($dis_no==2)
+ {
+ $data['master'] = array(
+ 'ipd_status' => '0'
+ );
+ }
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Status Updated."
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function add_bed_room()
+ {
+ $room_list=$this->input->post('room_list');
+ $Ipd_ID=$this->input->post('Ipd_ID');
+
+ $this->load->model('Ipd_M');
+ $data = array(
+ 'ipd_id' => $this->input->post('Ipd_ID'),
+ 'Fdate' => $this->input->post('start_datetime'),
+ 'TDate' => $this->input->post('end_datetime'),
+ 'bed_id' => $this->input->post('room_list')
+ );
+
+ $inser_id=$this->Ipd_M->bedassign($data);
+
+ $sql="select m.bed_no,m.room_name,b.Fdate,b.TDate,b.Remark
+ from ipd_bed_assign b join hc_bed_master m on b.bed_id=m.id where b.ipd_id=".$Ipd_ID;
+
+ $query = $this->db->query($sql);
+ $room_assign_info= $query->result();
+
+ $r_data='
+
+
+
+ Bed No.
+ Description
+ Date
+ Vacant Date
+
+
+ ';
+
+ for ($i = 0; $i < count($room_assign_info); ++$i) {
+ $r_data=$r_data.'
+ '.$room_assign_info[$i]->bed_no.'
+ '.$room_assign_info[$i]->room_name.'
+ '.$room_assign_info[$i]->Fdate.'
+ '.$room_assign_info[$i]->TDate.'
+ ';
+ }
+
+ $r_data=$r_data.'
';
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ //echo $encode_data;
+ echo $r_data;
+
+ }
+
+ public function list_med_inv($ipd_id)
+ {
+ $sql="select * from invoice_med_master where ipd_credit=1 and ipd_id = ".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_credit']= $query->result();
+
+ $data['ipd_id']=$ipd_id;
+
+ $this->load->view('IPD/IPD_Medical_Invoice_Panel',$data);
+ }
+
+ public function list_med_inv_details($ipd_id,$inv_med_id)
+ {
+ $sql="select * from invoice_med_master where ipd_credit=1 and id='".$inv_med_id."' and ipd_id = ".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_credit']= $query->result();
+
+ $sql="select * from inv_med_item where inv_med_id='".$inv_med_id."'";
+ $query = $this->db->query($sql);
+ $data['inv_master_credit_details']= $query->result();
+
+ $this->load->view('IPD/ipd_medical_invoice_short',$data);
+ }
+
+
+ public function Update_Invoice_ipd_credit_type()
+ {
+ $ipd_credit_type= $this->input->post('ipd_credit_type');
+ $inv_id = $this->input->post('inv_id');
+
+ $dataupdate = array(
+ 'ipd_include' => $ipd_credit_type
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$inv_id);
+ }
+
+
+ //Org. Update
+
+ public function IPD_Invoice_Edit($IPD_ID)
+ {
+ $sql="select * from v_ipd_list
+ where id=".$IPD_ID;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $ins_comp_id=$data['ipd_master'][0]->insurance_id;
+
+ $sql="select i.*,t.group_desc
+ from ipd_invoice_item i join ipd_item_type t on i.item_type=t.itype_id
+ where i.ipd_id=".$IPD_ID;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from ipd_invoice_item where ipd_id=".$IPD_ID;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,concat(d.p_fname,' [',group_concat(m.SpecName),']') as DocSpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id order by d.p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from med_spec order by SpecName";
+ $query = $this->db->query($sql);
+ $data['med_spec']= $query->result();
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc
+ from hc_items where itype=40 order by idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_1']= $query->result();
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc
+ from hc_items where itype=34 order by idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_2']= $query->result();
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc
+ from hc_items where itype=27 order by idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_5']= $query->result();
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc
+ from hc_items where itype=26 order by idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_3']= $query->result();
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc
+ from hc_items where itype=35 order by idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_6']= $query->result();
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc
+ from hc_items where itype=43 order by idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_7']= $query->result();
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc
+ from hc_items where itype=3 order by idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_8']= $query->result();
+
+ $this->load->view('IPD/ipd_invoice_items',$data);
+ }
+
+ public function ipd_package($ipd_id)
+ {
+ $sql="select * from package where id>1 and active=1";
+ $query = $this->db->query($sql);
+ $data['package_list']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,concat(d.p_fname,' [',group_concat(m.SpecName),']') as DocSpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id order by d.p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $this->load->view('IPD/ipd_package',$data);
+ }
+
+ public function show_Package($ipd_id)
+ {
+ $sql="select * from ipd_package where ipd_id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_package']= $query->result();
+
+ echo '';
+
+ }
+
+ public function ipd_package_showitem($type)
+ {
+ $this->load->model('Ipd_M');
+
+ $ipd_id=$this->input->post('ipd_id');
+ $pack_id=$this->input->post('package_id');
+ $package_name=$this->input->post('package_name');
+ $comment=$this->input->post('comment');
+ $package_desc=$this->input->post('comment');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']'.' D:'.date('d-m-Y h:i:s');
+
+ if($type==1)
+ {
+ $sql="select * from package where id=".$pack_id;
+ $query = $this->db->query($sql);
+ $package= $query->result();
+
+ $item_custom_amount=$this->input->post('input_amount');
+ $date_item=$this->input->post('date_item');
+
+ if($pack_id>1)
+ {
+ $package_desc=$package[0]->Pakage_description;
+ $package_name=$package[0]->ipd_pakage_name;
+ $item_amount=$package[0]->Pakage_Min_Amount;
+ }
+
+ if($date_item=='')
+ {
+ $date_item=date('Y-m-d');
+ }
+
+ if($item_custom_amount>0)
+ {
+ $item_amount=$item_custom_amount;
+ }
+
+ $data['insert_package'] = array(
+ 'ipd_id' => $ipd_id,
+ 'package_id' => $pack_id,
+ 'package_name' => $package_name,
+ 'package_desc' => $package_desc,
+ 'package_Amount' => $item_amount,
+ 'comment' => $comment,
+ 'update_by' => $user_name
+ );
+ $inser_id=$this->Ipd_M->insert_package( $data['insert_package']);
+
+ }elseif($type==2)
+ {
+ $amount_value=$this->input->post('input_amount');
+
+ $data['update_package'] = array(
+ 'item_amount' => $amount_value
+ );
+
+ $inser_id=$this->Ipd_M->update_package( $data['update_package'],$this->input->post('itemid'));
+
+ }else{
+
+ echo $this->Ipd_M->deletepackage($this->input->post('itemid'));
+ //$this->db->delete("invoice_item", "id=".$this->input->post('itemid'));
+ }
+
+ }
+
+ public function doc_ipd_fee($doc_id)
+ {
+ $sql="select * from doc_ipd_fee where isdelete=0 and doc_id= ".$doc_id." order by doc_fee_desc ";
+ $query = $this->db->query($sql);
+ $doc_fee= $query->result();
+
+ foreach($doc_fee as $row)
+ {
+ echo ''.$row->doc_fee_desc.'[Rs. '.$row->amount.'] ';
+ }
+
+ }
+
+ public function ipd_items_bytype()
+ {
+ $tid=$this->input->post('itype_idv');
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from ipd_items where itype=".$tid." order by idesc ";
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ echo '
+ Test Name
+ ';
+ foreach($data['labitem'] as $row)
+ {
+ echo ''.$row->sdesc.' ';
+ }
+ echo '
';
+ }
+
+ public function ipd_showitem($type)
+ {
+ $this->load->model('Ipd_M');
+
+ $ipd_id=$this->input->post('ipd_id');
+
+ if($type==1)
+ {
+
+ $sql="select * from ipd_items where id=".$this->input->post('itype_name_id');
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $item_rate=$data['itemlist'][0]->amount;
+
+ $item_custom_rate=$this->input->post('input_rate');
+ $date_item=$this->input->post('date_item');
+ if($date_item=='')
+ {
+ $date_item=date('Y-m-d');
+ }
+
+ if($item_custom_rate>0)
+ {
+ $item_rate=$item_custom_rate;
+ }
+ $amount_value=$this->input->post('input_qty')*$item_rate;
+
+ $doc_id=$this->input->post('doc_id');
+
+ if($doc_id<1)
+ {
+ $refername=$this->input->post('refername');
+ }else{
+ $sql="select * from doctor_master where id=".$doc_id;
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+ $refername=$data['doc_master'][0]->p_fname;
+ }
+
+ $data['insert_invoice_item'] = array(
+ 'ipd_id' => $ipd_id,
+ 'item_type' => $this->input->post('itype_idv'),
+ 'item_id' => $this->input->post('itype_name_id'),
+ 'item_name' => $data['itemlist'][0]->idesc,
+ 'item_rate' => $item_rate,
+ 'item_added_date' => date('Y-m-d h:i:s'),
+ 'item_qty' => $this->input->post('input_qty'),
+ 'item_amount' => $amount_value,
+ 'doc_id' => $this->input->post('doc_id'),
+ 'doc_name' => $refername,
+ 'date_item' => $date_item,
+ 'comment' => $this->input->post('comment')
+ );
+ $inser_id=$this->Ipd_M->insert_ipd_item( $data['insert_invoice_item']);
+
+ }elseif($type==2)
+ {
+ $amount_value=$this->input->post('update_qty') * $this->input->post('item_rate');
+
+ $data['update_invoice_item'] = array(
+ 'item_added_date' => date('Y-m-d h:i:s'),
+ 'item_qty' => $this->input->post('update_qty'),
+ 'item_amount' => $amount_value
+ );
+
+ $inser_id=$this->Ipd_M->update_ipd_item( $data['update_invoice_item'],$this->input->post('itemid'));
+
+ }else{
+
+ echo $this->Ipd_M->deleteIpdinvoiceitem($this->input->post('itemid'));
+ //$this->db->delete("invoice_item", "id=".$this->input->post('itemid'));
+ }
+
+ }
+
+ public function show_ipd_items($ipd_id)
+ {
+ $sql="select * from v_ipd_list where id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $ins_comp_id=$data['ipd_master'][0]->insurance_id;
+
+ $sql="select t.group_desc,i.*,sum(i.item_amount) as xAmount
+ from ipd_invoice_item i join ipd_item_type t on i.item_type=t.itype_id
+ where i.ipd_id=".$ipd_id."
+ group by i.item_type,i.id with rollup";
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from ipd_invoice_item where ipd_id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ echo '';
+ echo ' ';
+
+
+ }
+
+
+ public function add_ipd_org($ipd_id,$org_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ipd_M');
+
+ $update_ipd=array(
+ 'case_id'=>$org_id
+ );
+
+ $this->Ipd_M->update($update_ipd,$ipd_id);
+ }
+
+ public function update_org_doc()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $org_id=$this->input->post('org_id');
+ $feild=$this->input->post('feild');
+ $fvalue=$this->input->post('fvalue');
+
+ $this->load->model('Ocasemaster_M');
+
+ $update_ipd=array(
+ $feild=>$fvalue
+ );
+
+ $this->Ocasemaster_M->update($update_ipd,$org_id);
+
+ }
+
+
+
+ }
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Ipd2.php b/old_code_ci3/controllers/Ipd2.php
new file mode 100644
index 0000000..8cefac8
--- /dev/null
+++ b/old_code_ci3/controllers/Ipd2.php
@@ -0,0 +1,335 @@
+db->query($sql);
+ $ipdmaster= $query->result();
+
+ $pno=$ipdmaster[0]->p_id;
+ $case_id=$ipdmaster[0]->case_id;
+
+ $sql="select * from v_ipd_list where id=".$ipdno;
+ $query = $this->db->query($sql);
+ $ipd_list= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,if(age is null,
+ Get_Age(dob),Concat(age,' ',age_in)) AS age
+ from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $person_info= $query->result();
+
+
+ $sql="select * from ipd_package
+ where ipd_id=".$ipdno;
+ $query = $this->db->query($sql);
+ $ipd_package= $query->result();
+
+
+
+ //Check Items in Package
+ $No_Pack_items=0;
+
+ $sql1= 'Select count(*) as no_rec from ipd_invoice_item i
+ where i.package_id>0 and i.ipd_id='.$ipdno;
+
+ $sql2= 'Select count(*) as no_rec from invoice_med_master
+ Where ipd_credit=1 and ipd_credit_type=0 and ipd_id = '.$ipdno;
+
+ $sql3= 'Select count(*) as no_rec from v_ipd_invoice b
+ where b.ipd_id='.$ipdno.' and ipd_include=0';
+
+ $query = $this->db->query($sql1);
+ $Package_Items= $query->result();
+ $No_Pack_items+=$Package_Items[0]->no_rec;
+
+ $query = $this->db->query($sql2);
+ $Package_Items= $query->result();
+ $No_Pack_items+=$Package_Items[0]->no_rec;
+
+ $query = $this->db->query($sql3);
+ $Package_Items= $query->result();
+ $No_Pack_items+=$Package_Items[0]->no_rec;
+
+ if(count($ipd_package)>0)
+ {
+ $sql="select t.group_desc,i.*,sum(i.item_amount) as xAmount
+ from ipd_invoice_item i join ipd_item_type t on i.item_type=t.itype_id
+ where i.package_id=0 and i.ipd_id=".$ipdno."
+ group by i.item_type,i.id order by i.item_type";
+ $query = $this->db->query($sql);
+ $ipd_invoice_item= $query->result();
+ }else{
+ $sql="select t.group_desc,i.*,sum(i.item_amount) as xAmount
+ from ipd_invoice_item i join ipd_item_type t on i.item_type=t.itype_id
+ where i.ipd_id=".$ipdno."
+ group by i.item_type,i.id order by i.item_type";
+ $query = $this->db->query($sql);
+ $ipd_invoice_item= $query->result();
+ }
+
+ $sql="select *
+ from invoice_med_master
+ where ipd_credit=1 and ipd_credit_type=1
+ and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $inv_med_list= $query->result();
+
+ $sql="select b.ipd_id AS ipd_id,b.Charge_type AS Charge_type,b.idesc AS idesc,
+ b.item_rate AS item_rate,b.orgcode AS orgcode,sum(b.item_qty) AS no_qty,sum(b.Amount) AS amount
+ from v_ipd_invoice b where b.ipd_id=".$ipdno." and ipd_include=1
+ group by b.ipd_id,b.item_id,b.item_rate order by b.Charge_type ";
+
+ $query = $this->db->query($sql);
+ $showinvoice= $query->result();
+
+ if($ipdmaster[0]->case_id>0)
+ {
+ $sql="select * from organization_case_master
+ where id='".$ipdmaster[0]->case_id."'";
+ $query = $this->db->query($sql);
+ $orgcase= $query->result();
+
+ $ins_comp_id=$orgcase[0]->insurance_id;
+ $inc_card_id=$orgcase[0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id='".$inc_card_id."'";
+ $query = $this->db->query($sql);
+ $hc_insurance_card= $query->result();
+
+ $sql="select * from hc_insurance where id='".$ins_comp_id."'";
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+ }
+
+
+ $sql="select sum(net_amount) as tnet_amount
+ from invoice_med_master
+ where ipd_credit=1 and ipd_credit_type=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $inv_med_total= $query->result();
+
+ $total_med=$inv_med_total[0]->tnet_amount;
+
+ $sql="select sum(total_amount) as tnet_amount from invoice_master
+ where payment_status=1 and ipd_include=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $inv_charge_total= $query->result();
+
+ $sql="SELECT h.*,DATE_FORMAT(h.payment_date,'%d-%m-%Y') as pay_date_str,
+ concat(if(h.credit_debit=0,'','Return '),if(h.payment_mode=1,'CASH','BANK')) as pay_mode
+ from payment_history h where h.payof_type=4 AND h.payof_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $ipd_payment= $query->result();
+
+
+ $PrintData='IPD ID : '.$ipdmaster[0]->ipd_code.' / PCode : '.$person_info[0]->p_code. ' / PName : '.$person_info[0]->p_fname .' / Age : '.$person_info[0]->age .PHP_EOL;
+ $PrintData.='----------------------------------------------------------------------------------------------------------'.PHP_EOL;
+
+ $PrintData.=str_pad('Doctor Name : '. $ipd_list[0]->doc_name,35,' ',STR_PAD_RIGHT);
+
+ if($ipdmaster[0]->case_id>0) {
+ $PrintData.=str_pad('Organisation : '.$insurance[0]->ins_company_name,35,' ',STR_PAD_RIGHT);
+ }
+ $PrintData.=PHP_EOL;
+
+ $PrintData.=str_pad('Admit Date : '.$ipd_list[0]->str_register_date,35,' ',STR_PAD_RIGHT);
+ $PrintData.=str_pad('Discharge Date : '.$ipd_list[0]->str_discharge_date,35,' ',STR_PAD_RIGHT).PHP_EOL;
+
+ $PrintData.='----------------------------------------------------------------------------------------------------------'.PHP_EOL;
+ $PrintData.=' '.PHP_EOL;
+ $PrintData.='# Description Rate Qty Amount '.PHP_EOL;
+ $PrintData.='----------------------------------------------------------------------------------------------------------'.PHP_EOL;
+
+ $srno=1;
+ $headdesc='';
+
+ if(Count($ipd_package)>0){
+ $PrintData.='Package'.PHP_EOL;
+ $headdesc='Package';
+ for($i=0;$ipackage_name,60,' ',STR_PAD_RIGHT);
+ $line.=str_pad('',10,' ',STR_PAD_LEFT);
+ $line.=str_pad('',15,' ',STR_PAD_LEFT);
+ $line.=str_pad($ipd_package[$i]->package_Amount,15,' ',STR_PAD_LEFT);
+ $srno=$srno+1;
+ $PrintData.=$line.PHP_EOL;
+ }
+ }
+
+ for($i=0;$igroup_desc)
+ {
+ $PrintData.=''. $ipd_invoice_item[$i]->group_desc .''.PHP_EOL;
+ $headdesc=$ipd_invoice_item[$i]->group_desc;
+ }
+
+ $line='';
+ $line.=str_pad($srno,3,' ',STR_PAD_RIGHT);
+
+ $line.=str_pad($ipd_invoice_item[$i]->item_name.' '.$ipd_invoice_item[$i]->comment,60,' ',STR_PAD_RIGHT);
+ $line.=str_pad($ipd_invoice_item[$i]->item_qty,10,' ',STR_PAD_LEFT);
+ $line.=str_pad($ipd_invoice_item[$i]->item_rate,15,' ',STR_PAD_LEFT);
+ $line.=str_pad($ipd_invoice_item[$i]->item_amount,15,' ',STR_PAD_LEFT);
+ $srno=$srno+1;
+ $PrintData.=$line.PHP_EOL;
+
+ }
+
+ for($i=0;$iCharge_type)
+ {
+ $PrintData.=''. $showinvoice[$i]->Charge_type .''.PHP_EOL;
+ $headdesc=$showinvoice[$i]->Charge_type;
+ }
+
+ $line='';
+ $line.=str_pad($srno,3,' ',STR_PAD_RIGHT);
+
+ $line.=str_pad($showinvoice[$i]->idesc,60,' ',STR_PAD_RIGHT);
+ $line.=str_pad($showinvoice[$i]->no_qty,10,' ',STR_PAD_LEFT);
+ $line.=str_pad($showinvoice[$i]->item_rate,15,' ',STR_PAD_LEFT);
+ $line.=str_pad($showinvoice[$i]->amount,15,' ',STR_PAD_LEFT);
+ $srno=$srno+1;
+ $PrintData.=$line.PHP_EOL;
+ }
+
+ if(count($inv_med_list)>0)
+ {
+ $PrintData.='---------------------------- Medical Bill ----------------------------------------------------------'.PHP_EOL;
+
+ $med_total=0.00;
+ foreach($inv_med_list as $row)
+ {
+ $line='';
+ $line.=str_pad($srno,3,' ',STR_PAD_RIGHT);
+ $line.=str_pad($row->inv_med_code,40,' ',STR_PAD_RIGHT);
+ $line.=str_pad($row->net_amount,25,' ',STR_PAD_RIGHT);
+
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ $PrintData.=$line.PHP_EOL;
+ }
+ }
+
+ $PrintData.='----------------------------------------------------------------------------------------------------------'.PHP_EOL;
+ $PrintData.=str_pad('Gross Total : '.$ipdmaster[0]->gross_amount,100,' ',STR_PAD_LEFT).PHP_EOL;
+
+ if($ipdmaster[0]->chargeamount1>0)
+ {
+ $PrintData.=PHP_EOL;
+ $PrintData.=str_pad('Charge : '.$ipdmaster[0]->charge1,90,' ',STR_PAD_RIGHT).PHP_EOL ;
+ $PrintData.=str_pad($ipdmaster[0]->chargeamount1,10,' ',STR_PAD_LEFT).PHP_EOL ;
+ }
+
+ if($ipdmaster[0]->chargeamount2>0)
+ {
+ $PrintData.=PHP_EOL;
+ $PrintData.=str_pad('Charge : '.$ipdmaster[0]->charge2,90,' ',STR_PAD_RIGHT).PHP_EOL ;
+ $PrintData.=str_pad($ipdmaster[0]->chargeamount2,10,' ',STR_PAD_LEFT).PHP_EOL ;
+ }
+
+ if($ipdmaster[0]->Discount>0)
+ {
+ $PrintData.=PHP_EOL;
+ $PrintData.=str_pad('Deduction : '.$ipdmaster[0]->Discount_Remark,90,' ',STR_PAD_RIGHT).PHP_EOL ;
+ $PrintData.=str_pad($ipdmaster[0]->Discount,10,' ',STR_PAD_LEFT).PHP_EOL ;
+ }
+
+ if($ipdmaster[0]->Discount2>0)
+ {
+ $PrintData.=PHP_EOL;
+ $PrintData.=str_pad('Deduction : '.$ipdmaster[0]->Discount_Remark2,90,' ',STR_PAD_RIGHT).PHP_EOL ;
+ $PrintData.=str_pad($ipdmaster[0]->Discount2,10,' ',STR_PAD_LEFT).PHP_EOL ;
+ }
+
+ if($ipdmaster[0]->Discount3>0)
+ {
+ $PrintData.=PHP_EOL;
+ $PrintData.=str_pad('Deduction : '.$ipdmaster[0]->Discount_Remark3,90,' ',STR_PAD_RIGHT).PHP_EOL ;
+ $PrintData.=str_pad($ipdmaster[0]->Discount3,10,' ',STR_PAD_LEFT).PHP_EOL ;
+ }
+
+ $PrintData.='----------------------------------------------------------------------------------------------------------'.PHP_EOL;
+ $PrintData.=str_pad('Net Amount : '.$ipdmaster[0]->net_amount,100,' ',STR_PAD_LEFT).PHP_EOL;
+ $PrintData.=str_pad('Payment Recd : '.$ipdmaster[0]->total_paid_amount,100,' ',STR_PAD_LEFT).PHP_EOL;
+ $PrintData.=str_pad('Balance : '.$ipdmaster[0]->balance_amount,100,' ',STR_PAD_LEFT).PHP_EOL;
+ $PrintData.=str_pad('Balance Remark : '.$ipdmaster[0]->discharge_balance_remark,70,' ',STR_PAD_RIGHT);
+ $PrintData.=str_pad('Print Time : '.date('d-m-Y h:i:s'),30,' ',STR_PAD_LEFT).PHP_EOL;
+
+ $PrintData.='xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx'.PHP_EOL .PHP_EOL .PHP_EOL;
+
+ return $PrintData;
+ }
+
+
+
+ function Ipd_invoice_print_list($daterange,$doc_name_id,$ipd_type,$ipd_status,$ipd_date,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+
+ if($ipd_status>-1)
+ {
+ $where.=" and p.ipd_status=".$ipd_status;
+ }
+
+ if($ipd_date==0)
+ {
+ $where.=" and p.register_date between '".$minRange."' and '".$maxRange."' " ;
+ }elseif($ipd_date==1)
+ {
+ $where.=" and p.discharge_date between '".$minRange."' and '".$maxRange."' " ;
+ }
+
+ if($doc_name_id>0)
+ {
+ $where.=" and FIND_IN_SET('".$doc_name_id."',doc_list) ";
+ }
+
+ if($ipd_type==6){
+ $where.=" and (group_ins is null or group_ins=6)";
+ }elseif($ipd_type==0){
+ $where.=" ";
+ }else {
+ $where.=" and group_ins=$ipd_type ";
+ }
+
+
+ $sql="select p.id,p.ipd_code,p.p_fname,Date_Format(p.register_date,'%d-%m-%Y') as str_register_date,
+ Date_Format(p.discharge_date,'%d-%m-%Y') as str_discharge_date,p.admit_type,p.doc_name,p.Bed_Desc,
+ charge_amount,paid_amount
+ from v_ipd_list p where ".$where." group by p.id,p.doc_list order by id";
+
+ $query = $this->db->query($sql);
+ $dischargelist= $query->result();
+
+ $PrintData='';
+
+ foreach($dischargelist as $row)
+ {
+ $PrintData.=$this->Ipd_invoice_text($row->id);
+ }
+
+ echo ''.$PrintData.' ';
+
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/IpdNew.php b/old_code_ci3/controllers/IpdNew.php
new file mode 100644
index 0000000..a6e246b
--- /dev/null
+++ b/old_code_ci3/controllers/IpdNew.php
@@ -0,0 +1,2241 @@
+load->model('Ipd_M');
+ }
+
+ public function IpdDashboard()
+ {
+ $this->load->view('IPD2/ipd_dashboard');
+ }
+
+ public function ipd_panel_payment($ipdno)
+ {
+
+ $sql="select *,Date_Format(payment_date,'%d-%M-%Y') as pay_date_str,
+ Concat(if(payment_mode=1,'Cash','BANK'),if(credit_debit=0,'','-Return')) as pay_mode
+ from payment_history
+ where payof_type=4 and payof_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment_history']= $query->result();
+
+ $sql="select * from invoice_med_master where payment_status=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_master']= $query->result();
+
+ $this->load->view('IPD2/ipd_payment',$data);
+ }
+
+ public function IPD_info(){
+
+ $IPDNO = $this->input->post('input_ipd_no');
+
+ $sql="select * from v_ipd_list where ipd_code='$IPDNO' ";
+ $query = $this->db->query($sql);
+ $data= $query->result();
+
+ if(count($data)>0)
+ {
+ $Patient_id=$data[0]->p_id;
+ $IPD_id=$data[0]->id;
+ $ipd_info=$data[0]->p_code.'/'.$data[0]->p_fname.' '.$data[0]->p_rname.' /Age :'.$data[0]->str_age.' /AdmitDate:'.
+ $data[0]->str_register_date.'/TPA:'.$data[0]->admit_type;
+
+ }else{
+ $Patient_id=0;
+ $ipd_info='';
+ $IPD_id=0;
+ }
+
+ $rvar=array(
+ 'IPD_id' =>$IPD_id,
+ 'ipd_info'=>$ipd_info
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function ipd_Diagnosis($ipdno)
+ {
+
+ $sql="select i.id as inv_id,i.invoice_code,sum(t.item_amount) as amount,i.refer_by_other,
+ date_format(i.inv_date,'%d-%m-%Y') as str_date,i.ipd_include,
+ group_concat(distinct c.group_desc) as charge_list
+ from invoice_master i left join
+ (invoice_item t join hc_item_type c on t.item_type=c.itype_id)
+ on i.id =t.inv_master_id
+ where payment_status=1 and ipd_id = ".$ipdno." group by i.id ";
+
+ $query = $this->db->query($sql);
+ $data['inv_master']= $query->result();
+
+ $this->load->view('IPD2/ipd_diagnosis_charges',$data);
+ }
+
+ public function ipd_panel_invoice_show($inv_id,$inv_type)
+ {
+ //$inv_id=$this->input->post('invid');
+ //$inv_type=$this->input->post('invtype');
+
+ if($inv_type == 0)
+ {
+ redirect('InvoiceShow/invoice_med/'.$inv_id);
+ }else{
+ redirect('InvoiceShow/invoice_charges/'.$inv_id);
+ }
+ }
+
+ public function ipd_Diagnosis_invoice_show($invoice_id)
+ {
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select *,(case payment_status when 1 Then 'cash' when 2 then 'Bank Card' when 3 then 'Org Credit' else 'Pending' end) as Payment_type_str from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $this->load->view('IPD2/ipd_diagnosis_invoice_items',$data);
+
+ }
+
+ public function Update_Invoice_ipd_itmes_package()
+ {
+ $ipd_item_package_type= $this->input->post('ipd_item_package_type');
+ $ipd_item_id = $this->input->post('ipd_item_id');
+
+ $dataupdate = array(
+ 'package_id' => $ipd_item_package_type
+ );
+
+
+ $this->Ipd_M->update_ipd_item($dataupdate,$ipd_item_id);
+ echo 'Value of '.$ipd_item_package_type.' is '.$ipd_item_id;
+ }
+
+ public function show_account($ipdno)
+ {
+ $total_med=0.00;
+ $total_charges=0.00;
+
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $discount=$data['ipd_master'][0]->Discount;
+ $discount2=$data['ipd_master'][0]->Discount2;
+ $discount3=$data['ipd_master'][0]->Discount3;
+
+ $tdiscount=$discount+$discount2+$discount3;
+
+ $charge1=$data['ipd_master'][0]->chargeamount1;
+ $charge2=$data['ipd_master'][0]->chargeamount2;
+ $tcharge=$charge1+$charge2;
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_med_master where ipd_credit=1 and ipd_credit_type<2 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_total']= $query->result();
+
+ $total_med=$data['inv_med_total'][0]->tnet_amount;
+
+ $sql="select sum(total_amount) as tnet_amount from invoice_master where payment_status=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_charge_total']= $query->result();
+
+ $total_charges=$data['inv_charge_total'][0]->tnet_amount;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as tnet_amount from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['inv_payment_total']= $query->result();
+
+ $total_payment=$data['inv_payment_total'][0]->tnet_amount;
+
+ $total_balance_amount=$total_payment-($total_charges+$total_med+$tcharge-$tdiscount);
+
+ $data['inv_total']=array(
+ 'total_med' => $total_med,
+ 'total_charges' => $total_charges,
+ 'total_payment' => $total_payment,
+ 'total_balance_amount' => $total_balance_amount,
+ 'discount' => $tdiscount,
+ 'charge' => $tcharge,
+ 'ipd_id' => $ipdno
+ );
+
+ $this->load->view('IPD2/ipd_account_panel',$data);
+
+ }
+
+ public function ipd_complete_invoice($ipdno,$print=0)
+ {
+ //calculate_IPD
+
+
+
+ $this->Ipd_M->calculate_IPD($ipdno);
+
+ $sql="select * from ipd_master where id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipdmaster']= $query->result();
+
+ $pno=$data['ipdmaster'][0]->p_id;
+
+ $sql="select * from ipd_package where ipd_id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipd_package']= $query->result();
+
+ //Check Items in Package
+ $No_Pack_items=0;
+
+ $sql1= 'Select count(*) as no_rec from ipd_invoice_item i
+ where i.package_id>0 and i.ipd_id='.$ipdno;
+
+ $sql2= 'Select count(*) as no_rec from invoice_med_master
+ Where ipd_credit=1 and ipd_credit_type=0 and ipd_id = '.$ipdno;
+
+ $sql3= 'Select count(*) as no_rec from v_ipd_invoice b
+ where b.ipd_id='.$ipdno.' and ipd_include=0';
+
+ $query = $this->db->query($sql1);
+ $Package_Items= $query->result();
+ $No_Pack_items+=$Package_Items[0]->no_rec;
+
+ $query = $this->db->query($sql2);
+ $Package_Items= $query->result();
+ $No_Pack_items+=$Package_Items[0]->no_rec;
+
+ $query = $this->db->query($sql3);
+ $Package_Items= $query->result();
+ $No_Pack_items+=$Package_Items[0]->no_rec;
+
+ $data['No_Pack_items']=$No_Pack_items;
+
+ if(count($data['ipd_package'])>0)
+ {
+ $sql="select t.group_desc,i.*,sum(i.item_amount) as xAmount
+ from ipd_invoice_item i join ipd_item_type t on i.item_type=t.itype_id
+ where i.package_id=0 and i.ipd_id=".$ipdno."
+ group by i.item_type,i.id order by i.item_type";
+ $query = $this->db->query($sql);
+ $data['ipd_invoice_item']= $query->result();
+ }else{
+ $sql="select t.group_desc,i.*,sum(i.item_amount) as xAmount
+ from ipd_invoice_item i join ipd_item_type t on i.item_type=t.itype_id
+ where i.ipd_id=".$ipdno."
+ group by i.item_type,i.id order by i.item_type";
+ $query = $this->db->query($sql);
+ $data['ipd_invoice_item']= $query->result();
+ }
+
+ $sql="select * from invoice_med_master
+ where ipd_credit=1 and ipd_credit_type=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $data['inv_med_list']= $query->result();
+
+ $sql="select b.ipd_id AS ipd_id,b.Charge_type AS Charge_type,b.idesc AS idesc,
+ b.item_rate AS item_rate,b.orgcode AS orgcode,sum(b.item_qty) AS no_qty,sum(b.Amount) AS amount
+ from v_ipd_invoice b where b.ipd_id=".$ipdno." and ipd_include=1
+ group by b.ipd_id,b.item_id,b.item_rate order by b.Charge_type ";
+
+ $query = $this->db->query($sql);
+ $data['showinvoice']= $query->result();
+
+ $sql="select * from v_ipd_list where id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipd_list']= $query->result();
+
+ $sql="select b.ipd_id,b.bed_id,b.TDate,m.room_name,m.bed_no
+ from ipd_bed_assign b left join hc_bed_master m on b.bed_id=m.id
+ where b.ipd_id=".$ipdno." order by TDate desc";
+ $query = $this->db->query($sql);
+ $data['bed_list']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ if($data['ipdmaster'][0]->case_id>0)
+ {
+ $sql="select * from organization_case_master where id='".$data['ipdmaster'][0]->case_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id='".$inc_card_id."'";
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id='".$ins_comp_id."'";
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+ }
+
+ $sql="SELECT h.*,DATE_FORMAT(h.payment_date,'%d-%m-%Y') as pay_date_str,
+ concat(if(h.credit_debit=0,'','Return '),if(h.payment_mode=1,'CASH','BANK')) as pay_mode
+ from payment_history h where h.payof_type=4 AND h.payof_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+ if($print>0)
+ {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ //$this->m_pdf->pdf->SetWatermarkText(H_Name);
+ //$this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name='Report-IPDBill-'.$ipdno."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+
+ if($print==1)
+ {
+ $content=$this->load->view('IPD2/Ipd_invoice_print_V',$data,TRUE);
+ }else if($print==2)
+ {
+ $content=$this->load->view('IPD2/ipd_invoice_print_wo_payment',$data,TRUE);
+ }else if($print==3)
+ {
+ $content=$this->load->view('IPD2/ipd_invoice_doc_wise',$data,TRUE);
+ }else if($print==4)
+ {
+ $content=$this->load->view('IPD2/ipd_invoice_print_TPA_V',$data,TRUE);
+ }else if($print==5){
+ $content=$this->load->view('IPD2/ipd_invoice_print_on_letterhead',$data,TRUE);
+ }else{
+ $content='Blank';
+ }
+
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+
+
+ }else{
+ $this->load->view('IPD2/Ipd_invoice_V',$data);
+ }
+
+
+
+ }
+
+ public function ipd_short_invoice($ipdno,$print=0)
+ {
+ $sql="select * from ipd_master where id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipdmaster']= $query->result();
+
+ $pno=$data['ipdmaster'][0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ if($data['ipdmaster'][0]->case_id>0)
+ {
+ $sql="select * from organization_case_master where id='".$data['ipdmaster'][0]->case_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id='".$inc_card_id."'";
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id='".$ins_comp_id."'";
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+ }
+
+ $sql="select * from v_ipd_invoice v
+ where v.ipd_id=".$ipdno." order by Charge_type,inv_date ";
+ $query = $this->db->query($sql);
+ $data['showinvoice']= $query->result();
+
+ $sql="select sum(amount) as GTotal from v_ipd_invoice v
+ where v.ipd_id=".$ipdno." ";
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select *,case payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end as pay_mode from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+
+ if($print>0)
+ {
+ $this->load->view('IPD2/Ipd_invoice_print_V',$data);
+
+ }else{
+ $this->load->view('IPD2/Ipd_invoice_V',$data);
+ }
+ }
+
+ public function ipd_confirm_payment()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $this->load->model('Payment_M');
+
+ $ipd_id=$this->input->post('ipd_id');
+ $amount=$this->input->post('amount');
+
+ $sql="select * from ipd_master where id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $pay_remark=$this->input->post('cash_remark');
+
+ $pay_datetime=str_to_MysqlDate($this->input->post('date_payment')).' '.date('H:i:s');
+
+ if($this->input->post('mode')==1)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$amount,
+ 'payment_date'=>$pay_datetime,
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_id,
+ 'pay_date' =>$pay_datetime
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==2)
+ {
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[1]|max_length[15]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_master[0]->id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'0',
+ 'amount' => $amount,
+ 'payment_date'=>$pay_datetime,
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'pay_bank_id'=>$this->input->post('cbo_pay_type'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $status='Bank Card';
+
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ }
+
+ public function ipd_ded_payment()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $this->load->model('Payment_M');
+
+ $ipd_id=$this->input->post('ipd_id');
+ $amount=$this->input->post('amount');
+
+ $sql="select * from ipd_master where id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $pay_remark=$this->input->post('cash_remark');
+
+ if($this->input->post('mode')==3)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'1',
+ 'amount'=>$amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==4)
+ {
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'payof_type'=>'4',
+ 'payof_id'=>$ipd_id,
+ 'payof_code'=>$ipd_master[0]->ipd_code,
+ 'credit_debit'=>'1',
+ 'amount'=>$amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ 'payid' => $insert_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function ipd_org_status_update()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $this->load->model('Ocasemaster_M');
+ $data['master'] = array(
+ 'org_approved_amount' => $this->input->post('amount'),
+ 'org_approved_status_id' => $this->input->post('org_status'),
+ 'org_status_update_by' => $user_name
+ );
+
+ $case_id=$this->input->post('case_id');
+ $this->Ocasemaster_M->update($data['master'],$case_id);
+
+ $rvar=array(
+ 'update' =>'1',
+ 'msg' => 'Update Done '.$case_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function ipd_main_panel($ipdno)
+ {
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select * from v_ipd_list where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_list']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *,concat_ws(' ','Dr.',p_fname,p_mname,p_lname) as doc_name from doctor_master where id='".$data['ipd_info'][0]->r_doc_id."' ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select i.id,d.p_fname,d.id as doc_id from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select * from organization_case_master
+ where id=".$data['ipd_info'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from organization_case_master
+ where status=0 and case_type=1 and ipd_id=0 and p_id=".$data['ipd_info'][0]->p_id;
+ $query = $this->db->query($sql);
+ $data['case_master_open']= $query->result();
+
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from org_approved_status ";
+ $query = $this->db->query($sql);
+ $data['org_approved_status']= $query->result();
+
+ $sql="SELECT m.id,CONCAT(m.title,' ',m.f_name,' [',t.type_desc,']') AS refer_name, t.type_desc
+ FROM refer_master m JOIN refer_type t ON m.refer_type=t.id order by t.type_desc,m.f_name";
+ $query = $this->db->query($sql);
+ $data['refer_master']= $query->result();
+
+ $sql="SELECT i.id,CONCAT(m.title,' ',m.f_name,' [',t.type_desc,']') AS refer_name, t.type_desc
+ FROM (refer_master m JOIN refer_type t ON m.refer_type=t.id)
+ Join ipd_refer i on i.refer_by=m.id and i.ipd_id=$ipdno
+ order by t.type_desc,m.f_name";
+ $query = $this->db->query($sql);
+ $data['refer_list']= $query->result();
+
+
+ $this->load->view('IPD2/ipd_main_panel',$data);
+ }
+
+ public function ipd_account_panel($ipdno)
+ {
+ //calculate_IPD
+
+
+ $this->Ipd_M->calculate_IPD($ipdno);
+
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $data['ipd_master']=$ipd_master;
+
+ $data['inv_total']=array(
+ 'total_med_credit' => $ipd_master[0]->med_amount+$ipd_master[0]->package_med_amount,
+ 'total_med_cash' => $ipd_master[0]->cash_med_amount,
+ 'total_med_cash_paid' => $ipd_master[0]->med_paid,
+ 'total_charge_amount' => $ipd_master[0]->charge_amount,
+ 'total_payment' => $ipd_master[0]->total_paid_amount,
+ 'total_balance_amount' => $ipd_master[0]->balance_amount,
+ 'net_amount' => $ipd_master[0]->net_amount,
+ 'ipd_id' => $ipdno
+ );
+
+ $this->load->view('IPD2/ipd_account_panel',$data);
+ }
+
+ public function ipd_panel($ipdcode,$stype=0)
+ {
+
+ if($stype > 0)
+ {
+ $sql="select id from ipd_master where ipd_code='".$ipdcode."' ";
+ $query = $this->db->query($sql);
+ $get_ipd_no= $query->result();
+
+ $ipdno=$get_ipd_no[0]->id;
+ }else{
+ $ipdno=$ipdcode;
+ }
+
+ //calculate_IPD
+
+
+ $this->Ipd_M->calculate_IPD($ipdno);
+
+ $sql="select * from v_ipd_list where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $p_id=$data['ipd_info'][0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age
+ from patient_master where id='".$p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *
+ from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id
+ where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select *
+ from organization_case_master
+ where status=0 and case_type=1 and ipd_id=$ipdno and p_id=".$p_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $data['ipd_master']=$ipd_master;
+
+ $sql="select *,Date_Format(payment_date,'%d-%M-%Y') as pay_date_str,
+ Concat(if(payment_mode=1,'Cash','BANK'),if(credit_debit=0,'','-Return')) as pay_mode
+ from payment_history
+ where payof_type=4 and payof_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_payment_history']= $query->result();
+
+ if ($this->ion_auth->in_group('admin1') || $this->ion_auth->in_group('IPDAdmit') ) {
+ if($data['ipd_info'][0]->ipd_status==0)
+ {
+ $this->load->view('IPD2/Ipdpanel_V',$data);
+ }else{
+ if($this->ion_auth->in_group('IPDReAdmit'))
+ {
+ $this->load->view('IPD2/Ipdpanel_V',$data);
+ }else{
+ $this->load->view('IPD2/IPD_View',$data);
+ }
+ }
+ }else{
+ $this->load->view('IPD2/IPD_View',$data);
+ }
+ }
+
+ public function load_model_TPA_Payment($ipd_id)
+ {
+ $sql="select *,if(case_type=1,'MLC','Non MLC') as case_type_s,
+ Date_format(register_date,'%d-%m-%Y') as str_register_date ,
+ Date_format(discharge_date,'%d-%m-%Y') as str_discharge_date
+ from ipd_master where id='".$ipd_id."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master
+ where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $data['ipd_id']=$ipd_id;
+
+ $this->load->view('IPD2/TPA_Payment',$data);
+ }
+
+ public function tpa_payment()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $ipd_id=$this->input->post('hid_ipd_id');
+ $payable_by_tpa=$this->input->post('input_payable_by_tpa');
+ $discount_for_tpa=$this->input->post('input_discount_for_tpa');
+ $discount_by_hospital=$this->input->post('input_discount_by_hospital');
+ $discount_by_hospital_2=$this->input->post('input_discount_by_hospital_2');
+ $discount_by_hospital_remark=$this->input->post('input_discount_by_hospital_remark');
+ $discount_by_hospital_2_remark=$this->input->post('input_discount_by_hospital_2_remark');
+
+ $paydata = array(
+ 'payable_by_tpa'=> $payable_by_tpa,
+ 'discount_by_hospital'=>$discount_by_hospital,
+ 'discount_by_hospital_2'=>$discount_by_hospital_2,
+ 'discount_for_tpa'=>$discount_for_tpa,
+ 'discount_by_hospital_remark'=>$discount_by_hospital_remark,
+ 'discount_by_hospital_2_remark'=>$discount_by_hospital_2_remark,
+ );
+
+ $update=$this->Ipd_M->update($paydata,$ipd_id);
+
+ $rvar=array(
+ 'update' =>1,
+ 'ipd_id'=> $ipd_id,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function IpdList()
+ {
+ $sql = "select *,(paid_amount-(charge_amount+med_amount)) as balance from v_ipd_list where ipd_status=0 ";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('IPD2/IPDList_V',$data);
+ }
+
+ public function ipd_room_status()
+ {
+ $sql="select b.room_name,b.room_rent,count(b.id) as Total_Bed,sum(if(b.bed_used_p_id=0,1,0)) as FreeBed
+ from hc_bed_master b group by b.room_name";
+ $query = $this->db->query($sql);
+ $data['roomdata']= $query->result();
+
+ $this->load->view('IPD2/ipd_bed_status',$data);
+ }
+
+ public function add_remove_doc($ipd_doc_id)
+ {
+ if ($this->ion_auth->in_group('IPDAdmit')) {
+ $this->db->delete("ipd_master_doc_list", "id=".$ipd_doc_id);
+ }
+ }
+
+ public function add_add_doc($ipd_id,$doc_id)
+ {
+ if ($this->ion_auth->in_group('IPDAdmit')) {
+
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $data = array(
+ 'ipd_id' => $ipd_id,
+ 'doc_id' => $doc_id
+ );
+ $inser_id=$this->Ipd_M->add_ipd_doc($data);
+ }
+ }
+
+ public function show_ipd_form($ipdno,$form_no=1)
+ {
+ $sql="select *,if(case_type=1,'MLC','Non MLC') as case_type_s,
+ Date_format(register_date,'%d-%m-%Y') as str_register_date ,
+ Date_format(discharge_date,'%d-%m-%Y') as str_discharge_date
+ from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select * From v_ipd_list Where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info_2']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select *,concat_ws(' ','Dr.',p_fname,p_mname,p_lname) as doc_name from doctor_master where id='".$data['ipd_info'][0]->r_doc_id."' ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select i.id,d.p_fname,d.id as doc_id from ipd_master_doc_list i join doctor_master d on i.doc_id = d.id where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_doc_list']= $query->result();
+
+ $sql="select * from organization_case_master where id='".$data['ipd_info'][0]->case_id."' ";
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $d= $this->ion_auth->user()->row();
+
+ $data['user'] = $d;
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name='Report-FaceForm-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+
+ if($form_no==1)
+ {
+ $content=$this->load->view('IPD2/print_ipd_form1',$data,TRUE);
+ }elseif($form_no==2){
+ $content=$this->load->view('IPD2/print_ipd_form2',$data,TRUE);
+ }elseif($form_no==3){
+ $content=$this->load->view('IPD2/print_ipd_form3',$data,TRUE);
+ }elseif($form_no==4){
+ $content=$this->load->view('IPD2/ipd_dues_form',$data,TRUE);
+ }elseif($form_no==5){
+ $this->m_pdf->pdf->showWatermarkText = false;
+ $content=$this->load->view('IPD_Format/form_admission_histroy_phusical_assessment',$data,TRUE);
+ }elseif($form_no==6){
+ $this->m_pdf->pdf->showWatermarkText = false;
+ $content=$this->load->view('IPD_Format/form_treatment_chart',$data,TRUE);
+ }elseif($form_no==7){
+ $this->m_pdf->pdf->showWatermarkText = false;
+ $content=$this->load->view('IPD_Format/form_vitals_chart',$data,TRUE);
+ }elseif($form_no==8){
+ $this->m_pdf->pdf->showWatermarkText = false;
+ $content=$this->load->view('IPD_Format/form_progress_notes',$data,TRUE);
+ }elseif($form_no==9){
+ $this->m_pdf->pdf->showWatermarkText = false;
+ $content=$this->load->view('IPD_Format/form_fluid_in_out',$data,TRUE);
+ }elseif($form_no==13){
+ $content=$this->load->view('IPD2/print_ipd_form4',$data,TRUE);
+ }else{
+ $content="";
+ }
+
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }
+
+ public function ipd_list()
+ {
+ $this->load->view('IPD2/ipd_all_list');
+ }
+
+ public function addipd($pno)
+ {
+ $sql="select count(*) as no_ipd from ipd_master where ipd_status=0 and p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['ipd_master_rec']= $query->result();
+
+ if ($data['ipd_master_rec'][0]->no_ipd > 0)
+ {
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ redirect('IpdNew/ipd_panel/'.$data['ipd_info'][0]->id);
+ }else{
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_spec_l']= $query->result();
+
+ $sql="select id,concat('Bed No:',bed_no,'/','[',room_name,']') as Bed_Desc from hc_bed_master where bed_used_p_id=0";
+ $query = $this->db->query($sql);
+ $data['ipd_bed_list']= $query->result();
+
+ $sql="select * from hc_insurance ";
+ $query = $this->db->query($sql);
+ $data['insur_list']= $query->result();
+
+ $sql="select * from organization_case_master
+ where status=0 and case_type=1 and ipd_id=0 and p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from refer_master where active=1";
+ $query = $this->db->query($sql);
+ $data['refer_master']= $query->result();
+
+
+ $this->load->view('IPD2/Ipd_Registration_V',$data);
+ }
+
+ }
+
+ public function AddNew() {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $data['master'] = array(
+ 'p_id' => $this->input->post('pid'),
+ 'P_name' => $this->input->post('pname'),
+ 'relation' => $this->input->post('r_relation'),
+ 'contact_person_Name' => $this->input->post('rp_name'),
+ 'insurance_id' => $this->input->post('insur_list'),
+ 'policy_no' => $this->input->post('insur_no'),
+ 'register_date' => str_to_MysqlDate($this->input->post('res_date')),
+ 'problem' => $this->input->post('problem'),
+ 'remark' => $this->input->post('remark'),
+ 'P_mobile1' => $this->input->post('phone1'),
+ 'P_mobile2' => $this->input->post('phone2'),
+ 'case_type' => $this->input->post('optionsRadios_mlc'),
+ 'case_id' => $this->input->post('optionsRadios_org'),
+ 'reg_time' => $this->input->post('res_time'),
+ 'refer_by' => $this->input->post('refer_by_list')
+ );
+
+ $groupData = $this->input->post('doc_id');
+
+ if (isset($groupData) && !empty($groupData)) {
+ $data['doc_list']=$groupData;
+
+ $inser_id=$this->Ipd_M->insert($data);
+
+ $data['BedData'] = array(
+ 'ipd_id' => $inser_id,
+ 'Fdate' => date('Y-m-d h:i:s'),
+ 'TDate' => date('Y-m-d h:i:s'),
+ 'bed_id' => $this->input->post('room_list')
+ );
+
+ if($this->input->post('room_list')<>"")
+ {
+ $inser_bed_id=$this->Ipd_M->bedassign($data['BedData']);
+ }
+ }
+ else
+ {
+ $inser_id=0;
+ }
+
+ if($this->input->post('optionsRadios_org')>0 && $inser_id>0)
+ {
+ $org_data = array(
+ 'ipd_id' => $inser_id,
+ );
+
+ $this->load->model('Ocasemaster_M');
+ $this->Ocasemaster_M->update($org_data,$this->input->post('optionsRadios_org'));
+ }
+
+$rvar=array(
+'insertid' =>$inser_id
+);
+$encode_data = json_encode($rvar);
+echo $encode_data;
+}
+
+ public function ipd_bed_assign_list($ipdno)
+ {
+ $sql="select m.bed_no,m.room_name,b.Fdate,b.TDate,b.Remark
+ from ipd_bed_assign b join hc_bed_master m on b.bed_id=m.id where b.ipd_id=".$ipdno;
+ $query = $this->db->query($sql);
+ $data['ipd_bed_assign']= $query->result();
+
+ $sql="select id,concat('Bed No:',bed_no,'/','[',room_name,']') as Bed_Desc from hc_bed_master where bed_used_p_id=0";
+ $query = $this->db->query($sql);
+ $data['ipd_bed_list']= $query->result();
+
+
+ $this->load->view('IPD2/ipd_bed_assign',$data);
+
+ }
+
+
+ public function ipd_cash_print_pdf($ipd_id,$payid)
+ {
+ $sql="select *,date_format(payment_date,'%d-%m-%Y %h:%i %p') as payment_date_str ,
+ if(credit_debit=0,'','Return') as Amount_str
+ from payment_history where payof_type=4 and payof_id=$ipd_id and id=$payid";
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+ $sql="select * from ipd_master where id =".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $pno=$data['ipd_master'][0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $data['ipd_id']=$ipd_id;
+ $data['payid']=$payid;
+
+ //load mPDF library
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name='Charge_Invoice-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ $content=$this->load->view('IPD2/ipd_payment_receipt_print',$data,TRUE);
+
+ //echo $content;
+
+ //$this->m_pdf->pdf->debug = true;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output("TEST.pdf","I");
+ }
+
+ public function load_model_box($ipd_id)
+ {
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days,if(case_type=1,'MLC','Non MLC') as case_type_s, Date_format(register_date,'%d-%m-%Y') as str_register_date from ipd_master where id='".$ipd_id."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) as str_age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select s.id,s.pay_type,m.bank_name
+ From hospital_bank m join hospital_bank_payment_source s on m.id=s.bank_id";
+ $query = $this->db->query($sql);
+ $data['bank_data']= $query->result();
+
+ $this->load->view('IPD2/ipd_model_payment_box',$data);
+ }
+
+
+
+ public function ipd_bed_list()
+ {
+ $sql="select id,concat('Bed No:',bed_no,'/','[',room_name,']') as Bed_Desc from hc_bed_master where bed_used_p_id=0";
+
+ $query = $this->db->query($sql);
+ $ipd_bed_list= $query->result();
+
+ echo '';
+
+ foreach($ipd_bed_list as $row)
+ {
+ echo ''.$row->Bed_Desc.' ';
+ }
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ }
+
+ public function load_model_ded_box()
+ {
+ $this->load->view('IPD2/ipd_panel_deduction_payment');
+ }
+
+
+
+ public function discharge_update()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $discharge_by=$user_name.'['.$user_id.']';
+
+ $data['master'] = array(
+ 'discharge_by' => $discharge_by,
+ 'discharge_remark' => $this->input->post('discharge_remark'),
+ 'discharge_balance_user' => $this->input->post('input_bal_user'),
+ 'discharge_balance_remark' => $this->input->post('input_bal_remark'),
+ 'ipd_status' => '1',
+ 'discharge_date' => str_to_MysqlDate($this->input->post('dis_date')),
+ 'discharge_time' => $this->input->post('dis_time'),
+ 'discarge_patient_status' => $this->input->post('p_status')
+ );
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Discharge Status Updated."
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function update_ipdadmit_time()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $ipd_id=$this->input->post('Ipd_ID');
+
+ $data['master'] = array(
+ 'register_date' => str_to_MysqlDate($this->input->post('strdate')),
+ 'reg_time' => $this->input->post('strtime')
+ );
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Admit Date Updated"
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function update_relative_update()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $Ipd_ID=$this->input->post('Ipd_ID');
+ $P_mobile1=$this->input->post('P_mobile1');
+ $P_mobile2=$this->input->post('P_mobile2');
+ $contact_person_Name=$this->input->post('contact_person_Name');
+ $case_type=$this->input->post('case_type');
+
+ $data['master'] = array(
+ 'contact_person_Name' => $contact_person_Name,
+ 'P_mobile1' => $P_mobile1,
+ 'P_mobile2' => $P_mobile2,
+ 'case_type' => $case_type
+ );
+
+ $this->Ipd_M->update($data['master'],$Ipd_ID);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Admit Date Updated"
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function discharge_ipd($ipdno)
+ {
+ $sql="select * from ipd_master where id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select * from ipd_discharg_status ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_status']= $query->result();
+
+ $discount=$data['ipd_info'][0]->Discount;
+
+ $sql="select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$data['ipd_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+
+ if($data['ipd_info'][0]->ipd_status == 0 )
+ {
+ $this->load->view('IPD2/ipd_discharge',$data);
+ }else{
+ $this->load->view('IPD2/ipd_discharged_status',$data);
+ }
+
+
+ }
+
+ public function getIpdTable()
+ {
+
+ $requestData= $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 =>'ipd_code',
+ 1 => 'p_code',
+ 2 => 'p_fname',
+ 3=> 'admit_type',
+ 4=> 'insurance_no_1',
+ 5=> 'doc_name',
+ 6=> 'Disstatus',
+ 7=> 'str_register_date',
+ 8=> 'str_discharge_date',
+ 9=> 'status_desc'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select * ";
+
+ $sql_count="Select count(*) as no_rec ";
+
+ $sql_from=" from v_ipd_list ";
+
+ $total_sql=$sql_count.$sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec']= $query->result();
+ $totalData=$data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where=" WHERE 1 = 1";
+
+ $sql_where_flag=0;
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][0]['search']['value']) ){ //ipd_code
+ $sql_where.=" AND ipd_code LIKE '%".$requestData['columns'][0]['search']['value']."' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][1]['search']['value']) ){ //p_code
+ $sql_where.=" AND p_code LIKE '".$requestData['columns'][1]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][2]['search']['value']) ){ //p_fname
+ $sql_where.=" AND p_fname LIKE '%".$requestData['columns'][2]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][3]['search']['value']) ){ //P_mobile1
+ $sql_where.=" AND (admit_type LIKE '%".$requestData['columns'][3]['search']['value']."%'
+ or ins_company_name LIKE '%".$requestData['columns'][3]['search']['value']."%')";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][4]['search']['value']) ){ //P_mobile1
+ $sql_where.=" AND insurance_no_1 LIKE '%".$requestData['columns'][4]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][5]['search']['value']) ){ //P_mobile1
+ $sql_where.=" AND doc_name LIKE '%".$requestData['columns'][5]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][7]['search']['value']) )
+ { //IPD Admit Date Range
+ $rangeArray = explode("/",$requestData['columns'][7]['search']['value']);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+ $admitType = $rangeArray[2];
+ if($admitType==0){
+ $sql_where.=" AND ( Date(register_date) between '".$minRange."' AND '".$maxRange."' ) ";
+ }elseif($admitType==1){
+ $sql_where.=" AND ( Date(discharge_date) between '".$minRange."' AND '".$maxRange."' ) ";
+ }else{
+ $sql_where.=" AND (( Date(register_date) between '".$minRange."' AND '".$maxRange."' ) ";
+ $sql_where.=" OR ( Date(discharge_date) between '".$minRange."' AND '".$maxRange."' )) ";
+ }
+
+ $sql_where_flag=1;
+ }
+
+ $total_filer_sql=$sql_count.$sql_from.$sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered=$data['total_rec_filter'][0]->no_rec;
+
+ $sql_order=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+ $Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata= $query->result_array();
+
+ $output = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach($rdata as $aRow)
+ {
+ $row = array();
+
+ foreach($columns as $col)
+ {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function discount_update($dis_no)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $Discount_By=$user_name.'['.$user_id.']'.date('d-m-Y');
+
+ if($dis_no==1)
+ {
+ $data['master'] = array(
+ 'Discount_By' => $Discount_By,
+ 'Discount_Remark' => $this->input->post('Discount_Remark'),
+ 'Discount' => $this->input->post('Discount')
+ );
+ }elseif($dis_no==2){
+ $data['master'] = array(
+ 'Discount_By2' => $Discount_By,
+ 'Discount_Remark2' => $this->input->post('Discount_Remark'),
+ 'Discount2' => $this->input->post('Discount')
+ );
+ }elseif($dis_no==3){
+ $data['master'] = array(
+ 'Discount_By3' => $Discount_By,
+ 'Discount_Remark3' => $this->input->post('Discount_Remark'),
+ 'Discount3' => $this->input->post('Discount')
+ );
+ }
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Discount Status Updated."
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function charge_update($dis_no)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $charge_by=$user_name.'['.$user_id.']'.date('d-m-Y');
+
+ if($dis_no==1)
+ {
+ $data['master'] = array(
+ 'charge_by1' => $charge_by,
+ 'charge1' => $this->input->post('input_charge_remark1'),
+ 'chargeamount1' => $this->input->post('input_charge_Amount1')
+ );
+ }elseif($dis_no==2){
+ $data['master'] = array(
+ 'charge_by2' => $charge_by,
+ 'charge2' => $this->input->post('input_charge_remark2'),
+ 'chargeamount2' => $this->input->post('input_charge_Amount2')
+ );
+ }
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Charge Status Updated."
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function readmit($dis_no)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $charge_by=$user_name.'['.$user_id.']'.date('d-m-Y');
+
+ if($dis_no==2)
+ {
+ $data['master'] = array(
+ 'ipd_status' => '0'
+ );
+ }
+
+ $ipd_id=$this->input->post('Ipd_ID');
+ $this->Ipd_M->update($data['master'],$ipd_id);
+
+ $inser_id=1;
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'showcontent' => "Status Updated."
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function add_bed_room()
+ {
+ $room_list=$this->input->post('room_list');
+ $Ipd_ID=$this->input->post('Ipd_ID');
+
+
+ $data = array(
+ 'ipd_id' => $this->input->post('Ipd_ID'),
+ 'Fdate' => $this->input->post('start_datetime'),
+ 'TDate' => $this->input->post('end_datetime'),
+ 'bed_id' => $this->input->post('room_list')
+ );
+
+ $inser_id=$this->Ipd_M->bedassign($data);
+
+ $sql="select m.bed_no,m.room_name,b.Fdate,b.TDate,b.Remark
+ from ipd_bed_assign b join hc_bed_master m on b.bed_id=m.id where b.ipd_id=".$Ipd_ID;
+
+ $query = $this->db->query($sql);
+ $room_assign_info= $query->result();
+
+ $r_data='
+
+
+
+ Bed No.
+ Description
+ Date
+ Vacant Date
+
+
+ ';
+
+ for ($i = 0; $i < count($room_assign_info); ++$i) {
+ $r_data=$r_data.'
+ '.$room_assign_info[$i]->bed_no.'
+ '.$room_assign_info[$i]->room_name.'
+ '.$room_assign_info[$i]->Fdate.'
+ '.$room_assign_info[$i]->TDate.'
+ ';
+ }
+
+ $r_data=$r_data.'
';
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ //echo $encode_data;
+ echo $r_data;
+
+ }
+
+ public function list_med_inv($ipd_id)
+ {
+ $sql="select * from invoice_med_master where ipd_credit=1 and ipd_id = ".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_credit']= $query->result();
+
+ $data['ipd_id']=$ipd_id;
+
+ $this->load->view('IPD2/IPD_Medical_Invoice_Panel',$data);
+ }
+
+ public function list_med_inv_details($ipd_id,$inv_med_id)
+ {
+ $sql="select * from invoice_med_master where ipd_credit=1 and id='".$inv_med_id."' and ipd_id = ".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_credit']= $query->result();
+
+ $sql="select * from inv_med_item where inv_med_id='".$inv_med_id."'";
+ $query = $this->db->query($sql);
+ $data['inv_master_credit_details']= $query->result();
+
+ $this->load->view('IPD2/ipd_medical_invoice_short',$data);
+ }
+
+
+ public function Update_Invoice_ipd_credit_type()
+ {
+ $ipd_credit_type= $this->input->post('ipd_credit_type');
+ $inv_id = $this->input->post('inv_id');
+
+ $dataupdate = array(
+ 'ipd_include' => $ipd_credit_type
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$inv_id);
+ }
+
+
+ //Org. Update
+
+ public function IPD_Invoice_Edit($IPD_ID)
+ {
+ $sql="select * from v_ipd_list
+ where id=".$IPD_ID;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $ins_comp_id=$data['ipd_master'][0]->insurance_id;
+
+ if($ins_comp_id=='' || $ins_comp_id == null)
+ {
+ $ins_comp_id=0;
+ }
+
+ $sql="select i.*,t.group_desc
+ from ipd_invoice_item i join ipd_item_type t on i.item_type=t.itype_id
+ where i.ipd_id=".$IPD_ID;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from ipd_invoice_item where ipd_id=".$IPD_ID;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,concat(d.p_fname,' [',group_concat(m.SpecName),']') as DocSpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id order by d.p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from med_spec order by SpecName";
+ $query = $this->db->query($sql);
+ $data['med_spec']= $query->result();
+
+ $sql="select m.id,Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',
+ if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_comp_id and isdelete=0
+ where m.itype=1 order by m.idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_1']= $query->result();
+
+ $sql="select m.id,Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',
+ if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_comp_id and isdelete=0
+ where m.itype=2 order by m.idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_2']= $query->result();
+
+ $sql="select m.id,Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',
+ if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_comp_id and isdelete=0
+ where m.itype=5 order by m.idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_5']= $query->result();
+
+ $sql="select m.id,Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',
+ if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_comp_id and isdelete=0
+ where m.itype=3 order by m.idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_3']= $query->result();
+
+ $sql="select m.id,Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',
+ if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_comp_id and isdelete=0
+ where m.itype=6 order by m.idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_6']= $query->result();
+
+ $sql="select m.id,Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',
+ if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_comp_id and isdelete=0
+ where m.itype=7 order by m.idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_7']= $query->result();
+
+ $sql="select m.id,Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',
+ if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_comp_id and isdelete=0
+ where m.itype=8 order by m.idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_8']= $query->result();
+
+ $sql="select m.id,Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',
+ if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_comp_id and isdelete=0
+ where m.itype=10 order by m.idesc ";
+ $query = $this->db->query($sql);
+ $data['item_list_10']= $query->result();
+
+ $sql="select * from ipd_item_type ";
+ $query = $this->db->query($sql);
+ $data['item_list_cat']= $query->result();
+
+ $data['ins_comp_id']=$ins_comp_id;
+
+ $this->load->view('IPD2/ipd_invoice_items',$data);
+ }
+
+ public function ipd_package($ipd_id)
+ {
+
+ $sql="select * from v_ipd_list
+ where id=$ipd_id";
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $ins_comp_id=$data['ipd_master'][0]->insurance_id;
+
+ if($ins_comp_id=='' || $ins_comp_id == null)
+ {
+ $ins_comp_id=0;
+ }
+
+
+ $sql="SELECT m.id,m.ipd_pakage_name,m.Pakage_Min_Amount,i.hc_insurance_id,
+ i.code,if(i.hc_insurance_id is null,m.Pakage_Min_Amount,i.i_amount) as amount1,
+ if(i.hc_insurance_id is null,Concat(' Rs. ',m.Pakage_Min_Amount),Concat('[ Rs. ',i.i_amount,' /Org.Code ',i.code,']')) as org_code
+ from package m left join package_insurance i
+ on m.id=i.hc_items_id and i.hc_insurance_id=$ins_comp_id order by m.ipd_pakage_name" ;
+ $query = $this->db->query($sql);
+ $data['package_list']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,concat(d.p_fname,' [',group_concat(m.SpecName),']') as DocSpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id order by d.p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $this->load->view('IPD2/ipd_package',$data);
+ }
+
+ public function show_Package($ipd_id)
+ {
+ $sql="select * from ipd_package where ipd_id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_package']= $query->result();
+
+ echo '';
+
+ }
+
+ public function ipd_package_showitem($type)
+ {
+
+
+ $ipd_id=$this->input->post('ipd_id');
+ $pack_id=$this->input->post('package_id');
+ $package_name=$this->input->post('package_name');
+ $comment=$this->input->post('comment');
+ $package_desc=$this->input->post('comment');
+
+ $sql="select * from v_ipd_list
+ where id=$ipd_id";
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $ins_comp_id=$data['ipd_master'][0]->insurance_id;
+
+ if($ins_comp_id=='' || $ins_comp_id == null)
+ {
+ $ins_comp_id=0;
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']'.' D:'.date('d-m-Y h:i:s');
+
+ if($type==1)
+ {
+ $sql="SELECT m.id,m.ipd_pakage_name,m.Pakage_Min_Amount,i.hc_insurance_id,
+ i.code,if(i.hc_insurance_id is null,m.Pakage_Min_Amount,i.i_amount) as amount1,
+ if(i.hc_insurance_id is null,Concat(' Rs. ',m.Pakage_Min_Amount),Concat('[ Rs. ',i.i_amount,' /Org.Code ',i.code,']')) as org_code,
+ i.code
+ from package m left join package_insurance i
+ on m.id=i.hc_items_id and i.hc_insurance_id=$ins_comp_id
+ WHERE m.id=$pack_id";
+
+ $query = $this->db->query($sql);
+ $package= $query->result();
+
+ $item_custom_amount=$this->input->post('input_amount');
+ $date_item=$this->input->post('date_item');
+ $org_code='';
+
+ if($pack_id>1)
+ {
+ $package_desc=$package[0]->Pakage_description;
+ $package_name=$package[0]->ipd_pakage_name;
+ $item_amount=$package[0]->amount1;
+ $org_code=$package[0]->code;
+ }
+
+ if($date_item=='')
+ {
+ $date_item=date('Y-m-d');
+ }
+
+ if($item_custom_amount>0)
+ {
+ $item_amount=$item_custom_amount;
+ }
+
+ $data['insert_package'] = array(
+ 'ipd_id' => $ipd_id,
+ 'package_id' => $pack_id,
+ 'package_name' => $package_name,
+ 'package_desc' => $package_desc,
+ 'package_Amount' => $item_amount,
+ 'comment' => $comment,
+ 'update_by' => $user_name,
+ 'ins_id'=> $ins_comp_id,
+ 'org_code'=> $org_code
+ );
+ $inser_id=$this->Ipd_M->insert_package( $data['insert_package']);
+
+ }elseif($type==2)
+ {
+ $amount_value=$this->input->post('input_amount');
+ $data['update_package'] = array(
+ 'package_Amount' => $amount_value
+ );
+
+ $inser_id=$this->Ipd_M->update_package( $data['update_package'],$this->input->post('itemid'));
+
+ }else{
+ echo $this->Ipd_M->deletepackage($this->input->post('itemid'));
+ //$this->db->delete("invoice_item", "id=".$this->input->post('itemid'));
+ }
+
+ }
+
+ public function doc_ipd_fee($doc_id)
+ {
+ $sql="select * from doc_ipd_fee where isdelete=0 and doc_fee_type=2 and doc_id= ".$doc_id." order by doc_fee_desc ";
+ $query = $this->db->query($sql);
+ $doc_fee= $query->result();
+
+ foreach($doc_fee as $row)
+ {
+ echo ''.$row->doc_fee_desc.'[Rs. '.$row->amount.'] ';
+ }
+
+ }
+
+ public function ipd_items_bytype()
+ {
+ $tid=$this->input->post('itype_idv');
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from ipd_items where itype=".$tid." order by idesc ";
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ echo '
+ Test Name
+ ';
+ foreach($data['labitem'] as $row)
+ {
+ echo ''.$row->sdesc.' ';
+ }
+ echo '
';
+ }
+
+ public function ipd_showitem($type)
+ {
+
+
+ $ipd_id=$this->input->post('ipd_id');
+ $item_id=$this->input->post('itype_name_id');
+
+ $ins_id=$this->input->post('ins_id');
+
+ if($ins_id=='')
+ {
+ $ins_id=0;
+ }
+
+ if($type==1)
+ {
+
+ $sql="select m.id,m.idesc,
+ if(i.id is null,'',i.code) as org_code, if(i.hc_insurance_id is null,m.amount,i.amount1) AS amount1
+ from (ipd_items m join ipd_item_type t on m.itype=t.itype_id)
+ left join ipd_items_insurance i on m.id=i.hc_items_id AND hc_insurance_id=$ins_id and isdelete=0
+ where m.id=$item_id ";
+ $query = $this->db->query($sql);
+ $itemlist= $query->result();
+
+ if(count($itemlist)>0)
+ {
+ $item_rate=$itemlist[0]->amount1;
+ $item_name=$itemlist[0]->idesc;
+ $org_code=$itemlist[0]->org_code;
+ }else{
+ $item_rate=$this->input->post('input_rate');
+ $item_name=$this->input->post('itype_name');
+ $org_code='';
+ }
+
+ $item_custom_rate=$this->input->post('input_rate');
+ $date_item=$this->input->post('date_item');
+
+ if($date_item=='')
+ {
+ $date_item=date('Y-m-d');
+ }
+
+ if($item_custom_rate>0)
+ {
+ $item_rate=$item_custom_rate;
+ }
+
+ $amount_value=$this->input->post('input_qty')*$item_rate;
+
+ $doc_id=$this->input->post('doc_id');
+
+ if($doc_id<1)
+ {
+ $refername=$this->input->post('refername');
+ }else{
+ $sql="select * from doctor_master where id=".$doc_id;
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+ $refername=$data['doc_master'][0]->p_fname;
+ }
+
+ $item_id=$this->input->post('itype_name_id');
+
+ $data['insert_invoice_item'] = array(
+ 'ipd_id' => $ipd_id,
+ 'item_type' => $this->input->post('itype_idv'),
+ 'item_id' => $this->input->post('itype_name_id'),
+ 'item_name' => $item_name,
+ 'item_rate' => $item_rate,
+ 'item_added_date' => date('Y-m-d h:i:s'),
+ 'item_qty' => $this->input->post('input_qty'),
+ 'item_amount' => $amount_value,
+ 'doc_id' => $this->input->post('doc_id'),
+ 'doc_name' => $refername,
+ 'date_item' => $date_item,
+ 'comment' => $this->input->post('comment'),
+ 'ins_id' => $ins_id,
+ 'org_code' => $org_code,
+ );
+
+ $sql="Select * from ipd_invoice_item
+ where ipd_id=$ipd_id and item_id=$item_id and item_rate=$item_rate and doc_id=$doc_id" ;
+ $query = $this->db->query($sql);
+ $rec_exist= $query->result();
+
+ if(count($rec_exist)>0)
+ {
+ $inser_id=0;
+ }else{
+ $inser_id=$this->Ipd_M->insert_ipd_item( $data['insert_invoice_item']);
+ }
+
+
+ }elseif($type==2)
+ {
+ $amount_value=$this->input->post('update_qty') * $this->input->post('item_rate');
+
+ $data['update_invoice_item'] = array(
+ 'item_qty' => $this->input->post('update_qty'),
+ 'item_amount' => $amount_value
+ );
+
+ $inser_id=$this->Ipd_M->update_ipd_item( $data['update_invoice_item'],$this->input->post('itemid'));
+
+ }else{
+
+ $inser_id= $this->Ipd_M->deleteIpdinvoiceitem($this->input->post('itemid'));
+ //$this->db->delete("invoice_item", "id=".$this->input->post('itemid'));
+ }
+
+ echo $inser_id;
+
+ }
+
+ public function show_ipd_items($ipd_id)
+ {
+ $sql="select * from v_ipd_list where id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from ipd_package where ipd_id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_package']= $query->result();
+
+ //package_select
+ $select_package_content="";
+
+ $ins_comp_id=$data['ipd_master'][0]->insurance_id;
+
+ $sql="select t.group_desc,i.*,sum(i.item_amount) as xAmount
+ from ipd_invoice_item i join ipd_item_type t on i.item_type=t.itype_id
+ where i.ipd_id=".$ipd_id."
+ group by i.item_type,i.id with rollup";
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from ipd_invoice_item where ipd_id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ echo '';
+ echo ' ';
+
+ }
+
+
+ public function remove_refer($r_id)
+ {
+ if ($this->ion_auth->in_group('IPDReferUpdate')) {
+ $this->Ipd_M->remove_refer_ipd($r_id);
+ }
+ }
+
+ public function add_refer($ipd_id,$refer_by)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $Update_user = $user->first_name.' '. $user->last_name.' ['.$user_id.'] '.date('Y-m-d H:i:s');
+
+ if ($this->ion_auth->in_group('IPDAdmit')) {
+
+ $sql="select *
+ from refer_master
+ where id=$refer_by";
+ $query = $this->db->query($sql);
+ $refer_master= $query->result();
+
+ if(count($refer_master)>0){
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $data = array(
+ 'ipd_id' => $ipd_id,
+ 'refer_by' => $refer_by,
+ 'refer_type' => $refer_master[0]->refer_type,
+ 'refer_name' => $refer_master[0]->f_name,
+ 'update_by' => $Update_user,
+ );
+ $inser_id=$this->Ipd_M->insert_refer_ipd($data);
+ }
+
+
+ }
+ }
+
+ public function Update_Refer($ipd_id,$refer_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $update_refer=array(
+ 'refer_by'=>$refer_id
+ );
+
+ $this->Ipd_M->update($update_refer,$ipd_id);
+
+ }
+
+ public function update_org_doc()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $org_id=$this->input->post('org_id');
+ $feild=$this->input->post('feild');
+ $fvalue=$this->input->post('fvalue');
+
+ $this->load->model('Ocasemaster_M');
+
+ $update_ipd=array(
+ $feild=>$fvalue
+ );
+
+ $this->Ocasemaster_M->update($update_ipd,$org_id);
+
+ }
+
+ }
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Ipd_Report.php b/old_code_ci3/controllers/Ipd_Report.php
new file mode 100644
index 0000000..508c07b
--- /dev/null
+++ b/old_code_ci3/controllers/Ipd_Report.php
@@ -0,0 +1,116 @@
+load->view('IPD_Report/ipd_balance_report');
+ }
+
+ public function Ipd_bal_panel_report($daterange,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" p.balance_amount>0 " ;
+
+ $where.=" and Direct_Cust=1 and p.ipd_status=1 and p.register_date between '".$minRange."' and '".$maxRange."' " ;
+
+ if(isset($doc_name))
+ {
+ if($doc_name_id>0)
+ {
+ $where.=" and FIND_IN_SET('".$doc_name_id."',doc_list) ";
+ }
+ }
+
+ $sql="select p.ipd_code,p.p_fname,Date_Format(p.register_date,'%d-%m-%Y') as str_register_date,p_code,p.Contact_info,
+ Date_Format(p.discharge_date,'%d-%m-%Y') as str_discharge_date,p.admit_type,p.doc_name,p.Bed_Desc,p.Direct_Cust,
+ p.net_amount,p.balance_amount,(p.org_amount_recived+p.total_paid_amount) as sum_of_paid
+ from v_ipd_list p where ".$where." group by p.p_id,p.doc_list order by id";
+
+ $query = $this->db->query($sql);
+ $dischargelist= $query->result();
+
+ $total_Payment=0.00;
+ $total_balance=0.00;
+
+ $content='';
+
+ $content.='
+ #
+ IPD Code
+ P Code
+ Person Name
+ Phone No.
+ Admit Date
+ Discharge Date
+ Doc. Name
+ Net Amount
+ Paid Amt.
+ Balance Amt.
+ TYPE
+ ';
+
+ $sr_no=0;
+ foreach($dischargelist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->ipd_code.'
+ '.$row->p_code.'
+ '.$row->p_fname.'
+ '.$row->Contact_info.'
+ '.$row->str_register_date.'
+ '.$row->str_discharge_date.'
+ '.$row->doc_name.'
+ '.$row->net_amount.'
+ '.$row->sum_of_paid.'
+ '.$row->balance_amount.'
+ '.$row->admit_type.'
+ ';
+ $total_Payment+= $row->sum_of_paid;
+ $total_balance+= $row->balance_amount;
+ }
+
+ $content.='
+ #
+
+
+
+
+
+
+
+ Total
+ '.$total_Payment.'
+ '.$total_balance.'
+
+ ';
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+ $file_name="IPD_Balance_List-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($content,'IPD_Balance_List_'.date('dmYHis'));
+ }
+
+
+
+ }
+
+ }
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Ipd_discharge.php b/old_code_ci3/controllers/Ipd_discharge.php
new file mode 100644
index 0000000..2c3d936
--- /dev/null
+++ b/old_code_ci3/controllers/Ipd_discharge.php
@@ -0,0 +1,3564 @@
+load->model('ipdDischarge_M');
+ $this->load->model('Ipd_M');
+ $this->load->model('Patient_M');
+ }
+
+ public function search_ipd()
+ {
+ $this->load->view('IPD_Discharge/main');
+ }
+
+ public function search_ipd_result()
+ {
+ $sdata = $this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ $sql_where = "";
+
+ if (trim($sdata) == '') {
+ $sql = "select * from v_ipd_list order by id desc limit 200";
+ } else {
+ if (!$this->ion_auth->in_group('IPDOLD')) {
+ $sql_where = " and Date(register_date) > '2019-03-31'";
+ }
+
+ $sql = "select * from v_ipd_list
+ where ipd_code like '%" . $sdata . "' or p_code LIKE '%" . $sdata . "'
+ OR p_fname LIKE '%" . $sdata . "%'
+ OR doc_name LIKE '%" . $sdata . "%'
+ " . $sql_where . "
+ group by id order by id desc limit 100";
+ }
+
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $this->load->view('IPD_Discharge/search_ipd_result', $data);
+ }
+
+ public function ipd_select($ipdno, $re_create = 0)
+ {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $sql = "select * from hc_department order by vName ";
+ $query = $this->db->query($sql);
+ $data['hc_department'] = $query->result();
+
+ $sql = "select * from ipd_discharg_status ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_status'] = $query->result();
+
+ $sql = "select * from v_ipd_list where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $ipd_create = $data['ipd_master'][0]->ipd_create;
+
+ if ($ipd_create == 1 && $re_create == 0) {
+ redirect('Ipd_discharge/preview_discharge_report/' . $ipdno);
+ return true;
+ }
+
+
+ /*$dataupdate = array(
+ 'discharge_time'=>date('H:i'),
+ );
+
+ $this->Ipd_M->update($dataupdate,$ipdno);
+ */
+
+
+ $p_id = $data['ipd_master'][0]->p_id;
+ $ipd_admit_date = $data['ipd_master'][0]->register_date;
+
+ $sql = "select * from patient_master where id=$p_id ";
+ $query = $this->db->query($sql);
+ $data['Pdata'] = $query->result();
+
+ if ($data['ipd_master'][0]->discharge_date == null || $data['ipd_master'][0]->discharge_date == '0000-00-00' || $data['ipd_master'][0]->discharge_date == '1901-01-01') {
+ $ipd_discharge_date = date('Y-m-d');
+ } else {
+ $ipd_discharge_date = $data['ipd_master'][0]->discharge_date;
+ }
+
+ $sql = "select * from ipd_discharge
+ where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge'] = $query->result();
+
+ //Surgery
+ $sql = "select * from ipd_discharge_surgery where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_surgery'] = $query->result();
+
+ //Procedure
+ $sql = "select * from ipd_discharge_procedure where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_procedure'] = $query->result();
+
+ if (count($data['ipd_discharge']) == 0) {
+ $datainsert = array(
+ 'ipd_id' => $ipdno,
+ 'created_datetime' => $user_name . '[' . $user_id . ']',
+ );
+ $this->ipdDischarge_M->insert_ipdDischarge($datainsert);
+ }
+
+ //General examination
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,
+ if(d.rdata is null,col_pre_value,d.rdata) as rdata_text,g.col_type,col_pre_value,d.rdata
+ from ipd_discharge_general_exam_col g left join ipd_discharge_1_b d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "' where cat_group=1";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_general_exam_col_1'] = $query->result();
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,g.col_type,col_pre_value,
+ if(d.rdata is null,col_pre_value,d.rdata) as rdata_text,g.col_type,col_pre_value,d.rdata
+ from ipd_discharge_general_exam_col g left join ipd_discharge_1_b d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "' where cat_group=2";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_general_exam_col_2'] = $query->result();
+
+ $sql = "select g.id,g.sys_exam_name,g.sys_format,d.rdata
+ from ipd_discharge_sys_exam g left join ipd_discharge_1_a d on g.id=d.head_id and d.ipd_d_id='" . $ipdno . "' where g.id=9 ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_sys_exam'] = $query->result();
+
+ //ipd_discharge_1_d
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,g.col_type,col_pre_value,
+ if(d.rdata is null,col_pre_value,d.rdata) as rdata_text,g.col_type,col_pre_value,d.rdata
+ from ipd_discharge_investigation_during_admit g left join ipd_discharge_1_d d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "' where cat_group=1";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_investigation_during_admit'] = $query->result();
+
+ //ipd_discharge_1_e
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,g.col_type,col_pre_value,
+ if(d.rdata is null,col_pre_value,d.rdata) as rdata_text,g.col_type,col_pre_value,d.rdata
+ from ipd_discharge_special_investigation g left join ipd_discharge_1_e d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "' where cat_group=1";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_special_investigation'] = $query->result();
+
+ //Examination at the time of Discharge
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,
+ if(d.rdata is null,col_pre_value,d.rdata) as rdata_text
+ from ipd_discharge_general_exam_col g left join ipd_discharge_1_b_final d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_exam_on_discharge_col'] = $query->result();
+
+ //CLINICAL INVESTIGATION REPORTS
+
+ $sql = "select * from ipd_discharge_2 where ipd_d_id='" . $ipdno . "' and CHAR_LENGTH(lab_investigation_list)>0 ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_2'] = $query->result();
+
+ $lab_list = "0";
+ if (count($data['ipd_discharge_2']) > 0) {
+ $lab_list = $data['ipd_discharge_2'][0]->lab_investigation_list;
+ }
+
+ $sql = "select *,if(id in (" . $lab_list . "),'checked','') as chked from lab_request where patient_id=" . $p_id . "
+ and (ipd_id=" . $ipdno . " or (Request_Date between '" . $ipd_admit_date . "' and '" . $ipd_discharge_date . "' ))";
+
+ $sql = " SELECT QUOTE(m.inv_date) AS sDate, date_format(m.inv_date,'%d-%m-%Y') AS sInd_Date,
+ group_CONCAT(t.Test ORDER BY t.Test) AS test_list,if(m.inv_date in (" . $lab_list . "),'checked','') as chked
+ FROM (((invoice_master m JOIN lab_request l ON m.id=l.charge_id)
+ JOIN lab_request_item i ON l.id=i.lab_request_id)
+ JOIN lab_tests t ON i.lab_test_id=t.mstTestKey)
+ JOIN ipd_discharge_investigation_template d ON t.TestID=d.test_code
+ WHERE m.attach_id=" . $p_id . " and m.inv_date between '" . $ipd_admit_date . "' and '" . $ipd_discharge_date . "'
+ GROUP BY m.inv_date";
+
+ echo $sql;
+
+ $query = $this->db->query($sql);
+ $data['lab_request'] = $query->result();
+
+ $sql = "select * from ipd_discharge_2 where ipd_d_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_2'] = $query->result();
+
+
+ //Presenting Complaints with Duration and Reason for Admission
+
+ $sql = "select * from ipd_discharge_complaint where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_complaint'] = $query->result();
+
+ $sql = "select * from ipd_discharge_complaint_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_complaint_remark'] = $query->result();
+
+ //Final Diagnosis at the time of Discharge
+
+ $sql = "select * from ipd_discharge_diagnosis where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_diagnosis'] = $query->result();
+
+ $sql = "select * from ipd_discharge_diagnosis_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_diagnosis_remark'] = $query->result();
+
+ //Summary of key investigtions during Hospitalization
+
+ $sql = "select * from ipd_discharge_investigtions_inhos where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_investigtions_inhos'] = $query->result();
+
+
+ //Course in the hospital
+
+ $sql = "select * from ipd_discharge_course where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_course'] = $query->result();
+
+ $sql = "select * from ipd_discharge_course_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_course_remark'] = $query->result();
+
+ //Discharge Medications
+
+ $sql = "select * from ipd_discharge_drug where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_drug'] = $query->result();
+
+ //Discharge Medications New Method
+ $sql = "SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((ipd_discharge_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.ipd_id='" . $ipdno . "' order by pt.id";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_prescrption_prescribed'] = $query->result();
+ $data1['ipd_discharge_prescrption_prescribed'] = $data['ipd_discharge_prescrption_prescribed'];
+
+ $data['ipd_discharge_prescrption_prescribed_content'] = $this->load->view('IPD_Discharge/ipd_prescription', $data1, true);
+
+ //Discharge Instructions
+
+ $sql = "select * from ipd_discharge_instructions where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_instructions'] = $query->result();
+
+ //Discharge FOOD DRUG INTERACTION
+ $sql = "select * from ipd_discharge_drug_food_interaction where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_drug_food_interaction'] = $query->result();
+
+ $food_list = "0";
+ if (count($data['ipd_discharge_drug_food_interaction']) > 0) {
+ if (strlen($data['ipd_discharge_drug_food_interaction'][0]->food_id_list) > 0) {
+ $food_list = $data['ipd_discharge_drug_food_interaction'][0]->food_id_list;
+ }
+ }
+
+ $sql = "SELECT m.id,m.food_short,if(m.id IN (" . $food_list . "),'Checked','') AS food_exist,food_desc
+ FROM ipd_discharge_master_food m ";
+ $query = $this->db->query($sql);
+ $data['dis_food_interaction'] = $query->result();
+
+ $foot_banner_list = "0";
+ if (count($data['ipd_discharge_instructions']) > 0) {
+ if (strlen($data['ipd_discharge_instructions'][0]->footer_banner) > 0) {
+ $foot_banner_list = $data['ipd_discharge_instructions'][0]->footer_banner;
+ }
+ }
+
+ $sql = "SELECT m.id,m.banner_name,if(m.id IN (" . $foot_banner_list . "),'Checked','') AS banner_exist
+ FROM ipd_discharge_banner m ";
+ $query = $this->db->query($sql);
+ $data['dis_banner_list'] = $query->result();
+
+ //IPD discharge Medicince prescribed
+ $sql = "select * from opd_dose_shed ";
+ $query = $this->db->query($sql);
+ $data['opd_dose_shed'] = $query->result();
+
+ $sql = "select * from opd_dose_when";
+ $query = $this->db->query($sql);
+ $data['opd_dose_when'] = $query->result();
+
+ $sql = "select * from opd_dose_frequency";
+ $query = $this->db->query($sql);
+ $data['opd_dose_frequency'] = $query->result();
+
+ $sql = "select * from opd_dose_where";
+ $query = $this->db->query($sql);
+ $data['opd_dose_where'] = $query->result();
+
+ $sql = "select * from opd_dose_duration";
+ $query = $this->db->query($sql);
+ $data['opd_dose_duration'] = $query->result();
+
+ $sql = "select * from med_formulation";
+ $query = $this->db->query($sql);
+ $data['med_formulation'] = $query->result();
+
+ $sql = "SELECT o.id,o.next_visit_desc,DATE_ADD(CURDATE(),INTERVAL o.no_of_days DAY) AS next_date,
+ Concat(next_visit_desc,' (', Date_Format(DATE_ADD(CURDATE(),INTERVAL o.no_of_days DAY),'%d-%m-%Y') ,')') as next_visit_day
+ FROM opd_nextvisit o order by no_of_days";
+ $query = $this->db->query($sql);
+ $data['opd_nextvisit'] = $query->result();
+
+ //IPD discharge Medicince prescribed End
+
+
+ $this->load->view('IPD_Discharge/ipd_discharge_edit', $data);
+ }
+
+
+ // Get Combo Value
+
+ public function get_complaints()
+ {
+
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from complaints_master where Name like '%" . $q . "%' ";
+
+ $sql = $sql . " limit 20";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['Name']));
+ $new_row['value'] = htmlentities(stripslashes($row['Name']));
+
+ $new_row['complaints_no'] = htmlentities(stripslashes($row['Code']));
+
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ // Get Combo Value
+
+ public function get_hospital_course_master()
+ {
+
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from hospital_course_master where Name like '%" . $q . "%' ";
+
+ $sql = $sql . " limit 20";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['Name']));
+ $new_row['value'] = htmlentities(stripslashes($row['Name']));
+
+ $new_row['complaints_no'] = htmlentities(stripslashes($row['Code']));
+
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+
+ public function get_surgery()
+ {
+
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from surgery where Name like '%" . $q . "%' ";
+
+ $sql = $sql . " limit 20";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['Name']));
+ $new_row['value'] = htmlentities(stripslashes($row['Name']));
+
+ $new_row['surgery_no'] = htmlentities(stripslashes($row['Code']));
+
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_drug_timing()
+ {
+
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from drug_timing where dosage_desc like '%" . $q . "%' or dosage_code like '" . $q . "%' ";
+
+ $sql = $sql . " limit 20";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['dosage_desc']));
+ $new_row['value'] = htmlentities(stripslashes($row['dosage_desc']));
+
+ $new_row['surgery_no'] = htmlentities(stripslashes($row['id']));
+
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_disease()
+ {
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from disease_master where Name like '%" . $q . "%' order by Name";
+
+ $sql = $sql . " limit 20";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['Name']));
+ $new_row['value'] = htmlentities(stripslashes($row['Name']));
+
+ $new_row['complaints_no'] = htmlentities(stripslashes($row['Code']));
+
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_medical()
+ {
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from local_medical where med_name like '%" . $q . "%' order by med_name";
+
+ $sql = $sql . " limit 20";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['med_name']));
+ $new_row['value'] = htmlentities(stripslashes($row['med_name']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ // Data Saving
+
+ public function update_Sys_Exam()
+ {
+ $editor_Sys_Exam = $this->input->post('editor_Sys_Exam');
+ $IPD_id = $this->input->post('IPD_id');
+ $sys_exam_id = $this->input->post('sys_exam_id');
+
+ $sql = "select * from ipd_discharge_sys_exam where id=" . $sys_exam_id;
+ $query = $this->db->query($sql);
+ $short_head_sys_exam = $query->result();
+
+ $short_head = "";
+ if (count($short_head_sys_exam) > 0) {
+ $short_head = $short_head_sys_exam[0]->sys_exam_name;
+ }
+
+ $datainsert = array(
+ 'ipd_d_id' => $IPD_id,
+ 'head_id' => $sys_exam_id,
+ 'short_head' => $short_head,
+ 'rdata' => $editor_Sys_Exam,
+ );
+
+ $sql = "select * from ipd_discharge_1_a where ipd_d_id=" . $IPD_id . " and head_id=" . $sys_exam_id;
+ $query = $this->db->query($sql);
+ $chk_exist = $query->result();
+
+ if (count($chk_exist) > 0) {
+ $this->ipdDischarge_M->update_ipd_discharge_1_a($datainsert, $chk_exist[0]->id);
+ } else {
+ $this->ipdDischarge_M->insert_ipd_discharge_1_a($datainsert);
+ }
+
+ echo 'Saved';
+ }
+
+ public function update_investigation_m_Exam()
+ {
+
+ $IPD_id = $this->input->post('gen_exam_ipd_id');
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,
+ if(d.id is null,1,0) as insert_data
+ from ipd_discharge_investigation_during_admit g
+ left join ipd_discharge_1_d d on g.id=d.col_id and d.ipd_d_id=" . $IPD_id;
+ $query = $this->db->query($sql);
+ $discharge_general_exam = $query->result();
+
+ foreach ($discharge_general_exam as $row) {
+ $rdata = $this->input->post('input_m_exam_' . $row->id);
+
+ $datainsert = array(
+ 'ipd_d_id' => $IPD_id,
+ 'col_id' => $row->id,
+ 'short_head' => $row->col_name,
+ 'rdata' => $rdata,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_1_d($datainsert, $IPD_id, $row->id);
+ }
+
+ echo 'Saved';
+ }
+
+ public function update_investigation_s_Exam()
+ {
+
+ $IPD_id = $this->input->post('gen_exam_ipd_id');
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,
+ if(d.id is null,1,0) as insert_data
+ from ipd_discharge_special_investigation g
+ left join ipd_discharge_1_e d on g.id=d.col_id and d.ipd_d_id=" . $IPD_id;
+ $query = $this->db->query($sql);
+ $discharge_general_exam = $query->result();
+
+ foreach ($discharge_general_exam as $row) {
+ $rdata = $this->input->post('input_s_exam_' . $row->id);
+
+ $datainsert = array(
+ 'ipd_d_id' => $IPD_id,
+ 'col_id' => $row->id,
+ 'short_head' => $row->col_name,
+ 'rdata' => $rdata,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_1_e($datainsert, $IPD_id, $row->id);
+ }
+
+ echo 'Saved';
+ }
+
+ public function update_gen_Exam()
+ {
+
+ $IPD_id = $this->input->post('gen_exam_ipd_id');
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,
+ if(d.id is null,1,0) as insert_data
+ from ipd_discharge_general_exam_col g
+ left join ipd_discharge_1_b d on g.id=d.col_id and d.ipd_d_id=" . $IPD_id;
+ $query = $this->db->query($sql);
+ $discharge_general_exam = $query->result();
+
+ foreach ($discharge_general_exam as $row) {
+ $rdata = $this->input->post('input_g_exam_' . $row->id);
+
+ $datainsert = array(
+ 'ipd_d_id' => $IPD_id,
+ 'col_id' => $row->id,
+ 'short_head' => $row->col_name,
+ 'rdata' => $rdata,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_1_b($datainsert, $IPD_id, $row->id);
+ }
+
+ echo 'Saved';
+ }
+
+
+ public function update_dis_Exam()
+ {
+
+ $IPD_id = $this->input->post('dis_exam_ipd_id');
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,
+ if(d.id is null,1,0) as insert_data
+ from ipd_discharge_general_exam_col g
+ left join ipd_discharge_1_b_final d on g.id=d.col_id and d.ipd_d_id=" . $IPD_id;
+ $query = $this->db->query($sql);
+ $discharge_general_exam = $query->result();
+
+ foreach ($discharge_general_exam as $row) {
+ $rdata = $this->input->post('input_d_exam_' . $row->id);
+
+ $datainsert = array(
+ 'ipd_d_id' => $IPD_id,
+ 'col_id' => $row->id,
+ 'short_head' => $row->col_name,
+ 'rdata' => $rdata,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_1_b_final($datainsert, $IPD_id, $row->id);
+ }
+
+ echo 'Saved';
+ }
+
+ public function update_Provisional_Exam()
+ {
+ $editor_data = $this->input->post('editor_data');
+ $ipd_id = $this->input->post('ipd_id');
+ $lab_investigation_list = $this->input->post('lab_investigation_list');
+
+ $lab_investigation_list = str_replace(":", ",", $lab_investigation_list);
+
+ $short_head = "Other Examinations or Provisional Diagnosis";
+
+ $datainsert = array(
+ 'ipd_d_id' => $ipd_id,
+ 'lab_investigation_list' => $lab_investigation_list,
+ 'short_head' => $short_head,
+ 'rdata' => $editor_data,
+ );
+
+ $return_id = $this->ipdDischarge_M->update_insert_ipd_discharge_2($datainsert, $ipd_id);
+
+ echo 'Saved : With Return Code ->' . $return_id;
+ }
+
+ //Save Personal History
+
+ public function update_personal_history()
+ {
+ $p_id = $this->input->post('p_id');
+
+ $opd_prescription_smoking_chk = $this->input->post('opd_prescription_smoking_chk');
+ $opd_prescription_alcohol_chk = $this->input->post('opd_prescription_alcohol_chk');
+ $opd_prescription_tobacoo_chk = $this->input->post('opd_prescription_tobacoo_chk');
+ $opd_prescription_drug_chk = $this->input->post('opd_prescription_drug_chk');
+ $opd_prescription_hypertesion_chk = $this->input->post('opd_prescription_hypertesion_chk');
+ $opd_prescription_niddm_chk = $this->input->post('opd_prescription_niddm_chk');
+ $opd_prescription_hbsag_chk = $this->input->post('opd_prescription_hbsag_chk');
+ $opd_prescription_hcv_chk = $this->input->post('opd_prescription_hcv_chk');
+ $opd_prescription_hiv_I_II_chk = $this->input->post('opd_prescription_hiv_I_II_chk');
+
+ $dataPatientMaster = array(
+ 'is_smoking' => $opd_prescription_smoking_chk,
+ 'is_alcohol' => $opd_prescription_alcohol_chk,
+ 'is_drug_abuse' => $opd_prescription_drug_chk,
+ 'is_tobacoo' => $opd_prescription_tobacoo_chk,
+ 'is_hypertesion' => $opd_prescription_hypertesion_chk,
+ 'is_niddm' => $opd_prescription_niddm_chk,
+ 'is_hbsag' => $opd_prescription_hbsag_chk,
+ 'is_hcv' => $opd_prescription_hcv_chk,
+ 'is_hiv_I_II' => $opd_prescription_hiv_I_II_chk,
+ );
+
+ $this->Patient_M->update($dataPatientMaster, $p_id);
+
+ echo 'Saved ';
+ }
+
+
+ //FOOD_DRUG_INTERACTION
+
+ public function update_food_interaction()
+ {
+ $editor_data = $this->input->post('editor_data');
+
+ $ipd_id = $this->input->post('ipd_id');
+ $food_interaction_list = $this->input->post('food_interaction_list');
+
+ $food_interaction_list = str_replace(":", ",", $food_interaction_list);
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'food_id_list' => $food_interaction_list,
+ 'food_text' => $editor_data,
+ );
+
+ $return_id = $this->ipdDischarge_M->update_insert_ipd_discharge_drug_food_interaction($datainsert, $ipd_id);
+
+ echo 'Saved : With Return Code ->' . $return_id;
+ }
+
+ //Footer Banner
+
+ public function update_footer_banner()
+ {
+ $editor_data = $this->input->post('editor_data');
+
+ $ipd_id = $this->input->post('ipd_id');
+ $footer_banner_list = $this->input->post('footer_banner_list');
+
+ $footer_banner_list = str_replace(":", ",", $footer_banner_list);
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'footer_banner' => $footer_banner_list,
+ );
+
+ $return_id = $this->ipdDischarge_M->update_insert_ipd_discharge_instructions($datainsert, $ipd_id);
+
+ echo 'Saved : With Return Code ->' . $return_id;
+ }
+
+
+
+ //Compalint Part Add Update Renove
+
+ public function add_complaints()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $complaint = $this->input->post('input_complaints');
+ $complaint_value = $this->input->post('input_complaints_value');
+ $complaint_remarks = $this->input->post('input_complaints_remarks');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'comp_code' => $complaint_value,
+ 'comp_report' => $complaint,
+ 'comp_remark' => $complaint_remarks,
+ 'update_by' => $user_name
+ );
+
+ $this->ipdDischarge_M->insert_p_complaint($datainsert);
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_complaint where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "';
+
+ echo $content;
+ }
+
+
+ public function update_complaint()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $complaint_remarks = $this->input->post('complaint_remarks');
+ $complaint = $this->input->post('complaint');
+ $ipd_id = $this->input->post('ipd_id');
+ $rec_id = $this->input->post('invACode');
+
+ $sql = "select * from ipd_discharge_complaint where id=" . $rec_id . " and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "Nothing Done";
+
+ if (count($dataRec) > 0) {
+ $dataupdate = array(
+ 'comp_remark' => $complaint_remarks,
+ 'comp_report' => $complaint,
+ 'update_by' => $user_name
+ );
+
+
+ $this->ipdDischarge_M->update_p_complaint($dataupdate, $rec_id);
+
+ $content = "Update Done";
+ }
+
+ echo $content;
+ }
+
+
+ public function remove_complaint($invRecID, $ipd_id)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from ipd_discharge_complaint where ipd_id=" . $ipd_id . " and id=" . $invRecID;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ if (count($dataRec) > 0) {
+ $this->ipdDischarge_M->remove_p_complaint($invRecID);
+ }
+
+ $content = "';
+
+ echo $content;
+ }
+
+ public function update_complaint_edit()
+ {
+ $editor_Sys_Exam = $this->input->post('editor_Sys_Exam');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'comp_remark' => $editor_Sys_Exam,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_complaint_remark($datainsert, $ipd_id);
+
+ echo 'Saved';
+ }
+
+ //procedure Update and Add
+ public function add_procedure()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $input_procedure_name = $this->input->post('input_procedure_name');
+ $input_procedure_id = $this->input->post('input_procedure_id');
+ $input_procedure_remark = $this->input->post('input_procedure_remark');
+ $procedure_date = $this->input->post('procedure_date');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'procedure_id' => $input_procedure_id,
+ 'procedure_name' => $input_procedure_name,
+ 'procedure_remark' => $input_procedure_remark,
+ 'procedure_date' => str_to_MysqlDate($procedure_date),
+ 'update_by' => $user_name
+ );
+
+ $this->ipdDischarge_M->insert_p_procedure($datainsert);
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_procedure where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_procedure'] = $query->result();
+
+ $content = $this->load->view('IPD_Discharge/ipd_procedure', $data, true);
+
+ echo $content;
+ }
+
+
+ public function update_procedure()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $procedure_name = $this->input->post('procedure_name');
+ $procedure_remark = $this->input->post('procedure_remark');
+ $procedure_date = $this->input->post('procedure_date');
+
+ $ipd_id = $this->input->post('ipd_id');
+ $rec_id = $this->input->post('invACode');
+
+ $sql = "select * from ipd_discharge_procedure where id=" . $rec_id . " and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "Nothing Done";
+
+ if (count($dataRec) > 0) {
+ $dataupdate = array(
+ 'procedure_name' => $procedure_name,
+ 'procedure_remark' => $procedure_remark,
+ 'procedure_date' => str_to_MysqlDate($procedure_date),
+ 'update_by' => $user_name
+ );
+
+ $this->ipdDischarge_M->update_p_procedure($dataupdate, $rec_id);
+
+ $content = "Update Done";
+ }
+
+ echo $content;
+ }
+
+ public function remove_procedure($invRecID, $ipd_id)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from ipd_discharge_procedure where ipd_id=" . $ipd_id . " and id=" . $invRecID;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ if (count($dataRec) > 0) {
+ $this->ipdDischarge_M->remove_p_procedure($invRecID);
+ }
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_procedure where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_procedure'] = $query->result();
+
+ $content = $this->load->view('IPD_Discharge/ipd_procedure', $data, true);
+
+ echo $content;
+ }
+
+ //surgery Update and Add
+ public function add_surgery()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $input_surgery_name = $this->input->post('input_surgery_name');
+ $input_surgery_id = $this->input->post('input_surgery_id');
+ $input_surgery_remark = $this->input->post('input_surgery_remark');
+ $surgery_date = $this->input->post('surgery_date');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'surgery_id' => $input_surgery_id,
+ 'surgery_name' => $input_surgery_name,
+ 'surgery_remark' => $input_surgery_remark,
+ 'surgery_date' => str_to_MysqlDate($surgery_date),
+ 'update_by' => $user_name
+ );
+
+ $this->ipdDischarge_M->insert_p_surgery($datainsert);
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_surgery where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_surgery'] = $query->result();
+
+ $content = $this->load->view('IPD_Discharge/ipd_surgery', $data, true);
+
+ echo $content;
+ }
+
+
+ public function update_surgery()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $surgery_name = $this->input->post('surgery_name');
+ $surgery_remark = $this->input->post('surgery_remark');
+ $surgery_date = $this->input->post('surgery_date');
+
+ $ipd_id = $this->input->post('ipd_id');
+ $rec_id = $this->input->post('invACode');
+
+ $sql = "select * from ipd_discharge_surgery where id=" . $rec_id . " and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "Nothing Done";
+
+ if (count($dataRec) > 0) {
+ $dataupdate = array(
+ 'surgery_name' => $surgery_name,
+ 'surgery_remark' => $surgery_remark,
+ 'surgery_date' => str_to_MysqlDate($surgery_date),
+ 'update_by' => $user_name
+ );
+
+ $this->ipdDischarge_M->update_p_surgery($dataupdate, $rec_id);
+
+ $content = "Update Done";
+ }
+
+ echo $content;
+ }
+
+ public function remove_surgery($invRecID, $ipd_id)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from ipd_discharge_surgery where ipd_id=" . $ipd_id . " and id=" . $invRecID;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ if (count($dataRec) > 0) {
+ $this->ipdDischarge_M->remove_p_surgery($invRecID);
+ }
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_surgery where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_surgery'] = $query->result();
+
+ $content = $this->load->view('IPD_Discharge/ipd_surgery', $data, true);
+
+ echo $content;
+ }
+
+ //Delivery Update
+ public function update_delivery()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Ipd_M');
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $ipd_id = $this->input->post('ipd_id');
+ $isdelivery = $this->input->post('isdelivery');
+ $delivery_date = $this->input->post('delivery_date');
+ $delivery_time = $this->input->post('delivery_time');
+ $delivery_sex_of_baby = $this->input->post('delivery_sex_of_baby');
+ $delivery_sex_of_baby2 = $this->input->post('delivery_sex_of_baby2');
+ $delivery_sex_of_baby3 = $this->input->post('delivery_sex_of_baby3');
+
+
+ $dataupdate = array(
+ 'isdelivery' => $isdelivery,
+ 'delivery_time' => $delivery_time,
+ 'delivery_date' => str_to_MysqlDate($delivery_date),
+ 'delivery_sex_of_baby' => $delivery_sex_of_baby,
+ 'delivery_sex_of_baby2' => $delivery_sex_of_baby2,
+ 'delivery_sex_of_baby3' => $delivery_sex_of_baby3
+ );
+
+ $this->Ipd_M->update($dataupdate, $ipd_id);
+ $content = "Update Done";
+
+ echo $content;
+ }
+
+
+
+
+
+ //Delivery End
+
+
+
+
+ //diagnosis Part Add Update Renove
+
+ public function add_diagnosis()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $diagnosis = $this->input->post('input_diagnosis');
+ $diagnosis_value = $this->input->post('input_diagnosis_value');
+ $diagnosis_remarks = $this->input->post('input_diagnosis_remarks');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'comp_code' => $diagnosis_value,
+ 'comp_report' => $diagnosis,
+ 'comp_remark' => $diagnosis_remarks,
+ 'update_by' => $user_name
+ );
+
+ $this->ipdDischarge_M->insert_p_diagnosis($datainsert);
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_diagnosis where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "';
+
+ echo $content;
+ }
+
+
+ public function update_diagnosis()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $diagnosis_remarks = $this->input->post('diagnosis_remarks');
+ $diagnosis = $this->input->post('diagnosis');
+ $ipd_id = $this->input->post('ipd_id');
+ $rec_id = $this->input->post('invACode');
+
+ $sql = "select * from ipd_discharge_diagnosis where id=" . $rec_id . " and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "Nothing Done";
+
+ if (count($dataRec) > 0) {
+ $dataupdate = array(
+ 'comp_remark' => $diagnosis_remarks,
+ 'comp_report' => $diagnosis,
+ 'update_by' => $user_name
+ );
+
+
+ $this->ipdDischarge_M->update_p_diagnosis($dataupdate, $rec_id);
+
+ $content = "Update Done";
+ }
+
+ echo $content;
+ }
+
+
+ public function remove_diagnosis($invRecID, $ipd_id)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from ipd_discharge_diagnosis where ipd_id=" . $ipd_id . " and id=" . $invRecID;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ if (count($dataRec) > 0) {
+
+ $this->ipdDischarge_M->remove_p_diagnosis($invRecID);
+ }
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_diagnosis where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "';
+
+ echo $content;
+ }
+
+ public function update_diagnosis_edit()
+ {
+ $editor_Sys_Exam = $this->input->post('editor_Sys_Exam');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'comp_remark' => $editor_Sys_Exam,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_diagnosis_remark($datainsert, $ipd_id);
+
+ echo 'Saved';
+ }
+
+ //Summary of Key investigtion during Hospitalization
+ public function update_investigtions_inhos()
+ {
+ $editor_Sys_Exam = $this->input->post('editor_Sys_Exam');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'comp_remark' => $editor_Sys_Exam,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_investigtions_inhos($datainsert, $ipd_id);
+
+ echo 'Saved';
+ }
+
+ //Course in the Hospitalization
+
+
+ public function add_course()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $diagnosis = $this->input->post('input_course');
+ $diagnosis_value = $this->input->post('input_course_value');
+ $diagnosis_remarks = $this->input->post('input_course_remarks');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'comp_code' => $diagnosis_value,
+ 'comp_report' => $diagnosis,
+ 'comp_remark' => $diagnosis_remarks,
+ 'update_by' => $user_name
+ );
+
+ $this->ipdDischarge_M->insert_p_course($datainsert);
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_course where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "';
+
+ echo $content;
+ }
+
+
+ public function update_course()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $diagnosis_remarks = $this->input->post('course_remarks');
+ $comp_report = $this->input->post('course');
+ $ipd_id = $this->input->post('ipd_id');
+ $rec_id = $this->input->post('invACode');
+
+ $sql = "select * from ipd_discharge_course where id=" . $rec_id . " and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "Nothing Done";
+
+ if (count($dataRec) > 0) {
+ $dataupdate = array(
+ 'comp_remark' => $diagnosis_remarks,
+ 'comp_report' => $comp_report,
+ 'update_by' => $user_name
+ );
+
+
+ $this->ipdDischarge_M->update_p_course($dataupdate, $rec_id);
+
+ $content = "Update Done";
+ }
+
+ echo $content;
+ }
+
+
+ public function remove_course($invRecID, $ipd_id)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from ipd_discharge_course where ipd_id=" . $ipd_id . " and id=" . $invRecID;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ if (count($dataRec) > 0) {
+
+ $this->ipdDischarge_M->remove_p_course($invRecID);
+ }
+
+ $content = "";
+
+ $sql = "select * from ipd_discharge_course where ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "';
+
+ echo $content;
+ }
+
+ public function update_course_remark()
+ {
+ $editor_Sys_Exam = $this->input->post('editor_Sys_Exam');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'comp_remark' => $editor_Sys_Exam,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_course_remark($datainsert, $ipd_id);
+
+ echo 'Saved';
+ }
+
+
+ //Discharge Instructions
+ public function save_Instructions()
+ {
+ $editor_Sys_Exam = $this->input->post('editor_Sys_Exam');
+ $review_after = $this->input->post('input_next_visit');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'comp_remark' => $editor_Sys_Exam,
+ 'review_after' => $review_after,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_instructions($datainsert, $ipd_id);
+
+ echo 'Saved';
+ }
+
+
+
+ public function save_Footer()
+ {
+ $editor_Sys_Exam = $this->input->post('editor_Sys_Exam');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'footer_text' => $editor_Sys_Exam,
+ );
+
+ $this->ipdDischarge_M->update_insert_ipd_discharge_instructions($datainsert, $ipd_id);
+
+ echo 'Saved';
+ }
+
+ //Drugs
+
+ public function add_drug()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $input_med_name = strtoupper($this->input->post('input_med_name'));
+ $input_med_type = $this->input->post('input_med_type');
+ $input_dosage = $this->input->post('input_dosage');
+ $input_dosage_when = $this->input->post('input_dosage_when');
+ $input_dosage_freq = $this->input->post('input_dosage_freq');
+ $input_dose_where = $this->input->post('input_dose_where');
+ $input_no_of_days = $this->input->post('input_no_of_days');
+ $input_qty = $this->input->post('input_qty');
+ $input_remark = strtoupper($this->input->post('input_remark'));
+ $hid_med_id = $this->input->post('hid_med_id');
+ $ipd_id = $this->input->post('ipd_id');
+ $hid_ipd_med_item_id = $this->input->post('hid_ipd_med_item_id');
+ $input_med_salt = $this->input->post('input_med_salt');
+
+ $datainsert = array(
+ 'ipd_id' => $ipd_id,
+ 'med_id' => $hid_med_id,
+ 'med_name' => $input_med_name,
+ 'med_type' => $input_med_type,
+ 'med_salt' => $input_med_salt,
+ 'dosage' => $input_dosage,
+ 'dosage_when' => $input_dosage_when,
+ 'dosage_freq' => $input_dosage_freq,
+ 'dosage_where' => $input_dose_where,
+ 'qty' => $input_qty,
+ 'no_of_days' => $input_no_of_days,
+ 'remark' => $input_remark,
+ 'update_by' => $user_name
+ );
+
+ if ($hid_ipd_med_item_id > 0) {
+ $this->ipdDischarge_M->update_p_drug($datainsert, $hid_ipd_med_item_id);
+ } else {
+ $this->ipdDischarge_M->insert_p_drug($datainsert);
+ }
+
+
+
+ //Discharge Medications New Method
+ $sql = "SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((ipd_discharge_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.ipd_id='" . $ipd_id . "' order by pt.id ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_prescrption_prescribed'] = $query->result();
+
+ $content = $this->load->view('IPD_Discharge/ipd_prescription', $data, true);
+
+ echo $content;
+ }
+
+
+ public function update_drug()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $drug_remarks = $this->input->post('drug_remarks');
+ $ipd_id = $this->input->post('ipd_id');
+ $rec_id = $this->input->post('invACode');
+
+ $sql = "select * from ipd_discharge_drug where id=" . $rec_id . " and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $content = "Nothing Done";
+
+ if (count($dataRec) > 0) {
+ $dataupdate = array(
+ 'drug_dose' => $drug_remarks,
+ 'update_by' => $user_name
+ );
+
+
+ $this->ipdDischarge_M->update_p_drug($dataupdate, $rec_id);
+
+ $content = "Update Done";
+ }
+
+ echo $content;
+ }
+
+ public function remove_drug($invRecID, $ipd_id)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from ipd_discharge_prescrption_prescribed where ipd_id=" . $ipd_id . " and id=" . $invRecID;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ if (count($dataRec) > 0) {
+ $this->ipdDischarge_M->remove_p_drug($invRecID);
+ }
+
+ //Discharge Medications New Method
+ $sql = "SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((ipd_discharge_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.ipd_id='" . $ipd_id . "' Order by pt.id";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge_prescrption_prescribed'] = $query->result();
+
+ $content = $this->load->view('IPD_Discharge/ipd_prescription', $data, true);
+
+ echo $content;
+ }
+
+ public function medical_Select()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user->id . ']:T-' . date('d-m-Y h:m:s');
+
+ $ipd_id = $this->input->post('ipd_id');
+ $rec_id = $this->input->post('med_prec_id');
+
+ $sql = "select * from ipd_discharge_prescrption_prescribed
+ where id=" . $rec_id . " and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $dataRec = $query->result();
+
+ $rvar = array(
+ "id" => $dataRec[0]->id,
+ "ipd_id" => $ipd_id,
+ "med_name" => $dataRec[0]->med_name,
+ "med_type" => $dataRec[0]->med_type,
+ "dosage" => $dataRec[0]->dosage,
+ "dosage_when" => $dataRec[0]->dosage_when,
+ "dosage_freq" => $dataRec[0]->dosage_freq,
+ "no_of_days" => $dataRec[0]->no_of_days,
+ "qty" => $dataRec[0]->qty,
+ "remark" => $dataRec[0]->remark,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ //Chamunda Hospital
+ public function preview_discharge_report($ipdno)
+ {
+ $content = "";
+
+ $dataupdate = array(
+ 'ipd_create' => 1,
+ );
+
+ $this->Ipd_M->update($dataupdate, $ipdno);
+
+ $sql = "select * from v_ipd_list where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $sql = "select * from ipd_master where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_master_data = $query->result();
+
+ $p_id = $ipd_master[0]->p_id;
+ $ipd_admit_date = $ipd_master[0]->register_date;
+
+ $sql = "select * from patient_master_exten where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $patient_master = $query->result();
+
+ $sql = "select * from patient_master where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $patient_master_data = $query->result();
+
+
+ if ($ipd_master[0]->discharge_date == null || $ipd_master[0]->discharge_date == '0000-00-00' || $ipd_master[0]->discharge_date == '1901-01-01') {
+ $ipd_discharge_date = date('Y-m-d');
+ } else {
+ $ipd_discharge_date = $ipd_master[0]->discharge_date;
+ }
+
+ if ($ipd_master[0]->case_id == 0) {
+ $Discharge_time = date('h:i A', strtotime($ipd_master[0]->discharge_time));
+ $Reg_time = date('h:i A', strtotime($ipd_master[0]->reg_time));
+ } else {
+ $Discharge_time = '';
+ $Reg_time = '';
+ }
+
+ $data['Discharge_time'] = $Discharge_time;
+ $data['Reg_time'] = $Reg_time;
+
+
+ //IPD DEpartment
+
+ $dept_id = $ipd_master_data[0]->dept_id;
+
+ if ($dept_id == '') {
+ $dept_id = 1;
+ }
+
+ $sql = "select * from hc_department where iId=$dept_id";
+ $query = $this->db->query($sql);
+ $ipd_department = $query->result();
+
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge = $query->result();
+
+ $doc_list = $ipd_master[0]->doc_list;
+
+ $sql = "select d.id,d.p_fname,d.p_title,d.mphone1,d.mphone2,
+ if(d.gender=1,'Male','Female') as xgender,Get_Age(d.dob) as age,
+ d.dob,d.zip,d.email1,d.email2,
+ group_concat(distinct m.SpecName) as SpecName,d.doc_sign
+ from (doctor_master d left join (doc_spec s join med_spec m on s.med_spec_id=m.id) on d.id=s.doc_id)
+ where d.id in (" . $doc_list . ") group by d.id";
+ $query = $this->db->query($sql);
+ $doc_master = $query->result();
+
+ $depart_name = $ipd_department[0]->vName;
+
+ $doc_list_main_sign = '
+
+ Treating Consultant
+ ';
+
+ $row_num = 0;
+
+ // Doctor Name
+
+ foreach ($doc_master as $row) {
+ $row_num = $row_num + 1;
+
+ $mod_r = $row_num % 2;
+ if ($mod_r > 0) {
+ $doc_list_main_sign .= '';
+ }
+
+ $doc_list_main_sign .= '
+ Dr. ' . $row->p_fname . ' [' . $row->SpecName . ']
+ ' . nl2br($row->doc_sign) . '
+ ';
+
+ if ($mod_r == 0) {
+ $doc_list_main_sign .= ' ';
+ }
+ }
+
+ $row_num = $row_num + 1;
+ $mod_r = $row_num % 2;
+ if ($mod_r == 0) {
+
+ $doc_list_main_sign .= '
+ ';
+ }
+
+ $doc_list_main_sign .= "
";
+
+ $data['doc_list_main_sign'] = $doc_list_main_sign;
+
+ //Presenting Complaints with Duration and Reason for Admission
+
+ $sql = "select * from ipd_discharge_complaint where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_complaint = $query->result();
+
+ $sql = "select * from ipd_discharge_complaint_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_complaint_remark = $query->result();
+
+
+ //Surgery
+ $sql = "select * from ipd_discharge_surgery where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_surgery = $query->result();
+
+ //Prosedure
+ $sql = "select * from ipd_discharge_procedure where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_procedure = $query->result();
+
+ //General examination
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,d.ipd_d_id,g.col_unit
+ from ipd_discharge_general_exam_col g left join ipd_discharge_1_b d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "'
+ where CHAR_LENGTH(d.rdata)>0 ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_general_exam_col = $query->result();
+
+ $sql = "select g.id,g.sys_exam_name,g.sys_format,d.rdata
+ from ipd_discharge_sys_exam g left join ipd_discharge_1_a d on g.id=d.head_id and d.ipd_d_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_sys_exam = $query->result();
+
+
+ //CLINICAL INVESTIGATION REPORTS
+
+ $sql = "select * from ipd_discharge_2 where ipd_d_id='" . $ipdno . "' and CHAR_LENGTH(lab_investigation_list)>0";
+ $query = $this->db->query($sql);
+ $ipd_discharge_2 = $query->result();
+
+ $sql = "select * from ipd_discharge_2 where ipd_d_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_2_rdata = $query->result();
+
+ $lab_list = "";
+
+ if (count($ipd_discharge_2) > 0) {
+ $lab_list = $ipd_discharge_2[0]->lab_investigation_list;
+ }
+
+ if (strlen($lab_list) > 0) {
+ $lab_list_array = explode(",", $lab_list);
+ $sql_lab_test = "SELECT t.Test,t.Unit,t.FixedNormals";
+
+ foreach ($lab_list_array as $key => $value) {
+ $sql_lab_test .= "," . "group_concat(if(m.inv_date=" . $value . ",i.lab_test_value,null)) AS lab_test_value_" . $key;
+ }
+
+ $sql_lab_test .= " FROM ((((invoice_master m JOIN lab_request l ON m.id=l.charge_id)
+ JOIN lab_request_item i ON l.id=i.lab_request_id)
+ JOIN lab_tests t ON i.lab_test_id=t.mstTestKey)
+ JOIN ipd_discharge_investigation_template d ON t.TestID=d.test_code)
+ JOIN lab_rgroups g ON d.group_test=g.mstRGrpKey
+ WHERE m.attach_id=" . $p_id . " and m.inv_date IN (" . $lab_list . ")
+ GROUP BY d.test_code
+ ORDER BY g.sort_order,t.mstTestKey";
+ $query = $this->db->query($sql_lab_test);
+ $lab_request = $query->result_array();
+ }
+
+ //Final Diagnosis
+
+ $sql = "select * from ipd_discharge_diagnosis where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_diagnosis = $query->result();
+
+ $sql = "select * from ipd_discharge_diagnosis_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_diagnosis_remark = $query->result();
+
+ //Summary of key investigtions during Hospitalization
+
+ $sql = "select * from ipd_discharge_investigtions_inhos where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_investigtions_inhos = $query->result();
+
+ //Course in the hospital
+
+ $sql = "select * from ipd_discharge_course where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_course = $query->result();
+
+ $sql = "select * from ipd_discharge_course_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_course_remark = $query->result();
+
+ //Exam. in Discharge
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,g.col_unit
+ from ipd_discharge_general_exam_col g left join ipd_discharge_1_b_final d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "'
+ where CHAR_LENGTH(d.rdata)>0 ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_exam_on_discharge_col = $query->result();
+
+ //investigation Manual
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,g.col_unit
+ from ipd_discharge_investigation_during_admit g left join ipd_discharge_1_d d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "'
+ where CHAR_LENGTH(d.rdata)>0 ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_exam_on_discharge_col_1 = $query->result();
+
+ //investigation 2 Xray
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,g.col_unit
+ from ipd_discharge_special_investigation g left join ipd_discharge_1_e d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "'
+ where CHAR_LENGTH(d.rdata)>0 ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_exam_on_discharge_col_2 = $query->result();
+
+ //Discharge Medications
+
+ $sql = "select * from ipd_discharge_drug where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_drug = $query->result();
+
+ //Discharge Instructions
+
+ $sql = "select * from ipd_discharge_instructions where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_instructions = $query->result();
+
+ //Discharge FOOD DRUG INTERACTION
+ $sql = "select * from ipd_discharge_drug_food_interaction where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_drug_food_interaction = $query->result();
+
+ $food_list = "0";
+ if (count($ipd_discharge_drug_food_interaction) > 0) {
+ if (strlen($ipd_discharge_drug_food_interaction[0]->food_id_list) > 0) {
+ $food_list = $ipd_discharge_drug_food_interaction[0]->food_id_list;
+ }
+ }
+
+ $sql = "SELECT m.id,m.food_short,m.food_desc,m.food_desc_lang
+ FROM ipd_discharge_master_food m where m.id IN (" . $food_list . ")";
+ $query = $this->db->query($sql);
+ $dis_food_interaction = $query->result();
+
+ //Diet Advice
+
+ $data['diet_advice'] = "";
+ if (count($dis_food_interaction) > 0 || count($ipd_discharge_drug_food_interaction) > 0) {
+ $content = 'Dietary : ';
+ $content .= '';
+
+ foreach ($dis_food_interaction as $row) {
+ $content .= '' . $row->food_short . ' : ' . $row->food_desc_lang . ' ';
+ }
+ $content .= '
';
+
+ if ($ipd_discharge_drug_food_interaction[0]->food_text != '') {
+ $content .= $ipd_discharge_drug_food_interaction[0]->food_text;
+ }
+ $data['diet_advice'] = $content;
+ }
+
+
+
+ //Content Start
+ $sql = "SELECT * FROM ipd_discharg_status where id =" . $ipd_master[0]->discarge_patient_status;
+ $query = $this->db->query($sql);
+ $ipd_discharge_status = $query->result();
+
+ //HTML Style
+
+
+
+ if (count($ipd_discharge_status) < 1) {
+ $h1_head = '';
+ } else {
+ $h1_head = $ipd_discharge_status[0]->status_details;
+ }
+
+ $data['h1_head'] = $h1_head;
+ $data['depart_name'] = $depart_name;
+
+ if (D_discharge_doctor_name == 1) {
+ $data['Doc_Name_List'] = $doc_list_main_sign;
+ }
+
+ if ($ipd_master[0]->case_id == '0') {
+ $discharge_date_time = date('h:m A', strtotime($ipd_master[0]->discharge_time));
+ } else {
+ $discharge_date_time = '';
+ }
+
+ $discharge_date_time = $ipd_master[0]->discharge_time;
+
+ $p_address = "";
+
+ if (strlen($patient_master[0]->p_address) > 2) {
+ $p_address = " Address : " . $patient_master[0]->p_address;
+ }
+
+ if (strtoupper($patient_master[0]->blood_group) == 'NOT DEFINE') {
+ $blood_group_show = '';
+ } else {
+ $blood_group_show = 'Blood Group : ' . $patient_master[0]->blood_group;
+ }
+
+ $data['ipd_master'] = $ipd_master;
+
+ if (count($ipd_discharge_surgery) > 0) {
+ $data['Surgery'] = '';
+ $content = 'Surgery : ';
+ foreach ($ipd_discharge_surgery as $row) {
+ $content .= ' ' . $row->surgery_name . ' / Date of Surgery : ' . MysqlDate_to_str($row->surgery_date);
+ }
+ $content .= "
";
+ $data['Surgery'] = $content;
+ }
+
+ if (count($ipd_discharge_procedure) > 0) {
+ $data['Procedure'] = '';
+ $content = 'Procedure : ';
+
+ foreach ($ipd_discharge_procedure as $row) {
+ $content .= ' ' . $row->procedure_name . ' / Date of Procedure : ' . MysqlDate_to_str($row->procedure_date);
+ }
+
+ $content .= "
";
+
+ $data['Procedure'] = $content;
+ }
+
+ if ($ipd_master[0]->isdelivery == 1) {
+ $baby_desc = 'Sex of baby: ' . $ipd_master[0]->delivery_sex_of_baby . ' ';
+
+ if ($ipd_master[0]->delivery_sex_of_baby2 <> '') {
+ $baby_desc .= 'Sex of Second Baby :' . $ipd_master[0]->delivery_sex_of_baby2 . ' ';
+ }
+
+ if ($ipd_master[0]->delivery_sex_of_baby3 == '') {
+ $baby_desc .= 'Sex of Third Baby :' . $ipd_master[0]->delivery_sex_of_baby3 . '';
+ }
+
+ $content = '';
+ $content .= 'Child Birth : ';
+ $content .= 'Delivery Date and Time : ' . MysqlDate_to_str($ipd_master[0]->delivery_date) . ' ' . $ipd_master[0]->delivery_time;
+ $content .= ' ' . $baby_desc;
+
+ $data['isdelivery'] = $content;
+ }
+
+ //Presenting Complaints with Duration and Reason for Admission
+ if (count($ipd_discharge_complaint) > 0 || count($ipd_discharge_complaint_remark) > 0) {
+
+ $content = 'Presenting Complaints and Reason for Admission : ';
+
+ foreach ($ipd_discharge_complaint as $row) {
+ $content .= $row->comp_report . ' ';
+ $content .= '' . $row->comp_remark . ' ';
+ }
+
+ if (count($ipd_discharge_complaint_remark) > 0) {
+ if ($ipd_discharge_complaint_remark[0]->comp_remark != '') {
+ $content .= nl2br($ipd_discharge_complaint_remark[0]->comp_remark);
+ }
+ }
+
+ $content .= "
";
+
+
+ $data['discharge_complaint'] = $content;
+ }
+
+ //Provisional Diagnosis at the time of Admission
+ if (count($ipd_discharge_general_exam_col) > 0) {
+ $content = 'General Examination on Admission : ';
+
+ foreach ($ipd_discharge_general_exam_col as $row) {
+ $content .= $row->col_name . ' :' . $row->rdata . $row->col_unit . ' ';
+ }
+ $content .= '
';
+
+ $data['discharge_general_exam'] = $content;
+ }
+
+ foreach ($ipd_discharge_sys_exam as $row) {
+ $content = '';
+ if ($row->rdata == null || $row->rdata == '') {
+ } else {
+ //$content.=''.$row->sys_exam_name.'
';
+ $content = $row->rdata;
+ }
+
+ $data['discharge_sys_exam'] = $content;
+ }
+
+
+ //Personal History
+
+ $personal_history = '';
+
+ if ($patient_master_data[0]->is_smoking == 1) {
+ $personal_history .= 'Smoking ';
+ }
+
+ if ($patient_master_data[0]->is_alcohol == 1) {
+ $personal_history .= 'Alcoholic ';
+ }
+
+ if ($patient_master_data[0]->is_drug_abuse == 1) {
+ $personal_history .= 'Drug Abuse ';
+ }
+
+ if ($patient_master_data[0]->is_tobacoo == 1) {
+ $personal_history .= 'Tobacoo ';
+ }
+
+ if ($patient_master_data[0]->is_hypertesion == 1) {
+ $personal_history .= 'Hypertension';
+ }
+
+ if ($patient_master_data[0]->is_niddm == 1) {
+ $personal_history .= 'Type 2 DM';
+ }
+
+ if ($patient_master_data[0]->is_hbsag == 1) {
+ $personal_history .= 'HBsAg ';
+ }
+
+ if ($patient_master_data[0]->is_hcv == 1) {
+ $personal_history .= 'HCV ';
+ }
+
+ if ($patient_master_data[0]->is_hiv_I_II == 1) {
+ $personal_history .= 'HIV I-II ';
+ }
+
+ if ($patient_master_data[0]->Others == 1) {
+ $personal_history .= 'Others ';
+ }
+
+ if (strlen($personal_history) > 0) {
+ $content = "Personal History : " . $personal_history . "
";
+
+ $data['personal_history'] = $content;
+ }
+
+ //CLINICAL INVESTIGATION REPORTS
+ $data['lab_test_content'] = "Clinical Investigation Reports : ";
+ $content = '';
+ if (isset($lab_request)) {
+
+ $content .= '
+ ';
+ $content .= '';
+ $content .= 'Test Name ';
+ $content .= 'Fixed Normals ';
+ foreach ($lab_list_array as $key => $value) {
+ $content .= '' . MysqlDate_to_str(str_replace("'", "", $value)) . ' ';
+ }
+ $content .= ' ';
+
+ foreach ($lab_request as $row) {
+ $content .= '';
+ $content .= '' . $row['Test'] . ' ';
+ $content .= '' . $row['FixedNormals'] . ' ';
+ foreach ($lab_list_array as $key => $value) {
+ $content .= '' . $row['lab_test_value_' . $key] . ' ';
+ }
+ $content .= ' ';
+ }
+
+ $content .= '
';
+
+ if (isset($data['lab_test_content'])) {
+ $data['lab_test_content'] .= $content;
+ } else {
+ $data['lab_test_content'] = $content;
+ }
+ }
+
+ //investigation Manual
+ if (count($ipd_discharge_exam_on_discharge_col_1) > 0) {
+ $content = '';
+ foreach ($ipd_discharge_exam_on_discharge_col_1 as $row) {
+ $content .= '' . $row->col_name . ' : ' . $row->rdata . ' / ';
+ }
+ $content .= " ";
+
+ if (isset($data['lab_test_content'])) {
+ $data['lab_test_content'] .= $content;
+ } else {
+ $data['lab_test_content'] = $content;
+ }
+ }
+
+
+ //Manual X-Ray
+ if (count($ipd_discharge_exam_on_discharge_col_2) > 0) {
+ $content = '';
+ foreach ($ipd_discharge_exam_on_discharge_col_2 as $row) {
+ $content .= '' . $row->col_name . ': ' . $row->rdata . " ";
+ }
+
+ if (isset($data['lab_test_content'])) {
+ $data['lab_test_content'] .= $content;
+ } else {
+ $data['lab_test_content'] = $content;
+ }
+ }
+
+ if (count($ipd_discharge_2_rdata) > 0) {
+ $content = '';
+ if ($ipd_discharge_2_rdata[0]->rdata != '') {
+ $content .= '' . $ipd_discharge_2_rdata[0]->rdata . '
';
+ }
+ if (isset($data['lab_test_content'])) {
+ $data['lab_test_content'] .= $content;
+ } else {
+ $data['lab_test_content'] = $content;
+ }
+ }
+
+ $data['lab_test_content'] .= '';
+
+ //Final Diagnosis at the time of Discharge
+ $content = 'Final Diagnosis ';
+ if (count($ipd_discharge_diagnosis) > 0) {
+ foreach ($ipd_discharge_diagnosis as $row) {
+ $content .= ' ' . $row->comp_report . ' ';
+ if (strlen($row->comp_remark) > 0) {
+ $content .= '(' . $row->comp_remark . ') ';
+ }
+ }
+ }
+
+ if (count($ipd_discharge_diagnosis_remark) > 0) {
+ if ($ipd_discharge_diagnosis_remark[0]->comp_remark != '') {
+ $content .= ' ' . nl2br(trim($ipd_discharge_diagnosis_remark[0]->comp_remark));
+ }
+ }
+
+ $content .= "
";
+
+ $data['FinalDiagnosis'] = $content;
+
+ //Summary of key investigtions during Hospitalization
+ if (count($ipd_discharge_investigtions_inhos) > 0) {
+ $content = '';
+ if ($ipd_discharge_investigtions_inhos[0]->comp_remark != '') {
+ $content .= "Summary of key investigtions during Hospitalization ";
+ $content .= '' . $ipd_discharge_investigtions_inhos[0]->comp_remark . '
';
+ }
+
+ $data['discharge_investigtions_inhos'] = $content;
+ }
+
+ //Course in the hospital
+ if (count($ipd_discharge_course) > 0) {
+ $content = 'Course in the hospital ';
+ foreach ($ipd_discharge_course as $row) {
+ $content .= ' ' . $row->comp_report . ' ';
+ $content .= '' . $row->comp_remark . ' ';
+ }
+ $content .= "
";
+
+ $data['Course_in_the_hospital'] = $content;
+ }
+
+ if (count($ipd_discharge_course_remark) > 0) {
+ $content = '';
+ if ($ipd_discharge_course_remark[0]->comp_remark != '') {
+ $content .= '' . $ipd_discharge_course_remark[0]->comp_remark . '
';
+ }
+ if (isset($data['Course_in_the_hospital'])) {
+ $data['Course_in_the_hospital'] .= $content;
+ } else {
+ $data['Course_in_the_hospital'] = 'Course in the hospital ' . $content . "
";
+ }
+ }
+
+
+ //Exam in Discharge
+ if (count($ipd_discharge_exam_on_discharge_col) > 0) {
+ $content = 'Examination on Discharge : ';
+ $content .= '';
+
+ foreach ($ipd_discharge_exam_on_discharge_col as $row) {
+ $content .= $row->col_name . ': ' . $row->rdata . ' ' . $row->col_unit . ' / ';
+ }
+ $content .= '
';
+
+ $data['discharge_exam_on_discharge'] = $content;
+ }
+
+ //Discharge Medicince
+
+ $sql = "SELECT pt.* ,d.dose_show_sign AS dose_shed,d.dose_show_desc AS dose_shed_hindi,
+ dw.dose_sign_desc AS dose_when,dw.dose_sign_hindi AS dose_when_hindi,
+ df.dose_sign_desc AS dose_frequency,df.dose_sign_hindi AS dose_frequency_hindi,
+ d_on.dose_sign_desc AS dose_where,d_on.dose_sign_hindi AS dose_where_hindi,
+ m.genericname
+ FROM ((((ipd_discharge_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id)
+ LEFT JOIN opd_med_master m ON pt.med_id =m.id
+ where pt.ipd_id=" . $ipdno . " Order by pt.id";
+ $query = $this->db->query($sql);
+ $ipd_p_prescribed = $query->result();
+
+ $medical = '';
+ $sr_no = 1;
+ if (count($ipd_p_prescribed) > 0) {
+ $medical = "
Discharge Medications ";
+ $medical .= '
+
+
+
+ Medicine Name
+ Dosage
+ Qty
+ Day
+ ';
+
+ foreach ($ipd_p_prescribed as $row) {
+
+ $medical .= '
+
+ ' . $sr_no . ' - ' . $row->med_type . ' ' . $row->med_name . '
+ ' . $row->dose_shed . ' / ' . $row->dose_shed_hindi . ' ' . $row->dose_when_hindi . ' ' . $row->dose_frequency_hindi . '
+ ' . $row->qty . '
+ ' . $row->no_of_days . '
+ ';
+ $medical .= '
+
+ ';
+ if (strlen($row->genericname) > 0 || strlen($row->remark) > 0 || strlen($row->dose_shed_hindi) > 0) {
+ if (strlen($row->genericname) > 1) {
+ $medical .= 'Composition : ' . $row->genericname . ' ';
+ }
+
+ if (strlen($row->remark) > 0) {
+ $medical .= ' Notes : ' . $row->remark . ' ';
+ }
+ }
+
+ $medical .= '
+ ';
+
+ $sr_no = $sr_no + 1;
+ }
+ $medical .= "
";
+
+ $data['Discharge_Medications'] = $medical;
+ }
+
+
+ $foot_banner_list = "0";
+ $content = "";
+ //Discharge Instructions 1
+ if (count($ipd_discharge_instructions) > 0) {
+
+ $content .= 'Discharge Advice/Instructions/Summary
';
+
+ if ($ipd_discharge_instructions[0]->comp_remark <> '') {
+ $content .= $ipd_discharge_instructions[0]->comp_remark;
+ }
+
+ if (strlen($ipd_discharge_instructions[0]->review_after) > 0) {
+ $content .= 'Review after ' . $ipd_discharge_instructions[0]->review_after . ' days / as and when required
';
+ }
+
+ if (strlen($ipd_discharge_instructions[0]->footer_banner) > 0) {
+ $foot_banner_list = $ipd_discharge_instructions[0]->footer_banner;
+ }
+
+ if ($ipd_discharge_instructions[0]->footer_text != '') {
+ $content .= $ipd_discharge_instructions[0]->footer_text;
+ }
+
+ if ($foot_banner_list <> "0") {
+ $sql = "SELECT m.id,m.banner_name,m.banner_image_name
+ FROM ipd_discharge_banner m where m.id IN (" . $foot_banner_list . ") order by id desc";
+ $query = $this->db->query($sql);
+ $dis_banner_list = $query->result();
+
+ foreach ($dis_banner_list as $row) {
+ $content .= ' ';
+ }
+ }
+ }
+
+ $data['Discharge_Instructions'] = $content;
+
+ $content_html = $this->load->view('IPD_Discharge/' . D_discharge_content_format, $data, true);
+
+ // Update in Database
+ $dataupdate = array(
+ 'ipd_id' => $ipdno,
+ 'content' => $content_html
+ );
+ $this->ipdDischarge_M->update_ipdDischarge($dataupdate, $ipd_discharge[0]->id);
+
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge'] = $query->result();
+
+
+ $data['content'] = $content_html;
+
+ $this->load->view('IPD_Discharge/ipd_discharge_preview', $data);
+ }
+
+
+
+
+ //Report Format
+
+ public function create_discharge_report($ipdno)
+ {
+ $content = "";
+
+ $dataupdate = array(
+ 'ipd_create' => 1,
+ );
+
+ $this->Ipd_M->update($dataupdate, $ipdno);
+
+ $sql = "select * from v_ipd_list where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $sql = "select * from ipd_master where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_master_data = $query->result();
+
+ $p_id = $ipd_master[0]->p_id;
+ $ipd_admit_date = $ipd_master[0]->register_date;
+
+ $sql = "select * from patient_master_exten where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $patient_master = $query->result();
+
+
+ $sql = "select * from patient_master where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $patient_master_data = $query->result();
+
+ //IPD DEpartment
+
+ $dept_id = $ipd_master_data[0]->dept_id;
+
+ $sql = "select * from hc_department where iId=$dept_id";
+ $query = $this->db->query($sql);
+ $ipd_department = $query->result();
+
+ if ($ipd_master[0]->discharge_date == null || $ipd_master[0]->discharge_date == '0000-00-00' || $ipd_master[0]->discharge_date == '1901-01-01') {
+ $ipd_discharge_date = date('Y-m-d');
+ } else {
+ $ipd_discharge_date = $ipd_master[0]->discharge_date;
+ }
+
+ if ($ipd_master[0]->case_id == 0) {
+ $Discharge_time = date('h:m A', strtotime($ipd_master[0]->discharge_time));
+ $Reg_time = date('h:m A', strtotime($ipd_master[0]->reg_time));
+ } else {
+ $Discharge_time = '';
+ $Reg_time = '';
+ }
+
+
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge = $query->result();
+
+ $doc_list = $ipd_master[0]->doc_list;
+
+ $sql = "select d.id,d.p_fname,d.p_title,d.mphone1,d.mphone2,
+ if(d.gender=1,'Male','Female') as xgender,Get_Age(d.dob) as age,
+ d.dob,d.zip,d.email1,d.email2,
+ group_concat(distinct m.SpecName) as SpecName,d.doc_sign
+ from (doctor_master d left join (doc_spec s join med_spec m on s.med_spec_id=m.id) on d.id=s.doc_id)
+ where d.id in (" . $doc_list . ") group by d.id";
+ $query = $this->db->query($sql);
+ $doc_master = $query->result();
+
+
+ $depart_name = '
+
+
+ Department/Specialty : ' . $ipd_department[0]->vName . '
+
+
+
';
+
+
+ $doc_list = "";
+ $doc_list_sign = 'Treating Consultant / Authorized Team Doctor ';
+
+ $doc_list_main_sign = 'Treating Consultant/Department/Specialty ';
+
+ $row_num = 0;
+ foreach ($doc_master as $row) {
+ $row_num = $row_num + 1;
+
+ $doc_list .= "Dr. " . $row->p_fname . " [" . $row->SpecName . "] ";
+
+ $doc_list_sign .= '
+
+ Dr. ' . $row->p_fname . '
+ ' . $row->SpecName . '
+
+
+
+ Signature of Consultant
+ ';
+
+ $mod_r = $row_num % 2;
+ if ($mod_r > 0) {
+ $doc_list_main_sign .= '';
+ }
+
+ $doc_list_main_sign .= '
+ Dr. ' . $row->p_fname . ' [' . $row->SpecName . ']
+ ' . nl2br($row->doc_sign) . '
+ ';
+
+ if ($mod_r == 0) {
+ $doc_list_main_sign .= ' ';
+ }
+ }
+ $row_num = $row_num + 1;
+ $mod_r = $row_num % 2;
+ if ($mod_r == 0) {
+
+ $doc_list_main_sign .= '
+ ';
+ }
+
+
+ $doc_list_sign .= "
";
+
+ $doc_list_main_sign .= "
";
+
+ //Presenting Complaints with Duration and Reason for Admission
+
+ $sql = "select * from ipd_discharge_complaint where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_complaint = $query->result();
+
+ $sql = "select * from ipd_discharge_complaint_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_complaint_remark = $query->result();
+
+
+ //Surgery
+ $sql = "select * from ipd_discharge_surgery where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_surgery = $query->result();
+
+ //Prosedure
+ $sql = "select * from ipd_discharge_procedure where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_procedure = $query->result();
+
+ //General examination
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,d.ipd_d_id,g.col_unit
+ from ipd_discharge_general_exam_col g left join ipd_discharge_1_b d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "'
+ where CHAR_LENGTH(d.rdata)>0 ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_general_exam_col = $query->result();
+
+ $sql = "select g.id,g.sys_exam_name,g.sys_format,d.rdata
+ from ipd_discharge_sys_exam g left join ipd_discharge_1_a d on g.id=d.head_id and d.ipd_d_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_sys_exam = $query->result();
+
+
+ //CLINICAL INVESTIGATION REPORTS
+
+ $sql = "select * from ipd_discharge_2 where ipd_d_id='" . $ipdno . "' and CHAR_LENGTH(lab_investigation_list)>0";
+ $query = $this->db->query($sql);
+ $ipd_discharge_2 = $query->result();
+
+ $sql = "select * from ipd_discharge_2 where ipd_d_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_2_rdata = $query->result();
+
+ $lab_list = "";
+
+ if (count($ipd_discharge_2) > 0) {
+ $lab_list = $ipd_discharge_2[0]->lab_investigation_list;
+ }
+
+ if (strlen($lab_list) > 0) {
+ $lab_list_array = explode(",", $lab_list);
+ $sql_lab_test = "SELECT t.Test,t.Unit,t.FixedNormals";
+
+ foreach ($lab_list_array as $key => $value) {
+ $sql_lab_test .= "," . "group_concat(if(m.inv_date=" . $value . ",i.lab_test_value,null)) AS lab_test_value_" . $key;
+ }
+
+ $sql_lab_test .= " FROM ((((invoice_master m JOIN lab_request l ON m.id=l.charge_id)
+ JOIN lab_request_item i ON l.id=i.lab_request_id)
+ JOIN lab_tests t ON i.lab_test_id=t.mstTestKey)
+ JOIN ipd_discharge_investigation_template d ON t.TestID=d.test_code)
+ JOIN lab_rgroups g ON d.group_test=g.mstRGrpKey
+ WHERE m.attach_id=" . $p_id . " and m.inv_date IN (" . $lab_list . ")
+ GROUP BY d.test_code
+ ORDER BY g.sort_order,t.mstTestKey";
+
+
+ $query = $this->db->query($sql_lab_test);
+ $lab_request = $query->result_array();
+ }
+
+ //Final Diagnosis
+
+ $sql = "select * from ipd_discharge_diagnosis where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_diagnosis = $query->result();
+
+ $sql = "select * from ipd_discharge_diagnosis_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_diagnosis_remark = $query->result();
+
+
+ //Summary of key investigtions during Hospitalization
+
+ $sql = "select * from ipd_discharge_investigtions_inhos where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_investigtions_inhos = $query->result();
+
+ //Course in the hospital
+
+ $sql = "select * from ipd_discharge_course where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_course = $query->result();
+
+ $sql = "select * from ipd_discharge_course_remark where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_course_remark = $query->result();
+
+ //Exam. in Discharge
+
+ $sql = "select g.id,g.col_name,g.col_description,d.col_id,d.short_head,d.rdata,g.col_unit
+ from ipd_discharge_general_exam_col g left join ipd_discharge_1_b_final d on g.id=d.col_id and d.ipd_d_id='" . $ipdno . "'
+ where CHAR_LENGTH(d.rdata)>0 ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_exam_on_discharge_col = $query->result();
+
+
+ //Discharge Medications
+
+ $sql = "select * from ipd_discharge_drug where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_drug = $query->result();
+
+ //Discharge Instructions
+
+ $sql = "select * from ipd_discharge_instructions where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_instructions = $query->result();
+
+ //Discharge FOOD DRUG INTERACTION
+ $sql = "select * from ipd_discharge_drug_food_interaction where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge_drug_food_interaction = $query->result();
+
+ $food_list = "0";
+ if (count($ipd_discharge_drug_food_interaction) > 0) {
+ if (strlen($ipd_discharge_drug_food_interaction[0]->food_id_list) > 0) {
+ $food_list = $ipd_discharge_drug_food_interaction[0]->food_id_list;
+ }
+ }
+
+ $sql = "SELECT m.id,m.food_short
+ FROM ipd_discharge_master_food m where m.id IN (" . $food_list . ")";
+ $query = $this->db->query($sql);
+ $dis_food_interaction = $query->result();
+
+ //HTML Style
+
+ $style_tag_P = "LINE-HEIGHT:20px;";
+
+ $content_space_line = '';
+
+
+ //Content Start
+ $sql = "SELECT * FROM ipd_discharg_status where id =" . $ipd_master[0]->discarge_patient_status;
+ $query = $this->db->query($sql);
+ $ipd_discharge_status = $query->result();
+
+ if (count($ipd_discharge_status) < 1) {
+ $h1_head = '';
+ } else {
+ $h1_head = $ipd_discharge_status[0]->status_details;
+ }
+
+ $content .= '
+
+
+
+ ' . $h1_head . '
+
+
+
+
+
';
+
+ $content .= $depart_name;
+
+ $content .= $content_space_line;
+
+ $content .= $doc_list_main_sign;
+
+ $content .= $content_space_line;
+
+ if ($ipd_master[0]->case_id == '0') {
+ $discharge_date_time = date('h:m A', strtotime($ipd_master[0]->discharge_time));
+ } else {
+ $discharge_date_time = '';
+ }
+
+ $discharge_date_time = $ipd_master[0]->discharge_time;
+
+ $p_address = "";
+
+ if (strlen($patient_master[0]->p_address) > 2) {
+ $p_address = " Address : " . $patient_master[0]->p_address;
+ }
+
+ if (strtoupper($patient_master[0]->blood_group) == 'NOT DEFINE') {
+ $blood_group_show = '';
+ } else {
+ $blood_group_show = 'Blood Group : ' . $patient_master[0]->blood_group;
+ }
+
+ $content .= '
+
+
+
+ Patient Information
+
+
+
+ Name of Patient : ' . ucwords($ipd_master[0]->p_fname) . '
+ ' . ucwords($ipd_master[0]->p_relative) . ' ' . ucwords($ipd_master[0]->p_rname) . ' ' . $p_address . '
+ UHID:' . $ipd_master[0]->p_code . '
+ IPD No. : ' . $ipd_master[0]->ipd_code . '
+
+
+ Age : ' . $ipd_master[0]->str_age . ' / Gender : ' . $ipd_master[0]->xgender . '
+ TPA:' . $ipd_master[0]->admit_type . '
+ Discharge Status : ' . $ipd_master[0]->status_desc . '
+
+
+ Date of Admission : ' . $ipd_master[0]->str_register_date . ' ' . $Reg_time . '
+ Date of Discharge : ' . $ipd_master[0]->str_discharge_date . ' ' . $Discharge_time . '
+
+
+ MLC :' . $ipd_master[0]->mlc_type . '
+ ' . $blood_group_show . '
+
+
+
';
+
+ $content .= $content_space_line;
+
+ if ($ipd_master[0]->issurgery == 1 || $ipd_master[0]->isdelivery == 1 || count($ipd_discharge_surgery) > 0 || count($ipd_discharge_procedure) > 0) {
+ $content .= '
+
+ ';
+
+ if ($ipd_master[0]->issurgery == 1) {
+ $content .= '
+
+
+ Surgery
+
+ ' . $ipd_master[0]->surgery_name . '
+ Date of Surgery : ' . MysqlDate_to_str($ipd_master[0]->surgery_date) . '
+ ';
+ }
+
+ if (count($ipd_discharge_surgery) > 0) {
+ foreach ($ipd_discharge_surgery as $row) {
+ $content .= '
+
+
+ Surgery
+
+ ' . $row->surgery_name . '
+ Date of Surgery : ' . MysqlDate_to_str($row->surgery_date) . '
+ ';
+ }
+ }
+
+ if (count($ipd_discharge_procedure) > 0) {
+ foreach ($ipd_discharge_procedure as $row) {
+ $content .= '
+
+
+ Procedure
+
+ ' . $row->procedure_name . '
+ Date of Procedure : ' . MysqlDate_to_str($row->procedure_date) . '
+ ';
+ }
+ }
+
+
+
+ if ($ipd_master[0]->isdelivery == 1) {
+ $baby_desc = 'Sex of baby: ' . $ipd_master[0]->delivery_sex_of_baby . '';
+
+ if ($ipd_master[0]->delivery_sex_of_baby2 <> '') {
+ $baby_desc .= 'Sex of Second Baby :' . $ipd_master[0]->delivery_sex_of_baby2 . '';
+ }
+
+ if ($ipd_master[0]->delivery_sex_of_baby3 <> '') {
+ $baby_desc .= 'Sex of Third Baby :' . $ipd_master[0]->delivery_sex_of_baby3 . '';
+ }
+
+ $content .= '
+
+
+ Child Birth
+
+ Delivery Date and Time : ' . MysqlDate_to_str($ipd_master[0]->delivery_date) . ' ' . $ipd_master[0]->delivery_time . '
+ ' . $baby_desc . '
+ ';
+ }
+
+ $content .= '
+
+
';
+ }
+
+
+
+ //Presenting Complaints with Duration and Reason for Admission
+
+ $content .= 'Presenting Complaints and Reason for Admission ';
+
+ foreach ($ipd_discharge_complaint as $row) {
+ $content .= '' . $row->comp_report . ' ';
+ $content .= '' . $row->comp_remark . ' ';
+ }
+
+ if (count($ipd_discharge_complaint_remark) > 0) {
+ if ($ipd_discharge_complaint_remark[0]->comp_remark != '') {
+ $content .= '' . nl2br($ipd_discharge_complaint_remark[0]->comp_remark) . ' ';
+ }
+ }
+
+ //Provisional Diagnosis at the time of Admission
+
+ $content .= '
+ General Examination on Admission
+
+ ';
+ $icol = 0;
+ $no_col = 4;
+ foreach ($ipd_discharge_general_exam_col as $row) {
+ if ($icol % $no_col == 0) {
+ $content .= '';
+ }
+ $content .= '' . $row->col_name . ': ' . $row->rdata . ' ' . $row->col_unit . ' ';
+
+ if ($icol % $no_col == $no_col - 1) {
+ $content .= ' ';
+ }
+
+ $icol = $icol + 1;
+ }
+
+ while ($icol % $no_col > 0) {
+ $content .= ' ';
+
+ if ($icol % $no_col == $no_col - 1) {
+ $content .= '';
+ }
+ $icol = $icol + 1;
+ }
+
+ $content .= '
';
+
+ foreach ($ipd_discharge_sys_exam as $row) {
+ if ($row->rdata == null || $row->rdata == '') {
+ } else {
+ //$content.=''.$row->sys_exam_name.'
';
+ $content .= '' . $row->rdata . '
';
+ }
+ }
+
+ //Personal History
+
+ $personal_history = '';
+
+ if ($patient_master_data[0]->is_smoking == 1) {
+ $personal_history .= 'Smoking ';
+ }
+
+ if ($patient_master_data[0]->is_alcohol == 1) {
+ $personal_history .= 'Alcoholic ';
+ }
+
+ if ($patient_master_data[0]->is_drug_abuse == 1) {
+ $personal_history .= 'Drug Abuse ';
+ }
+
+ if ($patient_master_data[0]->is_tobacoo == 1) {
+ $personal_history .= 'Tobacoo ';
+ }
+
+ if ($patient_master_data[0]->is_hypertesion == 1) {
+ $personal_history .= 'Hypertension ';
+ }
+
+ if ($patient_master_data[0]->is_niddm == 1) {
+ $personal_history .= 'NIDDM ';
+ }
+
+ if ($patient_master_data[0]->is_hbsag == 1) {
+ $personal_history .= 'HBsAg ';
+ }
+
+ if ($patient_master_data[0]->is_hcv == 1) {
+ $personal_history .= 'HCV ';
+ }
+
+ if ($patient_master_data[0]->is_hiv_I_II == 1) {
+ $personal_history .= 'HIV I-II ';
+ }
+
+ if ($patient_master_data[0]->Others == 1) {
+ $personal_history .= 'Others ';
+ }
+
+ if (strlen($personal_history) > 0) {
+ $content .= "Personal History : " . $personal_history;
+ }
+
+ //CLINICAL INVESTIGATION REPORTS
+ if (isset($lab_request)) {
+ $content .= 'Clinical Investigation Reports ';
+ $content .= '
+ ';
+
+ $content .= '';
+ $content .= ' ';
+ $content .= 'Fixed Normals ';
+ foreach ($lab_list_array as $key => $value) {
+ $content .= '' . MysqlDate_to_str(str_replace("'", "", $value)) . ' ';
+ }
+ $content .= ' ';
+
+ foreach ($lab_request as $row) {
+ $content .= '';
+ $content .= '' . $row['Test'] . ' ';
+ $content .= '' . $row['FixedNormals'] . ' ';
+ foreach ($lab_list_array as $key => $value) {
+ $content .= '' . $row['lab_test_value_' . $key] . ' ';
+ }
+ $content .= ' ';
+ }
+
+ $content .= '
';
+ }
+
+ if (count($ipd_discharge_2_rdata) > 0) {
+ if ($ipd_discharge_2_rdata[0]->rdata != '') {
+ $content .= '' . $ipd_discharge_2_rdata[0]->rdata . '
';
+ }
+ }
+
+ //Final Diagnosis at the time of Discharge
+
+ $content .= 'Final Diagnosis ';
+
+ foreach ($ipd_discharge_diagnosis as $row) {
+ $content .= ' ' . $row->comp_report . ' ';
+ $content .= '' . $row->comp_remark . ' ';
+ }
+
+ if (count($ipd_discharge_diagnosis_remark) > 0) {
+ if ($ipd_discharge_diagnosis_remark[0]->comp_remark != '') {
+ $content .= '' . $ipd_discharge_diagnosis_remark[0]->comp_remark . '
';
+ }
+ }
+
+ //Summary of key investigtions during Hospitalization
+ if (count($ipd_discharge_investigtions_inhos) > 0) {
+ if ($ipd_discharge_investigtions_inhos[0]->comp_remark != '') {
+ $content .= "Summary of key investigtions during Hospitalization ";
+ $content .= '' . $ipd_discharge_investigtions_inhos[0]->comp_remark . '
';
+ }
+ }
+
+ //Course in the hospital
+
+ $content .= '
+ Course in the hospital ';
+
+ foreach ($ipd_discharge_course as $row) {
+ $content .= ' ' . $row->comp_report . ' ';
+ $content .= '' . $row->comp_remark . ' ';
+ }
+
+ if (count($ipd_discharge_course_remark) > 0) {
+ if ($ipd_discharge_course_remark[0]->comp_remark != '') {
+ $content .= '' . $ipd_discharge_course_remark[0]->comp_remark . '
';
+ }
+ }
+
+ //Exam in Discharge
+
+ $content .= 'Examination on Discharge ';
+
+ $content .= '
+
+ ';
+ $icol = 0;
+ $no_col = 4;
+ foreach ($ipd_discharge_exam_on_discharge_col as $row) {
+ if ($icol % $no_col == 0) {
+ $content .= '';
+ }
+ $content .= '' . $row->col_name . ' : ' . $row->rdata . ' ' . $row->col_unit . ' ';
+
+ if ($icol % $no_col == $no_col - 1) {
+ $content .= ' ';
+ }
+
+ $icol = $icol + 1;
+ }
+
+ while ($icol % $no_col > 0) {
+ $content .= ' ';
+
+ if ($icol % $no_col == $no_col - 1) {
+ $content .= '';
+ }
+ $icol = $icol + 1;
+ }
+
+ $content .= '
';
+
+ $content .= 'Discharge Medications ';
+ $content .= "";
+ foreach ($ipd_discharge_drug as $row) {
+ $content .= '' . $row->drug_name . ' ----------> ';
+
+ $content .= ' ' . $row->drug_dose . ' ';
+
+ if (strlen($row->drug_day) > 0) {
+ $content .= ' [ ' . $row->drug_day . " days] ";
+ } else {
+ $content .= ' ';
+ }
+
+ $content .= ' ';
+ }
+ $content .= " ";
+
+
+
+ //FOOD DRUG INTERACTION
+ if (count($ipd_discharge_drug_food_interaction) > 0) {
+ if (strlen($ipd_discharge_drug_food_interaction[0]->food_text) > 0 || count($dis_food_interaction) > 0) {
+ $content .= "Dietary ";
+ }
+ }
+
+ if (count($ipd_discharge_drug_food_interaction) > 0) {
+ if ($ipd_discharge_drug_food_interaction[0]->food_text != '') {
+ $content .= $ipd_discharge_drug_food_interaction[0]->food_text;
+ }
+ }
+
+ foreach ($dis_food_interaction as $row) {
+ $content .= $row->food_desc_lang . ' ';
+ //$content.=''.$row->food_desc.' ';
+ }
+
+ //Discharge Instructions
+ if (count($ipd_discharge_instructions) > 0) {
+ if ($ipd_discharge_instructions[0]->comp_remark != '') {
+ $content .= "Discharge Advice/Instructions/Summary ";
+ $content .= '' . $ipd_discharge_instructions[0]->comp_remark . '
';
+ }
+
+ if ($ipd_discharge_instructions[0]->footer_text != '') {
+ $content .= $ipd_discharge_instructions[0]->footer_text;
+ }
+ }
+
+
+
+
+ //FOOD DRUG INTERACTION
+ //$content.=$doc_list_sign;
+
+ //Foot Banner
+ $foot_banner_list = "0";
+ if (count($ipd_discharge_instructions) > 0) {
+ if (strlen($ipd_discharge_instructions[0]->footer_banner) > 0) {
+ $foot_banner_list = $ipd_discharge_instructions[0]->footer_banner;
+ }
+ }
+
+ $sql = "SELECT m.id,m.banner_name,m.banner_image_name
+ FROM ipd_discharge_banner m where m.id IN (" . $foot_banner_list . ") order by id desc";
+ $query = $this->db->query($sql);
+ $dis_banner_list = $query->result();
+
+ foreach ($dis_banner_list as $row) {
+ $content .= ' ';
+ }
+
+ // Update in Database
+ $dataupdate = array(
+ 'ipd_id' => $ipdno,
+ 'content' => $content
+ );
+ $this->ipdDischarge_M->update_ipdDischarge($dataupdate, $ipd_discharge[0]->id);
+
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge'] = $query->result();
+
+ $this->load->view('IPD_Discharge/ipd_discharge_preview', $data);
+ }
+
+ //
+
+ public function edit_discharge_report($ipdno)
+ {
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_discharge'] = $query->result();
+
+ $this->load->view('IPD_Discharge/ipd_discharge_preview', $data);
+ }
+
+
+ public function show_file($ipdno)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge = $query->result();
+
+ $sql = "select * from v_ipd_list where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ // Doctor Name
+
+ $docname = '';
+ $docedu = '';
+
+ $report_head = 'Patient Name :' . $ipd_master[0]->p_fname . ' / Age :' . $ipd_master[0]->str_age . ' / Gender :' . $ipd_master[0]->xgender . ' / IPD ID :' . $ipd_master[0]->ipd_code;
+
+ $complete_report = $ipd_discharge[0]->content;
+
+ $folder_name = 'uploads/' . date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name = 'Report-IPD-Discharge-' . $ipdno . "-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $folder_name . '/' . $file_name;
+
+ $udata = array(
+ 'file_name' => $file_name,
+ 'file_type' => 'pdf',
+ 'file_path' => $folder_name,
+ 'full_path' => $filepath,
+ 'orig_name' => $file_name,
+ 'client_name' => 'system_genrate',
+ 'file_ext' => '.pdf',
+ 'upload_by' => $user_name,
+ 'pid' => $ipd_master[0]->p_id,
+ 'ipd_id' => $ipd_master[0]->id,
+ 'case_id' => 0,
+ 'file_desc' => $report_head,
+ 'charge_id' => 0
+ );
+
+ $this->load->model('File_M');
+
+ $sql = "select * from file_upload_data where Date(insert_date)=Date(sysdate()) and file_name='" . $file_name . "'";
+ $query = $this->db->query($sql);
+ $check_file_exist = $query->result();
+
+ if (count($check_file_exist) < 1) {
+ $this->File_M->insert($udata);
+ } else {
+ $this->File_M->update($udata, $check_file_exist[0]->id);
+ }
+
+ create_Discharge_report_pdf($complete_report, $filepath, '', $report_head, $docname, $docedu);
+ }
+
+
+
+ public function show_file2($ipdno)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge = $query->result();
+
+ $sql = "select * from v_ipd_list where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ // Doctor Name
+
+ $docname = '';
+ $docedu = '';
+
+ $report_head = 'Patient Name :' . $ipd_master[0]->p_fname . ' / Age :' . $ipd_master[0]->str_age . ' / Gender :' . $ipd_master[0]->xgender . ' / IPD ID :' . $ipd_master[0]->ipd_code;
+
+ $complete_report = $ipd_discharge[0]->content;
+
+ $folder_name = 'uploads/' . date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name = 'Report-IPD-Discharge-' . $ipdno . "-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $folder_name . '/' . $file_name;
+
+ $udata = array(
+ 'file_name' => $file_name,
+ 'file_type' => 'pdf',
+ 'file_path' => $folder_name,
+ 'full_path' => $filepath,
+ 'orig_name' => $file_name,
+ 'client_name' => 'system_genrate',
+ 'file_ext' => '.pdf',
+ 'upload_by' => $user_name,
+ 'pid' => $ipd_master[0]->p_id,
+ 'ipd_id' => $ipd_master[0]->id,
+ 'case_id' => 0,
+ 'file_desc' => $report_head,
+ 'charge_id' => 0
+ );
+
+ $this->load->model('File_M');
+
+ $sql = "select * from file_upload_data where Date(insert_date)=Date(sysdate()) and file_name='" . $file_name . "'";
+ $query = $this->db->query($sql);
+ $check_file_exist = $query->result();
+
+ if (count($check_file_exist) < 1) {
+ $this->File_M->insert($udata);
+ } else {
+ $this->File_M->update($udata, $check_file_exist[0]->id);
+ }
+
+ create_discharge_logo_pdf($complete_report, $filepath);
+ }
+
+ public function show_file3($ipdno)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge = $query->result();
+
+ $sql = "select * from v_ipd_list where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ // Doctor Name
+
+ $docname = '';
+ $docedu = '';
+
+ $report_head = 'Patient Name :' . $ipd_master[0]->p_fname . ' / Age :' . $ipd_master[0]->str_age . ' / Gender :' . $ipd_master[0]->xgender . ' / IPD ID :' . $ipd_master[0]->ipd_code;
+
+ $report_foot = 'P:' . $ipd_master[0]->p_fname . ' / A:' . $ipd_master[0]->str_age . ' /G:' . $ipd_master[0]->xgender . ' /' . $ipd_master[0]->ipd_code;
+
+ $complete_report = $ipd_discharge[0]->content;
+
+ $folder_name = 'uploads/' . date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name = 'Report-IPD-Discharge-' . $ipdno . "-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $folder_name . '/' . $file_name;
+
+ $udata = array(
+ 'file_name' => $file_name,
+ 'file_type' => 'pdf',
+ 'file_path' => $folder_name,
+ 'full_path' => $filepath,
+ 'orig_name' => $file_name,
+ 'client_name' => 'system_genrate',
+ 'file_ext' => '.pdf',
+ 'upload_by' => $user_name,
+ 'pid' => $ipd_master[0]->p_id,
+ 'ipd_id' => $ipd_master[0]->id,
+ 'case_id' => 0,
+ 'file_desc' => $report_head,
+ 'charge_id' => 0
+ );
+
+ $this->load->model('File_M');
+
+ $sql = "select * from file_upload_data where Date(insert_date)=Date(sysdate()) and file_name='" . $file_name . "'";
+ $query = $this->db->query($sql);
+ $check_file_exist = $query->result();
+
+ if (count($check_file_exist) < 1) {
+ $this->File_M->insert($udata);
+ } else {
+ $this->File_M->update($udata, $check_file_exist[0]->id);
+ }
+
+ //create_Discharge_report_pdf($complete_report,$filepath,'',$report_head,$docname,$docedu);
+
+ $content = '';
+
+ $filename = '/uploads/' . time() . "_order.pdf";
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $Head_Print = '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
';
+
+ $this->m_pdf->pdf->SetHTMLFooter('
+
+
+ Page : {PAGENO}/{nbpg}
+ ' . $report_foot . '
+
+
+
');
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($Head_Print . $content . $complete_report);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ }
+
+ public function show_discharge($ipdno, $print_type = 0)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $sql = "select * from ipd_discharge where ipd_id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_discharge = $query->result();
+
+ $sql = "select * from v_ipd_list where id='" . $ipdno . "' ";
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+
+ $department = '';
+
+ $docname = '';
+ $docedu = '';
+
+ $data['report_head'] = 'Patient Name :' . $ipd_master[0]->p_fname . ' / Age :' . $ipd_master[0]->str_age . ' / Gender :' . $ipd_master[0]->xgender . ' / IPD ID :' . $ipd_master[0]->ipd_code;
+
+ $data['report_foot'] = 'P:' . $ipd_master[0]->p_fname . ' / A:' . $ipd_master[0]->str_age . ' /G:' . $ipd_master[0]->xgender . ' /' . $ipd_master[0]->ipd_code;
+
+ $data['complete_report'] = $ipd_discharge[0]->content;
+
+ $data['print_type'] = $print_type;
+
+ $folder_name = 'uploads/' . date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name = 'Report-IPD-Discharge-' . $ipdno . "-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $folder_name . '/' . $file_name;
+
+ $udata = array(
+ 'file_name' => $file_name,
+ 'file_type' => 'pdf',
+ 'file_path' => $folder_name,
+ 'full_path' => $filepath,
+ 'orig_name' => $file_name,
+ 'client_name' => 'system_genrate',
+ 'file_ext' => '.pdf',
+ 'upload_by' => $user_name,
+ 'pid' => $ipd_master[0]->p_id,
+ 'ipd_id' => $ipd_master[0]->id,
+ 'case_id' => 0,
+ 'file_desc' => $data['report_head'],
+ 'charge_id' => 0
+ );
+
+ $this->load->model('File_M');
+
+ $sql = "select * from file_upload_data where Date(insert_date)=Date(sysdate()) and file_name='" . $file_name . "'";
+ $query = $this->db->query($sql);
+ $check_file_exist = $query->result();
+
+ if (count($check_file_exist) < 1) {
+ $this->File_M->insert($udata);
+ } else {
+ $this->File_M->update($udata, $check_file_exist[0]->id);
+ }
+
+ //create_Discharge_report_pdf($complete_report,$filepath,'',$report_head,$docname,$docedu);
+
+ $print_content = $this->load->view('IPD_Discharge/' . D_discharge_template, $data, TRUE);
+
+ //$print_content=$this->load->view('IPD_Discharge/ipd_discharge_print_format_1',$data,TRUE);
+
+ $filename = '/uploads/' . time() . "_order.pdf";
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($print_content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ }
+}
diff --git a/old_code_ci3/controllers/Item.php b/old_code_ci3/controllers/Item.php
new file mode 100644
index 0000000..d1823c6
--- /dev/null
+++ b/old_code_ci3/controllers/Item.php
@@ -0,0 +1,354 @@
+db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('item/item_type_search_v',$data);
+ }
+
+ public function search_adv($itype_id=1)
+ {
+
+ $sql = "SELECT * FROM v_hc_items where itype=".$itype_id;
+ $query = $this->db->query($sql);
+ $data= $query->result();
+ echo ' Print ';
+
+ echo '
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+ ';
+ if(count($data)>0){
+ for ($i = 0; $i < count($data); ++$i) {
+ echo '
+ '.$data[$i]->isIPD_OPD.'
+ '.$data[$i]->group_desc.'
+ '.$data[$i]->idesc.'
+ '.$data[$i]->amount.'
+
+ Edit It....
+
+ ';
+ }
+ }
+
+ echo '
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+
';
+ echo "";
+
+ }
+
+ public function search()
+ {
+ $sql = "SELECT * FROM hc_item_type order by group_desc";
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $sql = "SELECT * FROM v_hc_items where itype=1";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('item/item_search_V',$data);
+
+ }
+
+
+ public function search_ipd()
+ {
+ $sql = "SELECT * FROM ipd_item_type order by group_desc";
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $sql = "SELECT * FROM ipd_items where itype=1";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('item_ipd/item_search_V',$data);
+
+ }
+
+ public function search_print($itype_id=1)
+ {
+
+ $sql = "SELECT * FROM v_hc_items where itype=".$itype_id." order by group_desc";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('item/item_item_list',$data);
+
+ }
+
+ function itemtype_record($id)
+ {
+ $sql = "SELECT *,(case is_ipd_opd when 0 then 'OPD-IPD' when 1 then 'OPD' when 2 then 'IPD' end) as isIPD_OPD
+ FROM hc_item_type where itype_id='".$id."' order by group_desc";
+ $query = $this->db->query($sql);
+ $data['data_item']= $query->result();
+
+ $this->load->view('item/item_type_profile',$data);
+ }
+
+ function item_record($id)
+ {
+
+ $sql="select * from v_hc_items where id=".$id;
+ $query = $this->db->query($sql);
+ $data['data_item']= $query->result();
+
+ $sql="select * from hc_item_type";
+ $query = $this->db->query($sql);
+ $data['data_item_type']= $query->result();
+
+ $sql="select * from v_insurance_item_list where c_item_id=".$id;
+ $query = $this->db->query($sql);
+ $data['data_insurance_item']= $query->result();
+
+ $sql="select * from hc_insurance where id>1";
+ $query = $this->db->query($sql);
+ $data['data_insurance']= $query->result();
+
+ $this->load->view('item/item_profile_V',$data);
+ }
+
+ public function UpdateRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_M');
+
+ $data = array(
+ 'itype' => $this->input->post('Item_Type'),
+ 'idesc' => $this->input->post('input_Item_name'),
+ 'amount' => $this->input->post('input_amount'),
+ 'update_date' => date('Y-m-d H:i:s')
+ );
+ $old_id=$this->input->post('p_id');
+ $update=$this->item_M->update($data,$old_id);
+
+ if($update>0)
+ {
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=> Show_Alert('success','Saved','Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function AddRecord()
+ {
+ $sql="select * from hc_item_type";
+ $query = $this->db->query($sql);
+ $data['data_item_type']= $query->result();
+
+ $this->load->view('item/item_create_V',$data);
+ }
+
+
+ public function AddItemTypeRecord()
+ {
+ $this->load->view('item/item_type_create');
+ }
+
+ public function CreateRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_M');
+ $data = array(
+ 'itype' => $this->input->post('Item_Type'),
+ 'idesc' => $this->input->post('input_Item_name'),
+ 'amount' => $this->input->post('input_amount'),
+ 'update_date' => date('Y-m-d H:i:s')
+ );
+
+ $inser_id=$this->item_M->insert($data);
+
+ if($inser_id>0)
+ {
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function AddInsuranceItemRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_M');
+ $data = array(
+ 'hc_items_id' => $this->input->post('p_id'),
+ 'hc_insurance_id' => $this->input->post('ins_company_name'),
+ 'amount1' => $this->input->post('input_amount'),
+ 'code' => $this->input->post('input_item_code')
+ );
+
+ $inser_id=$this->item_M->insert_in_item($data);
+
+ if($inser_id>0)
+ {
+ $sql="select * from v_insurance_item_list where c_item_id=".$this->input->post('p_id');
+ $query = $this->db->query($sql);
+ $data_insurance_item= $query->result();
+
+ echo '
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($data_insurance_item); ++$i) {
+ echo '
+ '.$data_insurance_item[$i]->ins_company_name.'
+ '.$data_insurance_item[$i]->i_amount.'
+ '.$data_insurance_item[$i]->code.'
+ Delete
+ ';
+ }
+ echo '
';
+ }
+
+ }
+
+ public function remove_record_item()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_M');
+ $data = array(
+ 'isdelete' => $this->input->post('in_remove_id')
+ );
+
+ $inser_id=$this->item_M->delete_in_item($data,$this->input->post('in_remove_id'));
+
+ if($inser_id>0)
+ {
+ $sql="select * from v_insurance_item_list where c_item_id=".$this->input->post('p_id');
+ $query = $this->db->query($sql);
+ $data_insurance_item= $query->result();
+
+ echo '
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($data_insurance_item); ++$i) {
+ echo '
+ '.$data_insurance_item[$i]->ins_company_name.'
+ '.$data_insurance_item[$i]->i_amount.'
+ '.$data_insurance_item[$i]->code.'
+ Delete
+ ';
+ }
+ echo '
';
+ }
+
+ }
+
+
+ public function _render_page($view, $data=null, $returnhtml=false)//I think this makes more sense
+ {
+
+ $this->viewdata = (empty($data)) ? $this->data: $data;
+
+ $view_html = $this->load->view($view, $this->viewdata, $returnhtml);
+
+ if ($returnhtml) return $view_html;//This will return html on 3rd argument being true
+ }
+
+
+ public function CreateItemTypeRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_M');
+ $data = array(
+ 'is_ipd_opd' => $this->input->post('Item_Type_ipd'),
+ 'group_desc' => $this->input->post('input_Item_type')
+ );
+
+ $inser_id=$this->item_M->insert_type($data);
+
+ if($inser_id>0)
+ {
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function UpdateItemTypeRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_M');
+
+ $data = array(
+ 'is_ipd_opd' => $this->input->post('Item_Type_ipd'),
+ 'group_desc' => $this->input->post('input_Item_type')
+ );
+
+ $old_id=$this->input->post('itemtype_id');
+ $update=$this->item_M->update_type($data,$old_id);
+
+ if($update>0)
+ {
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=> Show_Alert('success','Saved','Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Item_IPD.php b/old_code_ci3/controllers/Item_IPD.php
new file mode 100644
index 0000000..63d053e
--- /dev/null
+++ b/old_code_ci3/controllers/Item_IPD.php
@@ -0,0 +1,354 @@
+load->model('Item_ipd_M');
+ }
+
+ public function search_itemtype()
+ {
+ $sql = "SELECT * FROM ipd_item_type
+ order by group_desc";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('item_ipd/item_type_search_v',$data);
+ }
+
+ public function search_adv($itype_id=1)
+ {
+
+ $sql = "SELECT i.*,t.group_desc FROM ipd_items i join ipd_item_type t on i.itype=itype_id where itype=$itype_id";
+ $query = $this->db->query($sql);
+ $data= $query->result();
+ echo ' Print ';
+
+ echo '
+
+
+ Group
+ Charge Name
+ Amount
+
+
+
+ ';
+ for ($i = 0; $i < count($data); ++$i) {
+ echo '
+ '.$data[$i]->group_desc.'
+ '.$data[$i]->idesc.'
+ '.$data[$i]->amount.'
+
+ Edit It....
+
+ ';
+ }
+
+ echo '
+
+
+ Group
+ Charge Name
+ Amount
+
+
+
+
';
+ echo "";
+
+ }
+
+ public function search()
+ {
+ $sql = "SELECT * FROM ipd_item_type
+ order by group_desc";
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $sql = "SELECT i.*,t.group_desc
+ FROM ipd_items i join ipd_item_type t on i.itype=itype_id where itype=1";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('item_ipd/item_search_V',$data);
+
+ }
+
+ public function search_print($itype_id=1)
+ {
+ $sql = "select m.id AS id,m.itype AS itype,m.idesc AS idesc,m.idesc_detail AS idesc_detail,
+ m.amount AS amount,t.itype_id AS itype_id,
+ t.group_desc AS group_desc,
+ 'IPD' AS isIPD_OPD
+ from (ipd_items m join ipd_item_type t on((m.itype = t.itype_id)))
+ where m.itype=".$itype_id." order by group_desc";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('item_ipd/item_item_list',$data);
+
+ }
+
+ public function item_all_print()
+ {
+ $sql = "select m.id AS id,m.itype AS itype,m.idesc AS idesc,m.idesc_detail AS idesc_detail,
+ m.amount AS amount,t.itype_id AS itype_id,
+ t.group_desc AS group_desc,
+ 'IPD' AS isIPD_OPD
+ from (ipd_items m join ipd_item_type t on((m.itype = t.itype_id)))
+ order by group_desc";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $this->load->view('item_ipd/item_item_list',$data);
+
+ }
+
+ function itemtype_record($id)
+ {
+ $sql = "SELECT *
+ FROM ipd_item_type where itype_id='".$id."' order by group_desc";
+ $query = $this->db->query($sql);
+ $data['data_item']= $query->result();
+
+ $this->load->view('item_ipd/item_type_profile',$data);
+ }
+
+ function item_record($id)
+ {
+
+ $sql = "SELECT i.*,t.group_desc
+ FROM ipd_items i join ipd_item_type t on i.itype=itype_id where id=$id";
+ $query = $this->db->query($sql);
+ $data['data_item']= $query->result();
+
+ $sql="select * from ipd_item_type";
+ $query = $this->db->query($sql);
+ $data['data_item_type']= $query->result();
+
+ $sql="select * from v_insurance_ipd_item_list where c_item_id=".$id;
+ $query = $this->db->query($sql);
+ $data['data_insurance_item']= $query->result();
+
+ $sql="select * from hc_insurance where id>1";
+ $query = $this->db->query($sql);
+ $data['data_insurance']= $query->result();
+
+ $this->load->view('item_ipd/item_profile_V',$data);
+ }
+
+ public function UpdateRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $data = array(
+ 'itype' => $this->input->post('Item_Type'),
+ 'idesc' => $this->input->post('input_Item_name'),
+ 'amount' => $this->input->post('input_amount'),
+ 'update_date' => date('Y-m-d H:i:s')
+ );
+ $old_id=$this->input->post('p_id');
+ $update=$this->Item_ipd_M->update($data,$old_id);
+
+ if($update>0)
+ {
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=> Show_Alert('success','Saved','Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function AddRecord()
+ {
+ $sql="select * from ipd_item_type";
+ $query = $this->db->query($sql);
+ $data['data_item_type']= $query->result();
+
+ $this->load->view('item_ipd/item_create_V',$data);
+ }
+
+
+ public function AddItemTypeRecord()
+ {
+ $this->load->view('item_ipd/item_type_create');
+ }
+
+ public function CreateRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $data = array(
+ 'itype' => $this->input->post('Item_Type'),
+ 'idesc' => $this->input->post('input_Item_name'),
+ 'amount' => $this->input->post('input_amount'),
+ 'update_date' => date('Y-m-d H:i:s')
+ );
+
+ $inser_id=$this->Item_ipd_M->insert($data);
+
+ if($inser_id>0)
+ {
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function AddInsuranceItemRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_ipd_M');
+ $data = array(
+ 'hc_items_id' => $this->input->post('p_id'),
+ 'hc_insurance_id' => $this->input->post('ins_company_name'),
+ 'amount1' => $this->input->post('input_amount'),
+ 'code' => $this->input->post('input_item_code')
+ );
+
+ $inser_id=$this->item_ipd_M->insert_in_item($data);
+
+ if($inser_id>0)
+ {
+ $sql="select * from v_insurance_ipd_item_list where c_item_id=".$this->input->post('p_id');
+ $query = $this->db->query($sql);
+ $data_insurance_item= $query->result();
+
+ echo '
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($data_insurance_item); ++$i) {
+ echo '
+ '.$data_insurance_item[$i]->ins_company_name.'
+ '.$data_insurance_item[$i]->i_amount.'
+ '.$data_insurance_item[$i]->code.'
+ Delete
+ ';
+ }
+ echo '
';
+ }
+
+ }
+
+ public function remove_record_item()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_ipd_M');
+ $data = array(
+ 'isdelete' => $this->input->post('in_remove_id')
+ );
+
+ $inser_id=$this->item_ipd_M->delete_in_item($data,$this->input->post('in_remove_id'));
+
+ $sql="select * from v_insurance_ipd_item_list where c_item_id=".$this->input->post('p_id');
+ $query = $this->db->query($sql);
+ $data_insurance_item= $query->result();
+
+ echo '
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($data_insurance_item); ++$i) {
+ echo '
+ '.$data_insurance_item[$i]->ins_company_name.'
+ '.$data_insurance_item[$i]->i_amount.'
+ '.$data_insurance_item[$i]->code.'
+ Delete
+ ';
+ }
+ echo '
';
+
+ }
+
+
+
+
+ public function _render_page($view, $data=null, $returnhtml=false)//I think this makes more sense
+ {
+
+ $this->viewdata = (empty($data)) ? $this->data: $data;
+
+ $view_html = $this->load->view($view, $this->viewdata, $returnhtml);
+
+ if ($returnhtml) return $view_html;//This will return html on 3rd argument being true
+ }
+
+
+ public function CreateItemTypeRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('item_M');
+ $data = array(
+ 'group_desc' => $this->input->post('input_Item_type')
+ );
+
+ $inser_id=$this->Item_ipd_M->insert_type($data);
+
+ if($inser_id>0)
+ {
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function UpdateItemTypeRecord()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $data = array(
+ 'group_desc' => $this->input->post('input_Item_type')
+ );
+
+ $old_id=$this->input->post('itemtype_id');
+ $update=$this->Item_ipd_M->update_type($data,$old_id);
+
+ if($update>0)
+ {
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=> Show_Alert('success','Saved','Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Lab_Admin.php b/old_code_ci3/controllers/Lab_Admin.php
new file mode 100644
index 0000000..6f1edb6
--- /dev/null
+++ b/old_code_ci3/controllers/Lab_Admin.php
@@ -0,0 +1,3493 @@
+db->query($sql);
+ $data['labReport_master']= $query->result();
+
+ $this->load->view('PathLab_Report/lab_report_list',$data);
+ }
+
+ public function report_ultrasound_list($modality=2)
+ {
+ $sql="select * from radiology_ultrasound_template where modality=".$modality;
+ $query = $this->db->query($sql);
+ $data['labReport_master']= $query->result();
+
+ $data['modality']=$modality;
+
+ $this->load->view('PathLab_Report/ultrasound_template_list',$data);
+ }
+
+ public function report_test_list($repo_id)
+ {
+ $sql="select j.id,r.mstRepoKey,t.mstTestKey,t.Test,t.TestID,t.Result,j.EOrder
+ from lab_repo r join lab_repotests j join lab_tests t
+ on r.mstRepoKey=j.mstRepoKey and j.mstTestKey=t.mstTestKey where r.mstRepoKey=".$repo_id." order by j.EOrder" ;
+ $query = $this->db->query($sql);
+ $data['lab_Rep_Item_List']= $query->result();
+
+ $data['mstRepoKey']=$repo_id;
+
+ $this->load->view('PathLab_Report/lab_report_test_list',$data);
+ }
+
+ public function test_search_page($repo_id)
+ {
+ $data['repo_id']=$repo_id;
+ $this->load->view('PathLab_Report/lab_test_search',$data);
+ }
+
+ public function test_parameter_load($mstTestKey,$mstRepoKey)
+ {
+ $sql="select * from lab_tests where mstTestKey=".$mstTestKey ;
+ $query = $this->db->query($sql);
+ $data['lab_test_parameter']= $query->result();
+
+ $sql="select *,if(option_bold=1,'Bold','') as option_bold_str from lab_tests_option where mstTestKey=".$mstTestKey. " order by sort_id " ;
+ $query = $this->db->query($sql);
+ $data['lab_test_option']= $query->result();
+
+ $data['mstRepoKey']=$mstRepoKey;
+
+ $this->load->view('PathLab_Report/lab_report_item_edit',$data);
+ }
+ public function remove_test_option($option_id,$id_key)
+ {
+ $this->db->delete("lab_tests_option", "id=".$option_id);
+
+ $sql="select *,if(option_bold=1,'Bold','') as option_bold_str from lab_tests_option where mstTestKey=".$id_key. " order by sort_id " ;
+ $query = $this->db->query($sql);
+ $lab_test_option= $query->result();
+
+ $option_content='
+
+
+ #
+ Code
+ Bold
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($lab_test_option); ++$i) {
+ $option_content=$option_content.'
+ '.$lab_test_option[$i]->sort_id.'
+ '.$lab_test_option[$i]->option_value.'
+ '.$lab_test_option[$i]->option_bold_str.'
+
+
+
+
+ ';
+
+ $option_current=$lab_test_option[$i]->id;
+ $sort_current=$lab_test_option[$i]->sort_id;
+
+ if($i+1 < count($lab_test_option))
+ {
+ $option_next=$lab_test_option[$i+1]->id;
+ $sort_next=$lab_test_option[$i+1]->sort_id;
+
+ $option_content=$option_content. '
+ ';
+ }
+
+ if($i>0)
+ {
+ $option_prev=$lab_test_option[$i-1]->id;
+ $sort_prev=$lab_test_option[$i-1]->sort_id;
+
+ $option_content=$option_content. '
+ ';
+
+ }
+
+ $option_content=$option_content.'
+
+ ';
+ }
+ $option_content=$option_content.'
';
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+
+ $rvar=array(
+ 'insert_id' => 1,
+ 'showcontent'=> $showcontent,
+ 'option_content' => $option_content
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function test_parameter_edit()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('PathLab_M');
+
+ $id_key=$this->input->post('mstTestKey');
+
+ $sql="select * from lab_tests where mstTestKey=".$id_key;
+ $query = $this->db->query($sql);
+ $lab_tests= $query->result();
+
+ $TestID=$lab_tests[0]->TestID;
+ $TestID_post=$this->input->post('input_test_code');
+
+ $test_chk='';
+
+ if($TestID!=$TestID_post || $TestID=='')
+ {
+ $test_chk='|is_unique[lab_tests.TestID]';
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_Test_name',
+ 'label' => 'Test Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_test_code',
+ 'label' => 'Test Code',
+ 'rules' => 'required|min_length[1]|max_length[30]'.$test_chk
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ $update_value=1;
+ $showcontent="";
+ if ($this->form_validation->run() == TRUE)
+ {
+ $idChecked=$this->input->post('input_isChecked');
+
+ $data = array(
+ 'Test'=> $this->input->post('input_Test_name'),
+ 'TestID'=> $this->input->post('input_test_code'),
+ 'Result'=> $this->input->post('input_Default'),
+ 'Formula'=> $this->input->post('input_Formula'),
+ 'VRule'=> $this->input->post('input_Validation'),
+ 'VMsg'=> $this->input->post('input_Message'),
+ 'Unit'=> $this->input->post('input_Unit'),
+ 'FixedNormals'=> $this->input->post('input_Fixed'),
+ 'isGenderSpecific'=> $idChecked,
+ 'FixedNormalsWomen'=> $this->input->post('input_FixedNormalsWomen')
+ );
+
+ $this->PathLab_M->update_item_parameter($data,$id_key);
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+ }else{
+ $update_value=0;
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+
+
+ $rvar=array(
+ 'update_value' => $update_value,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+
+ }
+
+ public function test_parameter_add()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('PathLab_M');
+
+ $id_key=$this->input->post('mstTestKey');
+ $mstRepoKey=$this->input->post('mstRepoKey');
+
+ $sql="select * from lab_tests where mstTestKey=".$id_key;
+ $query = $this->db->query($sql);
+ $lab_tests= $query->result();
+
+ $TestID="";
+
+ if(count($lab_tests)>0)
+ {
+ $TestID=$lab_tests[0]->TestID;
+ }
+
+ $TestID_post=$this->input->post('input_test_code');
+
+ $test_chk='';
+
+ if($TestID!=$TestID_post || $TestID=='')
+ {
+ $test_chk='|is_unique[lab_tests.TestID]';
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_Test_name',
+ 'label' => 'Test Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_test_code',
+ 'label' => 'Test Code',
+ 'rules' => 'required|min_length[1]|max_length[30]'.$test_chk
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ $insert_id=0;
+ $showcontent="";
+ if ($this->form_validation->run() == TRUE)
+ {
+ $udata = array(
+ 'Test'=> $this->input->post('input_Test_name'),
+ 'TestID'=> $this->input->post('input_test_code'),
+ 'Result'=> $this->input->post('input_Default'),
+ 'Formula'=> $this->input->post('input_Formula'),
+ 'VRule'=> $this->input->post('input_Validation'),
+ 'VMsg'=> $this->input->post('input_Message'),
+ 'Unit'=> $this->input->post('input_Unit'),
+ 'FixedNormals'=> $this->input->post('input_Fixed')
+ );
+
+ $insert_id=$this->PathLab_M->insert_item_parameter($udata,$id_key);
+
+ $sql="select Max(EOrder) as MEOrder from lab_repotests where mstRepoKey=".$mstRepoKey;
+ $query = $this->db->query($sql);
+ $data['lab_repotests']= $query->result();
+
+ $MEOrder=0;
+ if(count($data['lab_repotests'])>0)
+ {
+ $MEOrder=$data['lab_repotests'][0]->MEOrder;
+ }
+
+ if($MEOrder === NULL)
+ {
+ $MEOrder=1;
+ }else{
+ $MEOrder=$MEOrder+1;
+ }
+
+ $udata = array(
+ 'mstRepoKey'=> $mstRepoKey,
+ 'mstTestKey'=> $insert_id,
+ 'EOrder'=> $MEOrder
+ );
+
+ $sortorder_insert_id=$this->PathLab_M->insert_item_sortorder($udata);
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+ }else{
+ $insert_id=0;
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+
+ $rvar=array(
+ 'insert_id' => $insert_id,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+
+ }
+
+ public function test_parameter_option_add()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('PathLab_M');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_op_value',
+ 'label' => 'Code',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ $sort_id=1;
+ $id_key=$this->input->post('mstTestKey');
+
+ $sql="select Max(sort_id) as msort_id from lab_tests_option where mstTestKey=".$id_key;
+ $query = $this->db->query($sql);
+ $lab_tests_option= $query->result();
+
+ if(count($lab_tests_option)>0)
+ {
+ $sort_id=$lab_tests_option[0]->msort_id;
+ $sort_id=$sort_id+1;
+ }
+
+ $insert_id=0;
+ $showcontent="";
+ $option_content="";
+ if ($this->form_validation->run() == TRUE)
+ {
+ $data = array(
+ 'mstTestKey'=> $id_key,
+ 'sort_id'=> $sort_id,
+ 'option_value'=> $this->input->post('input_op_value'),
+ 'option_text'=> $this->input->post('input_op_value'),
+ 'option_bold'=> $this->input->post('chk_bold')
+ );
+
+ $insert_id=$this->PathLab_M->insert_item_parameter_option($data);
+
+ $sql="select *,if(option_bold=1,'Bold','') as option_bold_str from lab_tests_option where mstTestKey=".$id_key. " order by sort_id " ;
+ $query = $this->db->query($sql);
+ $lab_test_option= $query->result();
+
+ $option_content='
+
+
+ #
+ Code
+ Bold
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($lab_test_option); ++$i) {
+
+ $option_content=$option_content.'
+ '.$lab_test_option[$i]->sort_id.'
+ '.$lab_test_option[$i]->option_value.'
+ '.$lab_test_option[$i]->option_bold_str.'
+
+
+ ';
+
+ $option_current=$lab_test_option[$i]->id;
+ $sort_current=$lab_test_option[$i]->sort_id;
+
+ if($i+1 < count($lab_test_option))
+ {
+ $option_next=$lab_test_option[$i+1]->id;
+ $sort_next=$lab_test_option[$i+1]->sort_id;
+
+ $option_content=$option_content. '
+ ';
+ }
+
+ if($i>0)
+ {
+ $option_prev=$lab_test_option[$i]->id;
+ $sort_prev=$lab_test_option[$i]->sort_id;
+
+ $option_content=$option_content. '
+ ';
+
+ }
+
+ $option_content=$option_content.'
+
+ ';
+ }
+ $option_content=$option_content.'
';
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+ }else{
+ $$insert_id=0;
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+ $rvar=array(
+ 'insert_id' => $insert_id,
+ 'showcontent'=> $showcontent,
+ 'option_content' => $option_content
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function change_sort($id_key,$option_id,$current,$change_option_id,$change)
+ {
+ $this->load->model('PathLab_M');
+
+ $udata = array(
+ 'sort_id'=> 0
+ );
+
+ $this->PathLab_M->update_item_parameter_option($udata,$option_id);
+
+ $udata = array(
+ 'sort_id'=> $current
+ );
+ $this->PathLab_M->update_item_parameter_option($udata,$change_option_id);
+
+
+ $udata = array(
+ 'sort_id'=> $change
+ );
+ $this->PathLab_M->update_item_parameter_option($udata,$option_id);
+
+
+
+ $sql="select *,if(option_bold=1,'Bold','') as option_bold_str from lab_tests_option where mstTestKey=".$id_key. " order by sort_id " ;
+ $query = $this->db->query($sql);
+ $lab_test_option= $query->result();
+
+ $option_content='
+
+
+ #
+ Code
+ Bold
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($lab_test_option); ++$i) {
+ $option_content=$option_content.'
+ '.$lab_test_option[$i]->sort_id.'
+ '.$lab_test_option[$i]->option_value.'
+ '.$lab_test_option[$i]->option_bold_str.'
+
+
+
+ ';
+
+ $option_current=$lab_test_option[$i]->id;
+ $sort_current=$lab_test_option[$i]->sort_id;
+
+ if($i+1 < count($lab_test_option))
+ {
+ $option_next=$lab_test_option[$i+1]->id;
+ $sort_next=$lab_test_option[$i+1]->sort_id;
+
+ $option_content=$option_content. '
+ ';
+ }
+
+ if($i>0)
+ {
+ $option_prev=$lab_test_option[$i-1]->id;
+ $sort_prev=$lab_test_option[$i-1]->sort_id;
+
+ $option_content=$option_content. '
+ ';
+
+ }
+
+ $option_content=$option_content.'
+
+ ';
+ }
+ $option_content=$option_content.'
';
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+
+ $rvar=array(
+ 'insert_id' => 1,
+ 'showcontent'=> $showcontent,
+ 'option_content' => $option_content
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function change_sort_item($repo_id,$option_id,$current,$change_option_id,$change)
+ {
+ $this->load->model('PathLab_M');
+
+ $udata = array(
+ 'EOrder'=> 0
+ );
+ $this->PathLab_M->update_item_sortorder($udata,$option_id);
+
+ $udata = array(
+ 'EOrder'=> $current
+ );
+ $this->PathLab_M->update_item_sortorder($udata,$change_option_id);
+
+ $udata = array(
+ 'EOrder'=> $change
+ );
+ $this->PathLab_M->update_item_sortorder($udata,$option_id);
+
+ $sql="select j.id,r.mstRepoKey,t.mstTestKey,t.Test,t.TestID,t.Result,j.EOrder
+ from lab_repo r join lab_repotests j join lab_tests t
+ on r.mstRepoKey=j.mstRepoKey and j.mstTestKey=t.mstTestKey where r.mstRepoKey=".$repo_id." order by j.EOrder" ;
+ $query = $this->db->query($sql);
+ $data['lab_Rep_Item_List']= $query->result();
+
+ $data['mstRepoKey']=$repo_id;
+
+ $this->load->view('PathLab_Report/lab_report_test_list',$data);
+
+ }
+
+
+ public function reportedit_load($repo_id=0)
+ {
+ $sql="select * from lab_repo where mstRepoKey=".$repo_id;
+ $query = $this->db->query($sql);
+ $data['labReport_master']= $query->result();
+
+ $item_id=0;
+
+ if($repo_id>0)
+ {
+ $item_id=$data['labReport_master'][0]->charge_id;
+ }
+
+ //$sql="select * from hc_items where itype=5 and id not in (select charge_id from lab_repo where charge_id>0 and charge_id<>".$item_id.")";
+ $sql="select * from hc_items where itype in (5,30,6) and id not in (select charge_id from lab_repo where charge_id>0 and charge_id<>".$item_id.") order by idesc ";
+
+ $query = $this->db->query($sql);
+ $data['hc_items']= $query->result();
+
+ $sql="select * from lab_rgroups ";
+ $query = $this->db->query($sql);
+ $data['lab_rgroups']= $query->result();
+
+ $sql="select j.id,r.mstRepoKey,t.mstTestKey,t.Test,t.TestID,t.Result,j.EOrder
+ from lab_repo r join lab_repotests j join lab_tests t
+ on r.mstRepoKey=j.mstRepoKey and j.mstTestKey=t.mstTestKey where r.mstRepoKey=".$repo_id." order by j.EOrder" ;
+ $query = $this->db->query($sql);
+ $data['lab_Rep_Item_List']= $query->result();
+
+ $sql="select * from color ";
+ $query = $this->db->query($sql);
+ $data['color_name']= $query->result();
+
+ $data['repo_id']=$repo_id;
+
+ $this->load->view('PathLab_Report/lab_report_edit',$data);
+ }
+
+ public function reportedit_ultrasound_load($modality=2,$repo_id=0)
+ {
+ $sql="select * from radiology_ultrasound_template where modality=$modality and id=".$repo_id;
+ $query = $this->db->query($sql);
+ $data['labReport_master']= $query->result();
+
+ $item_id=0;
+
+ if($repo_id>0)
+ {
+ $item_id=$data['labReport_master'][0]->charge_id;
+ }
+
+
+
+ $sql="select * from hc_items where itype=$modality order by idesc ";
+
+ $query = $this->db->query($sql);
+ $data['hc_items']= $query->result();
+
+ $data['repo_id']=$repo_id;
+
+ $data['modality']=$modality;
+
+ $this->load->view('PathLab_Report/ultrasound_report_edit',$data);
+ }
+
+ public function report_update()
+ {
+
+ $this->load->model('PathLab_M');
+
+ $id_key=$this->input->post('repo_id');
+
+ $sql="select * from lab_repo where mstRepoKey=".$id_key;
+ $query = $this->db->query($sql);
+ $lab_repo= $query->result();
+
+ $repo_title=$lab_repo[0]->Title;
+ $repo_title_post=$this->input->post('input_Reportname');
+
+ $repo_chk='';
+
+ if($repo_title!=$repo_title_post)
+ {
+ $repo_chk='|is_unique[lab_repo.Title]';
+ }
+
+ $charge_id=$lab_repo[0]->charge_id;
+ $charge_id_post=$this->input->post('charge_id');
+ $charge_chk='';
+
+ if($charge_id_post>0)
+ {
+ if($charge_id_post!=$charge_id)
+ {
+ $charge_chk='|is_unique[lab_repo.charge_id]';
+ }
+ }
+ $update_record=0;
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_Reportname',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[1]|max_length[100]'.$repo_chk
+ ),
+ array(
+ 'field' => 'charge_id',
+ 'label' => 'Charge Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'.$charge_chk
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $data = array(
+ 'Title'=> $this->input->post('input_Reportname'),
+ 'GrpKey'=> $this->input->post('group_id'),
+ 'charge_id'=> $this->input->post('charge_id'),
+ 'HTMLData'=> $this->input->post('HTMLData'),
+ );
+
+ $this->PathLab_M->update_report($data,$id_key);
+
+ $update_record=1;
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+
+ }else{
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+
+ $rvar=array(
+ 'update_record' => $update_record,
+ 'showcontent' => $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function report_ultrasound_insert($modality)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('PathLab_M');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_Reportname',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[1]|max_length[100]|is_unique[lab_repo.Title]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ $insertid=0;
+ $showcontent="";
+ if ($this->form_validation->run() == TRUE)
+ {
+ $id_key=$this->input->post('repo_id');
+ $data = array(
+ 'template_name'=> $this->input->post('input_Reportname'),
+ 'title'=> $this->input->post('group_id'),
+ 'charge_id'=> $this->input->post('charge_id'),
+ 'Findings'=> $this->input->post('HTMLData'),
+ 'Impression'=> $this->input->post('Impression'),
+ 'modality'=> $modality
+ );
+ $insertid=$this->PathLab_M->insert_ultrasound_report($data);
+ $showcontent="Data Saved successfully";
+
+ }else{
+ $showcontent =validation_errors();
+ }
+
+ $rvar=array(
+ 'insertid' => $insertid,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function report_ultrasound_update($modality=2)
+ {
+
+ $this->load->model('PathLab_M');
+
+ $id_key=$this->input->post('repo_id');
+
+ $sql="select * from radiology_ultrasound_template where id=".$id_key;
+ $query = $this->db->query($sql);
+ $lab_repo= $query->result();
+
+ $repo_title=$lab_repo[0]->title;
+ $repo_title_post=$this->input->post('input_Reportname');
+
+ $repo_chk='';
+
+ $charge_id_post=$this->input->post('charge_id');
+
+
+ $update_record=0;
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_Reportname',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[1]|max_length[100]'
+ ),
+ array(
+ 'field' => 'charge_id',
+ 'label' => 'Charge Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $data = array(
+ 'template_name'=> $this->input->post('input_Reportname'),
+ 'title'=> $this->input->post('group_id'),
+ 'charge_id'=> $charge_id_post,
+ 'Findings'=> $this->input->post('HTMLData'),
+ 'Impression'=> $this->input->post('Impression'),
+ 'modality'=> $modality
+ );
+
+ $this->PathLab_M->update_ultrasound_report($data,$id_key);
+
+ $update_record=1;
+
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+
+ }else{
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+
+ $rvar=array(
+ 'update_record' => $update_record,
+ 'showcontent' => $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function report_insert()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('PathLab_M');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_Reportname',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[1]|max_length[100]|is_unique[lab_repo.Title]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ $insertid=0;
+ $showcontent="";
+ if ($this->form_validation->run() == TRUE)
+ {
+ $id_key=$this->input->post('repo_id');
+ $data = array(
+ 'Title'=> $this->input->post('input_Reportname'),
+ 'GrpKey'=> $this->input->post('group_id'),
+ 'charge_id'=> $this->input->post('charge_id'),
+ ' HTMLData'=> $this->input->post('HTMLData')
+ );
+ $insertid=$this->PathLab_M->insert_report($data);
+ $showcontent=Show_Alert('success','Saved','Data Saved successfully');
+
+
+ }else{
+ $showcontent =Show_Alert('danger','Error',validation_errors());
+ }
+
+ $rvar=array(
+ 'insertid' => $insertid,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+
+ public function lab_master()
+ {
+ $this->load->view('PathLab_Report/lab_main');
+ }
+
+ public function lab_path($lab_type)
+ {
+ $data['lab_type']=$lab_type;
+ $this->load->view('PathLab_Report/pathlab_request_list',$data);
+ }
+
+
+ public function Entry_Update()
+ {
+ $this->load->model('PathLab_M');
+
+ $test_id=$this->input->post('test_id');
+ $test_value=$this->input->post('test_value');
+
+ $udata = array(
+ 'lab_test_value'=> $test_value
+ );
+ $this->PathLab_M->update_test_entry($udata,$test_id);
+
+
+ $sql="select lab_test_value from lab_request_item where id=".$test_id;
+ $query = $this->db->query($sql);
+ $data_value= $query->result();
+
+ echo $data_value[0]->lab_test_value;
+
+ }
+
+ public function Remark_Update($req_id)
+ {
+ $this->load->model('PathLab_M');
+
+ $udata = array(
+ 'Remark'=> $this->input->post('HTMLData')
+ );
+
+ $this->PathLab_M->update_test_request($udata,$req_id);
+
+ echo "Saved";
+
+ }
+
+ public function Final_Update($req_id)
+ {
+ $this->load->model('PathLab_M');
+
+ $udata = array(
+ 'Report_Data'=> $this->input->post('HTMLData')
+ );
+
+ $this->PathLab_M->update_test_request($udata,$req_id);
+
+ echo "Saved";
+
+ }
+
+ public function Report_Final_print($inv_req_id)
+ {
+ $this->load->model('PathLab_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.' '. $user->last_name.'['.$user_id.']['.date('d-m-Y h:m:s').']';
+
+ $udata = array(
+ 'Report_Data'=> $this->input->post('HTMLData'),
+ 'report_update'=> $user_name
+ );
+
+ $sortorder_insert_id=$this->PathLab_M->update_invoice_report($udata,$inv_req_id);
+ echo 'Report Update';
+
+ }
+
+ public function Report_single_print($lab_req_id)
+ {
+ $this->load->model('PathLab_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.' '. $user->last_name.'['.$user_id.']['.date('d-m-Y h:m:s').']';
+
+ $udata = array(
+ 'Report_Data'=> $this->input->post('HTMLData'),
+ 'report_update'=> $user_name
+ );
+
+ $sortorder_insert_id=$this->PathLab_M->update_test_request($udata,$lab_req_id);
+ echo 'Report Update';
+
+
+ }
+
+ public function confirm_report($req_id)
+ {
+ $this->load->model('PathLab_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $udata = array(
+ 'confirm_by'=> $user_name,
+ 'status'=>2
+ );
+
+ $this->PathLab_M->update_test_request($udata,$req_id);
+
+ echo "Verified and Ready for Print";
+
+ }
+
+
+
+ public function create_report($req_id) {
+
+ $this->load->model('PathLab_M');
+
+ $sql="select * from lab_request where id=".$req_id;
+ $query = $this->db->query($sql);
+ $data_lab_request= $query->result();
+
+ $p_id=$data_lab_request[0]->patient_id;
+
+ $sql="select * from patient_master_exten where id=$p_id";
+ $query = $this->db->query($sql);
+ $data_patient_data= $query->result();
+
+ $gender=$data_patient_data[0]->gender;
+
+
+ $sql="select d.mstTestKey,d.Test,d.TestID,d.Result,d.Formula,d.VRule,d.VMsg,d.Unit, d.FixedNormals,
+ i.lab_test_value,i.lab_test_remark,i.id ,s.EOrder,d.isGenderSpecific,d.FixedNormalsWomen,
+ group_concat(concat(o.id,':',o.option_text,':',o.option_value) ORDER BY o.sort_id) as option_value
+ from (lab_request_item i join lab_tests d join lab_repotests s
+ on i.lab_test_id=d.mstTestKey and d.mstTestKey=s.mstTestKey and i.lab_repo_id=s.mstRepoKey)
+ left join lab_tests_option o on d.mstTestKey=o.mstTestKey
+ where i.lab_request_id=".$req_id." group by d.mstTestKey order by s.EOrder";
+ $query = $this->db->query($sql);
+ $data_lab_test_list= $query->result();
+
+ $sql="select mstRepoKey,Title,HTMLData,GrpKey,charge_id,RepoGrp
+ from lab_repo join lab_rgroups on lab_repo.GrpKey=lab_rgroups.mstRGrpKey
+ where mstRepoKey=".$data_lab_request[0]->lab_repo_id;
+
+
+ $query = $this->db->query($sql);
+ $data_report_format= $query->result();
+
+ $sql="select * from invoice_master where attach_type=0 and id=".$data_lab_request[0]->charge_id;
+ $query = $this->db->query($sql);
+ $data_invoice_master= $query->result();
+
+ $sql="select id from lab_invoice_request where invoice_id=".$data_lab_request[0]->charge_id." and lab_type=".$data_lab_request[0]->lab_type ;
+ $query = $this->db->query($sql);
+ $lab_invoice_request= $query->result();
+
+ if(count($data_report_format)>0)
+ {
+
+ $Report_Head_H3=''.$data_report_format[0]->Title.' ';
+ $Report_string=$data_report_format[0]->HTMLData;
+
+ }else{
+
+ $Report_Head_H3=''.$data_lab_request[0]->report_name.' ';
+ $Report_string="";
+ }
+
+ $Report_Header='
+
+
+ '.$Report_Head_H3.'
+
+
+
+ ';
+
+
+ $Report_Footer=$data_lab_request[0]->Remark;
+
+ //update report_string with test parameter
+
+ $lab_test_array=array();
+ for($j = 0; $j < count($data_lab_test_list); ++$j) {
+ $lab_test_array[$data_lab_test_list[$j]->TestID]=$data_lab_test_list[$j]->lab_test_value;
+ }
+
+
+ for ($i = 0; $i < count($data_lab_test_list); ++$i) {
+
+ $FixedNormals=$data_lab_test_list[$i]->FixedNormals;
+ $isGenderSpecific=$data_lab_test_list[$i]->isGenderSpecific;
+ $FixedNormalsWomen=$data_lab_test_list[$i]->FixedNormalsWomen;
+
+ $Test_Formula=$data_lab_test_list[$i]->Formula;
+
+ //$LabTestValue=$data_lab_test_list[$i]->lab_test_value;
+
+ if(strlen($Test_Formula)>0){
+ foreach($lab_test_array as $key=>$value){
+ if(is_numeric($value))
+ {
+ $Test_Formula=str_replace('{'.$key.'}',$value,$Test_Formula);
+ }else{
+ $Test_Formula=str_replace('{'.$key.'}','0',$Test_Formula);
+ }
+
+ }
+
+ //echo $Test_Formula;
+
+ $LabTestValue=Round(cal_exp(trim($Test_Formula)),2);
+
+
+ }else{
+ $LabTestValue=$data_lab_test_list[$i]->lab_test_value;
+ }
+
+
+ if($isGenderSpecific==1)
+ {
+ if($gender==1)
+ {
+ if(strlen($FixedNormals)>0 && is_numeric($LabTestValue))
+ {
+ $FixedNormals_array=explode('-',$FixedNormals);
+
+ if(is_array($FixedNormals_array))
+ {
+ $FixedNormals_min=$FixedNormals_array[0];
+ $FixedNormals_max=$FixedNormals_array[1];
+ if(is_numeric($FixedNormals_min)&&is_numeric($FixedNormals_min))
+ {
+ if($LabTestValue>=$FixedNormals_min && $LabTestValue<=$FixedNormals_max )
+ {
+
+ }else{
+ $LabTestValue=''.$LabTestValue.' ';
+ }
+ }
+ }
+
+ }
+ }else{
+ if(strlen($FixedNormalsWomen)>0 && is_numeric($LabTestValue))
+ {
+ $FixedNormals_array=explode('-',$FixedNormalsWomen);
+
+ if(is_array($FixedNormals_array))
+ {
+ $FixedNormals_min=$FixedNormals_array[0];
+ $FixedNormals_max=$FixedNormals_array[1];
+ if(is_numeric($FixedNormals_min)&&is_numeric($FixedNormals_max))
+ {
+ if($LabTestValue>=$FixedNormals_min && $LabTestValue<=$FixedNormals_max )
+ {
+
+ }else{
+ $LabTestValue=''.$LabTestValue.' ';
+ }
+ }
+ }
+
+ }
+ }
+
+ }else{
+ if(strlen($FixedNormals)>0 && is_numeric($LabTestValue))
+ {
+ $FixedNormals_array=explode('-',$FixedNormals);
+
+ if(is_array($FixedNormals_array))
+ {
+ $FixedNormals_min=$FixedNormals_array[0];
+ $FixedNormals_max=$FixedNormals_array[1];
+ if(is_numeric($FixedNormals_min)&&is_numeric($FixedNormals_min))
+ {
+ if($LabTestValue>=$FixedNormals_min && $LabTestValue<=$FixedNormals_max )
+ {
+
+ }else{
+ $LabTestValue=''.$LabTestValue.' ';
+ }
+ }
+ }
+
+ }
+ }
+
+ $Report_string=str_replace('{'.$data_lab_test_list[$i]->TestID.'}',$LabTestValue,$Report_string);
+ }
+
+ $complete_report=$Report_Header.$Report_string.$Report_Footer;
+
+ $udata = array(
+ 'Report_Data'=> $complete_report,
+ 'status'=>1,
+ 'reported_time'=> date('Y-m-d H:i:s')
+ );
+
+ $this->PathLab_M->update_test_request($udata,$req_id);
+
+ $udata = array(
+ 'reported_time'=> date('Y-m-d H:i:s')
+ );
+ $this->PathLab_M->update_invoice_report($udata,$lab_invoice_request[0]->id);
+
+ //echo 'Report Created'.$lab_invoice_request[0]->id;
+
+ redirect('Lab_Admin/show_report_final/'.$req_id);
+ }
+
+
+
+ public function show_report_final($req_id)
+ {
+ $sql="select * from lab_request where id=".$req_id;
+ $query = $this->db->query($sql);
+ $data['report_format']= $query->result();
+
+ $this->load->view('PathLab_Report/lab_final_report_show',$data);
+ }
+
+ public function report_compile1($inv_id,$lab_type)
+ {
+ $sql="select l.*,g.RepoGrp,
+ date_format(l.collected_time,'%d-%m-%Y %h:%i %p') as str_collected_time,
+ date_format(l.reported_time,'%d-%m-%Y %h:%i %p') as str_reported_time
+ FROM (lab_request l join lab_repo r on l.lab_repo_id=r.mstRepoKey)
+ left join lab_rgroups g on r.GrpKey=g.mstRGrpKey
+ where l.print_combine=1 and status=2 and l.charge_id=".$inv_id." and l.lab_type=".$lab_type." order by g.sort_order";
+
+ $query = $this->db->query($sql);
+ $data_lab_request= $query->result();
+
+ $sql="Select max(report_edit_req_no) as no
+ from lab_request where charge_id=".$inv_id." and lab_type=".$lab_type." ";
+ $query = $this->db->query($sql);
+ $data_lab_request_edit= $query->result();
+
+ if($data_lab_request_edit[0]->no>0)
+ {
+ $data_lab_request_edit_str='/'.$data_lab_request_edit[0]->no;
+ $note_edit_str='Caution : Please ignore the earlier report.';
+ }else{
+ $data_lab_request_edit_str='';
+ $note_edit_str='';
+ }
+
+
+ $sql="select * ,
+ date_format(l.collected_time,'%d-%m-%Y %h:%i %p') as str_collected_time,
+ date_format(l.reported_time,'%d-%m-%Y %h:%i %p') as str_reported_time
+ from lab_invoice_request l
+ where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $lab_invoice_request= $query->result();
+
+ if(count($data_lab_request)==0)
+ {
+ exit( 'No Record Ready for print Report');
+ }
+
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select *
+ from patient_master_exten p where id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $data_patient_master= $query->result();
+
+ if($invoice_master[0]->refer_by_id>0)
+ {
+ $sql="select * from doctor_master where id=".$invoice_master[0]->refer_by_id;
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+ $rdoc_name='Dr.'.$doc_master[0]->p_fname;
+ }else{
+ $rdoc_name=$invoice_master[0]->refer_by_other;
+ }
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+
+
+ $insurance_case_id=$invoice_master[0]->insurance_case_id;
+
+ $org_ID='';
+
+ if($insurance_case_id>1)
+ {
+ $sql="select o.* ,i.short_name
+ from organization_case_master o join hc_insurance i on o.insurance_id=i.id
+ where o.id=".$insurance_case_id;
+ $query = $this->db->query($sql);
+ $org_master= $query->result();
+
+ if(count($org_master)>0){
+ $org_ID='Org. ID: '.$org_master[0]->case_id_code.' ';
+ $org_ID.='Org.Name : '.$org_master[0]->short_name.' ';
+ }
+ }
+
+ $ipd_id='';
+
+ if(count($ipd_master)>0)
+ {
+ $ipd_id='IPD No. : '. $ipd_master[0]->ipd_code.' ';
+ }
+
+ //$print_datetime=$data_lab_request[0]->Request_Date;
+
+ $print_datetime=date('d-m-Y h:i:s A');
+
+
+ if($lab_invoice_request[0]->collected_time<>'')
+ {
+ $Collection_data='
+ Collected : '.$lab_invoice_request[0]->str_collected_time.'
+ Reported : '.$lab_invoice_request[0]->str_reported_time;
+ }
+
+ $Header='
+
+
+
+ Inovice ID : '.$invoice_master[0]->invoice_code.' '.$data_lab_request_edit_str.'
+ Patient Name : '.$data_patient_master[0]->title.' '.$data_patient_master[0]->p_fname.'
+ '.$data_patient_master[0]->p_relative.' '.$data_patient_master[0]->p_rname.'
+ Age/Sex : '.$data_patient_master[0]->str_age.'/'.$data_patient_master[0]->xgender.'
+ UHID : '.$data_patient_master[0]->p_code.'
+
+ '.$ipd_id.$org_ID.'
+ Print Date : '.$print_datetime.'
+ '.$Collection_data.'
+ Reffered By : '.$rdoc_name.'
+
+
+ ';
+
+ $Header.='
+
'.$note_edit_str.'
+ ';
+
+ $RawData="";
+ $group_name='';
+ $first_header=1;
+
+ for($i=0;$iRepoGrp==$group_name)
+ {
+ $groupHead='';
+ }else{
+ if($first_header==0)
+ {
+ //$groupHead=' ';
+ $groupHead='';
+ }else{
+ $groupHead='';
+ }
+
+ $groupHead.='
+ '.$data_lab_request[$i]->RepoGrp.' ';
+
+ $first_header=0;
+ }
+
+ $RawData=$RawData.$groupHead;
+ $RawData=$RawData.$data_lab_request[$i]->Report_Data;
+
+ $group_name=$data_lab_request[$i]->RepoGrp;
+
+ }
+
+ $complete_report=$RawData;
+
+ $inv_req_id=0;
+ if(count($lab_invoice_request)>0)
+ {
+ $inv_req_id=$lab_invoice_request[0]->id;
+ }
+
+ $this->load->model('PathLab_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.' '. $user->last_name.'['.$user_id.']['.date('d-m-Y h:m:s').']';
+
+ $udata = array(
+ 'report_data'=> $complete_report,
+ 'report_compile'=> $user_name,
+ 'report_header'=> $Header,
+ );
+
+ $sortorder_insert_id=$this->PathLab_M->update_invoice_report($udata,$inv_req_id);
+ echo 'Data Compile';
+
+ $filename = $inv_id.'-'.$lab_type.'-'.time() . '.pdf';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $lab_file_name=$folder_name.'/'.$filename;
+
+ }
+
+ public function report_compile($inv_id,$lab_type)
+ {
+ $sql="select l.*,g.RepoGrp,
+ date_format(l.collected_time,'%d-%m-%Y %h:%i %p') as str_collected_time,
+ date_format(l.reported_time,'%d-%m-%Y %h:%i %p') as str_reported_time
+ FROM (lab_request l join lab_repo r on l.lab_repo_id=r.mstRepoKey)
+ left join lab_rgroups g on r.GrpKey=g.mstRGrpKey
+ where l.print_combine=1 and status=2 and l.charge_id=".$inv_id." and l.lab_type=".$lab_type." order by g.sort_order";
+
+ $query = $this->db->query($sql);
+ $data_lab_request= $query->result();
+
+ $sql="Select max(report_edit_req_no) as no
+ from lab_request where charge_id=".$inv_id." and lab_type=".$lab_type." ";
+ $query = $this->db->query($sql);
+ $data_lab_request_edit= $query->result();
+
+ if($data_lab_request_edit[0]->no>0)
+ {
+ $sql="SELECT GROUP_CONCAT(CONCAT_WS('/',l.log_type,l.log_Faults,l.comments,'Report:',r.report_name)) AS report_log
+ from lab_log l JOIN lab_request r ON l.lab_repo_id=r.id
+ WHERE r.charge_id=$inv_id AND r.lab_type=$lab_type";
+
+ $query = $this->db->query($sql);
+ $data_lab_edit_error= $query->result();
+
+ $report_log='';
+
+ if(count($data_lab_edit_error)>0){
+ $report_log=$data_lab_edit_error[0]->report_log;
+ }
+
+ $data_lab_request_edit_str='/'.$data_lab_request_edit[0]->no;
+ $note_edit_str='Caution : The previous report has been corrected. Please ignore the previous report. Error Type : '.$report_log;
+ //$note_edit_str='';
+ }else{
+ $data_lab_request_edit_str='';
+ $note_edit_str='';
+ }
+
+
+ $sql="select * ,
+ date_format(l.collected_time,'%d-%m-%Y %h:%i %p') as str_collected_time,
+ date_format(l.reported_time,'%d-%m-%Y %h:%i %p') as str_reported_time
+ from lab_invoice_request l
+ where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $lab_invoice_request= $query->result();
+
+ if(count($data_lab_request)==0)
+ {
+ exit( 'No Record Ready for print Report');
+ }
+
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select *
+ from patient_master_exten p where id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $data_patient_master= $query->result();
+
+
+ if($invoice_master[0]->refer_by_id>0)
+ {
+ $sql="select * from doctor_master where id=".$invoice_master[0]->refer_by_id;
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+ $rdoc_name='Dr.'.$doc_master[0]->p_fname;
+ }else{
+ $rdoc_name=$invoice_master[0]->refer_by_other;
+ }
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+
+
+ $insurance_case_id=$invoice_master[0]->insurance_case_id;
+
+ $org_ID='';
+
+ if($insurance_case_id>1)
+ {
+ $sql="select o.* ,i.short_name
+ from organization_case_master o join hc_insurance i on o.insurance_id=i.id
+ where o.id=".$insurance_case_id;
+ $query = $this->db->query($sql);
+ $org_master= $query->result();
+
+ if(count($org_master)>0){
+ $org_ID='Org. ID: '.$org_master[0]->case_id_code.' ';
+ $org_ID.='Org.Name : '.$org_master[0]->short_name.' ';
+ }
+ }
+
+ $ipd_id='';
+
+ if(count($ipd_master)>0)
+ {
+ $ipd_id='IPD No. : '. $ipd_master[0]->ipd_code.'';
+ }
+
+ //$print_datetime=$data_lab_request[0]->Request_Date;
+
+ $print_datetime=date('d-m-Y h:i:s A');
+
+
+ if($lab_invoice_request[0]->collected_time<>'')
+ {
+ $Collection_data='
+ Collected : '.$lab_invoice_request[0]->str_collected_time.'
+ Reported : '.$lab_invoice_request[0]->str_reported_time;
+ }
+
+ $Header='
+
+
+
+ Inovice ID : '.$invoice_master[0]->invoice_code.' '.$data_lab_request_edit_str.'
+ Patient Name : '.$data_patient_master[0]->title.' '.$data_patient_master[0]->p_fname.'
+ '.$data_patient_master[0]->p_relative.' '.$data_patient_master[0]->p_rname.'
+ Age/Sex : '.$data_patient_master[0]->str_age.'/'.$data_patient_master[0]->xgender.'
+ UHID : '.$data_patient_master[0]->p_code.'
+
+ '.$ipd_id.'
+ '.$Collection_data.'
+ Reffered By : '.$rdoc_name.'
+ Page No. : {PAGENO} / {nbpg}
+
+
+
+
+
+ ';
+
+ $Header.='
+
'.$note_edit_str.'
+ ';
+
+ $RawData="";
+ $group_name='';
+ $first_header=1;
+
+ for($i=0;$iRepoGrp==$group_name)
+ {
+ $groupHead='';
+ }else{
+ if($first_header==0)
+ {
+ //$groupHead=' ';
+ $groupHead='';
+ }else{
+ $groupHead='';
+ }
+
+ $groupHead.='
+ '.$data_lab_request[$i]->RepoGrp.' ';
+
+ $first_header=0;
+ }
+
+ $RawData=$RawData.$groupHead;
+ $RawData=$RawData.$data_lab_request[$i]->Report_Data;
+
+ $group_name=$data_lab_request[$i]->RepoGrp;
+
+ }
+
+ $complete_report=$RawData;
+
+ $inv_req_id=0;
+ if(count($lab_invoice_request)>0)
+ {
+ $inv_req_id=$lab_invoice_request[0]->id;
+ }
+
+ $this->load->model('PathLab_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.' '. $user->last_name.'['.$user_id.']['.date('d-m-Y h:m:s').']';
+
+ $udata = array(
+ 'report_data'=> $complete_report,
+ 'report_compile'=> $user_name,
+ 'report_header'=> $Header,
+ );
+
+ $sortorder_insert_id=$this->PathLab_M->update_invoice_report($udata,$inv_req_id);
+ echo 'Data Compile';
+
+ $filename = $inv_id.'-'.$lab_type.'-'.time() . '.pdf';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $lab_file_name=$folder_name.'/'.$filename;
+
+ }
+
+ public function report_compile_single($inv_id,$lab_type,$req_id,$print=1)
+ {
+ $sql="select l.*,g.RepoGrp,
+ date_format(l.collected_time,'%d-%m-%Y %h:%i %p') as str_collected_time,
+ date_format(l.reported_time,'%d-%m-%Y %h:%i %p') as str_reported_time
+ from lab_request l left join (lab_repo r join lab_rgroups g on r.GrpKey=g.mstRGrpKey)
+ on l.lab_repo_id=r.mstRepoKey
+ where l.id=".$req_id." and l.charge_id=".$inv_id." and l.lab_type=".$lab_type." order by g.sort_order";
+ $query = $this->db->query($sql);
+ $data['lab_request']=$query->result();
+
+ $data_lab_request=$data['lab_request'];
+
+ $sql="select * ,
+ date_format(l.collected_time,'%d-%m-%Y %h:%i %p') as str_collected_time,
+ date_format(l.reported_time,'%d-%m-%Y %h:%i %p') as str_reported_time
+ from lab_invoice_request l
+ where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $lab_invoice_request= $query->result();
+
+ $sql="SELECT max(r.report_edit_req_no) as no
+ from lab_request r JOIN lab_log l ON r.id=l.lab_repo_id
+ Where r.id=$req_id";
+ $query = $this->db->query($sql);
+ $data_lab_request_edit= $query->result();
+
+ if($data_lab_request_edit[0]->no>0)
+ {
+ $sql="SELECT GROUP_CONCAT(CONCAT_WS('/',l.log_type,l.log_Faults,l.comments,'Report:',r.report_name)) AS report_log
+ from lab_log l JOIN lab_request r ON l.lab_repo_id=r.id
+ WHERE r.charge_id=$inv_id AND r.lab_type=$lab_type and l.lab_repo_id=$req_id";
+
+ $query = $this->db->query($sql);
+ $data_lab_edit_error= $query->result();
+
+ $report_log='';
+
+ if(count($data_lab_edit_error)>0){
+ $report_log=$data_lab_edit_error[0]->report_log;
+ }
+
+ $data_lab_request_edit_str='/'.$data_lab_request_edit[0]->no;
+ $note_edit_str='Caution : The previous report has been corrected. Please ignore the previous report. Error Type : '.$report_log;
+ //$note_edit_str='';
+ }else{
+ $data_lab_request_edit_str='';
+ $note_edit_str='';
+ }
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select *
+ from patient_master_exten p where id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $data_patient_master= $query->result();
+
+ if($invoice_master[0]->refer_by_id>0)
+ {
+ $sql="select * from doctor_master where id=".$invoice_master[0]->refer_by_id;
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+ $rdoc_name='Dr.'.$doc_master[0]->p_fname;
+ }else{
+ $rdoc_name=$invoice_master[0]->refer_by_other;
+ }
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $ipd_id='';
+
+ if(count($ipd_master)>0)
+ {
+ $ipd_id='IPD No. : '. $ipd_master[0]->ipd_code.' ';
+ }
+
+ $insurance_case_id=$invoice_master[0]->insurance_case_id;
+
+ $org_ID='';
+
+ if($insurance_case_id>1)
+ {
+ $sql="select o.* ,i.short_name
+ from organization_case_master o join hc_insurance i on o.insurance_id=i.id
+ where o.id=".$insurance_case_id;
+ $query = $this->db->query($sql);
+ $org_master= $query->result();
+
+ if(count($org_master)>0){
+ $org_ID='Org. ID: '.$org_master[0]->case_id_code.' ';
+ $org_ID.='Org.Name : '.$org_master[0]->short_name.' ';
+ }
+ }
+
+ $print_datetime=$data_lab_request[0]->Request_Date;
+
+ $print_datetime=date('d-m-Y h:i:sa');
+
+ if($lab_invoice_request[0]->collected_time<>'')
+ {
+ $Collection_data='
+ Collected : '.$lab_invoice_request[0]->str_collected_time.'
+ Reported : '.$lab_invoice_request[0]->str_reported_time;
+ }
+
+
+ $Header='
+
+
+
+ Inovice ID : '.$invoice_master[0]->invoice_code.'
+ Patient Name : '.$data_patient_master[0]->title.' '.$data_patient_master[0]->p_fname.'
+ '.$data_patient_master[0]->p_relative.' '.$data_patient_master[0]->p_rname.'
+ Age/Sex : '.$data_patient_master[0]->str_age.'/'.$data_patient_master[0]->xgender.'
+ UHID : '.$data_patient_master[0]->p_code.'
+ Reffered By : '.$rdoc_name.'
+
+ '.$ipd_id.$org_ID.'
+
+ '.$Collection_data.'
+
+
+ ';
+
+ $Header.='
+
'.$note_edit_str.'
+ ';
+ $RawData="";
+ $group_name='';
+ $first_header=1;
+
+ for($i=0;$iRepoGrp==$group_name)
+ {
+ $groupHead='';
+ }else{
+ if($first_header==0)
+ {
+ //$groupHead=' ';
+ $groupHead='';
+ }else{
+ $groupHead='';
+ }
+
+ $groupHead.='
+ '.$data_lab_request[$i]->RepoGrp.' ';
+
+ $first_header=0;
+ }
+
+ $RawData=$RawData.$groupHead;
+ $RawData=$RawData.$data_lab_request[$i]->Report_Data;
+ $group_name=$data_lab_request[$i]->RepoGrp;
+ }
+
+ $complete_report=$RawData;
+
+
+ $inv_req_id=0;
+
+ $sql="select * from diagnosis_head_name where d_type=".$lab_type;
+ $query = $this->db->query($sql);
+ $data['lab_head_name']= $query->result();
+
+ //Report Show in PDF
+
+ $inv_req_id=$lab_invoice_request[0]->id;
+ //$complete_report=$data['lab_invoice_request'][0]->report_data;
+
+ $sql="select * from hc_item_type where itype_id=".$lab_invoice_request[0]->lab_type;
+ $query = $this->db->query($sql);
+ $report_head_row= $query->result();
+
+ $report_head=$report_head_row[0]->group_desc.' / Invoice ID :'.$invoice_master[0]->invoice_code.' / Person Name :'.$data_patient_master[0]->p_fname;
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ if($print>0)
+ {
+ if(count($data['lab_head_name'])>0)
+ {
+ $data['docname']=$data['lab_head_name'][0]->doc_name;
+ $data['docedu']=$data['lab_head_name'][0]->doc_edu;
+ $data['tech_name']=$data['lab_head_name'][0]->tech_name;
+ }else{
+ $data['docname']='';
+ $data['docedu']='';
+ $data['tech_name']='';
+ }
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name='Report'.$inv_id."-".$lab_type."-".date('dmYhis').".pdf";
+
+ $filepath=$folder_name.'/'.$file_name;
+
+ $data['complete_report']=$complete_report;
+ $data['report_head']=$report_head;
+
+ $data['report_header']=$Header;
+
+
+ $data['print_on_type']="0";
+ $data['bar_content']=$inv_id.'-'.$lab_type;
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Lab_Panel/patient_lab_report',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+
+ }else{
+ $this->load->view('Lab_Panel/lab_single_report',$data);
+ }
+ }
+
+ public function report_compile_xray_single($inv_id,$lab_type,$req_id,$print=1,$print_on_type=0)
+ {
+ $sql="select l.*,g.RepoGrp,
+ date_format(l.collected_time,'%d-%m-%Y %h:%i %p') as str_collected_time,
+ date_format(l.reported_time,'%d-%m-%Y %h:%i %p') as str_reported_time
+ from lab_request l left join (lab_repo r join lab_rgroups g on r.GrpKey=g.mstRGrpKey)
+ on l.lab_repo_id=r.mstRepoKey
+ where l.id=".$req_id." and l.charge_id=".$inv_id." and l.lab_type=".$lab_type." order by g.sort_order";
+ $query = $this->db->query($sql);
+ $data['lab_request']=$query->result();
+
+ $data_lab_request=$data['lab_request'];
+
+ $sql="select * ,
+ date_format(l.collected_time,'%d-%m-%Y %h:%i %p') as str_collected_time,
+ date_format(l.reported_time,'%d-%m-%Y %h:%i %p') as str_reported_time
+ from lab_invoice_request l
+ where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $lab_invoice_request= $query->result();
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select *
+ from patient_master_exten p where id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $data_patient_master= $query->result();
+
+ if($invoice_master[0]->refer_by_id>0)
+ {
+ $sql="select * from doctor_master where id=".$invoice_master[0]->refer_by_id;
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+ $rdoc_name='Dr.'.$doc_master[0]->p_fname;
+ }else{
+ $rdoc_name=$invoice_master[0]->refer_by_other;
+ }
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $ipd_id='';
+
+ if(count($ipd_master)>0)
+ {
+ $ipd_id='IPD No. : '. $ipd_master[0]->ipd_code.' ';
+ }
+
+ $insurance_case_id=$invoice_master[0]->insurance_case_id;
+
+ $org_ID='';
+
+ if($insurance_case_id>1)
+ {
+ $sql="select o.* ,i.short_name
+ from organization_case_master o join hc_insurance i on o.insurance_id=i.id
+ where o.id=".$insurance_case_id;
+ $query = $this->db->query($sql);
+ $org_master= $query->result();
+
+ if(count($org_master)>0){
+ $org_ID='Org. ID: '.$org_master[0]->case_id_code.' ';
+ $org_ID.='Org.Name : '.$org_master[0]->short_name.' ';
+ }
+ }
+
+ $print_datetime=$data_lab_request[0]->Request_Date;
+ $print_datetime=date('d-m-Y h:i:sa');
+
+ if($lab_invoice_request[0]->collected_time<>'')
+ {
+ $Collection_data='
+ Report Time : '.$lab_invoice_request[0]->str_reported_time;
+ }
+
+ $Header='
+
+
+
+ Patient Name : '.$data_patient_master[0]->title.' '.$data_patient_master[0]->p_fname.'
+ '.$data_patient_master[0]->p_relative.' '.$data_patient_master[0]->p_rname.'
+ Age/Sex : '.$data_patient_master[0]->str_age.'/'.$data_patient_master[0]->xgender.'
+ Reffered By : '.$rdoc_name.'
+
+
+ Inovice ID : '.$invoice_master[0]->invoice_code.'
+ UHID : '.$data_patient_master[0]->p_code.'
+ '.$ipd_id.$org_ID.'
+ '.$Collection_data.'
+
+
+ ';
+
+ $Header.='
+
+ ';
+ $RawData="";
+
+ if(count($data_lab_request)>0)
+ {
+ $groupHead=''.$data_lab_request[0]->report_name.' ';
+
+ $RawData=$RawData.$groupHead;
+ $RawData=trim($RawData.$data_lab_request[0]->Report_Data);
+ $report_data_Impression="Impression : ".nl2br($data_lab_request[0]->report_data_Impression).'
';
+ $RawData=$RawData.$report_data_Impression;
+ }
+
+ $complete_report=$RawData;
+
+ $sql="select * from diagnosis_head_name where d_type=".$lab_type;
+ $query = $this->db->query($sql);
+ $data['lab_head_name']= $query->result();
+
+ //Report Show in PDF
+
+ $inv_req_id=$lab_invoice_request[0]->id;
+ //$complete_report=$data['lab_invoice_request'][0]->report_data;
+
+ $sql="select * from hc_item_type where itype_id=".$lab_invoice_request[0]->lab_type;
+ $query = $this->db->query($sql);
+ $report_head_row= $query->result();
+
+ $report_head=$report_head_row[0]->group_desc.' / Invoice ID :'.$invoice_master[0]->invoice_code.' / Person Name :'.$data_patient_master[0]->p_fname;
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ if($print>0)
+ {
+ if(count($data['lab_head_name'])>0)
+ {
+ $data['docname']=$data['lab_head_name'][0]->doc_name;
+ $data['docedu']=$data['lab_head_name'][0]->doc_edu;
+ $data['tech_name']=$data['lab_head_name'][0]->tech_name;
+ $data['print_format_head_page']=$data['lab_head_name'][0]->print_format_head_page;
+ $data['print_page_direct']=$data['lab_head_name'][0]->print_format_head_page;
+ }else{
+ $data['docname']='';
+ $data['docedu']='';
+ $data['tech_name']='';
+ $data['print_format_head_page']='patient_lab_xray_report';
+ $data['print_page_direct']='patient_lab_xray_report';
+ }
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name='Report'.$inv_id."-".$lab_type."-".date('dmYhis').".pdf";
+
+ $filepath=$folder_name.'/'.$file_name;
+
+ $data['complete_report']=$complete_report;
+ $data['report_head']=$report_head;
+ $data['report_header']=$Header;
+
+
+ $data['print_on_type']=$print_on_type;
+ $data['bar_content']=$inv_id.'-'.$lab_type;
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $this->m_pdf->pdf->setAutoBottomMargin='pad';
+
+ $filepath=$file_name;
+
+ if($print_on_type=0){
+ $content=$this->load->view('Lab_Panel/'.$data['print_format_head_page'],$data,TRUE);
+ }else{
+ $content=$this->load->view('Lab_Panel/'.$data['print_page_direct'],$data,TRUE);
+ }
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ $this->load->view('Lab_Panel/lab_single_report',$data);
+ }
+ }
+
+ public function report_compile_edit($inv_id,$lab_type,$req_id,$print=1)
+ {
+ $sql="select l.*,g.RepoGrp
+ from lab_request l left join (lab_repo r join lab_rgroups g on r.GrpKey=g.mstRGrpKey)
+ on l.lab_repo_id=r.mstRepoKey
+ where l.id=".$req_id." and l.charge_id=".$inv_id." and l.lab_type=".$lab_type." order by g.sort_order";
+ //echo $sql;
+ $query = $this->db->query($sql);
+ $data_lab_request= $query->result();
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select *
+ from patient_master_exten p where id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $data_patient_master= $query->result();
+
+
+
+
+ if($invoice_master[0]->refer_by_id>0)
+ {
+ $sql="select * from doctor_master where id=".$invoice_master[0]->refer_by_id;
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+ $rdoc_name='Dr.'.$doc_master[0]->p_fname;
+ }else{
+ $rdoc_name=$invoice_master[0]->refer_by_other;
+ }
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$invoice_master[0]->attach_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $ipd_id='';
+
+ if(count($ipd_master)>0)
+ {
+ $ipd_id='IPD No. : '. $ipd_master[0]->ipd_code.' ';
+ }
+ $print_datetime=$data_lab_request[0]->Request_Date;
+
+ $print_datetime=date('d-m-Y h:i:sa');
+
+ if($data_lab_request[0]->collected_time<>'')
+ {
+ $Collection_data='
+ Collected : '.$data_lab_request[0]->collected_time.'
+ Reported : '.$data_lab_request[0]->reported_time;
+
+ }
+
+ $Header='
+
+
+
+ Inovice ID : '.$invoice_master[0]->invoice_code.'
+ Patient Name : '.$data_patient_master[0]->p_fname.'
+ Age/Sex : '.$data_patient_master[0]->str_age.'/'.$data_patient_master[0]->xgender.'
+ UHID : '.$data_patient_master[0]->p_code.'
+ Reffered By : '.$rdoc_name.'
+
+ '.$ipd_id.'
+ Print Date : '.$print_datetime.'
+ '.$Collection_data.'
+
+
+ ';
+
+ $Header.='
+
+ ';
+ $RawData="";
+ $group_name='';
+ $first_header=1;
+
+ for($i=0;$iRepoGrp==$group_name)
+ {
+ $groupHead='';
+ }else{
+ if($first_header==0)
+ {
+ //$groupHead=' ';
+ $groupHead='';
+ }else{
+ $groupHead='';
+ }
+
+ $groupHead.='
+ '.$data_lab_request[$i]->RepoGrp.' ';
+
+ $first_header=0;
+ }
+
+ $RawData=$RawData.$groupHead;
+ $RawData=$RawData.$data_lab_request[$i]->Report_Data;
+
+ $group_name=$data_lab_request[$i]->RepoGrp;
+
+ }
+
+ $complete_report=$Header.' '.$RawData;
+
+ $sql="select * from lab_invoice_request where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request']= $query->result();
+
+ $inv_req_id=0;
+
+ $sql="select * from diagnosis_head_name where d_type=".$lab_type;
+ $query = $this->db->query($sql);
+ $data['lab_head_name']= $query->result();
+
+ //Report Show in PDF
+
+ $inv_req_id=$data['lab_invoice_request'][0]->id;
+ //$complete_report=$data['lab_invoice_request'][0]->report_data;
+
+ $sql="select * from hc_item_type where itype_id=".$data['lab_invoice_request'][0]->lab_type;
+ $query = $this->db->query($sql);
+ $report_head_row= $query->result();
+
+ $report_head=$report_head_row[0]->group_desc.' / Invoice ID :'.$invoice_master[0]->invoice_code.' / Person Name :'.$data_patient_master[0]->p_fname;
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ if($print>0)
+ {
+ if(count($data['lab_head_name'])>0)
+ {
+ $docname=$data['lab_head_name'][0]->doc_name;
+ $docedu=$data['lab_head_name'][0]->doc_edu;
+ $tech_name=$data['lab_head_name'][0]->tech_name;
+ }else{
+ $docname='';
+ $docedu='';
+ $tech_name='';
+ }
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name='Report'.$inv_id."-".$lab_type."-".date('dmYhis').".pdf";
+
+ $filepath=$folder_name.'/'.$file_name;
+
+ $udata = array(
+ 'file_name'=>$file_name,
+ 'file_type'=>'pdf',
+ 'file_path'=>$folder_name,
+ 'full_path'=>$filepath,
+ 'orig_name'=>$file_name,
+ 'client_name'=>'system_genrate',
+ 'file_ext'=>'.pdf',
+ 'upload_by'=> $user_name,
+ 'pid'=>$invoice_master[0]->attach_id,
+ 'ipd_id'=>$invoice_master[0]->ipd_id,
+ 'case_id'=>$invoice_master[0]->insurance_case_id,
+ 'file_desc'=>$report_head,
+ 'charge_id'=>$invoice_master[0]->id,
+ 'charge_type' => $lab_type
+ );
+
+ $this->load->model('File_M');
+
+ $sql="select * from file_upload_data where Date(insert_date)=Date(sysdate()) and file_name='".$file_name."'";
+ $query = $this->db->query($sql);
+ $check_file_exist= $query->result();
+
+ if(count($check_file_exist)<1){
+ $this->File_M->insert($udata);
+ }else
+ {
+ $this->File_M->update($udata,$check_file_exist[0]->id);
+ }
+
+ create_lab_report_pdf($complete_report,$filepath,'',$report_head,$docname,$docedu,$tech_name);
+
+ }else{
+ $this->load->view('PathLab_Report/lab_final_print',$data);
+ }
+ }
+
+ public function report_remove($inv_id,$lab_type,$item_id)
+ {
+ $this->load->model('PathLab_M');
+ $this->PathLab_M->delete_request_entry($item_id);
+
+ echo 'Item Removed';
+
+ }
+
+ public function Update_CombineReport()
+ {
+ $this->load->model('PathLab_M');
+
+ $item_id=$this->input->post('item_id');
+ $checked=$this->input->post('checked');
+
+ $udata = array(
+ 'print_combine'=> $checked
+ );
+
+ $this->PathLab_M->update_test_request($udata,$item_id);
+
+ echo "Saved";
+
+ }
+
+ public function Update_Report_time()
+ {
+ $this->load->model('PathLab_M');
+
+ $datetimepicker1=$this->input->post('datetimepicker1');
+ $datetimepicker2=$this->input->post('datetimepicker2');
+ $inv_id=$this->input->post('inv_id');
+ $lab_type=$this->input->post('lab_type');
+
+ $sql="select * from lab_invoice_request where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $lab_invoice_request= $query->result();
+
+ if(count($lab_invoice_request)>0)
+ {
+ $rec_id=$lab_invoice_request[0]->id;
+
+ $udata = array(
+ 'collected_time'=> $datetimepicker1,
+ 'reported_time'=> $datetimepicker2
+ );
+
+ $this->PathLab_M->update_invoice_report($udata,$rec_id);
+ }
+
+ echo "Saved";
+ }
+
+ public function show_print_final_edit($inv_id,$lab_type,$print=0)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from lab_invoice_request where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request']= $query->result();
+
+ $sql="select * from invoice_master where id='".$inv_id."'";
+ $query = $this->db->query($sql);
+ $data_invoice_master= $query->result();
+
+ $sql="select * from patient_master_exten where id='".$data_invoice_master[0]->attach_id."'";
+ $query = $this->db->query($sql);
+ $data_person_master= $query->result();
+
+ $sql="select * from diagnosis_head_name where d_type=".$lab_type;
+ $query = $this->db->query($sql);
+ $data['lab_head_name']= $query->result();
+
+ $inv_req_id=0;
+ if(count($data['lab_invoice_request'])>0)
+ {
+ $inv_req_id=$data['lab_invoice_request'][0]->id;
+ $complete_report=$data['lab_invoice_request'][0]->report_data;
+
+ $sql="select * from hc_item_type where itype_id=".$data['lab_invoice_request'][0]->lab_type;
+ $query = $this->db->query($sql);
+ $report_head_row= $query->result();
+
+ $report_head=$report_head_row[0]->group_desc.' / Invoice ID :'.$data_invoice_master[0]->invoice_code.' / Person Name :'.$data_person_master[0]->p_fname;
+
+ $sql="select * from invoice_master where id=".$data['lab_invoice_request'][0]->invoice_id;
+ $query = $this->db->query($sql);
+ $report_invoice_info= $query->result();
+
+ if($print>0)
+ {
+ if(count($data['lab_head_name'])>0)
+ {
+ $docname=$data['lab_head_name'][0]->doc_name;
+ $docedu=$data['lab_head_name'][0]->doc_edu;
+ $tech_name=$data['lab_head_name'][0]->tech_name;
+ }else{
+ $docname='';
+ $docedu='';
+ $tech_name='';
+ }
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name='Report'.$inv_id."-".$lab_type."-".date('Ymdhis').".pdf";
+
+ $filepath=$folder_name.'/'.$file_name;
+
+ $udata = array(
+ 'file_name'=>$file_name,
+ 'file_type'=>'pdf',
+ 'file_path'=>$folder_name,
+ 'full_path'=>$filepath,
+ 'orig_name'=>$file_name,
+ 'client_name'=>'system_genrate',
+ 'file_ext'=>'.pdf',
+ 'upload_by'=> $user_name,
+ 'pid'=>$data_invoice_master[0]->attach_id,
+ 'ipd_id'=>$data_invoice_master[0]->ipd_id,
+ 'case_id'=>$data_invoice_master[0]->insurance_case_id,
+ 'file_desc'=>$report_head,
+ 'charge_id'=>$data_invoice_master[0]->id
+ );
+
+ $this->load->model('File_M');
+
+ $sql="select * from file_upload_data where Date(insert_date)=Date(sysdate()) and file_name='".$file_name."'";
+ $query = $this->db->query($sql);
+ $check_file_exist= $query->result();
+
+ if(count($check_file_exist)<1){
+ $this->File_M->insert($udata);
+ }else
+ {
+ $this->File_M->update($udata,$check_file_exist[0]->id);
+ }
+
+ $this->load->model('PathLab_M');
+
+ $rec_id=$data['lab_invoice_request'][0]->id;
+
+ $udata = array(
+ 'report_print_status'=> '1',
+ 'report_print_time'=> date('Y-m-d h:i:s'),
+ );
+
+ $this->PathLab_M->update_invoice_report($udata,$rec_id);
+
+ //create_lab_report_pdf($complete_report,$filepath,'',$report_head,$docname,$docedu,$tech_name);
+ create_Document_logo_pdf($complete_report,$filepath,'',$report_head,$docname,$docedu,$tech_name);
+
+ //load mPDF library
+
+ }else{
+ $this->load->view('PathLab_Report/lab_final_print',$data);
+ }
+ }else{
+ echo 'Error : Record not Exist in lab_invoice_request';
+ }
+
+ }
+
+ public function final_edit_single_report($inv_id,$lab_type,$print=0)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from lab_invoice_request where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request']= $query->result();
+
+ $sql="select * from invoice_master where id='".$inv_id."'";
+ $query = $this->db->query($sql);
+ $data_invoice_master= $query->result();
+
+ $sql="select * from patient_master_exten where id='".$data_invoice_master[0]->attach_id."'";
+ $query = $this->db->query($sql);
+ $data_person_master= $query->result();
+
+ $sql="select * from diagnosis_head_name where d_type=".$lab_type;
+ $query = $this->db->query($sql);
+ $data['lab_head_name']= $query->result();
+
+ $inv_req_id=0;
+ if(count($data['lab_invoice_request'])>0)
+ {
+ $inv_req_id=$data['lab_invoice_request'][0]->id;
+ $complete_report=$data['lab_invoice_request'][0]->report_data;
+
+ $sql="select * from hc_item_type where itype_id=".$data['lab_invoice_request'][0]->lab_type;
+ $query = $this->db->query($sql);
+ $report_head_row= $query->result();
+
+ $report_head=$report_head_row[0]->group_desc.' / Invoice ID :'.$data_invoice_master[0]->invoice_code.' / Person Name :'.$data_person_master[0]->p_fname;
+
+ $sql="select * from invoice_master where id=".$data['lab_invoice_request'][0]->invoice_id;
+ $query = $this->db->query($sql);
+ $report_invoice_info= $query->result();
+
+ if($print>0)
+ {
+ if(count($data['lab_head_name'])>0)
+ {
+ $docname=$data['lab_head_name'][0]->doc_name;
+ $docedu=$data['lab_head_name'][0]->doc_edu;
+ $tech_name=$data['lab_head_name'][0]->tech_name;
+ }else{
+ $docname='';
+ $docedu='';
+ $tech_name='';
+ }
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name='Report'.$inv_id."-".$lab_type."-".date('Ymdhis').".pdf";
+
+ $filepath=$folder_name.'/'.$file_name;
+
+ $udata = array(
+ 'file_name'=>$file_name,
+ 'file_type'=>'pdf',
+ 'file_path'=>$folder_name,
+ 'full_path'=>$filepath,
+ 'orig_name'=>$file_name,
+ 'client_name'=>'system_genrate',
+ 'file_ext'=>'.pdf',
+ 'upload_by'=> $user_name,
+ 'pid'=>$data_invoice_master[0]->attach_id,
+ 'ipd_id'=>$data_invoice_master[0]->ipd_id,
+ 'case_id'=>$data_invoice_master[0]->insurance_case_id,
+ 'file_desc'=>$report_head,
+ 'charge_id'=>$data_invoice_master[0]->id
+ );
+
+ $this->load->model('File_M');
+
+ $sql="select * from file_upload_data where Date(insert_date)=Date(sysdate()) and file_name='".$file_name."'";
+ $query = $this->db->query($sql);
+ $check_file_exist= $query->result();
+
+ if(count($check_file_exist)<1){
+ $this->File_M->insert($udata);
+ }else
+ {
+ $this->File_M->update($udata,$check_file_exist[0]->id);
+ }
+
+ //create_lab_report_pdf($complete_report,$filepath,'',$report_head,$docname,$docedu,$tech_name);
+ create_Document_logo_pdf($complete_report,$filepath,'',$report_head,$docname,$docedu,$tech_name);
+
+ //load mPDF library
+
+ }else{
+ $this->load->view('PathLab_Report/lab_final_print',$data);
+ }
+ }else{
+ echo 'Error : Record not Exist in lab_invoice_request';
+ }
+
+ }
+
+
+
+ public function print_pdf_create($inv_id,$lab_type,$print=0,$print_on_type=0)
+ {
+
+ $this->load->model('PathLab_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from lab_invoice_request where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request']= $query->result();
+
+ $sql="Select max(report_edit_req_no) as no
+ from lab_request where charge_id=".$inv_id." and lab_type=".$lab_type." ";
+ $query = $this->db->query($sql);
+ $data_lab_request_edit= $query->result();
+
+ if($data_lab_request_edit[0]->no>0)
+ {
+ $data_lab_request_edit_str='/'.$data_lab_request_edit[0]->no;
+ $note_edit_str='Caution : Please ignore the earlier report.';
+ }else{
+ $data_lab_request_edit_str='';
+ $note_edit_str='';
+ }
+
+ $sql="select * from invoice_master where id='".$inv_id."'";
+ $query = $this->db->query($sql);
+ $data_invoice_master= $query->result();
+
+ $sql="select * from patient_master_exten where id='".$data_invoice_master[0]->attach_id."'";
+ $query = $this->db->query($sql);
+ $data_person_master= $query->result();
+
+ $sql="select * from diagnosis_head_name where d_type=".$lab_type;
+ $query = $this->db->query($sql);
+ $data['lab_head_name']= $query->result();
+
+ $inv_req_id=0;
+ if(count($data['lab_invoice_request'])>0)
+ {
+ $inv_req_id=$data['lab_invoice_request'][0]->id;
+ $data['complete_report']=$data['lab_invoice_request'][0]->report_data;
+ $data['report_header']=$data['lab_invoice_request'][0]->report_header;
+
+ $sql="select * from hc_item_type where itype_id=".$data['lab_invoice_request'][0]->lab_type;
+ $query = $this->db->query($sql);
+ $report_head_row= $query->result();
+
+ $report_head=$report_head_row[0]->group_desc.' / Invoice ID :'.$data_invoice_master[0]->invoice_code.$data_lab_request_edit_str.' / Person Name :'.$data_person_master[0]->p_fname;
+
+ $sql="select * from invoice_master where id=".$data['lab_invoice_request'][0]->invoice_id;
+ $query = $this->db->query($sql);
+ $report_invoice_info= $query->result();
+
+ if($print>0)
+ {
+ $page_format='patient_lab_report';
+ $page_format_head='patient_lab_report';
+
+ if(count($data['lab_head_name'])>0)
+ {
+ $docname=$data['lab_head_name'][0]->doc_name;
+ $docedu=$data['lab_head_name'][0]->doc_edu;
+ $tech_name=$data['lab_head_name'][0]->tech_name;
+ $page_format=$data['lab_head_name'][0]->print_format_head_page;
+ $page_format_head=$data['lab_head_name'][0]->print_page_direct;
+ }else{
+ $docname='';
+ $docedu='';
+ $tech_name='';
+ }
+
+ $data['docname']=$docname;
+ $data['docedu']=$docedu;
+ $data['tech_name']=$tech_name;
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $file_name='Report-'.$inv_id."-".$lab_type."-".date('Ymd-his').".pdf";
+
+ $filepath=$folder_name.'/'.$file_name;
+
+ $udata = array(
+ 'file_name'=>$file_name,
+ 'file_type'=>'pdf',
+ 'file_path'=>$folder_name,
+ 'full_path'=>$filepath,
+ 'orig_name'=>$file_name,
+ 'client_name'=>'system_genrate',
+ 'file_ext'=>'.pdf',
+ 'upload_by'=> $user_name,
+ 'pid'=>$data_invoice_master[0]->attach_id,
+ 'ipd_id'=>$data_invoice_master[0]->ipd_id,
+ 'case_id'=>$data_invoice_master[0]->insurance_case_id,
+ 'file_desc'=>$report_head,
+ 'charge_id'=>$data_invoice_master[0]->id
+ );
+
+ $this->load->model('File_M');
+
+ $sql="select * from file_upload_data where Date(insert_date)=Date(sysdate()) and file_name='".$file_name."'";
+ $query = $this->db->query($sql);
+ $check_file_exist= $query->result();
+
+ $file_ID=0;
+
+ if(count($check_file_exist)<1){
+ $file_ID=$this->File_M->insert($udata);
+
+ }else
+ {
+ $this->File_M->update($udata,$check_file_exist[0]->id);
+ $file_ID=$check_file_exist[0]->id;
+ }
+
+ $Lab_reg_data = array(
+ 'file_id'=>$file_ID,
+ );
+
+ $this->PathLab_M->update_invoice_report($Lab_reg_data,$data['lab_invoice_request'][0]->id);
+
+ $data['report_head']=$report_head;
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+
+ $data['bar_content']=$inv_id.'-'.$lab_type;
+ $data["print_on_type"]=$print_on_type;
+ $data["data_lab_request_edit_str"]=$data_lab_request_edit_str;
+ $data['note_edit_str']=$note_edit_str;
+
+ if($print_on_type==1)
+ {
+ $content=$this->load->view('Lab_Panel/'.$page_format_head,$data,TRUE);
+ }else{
+ $content=$this->load->view('Lab_Panel/'.$page_format,$data,TRUE);
+ }
+
+
+ //$this->m_pdf->pdf->curlAllowUnsafeSslRequests = true;
+
+ $this->m_pdf->pdf->shrink_tables_to_fit = 1;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ //echo $content;
+ }else{
+ $this->load->view('PathLab_Report/lab_final_print',$data);
+ }
+ }else{
+ echo 'Error : Record not Exist in lab_invoice_request';
+ }
+
+ }
+
+
+ public function add_test_repo($repo_id,$test_id)
+ {
+ $sql="select * from lab_repotests where mstRepoKey=".$repo_id." and mstTestKey=".$test_id;
+ $query = $this->db->query($sql);
+ $data['lab_repotests_chk']= $query->result();
+
+ if(count($data['lab_repotests_chk'])<1)
+ {
+ $this->load->model('PathLab_M');
+
+ $sql="select Max(EOrder) as MEOrder from lab_repotests where mstRepoKey=".$repo_id;
+ $query = $this->db->query($sql);
+ $data['lab_repotests']= $query->result();
+
+ $MEOrder=0;
+ if(count($data['lab_repotests'])>0)
+ {
+ $MEOrder=$data['lab_repotests'][0]->MEOrder;
+ }
+
+ if($MEOrder === NULL)
+ {
+ $MEOrder=1;
+ }else{
+ $MEOrder=$MEOrder+1;
+ }
+
+ $udata = array(
+ 'mstRepoKey'=> $repo_id,
+ 'mstTestKey'=> $test_id,
+ 'EOrder'=> $MEOrder
+ );
+
+ $sortorder_insert_id=$this->PathLab_M->insert_item_sortorder($udata);
+
+ $showcontent=Show_Alert('success','Saved','Add successfully');
+
+ }else{
+ $sortorder_insert_id=0;
+ $showcontent=Show_Alert('error','Already....','Already Added');
+ }
+
+ $rvar=array(
+ 'insertid' => $sortorder_insert_id,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function remove_test_item($repo_id,$test_id)
+ {
+ $this->db->delete("lab_repotests", "mstRepoKey=".$repo_id." and mstTestKey=".$test_id);
+
+ }
+
+ public function test_item_search()
+ {
+ $Test_Name=$this->input->post('input_Test_name');
+ $repo_id=$this->input->post('repo_id');
+
+ $sql="select * from lab_tests where Test like '%".$Test_Name."%'";
+ $query = $this->db->query($sql);
+ $search_result= $query->result();
+
+ echo '';
+
+ }
+
+ public function lab_file_scan($repo_id,$test_id)
+ {
+ $data['repo_id']=$repo_id;
+ $data['test_id']=$test_id;
+
+ $this->load->view('PathLab_Report/lab_file_scan',$data);
+ }
+
+ public function lab_file_scan_complete($repo_id,$lab_type)
+ {
+ $data['repo_id']=$repo_id;
+ $data['lab_type']=$lab_type;
+
+ $this->load->view('PathLab_Report/lab_file_scan_whole',$data);
+ }
+
+ public function lab_file_upload($repo_id,$test_id)
+ {
+ $data['repo_id']=$repo_id;
+ $data['test_id']=$test_id;
+
+ $this->load->view('PathLab_Report/lab_file_upload',$data);
+ }
+
+ public function lab_file_upload_complete($inv_id,$lab_type)
+ {
+ $data['inv_id']=$inv_id;
+ $data['lab_type']=$lab_type;
+
+ $this->load->view('PathLab_Report/lab_file_upload_complete',$data);
+ }
+
+ public function save_image($repo_id,$test_id)
+ {
+ $filename = $repo_id.'-'.$test_id.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg|dcm';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('webcam')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from lab_request where id=".$repo_id;
+ $query = $this->db->query($sql);
+ $lab_request_result= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($lab_request_result)>0)
+ {
+ $pid=$lab_request_result[0]->patient_id;
+ $ipd_id=$lab_request_result[0]->ipd_id;
+ $org_id=$lab_request_result[0]->org_id;
+ $charge_type=$lab_request_result[0]->lab_type;
+ $inv_id=$lab_request_result[0]->charge_id;
+ }
+
+ $udata = array(
+ 'repo_id'=> $repo_id,
+ 'repo_test_id'=> $test_id,
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'charge_type'=> $charge_type,
+ 'charge_id'=>$inv_id,
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+
+ echo $filename;
+ }
+ }
+
+ public function save_image_complete($inv_id,$lab_type)
+ {
+ $filename = $inv_id.'-'.$lab_type.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('webcam')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from lab_request where charge_id=$inv_id and lab_type=$lab_type" ;
+ $query = $this->db->query($sql);
+ $lab_request_result= $query->result();
+
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+
+ if(count($lab_request_result)>0)
+ {
+ $pid=$lab_request_result[0]->patient_id;
+ $ipd_id=$lab_request_result[0]->ipd_id;
+ $org_id=$lab_request_result[0]->org_id;
+ $charge_type=$lab_request_result[0]->lab_type;
+ $repo_id=$lab_request_result[0]->id;
+ }
+
+ $udata = array(
+ 'repo_id'=> $repo_id,
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'charge_type'=> $lab_type,
+ 'charge_id'=>$inv_id,
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+
+ echo $filename;
+ }
+ }
+
+ public function process_ajax()
+ {
+ $output_dir = "uploads/";
+
+ if(isset($_FILES["myfile"]))
+ {
+ $ret = array();
+
+ $error = $_FILES["myfile"]["error"];
+
+ // upload single file
+ if(!is_array($_FILES["myfile"]["name"])) //single file
+ {
+ $fileName = $_FILES["myfile"]["name"];
+ move_uploaded_file($_FILES["myfile"]["tmp_name"],$output_dir.$fileName);
+ $ret[]= $fileName;
+ }
+ else
+ {
+ // Handle Multiple files
+ $fileCount = count($_FILES["myfile"]["name"]);
+ for($i=0; $i<$fileCount; $i++)
+ {
+ $fileName = $_FILES["myfile"]["name"][$i];
+ move_uploaded_file($_FILES["myfile"]["tmp_name"][$i],$output_dir.$fileName);
+ $ret[]= $fileName;
+ }
+ }
+ // output file names as comma seperated strings to display status
+ echo json_encode($ret);
+ }
+ }
+
+ public function lab_file_list($repo_id,$lab_type)
+ {
+ $sql="select * from file_upload_data
+ where repo_id=".$repo_id." and repo_test_id=".$lab_type;
+ $query = $this->db->query($sql);
+ $data['lab_file_list']= $query->result();
+
+ $this->load->view('PathLab_Report/lab_report_file_show',$data);
+
+ }
+
+ public function lab_file_list_all($inv_id,$lab_type)
+ {
+ $sql="select * from file_upload_data
+ where charge_id=$inv_id and charge_type=$lab_type";
+ $query = $this->db->query($sql);
+ $data['lab_file_list']= $query->result();
+
+
+
+ $this->load->view('PathLab_Report/lab_report_file_show',$data);
+
+ }
+
+ public function render_file($file_id)
+ {
+ $sql="select * from file_upload_data where id=".$file_id;
+ $query = $this->db->query($sql);
+ $data['lab_file_details']= $query->result();
+
+ $this->load->view('PathLab_Report/lab_file_show',$data);
+ }
+
+ public function lab_files_upload($repo_id,$test_id)
+ {
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $output_dir = $folder_name;
+
+ if(isset($_FILES["myfile"]))
+ {
+ $ret = array();
+
+ $error = $_FILES["myfile"]["error"];
+
+ // upload single file
+ if(!is_array($_FILES["myfile"]["name"])) //single file
+ {
+ $filename = $repo_id.'-'.$test_id.'-'.time() .$_FILES["myfile"]["name"];
+ $config['upload_path'] = $folder_name;
+ $config['file_name'] = $filename;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg|pdf|doc';
+
+ $this->load->library('upload', $config);
+ echo $filename;
+ //move_uploaded_file($_FILES["myfile"]["tmp_name"],$output_dir.$fileName);
+
+ if (!$this->upload->do_upload('myfile')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+ $this->load->model('File_M');
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from lab_request where id=".$repo_id;
+ $query = $this->db->query($sql);
+ $lab_request_result= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($lab_request_result)>0)
+ {
+ $pid=$lab_request_result[0]->patient_id;
+ $ipd_id=$lab_request_result[0]->ipd_id;
+ $org_id=$lab_request_result[0]->org_id;
+ $charge_type=$lab_request_result[0]->lab_type;
+ $inv_id=$lab_request_result[0]->charge_id;
+ }
+
+ $udata = array(
+ 'repo_id'=> $repo_id,
+ 'repo_test_id'=> $test_id,
+ 'charge_type'=> $charge_type,
+ 'charge_id'=>$inv_id,
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+
+ }
+
+ $ret[]= $_FILES["myfile"]["name"];
+ }
+ else
+ {
+ // Handle Multiple files
+ $fileCount = count($_FILES["myfile"]["name"]);
+ for($i=0; $i<$fileCount; $i++)
+ {
+ $filename = $repo_id.'-'.$test_id.'-'.time() .$_FILES["myfile"]["name"][$i];
+
+ //$fileName = $_FILES["myfile"]["name"][$i];
+ //move_uploaded_file($_FILES["myfile"]["tmp_name"][$i],$output_dir.$fileName);
+
+ if (!$this->upload->do_upload($_FILES["myfile"]["tmp_name"][$i])) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+ $this->load->model('File_M');
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from lab_request where id=".$repo_id;
+ $query = $this->db->query($sql);
+ $lab_request_result= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($lab_request_result)>0)
+ {
+ $pid=$lab_request_result[0]->patient_id;
+ $ipd_id=$lab_request_result[0]->ipd_id;
+ $org_id=$lab_request_result[0]->org_id;
+ $charge_type=$lab_request_result[0]->lab_type;
+ $inv_id=$lab_request_result[0]->charge_id;
+ }
+
+ $udata = array(
+ 'repo_id'=> $repo_id,
+ 'repo_test_id'=> $test_id,
+ 'charge_type'=> $charge_type,
+ 'charge_id'=>$inv_id,
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+ }
+
+ $ret[]= $_FILES["myfile"]["name"][$i];
+ }
+ }
+ // output file names as comma seperated strings to display status
+ echo json_encode($ret);
+ }
+ }
+
+ public function lab_files_upload_complete($inv_id,$lab_type)
+ {
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ chmod($folder_name, 0777);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $output_dir = $folder_name;
+
+ if(isset($_FILES["myfile"]))
+ {
+ $ret = array();
+
+ $error = $_FILES["myfile"]["error"];
+
+ // upload single file
+ if(!is_array($_FILES["myfile"]["name"])) //single file
+ {
+ $filename = $inv_id.'-'.$lab_type.'-'.time() .$_FILES["myfile"]["name"];
+ $config['upload_path'] = $folder_name;
+ $config['file_name'] = $filename;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg|pdf|doc';
+
+ $this->load->library('upload', $config);
+ echo $filename;
+ //move_uploaded_file($_FILES["myfile"]["tmp_name"],$output_dir.$fileName);
+
+ if (!$this->upload->do_upload('myfile')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+ $this->load->model('File_M');
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from lab_request where charge_id=$inv_id and lab_type=$lab_type" ;
+ $query = $this->db->query($sql);
+ $lab_request_result= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($lab_request_result)>0)
+ {
+ $pid=$lab_request_result[0]->patient_id;
+ $ipd_id=$lab_request_result[0]->ipd_id;
+ $org_id=$lab_request_result[0]->org_id;
+ $repo_id=$lab_request_result[0]->id;
+
+
+ }
+
+ $udata = array(
+ 'repo_id'=> $repo_id,
+ 'charge_type'=> $lab_type,
+ 'charge_id'=>$inv_id,
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+
+ }
+
+ $ret[]= $_FILES["myfile"]["name"];
+ }
+ else
+ {
+ // Handle Multiple files
+ $fileCount = count($_FILES["myfile"]["name"]);
+ for($i=0; $i<$fileCount; $i++)
+ {
+ $filename = $inv_id.'-'.$lab_type.'-'.time() .$_FILES["myfile"]["name"][$i];
+
+ //$fileName = $_FILES["myfile"]["name"][$i];
+ //move_uploaded_file($_FILES["myfile"]["tmp_name"][$i],$output_dir.$fileName);
+
+ if (!$this->upload->do_upload($_FILES["myfile"]["tmp_name"][$i])) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+ $this->load->model('File_M');
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from lab_request where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $lab_request_result= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($lab_request_result)>0)
+ {
+ $pid=$lab_request_result[0]->patient_id;
+ $ipd_id=$lab_request_result[0]->ipd_id;
+ $org_id=$lab_request_result[0]->org_id;
+ }
+
+ $udata = array(
+ 'repo_id'=> $repo_id,
+ 'charge_type'=> $lab_type,
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+ }
+
+ $ret[]= $_FILES["myfile"]["name"][$i];
+ }
+ }
+ // output file names as comma seperated strings to display status
+ echo json_encode($ret);
+ }
+ }
+
+
+ public function send_sms_lab_report($inv_id,$lab_type)
+ {
+ $sql="select * from lab_invoice_request where invoice_id='".$inv_id."' and lab_type='".$lab_type."'";
+ $query = $this->db->query($sql);
+ $lab_invoice_request= $query->result();
+
+ $file_id=0;
+
+ if(count($lab_invoice_request)>0)
+ {
+ $file_id=$lab_invoice_request[0]->file_id;
+
+ $file_id_en=encode_dst($file_id);
+
+ $message="Your Report is ready. click on ".base_url()."PhoneSMS/show_lab_report/".$file_id_en.' From Apollo Diag.&Path. Lab';
+ $message = urlencode($message);// urlencode your message
+
+ //echo $message;
+
+ $tomobile=$this->input->post('sms_number');
+
+ //Send SMS
+ $url="https://www.way2sms.com/api/v1/sendCampaign";
+
+ $curl = curl_init();
+ curl_setopt($curl, CURLOPT_POST, 1);// set post data to true
+ curl_setopt($curl, CURLOPT_POSTFIELDS, "apikey=B7DYP7GU8K92YJ8ZQGE6DWCUM1DXGOBS&secret=JG534P9WPHQ0Z9H7&usetype=prod&phone=$tomobile&senderid=DSTECH&message=$message");// post data
+ // query parameter values must be given without squarebrackets.
+ // Optional Authentication:
+ curl_setopt($curl, CURLOPT_HTTPAUTH, CURLAUTH_BASIC);
+ curl_setopt($curl, CURLOPT_URL, $url);
+ curl_setopt($curl, CURLOPT_RETURNTRANSFER, 1);
+ $result = curl_exec($curl);
+ curl_close($curl);
+
+ echo 'Message Send.';
+ }else{
+ echo 'Report Not Ready';
+ }
+
+ }
+
+
+ public function lab_tab_2_process($req_id)
+ {
+ $sql="select * from lab_request where id=".$req_id;
+ $query = $this->db->query($sql);
+ $labreport_entry= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $insert_id=0;
+
+ $this->load->model('PathLab_M');
+
+ if(count($labreport_entry)>0)
+ {
+
+ $sql="select r.mstRepoKey,t.mstTestKey,j.EOrder,t.Result
+ from lab_repo r join lab_repotests j join lab_tests t
+ on r.mstRepoKey=j.mstRepoKey and j.mstTestKey=t.mstTestKey
+ where r.mstRepoKey=".$labreport_entry[0]->lab_repo_id." order by j.EOrder";
+
+ $query = $this->db->query($sql);
+ $chkdata= $query->result();
+
+ for ($i = 0; $i < count($chkdata); ++$i)
+ {
+
+ $sql="select * from lab_request_item
+ where lab_request_id='".$req_id."' and lab_repo_id='".$chkdata[$i]->mstRepoKey."'
+ and lab_test_id='".$chkdata[$i]->mstTestKey."'";
+
+
+ $query = $this->db->query($sql);
+ $chktestlist= $query->result();
+
+ if(count($chktestlist)<1)
+ {
+ $udata = array(
+ 'lab_request_id'=> $req_id,
+ 'lab_repo_id'=> $chkdata[$i]->mstRepoKey,
+ 'lab_test_id'=> $chkdata[$i]->mstTestKey,
+ );
+
+ $insert_id=$this->PathLab_M->insert_test_entry($udata);
+ }
+ }
+ }
+
+ $sql= "select d.mstTestKey,d.Test,d.TestID,d.Result,d.Formula,d.VRule,d.VMsg,d.Unit, d.FixedNormals,
+ i.lab_test_value,i.lab_test_remark,i.id ,s.EOrder,
+ group_concat(concat(o.id,':',o.option_text,':',o.option_value) ORDER BY o.sort_id) as option_value,
+ d.Formula
+ from (lab_request_item i join lab_tests d join lab_repotests s
+ on i.lab_test_id=d.mstTestKey and d.mstTestKey=s.mstTestKey and i.lab_repo_id=s.mstRepoKey)
+ left join lab_tests_option o on d.mstTestKey=o.mstTestKey
+ where i.lab_request_id=".$req_id." group by d.mstTestKey order by s.EOrder";
+
+ $query = $this->db->query($sql);
+ $data['lab_request_item_entry']= $query->result();
+
+ $sql="select * from lab_request where id=".$req_id;
+ $query = $this->db->query($sql);
+ $data['lab_request_master']= $query->result();
+
+ $this->load->view('PathLab_Report/lab_test_entry',$data);
+
+ }
+
+
+ public function report_edit_request_show($repo_id)
+ {
+ $sql="select * from lab_request where id=".$repo_id;
+ $query = $this->db->query($sql);
+ $data['lab_request']= $query->result();
+
+ $sql="SELECT s.id,m.analytical_id,
+ Concat(s.analytical_faults,'[',m.analytical_name,']' ) AS log_type
+ from lab_log_analytical_type m JOIN lab_log_type_master s
+ ON m.analytical_id=s.analytical_faults_type";
+ $query = $this->db->query($sql);
+ $data['lab_log_type_master']= $query->result_array();
+
+ $data['Faults_id']=1;
+
+ $data['repo_id']=$repo_id;
+
+ $this->load->view('PathLab_Report/lab_report_edit_request',$data);
+
+ }
+
+
+ public function report_edit_request()
+ {
+ $this->load->model('PathLab_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.' '. $user->last_name.'['.$user_id.']['.date('d-m-Y h:i:s').']';
+
+ $sql="select * from lab_log_type_master where id=".$this->input->post('cbo_sub_Analytical');
+ $query = $this->db->query($sql);
+ $lab_log_type_master= $query->result();
+
+ $Analytical_text="";
+ $sub_Analytical_text="";
+ $log_type_id="0";
+
+ if(count($lab_log_type_master)>0)
+ {
+ $log_type_id=$lab_log_type_master[0]->analytical_faults_type;
+ $sub_Analytical_text=$lab_log_type_master[0]->analytical_faults;
+
+
+ $sql="select * from lab_log_analytical_type where analytical_id=".$lab_log_type_master[0]->analytical_faults_type;
+ $query = $this->db->query($sql);
+ $lab_log_analytical_type= $query->result();
+
+ $Analytical_text=$lab_log_analytical_type[0]->analytical_name;
+ }
+
+ $udata = array(
+ 'log_by_id'=> $user_id,
+ 'log_by'=> $user_name,
+ 'log_type_id'=> $log_type_id,
+ 'log_type'=> $Analytical_text,
+ 'log_Faults_id'=> $this->input->post('cbo_sub_Analytical'),
+ 'log_Faults'=> $sub_Analytical_text,
+ 'comments'=> $this->input->post('other_reason'),
+ 'lab_repo_id'=>$this->input->post('repo_id'),
+ );
+
+ $insert_id=$this->PathLab_M->insert_lab_log($udata);
+ if($insert_id>0)
+ {
+ $showcontent="Request to OPEN Report Done";
+ $id_key=$this->input->post('repo_id');
+
+ $sql="select * from lab_request where id=".$id_key;
+ $query = $this->db->query($sql);
+ $lab_request= $query->result();
+
+ $report_edit_req_no=$lab_request[0]->report_edit_req_no;
+
+ $report_edit_req_no =$report_edit_req_no+1;
+
+ $data = array(
+ 'status'=> '1',
+ 'report_edit_req_no'=>$report_edit_req_no,
+ );
+
+ $this->PathLab_M->update_test_request($data,$id_key);
+
+ }else{
+ $showcontent="Some Error, Please Contact to Admin";
+ }
+
+ $rvar=array(
+ 'insertid' => $insert_id,
+ 'showcontent'=> $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function update_lab_no()
+ {
+ $this->load->model('PathLab_M');
+
+ $lab_req_id=$this->input->post('lab_req_id');
+ $inputLabNo=$this->input->post('inputLabNo');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.' '. $user->last_name.'['.$user_id.']['.date('d-m-Y h:i:s').']';
+
+ $sql="select * from lab_invoice_request where id=$lab_req_id ";
+ $query = $this->db->query($sql);
+ $lab_invoice_request= $query->result();
+
+ if(count($lab_invoice_request)>0)
+ {
+ $udata = array(
+ 'lab_test_no'=> $inputLabNo,
+ );
+
+ $this->PathLab_M->update_invoice_report($udata,$lab_req_id);
+ }
+
+ echo "Saved";
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Lab_Report.php b/old_code_ci3/controllers/Lab_Report.php
new file mode 100644
index 0000000..736cbf9
--- /dev/null
+++ b/old_code_ci3/controllers/Lab_Report.php
@@ -0,0 +1,564 @@
+load->view('Lab_Panel/lab_main');
+ }
+
+ public function lab_path($lab_type)
+ {
+ $data['lab_type'] = $lab_type;
+ $this->load->view('Lab_Panel/pathlab_request_list', $data);
+ }
+
+ public function search_lab_4($lab_type)
+ {
+ $sdata = $this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if (trim($sdata) == '') {
+ $sql = "select m.id as inv_id,m.invoice_code,m.inv_date,
+ Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_rname) as inv_name,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age,
+ group_concat(concat_ws(';',t.item_name,t.item_name,t.id,check_item_request(m.id,t.id)) SEPARATOR '#') as data_array,
+ r.daily_sr_no,r.lab_test_no
+ from ( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ Left JOIN lab_invoice_request r ON m.id=r.invoice_id
+
+ where m.payment_status=1 and y.itype_id=" . $lab_type . "
+
+ group by m.id order by m.id desc limit 200";
+ } else {
+ $sql = "select m.id as inv_id,m.invoice_code,m.inv_date,Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_rname) as inv_name,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age,
+ group_concat(concat_ws(';',t.item_name,t.id,m.id,check_item_request(m.id,t.id)) SEPARATOR '#') as data_array,
+ r.daily_sr_no,r.lab_test_no
+ from ( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ Left JOIN lab_invoice_request r ON m.id=r.invoice_id
+
+ where m.payment_status=1 and y.itype_id= " . $lab_type . " AND (m.invoice_code LIKE '%" . $sdata . "'
+ OR p.p_fname LIKE '%" . $sdata . "%'
+ OR p.p_code LIKE '%" . $sdata . "' )
+
+ group by m.id order by m.id desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labreport_preprocess'] = $query->result();
+
+ if ($lab_type == 5 or $lab_type == 6) // Pathology or Biopsy
+ {
+ $this->load->view('Lab_Panel/lab_report_tab_path', $data);
+ } else {
+ $this->load->view('Lab_Panel/lab_report_tab_1', $data);
+ }
+ }
+
+ public function search_lab_4_labno($lab_type)
+ {
+ $sdata = $this->input->post('txtsearch_labno');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if (trim($sdata) == '') {
+ $sql = "select m.id as inv_id,m.invoice_code,m.inv_date,
+ Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_rname) as inv_name,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age,
+ group_concat(concat_ws(';',t.item_name,t.item_name,t.id,check_item_request(m.id,t.id)) SEPARATOR '#') as data_array,
+ r.daily_sr_no,r.lab_test_no
+ from ( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ JOIN lab_invoice_request r ON m.id=r.invoice_id And r.lab_test_no>0
+ where m.payment_status=1 and y.itype_id=$lab_type and m.inv_date >=date_add(curdate(),interval -3 day)
+ group by m.id order by m.id desc limit 50";
+ } else {
+ $sql = "select m.id as inv_id,m.invoice_code,m.inv_date,
+ Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_rname) as inv_name,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age,
+ group_concat(concat_ws(';',t.item_name,t.item_name,t.id,check_item_request(m.id,t.id)) SEPARATOR '#') as data_array,
+ r.daily_sr_no,r.lab_test_no
+ from ( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ JOIN lab_invoice_request r ON m.id=r.invoice_id And r.lab_test_no>0
+
+ where m.payment_status=1 and y.itype_id=$lab_type AND r.lab_test_no=$sdata
+
+ group by m.id order by m.id desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labreport_preprocess'] = $query->result();
+
+ $this->load->view('Lab_Panel/lab_report_tab_1', $data);
+ }
+
+
+ public function search_lab_4_srno($lab_type)
+ {
+ $sdata = $this->input->post('txtsearch_srno');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if (trim($sdata) == '') {
+ $sql = "select m.id as inv_id,m.invoice_code,m.inv_date,
+ Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_rname) as inv_name,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age,
+ group_concat(concat_ws(';',t.item_name,t.item_name,t.id,check_item_request(m.id,t.id)) SEPARATOR '#') as data_array,
+ r.daily_sr_no,r.lab_test_no
+ from ( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ JOIN lab_invoice_request r ON m.id=r.invoice_id And r.daily_sr_no>0
+ where m.payment_status=1 and y.itype_id=$lab_type and m.inv_date >=date_add(curdate(),interval -3 day)
+ group by m.id order by m.id desc limit 50";
+ } else {
+ $sql = "select m.id as inv_id,m.invoice_code,m.inv_date,
+ Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_rname) as inv_name,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age,
+ group_concat(concat_ws(';',t.item_name,t.item_name,t.id,check_item_request(m.id,t.id)) SEPARATOR '#') as data_array,
+ r.daily_sr_no,r.lab_test_no
+ from ( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ JOIN lab_invoice_request r ON m.id=r.invoice_id And r.daily_sr_no>0
+
+ where m.payment_status=1 and y.itype_id=$lab_type AND r.daily_sr_no=$sdata
+
+ group by m.id order by m.id desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labreport_preprocess'] = $query->result();
+
+ $this->load->view('Lab_Panel/lab_report_tab_1', $data);
+ }
+
+ public function lab_tab_1_process($test_id, $lab_type)
+ {
+ $sql = "select m.invoice_code,p.p_fname as inv_name,t.item_name,t.id as test_id,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age,
+ if(l.mstRepoKey is null,0,l.mstRepoKey) as mstRepoKey,if(l.mstRepoKey is null,item_name,l.Title) as Title,m.inv_date,
+ r.lab_repo_id,y.group_desc as item_type_desc,y.itype_id,m.insurance_case_id,m.ipd_id,
+ m.id as inv_id,m.attach_id,m.insurance_case_id,m.net_amount
+ from (( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ left join lab_request r on t.id=r.charge_item_id)
+ left join lab_repo l on t.item_id=l.charge_id
+ where m.payment_status=1 and y.itype_id=" . $lab_type . " and r.id is null and t.id=" . $test_id;
+
+ $query = $this->db->query($sql);
+ $data['labreport_preprocess'] = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $print_allowed = 0;
+ $insert_id = 0;
+
+ if (count($data['labreport_preprocess']) > 0) {
+ if ($data['labreport_preprocess'][0]->insurance_case_id > 0 || $data['labreport_preprocess'][0]->ipd_id > 0) {
+ $print_allowed = 1;
+ } else {
+ $sql = "select sum(if(credit_debit=0,amount,amount*-1)) as paid_amount from payment_history where payof_type=2 and payof_id=" . $data['labreport_preprocess'][0]->inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_amount'] = $query->result();
+
+ if (count($data['inv_amount']) < 1) {
+ $paid_Amount = 0;
+ } else {
+ $paid_Amount = $data['inv_amount'][0]->paid_amount;
+ $inv_amount = $data['labreport_preprocess'][0]->net_amount;
+
+ if ($inv_amount <= $paid_Amount) {
+ $print_allowed = 1;
+ }
+ }
+ }
+
+ $this->load->model('PathLab_M');
+
+ $udata = array(
+ 'lab_repo_id' => $data['labreport_preprocess'][0]->mstRepoKey,
+ 'charge_id' => $data['labreport_preprocess'][0]->inv_id,
+ 'lab_type' => $data['labreport_preprocess'][0]->itype_id,
+ 'charge_item_id' => $data['labreport_preprocess'][0]->test_id,
+ 'invoice_code' => $data['labreport_preprocess'][0]->invoice_code,
+ 'patient_name' => $data['labreport_preprocess'][0]->inv_name,
+ 'patient_id' => $data['labreport_preprocess'][0]->attach_id,
+ 'ipd_id' => $data['labreport_preprocess'][0]->ipd_id,
+ 'org_id' => $data['labreport_preprocess'][0]->insurance_case_id,
+ 'Request_Date' => $data['labreport_preprocess'][0]->inv_date,
+ 'report_name' => $data['labreport_preprocess'][0]->Title,
+ 'insert_by' => $user_name,
+ 'print_allowed' => $print_allowed,
+ 'collected_time' => date('Y-m-d H:i:s')
+ );
+
+ //print_r ($udata);
+ $insert_id = $this->PathLab_M->insert_test_request($udata);
+
+ $sql = "select id from lab_invoice_request
+ where lab_type=$lab_type and invoice_id=" . $data['labreport_preprocess'][0]->inv_id;
+ $query = $this->db->query($sql);
+ $lab_invoice_request = $query->result();
+
+ if (count($lab_invoice_request) < 1) {
+ $sql = "select count(*) as no_rec from lab_invoice_request
+ where lab_type=$lab_type and date(report_insert)=curdate()";
+ $query = $this->db->query($sql);
+ $lab_invoice_count = $query->result();
+
+ $count_rec = $lab_invoice_count[0]->no_rec;
+
+ $count_rec = $count_rec + 1;
+
+ $udata = array(
+ 'invoice_id' => $data['labreport_preprocess'][0]->inv_id,
+ 'invoice_code' => $data['labreport_preprocess'][0]->invoice_code,
+ 'lab_type' => $data['labreport_preprocess'][0]->itype_id,
+ 'print_allowed' => $print_allowed,
+ 'collected_time' => date('Y-m-d H:i:s'),
+ 'daily_sr_no' => $count_rec
+ );
+ $insert_invoice_request = $this->PathLab_M->insert_invoice_report($udata);
+ } else {
+ $udata = array(
+ 'print_allowed' => $print_allowed,
+ 'collected_time' => date('Y-m-d H:i:s')
+ );
+ $insert_invoice_request = $this->PathLab_M->update_invoice_report($udata, $lab_invoice_request[0]->id);
+ }
+ }
+
+ //Add Second Step
+
+
+ echo $insert_id;
+ }
+
+ public function create_report_xray($req_id)
+ {
+
+ $this->load->model('PathLab_M');
+
+ $sql = "select * from lab_request where id=" . $req_id;
+ $query = $this->db->query($sql);
+ $data_lab_request = $query->result();
+
+ $p_id = $data_lab_request[0]->patient_id;
+
+ $sql = "select * from patient_master_exten where id=$p_id";
+ $query = $this->db->query($sql);
+ $data_patient_data = $query->result();
+
+
+ $sql = "select mstRepoKey,Title,HTMLData,GrpKey,charge_id,RepoGrp
+ from lab_repo join lab_rgroups on lab_repo.GrpKey=lab_rgroups.mstRGrpKey
+ where mstRepoKey=" . $data_lab_request[0]->lab_repo_id;
+
+ $query = $this->db->query($sql);
+ $data_report_format = $query->result();
+
+ $sql = "select * from invoice_master where attach_type=0 and id=" . $data_lab_request[0]->charge_id;
+ $query = $this->db->query($sql);
+ $data_invoice_master = $query->result();
+
+ $sql = "select id from lab_invoice_request where invoice_id=" . $data_lab_request[0]->charge_id . " and lab_type=" . $data_lab_request[0]->lab_type;
+ $query = $this->db->query($sql);
+ $lab_invoice_request = $query->result();
+
+ $sql = "select * from invoice_item where id=" . $data_lab_request[0]->charge_item_id;;
+ $query = $this->db->query($sql);
+ $invoice_item = $query->result();
+
+
+
+
+
+ if (count($data_report_format) > 0) {
+
+ $Report_Head_H3 = '' . $data_report_format[0]->Title . ' ';
+ $Report_string = $data_report_format[0]->HTMLData;
+ } else {
+
+ $Report_Head_H3 = '' . $data_lab_request[0]->report_name . ' ';
+ $Report_string = "";
+ }
+
+ $Report_Header = '
+
+
+ ' . $Report_Head_H3 . '
+
+
+
+ ';
+
+ $Report_Footer = $data_lab_request[0]->Remark;
+
+ //update report_string with test parameter
+
+ $complete_report = $Report_Header . $Report_string . $Report_Footer;
+
+ $udata = array(
+ 'Report_Data' => $complete_report,
+ 'status' => 1,
+ 'reported_time' => date('Y-m-d H:i:s')
+ );
+
+ $this->PathLab_M->update_test_request($udata, $req_id);
+
+ $udata = array(
+ 'reported_time' => date('Y-m-d H:i:s')
+ );
+ $this->PathLab_M->update_invoice_report($udata, $lab_invoice_request[0]->id);
+
+ $sql = "select * from lab_request where id=" . $req_id;
+ $query = $this->db->query($sql);
+ $data['report_format'] = $query->result();
+
+ $sql = "select * from radiology_ultrasound_template where charge_id=" . $invoice_item[0]->item_id;
+ $sql = "select * from radiology_ultrasound_template order by Template_Name";
+ $query = $this->db->query($sql);
+ $data['radiology_ultrasound_template'] = $query->result();
+
+
+ $this->load->view('PathLab_Report/lab_final_report_show_xray', $data);
+
+ //redirect('Lab_Admin/show_report_final/'.$req_id);
+ }
+
+ public function show_report_final($req_id)
+ {
+ $sql = "select * from lab_request where id=" . $req_id;
+ $query = $this->db->query($sql);
+ $data['report_format'] = $query->result();
+
+ $sql = "select * from invoice_item where id=" . $data['report_format'][0]->charge_item_id;
+ $query = $this->db->query($sql);
+ $data['invoice_item'] = $query->result();
+
+ $sql = "select * from radiology_ultrasound_template where charge_id=" . $data['invoice_item'][0]->item_id;
+ $sql = "select * from radiology_ultrasound_template order by Template_Name";
+ $query = $this->db->query($sql);
+ $data['radiology_ultrasound_template'] = $query->result();
+
+ $this->load->view('PathLab_Report/lab_final_report_show_xray', $data);
+ }
+
+ public function get_template_xray($req_id)
+ {
+ $sql = "select * from radiology_ultrasound_template where id=$req_id";
+ $query = $this->db->query($sql);
+ $radiology_ultrasound_template = $query->result();
+
+ $Findings = "";
+ $Impression = "";
+
+ if (count($radiology_ultrasound_template) > 0) {
+ $Findings = $radiology_ultrasound_template[0]->Findings;
+ $Impression = $radiology_ultrasound_template[0]->Impression;
+ }
+
+ $rvar = array(
+ 'Findings' => $Findings,
+ 'Impression' => $Impression,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ public function Final_Update_xray($req_id)
+ {
+ $this->load->model('PathLab_M');
+
+ $udata = array(
+ 'Report_Data' => $this->input->post('HTMLData'),
+ 'report_data_Impression' => $this->input->post('report_data_Impression')
+ );
+
+ $this->PathLab_M->update_test_request($udata, $req_id);
+
+ echo "Saved";
+ }
+
+ public function confirm_report_xray($req_id)
+ {
+ $this->load->model('PathLab_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $udata = array(
+ 'confirm_by' => $user_name,
+ 'status' => 2
+ );
+
+ $this->PathLab_M->update_test_request($udata, $req_id);
+
+ echo "Verified and Ready for Print";
+ }
+
+
+
+ public function select_lab_invoice_path($inv_id, $lab_type)
+ {
+ $sql = "select * from invoice_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_master'] = $query->result();
+
+ $pno = $data['inv_master'][0]->attach_id;
+
+ $sql = "select *,GET_AGE_1(dob,age,age_in_month,estimate_dob) as str_age,
+ Date_Format(insert_date,'%Y-%m-%d') as str_regdate,
+ if(gender=1,'Male','Female') as xgender ,if(date_add(insert_date,interval 12 hour)>sysdate(),1,0) as p_edit
+ from patient_master where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $sql = "select * from lab_invoice_request
+ where invoice_id='" . $inv_id . "' and lab_type='" . $lab_type . "'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request'] = $query->result();
+
+ $data['inv_id'] = $inv_id;
+ $data['lab_type'] = $lab_type;
+ $data['inv_code'] = $data['inv_master'][0]->invoice_code;;
+
+ $this->load->view('Lab_Panel/lab_invoice_main', $data);
+ }
+
+ //Other then XRay
+
+ public function select_lab_invoice($inv_id, $lab_type)
+ {
+ $sql = "select * from invoice_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_master'] = $query->result();
+
+ $pno = $data['inv_master'][0]->attach_id;
+
+ $sql = "select *,GET_AGE_1(dob,age,age_in_month,estimate_dob) as str_age,
+ Date_Format(insert_date,'%Y-%m-%d') as str_regdate,
+ if(gender=1,'Male','Female') as xgender ,if(date_add(insert_date,interval 12 hour)>sysdate(),1,0) as p_edit
+ from patient_master where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $sql = "select * from lab_invoice_request
+ where invoice_id='" . $inv_id . "' and lab_type='" . $lab_type . "'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request'] = $query->result();
+
+ $data['inv_id'] = $inv_id;
+ $data['lab_type'] = $lab_type;
+ $data['inv_code'] = $data['inv_master'][0]->invoice_code;;
+
+ $this->load->view('Lab_Panel/lab_invoice_xray', $data);
+ }
+
+ public function lab_date_show($inv_id, $lab_type)
+ {
+ $sql = "select * from lab_invoice_request where invoice_id='" . $inv_id . "' and lab_type='" . $lab_type . "'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request'] = $query->result();
+
+ $this->load->view('Lab_Panel/lab_date_show', $data);
+ }
+
+ public function test_list($inv_id, $lab_type)
+ {
+ $sql = "select m.id as inv_id,m.invoice_code,m.inv_date,Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_rname) as inv_name,
+ t.item_name,t.item_name,t.id as test_id,check_item_request(m.id,t.id) as check_sample,
+ r.lab_repo_id,y.group_desc as item_type_desc,r.`status`,
+ r.id as req_id,r.charge_item_id,r.print_combine
+ from (( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ left join lab_request r on t.id=r.charge_item_id)
+ left join lab_repo l on t.item_id=l.charge_id
+ where y.itype_id=" . $lab_type . " and m.id=" . $inv_id . "
+ order by t.item_name";
+ $query = $this->db->query($sql);
+ $data['testlist'] = $query->result();
+
+ $sql = "select * from lab_invoice_request where invoice_id='" . $inv_id . "' and lab_type='" . $lab_type . "'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request'] = $query->result();
+
+ $this->load->view('Lab_Panel/lab_invoice_main_test_list', $data);
+ }
+
+ // Report Test List
+ public function xray_test_list($inv_id, $lab_type)
+ {
+ $sql = "select m.id as inv_id,m.invoice_code,m.inv_date,Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_rname) as inv_name,
+ t.item_name,t.item_name,t.id as test_id,check_item_request(m.id,t.id) as check_sample,
+ r.lab_repo_id,y.group_desc as item_type_desc,r.`status`,
+ r.id as req_id,r.charge_item_id,r.print_combine
+ from (( invoice_item t join invoice_master m join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id)
+ left join lab_request r on t.id=r.charge_item_id)
+ left join lab_repo l on t.item_id=l.charge_id
+ where y.itype_id=" . $lab_type . " and m.id=" . $inv_id . "
+ order by t.item_name";
+ $query = $this->db->query($sql);
+ $data['testlist'] = $query->result();
+
+ $sql = "select * from lab_invoice_request where invoice_id='" . $inv_id . "' and lab_type='" . $lab_type . "'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request'] = $query->result();
+
+ $this->load->view('Lab_Panel/lab_invoice_main_xray_test_list', $data);
+ }
+
+ public function report_file_list($inv_id, $lab_type, $delete = 0)
+ {
+ $sql = "select * from file_upload_data where isdelete=" . $delete . " and charge_id='" . $inv_id . "' and charge_type='" . $lab_type . "'";
+ $query = $this->db->query($sql);
+ $data['lab_file_list'] = $query->result();
+
+ $this->load->view('Lab_Panel/lab_report_file_list', $data);
+ }
+
+ // Other Then Pathology like Xray , MRI , Ultra sound
+
+ public function select_lab_radiology($inv_id, $lab_type)
+ {
+ $sql = "select * from invoice_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_master'] = $query->result();
+
+ $pno = $data['inv_master'][0]->attach_id;
+
+ $sql = "select *,GET_AGE_1(dob,age,age_in_month,estimate_dob) as str_age,
+ Date_Format(insert_date,'%Y-%m-%d') as str_regdate,
+ if(gender=1,'Male','Female') as xgender ,if(date_add(insert_date,interval 12 hour)>sysdate(),1,0) as p_edit
+ from patient_master where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $sql = "select * from lab_invoice_request
+ where invoice_id='" . $inv_id . "' and lab_type='" . $lab_type . "'";
+ $query = $this->db->query($sql);
+ $data['lab_invoice_request'] = $query->result();
+
+ $data['inv_id'] = $inv_id;
+ $data['lab_type'] = $lab_type;
+ $data['inv_code'] = $data['inv_master'][0]->invoice_code;;
+
+ $this->load->view('Lab_Panel/lab_invoice_XRay', $data);
+ }
+}
diff --git a/old_code_ci3/controllers/Master_data.php b/old_code_ci3/controllers/Master_data.php
new file mode 100644
index 0000000..8459763
--- /dev/null
+++ b/old_code_ci3/controllers/Master_data.php
@@ -0,0 +1,107 @@
+load->model('Master_M');
+ }
+
+ function tag_index()
+ {
+ $sql="select * from tag_master order by tag_name ";
+ $query = $this->db->query($sql);
+ $data['tag_master']= $query->result();
+
+ $this->load->view('MasterData/tag_master_index',$data);
+ }
+
+ function tag_add()
+ {
+ $this->load->view('MasterData/tag_master_add');
+ }
+
+ function tag_save()
+ {
+ $input_tag_name = $this->input->post('input_tag_name');
+ $input_tag_desc = $this->input->post('input_tag_desc');
+ $hid_tag_id = $this->input->post('hid_tag_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $insert_data=array(
+ 'tag_name'=>$input_tag_name,
+ 'tag_type_id'=>'0',
+ 'tag_desc'=>$input_tag_desc,
+ 'insert_dateimte'=>date('Y-m-d H:i:s'),
+ 'insert_by'=>$user_name,
+ );
+
+ if($hid_tag_id==0){
+ $inser_id=$this->Master_M->insert_tag_master($insert_data);
+ }else{
+ $inser_id=$this->Master_M->update_tag_master($insert_data,$hid_tag_id);
+ }
+
+ echo $inser_id;
+ }
+
+ // Employee Master
+ public function Employee_master_list()
+ {
+ $sql="select * from employee_master order by emp_name ";
+ $query = $this->db->query($sql);
+ $data['employee_master']= $query->result();
+
+ $this->load->view('MasterData/employee_master_list',$data);
+ }
+
+ function Employee_add()
+ {
+ $this->load->view('MasterData/emp_master_add');
+ }
+
+ function Employee_edit($emp_id)
+ {
+ $sql="select * from employee_master where emp_id= $emp_id";
+ $query = $this->db->query($sql);
+ $data['employee_master']= $query->result();
+
+ $this->load->view('MasterData/emp_master_edit',$data);
+ }
+
+ function Employee_save()
+ {
+ $input_emp_code = $this->input->post('input_emp_code');
+ $input_emp_name = $this->input->post('input_emp_name');
+ $input_emp_dob = $this->input->post('input_emp_dob');
+ $input_emp_joinning_date = $this->input->post('input_emp_joinning_date');
+ $input_emp_phone_no = $this->input->post('input_emp_phone_no');
+ $hid_emp_id = $this->input->post('hid_emp_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.' ['.$user_id.']';
+
+ $insert_data=array(
+ 'emp_code'=>$input_emp_code,
+ 'emp_name'=>$input_emp_name,
+ 'emp_dob'=>$input_emp_dob,
+ 'emp_joinning_date'=>$input_emp_joinning_date,
+ 'emp_phone_no'=>$input_emp_phone_no,
+
+ 'add_by'=>$user_name.' : '.date('Y-m-d H:i:s'),
+ );
+
+ if($hid_emp_id==0){
+ $inser_id=$this->Master_M->insert_employee_master($insert_data);
+ }else{
+ $inser_id=$this->Master_M->update_employee_master($insert_data,$hid_emp_id);
+ }
+
+ echo $inser_id;
+ }
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Medical.php b/old_code_ci3/controllers/Medical.php
new file mode 100644
index 0000000..dbd9066
--- /dev/null
+++ b/old_code_ci3/controllers/Medical.php
@@ -0,0 +1,5230 @@
+load->view('Medical/Dashboard');
+ }
+
+ public function select_store($store_id)
+ {
+ $sql = "select * from store_master where store_id=" . $store_id;
+ $query = $this->db->query($sql);
+ $data['store_master'] = $query->result();
+
+ $this->load->view('Medical/Store_Dashboard', $data);
+ }
+
+ public function main_store()
+ {
+ $this->load->view('Medical/Stock/main_store_dashboard');
+ }
+
+
+ public function DrugList()
+ {
+ $this->load->view('Medical/Drug_Details');
+
+ //$sql="select item_id,itemname,dosage from drug_temp_25072017";
+ //$query = $this->db->query($sql);
+ //$data['drug_data']= $query->result();
+
+ //$this->load->view('Medical/Drug_Details_all',$data);
+ }
+
+ public function Purchase()
+ {
+ $this->load->view('Medical/Purchase/supplier_list');
+ }
+
+ public function PurchaseMasterEdit($inv_id)
+ {
+ $sql = "select * from med_supplier order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $sql = "select p.*,s.name_supplier from purchase_invoice p join med_supplier s on p.sid=s.sid where p.id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_data'] = $query->result();
+
+ $sql = "select * from purchase_invoice_item where purchase_id='" . $inv_id . "' ";
+ $query = $this->db->query($sql);
+ $data['purchase_item'] = $query->result();
+
+ $this->load->view('Medical/Purchase/purchase_invoice_master_edit', $data);
+ }
+
+ public function UpdatePurchase()
+ {
+ $rec_id = $this->input->post('hid_purchaseid');
+ $sid = $this->input->post('input_supplier');
+ $invoice_code = $this->input->post('input_invoicecode');
+ $d_invoice = $this->input->post('datepicker_invoice');
+ $ischallan = $this->input->post('cbo_billtype');
+
+ $Udata = array(
+ 'sid' => $sid,
+ 'date_of_invoice' => str_to_MysqlDate($d_invoice),
+ 'Invoice_no' => $invoice_code,
+ 'ischallan' => $ischallan
+ );
+
+ $this->load->model('Medical_M');
+
+ $update_id = $this->Medical_M->update_purchase($Udata, $rec_id);
+
+ $rvar = array(
+ 'insertid' => 1,
+ 'show_text' => 'Data Update'
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function UpdatePurchaseInvoiceStatus($purchase_inv_id, $inv_status)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name . '' . $user->last_name . '[' . $user_id . ']' . date('d-m-Y H:i:s');
+
+ $Udata = array(
+ 'inv_status' => $inv_status,
+ 'inv_status_update_by' => $user_name_info,
+ );
+
+ $this->load->model('Medical_M');
+
+ $update_id = $this->Medical_M->update_purchase($Udata, $purchase_inv_id);
+
+ redirect('Medical/PurchaseMasterEdit/' . $purchase_inv_id);
+ }
+
+ public function purchase_scan_doc($purchase_inv_id)
+ {
+ $data['purchase_inv_id'] = $purchase_inv_id;
+
+ $sql = "select * from purchase_invoice where id='" . $purchase_inv_id . "' ";
+ $query = $this->db->query($sql);
+ $data['purchase_invoice'] = $query->result();
+
+ $sql = "select * from purchase_invoice_scan_file where purchase_id='" . $purchase_inv_id . "' ";
+ $query = $this->db->query($sql);
+ $data['purchase_invoice_scan_file'] = $query->result();
+
+ $this->load->view('Medical/Purchase/purchase_invoice_scan', $data);
+ }
+
+ public function purchase_file_list($inv_id)
+ {
+ $sql = "select * from purchase_invoice_scan_file where purchase_id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['purchase_file_rec'] = $query->result();
+
+ $this->load->view('Medical/Purchase/purchase_file_show', $data);
+ }
+
+ public function save_image($purchase_id)
+ {
+ $filename = 'purchase-' . $purchase_id . '-' . time() . '.jpg';
+
+ $folder_name = 'medical_uploads/purchase_invoice/' . date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('webcam')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ } else {
+ $data = array('upload_data' => $this->upload->data());
+
+ $this->load->model('FileMedical_M');
+
+ $file_insert_id = $this->FileMedical_M->insert_purchase_scan($data['upload_data']);
+
+ $udata = array(
+ 'upload_by' => $user_name,
+ 'purchase_id' => $purchase_id,
+ 'upload_by_id' => $user_id
+ );
+
+ if ($file_insert_id > 0) {
+ $this->FileMedical_M->update_purchase_scan($udata, $file_insert_id);
+ }
+
+ echo $filename;
+ }
+ }
+
+ public function purchase_file_last_list($purchase_id = '')
+ {
+
+ $sql = "select * from purchase_invoice_scan_file where purchase_id=$purchase_id order by id desc limit 5";
+ $query = $this->db->query($sql);
+ $data['purchase_invoice_scan_file'] = $query->result();
+
+ $this->load->view('Medical/Purchase/scan_purchase_list', $data);
+ }
+
+ public function purchase_file_hide($file_id, $purchase_id = '')
+ {
+ $user = $this->ion_auth->user()->row();
+ $upload_by_id = $user->id;
+
+ $udata = array(
+ 'show_type' => '1',
+ 'upload_by_id' => $upload_by_id
+ );
+ $this->load->model('FileMedical_M');
+
+ $this->FileMedical_M->delete_purchase_scan_fileupload( $file_id);
+
+ redirect('/Medical/purchase_file_last_list/' . $purchase_id);
+ }
+
+
+ public function PurchaseNew()
+ {
+ $sql = "select * from med_supplier where active=1 order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Purchase/new_purchase_invoice', $data);
+ }
+
+ public function SupplierList()
+ {
+ $sql = "select * from med_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Purchase/supplier_master', $data);
+ }
+
+ public function PurchaseInvoice()
+ {
+ $sdata = trim($this->input->post('txtsearch'));
+
+ //$sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if (trim($sdata) == '') {
+ $sql = "select p.id,p.Invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d-%m-%Y') as str_date_of_invoice,p.sid,s.name_supplier,
+ s.short_name,s.gst_no,
+ p.T_Net_Amount as tamount,p.ischallan
+ from (purchase_invoice p join med_supplier s on p.sid=s.sid)
+
+ group by p.id
+ order by p.id desc limit 50";
+ } else {
+
+ $numric_condition = "";
+
+ if (is_numeric($sdata)) {
+ $numric_condition = " OR p.Invoice_no=" . $sdata;
+ }
+
+ $sql = "select p.id,p.Invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d-%m-%Y') as str_date_of_invoice,
+ p.sid,s.name_supplier,s.short_name,s.gst_no,
+ p.T_Net_Amount as tamount,p.ischallan
+ from (purchase_invoice p join med_supplier s on p.sid=s.sid)
+ where (p.Invoice_no LIKE '%" . $sdata . "%' " . $numric_condition . " )
+ group by p.id order by p.id desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['purchase_list'] = $query->result();
+
+ $this->load->view('Medical/Purchase/purchase_supp_list', $data);
+ }
+
+ public function PurchaseInvoiceEdit($inv_id)
+ {
+ $sql = "select p.id,p.Invoice_no,p.date_of_invoice,date_format(p.date_of_invoice,'%d/%m/%Y') as str_date_of_invoice,
+ p.sid,s.name_supplier,s.short_name,s.gst_no,p.inv_status,p.ischallan
+ from purchase_invoice p join med_supplier s on p.sid=s.sid
+ where p.id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_invoice'] = $query->result();
+
+ $sql = "select * from purchase_invoice_item where purchase_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_invoice_item'] = $query->result();
+
+ $sql = "select * from med_gst_per ";
+ $query = $this->db->query($sql);
+ $data['med_gst_per'] = $query->result();
+
+ $this->load->view('Medical/Purchase/purchase_invoice_edit', $data);
+ }
+
+ public function challan_invoice($supplier_id)
+ {
+ $sql = "SELECT p.id,t.id AS ss_no,p.Invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d-%m-%Y') as str_date_of_invoice,p.sid,s.name_supplier,
+ s.short_name,s.gst_no,
+ p.T_Net_Amount as tamount,p.ischallan,
+ t.Item_name,t.qty,t.qty_free,t.mrp
+ FROM (purchase_invoice p join med_supplier s on p.sid=s.sid)
+ JOIN purchase_invoice_item t ON p.id=t.purchase_id
+ where p.sid=$supplier_id and p.ischallan=1
+ group by p.id,t.id ";
+
+ $query = $this->db->query($sql);
+ $data['purchase_challan_item'] = $query->result();
+
+ $this->load->view('Medical/Purchase/purchase_challan_list', $data);
+ }
+
+ public function challan_item_to_purchase($ss_no, $purchase_id)
+ {
+ $sql = "select * from purchase_invoice_item where id=$ss_no";
+ $query = $this->db->query($sql);
+ $purchase_invoice_item = $query->result();
+
+ if (count($purchase_invoice_item) > 0) {
+ $old_purchase_id = $purchase_invoice_item[0]->purchase_id;
+
+ $Pdata = array(
+ 'purchase_id' => $purchase_id,
+ 'old_purchase_id' => $old_purchase_id,
+ );
+
+ $this->load->model('Medical_M');
+ $is_update_stock = $this->Medical_M->update_purchase_item($Pdata, $ss_no);
+ $this->db->query("CALL p_purchase_invoice(" . $old_purchase_id . ")");
+
+ $rvar = array(
+ 'is_transfer' => $is_update_stock,
+ 'show_text' => "Item Addedd Successfully",
+ );
+ } else {
+ $rvar = array(
+ 'is_transfer' => 0,
+ 'show_text' => "Item Not Found ",
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function challan_item_return($ss_no)
+ {
+ $sql = "select * from purchase_invoice_item where old_purchase_id>0 and id=$ss_no";
+ $query = $this->db->query($sql);
+ $purchase_invoice_item = $query->result();
+
+ if (count($purchase_invoice_item) > 0) {
+ $old_challan_id = $purchase_invoice_item[0]->old_purchase_id;
+ $current_pur_id = $purchase_invoice_item[0]->purchase_id;
+
+ $sql = "select * from purchase_invoice where id=$old_challan_id";
+ $query = $this->db->query($sql);
+ $challan_invoice = $query->result();
+
+ if (count($challan_invoice) > 0) {
+ $Pdata = array(
+ 'purchase_id' => $old_challan_id,
+ 'old_purchase_id' => 0,
+ );
+
+ $this->load->model('Medical_M');
+ $is_update_stock = $this->Medical_M->update_purchase_item($Pdata, $ss_no);
+ $this->db->query("CALL p_purchase_invoice(" . $current_pur_id . ")");
+
+ $rvar = array(
+ 'is_transfer' => $is_update_stock,
+ 'show_text' => "Item Addedd Successfully",
+ );
+ } else {
+
+ $Pdata = array(
+ 'purchase_id' => $old_challan_id,
+ 'old_purchase_id' => 0,
+ );
+
+ $this->load->model('Medical_M');
+ $is_update_stock = $this->Medical_M->update_purchase_item($Pdata, $ss_no);
+
+
+ $rvar = array(
+ 'is_transfer' => 0,
+ 'show_text' => "Challan Not Found ",
+ );
+ }
+ } else {
+ $rvar = array(
+ 'is_transfer' => 0,
+ 'show_text' => "Item Not Found ",
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function purchase_invoice_delete($inv_id)
+ {
+
+ $sql = "select * from purchase_invoice_item where purchase_id=$inv_id";
+ $query = $this->db->query($sql);
+ $purchase_invoice_item = $query->result();
+
+ if (count($purchase_invoice_item) > 0) {
+ $rvar = array(
+ 'is_delete' => 0,
+ 'show_text' => "Invoice has Items, Empty the item list",
+ );
+ } else {
+ $this->load->model('Medical_M');
+ $is_delete = $this->Medical_M->delete_purchase($inv_id);
+ $rvar = array(
+ 'is_delete' => 1,
+ 'show_text' => "Invoice has been deleted",
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function SupplierListSub()
+ {
+ $sql = "select * from med_supplier order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Purchase/supplier_master_sub', $data);
+ }
+
+ public function SupplierEdit($sid = 0)
+ {
+ $sql = "select * from med_supplier where sid=" . $sid;
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $sql = "select * from india_state ";
+ $query = $this->db->query($sql);
+ $data['india_state'] = $query->result();
+
+ $this->load->view('Medical/Purchase/supplier_Edit', $data);
+ }
+
+ public function CreatePurchase()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_invoicecode',
+ 'label' => 'Invoice No',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+ $sid = $this->input->post('input_supplier');
+ $invoice_code = $this->input->post('input_invoicecode');
+ $d_invoice = $this->input->post('datepicker_invoice');
+ $ischallan = $this->input->post('cbo_billtype');
+
+ $where = " where sid=$sid";
+
+ if (is_numeric($invoice_code))
+ $where .= " and Invoice_no=" . $invoice_code;
+ else
+ $where .= " and Invoice_no='" . $invoice_code . "'";
+
+ $sql = "select count(*) as no_rec from purchase_invoice " . $where;
+ $query = $this->db->query($sql);
+ $chk_rec = $query->result();
+
+ if ($chk_rec[0]->no_rec == 0) {
+ $Udata = array(
+ 'sid' => $sid,
+ 'date_of_invoice' => str_to_MysqlDate($d_invoice),
+ 'Invoice_no' => $invoice_code,
+ 'ischallan' => $ischallan
+ );
+
+ $this->load->model('Medical_M');
+
+ $inser_id = $this->Medical_M->insert_purchase($Udata);
+ $send_msg = "Added Successfully";
+
+ if ($inser_id > 0) {
+ $show_text = $send_msg;
+ } else {
+ $show_text = $send_msg;
+ }
+ } else {
+ $show_text = 'Record Already Exist';
+ $inser_id = 0;
+ }
+
+ $rvar = array(
+ 'insertid' => $inser_id,
+ 'show_text' => $show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_msg = validation_errors();
+ $rvar = array(
+ 'insertid' => 0,
+ 'show_text' => $send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+ public function SupplierUpdate($sid = 0)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_name_supplier',
+ 'label' => 'Supplier Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_short_name',
+ 'label' => 'Short Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_gst_no',
+ 'label' => 'GST No.',
+ 'rules' => 'required|min_length[5]|max_length[15]'
+ ),
+ array(
+ 'field' => 'input_state',
+ 'label' => 'State',
+ 'rules' => 'required|min_length[1]|max_length[20]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+ $sid = $this->input->post('hid_sid');
+ $name_supplier = $this->input->post('input_name_supplier');
+ $short_name = $this->input->post('input_short_name');
+ $contact_no = $this->input->post('input_contact_no');
+ $gst_no = $this->input->post('input_gst_no');
+ $city = $this->input->post('input_city');
+ $state = $this->input->post('input_state');
+ $active = ($this->input->post('chk_active') == 'on' ? 1 : 0);
+
+ $Udata = array(
+ 'name_supplier' => $name_supplier,
+ 'short_name' => $short_name,
+ 'contact_no' => $contact_no,
+ 'gst_no' => $gst_no,
+ 'city' => $city,
+ 'state' => $state,
+ 'active' => $active
+ );
+
+ $this->load->model('Medical_M');
+
+ if ($sid > 0) {
+ $inser_id = $this->Medical_M->update_supplier($Udata, $sid);
+ $send_msg = "Saved Successfully";
+ } else {
+ $inser_id = $this->Medical_M->insert_supplier($Udata);
+ $send_msg = "Added Successfully";
+ }
+
+ if ($inser_id > 0) {
+ $show_text = Show_Alert('success', 'Success', $send_msg);
+ } else {
+ $show_text = Show_Alert('danger', 'Error', $send_msg);
+ }
+
+ $rvar = array(
+ 'insertid' => $inser_id,
+ 'show_text' => $show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_msg = validation_errors();
+ $rvar = array(
+ 'insertid' => 0,
+ 'show_text' => Show_Alert('danger', 'Error', $send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function StockDrugList()
+ {
+ $this->load->view('Medical/Medical_stock_drug');
+ }
+
+ public function add_stock()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_product_code',
+ 'label' => 'Product Code',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_product_name',
+ 'label' => 'Product Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_product_mrp',
+ 'label' => 'Product MRP',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_selling_price',
+ 'label' => 'Selling Price',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_qty',
+ 'label' => 'Product Qty',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_package',
+ 'label' => 'Package',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_HSNCODE',
+ 'label' => 'HSNCODE',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_CGST',
+ 'label' => 'CGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_SGST',
+ 'label' => 'SGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+ $item_code = $this->input->post('input_product_code');
+
+ if ($item_code == 'IC0000000') {
+ $item_code = 'MC' . date('ymdhis');
+ }
+
+ $selling_price = $this->input->post('input_selling_price');
+
+ $package = $this->input->post('input_package');
+ $qty = $this->input->post('input_qty');
+ $total_unit = $package * $qty;
+ $unit_rate = $selling_price / $qty;
+
+ $datepicker_doe_month = $this->input->post('datepicker_doe_month');
+ $datepicker_doe_year = $this->input->post('datepicker_doe_year');
+
+ $datepicker_doe = "20" . $datepicker_doe_year . "-" . $datepicker_doe_month . "-01";
+
+ $this->load->model('Medical_M');
+ $data = array(
+ 'item_code' => $item_code,
+ 'item_name' => $this->input->post('input_product_name'),
+ 'rack_no' => $this->input->post('input_rack_no'),
+ 'shelf_no' => $this->input->post('input_shelf_no'),
+ 'cold_storage' => $this->input->post('input_storage'),
+ 'batch_no' => $this->input->post('input_batch_code'),
+ 'qty' => $this->input->post('input_qty'),
+ 'packing' => $this->input->post('input_package'),
+ 'expiry_date' => $datepicker_doe,
+ 'mrp' => $this->input->post('input_product_mrp'),
+ 'purchase_price' => $this->input->post('input_purchase_price'),
+ 'selling_price' => $this->input->post('input_selling_price'),
+ 'total_unit' => $total_unit,
+ 'unit_rate' => $unit_rate,
+ 'margin' => $this->input->post('input_margin'),
+ 'formulation' => $this->input->post('input_formulation'),
+ 'stock_date' => str_to_MysqlDate($this->input->post('datepicker_stock')),
+ 'min_qty' => $this->input->post('input_minqty'),
+ 'HSNCODE' => $this->input->post('input_HSNCODE'),
+ 'CGST' => $this->input->post('input_CGST'),
+ 'SGST' => $this->input->post('input_SGST'),
+ 'IGST' => $this->input->post('input_IGST'),
+ 'dosage' => $this->input->post('input_dosage'),
+ 'supplier_id' => $this->input->post('input_supplier')
+ );
+
+ $data_drug = array(
+ 'item_id' => $item_code,
+ 'itemname' => $this->input->post('input_product_name'),
+ 'mrp' => $this->input->post('input_product_mrp'),
+ 'formulation' => $this->input->post('input_formulation'),
+ 'HSNCODE' => $this->input->post('input_HSNCODE'),
+ 'CGST' => $this->input->post('input_CGST'),
+ 'SGST' => $this->input->post('input_SGST'),
+ 'IGST' => $this->input->post('input_IGST'),
+ 'dosage' => $this->input->post('input_dosage')
+ );
+ $show_text = '';
+
+ $sql = "select * from drug_temp where item_id='" . $item_code . "'";
+ $query = $this->db->query($sql);
+ $drug_item = $query->result();
+
+ if (count($drug_item) > 0) {
+ $inser_id = $this->Medical_M->update_drug($data_drug, $item_code);
+ } else {
+ $inser_id = $this->Medical_M->insert_drug_add($data_drug);
+ }
+
+ if ($inser_id > 0) {
+ $inser_id = 0;
+ $inser_id = $this->Medical_M->insert_stock_add($data);
+ if ($inser_id > 0) {
+ $send_msg = "Added";
+ } else {
+ $send_msg = "Error : Add in Stock Table";
+ }
+ } else {
+ $send_msg = "Error : Addition data in Master Drug Table";
+ }
+
+ if ($inser_id > 0) {
+ $show_text = Show_Alert('success', 'Success', $send_msg);
+ } else {
+ $show_text = Show_Alert('danger', 'Error', $send_msg);
+ }
+
+ $rvar = array(
+ 'insertid' => $inser_id,
+ 'product_code' => $item_code,
+ 'show_text' => $show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_msg = validation_errors();
+ $rvar = array(
+ 'insertid' => 0,
+ 'show_text' => Show_Alert('danger', 'Error', $send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function update_master()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_product_code',
+ 'label' => 'Product Code',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_product_name',
+ 'label' => 'Product Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_product_mrp',
+ 'label' => 'Product MRP',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_selling_price',
+ 'label' => 'Selling Price',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_HSNCODE',
+ 'label' => 'HSNCODE',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_CGST',
+ 'label' => 'CGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_SGST',
+ 'label' => 'SGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+ $item_code = $this->input->post('input_product_code');
+
+ $this->load->model('Medical_M');
+
+ $data_drug = array(
+ 'item_id' => $item_code,
+ 'itemname' => $this->input->post('input_product_name'),
+ 'mrp' => $this->input->post('input_product_mrp'),
+ 'formulation' => $this->input->post('input_formulation'),
+ 'HSNCODE' => $this->input->post('input_HSNCODE'),
+ 'CGST' => $this->input->post('input_CGST'),
+ 'SGST' => $this->input->post('input_SGST'),
+ 'IGST' => $this->input->post('input_IGST'),
+ 'dosage' => $this->input->post('input_dosage')
+ );
+ $show_text = '';
+
+ $sql = "select * from drug_temp where item_id='" . $item_code . "'";
+ $query = $this->db->query($sql);
+ $drug_item = $query->result();
+
+ if (count($drug_item) > 0) {
+ $inser_id = $this->Medical_M->update_drug($data_drug, $item_code);
+ } else {
+ $inser_id = $this->Medical_M->insert_drug_add($data_drug);
+ }
+
+ if ($inser_id > 0) {
+ $inser_id = 0;
+ $inser_id = $this->Medical_M->insert_stock_add($data);
+ if ($inser_id > 0) {
+ $send_msg = "Update";
+ } else {
+ $send_msg = "Error : Edit in Drug Master";
+ }
+ } else {
+ $send_msg = "Error : Addition data in Master Drug Table";
+ }
+
+ if ($inser_id > 0) {
+ $show_text = Show_Alert('success', 'Success', $send_msg);
+ } else {
+ $show_text = Show_Alert('danger', 'Error', $send_msg);
+ }
+
+ $rvar = array(
+ 'insertid' => $inser_id,
+ 'product_code' => $item_code,
+ 'show_text' => $show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_msg = validation_errors();
+ $rvar = array(
+ 'insertid' => 0,
+ 'show_text' => Show_Alert('danger', 'Error', $send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function update_stock($ss_no)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_product_code',
+ 'label' => 'Product Code',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_product_name',
+ 'label' => 'Product Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_product_mrp',
+ 'label' => 'Product MRP',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_selling_price',
+ 'label' => 'Selling Price',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_qty',
+ 'label' => 'Product Qty',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_package',
+ 'label' => 'Package',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_HSNCODE',
+ 'label' => 'HSNCODE',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_CGST',
+ 'label' => 'CGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_SGST',
+ 'label' => 'SGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+ $item_code = $this->input->post('input_product_code');
+
+ $selling_price = $this->input->post('input_selling_price');
+
+ $package = $this->input->post('input_package');
+ $qty = $this->input->post('input_qty');
+ $total_unit = $package * $qty;
+ $unit_rate = $selling_price / $qty;
+
+ $datepicker_doe_month = $this->input->post('datepicker_doe_month');
+ $datepicker_doe_year = $this->input->post('datepicker_doe_year');
+
+ $datepicker_doe = "20" . $datepicker_doe_year . "-" . $datepicker_doe_month . "-01";
+
+ $this->load->model('Medical_M');
+ $data = array(
+ 'item_code' => $item_code,
+ 'item_name' => $this->input->post('input_product_name'),
+ 'rack_no' => $this->input->post('input_rack_no'),
+ 'shelf_no' => $this->input->post('input_shelf_no'),
+ 'cold_storage' => $this->input->post('input_storage'),
+ 'batch_no' => $this->input->post('input_batch_code'),
+ 'qty' => $this->input->post('input_qty'),
+ 'packing' => $this->input->post('input_package'),
+ 'expiry_date' => $datepicker_doe,
+ 'mrp' => $this->input->post('input_product_mrp'),
+ 'purchase_price' => $this->input->post('input_purchase_price'),
+ 'selling_price' => $this->input->post('input_selling_price'),
+ 'total_unit' => $total_unit,
+ 'unit_rate' => $unit_rate,
+ 'margin' => $this->input->post('input_margin'),
+ 'formulation' => $this->input->post('input_formulation'),
+ 'stock_date' => str_to_MysqlDate($this->input->post('datepicker_stock')),
+ 'min_qty' => $this->input->post('input_minqty'),
+ 'HSNCODE' => $this->input->post('input_HSNCODE'),
+ 'CGST' => $this->input->post('input_CGST'),
+ 'SGST' => $this->input->post('input_SGST'),
+ 'IGST' => $this->input->post('input_IGST'),
+ 'supplier_id' => $this->input->post('input_supplier')
+ );
+
+ $show_text = '';
+
+ $is_update_stock = 0;
+
+ $is_update_stock = $this->Medical_M->update_stock_upd($data, $ss_no);
+
+ if ($is_update_stock > 0) {
+ $send_msg = "Updated";
+ } else {
+ $send_msg = "Error : Update in Stock Table";
+ }
+
+ if ($is_update_stock > 0) {
+ $show_text = Show_Alert('success', 'Updated', $send_msg);
+ } else {
+ $show_text = Show_Alert('danger', 'Error', $send_msg);
+ }
+
+ $rvar = array(
+ 'is_update_stock' => $is_update_stock,
+ 'product_code' => $item_code,
+ 'show_text' => $show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_msg = validation_errors();
+ $rvar = array(
+ 'is_update_stock' => 0,
+ 'show_text' => Show_Alert('danger', 'Error', $send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function purchase_update_stock($inv_id, $return_stock = 0)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from purchase_invoice where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $purchase_invoice = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name . '' . $user->last_name . '[' . $user_id . ']' . date('d-m-Y H:i:s');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_product_code',
+ 'label' => 'Not Found in Database',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_drug_hid',
+ 'label' => 'Product Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_product_mrp',
+ 'label' => 'Product MRP',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_selling_price',
+ 'label' => 'Selling Price',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_Qty',
+ 'label' => 'Product Qty',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_package',
+ 'label' => 'Package',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_HSNCODE',
+ 'label' => 'HSNCODE',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_CGST',
+ 'label' => 'CGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_SGST',
+ 'label' => 'SGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_purchase_price',
+ 'label' => 'Purchase Price',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+ $item_code = $this->input->post('input_product_code');
+ $item_id = $this->input->post('invoice_item_id');
+
+ $datepicker_doe_month = $this->input->post('datepicker_doe_month');
+ $datepicker_doe_year = $this->input->post('datepicker_doe_year');
+
+ $datepicker_doe = "20" . $datepicker_doe_year . "-" . $datepicker_doe_month . "-01";
+
+ $this->load->model('Medical_M');
+
+ $Pdata = array(
+ 'purchase_id' => $inv_id,
+ 'item_code' => $item_code,
+ 'item_name' => $this->input->post('input_drug_hid'),
+ 'packing' => $this->input->post('input_package'),
+ 'batch_no' => $this->input->post('input_batch_code'),
+ 'purchase_price' => $this->input->post('input_purchase_price'),
+ 'expiry_date' => $datepicker_doe,
+ 'mrp' => $this->input->post('input_product_mrp'),
+
+ 'qty' => $this->input->post('input_Qty'),
+ 'qty_free' => $this->input->post('input_Qty_Free'),
+
+ 'discount' => $this->input->post('input_disc_price'),
+
+ 'CGST_per' => $this->input->post('input_CGST'),
+ 'SGST_per' => $this->input->post('input_SGST'),
+
+ 'HSNCODE' => $this->input->post('input_HSNCODE'),
+
+ 'cold_storage' => $this->input->post('input_storage'),
+ 'shelf_no' => $this->input->post('input_shelf_no'),
+ 'rack_no' => $this->input->post('input_rack_no'),
+ 'stock_date' => $purchase_invoice[0]->date_of_invoice,
+
+ 'selling_price' => $this->input->post('input_selling_price'),
+
+ 'sch_disc_amt' => $this->input->post('input_sch_amount'),
+ 'sch_disc_per' => $this->input->post('input_sch_disc'),
+
+ 'insert_by' => $user_name_info,
+
+ 'item_return' => $return_stock
+ );
+
+ $show_text = '';
+
+ $is_update_stock = 0;
+
+ $send_msg = "";
+
+ if ($item_id < 1) {
+ $is_update_stock = $this->Medical_M->insert_purchase_item($Pdata);
+ $send_msg = "Added";
+ } else {
+ $sql = "select * from purchase_invoice_item where id='$item_id' ";
+ $query = $this->db->query($sql);
+ $drug_item = $query->result();
+
+ if (count($drug_item) > 0) {
+ $tot_sale_qty = $drug_item[0]->total_sale_unit;
+
+ $qty = $this->input->post('input_Qty');
+ $qty_free = $this->input->post('input_Qty_Free');
+
+ $packing = $this->input->post('input_package');
+
+ $tot_qty = ($qty + $qty_free) * $packing;
+
+ if ($tot_sale_qty <= $tot_qty) {
+ $is_update_stock = $this->Medical_M->update_purchase_item($Pdata, $item_id);
+ if ($is_update_stock > 0) {
+ $send_msg = "Updated";
+ } else {
+ $send_msg = "Error : Update in Stock Table";
+ }
+ } else {
+ $send_msg = "Error : Update Qty is Less then saled Qty :" . $tot_qty . " / Saled :" . $tot_sale_qty;
+
+ //Update While Qty in Minus
+
+ //$is_update_stock=$this->Medical_M->update_purchase_item($Pdata,$item_id);
+ /*
+ if($is_update_stock>0)
+ {
+ $send_msg="Updated : But Error : Update Qty is Less then saled Qty :".$tot_qty." / Saled :".$tot_sale_qty;
+ }else{
+ $send_msg="Error : Update in Stock Table";
+ }
+ */
+ }
+ } else {
+ $send_msg = "Error : Record Not Found in Stock Table";
+ }
+ }
+
+ $rvar = array(
+ 'is_update_stock' => $is_update_stock,
+ 'product_code' => $item_code,
+ 'show_text' => $send_msg
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_msg = validation_errors();
+ $rvar = array(
+ 'is_update_stock' => 0,
+ 'show_text' => $send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ function purchase_invoice_item_edit($inv_id, $inv_item_id)
+ {
+ $sql = "select *,
+ date_format(expiry_date,'%m') as str_expiry_month ,
+ date_format(expiry_date,'%y') as str_expiry_year
+ from purchase_invoice_item where id=" . $inv_item_id . " and purchase_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $purchase_invoice_item = $query->result();
+
+ if (count($purchase_invoice_item) > 0) {
+ $rvar = array(
+ 'is_update_stock' => '1',
+ 'item_id' => $purchase_invoice_item[0]->id,
+ 'product_code' => $purchase_invoice_item[0]->item_code,
+ 'product_mrp' => $purchase_invoice_item[0]->mrp,
+ 'selling_price' => $purchase_invoice_item[0]->selling_price,
+ 'batch_code' => $purchase_invoice_item[0]->batch_no,
+ 'disc_price' => $purchase_invoice_item[0]->discount,
+ 'qty' => $purchase_invoice_item[0]->qty,
+ 'qty_free' => $purchase_invoice_item[0]->qty_free,
+ 'package' => $purchase_invoice_item[0]->packing,
+ 'purchase_price' => $purchase_invoice_item[0]->purchase_price,
+ 'datepicker_doe_month' => $purchase_invoice_item[0]->str_expiry_month,
+ 'datepicker_doe_year' => $purchase_invoice_item[0]->str_expiry_year,
+ 'drug' => $purchase_invoice_item[0]->Item_name,
+
+ 'sch_disc_amt' => $purchase_invoice_item[0]->sch_disc_amt,
+ 'sch_disc_per' => $purchase_invoice_item[0]->sch_disc_per,
+
+ 'HSNCODE' => $purchase_invoice_item[0]->HSNCODE,
+ 'CGST_per' => $purchase_invoice_item[0]->CGST_per,
+ 'SGST_per' => $purchase_invoice_item[0]->SGST_per,
+
+ 'cold_storage' => $purchase_invoice_item[0]->cold_storage,
+ 'shelf_no' => $purchase_invoice_item[0]->shelf_no,
+ 'rack_no' => $purchase_invoice_item[0]->rack_no,
+
+ );
+ } else {
+ $rvar = array(
+ 'is_update_stock' => '0',
+ 'show_text' => $sql
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function purchase_invoice_item_list($inv_id)
+ {
+ $sql = "select *,date_format(expiry_date,'%m/%y') as exp_date_str from purchase_invoice_item where purchase_id='" . $inv_id . "' ";
+ $query = $this->db->query($sql);
+ $data['purchase_item'] = $query->result();
+
+ $sql = "select * from purchase_invoice where id='" . $inv_id . "' ";
+ $query = $this->db->query($sql);
+ $data['purchase_invoice'] = $query->result();
+
+
+
+ $this->load->view('Medical/Purchase/purchase_invoice_item', $data);
+ }
+
+ public function purchase_invoice_item_list_old($item_code)
+ {
+ $sql = "SELECT s.name_supplier, date_format(p.date_of_invoice,'%d-%m-%Y') as date_of_invoice_str,
+ i.Item_name,i.packing,i.purchase_price,i.qty,i.qty_free,i.mrp,i.discount,i.sch_disc_per,i.purchase_unit_rate,p.Invoice_no
+ FROM (purchase_invoice p JOIN purchase_invoice_item i ON p.id=i.purchase_id)
+ JOIN med_supplier s ON p.sid=s.sid
+ WHERE i.item_code=$item_code ORDER BY i.id DESC LIMIT 5 ";
+ $query = $this->db->query($sql);
+ $data['purchase_item_old'] = $query->result();
+
+ $this->load->view('Medical/Purchase/purchase_item_old', $data);
+ }
+
+ public function purchase_invoice_item_delete($inv_id, $inv_item_del)
+ {
+ $this->load->model('Medical_M');
+
+ $sql = "select * from purchase_invoice_item where id='$inv_item_del' ";
+ $query = $this->db->query($sql);
+ $drug_item = $query->result();
+
+ if (count($drug_item) > 0) {
+ $sale_qty = $drug_item[0]->total_sale_unit;
+
+ if ($sale_qty > 0) {
+ $rvar = array(
+ 'is_update_stock' => 0,
+ 'show_text' => 'Sold some Quantity of this Item',
+ );
+ } else {
+ $is_update_stock = $this->Medical_M->delete_purchase_item($inv_id, $inv_item_del);
+ $rvar = array(
+ 'is_update_stock' => 1,
+ 'show_text' => 'Removed Successfully',
+ );
+ }
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function AddDrugStock($drug_item_code)
+ {
+ $sql = "select * from drug_temp where item_id='" . $drug_item_code . "' ";
+ $query = $this->db->query($sql);
+ $data['drug_item'] = $query->result();
+
+ $sql = "select * from stock_addition where item_code='" . $drug_item_code . "' ";
+ $query = $this->db->query($sql);
+ $data['drug_stock_item'] = $query->result();
+
+ $sql = "select * from med_supplier ";
+ $query = $this->db->query($sql);
+ $data['med_supplier'] = $query->result();
+
+ $this->load->view('Medical/Drug_Stock_Add', $data);
+ }
+
+ public function UpdateDrugStock($ss_no)
+ {
+ $sql = "select * from stock_addition where ss_no='" . $ss_no . "' ";
+ $query = $this->db->query($sql);
+ $data['stock_item'] = $query->result();
+
+ $sql = "select * from med_supplier ";
+ $query = $this->db->query($sql);
+ $data['med_supplier'] = $query->result();
+
+ $this->load->view('Medical/Stock_Update', $data);
+ }
+
+ public function load_stock_data($item_code)
+ {
+ $sql = "select * from stock_addition where item_code='" . $item_code . "' ";
+ $query = $this->db->query($sql);
+ $data['drug_stock_item'] = $query->result();
+
+ echo '
+
+
+ Item Code
+ Item Name
+ Formulation
+ Storage/Shelf/Rack No.
+ Batch No.
+ Qty /Sale Qty
+ Expiry
+ MRP
+ Rate/Unit
+
+
+ ';
+
+ $srno = 0;
+
+ foreach ($data['drug_stock_item'] as $row) {
+ $srno = $srno + 1;
+ echo '';
+ echo '' . $row->item_code . ' ';
+ echo '' . $row->item_name . ' ';
+ echo '' . $row->formulation . ' ';
+ echo '' . $row->cold_storage . '/' . $row->shelf_no . '/' . $row->rack_no . ' ';
+ echo '' . $row->batch_no . ' ';
+ echo '' . $row->total_unit . '/' . $row->total_sale_unit . ' ';
+ echo '' . $row->expiry_date . ' ';
+ echo '' . $row->mrp . ' ';
+ echo '' . $row->unit_rate . ' ';
+ echo ' ';
+ }
+
+ echo ' ';
+
+ echo '
+
+
+ Item Code
+ Item Name
+ Formulation
+ Storage/Shelf/Rack No.
+ Batch No.
+ Qty /Sale Qty
+ Expiry
+ MRP
+ Rate/Unit
+
+
';
+ }
+
+ public function Invoice_counter()
+ {
+ $sql = "select * from invoice_med_master";
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $sql = "select * from inv_med_item";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select sum(amount) as Gtotal from inv_med_item";
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $sql = "select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist'] = $query->result();
+
+ if ($data['invoiceMaster'][0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $data['invoiceMaster'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['OCaseMaster'] = $query->result();
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $this->load->view('Medical/Medical_Invoice_V', $data);
+ }
+
+ public function Invoice_Med_Draft()
+ {
+ $this->load->view('Medical/Draft_Med_Invoice');
+ }
+
+ public function Invoice_Med_Return()
+ {
+ $this->load->view('Medical/Draft_Med_Return_Invoice');
+ }
+
+ public function Invoice_med_show($inv_id)
+ {
+ $sql = "select *,if(ipd_credit>0,'Credit to IPD','CASH') as credit_status,
+ if(case_credit>0,'Credit to Org','CASH') as credit_org_status from invoice_med_master
+ where id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $patient_id = $data['invoiceMaster'][0]->patient_id;
+ $inv_phone_number = $data['invoiceMaster'][0]->inv_phone_number;
+
+ if ($patient_id == 0) {
+ }
+
+ $sql = "SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_med_item i JOIN purchase_invoice_item p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where inv_med_id=" . $inv_id . " GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select item_code
+ from inv_med_item where inv_med_id=" . $inv_id . " Group by item_code Having count(id)>1";
+ $query = $this->db->query($sql);
+ $data['inv_items_multiple'] = $query->result();
+
+ $sql = "select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,sum(disc_amount) as t_dis_amt from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $sql = "select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist'] = $query->result();
+
+ $sql = "select *,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='" . $data['invoiceMaster'][0]->patient_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $data['org_Name'] = "";
+ $ipd_id = $data['invoiceMaster'][0]->ipd_id;
+
+ if ($ipd_id > 0) {
+ $sql = "select * from ipd_master where id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $sql = "select * from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_list'] = $query->result();
+
+ $data['ipd_master'] = $ipd_master;
+
+ if (count($ipd_master) > 0) {
+ $p_ipd_id = $ipd_master[0]->id;
+ $p_ipd_code = $ipd_master[0]->ipd_code;
+
+ if ($ipd_master[0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $ipd_master[0]->case_id;
+ $query = $this->db->query($sql);
+ $org_master = $query->result();
+
+ if (count($org_master) > 0) {
+ $data['org_Name'] = $org_master[0]->insurance_company_name;
+ }
+ }
+ }
+ }
+
+ if ($data['invoiceMaster'][0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $data['invoiceMaster'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['OCaseMaster'] = $query->result();
+ }
+
+
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $data['sale_return'] = $data['invoiceMaster'][0]->sale_return;
+
+ $data['content'] = $this->load->view('Medical/Med_Item_List', $data, true);
+
+ if ($data['invoiceMaster'][0]->sale_return == 0) {
+ $this->load->view('Medical/Medical_Invoice_V', $data);
+ } else {
+ $this->load->view('Medical/Medical_Invoice_Return_V', $data);
+ }
+ }
+
+ //New Invoice Edit
+ public function Invoice_med_datasheet($inv_id)
+ {
+ $sql = "SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_med_item i JOIN purchase_invoice_item p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where inv_med_id=" . $inv_id . " GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $sql = "select *,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select item_code
+ from inv_med_item where inv_med_id=" . $inv_id . " Group by item_code Having count(id)>1";
+ $query = $this->db->query($sql);
+ $data['inv_items_multiple'] = $query->result();
+
+ $sql = "select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,sum(disc_amount) as t_dis_amt from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $sql = "select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist'] = $query->result();
+
+ $sql = "select *,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='" . $data['invoiceMaster'][0]->patient_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $data['org_Name'] = "";
+ $ipd_id = $data['invoiceMaster'][0]->ipd_id;
+
+ if ($ipd_id > 0) {
+ $sql = "select * from ipd_master where id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $sql = "select * from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_list'] = $query->result();
+
+ $data['ipd_master'] = $ipd_master;
+
+ if (count($ipd_master) > 0) {
+ $p_ipd_id = $ipd_master[0]->id;
+ $p_ipd_code = $ipd_master[0]->ipd_code;
+
+ if ($ipd_master[0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $ipd_master[0]->case_id;
+ $query = $this->db->query($sql);
+ $org_master = $query->result();
+
+ if (count($org_master) > 0) {
+ $data['org_Name'] = $org_master[0]->insurance_company_name;
+ }
+ }
+ }
+ }
+
+ if ($data['invoiceMaster'][0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $data['invoiceMaster'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['OCaseMaster'] = $query->result();
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $data['sale_return'] = $data['invoiceMaster'][0]->sale_return;
+
+ $data['content'] = $this->load->view('Medical/Med_Item_List', $data, true);
+
+ if ($data['invoiceMaster'][0]->sale_return == 0) {
+ $this->load->view('Medical/Medical_Invoice_V', $data);
+ } else {
+ $this->load->view('Medical/Medical_Invoice_Return_V', $data);
+ }
+ }
+
+
+ // Update Medical Invoice Master
+
+ public function update_uhid()
+ {
+ $this->load->model('Medical_M');
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $inv_id = $this->input->post('med_invoice_id');
+ $pid = $this->input->post('pid');
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master = $query->result();
+
+ $sql = "select * from patient_master_exten where id='" . $pid . "' ";
+ $query = $this->db->query($sql);
+ $person_info = $query->result();
+
+ if (count($person_info) > 0) {
+ $patient_id = $person_info[0]->id;
+ $patient_code_u = $person_info[0]->p_code;
+ $custmer_Name = $person_info[0]->p_fname;
+
+ $data = array(
+ 'customer_type' => 1,
+ 'patient_id' => $patient_id,
+ 'patient_code' => $patient_code_u,
+ 'inv_name' => $custmer_Name,
+ 'ipd_credit' => 0,
+ 'case_credit' => 0,
+ 'case_credit' => 0,
+ );
+
+ $inser_id = $this->Medical_M->update_in_upv_item($data, $inv_id);
+ $this->Medical_M->update_invoice_group($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+ $status = 1;
+ $remark = "Done";
+ } else {
+ $status = 0;
+ $remark = "Not Done";
+ }
+
+ $rvar = array(
+ 'status' => $status,
+ 'remark' => $remark
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function update_ipd()
+ {
+ $this->load->model('Medical_M');
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $inv_id = $this->input->post('med_invoice_id');
+ $ipd_id = $this->input->post('ipd_id');
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master = $query->result();
+
+ $sql = "select * from ipd_master where id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $pid = $ipd_master[0]->p_id;
+
+ $sql = "select * from patient_master_exten where id='" . $pid . "' ";
+ $query = $this->db->query($sql);
+ $person_info = $query->result();
+
+ if (count($person_info) > 0) {
+ $patient_id = $person_info[0]->id;
+ $patient_code_u = $person_info[0]->p_code;
+ $custmer_Name = $person_info[0]->p_fname;
+
+ $ipd_id = $ipd_master[0]->id;
+ $ipd_code = $ipd_master[0]->ipd_code;
+
+ $data = array(
+ 'customer_type' => 1,
+ 'patient_id' => $patient_id,
+ 'patient_code' => $patient_code_u,
+ 'inv_name' => $custmer_Name,
+ 'ipd_credit' => 0,
+ 'case_credit' => 0,
+ 'ipd_id' => $ipd_id,
+ 'ipd_code' => $ipd_code,
+ );
+
+ $inser_id = $this->Medical_M->update_in_upv_item($data, $inv_id);
+ $this->Medical_M->update_invoice_group($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+ $status = 1;
+ $remark = "Done";
+ } else {
+ $status = 0;
+ $remark = "Not Done";
+ }
+
+ $rvar = array(
+ 'status' => $status,
+ 'remark' => $remark
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function update_org()
+ {
+ $this->load->model('Medical_M');
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $inv_id = $this->input->post('med_invoice_id');
+ $org_id = $this->input->post('org_id');
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master = $query->result();
+
+ $sql = "select * from organization_case_master where case_type=0 and id=" . $org_id;
+ $query = $this->db->query($sql);
+ $org_master = $query->result();
+
+ $pid = $org_master[0]->p_id;
+
+ $sql = "select * from patient_master_exten where id='" . $pid . "' ";
+ $query = $this->db->query($sql);
+ $person_info = $query->result();
+
+ if (count($person_info) > 0) {
+ $patient_id = $person_info[0]->id;
+ $patient_code_u = $person_info[0]->p_code;
+ $custmer_Name = $person_info[0]->p_fname;
+
+ $org_id = $org_master[0]->id;
+ $org_code = $org_master[0]->case_id_code;
+
+ $data = array(
+ 'customer_type' => 1,
+ 'patient_id' => $patient_id,
+ 'patient_code' => $patient_code_u,
+ 'inv_name' => $custmer_Name,
+ 'ipd_credit' => 0,
+ 'case_credit' => 1,
+ 'ipd_id' => 0,
+ 'ipd_code' => '',
+ 'case_id' => $org_id,
+ );
+
+ $inser_id = $this->Medical_M->update_in_upv_item($data, $inv_id);
+ $this->Medical_M->update_invoice_group($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+ $status = 1;
+ $remark = "Done";
+ } else {
+ $status = 0;
+ $remark = "Not Done";
+ }
+
+ $rvar = array(
+ 'status' => $status,
+ 'remark' => $remark
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function update_invdate()
+ {
+ $this->load->model('Medical_M');
+
+ $inv_id = $this->input->post('med_invoice_id');
+ $inv_date = $this->input->post('inv_date');
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master = $query->result();
+
+ $inv_date = str_to_MysqlDate($inv_date);
+
+ $data = array(
+ 'inv_date' => $inv_date,
+ );
+
+ $inser_id = $this->Medical_M->update_in_upv_item($data, $inv_id);
+
+ $status = 1;
+ $remark = "Done";
+
+ $rvar = array(
+ 'status' => $status,
+ 'remark' => $remark
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function update_name_phone()
+ {
+ $this->load->model('Medical_M');
+
+ $inv_id = $this->input->post('med_invoice_id');
+ $pid = $this->input->post('pid');
+ $customer_type = $this->input->post('customer_type');
+ $P_Name = $this->input->post('P_Name');
+ $P_Phone = $this->input->post('P_Phone');
+
+ $doc_id = $this->input->post('doc_id');
+ $doc_name = $this->input->post('doc_name');
+
+ $refername = $doc_name;
+
+ $sql = "select * from doctor_master where id='" . $doc_id . "' ";
+ $query = $this->db->query($sql);
+ $doc_info = $query->result();
+
+ if (count($doc_info) > 0) {
+ $refername = $doc_info[0]->p_fname;
+ }
+
+
+ $data = array(
+ 'customer_type' => $customer_type,
+ 'patient_id' => '0',
+ 'patient_code' => '',
+ 'inv_name' => $P_Name,
+ 'inv_phone_number' => $P_Phone,
+ 'ipd_credit' => 0,
+ 'case_credit' => 0,
+ 'ipd_id' => 0,
+ 'ipd_code' => '',
+ 'case_id' => '0',
+ 'doc_id' => $doc_id,
+ 'doc_name' => $refername,
+ );
+
+ $inser_id = $this->Medical_M->update_in_upv_item($data, $inv_id);
+
+ $status = 1;
+ $remark = "Done";
+
+ $rvar = array(
+ 'status' => $status,
+ 'remark' => $remark
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function update_doctor()
+ {
+ $this->load->model('Medical_M');
+
+ $inv_id = $this->input->post('med_invoice_id');
+
+ $doc_id = $this->input->post('doc_id');
+ $doc_name = $this->input->post('doc_name');
+
+ $refername = $doc_name;
+
+ $sql = "select * from doctor_master where id='" . $doc_id . "' ";
+ $query = $this->db->query($sql);
+ $doc_info = $query->result();
+
+ if (count($doc_info) > 0) {
+ $refername = $doc_info[0]->p_fname;
+ }
+
+ $data = array(
+ 'doc_id' => $doc_id,
+ 'doc_name' => $refername,
+ );
+
+ $inser_id = $this->Medical_M->update_in_upv_item($data, $inv_id);
+
+ $status = 1;
+ $remark = "Done";
+
+ $rvar = array(
+ 'status' => $status,
+ 'remark' => $remark
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ public function update_cr_status_ipd()
+ {
+ $this->load->model('Medical_M');
+
+ $inv_id = $this->input->post('med_invoice_id');
+ $credit_ipd = $this->input->post('credit_ipd');
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master = $query->result();
+
+ $ipd_id = $invoice_master[0]->ipd_id;
+
+ $data = array(
+ 'ipd_credit' => $credit_ipd,
+ );
+
+ $inser_id = $this->Medical_M->update_in_upv_item($data, $inv_id);
+
+ $status = 1;
+ $remark = "Done";
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id, '1');
+ $this->Medical_M->update_invoice_group_gst($ipd_id, '2');
+ $this->Medical_M->update_invoice_group_gst($ipd_id, '3');
+
+ $rvar = array(
+ 'status' => $status,
+ 'remark' => $remark
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ // End Update Medical Invoice Master
+
+ public function search_customer($sale = 0)
+ {
+ $data['sale'] = $sale;
+ $this->load->view('Medical/Search_Patient', $data);
+ }
+
+ public function check_invoice($pno, $ipd_id, $case_id)
+ {
+ $sql = "select *
+ from invoice_med_master where inv_date=curdate() and patient_id='" . $pno . "' ";
+
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount,
+ m.net_amount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where m.patient_id=$pno and m.inv_date=curdate()
+ order by m.id desc";
+
+ $query = $this->db->query($sql);
+ $data['med_inv_item_list'] = $query->result();
+
+ $data['pno'] = $pno;
+ $data['ipd_id'] = $ipd_id;
+ $data['case_id'] = $case_id;
+
+ $content = "";
+
+ if (count($data['med_inv_item_list']) > 0) {
+
+ $this->load->view('Medical/mini_invoice', $data);
+ } else {
+ redirect('Medical/Invoice_counter_new/' . $pno . '/' . $ipd_id . '/' . $case_id);
+ }
+ }
+
+ public function Invoice_counter_new($pno, $ipd_id, $case_id)
+ {
+
+ $select_doc = 0;
+ $p_fname = '';
+ $p_pcode = '';
+ $p_pid = $pno;
+ $p_ipd_id = $ipd_id;
+ $p_ipd_code = '';
+ $customer_type = 0;
+ $group_invoice_id = 0;
+
+ $select_doc = 0;
+ $data['org_Name'] = "";
+ $data['content'] = "";
+
+ if ($pno > 0) {
+ $sql = "select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='" . $pno . "' ";
+ $query = $this->db->query($sql);
+ $person_info = $query->result();
+
+ $sql = "select doc_id from opd_master where p_id='" . $pno . "' order by opd_id desc limit 1";
+ $query = $this->db->query($sql);
+ $data['opd_master'] = $query->result();
+
+ $p_fname = $person_info[0]->p_fname;
+ $p_pcode = $person_info[0]->p_code;
+
+ if (count($data['opd_master']) > 0) {
+ $select_doc = $data['opd_master'][0]->doc_id;
+ } else {
+ $select_doc = 0;
+ }
+
+ $customer_type = 1;
+ }
+
+ if ($ipd_id > 0) {
+ $sql = "select * from ipd_master where id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql = "select * from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_list'] = $query->result();
+
+ $p_ipd_code = $data['ipd_master'][0]->ipd_code;
+
+ $group_invoice_id = 1;
+
+ if ($data['ipd_master'][0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $data['ipd_master'][0]->case_id;
+ $query = $this->db->query($sql);
+ $org_master = $query->result();
+
+ if (count($org_master) > 0) {
+ $data['org_Name'] = $org_master[0]->insurance_company_name;
+ }
+ }
+ }
+
+ $this->load->model('Medical_M');
+
+ $data['invoice_med_master'] = array(
+ 'patient_id' => $p_pid,
+ 'ipd_id' => $p_ipd_id,
+ 'ipd_code' => $p_ipd_code,
+ 'case_id' => $case_id,
+ 'inv_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'inv_name' => $p_fname,
+ 'patient_code' => $p_pcode,
+ 'doc_id' => $select_doc,
+ 'sale_return' => 0,
+ 'case_credit' => 0,
+ 'customer_type' => $customer_type,
+ 'group_invoice_id' => $group_invoice_id,
+ );
+
+ if ($case_id > 0) {
+ $data['invoice_med_master']['case_credit'] = 1;
+ }
+
+
+
+ $inser_id = $this->Medical_M->add_invoice($data['invoice_med_master']);
+
+ if ($inser_id) {
+ $sql = "select *,if(ipd_credit>0,'Credit to IPD','CASH') as credit_status from invoice_med_master where id=" . $inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $sql = "SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_med_item i JOIN purchase_invoice_item p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where inv_med_id=" . $inser_id . " GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select item_code
+ from inv_med_item where inv_med_id=" . $inser_id . " Group by item_code Having count(id)>1";
+ $query = $this->db->query($sql);
+ $data['inv_items_multiple'] = $query->result();
+
+ $sql = "select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,sum(disc_amount) as t_dis_amt from inv_med_item where inv_med_id=" . $inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $sql = "select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist'] = $query->result();
+
+ $sql = "select * from organization_case_master where id=" . $case_id;
+ $query = $this->db->query($sql);
+ $data['OCaseMaster'] = $query->result();
+
+ $data['sale_return'] = $data['invoiceMaster'][0]->sale_return;
+
+ $data['content'] = $this->load->view('Medical/Med_Item_List', $data, true);
+
+ $this->load->view('Medical/Medical_Invoice_V', $data);
+ }
+ }
+
+ public function Invoice_Return_new($pno)
+ {
+
+ $select_doc = 0;
+ $p_fname = '';
+ $p_pcode = '';
+ $p_pid = $pno;
+ $inv_phone_number = '';
+
+ $data['content'] = '';
+
+ if ($pno > 0) {
+ $sql = "select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='" . $pno . "' ";
+ $query = $this->db->query($sql);
+ $person_info = $query->result();
+
+ $p_fname = $person_info[0]->p_fname;
+ $p_pcode = $person_info[0]->p_code;
+ $inv_phone_number = $person_info[0]->mphone1;
+
+ $select_doc = 0;
+ }
+
+ $this->load->model('Medical_M');
+
+ $data['invoice_med_master'] = array(
+ 'patient_id' => $p_pid,
+ 'inv_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'inv_name' => $p_fname,
+ 'patient_code' => $p_pcode,
+ 'doc_id' => $select_doc,
+ 'inv_phone_number' => $inv_phone_number,
+ 'sale_return' => 1
+ );
+
+ $inser_id = $this->Medical_M->add_invoice($data['invoice_med_master']);
+
+ if ($inser_id) {
+ $sql = "select *,if(ipd_credit>0,'Credit to IPD','CASH') as credit_status from invoice_med_master where id=" . $inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $sql = "SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_med_item i JOIN purchase_invoice_item p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where inv_med_id=" . $inser_id . " GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select item_code
+ from inv_med_item where inv_med_id=" . $inser_id . " Group by item_code Having count(id)>1";
+ $query = $this->db->query($sql);
+ $data['inv_items_multiple'] = $query->result();
+
+ $sql = "select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,sum(disc_amount) as t_dis_amt from inv_med_item where inv_med_id=" . $inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $data['sale_return'] = $data['invoiceMaster'][0]->sale_return;
+
+ $data['content'] = $this->load->view('Medical/Med_Item_List', $data, true);
+
+ $this->load->view('Medical/Medical_Invoice_Return_V', $data);
+ }
+ }
+
+ public function item_stock_list($item_code)
+ {
+ $sql = "SELECT p.item_name,t.batch_no,t.expiry_date as expiry_date_str,t.expiry_date,
+ (t.total_unit-t.total_sale_unit-total_lost_unit-t.total_return_unit) AS c_qty,
+ t.id,t.mrp,t.selling_unit_rate,p.id AS item_code
+ FROM med_product_master p
+ JOIN purchase_invoice_item t ON p.id=t.item_code
+ where (t.total_unit-t.total_sale_unit)>0
+ and (expiry_date>date_add(sysdate(),interval 1 month) or p.exp_date_applicable=0)
+ and p.id =$item_code";
+
+ $query = $this->db->query($sql);
+ $data['Item_list'] = $query->result_array();
+
+ $this->load->view('Medical/sale_item_list_for_add', $data);
+ }
+
+ public function get_drug()
+ {
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "SELECT p.item_name as item_name,p.formulation,t.batch_no,t.expiry_date as expiry_date_str,t.expiry_date,
+ DATEDIFF(LAST_DAY(t.expiry_date),curdate()) as expiry_month_pending,
+ (t.total_unit-t.total_sale_unit-total_lost_unit-t.total_return_unit) AS c_qty,
+ t.id,t.mrp,t.selling_unit_rate,p.id AS item_code,t.packing,if(t.stock_date>'2025-09-21',1,0) as new_stock
+ FROM med_product_master p
+ JOIN purchase_invoice_item t ON p.id=t.item_code
+ and (t.total_unit-t.total_sale_unit-t.total_lost_unit-t.total_return_unit)>0
+ and t.remove_item=0 and t.item_return=0
+ and (LAST_DAY(expiry_date)>date_add(sysdate(),interval -15 day) or p.exp_date_applicable=0)
+ where (p.item_name like '" . $q . "%' ";
+
+ if (strlen($q) > 5) {
+ $sql = $sql . " or p.item_name SOUNDS LIKE '" . $q . "' or p.genericname like '%" . $q . "%'";
+ }
+
+ $sql = $sql . ") order by p.item_name,t.id limit 100";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $msg_desc = '';
+ $no_exp_month = Round($row['expiry_month_pending'] / 30, 2);
+
+ if ($no_exp_month <= 4 && $no_exp_month >= 2) {
+ $msg_desc .= ' Expire Within : ' . htmlentities(stripslashes($no_exp_month)) . ' Month ';
+ } elseif ($no_exp_month == 1) {
+ $msg_desc .= ' Expired : ' . htmlentities(stripslashes($no_exp_month)) . ' Month ';
+ } elseif ($no_exp_month < 1) {
+ $msg_desc .= ' Expired : ' . htmlentities(stripslashes($no_exp_month)) . ' Month ';
+ }
+
+
+ $new_row['label'] = htmlentities(stripslashes($row['item_name'] . ' ' . $row['formulation'])) . ' |B:' . htmlentities(stripslashes($row['batch_no'])) . ' |Pak:' . htmlentities(stripslashes($row['packing'])) . ' |Rs.' . htmlentities(stripslashes($row['mrp'])) . ' |Qty:' . htmlentities(stripslashes($row['c_qty']));
+ $new_row['value'] = htmlentities(stripslashes($row['item_name']));
+ $new_row['expiry_alert'] = htmlentities(stripslashes($no_exp_month));
+ $new_row['desc'] = $msg_desc;
+ $new_row['l_item_code'] = htmlentities(stripslashes($row['item_code']));
+ $new_row['l_ss_no'] = htmlentities(stripslashes($row['id']));
+ $new_row['l_Batch'] = htmlentities(stripslashes($row['batch_no']));
+ $new_row['l_Expiry'] = htmlentities(stripslashes($row['expiry_date_str']));
+ $new_row['l_mrp'] = htmlentities(stripslashes($row['mrp']));
+ $new_row['l_unit_rate'] = htmlentities(stripslashes($row['selling_unit_rate']));
+ $new_row['l_c_qty'] = htmlentities(stripslashes($row['c_qty']));
+ $new_row['l_packing'] = htmlentities(stripslashes($row['packing']));
+ $new_row['l_new_stock'] = htmlentities(stripslashes($row['new_stock']));
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ } else {
+ //$new_row['sql']=$sql;
+ //$row_set[] = $new_row;
+ echo json_encode($row_set);
+ }
+ }
+ }
+
+ public function get_drug_master()
+ {
+
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from purchase_invoice_item p
+ where p.id in (select max(id) from purchase_invoice_item t
+ where t.Item_name like '" . $q . "%' group by t.Item_name )
+ order by p.Item_name ";
+
+ $sql = "SELECT m.* ,p.id as ss_no,m.packing as p_packing,p.mrp,p.purchase_price,p.discount,
+ p.batch_no,date_format(expiry_date,'%m') as str_expiry_month ,
+ date_format(expiry_date,'%y') as str_expiry_year ,
+ m.batch_applicable,m.exp_date_applicable,
+ if(p.id is null,m.CGST_per,p.CGST_per) as p_CGST_per,
+ if(p.id is null,m.SGST_per,p.SGST_per) as p_SGST_per,
+ if(p.id is null,m.rack_no,p.rack_no) as p_rack_no,
+ if(p.id is null,m.shelf_no,p.shelf_no) as p_shelf_no,
+ if(p.id is null,m.cold_storage,p.cold_storage) as p_cold_storage
+
+ FROM med_product_master m
+ LEFT JOIN (SELECT * from purchase_invoice_item
+ WHERE id in (select max(id) from purchase_invoice_item
+ WHERE Item_name LIKE '" . $q . "%'
+ group BY item_code ) ) as p ON m.id=p.item_code
+ WHERE m.is_continue=1 and m.Item_name LIKE '" . $q . "%'
+ order BY m.item_name ";
+
+ $sql = $sql . " limit 20";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['item_name'])) . ' | ' . htmlentities(stripslashes($row['p_packing'])) . ' | ' . htmlentities(stripslashes($row['mrp']));
+ $new_row['value'] = htmlentities(stripslashes($row['item_name']));
+ $new_row['l_item_code'] = htmlentities(stripslashes($row['id']));
+ $new_row['l_mrp'] = htmlentities(stripslashes($row['mrp']));
+
+ $new_row['l_packing'] = htmlentities(stripslashes($row['packing']));
+ $new_row['l_CGST_per'] = htmlentities(stripslashes($row['p_CGST_per']));
+ $new_row['l_SGST_per'] = htmlentities(stripslashes($row['p_SGST_per']));
+ $new_row['l_HSNCODE'] = htmlentities(stripslashes($row['HSNCODE']));
+
+ $new_row['l_batch_no'] = htmlentities(stripslashes($row['batch_no']));
+
+ $new_row['l_purchase_price'] = htmlentities(stripslashes($row['purchase_price']));
+
+ $new_row['l_package'] = htmlentities(stripslashes($row['p_packing']));
+ $new_row['l_disc_price'] = htmlentities(stripslashes($row['discount']));
+
+ $new_row['l_rack_no'] = htmlentities(stripslashes($row['p_rack_no']));
+ $new_row['l_shelf_no'] = htmlentities(stripslashes($row['p_shelf_no']));
+ $new_row['l_cold_storage'] = htmlentities(stripslashes($row['p_cold_storage']));
+
+ $new_row['batch_applicable'] = htmlentities(stripslashes($row['batch_applicable']));
+ $new_row['exp_date_applicable'] = htmlentities(stripslashes($row['exp_date_applicable']));
+
+ $new_row['datepicker_doe_month'] = htmlentities(stripslashes($row['str_expiry_month']));
+ $new_row['datepicker_doe_year'] = htmlentities(stripslashes($row['str_expiry_year']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ } else {
+ $row_set[] = array();
+ echo json_encode($row_set);
+ }
+ }
+ }
+
+ public function get_formulation_desc()
+ {
+
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from drugs_formulation where formulation_desc like '" . $q . "%'";
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['formulation_desc']));
+ $new_row['value'] = htmlentities(stripslashes($row['formulation_desc']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function go_final()
+ {
+ $this->load->model('Medical_M');
+
+ $inv_id = $this->input->post('inv_id');
+ $doc_id = $this->input->post('doc_id');
+ $doc_name = $this->input->post('doc_name');
+ $remark_ipd = $this->input->post('input_remark_ipd');
+ $patient_code = $this->input->post('patient_code');
+ $custmer_Name = $this->input->post('custmer_Name');
+ $ipd_credit = $this->input->post('ipd_credit');
+
+ $org_credit = $this->input->post('org_credit');
+ $inv_date = $this->input->post('inv_date');
+
+ $sql = "select * from patient_master where p_code='" . $patient_code . "' ";
+ $query = $this->db->query($sql);
+ $person_info = $query->result();
+
+ $sql = "select * from doctor_master where id='" . $doc_id . "' ";
+ $query = $this->db->query($sql);
+ $doc_info = $query->result();
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master'] = $query->result();
+
+ if ($this->ion_auth->in_group('InvoiceDateChanged') || $this->ion_auth->in_group('admin')) {
+ $inv_date = str_to_MysqlDate($inv_date);
+ } else {
+ $inv_date = $data['invoice_master'][0]->inv_date;
+ }
+
+ if (count($person_info) > 0) {
+ $patient_id = $person_info[0]->id;
+ $patient_code_u = $patient_code;
+ $custmer_Name = $person_info[0]->p_fname;
+ } else {
+ $patient_id = 0;
+ $patient_code_u = '';
+ }
+
+ $refername = $doc_name;
+
+ if (count($doc_info) > 0) {
+ $refername = $doc_info[0]->p_fname;
+ }
+
+ $data = array(
+ 'patient_id' => $patient_id,
+ 'patient_code' => $patient_code_u,
+ 'doc_id' => $doc_id,
+ 'doc_name' => $refername,
+ 'inv_name' => $custmer_Name,
+ 'remark_ipd' => $remark_ipd,
+ 'ipd_credit' => $ipd_credit,
+ 'case_credit' => $org_credit,
+ 'inv_date' => $inv_date
+ );
+
+ $inser_id = $this->Medical_M->update_in_upv_item($data, $inv_id);
+ $this->Medical_M->update_invoice_group($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+ }
+
+ public function getDrugTable()
+ {
+
+ $requestData = $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 => 'item_id',
+ 1 => 'itemname',
+ 2 => 'formulation',
+ 3 => 'genericname',
+ 5 => 'company_name_idx',
+ 4 => 'mrp'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select * ";
+
+ $sql_count = "Select count(*) as no_rec ";
+
+ $sql_from = " from drug_temp ";
+
+ $total_sql = $sql_count . $sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec'] = $query->result();
+ $totalData = $data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where = " WHERE 1 = 1";
+
+ $sql_where_flag = 0;
+
+ // getting records as per search parameters
+ if (!empty($requestData['columns'][0]['search']['value'])) { //item_id
+ $sql_where .= " AND item_id LIKE '" . $requestData['columns'][0]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][1]['search']['value'])) { //itemname
+ $sql_where .= " AND itemname LIKE '%" . $requestData['columns'][1]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][2]['search']['value'])) { //dosage
+ $sql_where .= " AND formulation LIKE '%" . $requestData['columns'][2]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][3]['search']['value'])) { //formulation
+ $sql_where .= " AND genericname LIKE '%" . $requestData['columns'][3]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][4]['search']['value'])) { //therapeutic
+ $sql_where .= " AND company_name_idx LIKE '%" . $requestData['columns'][4]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ $total_filer_sql = $sql_count . $sql_from . $sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter'] = $query->result(); // when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered = $data['total_rec_filter'][0]->no_rec;
+
+
+ $sql_order = " ORDER BY " . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " "; // adding length
+
+ $Result_sql = $sql_f_all . $sql_from . $sql_where . $sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata = $query->result_array();
+
+ $output = array(
+ "draw" => intval($requestData['draw']), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval($totalData), // total number of records
+ "recordsFiltered" => intval($totalFiltered), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach ($rdata as $aRow) {
+ $row = array();
+
+ foreach ($columns as $col) {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+ }
+
+ public function getInvoiceTable()
+ {
+ //Single Store Remove Store ID feild
+
+ $requestData = $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 => 'inv_med_code',
+ 1 => 'inv_name',
+ 2 => 'patient_code',
+ 3 => 'IPD_CODE',
+ 4 => 'inv_date_str',
+ 5 => 'net_amount',
+ 6 => 'payment_received',
+ 7 => 'payment_balance',
+ 8 => 'id',
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select m.inv_med_code,m.inv_name,
+ m.inv_phone_number, m.patient_code,
+ if(m.ipd_id>0,Concat('',m.ipd_code,' '),'') AS IPD_CODE,
+ if(m.case_id>0,Concat(o.case_id_code,' '),'') as ORG_CODE ,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,
+ m.net_amount,m.id,m.payment_received,m.payment_balance ";
+
+ $sql_count = "Select count(*) as no_rec ";
+
+ $sql_from = " from (invoice_med_master m left join ipd_master i on m.ipd_id=i.id )
+ left join organization_case_master o on m.case_id=o.id
+ left join inv_med_group g on i.id=g.ipd_id AND g.med_group_id=m.med_group_id";
+
+ //$total_sql=$sql_count.$sql_from;
+ $total_sql = "Select count(*) as no_rec from invoice_med_master";
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec'] = $query->result();
+ $totalData = $data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ if ($this->ion_auth->in_group('MedicalStoreAdmin')) {
+ $sql_where = " WHERE sale_return=0 ";
+ } else {
+ $sql_where = " WHERE sale_return=0 and inv_date >= date_add(sysdate(),interval -50 day) ";
+ }
+
+ $sql_where_flag = 0;
+
+ // getting records as per search parameters
+ if (!empty($requestData['columns'][0]['search']['value'])) { //inv_med_code
+ $sql_where .= " AND inv_med_code LIKE '%" . $requestData['columns'][0]['search']['value'] . "' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][1]['search']['value'])) { //inv_name
+ $stext = $requestData['columns'][1]['search']['value'];
+ if (!is_numeric($stext) && strlen($stext) > 3) {
+ $sql_where .= " AND inv_name LIKE '%" . $requestData['columns'][1]['search']['value'] . "%' ";
+ }
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][2]['search']['value'])) { //patient_code
+ $stext = $requestData['columns'][2]['search']['value'];
+ $sql_where .= " AND (patient_code LIKE '%" . $stext . "' )";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][3]['search']['value'])) { //patient_code
+ $stext = $requestData['columns'][3]['search']['value'];
+ $sql_where .= " AND (m.ipd_code LIKE '%" . $stext . "' AND m.ipd_id>0 ) ";
+ $sql_where_flag = 1;
+ }
+
+
+
+ $total_filer_sql = $sql_count . $sql_from . $sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter'] = $query->result(); // when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered = $data['total_rec_filter'][0]->no_rec;
+
+ $sql_order = " ORDER BY id desc," . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " "; // adding length
+
+ $Result_sql = $sql_f_all . $sql_from . $sql_where . $sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata = $query->result_array();
+
+ //$totalFiltered=count($rdata);
+
+ $output = array(
+ "draw" => intval($requestData['draw']), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval($totalData), // total number of records
+ "recordsFiltered" => intval($totalFiltered), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach ($rdata as $aRow) {
+ $row = array();
+
+ foreach ($columns as $col) {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function getReturnInvoiceTable()
+ {
+ //Single Store Remove Store ID feild
+
+ $requestData = $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 => 'inv_med_code',
+ 1 => 'inv_name',
+ 2 => 'Code',
+ 3 => 'inv_date_str',
+ 4 => 'net_amount',
+ 5 => 'payment_received',
+ 6 => 'payment_balance',
+ 7 => 'id',
+ 8 => 'ipd_status',
+ 9 => 'org_status',
+ 10 => 'ipd_credit_type',
+ 11 => 'org_credit_type'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select m.inv_med_code,m.inv_name,
+ Concat(if(m.patient_code<>'',Concat(m.patient_code,' '),''),
+ if(m.ipd_code<>'',Concat('',m.ipd_code,' '),''),
+ if(m.case_id>0,Concat(o.case_id_code,' '),'')) as Code ,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,
+ m.doc_name,m.net_amount,m.payment_received,m.payment_balance,m.id,i.ipd_status,
+ o.status as org_status,
+ m.ipd_credit as ipd_credit_type,m.case_credit as org_credit_type ";
+
+ $sql_count = "Select count(*) as no_rec ";
+
+ $sql_from = " from (invoice_med_master m left join ipd_master i on m.ipd_id=i.id )
+ left join organization_case_master o on m.case_id=o.id ";
+
+ $total_sql = $sql_count . $sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec'] = $query->result();
+ $totalData = $data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ if ($this->ion_auth->in_group('MedicalStoreAdmin')) {
+ $sql_where = " WHERE sale_return=1 ";
+ } else {
+ $sql_where = " WHERE sale_return=1 and inv_date >= date_add(sysdate(),interval -50 day) ";
+ }
+
+
+ $sql_where_flag = 0;
+
+ // getting records as per search parameters
+ if (!empty($requestData['columns'][0]['search']['value'])) { //inv_med_code
+ $sql_where .= " AND inv_med_code LIKE '%" . $requestData['columns'][0]['search']['value'] . "' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][1]['search']['value'])) { //inv_name
+ $stext = $requestData['columns'][1]['search']['value'];
+ if (is_numeric($stext) && strlen($stext) > 3) {
+ $sql_where .= " AND inv_phone_number LIKE '" . $stext . "%' ";
+ } else {
+ $sql_where .= " AND inv_name LIKE '%" . $requestData['columns'][1]['search']['value'] . "%' ";
+ }
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][2]['search']['value'])) { //patient_code
+ $sql_where .= " AND (patient_code LIKE '%" . $requestData['columns'][2]['search']['value'] . "' OR
+ m.ipd_code LIKE '%" . $requestData['columns'][2]['search']['value'] . "' OR
+ o.case_id_code LIKE '%" . $requestData['columns'][2]['search']['value'] . "' )";
+ $sql_where_flag = 1;
+ }
+
+ $total_filer_sql = $sql_count . $sql_from . $sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter'] = $query->result(); // when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered = $data['total_rec_filter'][0]->no_rec;
+
+ $sql_order = " ORDER BY id desc," . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " "; // adding length
+
+ $Result_sql = $sql_f_all . $sql_from . $sql_where . $sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata = $query->result_array();
+
+ $output = array(
+ "draw" => intval($requestData['draw']), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval($totalData), // total number of records
+ "recordsFiltered" => intval($totalFiltered), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach ($rdata as $aRow) {
+ $row = array();
+
+ foreach ($columns as $col) {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+
+ public function getStockDrugTable()
+ {
+
+ $requestData = $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 => 'ss_no',
+ 1 => 'item_code',
+ 2 => 'item_name',
+ 3 => 'formulation',
+ 4 => 'rack_no',
+ 5 => 'shelf_no',
+ 6 => 'batch_no',
+ 7 => 'total_unit',
+ 8 => 'expiry_date',
+ 9 => 'mrp',
+ 10 => 'update_stock_qty'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select * ";
+
+ $sql_count = "Select count(*) as no_rec ";
+
+ $sql_from = " from stock_addition ";
+
+ $total_sql = $sql_count . $sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec'] = $query->result();
+ $totalData = $data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where = " WHERE 1 = 1 ";
+
+ $sql_where_flag = 0;
+
+ // getting records as per search parameters
+ if (!empty($requestData['columns'][0]['search']['value'])) { //item_id
+ $sql_where .= " AND item_code LIKE '" . $requestData['columns'][0]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][1]['search']['value'])) { //itemname
+ $sql_where .= " AND item_name LIKE '%" . $requestData['columns'][1]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][2]['search']['value'])) { //dosage
+ $sql_where .= " AND formulation LIKE '%" . $requestData['columns'][2]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][3]['search']['value'])) { //dosage
+ $sql_where .= " AND rack_no LIKE '%" . $requestData['columns'][3]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][4]['search']['value'])) { //dosage
+ $sql_where .= " AND shelf_no LIKE '%" . $requestData['columns'][4]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][5]['search']['value'])) { //dosage
+ $sql_where .= " AND batch_no LIKE '%" . $requestData['columns'][5]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ $total_filer_sql = $sql_count . $sql_from . $sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter'] = $query->result(); // when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered = $data['total_rec_filter'][0]->no_rec;
+
+ $sql_order = " ORDER BY " . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " "; // adding length
+
+ $Result_sql = $sql_f_all . $sql_from . $sql_where . $sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata = $query->result_array();
+
+ $output = array(
+ "draw" => intval($requestData['draw']), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval($totalData), // total number of records
+ "recordsFiltered" => intval($totalFiltered), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach ($rdata as $aRow) {
+ $row = array();
+
+ foreach ($columns as $col) {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function confirm_payment()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Medical_M');
+
+ $invoice_id = $this->input->post('med_invoice_id');
+ $input_amount_paid = $this->input->post('input_amount_paid');
+
+ $sql = "select * from invoice_med_master where id='" . $invoice_id . "'";
+ $query = $this->db->query($sql);
+ $inv_master = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $showcontent1 = '
+
+
+ Payment Method by : ';
+
+ $showcontent2 = '
';
+
+ $pay_remark = '';
+
+ if ($inv_master[0]->patient_id > 0) {
+ $Customerof_type = 1;
+ } else {
+ $Customerof_type = 3;
+ }
+
+ if ($this->input->post('mode') == 1) {
+ $paydata = array(
+ 'payment_mode' => '1',
+ 'Customerof_type' => $Customerof_type,
+ 'Customerof_id' => $inv_master[0]->patient_id,
+ 'Customerof_code' => $inv_master[0]->patient_code,
+ 'Medical_invoice_id' => $inv_master[0]->id,
+ 'Medical_invoice_code' => $inv_master[0]->inv_med_code,
+ 'credit_debit' => '0',
+ 'amount' => $input_amount_paid,
+ 'payment_date' => date('Y-m-d H:i:s'),
+ 'remark' => $pay_remark,
+ 'update_by' => $user_name . '[' . $user_id . ']',
+ 'update_by_id' => $user_id
+ );
+
+ $insert_id = $this->Medical_M->insert_payment($paydata);
+
+ $data = array(
+
+ 'payment_mode' => '1',
+ 'payment_status' => '1',
+ 'invoice_status' => '1',
+ 'payment_id' => $insert_id,
+ 'payment_mode_desc' => 'Cash',
+ 'confirm_invoice' => date('Y-m-d H:i:s'),
+ 'prepared_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->Medical_M->update_in_upv_item($data, $invoice_id);
+
+
+
+ $status = 'CASH';
+ $showcontent = $showcontent1 . $status . $showcontent2;
+
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if ($this->input->post('mode') == 2) {
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[3]|max_length[15]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+ $paydata = array(
+ 'payment_mode' => '2',
+ 'Customerof_type' => $Customerof_type,
+ 'Customerof_id' => $inv_master[0]->patient_id,
+ 'Customerof_code' => $inv_master[0]->patient_code,
+ 'Medical_invoice_id' => $inv_master[0]->id,
+ 'Medical_invoice_code' => $inv_master[0]->inv_med_code,
+ 'credit_debit' => '0',
+ 'amount' => $input_amount_paid,
+ 'payment_date' => date('Y-m-d H:i:s'),
+ 'remark' => $pay_remark,
+ 'update_by' => $user_name . '[' . $user_id . ']',
+ 'update_by_id' => $user_id,
+ 'pay_bank_id' => $this->input->post('cbo_pay_type'),
+ 'card_tran_id' => $this->input->post('input_card_tran')
+ );
+
+ $insert_id = $this->Medical_M->insert_payment($paydata);
+
+ $data = array(
+ 'payment_mode' => '2',
+ 'payment_status' => '1',
+ 'invoice_status' => '1',
+ 'payment_mode_desc' => 'Bank Card',
+ 'confirm_invoice' => date('Y-m-d H:i:s'),
+ 'payment_id' => $insert_id,
+ 'card_tran_id' => $this->input->post('input_card_tran'),
+ 'prepared_by' => $user_name . '[' . $user_id . ']',
+ 'prepared_by_id' => $user_id
+ );
+
+ $this->Medical_M->update_in_upv_item($data, $invoice_id);
+
+ $status = 'Bank Card';
+ $showcontent = $showcontent1 . $status . $showcontent2;
+
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => $showcontent
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_error = validation_errors();
+ $rvar = array(
+ 'update' => 0,
+ 'error_text' => $send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ if ($this->input->post('mode') == 3) {
+ $data = array(
+
+ 'payment_mode' => '3',
+ 'payment_status' => '1',
+ 'invoice_status' => '1',
+ 'confirm_invoice' => date('d/m/Y H:m:s'),
+ 'payment_mode_desc' => 'IPD Credit',
+ 'ipd_id' => $this->input->post('ipd_id'),
+ 'prepared_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->Medical_M->update_in_upv_item($data, $invoice_id);
+
+ $status = 'IPD Credit';
+ $showcontent = $showcontent1 . $status . $showcontent2;
+
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if ($this->input->post('mode') == 4) {
+ $data = array(
+ 'payment_mode' => '4',
+ 'payment_status' => '1',
+ 'invoice_status' => '1',
+ 'confirm_invoice' => date('d/m/Y H:m:s'),
+ 'payment_mode_desc' => 'Org Credit',
+ 'case_id' => $this->input->post('ipd_id'),
+ 'prepared_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->Medical_M->update_in_upv_item($data, $invoice_id);
+
+ $status = 'Org Credit';
+ $showcontent = $showcontent1 . $status . $showcontent2;
+
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if ($this->input->post('mode') == 5) {
+ if ($input_amount_paid < 0) {
+ $input_amount_paid = $input_amount_paid * -1;
+ }
+
+ $paydata = array(
+ 'payment_mode' => '1',
+ 'Customerof_type' => $Customerof_type,
+ 'Customerof_id' => $inv_master[0]->patient_id,
+ 'Customerof_code' => $inv_master[0]->patient_code,
+ 'Medical_invoice_id' => $inv_master[0]->id,
+ 'Medical_invoice_code' => $inv_master[0]->inv_med_code,
+ 'credit_debit' => '1',
+ 'amount' => $input_amount_paid,
+ 'payment_date' => date('Y-m-d H:i:s'),
+ 'remark' => $pay_remark,
+ 'update_by' => $user_name . '[' . $user_id . ']',
+ 'update_by_id' => $user_id
+ );
+
+ $insert_id = $this->Medical_M->insert_payment($paydata);
+
+ $data = array(
+
+ 'payment_mode' => '1',
+ 'payment_status' => '1',
+ 'invoice_status' => '1',
+ 'payment_id' => $insert_id,
+ 'payment_mode_desc' => 'Cash Return',
+ 'confirm_invoice' => date('Y-m-d H:i:s'),
+ 'prepared_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->Medical_M->update_in_upv_item($data, $invoice_id);
+
+ $status = 'CASH';
+ $showcontent = $showcontent1 . $status . $showcontent2;
+
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => $showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ $this->Medical_M->update_invoice_final($invoice_id);
+ }
+
+ public function Adjust_Payment()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Medical_M');
+
+ $invoice_id = $this->input->post('med_invoice_id');
+ $input_amount_paid = $this->input->post('input_amount_paid');
+
+ $sql = "select * from invoice_med_master where id='" . $invoice_id . "'";
+ $query = $this->db->query($sql);
+ $inv_master = $query->result();
+
+ if (count($inv_master) > 0) {
+ if ($inv_master[0]->ipd_id == 0) {
+
+ $discount = $inv_master[0]->discount_amount;
+ $discount = $discount + $input_amount_paid;
+
+ $log = $inv_master[0]->log;
+
+ $update_str = "Adjust Balance Amt:" . $input_amount_paid;
+
+ $log = $log . PHP_EOL . PHP_EOL . $update_str;
+
+ $dataupdate = array(
+ 'discount_amount' => $discount,
+ 'log' => $log,
+ );
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_in_upv_item($dataupdate, $invoice_id);
+
+ $this->Medical_M->update_invoice_final($invoice_id);
+ }
+ }
+ }
+
+ public function invoice_print($inv_id, $print_format = 0)
+ {
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_invoice_final($inv_id);
+
+ $sql = "select *,(discount_amount+item_discount_amount) as inv_disc_total,(CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master'] = $query->result();
+
+ $sql = "select *,(disc_amount+disc_whole) as d_amt,(CGST+SGST) as gst,(CGST_per+SGST_per) as gst_per from inv_med_item
+ where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select * from ipd_master where id=" . $data['invoice_master'][0]->ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql = "select * from organization_case_master where id=" . $data['invoice_master'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['orgcase'] = $query->result();
+
+ $sql = "select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history_medical where Medical_invoice_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['payment_history_medical'] = $query->result();
+
+ $sql = "select *,if(credit_debit>0,amount*-1,amount) as paid_amount,
+ (case payment_mode when 1 then 'Cash' when 2 then 'Bank Card' when 3 then 'Return Cash ' when 4 then 'Bank Return' when 5 then 'Cash Return' else 'Other' end) as Payment_type_str
+ from payment_history_medical where Medical_invoice_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['payment_history'] = $query->result();
+
+ if ($print_format == 0) {
+ $this->load->view('Medical/Medical_invoice_print_2', $data);
+ } else {
+ $this->load->view('Medical/Medical_invoice_print', $data);
+ }
+ }
+
+
+ public function invoice_print_all($ipd_id, $cash = 0)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+
+ $cash_where = " ";
+
+ if ($cash == 0) {
+ $cash_where .= " and ipd_credit=0 ";
+ $med_type = 1;
+ } elseif ($cash == 1) {
+ $cash_where .= " and ipd_credit=1 and ipd_credit_type=1 ";
+ $med_type = 2;
+ } elseif ($cash == 2) {
+ $cash_where .= " and ipd_credit=1 and ipd_credit_type=0 ";
+ $med_type = 3;
+ }
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id, $med_type);
+
+
+ $sql = "select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%Y')as expiry,
+ i.price,i.qty,sum(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ sum(twdisc_amount) as twdisc_amount,
+ sum(i.disc_amount+i.disc_whole) as d_amt,
+ sum(i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per
+ from inv_med_item i join invoice_med_master m
+ on i.inv_med_id=m.id
+ where m.group_invoice_id>0 and m.ipd_id=" . $ipd_id . $cash_where . " group by i.inv_med_id,i.id WITH ROLLUP";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select sum(CGST_Tamount) as CGST_Tamount,
+ sum(SGST_Tamount) as SGST_Tamount,
+ sum(TaxableAmount) as TaxableAmount,
+ sum(net_amount) as net_amount,
+ sum(payment_received) as payment_received,
+ sum(payment_balance) as payment_balance,
+ sum(discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master
+ where group_invoice_id>0 and ipd_id=" . $ipd_id . $cash_where . " group by ipd_id";
+ $query = $this->db->query($sql);
+ $data['invoice_master'] = $query->result();
+
+ $sql = "select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql = "select * from organization_case_master where id='" . $data['ipd_master'][0]->org_id . "'";
+ $query = $this->db->query($sql);
+ $data['orgcase'] = $query->result();
+
+ $sql = "select sum(if(p.credit_debit>0,p.amount*-1,p.amount)) as paid_amount
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=" . $ipd_id . " and m.med_type=" . $med_type;
+ $query = $this->db->query($sql);
+ $data['payment_Total'] = $query->result();
+
+ $sql = "select p.*,if(p.credit_debit>0,p.amount*-1,p.amount) as paid_amount,
+ (case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' when 3 then 'Return Cash ' when 4 then 'Bank Return' when 5 then 'Cash Return' else 'Other' end) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=" . $ipd_id . " and m.med_type=" . $med_type;
+ $query = $this->db->query($sql);
+ $data['payment_history'] = $query->result();
+
+ $sql = "select * from inv_med_group
+ where ipd_id='" . $ipd_id . "' and med_type='" . $med_type . "'";
+ $query = $this->db->query($sql);
+ $data['inv_med_group'] = $query->result();
+
+ if ($cash == 0) {
+ if ($data['inv_med_group'][0]->bill_final == 1) {
+ $this->load->view('Medical/Medical_invoice_print_all', $data);
+ } else {
+ $this->load->view('Medical/Medical_invoice_print_all_provisional', $data);
+ }
+ } else {
+ $this->load->view('Medical/Medical_invoice_print_all', $data);
+ }
+ }
+
+
+ public function final_invoice($inv_id)
+ {
+ $this->load->model('Medical_M');
+
+ /* $sql="select * from invoice_med_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster']= $query->result(); */
+
+ //$this->Medical_M->update_invoice_group($inv_id);
+ //$this->Medical_M->opd_reset( $inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+
+ $sql = "select *,(discount_amount+item_discount_amount) as inv_disc_total,(CGST_Tamount+SGST_Tamount) as TGST ,date_add(ifnull(confirm_invoice,inv_insert_datetime) ,interval 240 minute) as bill_open_date,
+ if( date_add(ifnull(confirm_invoice,inv_insert_datetime) ,interval 48 hour)>sysdate(),0,1) as bill_opd_close
+ from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $sql = "select * from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age
+ from patient_master where id='" . $data['invoiceMaster'][0]->patient_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $sql = "select * from ipd_master where ipd_status=0 and id=" . $data['invoiceMaster'][0]->ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ if ($data['invoiceMaster'][0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $data['invoiceMaster'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['OCaseMaster'] = $query->result();
+ }
+
+ $sql = "select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history_medical where Medical_invoice_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['payment_history_medical'] = $query->result();
+
+ $sql = "select s.id,s.pay_type,m.bank_name
+ From medical_bank m join medical_bank_payment_source s on m.id=s.bank_id";
+ $query = $this->db->query($sql);
+ $data['bank_data'] = $query->result();
+
+ $sql = "select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p
+ where Medical_invoice_id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['payment_history'] = $query->result();
+
+ if (count($data['invoiceMaster']) > 0) {
+ if ($data['invoiceMaster'][0]->ipd_id > 0) {
+ redirect('Medical/list_med_inv/' . $data['invoiceMaster'][0]->ipd_id);
+ } else if ($data['invoiceMaster'][0]->case_id > 0 && $data['invoiceMaster'][0]->case_credit > 0) {
+ redirect('Medical/list_med_orginv/' . $data['invoiceMaster'][0]->case_id);
+ } else {
+ $this->load->view('Medical/Medical_Final_Invoice', $data);
+ }
+ }
+ }
+
+ public function final_return_invoice($inv_id)
+ {
+ $this->load->model('Medical_M');
+
+ $sql = "select *,(discount_amount+item_discount_amount) as inv_disc_total,(CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $sql = "select *,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select *,if(gender=1,'Male','FeMale') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age
+ from patient_master where id='" . $data['invoiceMaster'][0]->patient_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $sql = "select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history_medical where Medical_invoice_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['payment_history_medical'] = $query->result();
+
+ $sql = "select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p
+ where p.Customerof_type in (1,3) and Medical_invoice_id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['payment_history'] = $query->result();
+
+ if (count($data['invoiceMaster']) > 0) {
+ $this->load->view('Medical/Medical_Final_return_Invoice', $data);
+ } else {
+ echo 'Error In Inv. No.';
+ }
+ }
+
+
+ public function add_item($type, $req = 0)
+ {
+ $this->load->model('Medical_M');
+
+ $inser_id = 1;
+ $Error_Show = '';
+ $exist = 0;
+ $input_id = 0;
+
+ $store_stock_id = $this->input->post('l_ssno');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name . '' . $user->last_name . '[' . $user_id . ']' . date('d-m-Y H:i:s');
+
+ if ($type == 1) {
+ $inv_id = $this->input->post('inv_id');
+ $qty = $this->input->post('qty');
+ $disc = $this->input->post('disc');
+ $product_unit_rate = $this->input->post('product_unit_rate');
+
+ $sql = "SELECT p.item_name as item_name,t.batch_no,t.expiry_date,
+ (t.total_unit-t.total_sale_unit) AS S_qty,
+ t.mrp,t.selling_unit_rate,p.id AS master_product_id,
+ t.id as purchase_item_id,p.formulation,
+ t.HSNCODE,t.CGST_per,t.SGST_per,t.packing
+ FROM med_product_master p
+ JOIN purchase_invoice_item t ON p.id=t.item_code
+ where t.id= " . $store_stock_id;
+ $query = $this->db->query($sql);
+ $data['itemlist'] = $query->result();
+
+ $sql = "select * from inv_med_item where inv_med_id=" . $inv_id . "
+ and store_stock_id=" . $store_stock_id;
+ $query = $this->db->query($sql);
+ $itemExist = $query->result();
+
+ $CGST = $data['itemlist'][0]->CGST_per;
+ $SGST = $data['itemlist'][0]->SGST_per;
+
+ //$item_rate=$data['itemlist'][0]->unit_rate;
+ $item_rate = $product_unit_rate;
+
+ $amount_value = $qty * $item_rate;
+
+ $disc_amount = $amount_value * $disc / 100;
+
+ $Tamount_value = $amount_value - $disc_amount;
+
+ $HSNCODE = $data['itemlist'][0]->HSNCODE;
+
+ $stock_qty = $data['itemlist'][0]->S_qty;
+
+ if ($qty > $stock_qty) {
+ $inser_id = 0;
+ $Error_Show = 'Stock Qty. is less than Required Qty : Current Qty :' . $stock_qty;
+ } elseif ($stock_qty == 0) {
+ $stock_qty = 0;
+ $inser_id = 0;
+ $Error_Show = 'Stock is Empty';
+ }
+
+ if ($inser_id > 0) {
+ $data['insert_inv_med_item'] = array(
+ 'inv_med_id' => $inv_id,
+ 'item_code' => $data['itemlist'][0]->master_product_id,
+ 'item_Name' => $data['itemlist'][0]->item_name,
+ 'formulation' => $data['itemlist'][0]->formulation,
+ 'qty' => $qty,
+ 'batch_no' => $data['itemlist'][0]->batch_no,
+ 'expiry' => $data['itemlist'][0]->expiry_date,
+ 'price' => $item_rate,
+ 'price2' => $item_rate,
+ 'mrp' => $data['itemlist'][0]->mrp,
+ 'disc_per' => $disc,
+ 'disc_amount' => $disc_amount,
+ 'amount' => $amount_value,
+ 'tamount' => $Tamount_value,
+ 'CGST_per' => $CGST,
+ 'SGST_per' => $SGST,
+ 'HSNCODE' => $HSNCODE,
+ 'store_stock_id' => $data['itemlist'][0]->purchase_item_id,
+ 'update_by_id' => $user_id,
+ 'update_by_remark' => $user_name_info,
+ 'packing' => $data['itemlist'][0]->packing,
+ );
+
+ if (count($itemExist) > 0) {
+ $Error_Show = 'Please Check Also Same Item List';
+ $exist = count($itemExist);
+ $input_id = $itemExist[0]->id;
+ $input_id = 0;
+ }
+
+ $inser_id = $this->Medical_M->add_invoiceitem($data['insert_inv_med_item']);
+ }
+ } else if ($type == 2) {
+ $update_qty = $this->input->post('u_qty');
+ $itemid = $this->input->post('itemid');
+
+ $sql = "select * from inv_med_item where id=" . $itemid;
+ $query = $this->db->query($sql);
+ $data['inv_med_item'] = $query->result();
+
+ $CGST = $data['inv_med_item'][0]->CGST_per;
+ $SGST = $data['inv_med_item'][0]->SGST_per;
+ $disc = $data['inv_med_item'][0]->disc_per;
+
+ $inv_id = $data['inv_med_item'][0]->inv_med_id;
+
+ $store_stock_id = $data['inv_med_item'][0]->store_stock_id;
+
+ $sql = "SELECT p.item_name,t.batch_no,t.expiry_date,
+ (t.total_unit-t.total_sale_unit) AS S_qty,
+ t.mrp,t.selling_unit_rate,p.id AS master_product_id,
+ t.id as purchase_item_id,p.formulation,
+ t.HSNCODE,t.CGST_per,t.SGST_per,t.packing
+ FROM med_product_master p
+ JOIN purchase_invoice_item t ON p.id=t.item_code
+ where t.id= " . $store_stock_id;
+
+ $query = $this->db->query($sql);
+ $item_master = $query->result();
+
+ $stock_qty = 0;
+
+ $old_qty = $data['inv_med_item'][0]->qty;
+ $diff_qty = $update_qty - $old_qty;
+
+ if ($diff_qty > 0) {
+ if (count($item_master) > 0) {
+ $stock_qty = $item_master[0]->S_qty;
+ if ($diff_qty > $stock_qty) {
+ $inser_id = 0;
+ $Error_Show = 'Stock Qty. is less than Required Qty : Current Qty :' . $stock_qty;
+ }
+ } else {
+ $stock_qty = 0;
+ $inser_id = 0;
+ $Error_Show = 'Stock is Empty';
+ }
+ }
+
+ if ($inser_id > 0) {
+ $item_rate = $data['inv_med_item'][0]->price;
+ $amount_value = $update_qty * $item_rate;
+
+ $disc_amount = $amount_value * $disc / 100;
+
+ $Tamount_value = $amount_value - $disc_amount;
+
+ $data['update_inv_med_item'] = array(
+ 'qty' => $update_qty,
+ 'disc_amount' => $disc_amount,
+ 'amount' => $amount_value,
+ 'tamount' => $Tamount_value,
+ 'store_stock_id' => $store_stock_id,
+ 'packing' => $data['inv_med_item'][0]->packing,
+ 'inv_med_id' => $inv_id,
+ );
+
+ $this->Medical_M->update_invoiceitem($data['update_inv_med_item'], $itemid);
+ $inser_id = $itemid;
+ }
+
+ $this->Medical_M->update_invoice_group($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+ } else {
+ $inv_id = $this->input->post('inv_id');
+ $itemid = $this->input->post('itemid');
+
+ $sql = "select * from inv_med_item where id=" . $itemid;
+ $query = $this->db->query($sql);
+ $inv_items = $query->row_array();
+
+ $this->Medical_M->delete_invoiceitem($itemid, $inv_items);
+ }
+
+ $content = '';
+
+ if ($inser_id > 0) {
+ $this->Medical_M->update_invoice_final($inv_id);
+
+ $sql = "SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_med_item i JOIN purchase_invoice_item p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where inv_med_id=" . $inv_id . " GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select item_code
+ from inv_med_item where inv_med_id=" . $inv_id . " Group by item_code Having count(id)>1";
+ $query = $this->db->query($sql);
+ $data['inv_items_multiple'] = $query->result();
+
+ $sql = "select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,
+ sum(disc_amount) as t_dis_amt from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $data['sale_return'] = $data['invoiceMaster'][0]->sale_return;
+
+ $content = $this->load->view('Medical/Med_Item_List', $data, true);
+ //$content='';
+ }
+
+ $rvar = array(
+ 'exist' => $exist,
+ 'insertid' => $inser_id,
+ 'content' => $content,
+ 'error' => $Error_Show,
+ 'input_id' => $input_id,
+ 'csrf_dst_name_value' => $this->security->get_csrf_hash()
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ function show_items($inv_id)
+ {
+ $this->load->model('Medical_M');
+
+ //$this->Medical_M->update_invoice_final($inv_id);
+
+ $sql = "SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_med_item i JOIN purchase_invoice_item p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where inv_med_id=" . $inv_id . " GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select item_code
+ from inv_med_item where inv_med_id=" . $inv_id . " Group by item_code Having count(id)>1";
+ $sql = "select item_code
+ from inv_med_item where 1<>1";
+ $query = $this->db->query($sql);
+ $data['inv_items_multiple'] = $query->result();
+
+ $sql = "select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,
+ sum(disc_amount) as t_dis_amt from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $data['sale_return'] = $data['invoiceMaster'][0]->sale_return;
+
+ $content = $this->load->view('Medical/Med_Item_List', $data, true);
+
+ //$content="hello";
+ echo $content;
+ }
+
+
+
+ public function list_org_ipd()
+ {
+ $sql = "select *,(paid_amount-(charge_amount+med_amount)) as balance
+ from v_ipd_list where ipd_status=0 ";
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $sql = "SELECT CONCAT('IPD : ',i.ipd_code,' /Name :',p.p_fname,' / Admit Dt: ',date_format(i.register_date,'%d-%m-%Y'),
+ ' /Balance :',m.payment_balance) AS show_content
+ FROM (inv_med_group m JOIN ipd_master i ON m.ipd_id=i.id)
+ JOIN patient_master p ON i.p_id=p.id
+ WHERE i.ipd_status=0 AND m.med_type=1 AND m.net_amount>0
+ AND payment_balance>=50000 ";
+ $query = $this->db->query($sql);
+ $data['high_balance'] = $query->result();
+
+ $this->load->view('Medical/Medical_ipd_org_list', $data);
+ }
+
+ public function list_high_balance()
+ {
+ $sql = "SELECT i.ipd_code,p.p_code,p.p_fname,p.mphone1,m.payment_received,m.payment_balance,m.net_amount
+ FROM (inv_med_group m JOIN ipd_master i ON m.ipd_id=i.id)
+ JOIN patient_master p ON i.p_id=p.id
+ WHERE i.ipd_status=0 AND m.med_type=1 AND m.net_amount>0
+ AND payment_balance>=50000 ";
+ $query = $this->db->query($sql);
+ $data['high_balance'] = $query->result();
+
+ $this->load->view('Medical/Report/Med_high_pending', $data);
+ }
+
+
+ public function list_org()
+ {
+ $sql = "select p.p_fname,p.p_code,p.p_relative,p.p_rname,o.insurance_company_name,o.case_id_code,o.id as org_id,o.p_id ,
+ o.date_registration,Date_Format(o.date_registration,'%d-%m-%Y') as str_register_date,o.insurance_id
+ from organization_case_master o join patient_master p on o.p_id=p.id
+ and o.insurance_id >1 and o.`status`=0 and o.case_type=0 ";
+ $query = $this->db->query($sql);
+ $data['organization_case_master'] = $query->result();
+
+
+ $this->load->view('Medical/Medical_org_list', $data);
+ }
+
+ public function list_med_inv($ipd_id)
+ {
+
+ $sql = "select *,if(ipd_credit=0,'CASH','CREDIT') as credit,
+ if(ipd_credit=1 and ipd_credit_type=0,'Yes','No') as Package
+ from invoice_med_master where ipd_id = " . $ipd_id . " Order by inv_date,id";
+ $query = $this->db->query($sql);
+ $data['inv_master'] = $query->result();
+
+ $this->load->model('Medical_M');
+ //$this->Medical_M->update_invoice_group_gst($ipd_id,1);
+
+ $sql = "select sum(if(ipd_credit=0,net_amount,0)) as cash_netAmount,
+ sum(if(ipd_credit=1 and ipd_credit_type=1,net_amount,0)) as IPDCrAmount ,
+ sum(if(ipd_credit=1 and ipd_credit_type=0,net_amount,0)) as PackageCrAmount,
+ sum(payment_balance) as t_payment_balance ,sum(net_amount) as t_net_amount
+ from invoice_med_master where ipd_id = " . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_total'] = $query->result();
+
+ $sql = "select * from ipd_master where id = " . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql = "select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='" . $data['ipd_master'][0]->p_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $sql = "select * from v_ipd_list where id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_list'] = $query->result();
+
+ $sql = "select * from inv_med_group where med_type=1 and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['med_group_list'] = $query->result();
+
+ $sql = "select b.ipd_id,b.bed_id,b.TDate,m.room_name,m.bed_no
+ from ipd_bed_assign b left join hc_bed_master m on b.bed_id=m.id
+ where b.ipd_id=" . $ipd_id . " order by TDate desc";
+ $query = $this->db->query($sql);
+ $data['bed_list'] = $query->result();
+
+ if ($data['ipd_master'][0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id='" . $data['ipd_master'][0]->case_id . "'";
+ $query = $this->db->query($sql);
+ $data['orgcase'] = $query->result();
+
+ $ins_comp_id = $data['orgcase'][0]->insurance_id;
+ $inc_card_id = $data['orgcase'][0]->insurance_card_id;
+
+ $sql = "select * from hc_insurance_card where id='" . $inc_card_id . "'";
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card'] = $query->result();
+
+ $sql = "select * from hc_insurance where id='" . $ins_comp_id . "'";
+ $query = $this->db->query($sql);
+ $data['insurance'] = $query->result();
+ }
+
+ if (count($data['med_group_list']) > 0) {
+ if ($data['med_group_list'][0]->discount_group_2 <> 0) {
+ exit('Please Contact to Medical Store Admin ');
+ }
+ }
+
+ $this->load->view('Medical/Medical_invoice_list', $data);
+ }
+
+ public function list_med_orginv($org_id)
+ {
+
+ $sql = "select *,if(case_credit=0,'CASH','CREDIT') as credit
+ from invoice_med_master where case_id = " . $org_id . " order by inv_date,id";
+ $query = $this->db->query($sql);
+ $data['inv_master'] = $query->result();
+
+ $sql = "select * from organization_case_master where id = " . $org_id;
+ $query = $this->db->query($sql);
+ $data['orgcase_master'] = $query->result();
+
+ $sql = "select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='" . $data['orgcase_master'][0]->p_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $this->load->view('Medical/Medical_org_invoicelist', $data);
+ }
+
+ public function update_discount()
+ {
+ $invoice_id = $this->input->post('med_invoice_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $dataupdate = array(
+ 'discount_amount' => $this->input->post('input_dis_amt'),
+ 'discount_remark' => $this->input->post('input_dis_desc'),
+ 'discount_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_in_upv_item($dataupdate, $invoice_id);
+
+ $this->Medical_M->update_invoice_final($invoice_id);
+ }
+
+ public function BillFinal($group_id)
+ {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $dataupdate = array(
+ 'bill_final' => '1',
+ 'bill_final_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_group_invoice($dataupdate, $group_id);
+
+ $rvar = array(
+ 'update' => 1,
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function InvBillFinal($invoice_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $dataupdate = array(
+ 'bill_final' => '1',
+ 'bill_final_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_in_upv_item($dataupdate, $invoice_id);
+
+ $rvar = array(
+ 'update' => 1,
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ public function search()
+ {
+ $sdata = $this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9 _.@\-]/', '', trim($sdata));
+
+ if (strlen($sdata) == 0) {
+ $sql = "SELECT p.*,GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age ,
+ Max(o.apointment_date) as Last_OPD ,
+ date_format(if(Max(o.apointment_date) IS NULL,p.insert_date,Max(o.apointment_date)),'%d-%m-%Y') AS Last_Visit
+ FROM patient_master p left join opd_master o on p.id=o.p_id
+ group BY p.id
+ order BY if(Max(o.apointment_date) IS NULL,p.insert_date,Max(o.apointment_date)) DESC
+ LIMIT 100";
+ } else {
+
+ $sdate_array = explode(" ", $sdata);
+ $search_string = " 1=1 ";
+
+ foreach ($sdate_array as $row_data) {
+ if (is_numeric($row_data)) {
+ $search_string .= " and (p.p_code like '%$row_data'
+ or p.mphone1 = '$row_data'
+ or p.udai='$row_data' )";
+ } elseif (ctype_alpha($row_data)) {
+ $search_string .= " and (p.p_fname like '%$row_data%'
+ or p.email1 = '$row_data'
+ or SUBSTRING_INDEX(p.p_fname,' ',1) sounds like '" . $row_data . "')";
+ } else {
+ $search_string .= " and (p.p_code like '$row_data'
+ or p.email1 = '$row_data' )";
+ }
+ }
+
+ $sql = "SELECT p.*,GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age ,
+ Max(o.apointment_date) as Last_OPD ,
+ date_format(if(Max(o.apointment_date) IS NULL,p.insert_date,Max(o.apointment_date)),'%d-%m-%Y') AS Last_Visit
+ FROM patient_master p left join opd_master o on p.id=o.p_id
+ WHERE $search_string
+ group BY p.id
+ order BY if(Max(o.apointment_date) IS NULL,p.insert_date,Max(o.apointment_date)) DESC ";
+ }
+
+
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $this->load->view('Medical/Patient_Search_Result', $data);
+ }
+
+ public function Update_Invoice_ipd_credit_type()
+ {
+ $ipd_credit_type = $this->input->post('ipd_credit_type');
+ $inv_med_id = $this->input->post('inv_med_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user_id . ']T:' . date('d-m-Y');
+
+ if ($inv_med_id == '1') {
+ $ipd_credit_type_update = 'Include by : ' . $user_name;
+ } else {
+ $ipd_credit_type_update = 'Packeage by ' . $user_name;
+ }
+
+ $dataupdate = array(
+ 'ipd_credit_type' => $ipd_credit_type,
+ 'ipd_credit_type_update' => $ipd_credit_type_update,
+ );
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_in_upv_item($dataupdate, $inv_med_id);
+ }
+
+
+
+ public function Med_Inv_Group($inv_med_id)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from invoice_med_master where id=" . $inv_med_id;
+ $query = $this->db->query($sql);
+ $invoice_med_master = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $old_remark = $invoice_med_master[0]->update_history;
+
+ $new_remark = 'Group By : ' . $user_name . '[' . $user_id . ']' . ' Date:' . date('d-m-Y h:i:s') . PHP_EOL;
+
+ $new_remark .= $old_remark;
+
+ $dataupdate = array(
+ 'med_group_id' => 1,
+ 'update_history' => $new_remark
+ );
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_in_upv_item($dataupdate, $inv_med_id);
+ //$this->Medical_M->update_invoice_group($inv_med_id);
+
+ $rvar = array(
+ 'update' => 1,
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function Update_Group_Discount($med_group_id)
+ {
+ $input_discount = $this->input->post('input_discount');
+ $Ipd_ID = $this->input->post('ipd_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $dataupdate = array(
+ 'discount_group' => $input_discount,
+ 'discount_by_group' => $user_name . '[' . $user_id . ']' . ' Date:' . date('d-m-Y h:i:s')
+ );
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_group_invoice($dataupdate, $med_group_id);
+ //$this->Medical_M->update_invoice_group_gst($Ipd_ID);
+
+ $rvar = array(
+ 'update' => 1,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function edit_invoice_edit($inv_id)
+ {
+ $sql = "select *,if(ipd_credit>0,'Credit to IPD','CASH') as credit_status,
+ if(case_credit>0,'Credit to Org','CASH') as credit_org_status from invoice_med_master
+ where id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $sql = "select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,sum(disc_amount) as t_dis_amt from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $sql = "select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist'] = $query->result();
+
+ $sql = "select *,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='" . $data['invoiceMaster'][0]->patient_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $data['org_Name'] = "";
+ $ipd_id = $data['invoiceMaster'][0]->ipd_id;
+
+ if ($ipd_id > 0) {
+ $sql = "select * from ipd_master where id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $sql = "select * from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_list'] = $query->result();
+
+ $data['ipd_master'] = $ipd_master;
+
+ if (count($ipd_master) > 0) {
+ $p_ipd_id = $ipd_master[0]->id;
+ $p_ipd_code = $ipd_master[0]->ipd_code;
+
+ if ($ipd_master[0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $ipd_master[0]->case_id;
+ $query = $this->db->query($sql);
+ $org_master = $query->result();
+
+ if (count($org_master) > 0) {
+ $data['org_Name'] = $org_master[0]->insurance_company_name;
+ }
+ }
+ }
+ }
+
+ if ($data['invoiceMaster'][0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $data['invoiceMaster'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['OCaseMaster'] = $query->result();
+ }
+
+
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $this->load->view('Medical/invoice_master_edit', $data);
+ }
+
+ public function LockIPD($inv_med_id, $lock = 1)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $sql = "select * from ipd_master where id=" . $inv_med_id;
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $old_remark = $ipd_master[0]->lock_remark;
+
+ if ($lock == 1) {
+ $new_remark = 'Locked By : ' . $user_name . '[' . $user_id . ']' . ' Date:' . date('d-m-Y h:i:s') . PHP_EOL;
+ } else {
+ $new_remark = 'Unlocked By : ' . $user_name . '[' . $user_id . ']' . ' Date:' . date('d-m-Y h:i:s') . PHP_EOL;
+ }
+
+ $new_remark .= $old_remark;
+
+ $dataupdate = array(
+ 'lock_medical' => $lock,
+ 'lock_remark' => $new_remark
+ );
+
+ $this->load->model('Ipd_M');
+ $this->Ipd_M->update($dataupdate, $inv_med_id);
+
+ $rvar = array(
+ 'update' => 1,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function load_model_box($ipd_id)
+ {
+ $this->load->model('Medical_M');
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id, 1);
+
+ $sql = "select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),
+ DATEDIFF(discharge_date,register_date)) as no_days,
+ if(case_type=1,'MLC','Non MLC') as case_type_s,
+ Date_format(register_date,'%d-%m-%Y') as str_register_date from ipd_master
+ where id='" . $ipd_id . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info'] = $query->result();
+
+ $sql = "select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age
+ from patient_master where id='" . $data['ipd_info'][0]->p_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $sql = "select * from inv_med_group where med_type=1 and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['med_group_list'] = $query->result();
+
+ $sql = "select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Date_Format(payment_date,'%d-%m-%Y') as str_payment_date,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=" . $ipd_id . " and m.med_type=1";
+ $query = $this->db->query($sql);
+ $data['payment_history'] = $query->result();
+
+ $sql = "select * from inv_med_group where med_type=1 and ipd_id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['inv_med_group'] = $query->result();
+
+ $sql = "select s.id,s.pay_type,m.bank_name
+ From medical_bank m join medical_bank_payment_source s on m.id=s.bank_id";
+ $query = $this->db->query($sql);
+ $data['bank_data'] = $query->result();
+
+ $phone_number_list = array($data['person_info'][0]->mphone1, $data['ipd_info'][0]->P_mobile1, $data['ipd_info'][0]->P_mobile2);
+
+ $data['phone_number_list'] = array_unique($phone_number_list);
+
+ $this->load->view('Medical/Med_Model_Payment', $data);
+ }
+
+ public function payment_receipt($ipd_id, $cash = 0)
+ {
+ $cash_where = " ";
+
+ if ($cash == 0) {
+ $cash_where .= " and ipd_credit=0 ";
+ $med_type = 1;
+ } elseif ($cash == 1) {
+ $cash_where .= " and ipd_credit=1 and ipd_credit_type=1 ";
+ $med_type = 2;
+ } elseif ($cash == 2) {
+ $cash_where .= " and ipd_credit=1 and ipd_credit_type=0 ";
+ $med_type = 3;
+ }
+
+ $sql = "select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,m.mphone1,m.P_mobile1,m.P_mobile2,m.add1,m.add2,
+ m.city,m.district,m.state,
+ m.org_id from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql = "select * from organization_case_master where id='" . $data['ipd_master'][0]->org_id . "'";
+ $query = $this->db->query($sql);
+ $data['orgcase'] = $query->result();
+
+ $sql = "select * from inv_med_group
+ where ipd_id='" . $ipd_id . "' and med_type=" . $med_type;
+ $query = $this->db->query($sql);
+ $data['inv_med_group'] = $query->result();
+
+ $sql = "select p.*,if(p.credit_debit>0,p.amount*-1,p.amount) as paid_amount,
+ Date_Format(payment_date,'%d-%m-%Y') as str_payment_date,
+ (case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' when 3 then 'Return Cash ' when 4 then 'Bank Return' when 5 then 'Cash Return' else 'Other' end) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=" . $ipd_id . " and m.med_type=" . $med_type;
+ $query = $this->db->query($sql);
+ $data['payment_history'] = $query->result();
+
+ //$this->load->view('Medical/Med_Payment_Receipt',$data);
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name = 'Report-payment_receipt-' . $ipd_id . "-" . date('Ymdhis') . ".pdf";
+ $filepath = $file_name;
+ $content = $this->load->view('Medical/Med_Payment_Receipt', $data, TRUE);
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath, "I");
+ }
+
+ public function payment_receipt_sms($ipd_id, $cash = 0)
+ {
+ $inv_phone_number = $this->input->post('phone_number');
+
+ $cash_where = " ";
+
+ if ($cash == 0) {
+ $cash_where .= " and ipd_credit=0 ";
+ $med_type = 1;
+ } elseif ($cash == 1) {
+ $cash_where .= " and ipd_credit=1 and ipd_credit_type=1 ";
+ $med_type = 2;
+ } elseif ($cash == 2) {
+ $cash_where .= " and ipd_credit=1 and ipd_credit_type=0 ";
+ $med_type = 3;
+ }
+
+ $sql = "select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id,m.P_mobile1,m.P_mobile2 from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $sql = "select * from inv_med_group
+ where ipd_id='" . $ipd_id . "' and med_type=" . $med_type;
+ $query = $this->db->query($sql);
+ $inv_med_group = $query->result();
+
+ $sql = "select * from invoice_med_master
+ where ipd_id='" . $ipd_id . "' and ipd_credit=0 order by id desc limit 1";
+ $query = $this->db->query($sql);
+ $inv_med_master = $query->result();
+
+ $sql = "select p.*,if(p.credit_debit>0,p.amount*-1,p.amount) as paid_amount,
+ Date_Format(payment_date,'%d-%m-%Y') as str_payment_date,
+ (case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' when 3 then 'Return Cash ' when 4 then 'Bank Return' when 5 then 'Cash Return' else 'Other' end) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=" . $ipd_id . " and m.med_type=" . $med_type . " order by id desc limit 1";
+ $query = $this->db->query($sql);
+ $payment_history_last = $query->result();
+
+ $Last_Inv_Amt = 0;
+ $Last_pay_Amt = 0;
+
+ if (count($inv_med_master) > 0) {
+ $Last_Inv_Amt = $inv_med_master[0]->net_amount;
+ }
+
+ if (count($payment_history_last) > 0) {
+ $Last_pay_Amt = $payment_history_last[0]->paid_amount;
+ }
+
+ $SMS_SEND = M_store_short . " STORE BILL STATUS%nIPD No.: " . $ipd_master[0]->ipd_code . "%nPName: " . Trim($ipd_master[0]->p_fname) . "%nTot. Med Amt.: " . Round($inv_med_group[0]->net_amount, 0) . "%nLast Inv. Amt.: " . Round($Last_Inv_Amt, 0) . "%nTot. Paid Amt.: " . Round($inv_med_group[0]->payment_received) . "%nLast Paid Amt.: " . Round($Last_pay_Amt, 0) . "%nBal. Amt.: " . Round($inv_med_group[0]->payment_balance, 0) . "%nFrom: DevSoftTech HMS";
+
+
+
+ //$inv_phone_number="9720958717";
+
+ $this->load->model('SMS_M');
+
+ $data = array(
+ 'to_number' => $inv_phone_number,
+ 'message' => $SMS_SEND
+ );
+
+ $insert_id = $this->SMS_M->insert_sms_outbox($data);
+
+
+ $rvar = array(
+ 'update' => $insert_id,
+ 'msg_text' => "Message Send"
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function group_confirm_payment()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Ipd_M');
+ $this->load->model('Medical_M');
+
+ $ipd_id = $this->input->post('ipd_id');
+ $amount = $this->input->post('amount');
+ $Med_Group_id = $this->input->post('Med_Group_id');
+
+ $sql = "select * from ipd_master where id=" . $ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $pay_remark = $this->input->post('cash_remark');
+ $cr_dr = $this->input->post('cr_dr');
+
+
+ $pay_datetime = str_to_MysqlDate($this->input->post('date_payment')) . ' ' . date('H:i:s');
+
+ if ($this->input->post('mode') == 1) {
+ $paydata = array(
+ 'payment_mode' => '1',
+ 'Customerof_type' => '2',
+ 'Customerof_id' => $ipd_master[0]->p_id,
+ 'group_id' => $Med_Group_id,
+ 'ipd_id' => $ipd_id,
+ 'med_type' => 0,
+ 'credit_debit' => $cr_dr,
+ 'amount' => $amount,
+ 'payment_date' => $pay_datetime,
+ 'remark' => $pay_remark,
+ 'update_by' => $user_name . '[' . $user_id . ']',
+ 'update_by_id' => $user_id
+ );
+
+ $insert_id = $this->Medical_M->insert_payment($paydata);
+
+
+ $rvar = array(
+ 'update' => 1,
+ 'ipd_id' => $ipd_id,
+ 'payid' => $insert_id,
+ 'pay_date' => $pay_datetime
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if ($this->input->post('mode') == 2) {
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[1]|max_length[15]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+
+
+ $paydata = array(
+ 'payment_mode' => '2',
+ 'Customerof_type' => '2',
+ 'Customerof_id' => $ipd_master[0]->p_id,
+ 'group_id' => $Med_Group_id,
+ 'ipd_id' => $ipd_id,
+ 'med_type' => 0,
+ 'credit_debit' => $cr_dr,
+ 'amount' => $amount,
+ 'payment_date' => $pay_datetime,
+ 'remark' => $pay_remark,
+ 'update_by' => $user_name . '[' . $user_id . ']',
+ 'update_by_id' => $user_id,
+ 'pay_bank_id' => $this->input->post('cbo_pay_type'),
+ 'card_tran_id' => $this->input->post('input_card_tran'),
+
+ );
+
+ $insert_id = $this->Medical_M->insert_payment($paydata);
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id);
+
+ $rvar = array(
+ 'update' => 1,
+ 'ipd_id' => $ipd_id,
+ 'payid' => $insert_id,
+ 'pay_date' => $pay_datetime
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_error = validation_errors();
+ $rvar = array(
+ 'update' => 0,
+ 'error_text' => $send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+ if ($this->input->post('mode') == 5) {
+ $FormRules = array(
+ array(
+ 'field' => 'input_person_name',
+ 'label' => 'Name on Chq.',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_bank_tran',
+ 'label' => 'Chq. Number',
+ 'rules' => 'required|min_length[1]|max_length[15]'
+ )
+ /*,
+ array(
+ 'field' => 'input_card_digit',
+ 'label' => 'Card Last 4 Digit ',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_card_bank',
+ 'label' => 'Bank Name ',
+ 'rules' => 'required|min_length[1]|max_length[50]'
+ ),
+ */
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+ $pay_remark = 'Chq Payment';
+
+ $paydata = array(
+ 'payment_mode' => '2',
+ 'payof_type' => '4',
+ 'payof_id' => $ipd_master[0]->id,
+ 'payof_code' => $ipd_master[0]->ipd_code,
+ 'credit_debit' => $cr_dr,
+ 'amount' => $amount,
+ 'payment_date' => $pay_datetime,
+ 'remark' => $pay_remark,
+ 'update_by' => $user_name . '[' . $user_id . ']',
+ 'card_bank' => $this->input->post('input_bank_hospital'),
+ 'cust_card' => $this->input->post('input_bank_name'),
+ 'card_remark' => $this->input->post('input_person_name'),
+ 'card_tran_id' => $this->input->post('input_bank_tran'),
+ 'update_by_id' => $user_id
+ );
+
+ $insert_id = $this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode' => '2',
+ 'payment_mode_desc' => 'Bank Chq.-Draft',
+ 'payment_id' => $insert_id,
+ 'pay_date' => $pay_datetime,
+ 'enter_pay_date' => date('Y-m-d H:i:s'),
+ 'ipd_id' => $ipd_id,
+ 'amount' => $amount,
+ 'card_bank' => $this->input->post('input_bank_hospital'),
+ 'card_remark' => $this->input->post('input_card_digit'),
+ 'cust_card' => $this->input->post('input_bank_name'),
+ 'card_tran_id' => $this->input->post('input_bank_tran'),
+ 'prepared_by' => $user_name . '[' . $user_id . ']',
+ 'prepared_by_id' => $user_id
+ );
+
+ $insert_ipdpay_id = $this->Ipd_M->insert_payment_ipd($data);
+
+ $status = 'Bank Card';
+
+
+ $rvar = array(
+ 'update' => 1,
+ 'ipd_id' => $ipd_id,
+ 'payid' => $insert_ipdpay_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_error = validation_errors();
+ $rvar = array(
+ 'update' => 0,
+ 'error_text' => $send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+ }
+
+ public function group_cash_print($ipd_id, $payid)
+ {
+ $sql = "select *,date_format(payment_date,'%d-%m-%Y') as pay_date,
+ (case payment_mode when 1 then 'CASH' when 2 then 'Bank' Else 'Other' End) as payment_mode_desc
+ from payment_history_medical where id=" . $payid;
+ $query = $this->db->query($sql);
+ $data['med_payment'] = $query->result();
+
+ $sql = "select * from ipd_master where id =" . $ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $pno = $data['ipd_master'][0]->p_id;
+
+ $sql = "select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age
+ from patient_master where id='" . $pno . "' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $this->load->view('Medical/Med_Payment_receipt', $data);
+ }
+
+ public function Invoice_Item_Return($inv_type_id, $inv_type = 0)
+ {
+ $data['inv_type_id'] = $inv_type_id;
+ $data['inv_type'] = $inv_type;
+
+ $p_id = 0;
+
+ if ($inv_type == 0) {
+ $sql = "select * from ipd_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,r.r_qty,r.id as return_id
+ from (invoice_med_master m join inv_med_item t on m.id=t.inv_med_id ) left join inv_med_item_return r on t.id=r.inv_item_id and return_status=0
+ where m.ipd_id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['ipd_master'][0]->p_id;
+ } elseif ($inv_type == 1) {
+ $sql = "select * from organization_case_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['org_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,r.r_qty,r.id as return_id
+ from (invoice_med_master m join inv_med_item t on m.id=t.inv_med_id ) left join inv_med_item_return r on t.id=r.inv_item_id and return_status=0
+ where m.case_id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['org_master'][0]->p_id;
+ } else {
+ $sql = "select * from invoice_med_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['invoice_med_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,r.r_qty,r.id as return_id
+ from (invoice_med_master m join inv_med_item t on m.id=t.inv_med_id ) left join inv_med_item_return r on t.id=r.inv_item_id and return_status=0
+ where m.id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['invoice_med_master'][0]->patient_id;
+ }
+
+ $sql = "select * from patient_master_exten
+ where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $query = $this->db->query($sql_items);
+ $data['inv_items'] = $query->result();
+
+ $this->load->view('Medical/Medical_Invoice_Return', $data);
+ }
+
+ public function Invoice_Item_Return_new($inv_type_id, $inv_type = 0)
+ {
+ $data['inv_type_id'] = $inv_type_id;
+ $data['inv_type'] = $inv_type;
+
+ $p_id = 0;
+
+ $sql = "select * from ipd_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $p_id = $data['ipd_master'][0]->p_id;
+
+
+ $sql = "select * from patient_master_exten
+ where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $this->load->view('Medical/IPD_return_medicine', $data);
+ }
+
+ public function IPD_Item_Return_temp($inv_type_id, $inv_type = 0)
+ {
+ $data['inv_type_id'] = $inv_type_id;
+ $data['inv_type'] = $inv_type;
+
+ if ($inv_type == 0) {
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,r.r_qty,r.id as return_id
+ from (invoice_med_master m join inv_med_item t on m.id=t.inv_med_id )
+ join inv_med_item_return r on t.id=r.inv_item_id and return_status=0
+ where m.ipd_id=" . $inv_type_id . " order by r.id desc";
+ } elseif ($inv_type == 1) {
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,r.r_qty,r.id as return_id
+ from (invoice_med_master m join inv_med_item t on m.id=t.inv_med_id )
+ join inv_med_item_return r on t.id=r.inv_item_id and return_status=0
+ where m.case_id=" . $inv_type_id . " order by r.id desc";
+ } else {
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,r.r_qty,r.id as return_id
+ from (invoice_med_master m join inv_med_item t on m.id=t.inv_med_id )
+ join inv_med_item_return r on t.id=r.inv_item_id and return_status=0
+ where l m.id=" . $inv_type_id . " order by r.id desc";
+ }
+
+ $query = $this->db->query($sql_items);
+ $data['inv_items'] = $query->result();
+
+ $this->load->view('Medical/Medical_Invoice_Return_list', $data);
+ }
+
+ public function IPD_Item_list($inv_type_id)
+ {
+ $data['inv_type_id'] = $inv_type_id;
+
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,r.r_qty,r.id as return_id
+ from (invoice_med_master m join inv_med_item t on m.id=t.inv_med_id )
+ left join inv_med_item_return r on t.id=r.inv_item_id and return_status=0
+ where r.id is null and m.ipd_id=" . $inv_type_id . " ";
+
+ if (strlen($q) > 0) {
+ $sql .= " and t.item_name LIKE '" . $q . "%'";
+ } else {
+ $sql .= " and 1<>1 ";
+ }
+
+ $sql .= " order by t.item_name,t.id";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['item_Name'])) . ' |B:' . htmlentities(stripslashes($row['batch_no'])) . ' |Rs.' . htmlentities(stripslashes($row['mrp'])) . ' |Qty:' . htmlentities(stripslashes($row['qty']));
+ $new_row['value'] = htmlentities(stripslashes($row['item_Name']));
+ $new_row['l_item_code'] = htmlentities(stripslashes($row['item_id']));
+ $new_row['l_Batch'] = htmlentities(stripslashes($row['batch_no']));
+ $new_row['l_mrp'] = htmlentities(stripslashes($row['mrp']));
+ $new_row['l_price'] = htmlentities(stripslashes($row['price']));
+ $new_row['l_qty'] = htmlentities(stripslashes($row['qty']));
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ } else {
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row;
+ echo json_encode($row_set);
+ }
+ }
+ }
+
+
+
+ public function Med_Return_invoice_search($r_inv_id)
+ {
+ $data['r_inv_id'] = $r_inv_id;
+ $this->load->view('Medical/Med_Return_Invoice_search', $data);
+ }
+
+ public function Invoice_Item_old()
+ {
+ $search_text = trim($this->input->post('search_text'));
+ $search_type = $this->input->post('search_type');
+
+ if ($search_type == 1) {
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where m.inv_date >=date_add(curdate(),interval -5 month) and m.inv_phone_number='$search_text' and m.ipd_id=0 and m.case_id=0 ";
+ $query = $this->db->query($sql);
+ $data['med_inv_item_list'] = $query->result();
+ }
+
+ if ($search_type == 2) {
+ $sql = "SELECT count(id) as no_rec,group_concat(id) as p_id_list
+ From patient_master where p_code like '" . $search_text . "' ";
+ $query = $this->db->query($sql);
+ $patient_master = $query->result();
+
+ $search_id_list = "0";
+ if ($patient_master[0]->no_rec) {
+ $search_id_list = $patient_master[0]->p_id_list;
+ }
+
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where m.inv_date >=date_add(curdate(),interval -5 month) and m.patient_id in ($search_id_list) and m.ipd_id=0 and m.case_id=0";
+ $query = $this->db->query($sql);
+ $data['med_inv_item_list'] = $query->result();
+ }
+
+ if ($search_type == 3) {
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where m.inv_date >=date_add(curdate(),interval -12 month) and m.inv_med_code like '%" . $search_text . "' and m.ipd_id=0 and m.case_id=0";
+ $query = $this->db->query($sql);
+ $data['med_inv_item_list'] = $query->result();
+ }
+
+ if ($search_type == 4) {
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where m.inv_date >=date_add(curdate(),interval -5 month) and i.item_Name like '" . $search_text . "%' ";
+ $query = $this->db->query($sql);
+ $data['med_inv_item_list'] = $query->result();
+ }
+
+ $this->load->view('Medical/Med_Item_old_list', $data);
+ }
+
+ public function Invoice_old($inv_id)
+ {
+ $sql = "Select * from invoice_med_master where id=$inv_id ";
+ $query = $this->db->query($sql);
+ $invoice_med_master = $query->result();
+
+ $phone_no = '';
+ $p_id = 0;
+ $ipd_id = 0;
+
+ if (count($invoice_med_master) > 0) {
+ $phone_no = $invoice_med_master[0]->inv_phone_number;
+ $p_id = $invoice_med_master[0]->patient_id;
+ $ipd_id = $invoice_med_master[0]->ipd_id;
+ }
+
+ if ($ipd_id > 0) {
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount,
+ m.net_amount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where m.id<>$inv_id and m.ipd_id=$ipd_id and m.case_id=0
+ order by m.id desc";
+ } else if ($p_id > 0) {
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount,
+ m.net_amount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where m.patient_id='$p_id' and m.id<>$inv_id and m.ipd_id=0 and m.case_id=0
+ and m.inv_date>date_add(sysdate(),interval -6 month)
+ order by m.id desc";
+ } else if ($phone_no != '') {
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount,
+ m.net_amount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where m.inv_phone_number='$phone_no' and m.id<>$inv_id and m.ipd_id=0 and m.case_id=0
+ and m.inv_date>date_add(sysdate(),interval -6 month)
+ order by m.id desc";
+ } else {
+ $sql = "SELECT m.id AS inv_id,m.inv_med_code,m.inv_date,m.inv_name,m.inv_phone_number,
+ i.*,date_format(i.expiry,'%m-%Y') as exp_date,(i.disc_amount+disc_whole) as t_discount,
+ m.net_amount
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.sale_return=0)
+ Where 1<>1 and m.inv_date>date_add(sysdate(),interval -6 month)";
+ }
+
+ $query = $this->db->query($sql);
+ $data['med_inv_item_list'] = $query->result();
+
+ $this->load->view('Medical/Med_old_invoice_list', $data);
+ }
+
+ public function add_remove_item()
+ {
+ $this->load->model('Medical_M');
+
+ $inv_id = $this->input->post('inv_id');
+ $item_id = $this->input->post('itemid');
+ $rqty = $this->input->post('rqty');
+
+ $this->Medical_M->opd_reset($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+
+ $user = $this->ion_auth->user()->row();
+ $user_update_info = $user->first_name . '' . $user->last_name . '[' . $user->id . ']' . date('d-m-Y H:i:s');
+
+ $sql = "select * from inv_med_item where id='" . $item_id . "' ";
+ $query = $this->db->query($sql);
+ $inv_med_item_result = $query->result_array();
+
+ $update = 0;
+ $msg_box = "";
+
+ if (count($inv_med_item_result) > 0) {
+ $inv_med_item = $inv_med_item_result[0];
+
+ $CGST = $inv_med_item['CGST_per'];
+ $SGST = $inv_med_item['SGST_per'];
+
+ $item_rate = $inv_med_item['price2'];
+ $amount_value = $rqty * $item_rate * -1;
+
+ $disc_total = $inv_med_item['disc_amount'] + $inv_med_item['disc_whole'];
+ $amount = $inv_med_item['amount'];
+ $twdisc_amount = $inv_med_item['twdisc_amount'];
+
+ $margin = $amount - $twdisc_amount;
+ $desc_per = $margin * 100 / $amount;
+
+ $disc_amount = $amount_value * $desc_per / 100;
+ $Tamount_value = $amount_value - $disc_amount;
+
+ unset($inv_med_item['id']);
+
+ $inv_med_item['inv_med_id'] = $inv_id;
+
+ //Old Qty Sale
+ $old_qty = $inv_med_item['qty'];
+ $inv_med_item['qty'] = $rqty;
+
+ $inv_med_item['return_item_id'] = $item_id;
+ $inv_med_item['sale_return'] = 1;
+
+ $inv_med_item['amount'] = $amount_value;
+ $inv_med_item['tamount'] = $Tamount_value;
+
+ $inv_med_item['disc_amount'] = $disc_amount;
+ $inv_med_item['disc_per'] = $desc_per;
+
+ $inv_med_item['disc_whole'] = '0';
+ $inv_med_item['twdisc_amount'] = $Tamount_value;
+
+ $inv_med_item['update_by_remark'] = $user_update_info;
+ $inv_med_item['update_by_id'] = $user->id;
+
+ $sql = "select * from inv_med_item
+ where sale_return=1 and inv_med_id='$inv_id' and return_item_id='$item_id' ";
+ $query = $this->db->query($sql);
+ $inv_med_item_return = $query->result();
+
+ $sql = "select sum(qty) as t_r_qty from inv_med_item
+ where sale_return=1 and return_item_id='$item_id' ";
+ $query = $this->db->query($sql);
+ $med_item_return_total = $query->result();
+
+ $tot_qty = 0;
+
+ if (count($med_item_return_total) > 0) {
+ $tot_return = $med_item_return_total[0]->t_r_qty;
+ $tot_qty = $old_qty - $tot_return;
+ }
+
+ if ($tot_qty >= $rqty) {
+ if (count($inv_med_item_return) == 0) {
+ $update = $this->Medical_M->add_invoiceitem($inv_med_item);
+ $msg_box = "Added Return list";
+ } else {
+ $update = $inv_med_item_return[0]->id;
+
+ $this->Medical_M->update_invoiceitem($inv_med_item, $update);
+ $msg_box = "Update Return ";
+ }
+ } else {
+ $update = 0;
+ $msg_box = "Item Already Returned";
+ }
+ } else {
+ $update = 0;
+ $msg_box = "No item found";
+ }
+
+ $this->Medical_M->update_invoice_final($inv_id);
+
+ $sql = "SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_med_item i JOIN purchase_invoice_item p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where inv_med_id=" . $inv_id . " GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select item_code
+ from inv_med_item where inv_med_id=" . $inv_id . " Group by item_code Having count(id)>1";
+ $query = $this->db->query($sql);
+ $data['inv_items_multiple'] = $query->result();
+
+ $sql = "Select sum(amount) as Gtotal,sum(tamount) as tamt,
+ sum(CGST) as TCGST,sum(SGST) as TSGST,sum(disc_amount) as t_dis_amt
+ from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal'] = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $sql = "select * from invoice_med_master where id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $data['sale_return'] = $data['invoiceMaster'][0]->sale_return;
+
+ $content = $this->load->view('Medical/Med_Item_List', $data, true);
+
+ $rvar = array(
+ 'update' => $update,
+ 'msg_text' => $msg_box,
+ 'content' => $content
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function Update_Return()
+ {
+ $this->load->model('Medical_M');
+
+ $r_qty = $this->input->post('u_qty');
+ $item_id = $this->input->post('itemid');
+
+ $sql = "select * from inv_med_item where id='" . $item_id . "' ";
+ $query = $this->db->query($sql);
+ $inv_med_item_result = $query->result_array();
+
+ $user = $this->ion_auth->user()->row();
+ $user_update_info = $user->first_name . '' . $user->last_name . '[' . $user->id . ']' . date('d-m-Y H:i:s');
+
+ $update = 0;
+ $msg_box = "";
+
+ if (count($inv_med_item_result) > 0) {
+ $inv_med_item = $inv_med_item_result[0];
+
+ $CGST = $inv_med_item['CGST_per'];
+ $SGST = $inv_med_item['SGST_per'];
+
+ $item_rate = $inv_med_item['price'];
+ $amount_value = $r_qty * $item_rate;
+
+ $disc = $inv_med_item['disc_per'];
+ $disc_amount = $amount_value * $disc / 100;
+
+ $Tamount_value = $amount_value - $disc_amount;
+
+ $inv_med_item['inv_item_id'] = $inv_med_item['id'];
+ unset($inv_med_item['id']);
+ $inv_med_item['r_qty'] = $r_qty;
+
+ $inv_med_item['amount'] = $amount_value;
+ $inv_med_item['tamount'] = $Tamount_value;
+
+ $inv_med_item['update_remark'] = $user_update_info;
+
+ $sql = "select * from inv_med_item_return where return_status=0 and inv_item_id='" . $item_id . "' ";
+ $query = $this->db->query($sql);
+ $inv_med_item_return = $query->result_array();
+
+ if (count($inv_med_item_return) == 0) {
+ $update = $this->Medical_M->insert_inv_med_item_return_add($inv_med_item);
+ $msg_box = "Added in Pending Return list";
+ } else {
+ $update = 1;
+ $this->Medical_M->delete_return_item($item_id);
+ $update = $this->Medical_M->insert_inv_med_item_return_add($inv_med_item);
+ $msg_box = "Alerady in Pending Return list, Now Update Again ";
+ }
+ } else {
+ $update = 0;
+ $msg_box = "No item found";
+ }
+
+ $rvar = array(
+ 'update' => $update,
+ 'msg_text' => $msg_box
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ public function undo_Return()
+ {
+ $this->load->model('Medical_M');
+
+ $item_id = $this->input->post('itemid');
+
+ $update = 1;
+ $msg_box = "";
+
+ $this->Medical_M->delete_return_item($item_id);
+
+ $rvar = array(
+ 'update' => $update,
+ 'msg_text' => $msg_box
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ public function pre_reurn_item_list($inv_type_id, $inv_type = 0)
+ {
+ $data['inv_type_id'] = $inv_type_id;
+ $data['inv_type'] = $inv_type;
+
+ $p_id = 0;
+
+ if ($inv_type == 0) {
+ $sql = "select * from ipd_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=0)
+ where m.ipd_id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['ipd_master'][0]->p_id;
+ } elseif ($inv_type == 1) {
+ $sql = "select * from organization_case_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['org_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=0)
+ where m.case_id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['org_master'][0]->p_id;
+ } else {
+ $sql = "select * from invoice_med_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['invoice_med_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=0)
+ where m.id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['invoice_med_master'][0]->patient_id;
+ }
+
+ $sql = "select * from patient_master_exten
+ where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $query = $this->db->query($sql_items);
+ $data['inv_items'] = $query->result();
+
+ $this->load->view('Medical/Medical_Invoice_Return_pre', $data);
+ }
+
+
+ public function Med_Return_final($inv_type_id, $inv_type = 0)
+ {
+ $this->load->model('Medical_M');
+
+ $data['inv_type_id'] = $inv_type_id;
+ $data['inv_type'] = $inv_type;
+
+ $p_id = 0;
+
+ if ($inv_type == 0) {
+ $sql = "select * from ipd_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as ritem_id,t.inv_item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_per,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=0)
+ where m.ipd_id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['ipd_master'][0]->p_id;
+ } elseif ($inv_type == 1) {
+ $sql = "select * from organization_case_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['org_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as ritem_id,t.inv_item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_per,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=0)
+ where m.case_id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['org_master'][0]->p_id;
+ } else {
+ $sql = "select * from invoice_med_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['invoice_med_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as ritem_id,t.inv_item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.amount,t.disc_per,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=0)
+ where m.id=" . $inv_type_id . " order by t.item_Name,t.batch_no";
+
+ $p_id = $data['invoice_med_master'][0]->patient_id;
+ }
+
+ $sql = "select * from patient_master_exten
+ where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $query = $this->db->query($sql_items);
+ $data['inv_items'] = $query->result();
+
+ foreach ($data['inv_items'] as $row) {
+ $store_stock_id = $row->ss_no;
+
+ $ritem_id = $row->ritem_id;
+
+ $itemid = $row->inv_item_id;
+
+ $item_rate = $row->price;
+
+ $current_qty = $row->qty - $row->r_qty;
+
+ $inv_id = $row->inv_id;
+
+ $amount_value = $current_qty * $item_rate;
+
+ $disc_per = $row->disc_per;
+
+ $disc_amount = $amount_value * $disc_per / 100;
+
+ $Tamount_value = $amount_value - $disc_amount;
+
+ $data['update_inv_med_item'] = array(
+ 'qty' => $current_qty,
+ 'disc_amount' => $disc_amount,
+ 'amount' => $amount_value,
+ 'tamount' => $Tamount_value,
+ 'store_stock_id' => $store_stock_id,
+ 'inv_med_id' => $inv_id,
+ );
+
+ $update_return_item = array(
+ 'return_status' => '1',
+ );
+
+ $this->Medical_M->update_return_item($update_return_item, $ritem_id);
+
+ $this->Medical_M->update_invoiceitem($data['update_inv_med_item'], $itemid);
+
+ $this->Medical_M->update_invoice_final($inv_id);
+ }
+
+ redirect('/Medical/pre_reurn_item_list/' . $inv_type_id . '/' . $inv_type = 0);
+ }
+
+
+ public function Med_Return_print($inv_type_id, $inv_type = 0)
+ {
+ $this->load->model('Medical_M');
+
+ $data['inv_type_id'] = $inv_type_id;
+ $data['inv_type'] = $inv_type;
+
+ $p_id = 0;
+
+ if ($inv_type == 0) {
+ $sql = "select * from v_ipd_list where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,
+ date_format(return_date_time,'%d-%m-%Y') as str_ret_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as ritem_id,t.inv_item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,
+ t.update_remark,t.return_date_time,
+ t.amount,t.disc_per,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=1)
+ where m.ipd_id=" . $inv_type_id . " order by t.return_date_time,t.item_Name,t.batch_no";
+
+ $p_id = $data['ipd_master'][0]->p_id;
+ } elseif ($inv_type == 1) {
+ $sql = "select * from organization_case_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['org_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,
+ date_format(return_date_time,'%d-%m-%Y') as str_ret_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as ritem_id,t.inv_item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,t.update_remark,t.return_date_time,
+ t.amount,t.disc_per,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=1)
+ where m.case_id=" . $inv_type_id . " order by t.return_date_time,t.item_Name,t.batch_no";
+
+ $p_id = $data['org_master'][0]->p_id;
+ } else {
+ $sql = "select * from invoice_med_master where id='" . $inv_type_id . "' ";
+ $query = $this->db->query($sql);
+ $data['invoice_med_master'] = $query->result();
+
+ $sql_items = "select m.id as inv_id,m.inv_med_code,date_format(inv_date,'%d-%m-%Y') as str_inv_date,
+ date_format(return_date_time,'%d-%m-%Y') as str_ret_date,m.ipd_id,m.patient_id,m.group_invoice_id,m.case_id,
+ t.id as ritem_id,t.inv_item_id,t.item_Name,t.qty,t.batch_no,t.expiry,t.store_stock_id as ss_no,t.item_code,t.mrp,t.price,t.update_remark,t.return_date_time,
+ t.amount,t.disc_per,t.disc_amount,t.tamount,t.r_qty,t.id as return_id
+ from (invoice_med_master m join inv_med_item_return t on m.id=t.inv_med_id and t.return_status=1)
+ where m.id=" . $inv_type_id . " order by t.return_date_time,t.item_Name,t.batch_no";
+
+ $p_id = $data['invoice_med_master'][0]->patient_id;
+ }
+
+ $sql = "select * from patient_master_exten
+ where id='" . $p_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $query = $this->db->query($sql_items);
+ $data['inv_items'] = $query->result();
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name = 'Medical_Return_' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ $content = $this->load->view('Medical/Print/Medical_return_medicine', $data, TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+
+ //$this->load->view('Medical/Medical_Invoice_Return_print',$data);
+ }
+
+
+ //Medical Notification
+ public function get_medical_bill_pending_higher()
+ {
+ $sql = "SELECT COUNT(i.id) AS No_IPD
+ FROM inv_med_group m JOIN ipd_master i ON m.ipd_id=i.id
+ WHERE i.ipd_status=0 AND m.med_type=1 AND m.net_amount>0
+ AND payment_balance>=50000";
+ $query = $this->db->query($sql);
+ $ipd_pending_balance = $query->result();
+
+ $No_IPD = $ipd_pending_balance[0]->No_IPD;
+ if ($No_IPD > 0) {
+ echo 'High Bal. :' . $No_IPD;
+ } else {
+ echo '';
+ }
+ }
+}
diff --git a/old_code_ci3/controllers/Medical_Invoice_PDF.php b/old_code_ci3/controllers/Medical_Invoice_PDF.php
new file mode 100644
index 0000000..57d0b4e
--- /dev/null
+++ b/old_code_ci3/controllers/Medical_Invoice_PDF.php
@@ -0,0 +1,104 @@
+load->library("Pdf");
+
+ }
+
+ //Sale Report
+
+ public function Report_1()
+ {
+ $this->load->view('Medical/Report/Med_Report_1');
+ }
+
+ public function Invoice_PDF($sale_date_range,$output=0)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_invoice_group_gst($ipd_id);
+
+ $cash_where=" ";
+
+ if($cash==0)
+ {
+ $cash_where.=" and ipd_credit=0 ";
+ $med_type=1;
+ }elseif($cash==1)
+ {
+ $cash_where.=" and ipd_credit=1 and ipd_credit_type=1 ";
+ $med_type=2;
+ }elseif($cash==2)
+ {
+ $cash_where.=" and ipd_credit=1 and ipd_credit_type=0 ";
+ $med_type=3;
+ }
+
+ $sql="select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%Y')as expiry,
+ i.price,i.qty,sum(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ sum(twdisc_amount) as twdisc_amount,
+ sum(i.disc_amount+i.disc_whole) as d_amt,
+ sum(i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per
+ from inv_med_item i join invoice_med_master m
+ on i.inv_med_id=m.id
+ where m.group_invoice_id>0 and m.ipd_id=".$ipd_id.$cash_where." group by i.inv_med_id,i.id WITH ROLLUP";
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select sum(CGST_Tamount) as CGST_Tamount,
+ sum(SGST_Tamount) as SGST_Tamount,
+ sum(TaxableAmount) as TaxableAmount,
+ sum(net_amount) as net_amount,
+ sum(payment_received) as payment_received,
+ sum(payment_balance) as payment_balance,
+ sum(discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master
+ where group_invoice_id>0 and ipd_id=".$ipd_id.$cash_where." group by ipd_id";
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where id='".$data['ipd_master'][0]->org_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $sql="select sum(if(p.credit_debit>0,p.amount*-1,p.amount)) as paid_amount
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_Total']= $query->result();
+
+ $sql="select p.*,if(p.credit_debit>0,p.amount*-1,p.amount) as paid_amount,
+ (case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' when 3 then 'Return Cash ' when 4 then 'Bank Return' when 5 then 'Cash Return' else 'Other' end) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select * from inv_med_group
+ where ipd_id='".$ipd_id."' and med_type=1";
+ $query = $this->db->query($sql);
+ $data['inv_med_group']= $query->result();
+
+
+
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Medical_Print.php b/old_code_ci3/controllers/Medical_Print.php
new file mode 100644
index 0000000..67e3915
--- /dev/null
+++ b/old_code_ci3/controllers/Medical_Print.php
@@ -0,0 +1,1150 @@
+load->model('Medical_M');
+
+ $this->Medical_M->update_invoice_group($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+
+ $sql="select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%y')as expiry,
+ i.price,i.qty,(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ (twdisc_amount) as twdisc_amount,
+ (i.disc_amount+i.disc_whole) as d_amt,
+ (i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per ,i.sale_return,
+ i.TaxableAmount
+ from inv_med_item i join invoice_med_master m
+ on i.inv_med_id=m.id
+ where m.id=$inv_id order by i.sale_return,id";
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select *,
+ date_format(inv_date,'%d-%m-%Y') as str_inv_date,
+ (discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST
+ from invoice_med_master
+ where id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['invoice_med_master']= $query->result();
+
+ $data['Doc_name']="";
+
+ if($data['invoice_med_master'][0]->doc_id>0)
+ {
+ $doc_id=$data['invoice_med_master'][0]->doc_id;
+
+ $sql="select * from doctor_master
+ where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ $data['Doc_name']=$doctor_master[0]->p_title.' '.$doctor_master[0]->p_fname;
+ }else{
+ $data['Doc_name']=$data['invoice_med_master'][0]->doc_name;
+ }
+
+ if($data['invoice_med_master'][0]->patient_id>0)
+ {
+ $p_id=$data['invoice_med_master'][0]->patient_id;
+
+ $sql="select * from patient_master_exten
+ where id=$p_id";
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+
+
+
+ if($data['invoice_med_master'][0]->ipd_id>0)
+ {
+ $ipd_id=$data['invoice_med_master'][0]->ipd_id;
+
+ $sql="select * from v_ipd_list
+ where id=$ipd_id";
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $org_id=$data['ipd_master'][0]->case_id;
+
+ $sql="select * from organization_case_master
+ where id=$org_id";
+ $query = $this->db->query($sql);
+ $data['org_master']= $query->result();
+
+
+ }else if( $data['invoice_med_master'][0]->case_id>0)
+ {
+
+ $org_id=$data['invoice_med_master'][0]->case_id;
+
+ $sql="select * from organization_case_master
+ where id=$org_id";
+ $query = $this->db->query($sql);
+ $data['org_master']= $query->result();
+ }
+
+ }
+
+ $sql="select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p
+ where p.Customerof_type in (1,3) and Medical_invoice_id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name='Report-MedicalBill_'.$inv_id.'_'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+
+ if($print_format==0)
+ {
+ $content=$this->load->view('Medical/Print/medical_bill_print_format_single',$data,TRUE);
+ }elseif($print_format==1){
+
+ $content=$this->load->view('Medical/Print/medical_bill_print_a6',$data,TRUE);
+ $this->m_pdf->pdf->SetJS('this.print();');
+ }elseif($print_format==2){
+
+ $content=$this->load->view('Medical/Print/medical_bill_print_a5',$data,TRUE);
+ $this->m_pdf->pdf->SetJS('this.print();');
+ }elseif($print_format==3){
+
+ $content=$this->load->view('Medical/Print/medical_bill_print_a5_discount',$data,TRUE);
+ $this->m_pdf->pdf->SetJS('this.print();');
+ }
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+
+
+ }
+
+
+ public function invoice_print_all($ipd_id,$cash=0,$salt_name=0)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+
+ $cash_where=" ";
+
+ if($cash==0)
+ {
+ $cash_where.=" and ipd_credit=0 ";
+ $med_type=1;
+ }elseif($cash==1)
+ {
+ $cash_where.=" and ipd_credit=1 and ipd_credit_type=1 ";
+ $med_type=2;
+ }elseif($cash==2)
+ {
+ $cash_where.=" and ipd_credit=1 and ipd_credit_type=0 ";
+ $med_type=3;
+ }
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id,$med_type);
+
+
+ $sql="select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%Y')as expiry,
+ i.price,i.qty,sum(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ sum(twdisc_amount) as twdisc_amount,
+ sum(i.disc_amount+i.disc_whole) as d_amt,
+ sum(i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per ,
+ p.genericname
+ from (inv_med_item i join invoice_med_master m on i.inv_med_id=m.id)
+ Left join med_product_master p on i.item_code=p.id
+ where m.group_invoice_id>0 and i.qty>0 and m.ipd_id=".$ipd_id.$cash_where."
+ group by i.inv_med_id,i.id WITH ROLLUP";
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select sum(CGST_Tamount) as CGST_Tamount,
+ sum(SGST_Tamount) as SGST_Tamount,
+ sum(TaxableAmount) as TaxableAmount,
+ sum(net_amount) as net_amount,
+ sum(payment_received) as payment_received,
+ sum(payment_balance) as payment_balance,
+ sum(discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master
+ where ipd_id=".$ipd_id.$cash_where." group by ipd_id";
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,m.p_relative,m.p_rname,
+ m.org_id from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where id='".$data['ipd_master'][0]->org_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $sql="select sum(if(p.credit_debit>0,p.amount*-1,p.amount)) as paid_amount
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_Total']= $query->result();
+
+ $sql="select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select * from inv_med_group
+ where ipd_id='".$ipd_id."' and med_type='".$med_type."'";
+ $query = $this->db->query($sql);
+ $data['inv_med_group']= $query->result();
+
+
+ $data['salt_name']=$salt_name;
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name='Report-MedicalBill-'.$ipd_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Medical/Print/medical_bill_print_format',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+ //$this->m_pdf->pdf->Output('uploads/'.$filepath,"F");
+
+ }
+
+ public function invoice_print_salt_all($ipd_id,$cash=0,$print_size=0)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+
+ $cash_where=" ";
+
+ if($cash==0)
+ {
+ $cash_where.=" and ipd_credit=0 ";
+ $med_type=1;
+ }elseif($cash==1)
+ {
+ $cash_where.=" and ipd_credit=1 and ipd_credit_type=1 ";
+ $med_type=2;
+ }elseif($cash==2)
+ {
+ $cash_where.=" and ipd_credit=1 and ipd_credit_type=0 ";
+ $med_type=3;
+ }
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id,$med_type);
+
+
+ $sql="select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%Y')as expiry,
+ i.price,i.qty,sum(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ sum(twdisc_amount) as twdisc_amount,
+ sum(i.disc_amount+i.disc_whole) as d_amt,
+ sum(i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per,
+ p.genericname
+ from (inv_med_item i join invoice_med_master m
+ on i.inv_med_id=m.id)
+ join med_product_master p on i.item_code=p.id
+ where m.group_invoice_id>0 and i.qty>0 and m.ipd_id=".$ipd_id.$cash_where."
+ group by i.inv_med_id,i.id WITH ROLLUP";
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select sum(CGST_Tamount) as CGST_Tamount,
+ sum(SGST_Tamount) as SGST_Tamount,
+ sum(TaxableAmount) as TaxableAmount,
+ sum(net_amount) as net_amount,
+ sum(payment_received) as payment_received,
+ sum(payment_balance) as payment_balance,
+ sum(discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master
+ where ipd_id=".$ipd_id.$cash_where." group by ipd_id";
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where id='".$data['ipd_master'][0]->org_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $sql="select sum(if(p.credit_debit>0,p.amount*-1,p.amount)) as paid_amount
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_Total']= $query->result();
+
+ $sql="select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select * from inv_med_group
+ where ipd_id='".$ipd_id."' and med_type='".$med_type."'";
+ $query = $this->db->query($sql);
+ $data['inv_med_group']= $query->result();
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name='Report-MedicalBill-'.$ipd_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Medical/Print/medical_bill_print_format',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+ //$this->m_pdf->pdf->Output('uploads/'.$filepath,"F");
+
+ }
+
+ public function invoice_print_with_return_all($ipd_id,$cash=0,$print_size=0)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+
+ $cash_where=" ";
+
+ if($cash==0)
+ {
+ $med_type=1;
+ }elseif($cash==1)
+ {
+ $med_type=2;
+ }elseif($cash==2)
+ {
+ $med_type=3;
+ }
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id,$med_type);
+
+ /* $sql="SELECT *,SUM(i.amount) AS t_amount
+ FROM v_med_item_with_return i
+ where i.ipd_id=".$ipd_id.$cash_where."
+ group by i.inv_med_id,i.id WITH ROLLUP";
+ $query = $this->db->query($sql); */
+
+ //$query = $this->db->query('call p_get_list_ipd_med_item('.$ipd_id.')');
+ //$query->next_result();
+ $sql="Select i.inv_med_id AS inv_med_id,i.id AS id,m.ipd_id AS ipd_id,i.item_Name AS item_Name,
+ i.formulation AS formulation,i.batch_no AS batch_no,date_format(i.expiry,'%m-%Y') AS expiry,
+ i.price AS price,i.qty AS Cur_qty,if(isnull(r.r_qty),i.qty,(i.qty + sum(r.r_qty))) AS qty,
+ (if(isnull(r.r_qty),i.qty,(i.qty + sum(r.r_qty)))*i.price) AS amount,i.HSNCODE AS HSNCODE,
+ m.inv_med_code AS inv_med_code,m.id AS m_id,date_format(m.inv_date,'%d-%m-%Y') AS str_inv_date,
+ r.id AS r_id,sum(r.r_qty) AS tot_return
+ from ((inv_med_item i join invoice_med_master m on((m.id = i.inv_med_id)))
+ left join inv_med_item_return r on((i.id = r.inv_item_id)))
+ WHERE m.ipd_credit=0 AND m.ipd_id=$ipd_id
+ group by i.inv_med_id,i.id WITH ROLLUP ";
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="SELECT *,SUM(i.amount) AS t_amount
+ FROM v_med_item_return i
+ where i.ipd_id=".$ipd_id.$cash_where."
+ group by i.inv_med_id,i.id WITH ROLLUP";
+ $query = $this->db->query($sql);
+ $data['inv_items_return']= $query->result();
+
+ $sql="select sum(CGST_Tamount) as CGST_Tamount,
+ sum(SGST_Tamount) as SGST_Tamount,
+ sum(TaxableAmount) as TaxableAmount,
+ sum(net_amount) as net_amount,
+ sum(payment_received) as payment_received,
+ sum(payment_balance) as payment_balance,
+ sum(discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master
+ where ipd_id=".$ipd_id.$cash_where." group by ipd_id";
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where id='".$data['ipd_master'][0]->org_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $sql="select sum(if(p.credit_debit>0,p.amount*-1,p.amount)) as paid_amount
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_Total']= $query->result();
+
+ $sql="select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select * from inv_med_group
+ where ipd_id='".$ipd_id."' and med_type='".$med_type."'";
+ $query = $this->db->query($sql);
+ $data['inv_med_group']= $query->result();
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name='Report-MedicalBill-'.$ipd_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Medical/Print/medical_bill_print_format_with_return',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+ //$this->m_pdf->pdf->Output('uploads/'.$filepath,"F");
+
+ }
+
+
+ public function invoice_print_all_bill($ipd_id)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+
+ $cash_where=" ";
+
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id,'1');
+ $this->Medical_M->update_invoice_group_gst($ipd_id,'2');
+ $this->Medical_M->update_invoice_group_gst($ipd_id,'3');
+
+ $sql="select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%Y')as expiry,
+ i.price,i.qty,sum(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ sum(twdisc_amount) as twdisc_amount,
+ sum(i.disc_amount+i.disc_whole) as d_amt,
+ sum(i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per
+ from inv_med_item i join invoice_med_master m
+ on i.inv_med_id=m.id
+ where m.group_invoice_id>0 and i.qty>0 and m.ipd_id=".$ipd_id.$cash_where." group by i.inv_med_id,i.id WITH ROLLUP";
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select sum(CGST_Tamount) as CGST_Tamount,
+ sum(SGST_Tamount) as SGST_Tamount,
+ sum(TaxableAmount) as TaxableAmount,
+ sum(net_amount) as net_amount,
+ sum(payment_received) as payment_received,
+ sum(payment_balance) as payment_balance,
+ sum(discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master
+ where group_invoice_id>0 and ipd_id=".$ipd_id.$cash_where." group by ipd_id";
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where id='".$data['ipd_master'][0]->org_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+ $file_name='Report-MedicalBill-'.$ipd_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Medical/Print/medical_bill_print_format_newpage',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+
+ public function medicine_list_print_all($ipd_id,$cash=-1)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+
+ $sql="select i.item_Name,i.formulation,p.genericname, SUM(i.qty) AS i_qty_total
+ FROM (inv_med_item i join invoice_med_master m on i.inv_med_id=m.id)
+ JOIN med_product_master p ON i.item_code=p.id
+ where m.group_invoice_id>0 and i.qty>0
+ and m.ipd_id=$ipd_id AND i.formulation <>'SUR'
+ group BY i.item_code order BY i.item_Name";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select i.item_Name,i.formulation,p.genericname, SUM(i.qty) AS i_qty_total
+ FROM (inv_med_item i join invoice_med_master m on i.inv_med_id=m.id)
+ JOIN med_product_master p ON i.item_code=p.id
+ where m.group_invoice_id>0 and i.qty>0
+ and m.ipd_id=$ipd_id AND i.formulation ='SUR'
+ group BY i.item_code order BY i.item_Name";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $data['inv_items_sur']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id,m.doc_list from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $data['doc_list_sign']="";
+ $data['doc_list_main_sign']="";
+
+ if(count($data['ipd_master'])>0)
+ {
+ $doc_list=$data['ipd_master'][0]->doc_list;
+
+ $sql="select d.id,d.p_fname,d.p_title,d.mphone1,d.mphone2,
+ if(d.gender=1,'Male','Female') as xgender,Get_Age(d.dob) as age,
+ d.dob,d.zip,d.email1,d.email2,
+ group_concat(distinct m.SpecName) as SpecName,d.doc_sign
+ from (doctor_master d left join (doc_spec s join med_spec m on s.med_spec_id=m.id) on d.id=s.doc_id)
+ where d.id in (".$doc_list.") group by d.id";
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+
+ $doc_list="";
+
+ foreach($doc_master as $row)
+ {
+ $doc_list.="Dr. ".$row->p_fname." [".$row->SpecName."] ";
+ }
+
+ $data['doc_list']=$doc_list;
+
+ }
+
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $file_name='MedicineList-MedicalBill-'.$ipd_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Medical/Print/Medicine_consolidated_List',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function medicine_list_print($ipd_id,$cash=-1)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+
+ $sql="SELECT i.inv_med_id,i.id,i.item_Name,i.formulation,p.genericname,
+ sum(i.qty) as tot_qty, m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date
+ FROM (inv_med_item i join invoice_med_master m on i.inv_med_id=m.id)
+ JOIN med_product_master p ON i.item_code=p.id
+ where m.group_invoice_id>0 and i.qty>0
+ and m.ipd_id=$ipd_id AND i.formulation <>'SUR'
+ GROUP BY i.item_code
+ order by m.inv_date,i.id";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id,m.doc_list from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $data['doc_list_sign']="";
+ $data['doc_list_main_sign']="";
+
+ if(count($data['ipd_master'])>0)
+ {
+ $doc_list=$data['ipd_master'][0]->doc_list;
+
+ $sql="select d.id,d.p_fname,d.p_title,d.mphone1,d.mphone2,
+ if(d.gender=1,'Male','Female') as xgender,Get_Age(d.dob) as age,
+ d.dob,d.zip,d.email1,d.email2,
+ group_concat(distinct m.SpecName) as SpecName,d.doc_sign
+ from (doctor_master d left join (doc_spec s join med_spec m on s.med_spec_id=m.id) on d.id=s.doc_id)
+ where d.id in (".$doc_list.") group by d.id";
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+
+ $doc_list="";
+ $doc_list_sign='Treating Consultant / Authorized Team Doctor ';
+
+ $doc_list_main_sign='Treating Consultant/Department/Specialty ';
+
+ $row_num=0;
+ foreach($doc_master as $row)
+ {
+ $row_num=$row_num+1;
+
+ $doc_list.="Dr. ".$row->p_fname." [".$row->SpecName."] ";
+
+ $doc_list_sign.='
+
+ Dr. '.$row->p_fname.'
+ '.$row->SpecName.'
+ '.nl2br($row->doc_sign).'
+
+
+
+ Signature of Consultant
+
+
+ ';
+
+ $mod_r=$row_num % 2;
+ if($mod_r>0)
+ {
+ $doc_list_main_sign.='';
+ }
+
+ $doc_list_main_sign.='
+ Dr. '.$row->p_fname.' ['.$row->SpecName.']
+ '.nl2br($row->doc_sign).'
+ ';
+
+ if($mod_r==0)
+ {
+ $doc_list_main_sign.=' ';
+ }
+ }
+
+ $row_num=$row_num+1;
+ $mod_r=$row_num % 2;
+
+ if($mod_r==0)
+ {
+
+ $doc_list_main_sign.='
+ ';
+ }
+
+ $doc_list_sign.="
";
+ $doc_list_main_sign.="
";
+
+ $data['doc_list_sign']=$doc_list_sign;
+ $data['doc_list_main_sign']=$doc_list_main_sign;
+ }
+
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $file_name='MedicineList-MedicalBill-'.$ipd_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Medical/Print/Medicine_List',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function medicine_list_surgical_print($ipd_id,$cash=-1)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+ $this->load->model('Medical_M');
+
+ $cash_where=" ";
+
+ $sql="select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%Y')as expiry,
+ i.price,i.qty,(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ (twdisc_amount) as twdisc_amount,
+ (i.disc_amount+i.disc_whole) as d_amt,
+ (i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per
+ from inv_med_item i join invoice_med_master m
+ on i.inv_med_id=m.id
+ where m.group_invoice_id>0 and i.qty>0
+ and m.ipd_id=$ipd_id and formulation ='SUR' order by m.inv_date,i.id";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id,m.doc_list from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $data['doc_list_sign']="";
+ $data['doc_list_main_sign']="";
+
+ if(count($data['ipd_master'])>0)
+ {
+ $doc_list=$data['ipd_master'][0]->doc_list;
+
+ $sql="select d.id,d.p_fname,d.p_title,d.mphone1,d.mphone2,
+ if(d.gender=1,'Male','Female') as xgender,Get_Age(d.dob) as age,
+ d.dob,d.zip,d.email1,d.email2,
+ group_concat(distinct m.SpecName) as SpecName,d.doc_sign
+ from (doctor_master d left join (doc_spec s join med_spec m on s.med_spec_id=m.id) on d.id=s.doc_id)
+ where d.id in (".$doc_list.") group by d.id";
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+
+ $doc_list="";
+ $doc_list_sign='Treating Consultant / Authorized Team Doctor ';
+
+ $doc_list_main_sign='Treating Consultant/Department/Specialty ';
+
+ $row_num=0;
+ foreach($doc_master as $row)
+ {
+ $row_num=$row_num+1;
+
+ $doc_list.="Dr. ".$row->p_fname." [".$row->SpecName."] ";
+
+ $doc_list_sign.='
+
+ Dr. '.$row->p_fname.'
+ '.$row->SpecName.'
+ '.nl2br($row->doc_sign).'
+
+
+
+ Signature of Consultant
+
+
+ ';
+
+ $mod_r=$row_num % 2;
+ if($mod_r>0)
+ {
+ $doc_list_main_sign.='';
+ }
+
+ $doc_list_main_sign.='
+ Dr. '.$row->p_fname.' ['.$row->SpecName.']
+ '.nl2br($row->doc_sign).'
+ ';
+
+ if($mod_r==0)
+ {
+ $doc_list_main_sign.=' ';
+ }
+ }
+
+ $row_num=$row_num+1;
+ $mod_r=$row_num % 2;
+
+ if($mod_r==0)
+ {
+
+ $doc_list_main_sign.='
+ ';
+ }
+
+ $doc_list_sign.="
";
+ $doc_list_main_sign.="
";
+
+ $data['doc_list_sign']=$doc_list_sign;
+ $data['doc_list_main_sign']=$doc_list_main_sign;
+ }
+
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $file_name='MedicineList-MedicalBill-'.$ipd_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Medical/Print/Medicine_List',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function ipd_cash_print_pdf($ipd_id,$payid)
+ {
+ $sql="select *,date_format(payment_date,'%d-%m-%Y %h:%i %p') as payment_date_str ,
+ if(credit_debit=0,'','Return') as Amount_str
+ from payment_history_medical where Customerof_type=2 and ipd_id=$ipd_id and id=$payid";
+ $query = $this->db->query($sql);
+ $data['ipd_payment']= $query->result();
+
+ $sql="select * from ipd_master where id =".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $pno=$data['ipd_master'][0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $data['ipd_id']=$ipd_id;
+ $data['payid']=$payid;
+
+ //load mPDF library
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name='Charge_Invoice-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ $content=$this->load->view('Medical/Print//medical_cash_received_bill',$data,TRUE);
+
+ //echo $content;
+
+ //$this->m_pdf->pdf->debug = true;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output("TEST.pdf","I");
+ }
+
+ public function Print_bill_on_uhid()
+ {
+
+ }
+
+ public function Print_bill_on_uhid_print($uhis_id,$cash=0,$print_size=0)
+ {
+ //$cash 0 for Cash Only,1 for OPD Cridit
+ $this->load->model('Medical_M');
+
+ $cash_where=" ";
+
+ if($cash==0)
+ {
+ $cash_where.=" and ipd_credit=0 ";
+ $med_type=1;
+ }elseif($cash==1)
+ {
+ $cash_where.=" and ipd_credit=1 and ipd_credit_type=1 ";
+ $med_type=2;
+ }elseif($cash==2)
+ {
+ $cash_where.=" and ipd_credit=1 and ipd_credit_type=0 ";
+ $med_type=3;
+ }
+
+ $this->Medical_M->update_invoice_group_gst($ipd_id,$med_type);
+
+
+ $sql="select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%Y')as expiry,
+ i.price,i.qty,sum(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ sum(twdisc_amount) as twdisc_amount,
+ sum(i.disc_amount+i.disc_whole) as d_amt,
+ sum(i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per
+ from inv_med_item i join invoice_med_master m
+ on i.inv_med_id=m.id
+ where m.group_invoice_id>0 and i.qty>0 and m.ipd_id=".$ipd_id.$cash_where."
+ group by i.inv_med_id,i.id WITH ROLLUP";
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select sum(CGST_Tamount) as CGST_Tamount,
+ sum(SGST_Tamount) as SGST_Tamount,
+ sum(TaxableAmount) as TaxableAmount,
+ sum(net_amount) as net_amount,
+ sum(payment_received) as payment_received,
+ sum(payment_balance) as payment_balance,
+ sum(discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST from invoice_med_master
+ where ipd_id=".$ipd_id.$cash_where." group by ipd_id";
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select m.p_id,p.p_fname,m.ipd_code,p.p_code, m.doc_name,
+ m.org_id from v_ipd_list m join patient_master p on m.p_id=p.id
+ where m.id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where id='".$data['ipd_master'][0]->org_id."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $sql="select sum(if(p.credit_debit>0,p.amount*-1,p.amount)) as paid_amount
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_Total']= $query->result();
+
+ $sql="select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p join inv_med_group m
+ on p.group_id=m.med_group_id
+ where m.ipd_id=".$ipd_id." and m.med_type=".$med_type;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select * from inv_med_group
+ where ipd_id='".$ipd_id."' and med_type='".$med_type."'";
+ $query = $this->db->query($sql);
+ $data['inv_med_group']= $query->result();
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name='Report-MedicalBill-'.$ipd_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+ $content=$this->load->view('Medical/Print/medical_bill_print_format',$data,TRUE);
+
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+ //$this->m_pdf->pdf->Output('uploads/'.$filepath,"F");
+
+ }
+
+
+ public function print_purchase_return($inv_id)
+ {
+ $sql = "select p.id,p.p_r_invoice_no as Invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d/%m/%Y') as str_date_of_invoice,
+ p.sid,s.name_supplier,s.short_name,s.gst_no,p.status as inv_status
+ from purchase_return_invoice p join med_supplier s on p.sid=s.sid
+ where p.id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice'] = $query->result();
+
+ $sql = "select p.*,r.purchase_inv_id,r.qty as r_qty,Round(r.qty/p.packing,2) AS qty_pak,r.id as r_id,
+ if(r.batch_no_r='',p.batch_no,r.batch_no_r) as batch_no_r_s,
+ date_format(p.expiry_date,'%m/%y') as exp_date_str ,p.purchase_unit_rate*r.qty AS r_amount,p.purchase_unit_rate
+ from purchase_return_invoice_item r join purchase_invoice_item p on r.purchase_item_id=p.id
+ where purchase_inv_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice_item'] = $query->result();
+
+ $content = $this->load->view('Medical/Stock/purchase_return_invoice_item_print', $data, true);
+
+ //load mPDF library
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name='Return_Invoice-'.$inv_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //echo $content;
+
+ $this->m_pdf->pdf->debug = true;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }
+
+ public function print_purchase($inv_id)
+ {
+ $sql="select * from med_supplier order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data']= $query->result();
+
+ $sql="select p.*,s.name_supplier from purchase_invoice p join med_supplier s on p.sid=s.sid where p.id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_data']= $query->result();
+
+ $sql="select * from purchase_invoice_item where purchase_id='".$inv_id."' ";
+ $query = $this->db->query($sql);
+ $data['purchase_item']= $query->result();
+
+ $content = $this->load->view('Medical/Stock/purchase_invoice_item_print', $data, true);
+
+ //load mPDF library
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name='Return_Invoice-'.$inv_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //echo $content;
+
+ $this->m_pdf->pdf->debug = true;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output("TEST.pdf","I");
+ }
+
+}
+
diff --git a/old_code_ci3/controllers/Medical_Report.php b/old_code_ci3/controllers/Medical_Report.php
new file mode 100644
index 0000000..1eb3b52
--- /dev/null
+++ b/old_code_ci3/controllers/Medical_Report.php
@@ -0,0 +1,3012 @@
+load->view('Medical/Report/Med_Report_1');
+ }
+
+ public function Report_1_data($sale_date_range, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and m.inv_date >=date_add(sysdate(),interval -1 day)";
+ }
+
+ $sql = "select count(DISTINCT m.id) as No_invoice,
+ count( DISTINCT m.patient_id) as No_Patients,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,
+ Sum(i.twdisc_amount) as tnet_amount,
+ sum(if(m.ipd_id=0 and m.case_id=0,i.twdisc_amount,0)) as OPD_Cash_Bill_amount,
+ sum(if(m.ipd_id=0 and m.case_id>1,i.twdisc_amount,0)) as OPD_Org_Bill_amount,
+
+ sum(if(m.ipd_id>0 and m.ipd_credit=0,i.twdisc_amount,0)) as IPD_Cash_Bill_amount,
+ sum(if(m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=1,i.twdisc_amount,0)) as IPD_Credit_Bill_amount,
+ sum(if(m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=0,i.twdisc_amount,0)) as IPD_Package_Bill_amount
+
+ from ((invoice_med_master m join inv_med_item i on m.id=i.inv_med_id)
+ left join patient_master p on m.patient_id=p.id)
+ left join organization_case_master o on m.case_id=o.id
+
+ where " . $sql_where . " group by m.inv_date with Rollup";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ $content = '';
+
+ $content .= '
+ #
+ Date
+ No. Patients
+ No. Inv.
+ Net Amt.
+ OPD Cash
+ OPD Org.
+ IPD Cash Amount
+ IPD Cr Hospital
+ IPD Cr Pkg. Hospital
+ Tot. Cr. Amt.
+ ';
+ $sr_no = 0;
+ $cr_Amt_row = 0;
+ $cr_Amt_total = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ $cr_Amt_row = $row->OPD_Org_Bill_amount + $row->IPD_Credit_Bill_amount + $row->IPD_Package_Bill_amount;
+
+ if ($row->inv_date == '') {
+ $content .= '
+ #
+ Total
+ ' . $row->No_Patients . '
+ ' . $row->No_invoice . '
+ ' . $row->tnet_amount . '
+ ' . $row->OPD_Cash_Bill_amount . '
+ ' . $row->OPD_Org_Bill_amount . '
+ ' . $row->IPD_Cash_Bill_amount . '
+ ' . $row->IPD_Credit_Bill_amount . '
+ ' . $row->IPD_Package_Bill_amount . '
+ ' . $cr_Amt_total . '
+ ';
+ } else {
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->inv_date_str . '
+ ' . $row->No_Patients . '
+ ' . $row->No_invoice . '
+ ' . $row->tnet_amount . '
+ ' . $row->OPD_Cash_Bill_amount . '
+ ' . $row->OPD_Org_Bill_amount . '
+ ' . $row->IPD_Cash_Bill_amount . '
+ ' . $row->IPD_Credit_Bill_amount . '
+ ' . $row->IPD_Package_Bill_amount . '
+ ' . $cr_Amt_row . '
+ ';
+ $cr_Amt_total += $cr_Amt_row;
+ }
+ }
+
+ $content .= '
';
+
+
+ $this->load->library('m_pdf');
+
+ $file_name = "Report-MedicalBill-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ $this->m_pdf->pdf->Output($filepath, "I");
+ }
+
+
+ //Daily Medicine Sale Report
+ public function Report_daily_med_sale()
+ {
+
+ $this->load->view('Medical/Report/Med_Report_daily_med_sale');
+ }
+
+ public function Report_daily_med_sale_data($sale_date_range, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and m.inv_date >=date_add(sysdate(),interval -1 day)";
+ }
+
+ $sql = "SELECT i.item_code,i.item_Name,
+ SUM(if(m.sale_return=0,i.qty,0)) AS Sale_Qty,
+ SUM(if(m.sale_return=0,i.twdisc_amount,0)) AS Sale_Amount,
+ SUM(if(m.sale_return=0,i.qty*p.purchase_unit_rate,0)) AS Purchase_Amount,
+ SUM(if(m.sale_return=1,i.qty,0)) AS Return_Qty,
+ SUM(if(m.sale_return=1,i.twdisc_amount,0)) AS Return_Amount,
+ SUM(if(m.sale_return=1,i.qty*p.purchase_unit_rate,0)) AS return_Purchase_Amount,
+ q.cur_qty
+ FROM (invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id)
+ LEFT JOIN purchase_invoice_item p ON i.store_stock_id=p.id
+ JOIN (SELECT t.item_code,SUM(t.total_unit-total_sale_unit-total_return_unit-total_lost_unit) AS cur_qty
+ FROM purchase_invoice_item t
+ GROUP BY t.item_code) AS q ON q.item_code=i.item_code
+ Where " . $sql_where . " GROUP BY i.item_code ORDER BY i.item_Name";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ $content = '';
+
+ $content .= '
+ #
+ Item Code
+ Item Name
+ Sale Qty
+ Sale Amt
+ Pur. Amt
+ Return Qty
+ Return Amt
+ Return Pur. Amt
+ Cur.Qty
+ ';
+ $sr_no = 0;
+ $tot_sale_amt = 0;
+ $tot_return_amt = 0;
+ $tot_pur_amt = 0;
+ $tot_pur_return_amt = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ $tot_sale_amt = $tot_sale_amt + $row->Sale_Amount;
+ $tot_return_amt = $tot_return_amt + $row->Return_Amount;
+
+ $tot_pur_amt += $row->Purchase_Amount;
+ $tot_pur_return_amt += $row->return_Purchase_Amount;
+
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->item_code . '
+ ' . $row->item_Name . '
+ ' . $row->Sale_Qty . '
+ ' . $row->Sale_Amount . '
+ ' . $row->Purchase_Amount . '
+ ' . $row->Return_Qty . '
+ ' . $row->Return_Amount . '
+ ' . $row->return_Purchase_Amount . '
+ ' . $row->cur_qty . '
+ ';
+ }
+
+ $content .= '
+ #
+
+
+ Total Sale
+ ' . $tot_sale_amt . '
+ ' . $tot_pur_amt . '
+ Total Return
+ ' . $tot_return_amt . '
+ ' . $tot_pur_return_amt . '
+
+ ';
+
+ $content .= '
';
+
+ $Tot_Margin = ($tot_sale_amt - $tot_pur_amt) - ($tot_return_amt - $tot_pur_return_amt);
+
+ $content .= "Total Margin : Rs." . $Tot_Margin;
+
+ if ($output == 0) {
+
+ $this->load->library('m_pdf');
+
+ $file_name = "Report-MedicalSale-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ $file_name = "Report-MedicalSale-" . date('Ymdhis') . ".pdf";
+
+ ExportExcel($content, $file_name);
+ }
+ }
+
+
+ //
+ //Daily Medicine Doctor Wise Sale Report
+ public function Report_daily_med_sale_doc()
+ {
+ $sql = "select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist'] = $query->result();
+
+ $this->load->view('Medical/Report/Med_Report_daily_med_doc_sale', $data);
+ }
+
+ public function Report_daily_med_sale_doc_data($sale_date_range, $doc_id, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ if ($doc_id <> 0) {
+ $doc_id_list = str_replace('S', ',', $doc_id);
+
+ $sql_where .= " and m.doc_id in (" . $doc_id_list . ")";
+ }
+
+ $sql_where .= " and m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and m.inv_date >=date_add(sysdate(),interval -1 day)";
+ }
+
+ $sql = "SELECT m.doc_id,d.p_fname, i.item_code,i.item_Name,
+ SUM(if(m.sale_return=0,i.qty,i.qty*-1)) AS Sale_Qty,
+ SUM(if(m.sale_return=0,i.twdisc_amount,i.twdisc_amount*-1)) AS Sale_Amount,
+ SUM(if(m.sale_return=0,i.qty*p.purchase_unit_rate,i.qty*p.purchase_unit_rate*-1)) AS Purchase_Amount,
+ q.cur_qty,i.CGST_per,
+ SUM(if(m.sale_return=0,(i.CGST+i.SGST),(i.CGST+i.SGST)*-1)) AS Sale_GST
+ FROM ((invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id)
+ LEFT JOIN purchase_invoice_item p ON i.store_stock_id=p.id
+ JOIN (SELECT t.item_code,SUM(t.total_unit-total_sale_unit-total_return_unit-total_lost_unit) AS cur_qty
+ FROM purchase_invoice_item t
+ GROUP BY t.item_code) AS q ON q.item_code=i.item_code)
+ LEFT JOIN doctor_master d ON m.doc_id=d.id
+ Where $sql_where and m.ipd_id=0
+ GROUP BY m.doc_id,i.item_code ORDER BY i.item_Name";
+
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ $content = 'Date Between ' . $minRange . ' and ' . $maxRange . '
+
+ ';
+
+ $content .= '
+ #
+ Doc. Name
+ Item Code
+ Item Name
+ Sale Qty
+ Sale Amt
+ Pur. Amt
+ Sale GST
+ Cur.Qty
+ ';
+ $sr_no = 0;
+ $tot_sale_amt = 0;
+ $tot_sale_gst = 0;
+ $tot_pur_amt = 0;
+ $tot_pur_return_amt = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ $tot_sale_amt = $tot_sale_amt + $row->Sale_Amount;
+
+ $tot_pur_amt += $row->Purchase_Amount;
+
+ $tot_sale_gst += $row->Sale_GST;
+
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->p_fname . '
+ ' . $row->item_code . '
+ ' . $row->item_Name . '
+ ' . $row->Sale_Qty . '
+ ' . $row->Sale_Amount . '
+ ' . $row->Purchase_Amount . '
+ ' . $row->Sale_GST . '
+ ' . $row->cur_qty . '
+ ';
+ }
+
+ $content .= '
+ #
+
+
+
+ Total Sale
+ ' . $tot_sale_amt . '
+ ' . $tot_pur_amt . '
+ ' . $tot_sale_gst . '
+
+ ';
+
+ $content .= '
';
+
+ $Tot_Margin = ($tot_sale_amt - $tot_pur_amt - $tot_sale_gst);
+
+ $content .= "Total Margin (Sale - Purchase - SaleGST): Rs. " . $Tot_Margin;
+
+ if ($output == 0) {
+
+ $this->load->library('m_pdf');
+ $file_name = "Report-MedicalSale-" . date('Ymdhis') . ".pdf";
+ $filepath = $file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ $file_name = "Report-MedicalSale-" . date('Ymdhis') . ".pdf";
+
+ ExportExcel($content, $file_name);
+ }
+ }
+
+ public function Report_daily_med_sale_doc_data_ipd($sale_date_range, $doc_id, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ if ($doc_id <> 0) {
+ //$doc_id_list = str_replace('S', ',', $doc_id);
+
+ $sql_where .= " and FIND_IN_SET($doc_id,ipd.doc_list)>0";
+ }
+
+ $sql_where .= " and ipd.discharge_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and ipd.discharge_date >=date_add(sysdate(),interval -2 month)";
+ }
+
+ $sql = "SELECT ipd.doc_name,ipd.doc_list, i.item_code,i.item_Name,
+ SUM(if(m.sale_return=0,i.qty,i.qty*-1)) AS Sale_Qty,
+ SUM(if(m.sale_return=0,i.twdisc_amount,i.twdisc_amount*-1)) AS Sale_Amount,
+ SUM(if(m.sale_return=0,i.qty*p.purchase_unit_rate,i.qty*p.purchase_unit_rate*-1)) AS Purchase_Amount,
+ q.cur_qty,i.CGST_per,
+ SUM(if(m.sale_return=0,(i.CGST+i.SGST),(i.CGST+i.SGST)*-1)) AS Sale_GST
+ FROM ((((invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id AND m.ipd_id>0) JOIN v_ipd_list ipd ON m.ipd_id=ipd.id)
+ LEFT JOIN purchase_invoice_item p ON i.store_stock_id=p.id )
+
+ JOIN (SELECT t.item_code,SUM(t.total_unit-total_sale_unit-total_return_unit-total_lost_unit) AS cur_qty
+ FROM purchase_invoice_item t
+ GROUP BY t.item_code) AS q ON q.item_code=i.item_code)
+ Where $sql_where and m.ipd_id>0
+ GROUP BY m.doc_id,i.item_code ORDER BY i.item_Name";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ $content = 'Date Between ' . $minRange . ' and ' . $maxRange . '
+
+ ';
+
+ $content .= '
+ #
+ Doc. Name
+ Item Code
+ Item Name
+ Sale Qty
+ Sale Amt
+ Pur. Amt
+ Sale GST
+ Cur.Qty
+ ';
+ $sr_no = 0;
+ $tot_sale_amt = 0;
+ $tot_sale_gst = 0;
+ $tot_pur_amt = 0;
+ $tot_pur_return_amt = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ $tot_sale_amt = $tot_sale_amt + $row->Sale_Amount;
+
+ $tot_pur_amt += $row->Purchase_Amount;
+
+ $tot_sale_gst += $row->Sale_GST;
+
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->doc_name . '
+ ' . $row->item_code . '
+ ' . $row->item_Name . '
+ ' . $row->Sale_Qty . '
+ ' . $row->Sale_Amount . '
+ ' . $row->Purchase_Amount . '
+ ' . $row->Sale_GST . '
+ ' . $row->cur_qty . '
+ ';
+ }
+
+ $content .= '
+ #
+
+
+
+ Total Sale
+ ' . $tot_sale_amt . '
+ ' . $tot_pur_amt . '
+ ' . $tot_sale_gst . '
+
+ ';
+
+ $content .= '
';
+
+ $Tot_Margin = ($tot_sale_amt - $tot_pur_amt - $tot_sale_gst);
+
+ $content .= "Total Margin (Sale - Purchase - SaleGST): Rs. " . $Tot_Margin;
+
+ if ($output == 0) {
+
+ $this->load->library('m_pdf');
+ $file_name = "Report-MedicalSale-" . date('Ymdhis') . ".pdf";
+ $filepath = $file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ $file_name = "Report-MedicalSale-" . date('Ymdhis') . ".pdf";
+
+ ExportExcel($content, $file_name);
+ }
+ }
+ //Company Wise Medicine Sale Report
+ public function Report_company_med_sale()
+ {
+ $sql = "Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company'] = $query->result();
+
+ $this->load->view('Medical/Report/Med_Report_company_med_sale', $data);
+ }
+
+ public function Report_company_med_sale_data($sale_date_range, $comp_id, $output = 0)
+ {
+ $sql_where = " c.company_id= " . $comp_id;
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and m.inv_date >=date_add(sysdate(),interval -1 day)";
+ }
+
+ $sql = "SELECT i.item_code,i.item_Name,c.company_name,
+ SUM(if(m.sale_return=0,i.qty,0)) AS Sale_Qty,
+ SUM(if(m.sale_return=0,i.twdisc_amount,0)) AS Sale_Amount,
+ SUM(if(m.sale_return=0,i.qty*p.purchase_unit_rate,0)) AS Purchase_Amount,
+ SUM(if(m.sale_return=1,i.qty,0)) AS Return_Qty,
+ SUM(if(m.sale_return=1,i.twdisc_amount,0)) AS Return_Amount,
+ SUM(if(m.sale_return=1,i.qty*p.purchase_unit_rate,0)) AS return_Purchase_Amount
+ FROM ((invoice_med_master m JOIN inv_med_item i ON m.id=i.inv_med_id)
+ JOIN purchase_invoice_item p ON i.store_stock_id=p.id )
+ JOIN med_product_master c ON i.item_code=c.id
+ Where " . $sql_where . " GROUP BY i.item_code ORDER BY i.item_Name";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ $content = '';
+
+ $content .= '
+ #
+ Item Code
+ Item Name
+ Sale Qty
+ Sale Amt
+ Pur. Amt
+ Return Qty
+ Return Amt
+ Return Pur. Amt
+ ';
+ $sr_no = 0;
+ $tot_sale_amt = 0;
+ $tot_return_amt = 0;
+ $tot_pur_amt = 0;
+ $tot_pur_return_amt = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ $tot_sale_amt = $tot_sale_amt + $row->Sale_Amount;
+ $tot_return_amt = $tot_return_amt + $row->Return_Amount;
+
+ $tot_pur_amt += $row->Purchase_Amount;
+ $tot_pur_return_amt += $row->return_Purchase_Amount;
+
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->item_code . '
+ ' . $row->item_Name . '
+ ' . $row->Sale_Qty . '
+ ' . $row->Sale_Amount . '
+ ' . $row->Purchase_Amount . '
+ ' . $row->Return_Qty . '
+ ' . $row->Return_Amount . '
+ ' . $row->return_Purchase_Amount . '
+ ';
+ }
+
+ $content .= '
+ #
+
+
+ Total Sale
+ ' . $tot_sale_amt . '
+ ' . $tot_pur_amt . '
+ Total Return
+ ' . $tot_return_amt . '
+ ' . $tot_pur_return_amt . '
+ ';
+
+ $content .= '
';
+
+ $Tot_Margin = ($tot_sale_amt - $tot_pur_amt) - ($tot_return_amt - $tot_pur_return_amt);
+
+ $content .= "Total Margin : Rs." . $Tot_Margin;
+
+ if ($output == 0) {
+
+ $this->load->library('m_pdf');
+
+ $file_name = "Report-MedicalSale-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ $file_name = "Report-MedicalSale-" . date('Ymdhis') . ".pdf";
+
+ ExportExcel($content, $file_name);
+ }
+ }
+
+ public function Report_company_med_purchase_data($sale_date_range, $comp_id, $output = 0)
+ {
+ $sql_where = " p.company_id= " . $comp_id;
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and m.date_of_invoice between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and m.date_of_invoice >=date_add(sysdate(),interval -1 day)";
+ }
+
+ $sql = "SELECT i.item_code,i.Item_name,i.packing,
+ sum(i.qty) as qty,sum(i.taxable_amount) AS taxable_amount,
+ sum(i.net_amount) AS net_amount ,c.company_name
+ FROM ((purchase_invoice_item i JOIN purchase_invoice m on i.purchase_id=m.id)
+ JOIN med_product_master p ON i.item_code=p.id) JOIN med_company c ON p.company_id=c.id
+ Where " . $sql_where . " GROUP BY i.item_code ORDER BY i.Item_name";
+
+ echo $sql;
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ $content = '';
+
+ $content .= '
+ #
+ Company Name
+ Item Name
+ Purchase Qty
+ Pur. Tax. Amt
+ Pur. Net Amt
+ ';
+ $sr_no = 0;
+ $tot_taxable_amount = 0;
+ $tot_net_amount = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ $tot_taxable_amount = $tot_taxable_amount + $row->taxable_amount;
+ $tot_net_amount = $tot_net_amount + $row->net_amount;
+
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->company_name . '
+ ' . $row->Item_name . '
+ ' . $row->qty . '
+ ' . $row->taxable_amount . '
+ ' . $row->net_amount . '
+ ';
+ }
+
+ $content .= '
+ #
+
+
+ Total
+ ' . $tot_taxable_amount . '
+ ' . $tot_net_amount . '
+ ';
+
+ $content .= '
';
+
+ //echo $content;
+ if ($output == 0) {
+
+ $this->load->library('m_pdf');
+
+ $file_name = "Report-MedicalCompanyWisePurcase-" . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ $file_name = "Report-MedicalCompanyWisePurcase-" . date('Ymdhis') . ".pdf";
+
+ ExportExcel($content, $file_name);
+ }
+ }
+
+ // Pending Invoice Report
+
+ public function Report_2_OPD_Pending()
+ {
+
+ $this->load->view('Medical/Report/Med_Report_2_Pending');
+ }
+
+ public function Report_2_Bal_pending_data($sale_date_range, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and m.inv_date >=date_add(sysdate(),interval -1 day)";
+ }
+
+ $Report_Heading = "Date (YYYY-MM-DD) From :" . $minRange . " To " . $maxRange . " / Data Filter : Pending Balance Invoice";
+
+ $sql = "Select m.id,m.inv_med_code, m.patient_id,m.inv_name,m.patient_code,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,
+ Sum(m.net_amount) as tnet_amount ,
+ Sum(m.payment_received) as payment_received,
+ Sum(m.payment_balance) as payment_balance
+ FROM invoice_med_master m
+ where " . $sql_where . "
+ and (m.payment_balance >1 OR m.payment_balance <-1)
+ AND m.ipd_id=0 and m.case_id=0
+ group by inv_date,m.id with ROLLUP";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ //echo $sql;
+
+ $content = '' . $Report_Heading . '
';
+ $content .= '';
+
+ $content .= '
+ #
+ Date
+ Invoice ID
+ Patients Name
+ Net Amt.
+ Amt. Rec.
+ Amt. Bal.
+ ';
+ $sr_no = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ if ($row->inv_date == '') {
+ $content .= '
+ #
+ Grand Total :
+ ' . $row->tnet_amount . '
+ ' . $row->payment_received . '
+ ' . $row->payment_balance . '
+ ';
+ } elseif ($row->id == '') {
+ $content .= '
+ #
+ Total Date : ' . $row->inv_date_str . '
+ ' . $row->tnet_amount . '
+ ' . $row->payment_received . '
+ ' . $row->payment_balance . '
+ ';
+ } else {
+
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->inv_date_str . '
+ ' . $row->inv_med_code . '
+ ' . $row->inv_name . ' ' . $row->patient_code . '
+ ' . $row->tnet_amount . '
+ ' . $row->payment_received . '
+ ' . $row->payment_balance . '
+ ';
+ }
+ }
+
+ $content .= '
+
+
+ #
+ Date
+ Invoice ID
+ Patients Name
+ Net Amt.
+ Amt. Rec.
+ Amt. Bal.
+
+
+
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+
+ $file_name = 'Report-MedicalBill_Pending-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Med_Sale_day0001');
+ }
+
+ //echo $content;
+
+
+ }
+
+
+
+
+ // OPD Pending Balance Paid or OLD Payment Received
+
+ public function Report_2_OPD_Pending_Paid()
+ {
+
+ $this->load->view('Medical/Report/Med_Report_2_Pending_paid');
+ }
+
+ public function Report_2_Bal_pending_payment($sale_date_range, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and Date(h.payment_date)= '" . $minRange . "' and m.inv_date < '" . $minRange . "'";
+
+ $Report_Heading = "Date (YYYY-MM-DD) :" . $minRange . " / Data Filter : Payment of OLD OPD Invoice";
+
+ $sql = "Select m.id,m.inv_med_code, m.patient_id,m.inv_name,m.patient_code, m.inv_date,
+ Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,
+ (m.net_amount) as tnet_amount ,
+ (m.payment_received) as payment_received,
+ (m.payment_balance) as payment_balance,
+ if(h.credit_debit=0, h.amount,h.amount*-1) AS tran_amt
+ FROM (invoice_med_master m join payment_history_medical h on m.id=h.Medical_invoice_id )
+ where " . $sql_where . " ";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ //echo $sql;
+
+ $content = '' . $Report_Heading . '
';
+ $content .= '';
+
+ $content .= '
+ #
+ Date
+ Invoice ID
+ Patients Name
+ Net Amt.
+ Amt. Rec.
+ Amt. Bal.
+ Payment Amt.
+ ';
+ $sr_no = 0;
+
+ $tot_payment = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->inv_date_str . '
+ ' . $row->inv_med_code . '
+ ' . $row->inv_name . ' ' . $row->patient_code . '
+ ' . $row->tnet_amount . '
+ ' . $row->payment_received . '
+ ' . $row->payment_balance . '
+ ' . $row->tran_amt . '
+ ';
+ $tot_payment += $row->tran_amt;
+ }
+
+ $content .= '
+
+
+ #
+
+
+
+
+
+ Total
+ ' . $tot_payment . '
+
+
+
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+ $file_name = 'Report-MedicalBill_Pending-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Med_Sale_day0001');
+ }
+
+ //echo $content;
+
+ }
+ //Daily Cash Received List
+
+ public function Report_2()
+ {
+
+ $this->load->view('Medical/Report/Med_Report_2');
+ }
+
+
+ public function Report_2_data($sale_date_range, $bill_type, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $minRange = $sale_date_range;
+
+ $sql_where .= " and m.inv_date = '" . $minRange . "' ";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and date(m.inv_date) >=date(date_add(sysdate(),interval -2 day))";
+ }
+
+
+
+ $Filter_type = "ALL";
+
+ if ($bill_type == 1) {
+ $sql_where .= " and (m.ipd_id=0 and m.case_id=0 )";
+ $Filter_type = "OPD CASH";
+ } elseif ($bill_type == 2) {
+ $sql_where .= " and (m.ipd_id>0 and m.ipd_credit=0 )";
+ $Filter_type = "IPD CASH";
+ } elseif ($bill_type == 3) {
+ $sql_where .= " and (m.ipd_id=0 and m.case_id>1 )";
+ $Filter_type = "OPD Org.";
+ } elseif ($bill_type == 4) {
+ $sql_where .= " and (m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=1 )";
+ $Filter_type = "IPD Cr";
+ } elseif ($bill_type == 5) {
+ $sql_where .= " and (m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=0 )";
+ $Filter_type = "IPD Pkg Cr";
+ } elseif ($bill_type == 6) {
+ $sql_where .= " and ((m.ipd_id>0 and m.ipd_credit=1) or (m.ipd_id=0 and m.case_id>1 ))";
+ $Filter_type = "Hospital Cr";
+ }
+
+ $Report_Heading = "Date (YYYY-MM-DD) :" . $minRange . " / Data Filter :" . $Filter_type;
+
+ $sql = "Select m.id,m.inv_med_code,m.ipd_code, m.patient_id,m.inv_name,m.patient_code,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,
+ Sum(i.twdisc_amount) as tnet_amount,
+ sum(if(m.ipd_id=0 and m.case_id=0,i.twdisc_amount,0)) as OPD_Cash_Bill_amount,
+ sum(if(m.ipd_id=0 and m.case_id>1,i.twdisc_amount,0)) as OPD_Org_Bill_amount,
+
+ if(o1.short_name IS null, o2.short_name, o1.short_name) AS Ins_name,
+ sum(if(m.ipd_id>0 and m.ipd_credit=0,i.twdisc_amount,0)) as IPD_Cash_Bill_amount,
+ sum(if(m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=1,i.twdisc_amount,0)) as IPD_Credit_Bill_amount,
+ sum(if(m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=0,i.twdisc_amount,0)) as IPD_Package_Bill_amount
+
+ FROM (((invoice_med_master m join inv_med_item i on m.id=i.inv_med_id)
+ left join patient_master p on m.patient_id=p.id)
+ left join (Select org.id,ins.short_name,org.ipd_id ,org.case_type
+ from organization_case_master org join hc_insurance ins
+ on org.insurance_id=ins.id) o1 ON m.ipd_id=o1.ipd_id AND o1.case_type=1 and m.ipd_id>0)
+ left join (Select org.id,ins.short_name,org.ipd_id ,org.case_type
+ from organization_case_master org join hc_insurance ins
+ on org.insurance_id=ins.id) o2 ON m.case_id=o2.id AND o2.case_type=0 and m.ipd_id=0
+ where " . $sql_where . " group by inv_date,m.id with ROLLUP";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ //echo $sql;
+
+ $content = '' . $Report_Heading . '
';
+ $content .= '';
+
+ $content .= '
+ #
+ Date
+ Invoice ID
+ Patients Name
+ Net Amt.
+ OPD Cash
+ IPD Cash Amount
+ Org.Name
+ OPD Org.
+ IPD Cr Hospital
+ IPD Cr Pkg. Hospital
+ Tot. Cr Hospital
+ ';
+ $sr_no = 0;
+ $grand_date_tot_row = 0;
+ $grand_tot_row = 0;
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ if ($row->inv_date == '') {
+ $content .= '
+ #
+ Grand Total :
+ ' . $row->tnet_amount . '
+ ' . $row->OPD_Cash_Bill_amount . '
+ ' . $row->IPD_Cash_Bill_amount . '
+
+ ' . $row->OPD_Org_Bill_amount . '
+ ' . $row->IPD_Credit_Bill_amount . '
+ ' . $row->IPD_Package_Bill_amount . '
+ ' . $grand_date_tot_row . '
+ ';
+ } elseif ($row->id == '') {
+ $content .= '
+ #
+ Total Date : ' . $row->inv_date_str . '
+ ' . $row->tnet_amount . '
+ ' . $row->OPD_Cash_Bill_amount . '
+ ' . $row->IPD_Cash_Bill_amount . '
+
+ ' . $row->OPD_Org_Bill_amount . '
+ ' . $row->IPD_Credit_Bill_amount . '
+ ' . $row->IPD_Package_Bill_amount . '
+ ' . $grand_tot_row . '
+ ';
+ $grand_date_tot_row += $grand_tot_row;
+ $grand_tot_row = 0;
+ } else {
+ $tot_row = $row->OPD_Org_Bill_amount + $row->IPD_Credit_Bill_amount + $row->IPD_Package_Bill_amount;
+ $grand_tot_row += $tot_row;
+
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->inv_date_str . '
+ ' . $row->inv_med_code . '
+ ' . $row->inv_name . ' ' . $row->patient_code . ' ' . $row->ipd_code . '
+ ' . $row->tnet_amount . '
+ ' . $row->OPD_Cash_Bill_amount . '
+ ' . $row->IPD_Cash_Bill_amount . '
+ ' . $row->Ins_name . '
+ ' . $row->OPD_Org_Bill_amount . '
+ ' . $row->IPD_Credit_Bill_amount . '
+ ' . $row->IPD_Package_Bill_amount . '
+ ' . $tot_row . '
+ ';
+ }
+ }
+
+ $content .= '
+
+
+ #
+ Date
+ Invoice ID
+ Patients Name
+ Net Amt.
+ OPD Cash
+ IPD Cash Amount
+ Org.Name
+ OPD Org.
+ IPD Cr Hospital
+ IPD Cr Pkg. Hospital
+ Tot. Cr Hospital
+
+
+
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Med_Sale_day0001');
+ }
+
+ //echo $content;
+
+
+ }
+
+ public function Report_2_short_data($sale_date_range, $bill_type)
+ {
+ $sql_where = " m.net_amount is not null ";
+
+ $minRange = $sale_date_range;
+
+ $sql_where .= " and m.inv_date = '" . $minRange . "' ";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and date(m.inv_date) >=date(date_add(sysdate(),interval -2 day))";
+ }
+
+
+ $Filter_type = "ALL";
+
+ if ($bill_type == 1) {
+ $sql_where .= " and (m.ipd_id=0 and m.case_id=0 )";
+ $Filter_type = "OPD CASH";
+ } elseif ($bill_type == 2) {
+ $sql_where .= " and (m.ipd_id>0 and m.ipd_credit=0 )";
+ $Filter_type = "IPD CASH";
+ } elseif ($bill_type == 3) {
+ $sql_where .= " and (m.ipd_id=0 and m.case_id>1 )";
+ $Filter_type = "OPD Org.";
+ } elseif ($bill_type == 4) {
+ $sql_where .= " and (m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=1 )";
+ $Filter_type = "IPD Cr";
+ } elseif ($bill_type == 5) {
+ $sql_where .= " and (m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=0 )";
+ $Filter_type = "IPD Pkg Cr";
+ } elseif ($bill_type == 6) {
+ $sql_where .= " and ((m.ipd_id>0 and m.ipd_credit=1) or (m.ipd_id=0 and m.case_id>1 ))";
+ $Filter_type = "Hospital Cr";
+ }
+
+ $Report_Heading = "Date (YYYY-MM-DD) :" . $minRange . " / Data Filter :" . $Filter_type;
+
+ $sql = "select count(DISTINCT m.id) as No_invoice,
+ count( DISTINCT m.patient_id) as No_Patients,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,
+ Sum(m.net_amount) as tnet_amount,
+ sum(if(m.ipd_id=0 and m.case_id=0,m.net_amount,0)) as OPD_Cash_Bill_amount,
+ sum(if(m.ipd_id=0 and m.case_id>1,m.net_amount,0)) as OPD_Org_Bill_amount,
+
+ sum(if(m.ipd_id>0 and m.ipd_credit=0,m.net_amount,0)) as IPD_Cash_Bill_amount,
+ sum(if(m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=1,m.net_amount,0)) as IPD_Credit_Bill_amount,
+ sum(if(m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=0,m.net_amount,0)) as IPD_Package_Bill_amount,
+
+ sum(if(m.ipd_id=0 and m.case_id=0,1,0)) as OPD_Cash_Bill_invoice,
+ sum(if(m.ipd_id=0 and m.case_id>1,1,0)) as OPD_Org_Bill_invoice,
+
+ sum(if(m.ipd_id>0 and m.ipd_credit=0,1,0)) as IPD_Cash_Bill_invoice,
+ sum(if(m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=1,1,0)) as IPD_Credit_Bill_invoice,
+ sum(if(m.ipd_id>0 and m.ipd_credit=1 and m.ipd_credit_type=0,1,0)) as IPD_Package_Bill_invoice
+
+ from invoice_med_master m
+
+ where " . $sql_where . " group by m.inv_date ";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ //echo $sql;
+
+ $content = '' . $Report_Heading . '
';
+ $content .= '';
+
+ $content .= '
+ Sr.No.
+ Date
+ No. of Invoice
+ Invoice Type
+ CASH/Direct
+ Credit to Hospital
+ ';
+
+ foreach ($med_inv_total as $row) {
+ $content .= '
+ 1
+ ' . $row->inv_date_str . '
+ ' . $row->OPD_Cash_Bill_invoice . '
+ OPD CASH
+ ' . $row->OPD_Cash_Bill_amount . '
+
+ ';
+
+ $content .= '
+ 2
+ ' . $row->inv_date_str . '
+ ' . $row->IPD_Cash_Bill_invoice . '
+ IPD CASH
+ ' . $row->IPD_Cash_Bill_amount . '
+
+ ';
+
+ $content .= '
+ 3
+ ' . $row->inv_date_str . '
+ ' . $row->OPD_Org_Bill_invoice . '
+ OPD Org.
+
+ ' . $row->OPD_Org_Bill_amount . '
+ ';
+
+ $content .= '
+ 4
+ ' . $row->inv_date_str . '
+ ' . $row->IPD_Credit_Bill_invoice . '
+ IPD Credit
+
+ ' . $row->IPD_Credit_Bill_amount . '
+ ';
+
+ $content .= '
+ 5
+ ' . $row->inv_date_str . '
+ ' . $row->IPD_Package_Bill_invoice . '
+ IPD Credit Pkg.
+
+ ' . $row->IPD_Package_Bill_amount . '
+ ';
+
+ $total_Cash_Bill_amount = $row->OPD_Cash_Bill_amount + $row->IPD_Cash_Bill_amount;
+ $total_Credit_Bill_amount = $row->OPD_Org_Bill_amount + $row->IPD_Credit_Bill_amount + $row->IPD_Package_Bill_amount;
+
+ $content .= '
+ Total
+ ' . $row->No_invoice . '
+
+ ' . $total_Cash_Bill_amount . '
+ ' . $total_Credit_Bill_amount . '
+ ';
+ }
+
+ $content .= '
+
';
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ //echo $content;
+
+
+ }
+
+ //IPD Discharge Report
+
+ public function ipd_discharge()
+ {
+ $this->load->view('Medical/Report/IPD_Discharge_Report');
+ }
+
+
+ public function Report_6_data($sale_date_range, $output = 0)
+ {
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " m.ipd_id>0 and p.ipd_status=1 ";
+
+ $where .= " and p.discharge_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+
+
+ $sql = "SELECT p.ipd_code,p.p_code,p.p_fname, DATE_FORMAT(p.register_date,'%d-%m-%Y') as ipd_admit_date_str, DATE_FORMAT(p.discharge_date,'%d-%m-%Y') as ipd_discharge_date_str, p.admit_type,
+ (if(m.ipd_credit=1 and m.ipd_credit_type=1,g.net_amount,0)) as IPD_Credit_Amount,
+ (if(m.ipd_credit=1 and m.ipd_credit_type=0,g.net_amount,0)) as IPD_Package_Amount,
+ (if(m.ipd_credit=0,g.net_amount,0)) as IPD_CASH_Amount, (g.net_amount-pay_his.Total_Paid_Amount) as cash_balance,
+ pay_his.Total_Paid_Amount as Paid_Amount
+ FROM ((invoice_med_master m join v_ipd_list p on m.ipd_id=p.id ) join inv_med_group g ON m.med_group_id=g.med_group_id)
+ LEFT JOIN (SELECT SUM(if(h.credit_debit=0,h.amount,h.amount*-1)) AS Total_Paid_Amount, h.ipd_id
+ FROM payment_history_medical h WHERE h.Customerof_type=2 GROUP BY h.ipd_id) AS pay_his ON p.id=pay_his.ipd_id
+ where " . $where . " group by m.ipd_id ";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ //echo $sql;
+
+ $content = "";
+
+ $content .= '
+
+ IPD Code
+ Patient Code
+ Patient Name
+ Admit dt.
+ Discharge Dt.
+ TPA Name
+ Cash
+ Paid Amt.
+ Cash Balance
+ Credit
+ Package
+
+ ';
+
+ $Head_Content = "";
+ foreach ($stock_list as $row) {
+ $content .= '';
+ $content .= ' ' . $row->ipd_code . ' ';
+ $content .= ' ' . $row->p_code . ' ';
+ $content .= ' ' . $row->p_fname . ' ';
+ $content .= ' ' . $row->ipd_admit_date_str . ' ';
+ $content .= ' ' . $row->ipd_discharge_date_str . ' ';
+ $content .= ' ' . $row->admit_type . ' ';
+ $content .= ' ' . $row->IPD_CASH_Amount . ' ';
+ $content .= ' ' . $row->Paid_Amount . ' ';
+ $content .= ' ' . Round($row->cash_balance,0) . ' ';
+ $content .= ' ' . $row->IPD_Credit_Amount . ' ';
+ $content .= ' ' . $row->IPD_Package_Amount . ' ';
+ $content .= ' ';
+ }
+
+ $content .= '
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medical');
+ }
+ }
+
+
+ //Daily Cash Received List
+
+ public function Report_Payment_Recieved()
+ {
+
+ $sql = "select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist'] = $query->result();
+
+ $sql = "select * from payment_mode where id in (1,2) ";
+ $query = $this->db->query($sql);
+ $data['paymodelist'] = $query->result();
+
+ $this->load->view('Medical/Report/Med_Payment_Recevie', $data);
+ }
+
+ public function Report_Payment_Recieved_data($sale_date_range, $emp_name_id = 0, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = str_replace('T', ' ', $rangeArray[0]);
+ $maxRange = str_replace('T', ' ', $rangeArray[1]);
+
+ if ($minRange == $maxRange) {
+ $sql_where .= " and Date(p.payment_date) between Date('" . $minRange . "') and Date('" . $maxRange . "')";
+ } else {
+ $sql_where .= " and p.payment_date between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ $data_show = 'Date(YYYY-MM-DD h:m) between ' . $minRange . ' and ' . $maxRange . '
';
+
+ if ($emp_name_id <> 0) {
+ $emp_name_id = str_replace('S', ',', $emp_name_id);
+
+ $sql_where .= " and p.update_by_id in (" . $emp_name_id . ")";
+ }
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and p.payment_date >=date_add(sysdate(),interval -1 day)";
+ }
+
+ $sql = "SELECT p.id,
+ if(p.Customerof_type=1,u.p_code,if(p.Customerof_type =3,m.inv_med_code,i.ipd_code)) AS UHID_IPD,
+ if(p.Customerof_type=1,u.p_fname,if(p.Customerof_type =3,m.inv_name,i.p_fname)) AS NAME_PERSON,
+
+ if(p.Customerof_type IN (1,3) AND p.payment_mode=1 ,if(p.credit_debit=0,p.amount,p.amount*-1),0) AS OPD_Amt_CASH,
+ if(p.Customerof_type IN (1,3) AND p.payment_mode=2,if(p.credit_debit=0,p.amount,p.amount*-1),0) AS OPD_Amt_BANK,
+
+ if(p.Customerof_type IN (2) AND p.payment_mode=1,if(p.credit_debit=0,p.amount,p.amount*-1),0) AS IPD_Amt_CASH,
+ if(p.Customerof_type IN (2) AND p.payment_mode=2,if(p.credit_debit=0,p.amount,p.amount*-1),0) AS IPD_Amt_BANK,
+ p.payment_date,p.credit_debit,p.update_by,p.update_by_id
+ FROM ((payment_history_medical p Left JOIN patient_master u ON p.Customerof_id=u.id AND p.Customerof_type=1)
+ Left JOIN
+ (SELECT ipd_master.id,ipd_master.ipd_code,patient_master.p_fname
+ from ipd_master JOIN patient_master ON ipd_master.p_id=patient_master.id ) i ON p.ipd_id=i.id AND p.Customerof_type=2)
+ LEFT JOIN invoice_med_master m ON p.Medical_invoice_id=m.id
+ where " . $sql_where . " order by p.id";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+
+ $content = '';
+
+ $content .= '';
+
+ $content .= '
+ #
+ Payment Date
+ UHID/IPD/Inv.ID
+ Name of Person
+ OPD Cash
+ OPD Bank
+ IPD Cash
+ IPD BANK
+ Update By
+ ';
+
+ $sr_no = 0;
+ $OPD_Amt_CASH = 0;
+ $OPD_Amt_BANK = 0;
+ $IPD_Amt_CASH = 0;
+ $IPD_Amt_BANK = 0;
+ $Total_Amt = 0;
+
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ $OPD_Amt_CASH += $row->OPD_Amt_CASH;
+ $OPD_Amt_BANK += $row->OPD_Amt_BANK;
+ $IPD_Amt_CASH += $row->IPD_Amt_CASH;
+ $IPD_Amt_BANK += $row->IPD_Amt_BANK;
+
+ $content .= '
+ ' . $row->id . '
+ ' . $row->payment_date . '
+ ' . $row->UHID_IPD . '
+ ' . $row->NAME_PERSON . '
+ ' . $row->OPD_Amt_CASH . '
+ ' . $row->OPD_Amt_BANK . '
+ ' . $row->IPD_Amt_CASH . '
+ ' . $row->IPD_Amt_BANK . '
+ ' . $row->update_by . '
+ ';
+ }
+
+ $content .= '
+ #
+
+
+ Total Amt.
+ ' . $OPD_Amt_CASH . '
+ ' . $OPD_Amt_BANK . '
+ ' . $IPD_Amt_CASH . '
+ ' . $IPD_Amt_BANK . '
+
+ ';
+ $content .= '
';
+
+ $GTotal = $OPD_Amt_CASH + $OPD_Amt_BANK + $IPD_Amt_CASH + $IPD_Amt_BANK;
+
+ $content .= 'Total Amount : ' . $GTotal;
+
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Med_Sale_day0001');
+ }
+
+ //echo $content;
+
+ }
+
+ public function Report_3()
+ {
+ $this->load->view('Medical/Report/Med_Report_3');
+ }
+
+ public function Report_3_data($sale_date_range, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ //$sql_where .= " and m.net_amount>0 ";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and m.inv_date >=date_add(sysdate(),interval -1 day)";
+ }
+
+ $sql = "Select t.CGST_per,sum(t.qty) as t_qty,
+ sum(t.CGST) as TCGST,
+ t.SGST_per,
+ sum(t.SGST) as TSGST,
+ sum(t.CGST+t.SGST) as TGST,
+ sum(t.TaxableAmount) as TaxableAmount,
+ sum(t.twdisc_amount) as Amount
+ from invoice_med_master m join inv_med_item t
+ on m.id=t.inv_med_id
+ where " . $sql_where . " group by t.CGST_per with ROLLUP";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+ //echo $sql;
+
+ $content = '';
+
+ $content .= '
+ #
+ CGST Per
+ T. CGST
+ SGST Per
+ T. SGST
+ Total GST
+ Taxable Amount
+ Amount
+ Item Qty
+ ';
+
+ $sr_no = 0;
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ if ($row->CGST_per == '') {
+ $content .= '
+ #
+ Grand Total :
+ ' . $row->TCGST . '
+
+ ' . $row->TSGST . '
+ ' . $row->TGST . '
+ ' . $row->TaxableAmount . '
+ ' . $row->Amount . '
+ ' . $row->t_qty . '
+ ';
+ } else {
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->CGST_per . '
+ ' . $row->TCGST . '
+ ' . $row->SGST_per . '
+ ' . $row->TSGST . '
+ ' . $row->TGST . '
+ ' . $row->TaxableAmount . '
+ ' . $row->Amount . '
+ ' . $row->t_qty . '
+ ';
+ }
+ }
+
+ $content .= '
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Med_Sale_day0001');
+ }
+
+ //echo $content;
+
+ }
+
+ public function Report_3_purchase_data($sale_date_range, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $sql_where .= " and date(m.inv_date) >=date(date_add(sysdate(),interval -2 day))";
+ }
+
+
+ $sql = "Select t.CGST_per,sum(t.qty) as t_qty,
+ sum(t.CGST) as TCGST,
+ t.SGST_per,
+ sum(t.SGST) as TSGST,
+ sum(t.CGST+t.SGST) as TGST,
+ sum(t.TaxableAmount) as TaxableAmount,
+ sum(t.twdisc_amount) as Amount
+ from invoice_med_master m join inv_med_item t
+ on m.id=t.inv_med_id
+ where " . $sql_where . " group by t.CGST_per with ROLLUP";
+
+ $query = $this->db->query($sql);
+ $med_inv_total = $query->result();
+ //echo $sql;
+
+ $content = '';
+
+ $content .= '
+ #
+ CGST Per
+ T. CGST
+ SGST Per
+ T. SGST
+ Total GST
+ Taxable Amount
+ Amount
+ Item Qty
+ ';
+
+ $sr_no = 0;
+ foreach ($med_inv_total as $row) {
+ $sr_no = $sr_no + 1;
+
+ if ($row->CGST_per == '') {
+ $content .= '
+ #
+ Grand Total :
+ ' . $row->TCGST . '
+
+ ' . $row->TSGST . '
+ ' . $row->TGST . '
+ ' . $row->TaxableAmount . '
+ ' . $row->Amount . '
+ ' . $row->t_qty . '
+ ';
+ } else {
+ $content .= '
+ ' . $sr_no . '
+ ' . $row->CGST_per . '
+ ' . $row->TCGST . '
+ ' . $row->SGST_per . '
+ ' . $row->TSGST . '
+ ' . $row->TGST . '
+ ' . $row->TaxableAmount . '
+ ' . $row->Amount . '
+ ' . $row->t_qty . '
+ ';
+ }
+ }
+
+ $content .= '
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Med_Sale_day0001');
+ }
+
+ //echo $content;
+
+ }
+
+
+ public function Report_4()
+ {
+ $this->load->view('Medical/Report/Med_Report_4');
+ }
+
+ public function Report_4_data($sale_date_range, $output = 0)
+ {
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " m.ipd_id>0 and p.ipd_status=1 ";
+
+ $where .= " and p.discharge_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+
+
+ $sql = "select m.id,m.ipd_id,m.inv_med_code,m.ipd_code, m.patient_id,m.inv_name,m.patient_code,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,p.ins_company_name,
+
+ sum(if(m.ipd_credit=1 and m.ipd_credit_type=1,m.net_amount,0)) as IPD_Credit_Amount,
+ sum(if(m.ipd_credit=1 and m.ipd_credit_type=0,m.net_amount,0)) as IPD_Package_Amount,
+ sum(if(m.ipd_credit=0,m.net_amount,0)) as IPD_CASH_Amount,
+
+ sum(m.net_amount) as IPD_Total_Amount
+ from invoice_med_master m join v_ipd_list p on m.ipd_id=p.id
+ where " . $where . " group by m.ipd_id,m.id with ROLLUP";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ //echo $sql;
+
+ $content = '
+
+ IPD Code
+ Patient Code
+ Patient Name
+ TPA Name
+
+
+
+ Inv.No.
+ Inv.Date
+ Cash
+ Credit
+ Package
+ Total
+ ';
+
+ $Head_Content = "";
+ foreach ($stock_list as $row) {
+ if ($row->id == '') {
+ $content .= '';
+ $content .= 'IPD Total ';
+ $content .= ' ' . $row->IPD_CASH_Amount . ' ';
+ $content .= ' ' . $row->IPD_Credit_Amount . ' ';
+ $content .= ' ' . $row->IPD_Package_Amount . ' ';
+ $content .= ' ' . $row->IPD_Total_Amount . ' ';
+ $content .= ' ';
+ } else {
+ if ($Head_Content <> $row->ipd_code) {
+ $content .= ' ';
+
+ $content .= '';
+ $content .= '';
+ $content .= ' ' . $row->ipd_code . ' ';
+ $content .= ' ' . $row->patient_code . ' ';
+ $content .= ' ' . $row->inv_name . ' ';
+ $content .= ' ' . $row->ins_company_name . ' ';
+ $content .= ' ';
+ $Head_Content = $row->ipd_code;
+ }
+
+ $content .= '';
+ $content .= ' ';
+ $content .= ' ' . $row->inv_med_code . ' ';
+ $content .= ' ' . $row->inv_date_str . ' ';
+ $content .= ' ' . $row->IPD_CASH_Amount . ' ';
+ $content .= ' ' . $row->IPD_Credit_Amount . ' ';
+ $content .= ' ' . $row->IPD_Package_Amount . ' ';
+ $content .= ' ' . $row->IPD_Total_Amount . ' ';
+ $content .= ' ';
+ }
+ }
+
+ $content .= '
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medical');
+ }
+ }
+
+ //IPD Credit Bills
+
+ public function Report_IPD_Credit_data($sale_date_range, $billtype = 0, $output = 0)
+ {
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " m.ipd_id>0 and p.ipd_status=1 ";
+
+ $where .= " and p.discharge_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+
+
+ if ($billtype == 0) {
+ } elseif ($billtype == 1) {
+ $where .= " and m.ipd_credit=0 ";
+ } elseif ($billtype == 2) {
+ $where .= " and m.ipd_credit=1 and m.ipd_credit_type=1 ";
+ } elseif ($billtype == 3) {
+ $where .= " and m.ipd_credit=1 and m.ipd_credit_type=0 ";
+ } else {
+ $where .= " 1<>1";
+ }
+
+ $sql = "select m.id,m.ipd_id,m.inv_med_code,m.ipd_code, m.patient_id,m.inv_name,m.patient_code,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,p.ins_company_name,
+ if(m.ipd_credit=0,'CASH',if(m.ipd_credit_type=1,'Credit','Package')) bill_type,
+ sum(m.net_amount) as IPD_Total_Amount
+ from invoice_med_master m join v_ipd_list p on m.ipd_id=p.id
+ where " . $where . " group by m.ipd_id,m.id with ROLLUP";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+
+ $content = '
+
+ IPD Code
+ Patient Code
+ Patient Name
+ TPA Name
+
+
+ Inv.No.
+ Inv.Date
+ Amount
+ Type
+ ';
+
+ $Head_Content = "";
+
+ $stock_list_count = count($stock_list);
+ $i = 0;
+ foreach ($stock_list as $row) {
+
+ if ($row->id == '') {
+ if ($stock_list_count == $i + 1) {
+ $content .= ' ';
+ $content .= '';
+ $content .= 'Grand Total ';
+ $content .= '' . $row->IPD_Total_Amount . ' ';
+ $content .= ' ';
+ $content .= ' ';
+ } else {
+ $content .= '';
+ $content .= 'Total ';
+ $content .= '' . $row->IPD_Total_Amount . ' ';
+ $content .= ' ';
+ $content .= ' ';
+ }
+ } else {
+ if ($Head_Content <> $row->ipd_code) {
+ $content .= ' ';
+ $content .= '';
+ $content .= ' ' . $row->ipd_code . ' ';
+ $content .= ' ' . $row->patient_code . ' ';
+ $content .= ' ' . $row->inv_name . ' ';
+ $content .= ' ' . $row->ins_company_name . ' ';
+ $content .= ' ';
+ $Head_Content = $row->ipd_code;
+ }
+
+ $content .= '';
+ $content .= ' ' . $row->inv_med_code . ' ';
+ $content .= ' ' . $row->inv_date_str . ' ';
+ $content .= ' ' . $row->IPD_Total_Amount . ' ';
+ $content .= '' . $row->bill_type . ' ';
+ $content .= ' ';
+ }
+
+ $i = $i + 1;
+ }
+
+ $content .= '
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medical');
+ }
+ }
+
+
+
+ public function purchase_invoice_report()
+ {
+ $sql = "select * from med_supplier order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Report/Purchase_Invoice', $data);
+ }
+
+ public function purchase_invoice_data($sale_date_range, $supplier_id, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and p.date_of_invoice between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if ($supplier_id > 0) {
+ $sql_where .= " and s.sid= '" . $supplier_id . "' ";
+ }
+
+ $sql = "select p.id,p.Invoice_no,p.date_of_invoice,p.sid,s.name_supplier,s.short_name,s.gst_no,
+ s.state,
+ sum(if(item_return=0,t.net_amount,t.net_amount*-1)) as tamount,count(t.id) as no_item,
+ p.Taxable_Amt,(p.CGST_Amt+p.SGST_Amt) as gst,
+
+ SUM(if(t.CGST_per=0,t.CGST,0)) AS CGST_per_0,
+ SUM(if(t.SGST_per=0,t.SGST,0)) AS SGST_per_0,
+ SUM(if(t.SGST_per=0,t.taxable_amount,0)) AS TotGST_per_0,
+
+ SUM(if(t.CGST_per=2.5,t.CGST,0)) AS CGST_per_2_5,
+ SUM(if(t.SGST_per=2.5,t.SGST,0)) AS SGST_per_2_5,
+ SUM(if(t.SGST_per=2.5,t.taxable_amount,0)) AS TotGST_per_5,
+
+ SUM(if(t.CGST_per=6,t.CGST,0)) AS CGST_per_6,
+ SUM(if(t.SGST_per=6,t.SGST,0)) AS SGST_per_6,
+ SUM(if(t.SGST_per=6,t.taxable_amount,0)) AS TotGST_per_12,
+
+ SUM(if(t.CGST_per=9,t.CGST,0)) AS CGST_per_9,
+ SUM(if(t.SGST_per=9,t.SGST,0)) AS SGST_per_9,
+ SUM(if(t.SGST_per=9,t.taxable_amount,0)) AS TotGST_per_18,
+
+ SUM(if(t.CGST_per=14,t.CGST,0)) AS CGST_per_14,
+ SUM(if(t.SGST_per=14,t.SGST,0)) AS SGST_per_14,
+ SUM(if(t.SGST_per=14,t.taxable_amount,0)) AS TotGST_per_28
+
+ from (purchase_invoice p join med_supplier s on p.sid=s.sid)
+ left join purchase_invoice_item t on p.id=t.purchase_id
+ where " . $sql_where . " and s.state='" . M_State . "' group by p.id order by s.state,p.id";
+
+ $query = $this->db->query($sql);
+ $pur_inv_total_local = $query->result();
+
+ $sql = "select p.id,p.Invoice_no,p.date_of_invoice,p.sid,s.name_supplier,s.short_name,s.gst_no,
+ s.state,
+ sum(if(item_return=0,t.net_amount,t.net_amount*-1)) as tamount,count(t.id) as no_item,
+ p.Taxable_Amt,(p.CGST_Amt+p.SGST_Amt) as gst,
+
+ SUM(if(t.CGST_per=0,t.CGST,0)) AS CGST_per_0,
+ SUM(if(t.SGST_per=0,t.SGST,0)) AS SGST_per_0,
+ SUM(if(t.SGST_per=0,t.taxable_amount,0)) AS TotGST_per_0,
+
+ SUM(if(t.CGST_per=2.5,t.CGST,0)) AS CGST_per_2_5,
+ SUM(if(t.SGST_per=2.5,t.SGST,0)) AS SGST_per_2_5,
+ SUM(if(t.SGST_per=2.5,t.taxable_amount,0)) AS TotGST_per_5,
+
+ SUM(if(t.CGST_per=6,t.CGST,0)) AS CGST_per_6,
+ SUM(if(t.SGST_per=6,t.SGST,0)) AS SGST_per_6,
+ SUM(if(t.SGST_per=6,t.taxable_amount,0)) AS TotGST_per_12,
+
+ SUM(if(t.CGST_per=9,t.CGST,0)) AS CGST_per_9,
+ SUM(if(t.SGST_per=9,t.SGST,0)) AS SGST_per_9,
+ SUM(if(t.SGST_per=9,t.taxable_amount,0)) AS TotGST_per_18,
+
+ SUM(if(t.CGST_per=14,t.CGST,0)) AS CGST_per_14,
+ SUM(if(t.SGST_per=14,t.SGST,0)) AS SGST_per_14,
+ SUM(if(t.SGST_per=14,t.taxable_amount,0)) AS TotGST_per_28
+
+ from (purchase_invoice p join med_supplier s on p.sid=s.sid)
+ left join purchase_invoice_item t on p.id=t.purchase_id
+ where " . $sql_where . " and s.state<>'" . M_State . "' group by p.id order by s.state,p.id";
+
+ $query = $this->db->query($sql);
+ $pur_inv_total_IGST = $query->result();
+
+
+ $xcontent_head = '';
+
+ $xcontent_head .= '
+ #
+ Invoice ID
+ Supplier
+ GST
+ State
+ Date
+ Amount
+ R Amount
+ GST
+ TotGST_per_0
+ CGST_per_0
+ SGST_per_0
+ TotGST_per_5
+ CGST_per_2_5
+ SGST_per_2_5
+ TotGST_per_12
+ CGST_per_6
+ SGST_per_6
+ TotGST_per_18
+ CGST_per_9
+ SGST_per_9
+ TotGST_per_28
+ CGST_per_14
+ SGST_per_14
+ ';
+
+ $sr_no = 0;
+ $tamt = 0;
+ $tramt = 0;
+ $tgst = 0;
+
+ $xcontent = '';
+
+ foreach ($pur_inv_total_local as $row) {
+ $sr_no = $sr_no + 1;
+ $tamt = $tamt + $row->tamount;
+ $tramt = $tramt + round($row->tamount);
+ $tgst = $tgst + round($row->gst);
+
+ $xcontent .= '
+ ' . $sr_no . '
+ ' . $row->Invoice_no . '
+ ' . $row->name_supplier . '
+ ' . $row->gst_no . '
+ ' . $row->state . '
+ ' . $row->date_of_invoice . '
+ ' . $row->tamount . '
+ ' . round($row->tamount) . '
+ ' . round($row->gst) . '
+ ' . round($row->TotGST_per_0) . '
+ ' . round($row->CGST_per_0) . '
+ ' . round($row->SGST_per_0) . '
+ ' . round($row->TotGST_per_5) . '
+ ' . round($row->CGST_per_2_5) . '
+ ' . round($row->SGST_per_2_5) . '
+ ' . round($row->TotGST_per_12) . '
+ ' . round($row->CGST_per_6) . '
+ ' . round($row->SGST_per_6) . '
+ ' . round($row->TotGST_per_18) . '
+ ' . round($row->CGST_per_9) . '
+ ' . round($row->SGST_per_9) . '
+ ' . round($row->TotGST_per_28) . '
+ ' . round($row->CGST_per_14) . '
+ ' . round($row->SGST_per_14) . '
+ ';
+ }
+
+ $xcontent_total = '
+
+
+ #
+
+
+
+
+ Total
+ ' . $tamt . '
+ ' . $tramt . '
+ ' . $tgst . '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
';
+
+ $SGST_Purchase_List = $xcontent_head . $xcontent . $xcontent_total;
+
+ //IGST Record
+
+ $content = '';
+
+
+ $xcontent_head = '
+
+
+ #
+ Invoice ID
+ Supplier
+ GST
+ State
+ Date
+ Amount
+ R Amount
+ GST
+ TotGST_per_0
+ CGST_per_0
+ IGST_per_0
+ TotGST_per_5
+ CGST_per_2_5
+ IGST_per_2_5
+ TotGST_per_12
+ CGST_per_6
+ IGST_per_6
+ TotGST_per_18
+ CGST_per_9
+ IGST_per_9
+ TotGST_per_28
+ CGST_per_14
+ IGST_per_14
+ ';
+ $sr_no = 0;
+ $tamt = 0;
+ $tramt = 0;
+ $tgst = 0;
+
+ $xcontent = '';
+
+ foreach ($pur_inv_total_IGST as $row) {
+ $sr_no = $sr_no + 1;
+ $tamt = $tamt + $row->tamount;
+ $tramt = $tramt + round($row->tamount);
+ $tgst = $tgst + round($row->gst);
+
+ $xcontent .= '
+ ' . $sr_no . '
+ ' . $row->Invoice_no . '
+ ' . $row->name_supplier . '
+ ' . $row->gst_no . '
+ ' . $row->state . '
+ ' . $row->date_of_invoice . '
+ ' . $row->tamount . '
+ ' . round($row->tamount) . '
+ ' . round($row->gst) . '
+ ' . round($row->TotGST_per_0) . '
+ ' . round($row->CGST_per_0) . '
+ ' . round($row->SGST_per_0) . '
+ ' . round($row->TotGST_per_5) . '
+ ' . round($row->CGST_per_2_5) . '
+ ' . round($row->SGST_per_2_5) . '
+ ' . round($row->TotGST_per_12) . '
+ ' . round($row->CGST_per_6) . '
+ ' . round($row->SGST_per_6) . '
+ ' . round($row->TotGST_per_18) . '
+ ' . round($row->CGST_per_9) . '
+ ' . round($row->SGST_per_9) . '
+ ' . round($row->TotGST_per_28) . '
+ ' . round($row->CGST_per_14) . '
+ ' . round($row->SGST_per_14) . '
+ ';
+ }
+
+ $xcontent_total = '
+
+
+ #
+
+
+
+
+ Total
+ ' . $tamt . '
+ ' . $tramt . '
+ ' . $tgst . '
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
';
+
+ $IGST_Purchase_List = $xcontent_head . $xcontent . $xcontent_total;
+
+ $final_content = $SGST_Purchase_List;
+
+ if (count($pur_inv_total_IGST) > 0) {
+ $final_content .= "";
+ $final_content .= $IGST_Purchase_List;
+ }
+
+ //echo $content;
+ if ($output == 0) {
+ create_report_pdf_landscape($final_content, 'Med_Invoice');
+ } else {
+ ExportExcel($final_content, 'Report_Medical');
+ }
+ }
+
+ public function purchase_invoice_data_pdf($sale_date_range, $supplier_id, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and p.date_of_invoice between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if ($supplier_id > 0) {
+ $sql_where .= " and s.sid= '" . $supplier_id . "' ";
+ }
+
+ $sql = "select p.id,trim(s.name_supplier) AS name_supplier,p.sid,p.Invoice_no,
+ date_format(p.date_of_invoice,'%d-%m-%Y')AS str_date_of_invoice,
+ p.date_of_invoice, s.short_name,s.gst_no,s.state,
+ SUM(round(p.T_Net_Amount)) as tamount,
+ sum(p.Taxable_Amt) AS Taxable_Amt,
+ SUM(p.CGST_Amt+p.SGST_Amt) as gst
+
+ from (purchase_invoice p join med_supplier s on p.sid=s.sid)
+ where " . $sql_where . " group by trim(s.name_supplier),p.date_of_invoice,p.id WITH rollup";
+
+ $query = $this->db->query($sql);
+ $pur_inv_total = $query->result();
+ $content = '';
+
+ //$content=$sql;
+
+ $content .= '';
+
+ $xcontent_head = '';
+
+ $head_content = "";
+ $Total_Amount_Round = 0;
+ $Total_Grand_Amount_Round = 0;
+
+ foreach ($pur_inv_total as $row) {
+
+ if ($row->id != '' && $row->name_supplier != '' && $row->date_of_invoice != '') {
+ if ($head_content != $row->name_supplier) {
+ $sr_no = 0;
+ $Total_Amount_Round = 0;
+ $content .= '
+ _
+ ';
+ $content .= '
+ ' . $row->name_supplier . ' / GST No. ' . $row->gst_no . ' / State : ' . $row->state . '
+ ';
+ $content .= '
+
+ #
+ Purchase. Inv. ID
+ Inv. Date
+ Taxable Amt
+ Tax Amt
+ Inv. Amount
+ ';
+ }
+ $sr_no = $sr_no + 1;
+
+ $content .= '
+
+ ' . $sr_no . '
+ ' . $row->Invoice_no . '
+ ' . $row->str_date_of_invoice . '
+ ' . $row->Taxable_Amt . '
+ ' . $row->gst . '
+ ' . $row->tamount . '
+ ';
+ } elseif ($row->id == '' && $row->name_supplier == '' && $row->date_of_invoice == '') {
+ $content .= '
+
+ #
+
+ Grand Total
+ ' . $row->Taxable_Amt . '
+ ' . $row->gst . '
+ ' . $row->tamount . '
+ ';
+ } elseif ($row->id == '' && $row->date_of_invoice == '') {
+ $content .= '
+
+ #
+ Total of : ' . $row->name_supplier . '
+ ' . $row->Taxable_Amt . '
+ ' . $row->gst . '
+ ' . $row->tamount . '
+ ';
+ }
+
+ $head_content = $row->name_supplier;
+ }
+
+ $content .= '
';
+
+ //echo $content;
+ if ($output == 0) {
+ $this->load->library('m_pdf');
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+ $filepath = $file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medical');
+ }
+ }
+
+ public function purchase_invoice_data_gsr_rate_pdf($sale_date_range, $supplier_id, $output = 0)
+ {
+ $sql_where = " 1=1 ";
+
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where .= " and m.date_of_invoice between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if ($supplier_id > 0) {
+ $sql_where .= " and s.sid= '" . $supplier_id . "' ";
+ }
+
+ $sql = "SELECT m.id,m.supp_name,m.date_of_invoice,m.Invoice_no,s.name_supplier,s.sid,
+ s.short_name,s.gst_no,s.state,
+ t.CGST_per,sum(t.qty) as t_qty,
+ sum(t.CGST) as TCGST,
+ t.SGST_per,
+ sum(t.SGST) as TSGST,
+ sum(t.CGST+t.SGST) as TGST,
+ SUM(t.taxable_amount) as TaxableAmount,
+ SUM(t.net_amount) as Amount
+ FROM (purchase_invoice m join purchase_invoice_item t
+ ON m.id=t.purchase_id)
+ JOIN med_supplier s ON m.sid=s.sid
+ where " . $sql_where . " group BY s.sid,m.id,t.CGST_per with ROLLUP";
+
+
+ $query = $this->db->query($sql);
+ $pur_inv_total = $query->result();
+ $content = '';
+
+ //$content=$sql;
+
+ $content .= '';
+
+ $xcontent_head = '';
+
+ $head_content = "";
+ $Total_Amount_Round = 0;
+ $Total_Grand_Amount_Round = 0;
+
+ foreach ($pur_inv_total as $row) {
+
+ if ($row->id != '' && $row->name_supplier != '' && $row->date_of_invoice != '') {
+ if ($head_content != $row->name_supplier) {
+ $sr_no = 0;
+ $Total_Amount_Round = 0;
+ $content .= '
+ _
+ ';
+ $content .= '
+ ' . $row->name_supplier . ' / GST No. ' . $row->gst_no . ' / State : ' . $row->state . '
+ ';
+ $content .= '
+
+ #
+ Purchase. Inv. ID
+ Inv. Date
+ Taxable Amt
+ Tax Amt
+ Inv. Amount
+ ';
+ }
+ $sr_no = $sr_no + 1;
+
+ $content .= '
+
+ ' . $sr_no . '
+ ' . $row->Invoice_no . '
+ ' . $row->str_date_of_invoice . '
+ ' . $row->Taxable_Amt . '
+ ' . $row->gst . '
+ ' . $row->tamount . '
+ ';
+ } elseif ($row->id == '' && $row->name_supplier == '' && $row->date_of_invoice == '') {
+ $content .= '
+
+ #
+
+ Grand Total
+ ' . $row->Taxable_Amt . '
+ ' . $row->gst . '
+ ' . $row->tamount . '
+ ';
+ } elseif ($row->id == '' && $row->date_of_invoice == '') {
+ $content .= '
+
+ #
+ Total of : ' . $row->name_supplier . '
+ ' . $row->Taxable_Amt . '
+ ' . $row->gst . '
+ ' . $row->tamount . '
+ ';
+ }
+
+ $head_content = $row->name_supplier;
+ }
+
+ $content .= '
';
+
+ //echo $content;
+ if ($output == 0) {
+ $this->load->library('m_pdf');
+
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+ $filepath = $file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medical');
+ }
+ }
+
+ //GST Report
+
+ public function Report_5()
+ {
+ $this->load->view('Medical/Report/Med_Report_5');
+ }
+
+ public function Report_5_data($sale_date_range, $output = 0)
+ {
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ $where .= " and m.net_amount>0 ";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $where .= " and date(m.inv_date) >=date(date_add(sysdate(),interval -2 day))";
+ }
+
+
+ $sql = "select m.inv_med_code,Date_Format(m.inv_date,'%d-%m-%Y') as Inv_Date,m.inv_name,
+ get_med_type(m.ipd_id,m.ipd_credit,m.ipd_credit_type,m.case_id,m.case_credit) as Invoice_type,
+ m.ipd_code,p.p_code,o.case_id_code,
+ count(i.id) as No_of_Items,
+ sum(i.qty) as No_of_Qty,
+
+ round(sum(i.twdisc_amount),0) as Total_Amount,
+
+ round(sum(if(i.CGST_per=2.5,i.TaxableAmount,0)),0) as Sale_5_Amount,
+ sum(if(i.CGST_per=2.5,i.CGST,0)) as CGST_2_5,
+ sum(if(i.CGST_per=2.5,i.SGST,0)) as SGST_2_5,
+
+ round(sum(if(i.CGST_per=5,i.TaxableAmount,0)),0) as Sale_10_Amount,
+ sum(if(i.CGST_per=5,i.CGST,0)) as CGST_5,
+ sum(if(i.CGST_per=5,i.SGST,0)) as SGST_5,
+
+ round(sum(if(i.CGST_per=6,i.TaxableAmount,0)),0) as Sale_12_Amount,
+ sum(if(i.CGST_per=6,i.CGST,0)) as CGST_6,
+ sum(if(i.CGST_per=6,i.SGST,0)) as SGST_6,
+
+ round(sum(if(i.CGST_per=9,i.TaxableAmount,0)),0) as Sale_18_Amount,
+ sum(if(i.CGST_per=9,i.CGST,0)) as CGST_9,
+ sum(if(i.CGST_per=9,i.SGST,0)) as SGST_9,
+
+ round(sum(if(i.CGST_per=14,i.TaxableAmount,0)),0) as Sale_28_Amount,
+ sum(if(i.CGST_per=14,i.CGST,0)) as CGST_14,
+ sum(if(i.CGST_per=14,i.SGST,0)) as SGST_14,
+
+ round(sum(if(i.CGST_per=0,i.TaxableAmount,0)),0) as Sale_0_Amount,
+
+ sum(i.TaxableAmount) as Total_TaxableAmount
+
+ from ((invoice_med_master m join inv_med_item i on m.id=i.inv_med_id)
+ left join patient_master p on m.patient_id=p.id)
+ left join organization_case_master o on m.case_id=o.id
+ where " . $where . " group by m.id ";
+
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ //echo $sql;
+
+ $content = '
+
+ Invoice ID
+ Inv.Date
+ inv.Name
+ Invoice Type
+ Qty
+ Tot.Amt.
+ Tot.Tax.Amt
+ Tax.Amt.5%
+ CGST 2.5%
+ SCGT 2.5%
+ Tax.Amt.12%
+ CGST 6%
+ SCGT 6%
+ Tax.Amt.18%
+ CGST 9%
+ SCGT 9%
+ Tax.Amt.28%
+ CGST 14%
+ SCGT 14%
+ Tax.Amt.0%
+ ';
+
+ $Head_Content = "";
+ foreach ($stock_list as $row) {
+ $content .= '';
+ $content .= ' ' . $row->inv_med_code . ' ';
+ $content .= ' ' . $row->Inv_Date . ' ';
+ $content .= ' ' . $row->inv_name . ' ';
+ $content .= ' ' . $row->Invoice_type . ' ';
+ $content .= ' ' . $row->No_of_Qty . ' ';
+ $content .= ' ' . $row->Total_Amount . ' ';
+ $content .= ' ' . $row->Total_TaxableAmount . ' ';
+ $content .= ' ' . $row->Sale_5_Amount . ' ';
+ $content .= ' ' . $row->CGST_2_5 . ' ';
+ $content .= ' ' . $row->SGST_2_5 . ' ';
+ $content .= ' ' . $row->Sale_12_Amount . ' ';
+ $content .= ' ' . $row->CGST_6 . ' ';
+ $content .= ' ' . $row->SGST_6 . ' ';
+ $content .= ' ' . $row->Sale_18_Amount . ' ';
+ $content .= ' ' . $row->CGST_9 . ' ';
+ $content .= ' ' . $row->SGST_9 . ' ';
+ $content .= ' ' . $row->Sale_28_Amount . ' ';
+ $content .= ' ' . $row->CGST_14 . ' ';
+ $content .= ' ' . $row->SGST_14 . ' ';
+ $content .= ' ' . $row->Sale_0_Amount . ' ';
+ $content .= ' ';
+ }
+
+ $content .= '
';
+
+ ExportExcel($content, 'Report_Medical_gst_invoice');
+ }
+
+
+
+ public function Report_5_HSNdata($sale_date_range, $output = 0)
+ {
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ //$where .= " and m.net_amount>0 ";
+
+ if (!$this->ion_auth->in_group('MedOLDRec')) {
+ $where .= " and date(m.inv_date) >=date(date_add(sysdate(),interval -2 day))";
+ }
+
+
+ $sql = "select Left(i.HSNCODE," . M_HSNCODE_LEN . ") as HSNCODE,
+ count(i.id) as No_of_Items,
+ sum(i.qty) as No_of_Qty,
+ i.CGST_per ,
+ sum(i.twdisc_amount) as Total_Amount,
+
+ round(sum(if(i.CGST_per=2.5,i.TaxableAmount,0)),0) as Sale_5_Amount,
+ sum(if(i.CGST_per=2.5,i.CGST,0)) as CGST_2_5,
+ sum(if(i.CGST_per=2.5,i.SGST,0)) as SGST_2_5,
+
+ round(sum(if(i.CGST_per=5,i.TaxableAmount,0)),0) as Sale_10_Amount,
+ sum(if(i.CGST_per=5,i.CGST,0)) as CGST_5,
+ sum(if(i.CGST_per=5,i.SGST,0)) as SGST_5,
+
+ round(sum(if(i.CGST_per=6,i.TaxableAmount,0)),0) as Sale_12_Amount,
+ sum(if(i.CGST_per=6,i.CGST,0)) as CGST_6,
+ sum(if(i.CGST_per=6,i.SGST,0)) as SGST_6,
+
+ round(sum(if(i.CGST_per=9,i.TaxableAmount,0)),0) as Sale_18_Amount,
+ sum(if(i.CGST_per=9,i.CGST,0)) as CGST_9,
+ sum(if(i.CGST_per=9,i.SGST,0)) as SGST_9,
+
+ round(sum(if(i.CGST_per=14,i.TaxableAmount,0)),0) as Sale_28_Amount,
+ sum(if(i.CGST_per=14,i.CGST,0)) as CGST_14,
+ sum(if(i.CGST_per=14,i.SGST,0)) as SGST_14,
+
+ round(sum(if(i.CGST_per=0,i.TaxableAmount,0)),0) as Sale_0_Amount,
+
+ sum(i.TaxableAmount) as Total_TaxableAmount
+
+ from ((invoice_med_master m join inv_med_item i on m.id=i.inv_med_id)
+ left join patient_master p on m.patient_id=p.id)
+ left join organization_case_master o on m.case_id=o.id
+ where " . $where . " group by Left(i.HSNCODE," . M_HSNCODE_LEN . ") ,i.CGST_per ";
+
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ //echo $sql;
+
+ $content = '
+
+ HSN Code
+ Item Qty
+ Tax Per.
+ Tot.Amt.
+ Tot.Tax.Amt
+ Tax.Amt.5%
+ CGST 2.5%
+ SCGT 2.5%
+ Tax.Amt.12%
+ CGST 6%
+ SCGT 6%
+ Tax.Amt.18%
+ CGST 9%
+ SCGT 9%
+ Tax.Amt.28%
+ CGST 14%
+ SCGT 14%
+ Tax.Amt.0%
+ ';
+
+ $Head_Content = "";
+ foreach ($stock_list as $row) {
+ $content .= '';
+ $content .= ' ' . $row->HSNCODE . ' ';
+ $content .= ' ' . $row->No_of_Qty . ' ';
+ $content .= ' ' . $row->CGST_per . ' ';
+ $content .= ' ' . $row->Total_Amount . ' ';
+ $content .= ' ' . $row->Total_TaxableAmount . ' ';
+ $content .= ' ' . $row->Sale_5_Amount . ' ';
+ $content .= ' ' . $row->CGST_2_5 . ' ';
+ $content .= ' ' . $row->SGST_2_5 . ' ';
+ $content .= ' ' . $row->Sale_12_Amount . ' ';
+ $content .= ' ' . $row->CGST_6 . ' ';
+ $content .= ' ' . $row->SGST_6 . ' ';
+ $content .= ' ' . $row->Sale_18_Amount . ' ';
+ $content .= ' ' . $row->CGST_9 . ' ';
+ $content .= ' ' . $row->SGST_9 . ' ';
+ $content .= ' ' . $row->Sale_28_Amount . ' ';
+ $content .= ' ' . $row->CGST_14 . ' ';
+ $content .= ' ' . $row->SGST_14 . ' ';
+ $content .= ' ' . $row->Sale_0_Amount . ' ';
+ $content .= ' ';
+ }
+
+ $content .= '
';
+
+ ExportExcel($content, 'Report_Medical_gst_hsn');
+ }
+
+
+ //Bank Ledger Account
+
+ public function Report_7()
+ {
+ $sql = "select * from med_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $sql = "select * from bank_account_master";
+ $query = $this->db->query($sql);
+ $data['bank_account_data'] = $query->result();
+
+ $this->load->view('Medical/Report/Med_Report_7', $data);
+ }
+
+ public function Report_7_data($sale_date_range, $supplier_id, $account_id, $output = 0)
+ {
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " l.tran_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id ";
+ }
+
+ if ($account_id > 0) {
+ $where .= " and b.bank_id=$account_id ";
+ }
+
+ $sql = "SELECT b.bank_account_name,m.name_supplier,
+ l.tran_date,l.credit_debit,l.tran_desc,
+ Date_Format(l.tran_date,'%d-%m-%Y') as tran_date_str,
+ if(l.credit_debit=0,l.amount,0) AS cr_amt,
+ if(l.credit_debit=1,l.amount,0) AS dr_amt,l.id
+ FROM (bank_account_master b JOIN med_supplier_ledger l
+ ON l.bank_id=b.bank_id AND b.bank_id>1)
+ JOIN med_supplier m ON l.supplier_id=m.sid
+ where " . $where . " order by l.tran_date, l.id ";
+
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ //echo $sql;
+
+ $content = '
+
+ Led. ID
+ Date
+ Bank/Cash
+ Ledger
+ Cr.Amt.
+ Dr.Amt
+ ';
+
+ $Head_Content = "";
+ $total_cr_amt = 0;
+ $total_dr_amt = 0;
+
+ foreach ($stock_list as $row) {
+ $content .= '';
+ $content .= ' ' . $row->id . ' ';
+ $content .= ' ' . $row->tran_date_str . ' ';
+ $content .= ' ' . $row->bank_account_name . ' ';
+ $content .= ' ' . $row->name_supplier . ' ';
+ $content .= ' ' . $row->cr_amt . ' ';
+ $content .= ' ' . $row->dr_amt . ' ';
+ $content .= ' ';
+ $total_cr_amt += $row->cr_amt;
+ $total_dr_amt += $row->dr_amt;
+ }
+
+ $content .= '';
+ $content .= ' ';
+ $content .= ' ';
+ $content .= ' ';
+ $content .= ' Total ';
+ $content .= ' ' . $total_cr_amt . ' ';
+ $content .= ' ' . $total_dr_amt . ' ';
+ $content .= ' ';
+
+ $content .= '
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ $file_name = 'Report_Medical_Ledger_' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medical_Ledger_' . date('d-m-Y'));
+ }
+ }
+
+ //Lost Medicine Data
+
+ public function Lost_medicine()
+ {
+ $this->load->view('Medical/Stock/Lost_medicine');
+ }
+
+ public function Lost_medicine_data($sale_date_range, $output = 0)
+ {
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " a.date_of_adjust between '" . $minRange . "' and '" . $maxRange . "'";
+
+
+ $sql = "SELECT a.id,Date_Format(a.date_of_adjust,'%d-%m-%Y') as adjust_date_str,a.update_by,
+ i.item_code,i.Item_name,a.qty,
+ i.packing,i.purchase_price,i.purchase_unit_rate,(i.purchase_unit_rate*a.qty) AS cost,
+ (i.selling_unit_rate*a.qty) AS sale_value
+ FROM purchase_item_stock_adjust a JOIN purchase_invoice_item i ON a.item_id=i.id
+ where " . $where . " order by a.date_of_adjust, a.id ";
+
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ //echo $sql;
+
+ $content = '
+
+ ID
+ Date
+ Item Name
+ Qty
+ Cost
+ Sale Value
+ ';
+
+ $Head_Content = "";
+ $total_cost = 0;
+ $total_sale_value = 0;
+
+ foreach ($stock_list as $row) {
+ $content .= '';
+ $content .= ' ' . $row->id . ' ';
+ $content .= ' ' . $row->adjust_date_str . ' ';
+ $content .= ' ' . $row->Item_name . ' ';
+ $content .= ' ' . $row->qty . ' ';
+ $content .= ' ' . $row->cost . ' ';
+ $content .= ' ' . $row->sale_value . ' ';
+ $content .= ' ';
+ $total_cost += $row->cost;
+ $total_sale_value += $row->sale_value;
+ }
+
+ $content .= '';
+ $content .= ' ';
+ $content .= ' ';
+ $content .= ' ';
+ $content .= ' Total ';
+ $content .= ' ' . $total_cost . ' ';
+ $content .= ' ' . $total_sale_value . ' ';
+ $content .= ' ';
+
+ $content .= '
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ $file_name = 'Report_Medicine_Lost_' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medicine_Lost_' . date('d-m-Y'));
+ }
+ }
+
+
+ //Short Medicine Data
+
+ public function Short_medicine()
+ {
+ $sql = "select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation'] = $query->result();
+
+ $this->load->view('Medical/Stock/Short_medicine', $data);
+ }
+
+ public function Short_medicine_data($sale_date_range, $formulation, $output = 0)
+ {
+ $rangeArray = explode("S", $sale_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $formulation_list = str_replace("S", ",", $formulation);
+
+ $content = "";
+
+ $where = " s.short_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if ($formulation_list <> '0') {
+ $where .= " and m.formulation_id in (" . $formulation_list . ")";
+ }
+
+ $sql = "SELECT s.id,s.item_Name,s.curQty,m.formulation,
+ date_format(s.short_date,'%d-%m-%Y') as str_short_date,
+ s.supplier_name
+ FROM med_short_list s join med_product_master m on s.item_code=m.id
+ where " . $where . " order by short_date desc ";
+
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ //$content.=$sql;
+
+ $content .= '
+
+ ID
+ Date
+ Item Name
+ Formulation
+ Qty
+ Supplier
+ ';
+
+ foreach ($stock_list as $row) {
+ $content .= '';
+ $content .= ' ' . $row->id . ' ';
+ $content .= ' ' . $row->str_short_date . ' ';
+ $content .= ' ' . $row->item_Name . ' ';
+ $content .= ' ' . $row->formulation . ' ';
+ $content .= ' ' . Round($row->curQty) . ' ';
+ $content .= ' ' . $row->supplier_name . ' ';
+
+ $content .= ' ';
+ }
+
+ $content .= '
';
+
+ if ($output == 0) {
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ $file_name = 'Report_Medicine_Short_' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medicine_Lost_' . date('d-m-Y'));
+ }
+ }
+
+ public function Report_gst_1()
+ {
+ $this->load->view('Medical/Report/Report_gst_1');
+ }
+}
diff --git a/old_code_ci3/controllers/Medical_app.php b/old_code_ci3/controllers/Medical_app.php
new file mode 100644
index 0000000..f264b73
--- /dev/null
+++ b/old_code_ci3/controllers/Medical_app.php
@@ -0,0 +1,453 @@
+load->database();
+ //$this->load->helper(array('cookie','url','language'));
+
+ // Load form helper library
+ //$this->load->helper('form');
+
+ // Load form validation library
+ //$this->load->library('form_validation');
+
+ // Load session library
+ //$this->load->library('session');
+
+ $this->load->helper('security');
+
+ }
+
+ public function index()
+ {
+ $this->load->view('Medical_app/index');
+ }
+
+ public function load_dash()
+ {
+ $session_data = $this->session->userdata();
+ print_r($session_data);
+ if($session_data['u_id']=='')
+ {
+ redirect('Medical_app/select_user_login');
+ }else{
+ $this->load->view('Medical_app/dash_main');
+ }
+ }
+
+ public function select_user_login()
+ {
+ $sql="select *
+ from users
+ where active=1 and medical_app=1";
+ $query = $this->db->query($sql);
+
+ $data['user_data']= $query->result();
+
+ $this->load->view('Medical_app/select_doctor',$data);
+ }
+
+ public function login($user_id=0)
+ {
+ // Retrieve session data
+ $session_set_value = $this->session->userdata();
+
+ $data['user_id'] = $user_id;
+
+ $sql="select *
+ from users
+ where active=1 and id=$user_id and medical_app=1 ";
+ $query = $this->db->query($sql);
+ $data['user_data_profile']= $query->result();
+
+ // Check for remember_me data in retrieved session data
+ if (isset($session_set_value['remember_me']) && $session_set_value['remember_me'] == "1") {
+ //$this->load->view('admin_page');
+ $this->load->view('Mobile_app/dash_main',$data);
+ } else {
+
+ // Check for validation
+ $this->form_validation->set_rules('password', 'Pin Number', 'trim|required|xss_clean');
+
+ if ($this->form_validation->run() == FALSE) {
+ //$this->load->view('login_form');
+ $this->load->view('Medical_app/login',$data);
+ } else {
+ $username = $user_id;
+ $password = $this->input->post('password');
+
+ $sql = "SELECT *
+ FROM users
+ WHERE id=$username and login_pin='$password' and medical_app=1";
+
+ $query = $this->db->query($sql);
+ $data_login= $query->result();
+
+ if (count($data_login)>0) {
+ $this->session->set_userdata('remember_me', TRUE);
+
+ $session_data = array(
+ 'p_fname'=> $data_login[0]->first_name,
+ 'p_mname'=> $data_login[0]->last_name,
+ 'u_id' => $data_login[0]->id,
+ 'username' => $username,
+ 'password' => $password
+ );
+
+ $this->session->set_userdata($session_data);
+
+ $data['user'] = 1;
+ $this->load->view('Medical_app/dash_main',$data);
+
+ } else {
+ $data['error_message'] = 'Invalid Pin';
+
+ $this->load->view('Medical_app/login', $data);
+ }
+ }
+ }
+ }
+
+ public function logout()
+ {
+ // Destroy session data
+ $this->session->sess_destroy();
+ $data['message_display'] = 'Successfully Logout';
+ redirect('Mobile_app/select_user_login');
+ }
+
+
+ //Customer Search
+ function patient_index_all()
+ {
+ $data['_view'] = '';
+
+ $this->load->view('Mobile_app/patient_page',$data);
+ }
+
+ function patient_index($day=0,$doc_id=0)
+ {
+ if($doc_id==0)
+ {
+ $where="";
+ }else{
+ $where=" and o.doc_id = ".$doc_id;
+ }
+
+ if($day>=0){
+ $where_date=" and date(o.opd_book_date) = DATE_ADD(CURDATE(),INTERVAL -".$day." DAY)";
+ }
+
+ $sql = "SELECT p.*,Date_Format(o.last_opdvisit_date,'%d-%m-%Y %H:%i') AS last_date_visit,
+ o.*,
+ if(date(o.opd_book_date)=curdate(),1,0) as opd_today
+ FROM (patient_master_exten p
+ JOIN opd_master o ON p.id=o.p_id)
+ WHERE 1=1 $where_date $where
+ Group by p.id
+ order by o.opd_id desc";
+
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $data['doc_id']=$doc_id;
+ $data['day']=$day;
+
+ $data['sql']= $sql;
+
+ $data['_view'] = 'Mobile_app/patient_search_v';
+
+ $this->load->view('Mobile_app/patient_page',$data);
+ }
+
+ function patient_search()
+ {
+ $doc_id=$this->input->post('doc_id');
+ $day=$this->input->post('day');
+ $sdata=$this->input->post('data_search');
+
+ $where="1=1 ";
+
+ if($doc_id==0)
+ {
+ $where.="";
+ }else{
+ $where.=" and o.doc_id = ".$doc_id;
+ }
+
+ if($day>=0){
+ $where_date=" and date(o.opd_book_date) = DATE_ADD(CURDATE(),INTERVAL -".$day." DAY)";
+ }else{
+ $where_date="";
+ }
+
+ $sdata = preg_replace('/[^A-Za-z0-9 _\-]/', '', trim($sdata));
+
+ if(is_numeric($sdata))
+ {
+ $where.=" and (mphone1 = '".$sdata."' or udai='".$sdata."' or p_code like '%".$sdata."')" ;
+ }elseif (filter_var($sdata, FILTER_VALIDATE_EMAIL)) {
+ $where.=" email1 = '".$sdata."'" ;
+ }else{
+ $where.=" and (p_fname like '%".$sdata."%' or
+ SUBSTRING_INDEX(p_fname,' ',1) sounds like '".$sdata."')";
+ }
+
+ $sql = "SELECT p.*,Date_Format(o.last_opdvisit_date,'%d-%m-%Y %H:%i') AS last_date_visit,
+ o.*,
+ if(date(o.opd_book_date)=curdate(),1,0) as opd_today
+ FROM (patient_master_exten p
+ JOIN opd_master o ON p.id=o.p_id)
+ WHERE ".$where." ".$where_date."
+ order by o.opd_id desc ";
+
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $data['sql']= $sql;
+
+ $this->load->view('Mobile_app/patient_search_v',$data);
+
+
+
+ }
+
+ function patient_index_opd()
+ {
+ if (isset($_POST['search'])){
+
+ $doc_id=$this->input->post('doc_id');
+ $day=$this->input->post('day');
+ $sdata=$this->input->post('search');
+
+ if($doc_id==0)
+ {
+ $where="1=1 ";
+ }else{
+ $where=" o.doc_id = ".$doc_id;
+ }
+
+ if($day>=0){
+ $where_date=" and date(o.opd_book_date) = DATE_ADD(CURDATE(),INTERVAL -".$day." DAY)";
+ }else{
+ $where_date=" and date(o.opd_book_date) > DATE_ADD(CURDATE(),INTERVAL -180 DAY)";
+ }
+
+ $sdata = preg_replace('/[^A-Za-z0-9 _\-]/', '', trim($sdata));
+
+ if(is_numeric($sdata))
+ {
+ $where.=" and (mphone1 = '".$sdata."' or udai='".$sdata."' or p_code like '%".$sdata."')" ;
+ }elseif (filter_var($sdata, FILTER_VALIDATE_EMAIL)) {
+ $where.=" and email1 = '".$sdata."'" ;
+ }else{
+ $where.=" and (p_fname like '%".$sdata."%' or
+ SUBSTRING_INDEX(p_fname,' ',1) sounds like '".$sdata."')";
+ }
+
+ $sql = "SELECT p.*,Date_Format(p.last_visit,'%d-%m-%Y %H:%i') AS last_date_visit,
+ o.doc_name,
+ if(date(o.opd_book_date)=curdate(),1,0) as opd_today
+ FROM (patient_master_exten p
+ JOIN opd_master o ON p.id=o.p_id)
+ WHERE ".$where." ".$where_date." Group by p.id
+ order by o.opd_id desc ";
+
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ //$data['sql']= $sql;
+
+ $content=$this->load->view('Medical_app/ipd_panel_sub',$data,TRUE);
+
+ echo $content;
+ echo $sql;
+
+ }
+ }
+
+
+ function person_record($pno)
+ {
+ $sql="select * from patient_master_exten where id=".$pno;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date
+ from opd_master where p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['opd_List']= $query->result();
+
+ $sql="select m.id,m.invoice_code,Date_Format(m.inv_date,'%d-%m-%y') as str_inv_date,m.inv_name,
+ if(count(t.id)>0,group_concat(t.item_name SEPARATOR ' / '),'No-Item') as Item_List, m.net_amount,m.invoice_status
+ from invoice_master m left join invoice_item t on m.id=t.inv_master_id
+ where attach_type=0 and attach_id=".$pno." group by m.id order by m.id desc";
+ $query = $this->db->query($sql);
+ $data['invoice_list']= $query->result();
+
+ $sql="select i.*,m.ins_company_name,m.opd_allowed,m.charge_cash
+ from hc_insurance_card i join hc_insurance m on i.insurance_id=m.id
+ where m.active=1 and i.p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['data_insurance_card']= $query->result();
+
+ $sql="select *,Date_Format(date_registration,'%d-%m-%Y') as str_date_registration from organization_case_master where status=0 and p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from file_upload_data where id=".$data['data'][0]->profile_file_id;
+ $query = $this->db->query($sql);
+ $file_data= $query->result();
+
+ $profile_file_path="/assets/images/no_image.jpg";
+
+ if(count($file_data)>0)
+ {
+ $pos=strpos($file_data[0]->full_path,'/uploads/',1) ;
+ $profile_file_path=substr($file_data[0]->full_path,$pos);
+ }
+
+ $data['profile_file_path']=$profile_file_path;
+
+ $sql="select * from file_upload_data where pid=".$pno." order by id desc";
+ $query = $this->db->query($sql);
+ $data['opd_file_list']= $query->result();
+
+ $this->load->view('Mobile_app/patient_opd_profile',$data);
+
+ }
+
+
+ public function show_profile_opd($p_id)
+ {
+ $data['p_id']=$p_id;
+
+ $sql="select * from patient_master_exten where id=".$p_id;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select o.* from opd_master o where o.p_id=$p_id order by o.opd_id desc";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select o.* from opd_master o where o.p_id=$p_id and date(o.apointment_date)=curdate()";
+ $query = $this->db->query($sql);
+ $data['opd_master_current']= $query->result();
+
+ $this->load->view('Mobile_app/person_file_show',$data);
+ }
+
+ public function take_opd_picture($opd_id,$pno)
+ {
+ $data['opd_id']=$opd_id;
+ $data['pno']=$pno;
+
+ $sql="select * from patient_master_exten where id=".$pno;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select o.* from opd_master o where o.opd_id=$opd_id";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+
+ $this->load->view('Mobile_app/opd_scan',$data);
+ }
+
+ //IPD Panel
+
+ public function ipd_panel()
+ {
+ $sql="SELECT i.*,p.p_fname,p.str_age,p.xgender,
+ date_format(i.register_date,'%d-%m-%Y') AS admit_dt,
+ DATE_FORMAT(i.discharge_date,'%d-%m-%Y') AS discharge_dt,
+ m.gross_amount,m.discount_group,m.discount_group_2,m.net_amount,m.payment_received,
+ if(m.med_type>1,'TPA','CASH') AS pay_type,m.payment_balance
+ FROM (inv_med_group m JOIN ipd_master i ON m.ipd_id=i.id)
+ JOIN patient_master_exten p ON i.p_id=p.id
+ WHERE i.ipd_status=0 AND m.net_amount>0" ;
+
+ $query = $this->db->query($sql);
+ $data['ipd_data']= $query->result();
+
+ $this->load->view('Medical_app/ipd_panel',$data);
+ }
+
+ public function ipd_panel_search()
+ {
+ $this->load->view('Medical_app/ipd_panel_search');
+ }
+
+ public function ipd_panel_search_data($search_text='',$pay_type=1)
+ {
+ $sdata=$this->input->post('data_search');
+
+ $where="1=1 ";
+
+ if(is_numeric($sdata))
+ {
+ $where.=" and (p.mphone1 = '".$sdata."' or p.udai='".$sdata."' or p.p_code like '%".$sdata."' or i.ipd_code like '%".$sdata."')" ;
+ }elseif (filter_var($sdata, FILTER_VALIDATE_EMAIL)) {
+ $where.=" and p.email1 = '".$sdata."'" ;
+ }else{
+ $where.=" and (p.p_fname like '".$sdata."%' or
+ SUBSTRING_INDEX(p_fname,' ',1) sounds like '".$sdata."')";
+ }
+
+ $sql="SELECT i.*,p.p_fname,p.str_age,p.xgender,
+ date_format(i.register_date,'%d-%m-%Y') AS admit_dt,
+ DATE_FORMAT(i.discharge_date,'%d-%m-%Y') AS discharge_dt,
+ m.gross_amount,m.discount_group,m.discount_group_2,m.net_amount,m.payment_received,
+ if(m.med_type>1,'TPA','CASH') AS pay_type,m.payment_balance
+ FROM (inv_med_group m JOIN ipd_master i ON m.ipd_id=i.id)
+ JOIN patient_master_exten p ON i.p_id=p.id
+ WHERE $where AND m.net_amount>0" ;
+
+ $query = $this->db->query($sql);
+ $data['ipd_data']= $query->result();
+
+ $content=$this->load->view('Medical_app/ipd_panel_sub',$data,TRUE);
+
+ //echo $sql;
+ echo $content;
+ }
+
+ public function open_ipd_bill($ipd_id)
+ {
+ $this->db->query("CALL p_revoke_bill(".$ipd_id.")");
+ echo 'Done : Bill Opened';
+ }
+
+ public function get_ipd_bill_purchase($ipd_id)
+ {
+ $sql="select m.ipd_code,m.inv_name,sum(i.twdisc_amount) as Bill_Amount,
+ sum(Round(COALESCE(p.net_amount/p.total_unit,i.price2),2)*i.qty) as purchase_amount,
+ SUM(i.disc_whole) as Dis_Amount
+ from ((invoice_med_master m join inv_med_item i on m.id=i.inv_med_id)
+ left join purchase_invoice_item p on p.id=i.store_stock_id)
+ join ipd_master ipd on m.ipd_id=ipd.id
+ WHERE ipd.id=$ipd_id group by m.ipd_id ";
+
+ $query = $this->db->query($sql);
+ $ipd_data= $query->result();
+
+ if(count($ipd_data)>0){
+ $content="IPD : ".$ipd_data[0]->ipd_code." ".
+ "Name : ".$ipd_data[0]->inv_name." ".
+ "Bill Amount : ".$ipd_data[0]->Bill_Amount." ".
+ "Discount : ".$ipd_data[0]->Dis_Amount." ".
+ "Purchase : ".$ipd_data[0]->purchase_amount."";
+
+ }else{
+ $content="Not Found";
+ }
+
+ echo $content;
+
+ }
+
+}
+
diff --git a/old_code_ci3/controllers/Medical_backpanel.php b/old_code_ci3/controllers/Medical_backpanel.php
new file mode 100644
index 0000000..d5f854a
--- /dev/null
+++ b/old_code_ci3/controllers/Medical_backpanel.php
@@ -0,0 +1,2168 @@
+load->view('Medical/Med_back_Panel');
+ }
+
+ public function Med_old_invoice()
+ {
+ $this->load->view('Medical/Invoice_med_list');
+ }
+
+ public function Stock()
+ {
+ $sql = "select * from med_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Stock/stock_search', $data);
+ }
+
+ public function store_stock()
+ {
+ $sql = "select * from med_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $sql = "select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation'] = $query->result();
+
+ $this->load->view('Medical/Store/store_stock_search', $data);
+ }
+
+ public function stock_details()
+ {
+ $sql = "select * from med_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Store/stock_store_statement', $data);
+ }
+
+ public function store_Stock_result()
+ {
+ $item_name = trim($this->input->post('txtsearch'));
+ $chk_reorder = $this->input->post('chk_reorder');
+
+ $HAVING = "";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING SUM(s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)<=p.re_order_qty";
+ }
+
+ $where = " (s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)>=0 ";
+
+ if ($item_name <> '') {
+ $where .= " and (p.item_name like '%" . $item_name . "%' or p.genericname like '%" . $item_name . "%' )";
+ }
+
+ $schedule_id = $this->input->post('schedule_id');
+
+ if ($schedule_id == '') {
+ } else {
+ $where .= " and (1<>1 ";
+ foreach ($schedule_id as $row) {
+ if ($row == 1) {
+ $where .= " or p.schedule_h=1 ";
+ }
+
+ if ($row == 2) {
+ $where .= " or p.schedule_h1=1 ";
+ }
+
+ if ($row == 3) {
+ $where .= " or p.schedule_x=1 ";
+ }
+
+ if ($row == 4) {
+ $where .= " or p.schedule_g=1 ";
+ }
+
+ if ($row == 5) {
+ $where .= " or p.narcotic=1 ";
+ }
+
+ if ($row == 6) {
+ $where .= " or p.high_risk=1 ";
+ }
+ }
+ $where .= ")";
+ }
+
+ $where .= " and m.date_of_invoice>date_add(curdate(),interval -24 month) ";
+
+ $sql = "SELECT p.id, p.item_name,p.genericname,
+ IFNULL(s.item_code,0) AS item_found,
+ ifnull(s.packing,p.packing) as packing,
+ SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit) as C_Unit_Stock_Qty,
+ Concat(TRUNCATE(SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit)/s.packing,0),
+ ':',
+ MOD(SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit),s.packing)) as C_Pak_Qty,
+ sum(s.total_unit) as P_Unit_Qty,
+ sum(s.total_unit)/s.packing as Pak_qty,
+ sum(s.total_sale_unit) as sale_unit,
+ sum(s.total_sale_unit)/s.packing as C_Pak_Sale_Qty,
+ p.re_order_qty,
+ s.total_lost_unit
+ FROM (med_product_master p
+ JOIN purchase_invoice_item s ON p.id=s.item_code AND s.remove_item=0 AND s.item_return=0)
+ JOIN purchase_invoice m ON s.purchase_id=m.id and p.is_continue=1
+ WHERE " . $where . " group by p.id,s.packing " . $HAVING . " order by p.Item_name ";
+ $query = $this->db->query($sql);
+ $data['stock_list'] = $query->result();
+
+
+ $this->load->view('Medical/Store/Stock_search_result', $data);
+ }
+
+ public function store_Stock_result_datewise()
+ {
+ $item_name = trim($this->input->post('txtsearch'));
+ $chk_reorder = $this->input->post('chk_reorder');
+
+ $supplier_id = $this->input->post('input_supplier');
+ $opd_date_range = $this->input->post('opd_date_range');
+
+ $rangeArray = explode("S", $opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $HAVING = "";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING SUM(s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)<=p.re_order_qty";
+ }
+
+ $where = " 1=1 ";
+
+ if ($item_name <> '') {
+ $where .= " and p.item_name like '%" . $item_name . "%' ";
+ }
+
+ if ($opd_date_range <> '') {
+ $where .= " and s.stock_date between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ $where .= " and m.date_of_invoice>date_add(curdate(),interval -24 month) ";
+
+ $sql = "SELECT p.id, p.item_name, IFNULL(s.item_code,0) AS item_found,
+ ifnull(s.packing,p.packing) as packing,
+ SUM(s.tqty) AS total_pak_qty,
+ SUM(s.net_amount) AS purchase_cost,
+ SUM(s.total_unit) AS total_unit,
+ SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit) as C_Unit_Stock_Qty,
+ SUM((s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit))/s.packing as C_Pak_Qty,
+ sum(s.total_unit) as P_Unit_Qty, sum(s.total_unit)/s.packing as Pak_qty,
+ sum(s.total_sale_unit) as sale_unit, sum(s.total_sale_unit)/s.packing as C_Pak_Sale_Qty,
+ p.re_order_qty, s.total_lost_unit
+ FROM (med_product_master p JOIN purchase_invoice_item s ON p.id=s.item_code and s.item_return=0)
+ JOIN purchase_invoice m ON s.purchase_id=m.id
+ WHERE " . $where . " group by p.id,s.packing " . $HAVING . " order by p.Item_name";
+ $query = $this->db->query($sql);
+ $data['stock_list'] = $query->result();
+
+ $data['date_range'] = $opd_date_range;
+ $data['supplier_id'] = $supplier_id;
+
+ $this->load->view('Medical/Store/stock_store_statement_data', $data);
+ }
+
+ public function store_Stock_result_datewise_excel($opd_date_range, $item_name='-', $supplier_id = '')
+ {
+
+ $rangeArray = explode("S", $opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+
+ $where = " 1=1 ";
+
+ if ($item_name <> '') {
+ $where .= " and p.item_name like '%" . $item_name . "%' ";
+ }
+
+ if ($opd_date_range <> '') {
+ $where .= " and s.stock_date between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ $where .= " and m.date_of_invoice>date_add(curdate(),interval -24 month) ";
+
+ $sql = "SELECT p.*, IFNULL(s.item_code,0) AS item_found,
+ ifnull(s.packing,p.packing) as packing,
+ SUM(s.tqty) AS total_pak_qty,
+ SUM(s.net_amount) AS purchase_cost,
+ SUM(s.total_unit) AS total_unit,
+ SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit) as C_Unit_Stock_Qty,
+ SUM((s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit))/s.packing as C_Pak_Qty,
+ sum(s.total_unit) as P_Unit_Qty, sum(s.total_unit)/s.packing as Pak_qty,
+ sum(s.total_sale_unit) as sale_unit, sum(s.total_sale_unit)/s.packing as C_Pak_Sale_Qty,
+ s.total_lost_unit,s.expiry_date,
+ SUM(TRUNCATE((s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit),0)*s.purchase_unit_rate) AS Stock_Cost,
+ s.purchase_unit_rate ,s.mrp,s.batch_no,s.CGST_per
+ FROM (med_product_master p JOIN purchase_invoice_item s ON p.id=s.item_code and s.item_return=0)
+ JOIN purchase_invoice m ON s.purchase_id=m.id
+ WHERE " . $where . " group by p.id,s.packing,s.batch_no order by p.Item_name";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ $content = "";
+ $content .= '
+
+
+ Item Name
+ Generic Name
+ MRP
+ Batch
+ Expiry
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Package/Re-Order Qty
+ Purchase Unit Rate
+ GST
+ Stock Cost
+
+
+ ';
+
+ $total_stock_value = 0;
+
+ foreach ($stock_list as $row) {
+
+ /* if ($row->C_Pak_Qty <= $row->re_order_qty) {
+ $tr_color = 'style="color:rgb(243, 7, 7);"';
+ } else {
+ $tr_color = '';
+ } */
+
+ $tr_color = '';
+
+ $content .= '
+ ' . $row->item_name . '
+ ' . $row->genericname . '
+ ' . $row->mrp . '
+ ' . $row->batch_no . '
+ ' . $row->expiry_date . '
+ ' . $row->C_Pak_Qty . '
+ ' . $row->C_Unit_Stock_Qty . '
+ ' . $row->C_Pak_Sale_Qty . '
+ ' . $row->sale_unit . '
+ ' . $row->packing . '
+ ' . $row->purchase_unit_rate . '
+ ' . $row->CGST_per*2 . '
+ ' . $row->Stock_Cost . '
+ ';
+ $total_stock_value += $row->Stock_Cost;
+ }
+
+ $content .= '
+ Total Stock Cost
+ ' . $total_stock_value . '
+ ';
+
+ $content .= '
';
+
+ //echo $content;
+ ExportExcel($content, 'Report_Medical_store_stock');
+ }
+
+ public function Stock_result_excel($chk_reorder, $item_name, $schedule_id)
+ {
+ $HAVING = "";
+ $where = " 1=1 ";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING (SUM(TRUNCATE((p.total_unit-p.total_sale_unit-p.total_lost_unit-p.total_return_unit)/p.packing,0)))<=m.re_order_qty";
+ }else{
+ $where .=" and (p.total_unit-p.total_lost_unit-p.total_sale_unit-p.total_return_unit)>0 ";
+ }
+
+
+
+ if (strlen(urldecode($item_name))>2) {
+ $where .= " and m.item_name like '%" . urldecode($item_name) . "%' ";
+ }
+
+ if ($schedule_id <>0 ) {
+
+ $schedule_id = explode("S", $schedule_id);
+ if (count($schedule_id) > 0) {
+ $where .= " ( ";
+ }
+ foreach ($schedule_id as $row) {
+ if ($row == 1) {
+ $where .= " or m.schedule_h=1 ";
+ }
+
+ if ($row == 2) {
+ $where .= " or m.schedule_h1=1 ";
+ }
+
+ if ($row == 3) {
+ $where .= " or m.schedule_x=1 ";
+ }
+
+ if ($row == 4) {
+ $where .= " or m.schedule_g=1 ";
+ }
+
+ if ($row == 5) {
+ $where .= " or m.narcotic=1 ";
+ }
+ }
+ if (count($schedule_id) > 0) {
+ $where .= " ) ";
+ }
+ }
+
+
+
+ $where .= " and i.date_of_invoice>date_add(curdate(),interval -24 month) ";
+
+ $sql = "SELECT m.item_name, m.id,m.genericname,
+ SUM(p.tqty) AS Pak_qty,
+ SUM(p.total_unit) AS P_Unit_Qty,
+ m.packing,
+ SUM(TRUNCATE((p.total_unit-p.total_sale_unit)/p.packing,0)) AS C_Pak_Qty,
+ SUM(p.total_sale_unit) AS sale_unit,
+ SUM(TRUNCATE((p.total_sale_unit)/p.packing,0)) AS C_Pak_Sale_Qty,
+ m.re_order_qty,
+ SUM(p.total_unit-p.total_sale_unit) AS C_Unit_Stock_Qty,
+ SUM(TRUNCATE((p.total_unit-p.total_sale_unit-p.total_lost_unit-p.total_return_unit),0)*p.purchase_unit_rate) AS Stock_Cost,
+ p.purchase_unit_rate
+ FROM (med_product_master m JOIN purchase_invoice_item p
+ ON m.id=p.item_code and m.is_continue=1 and p.item_return=0 AND p.remove_item=0)
+ JOIN purchase_invoice i ON p.purchase_id=i.id
+ WHERE " . $where . " group by m.id,p.purchase_unit_rate,p.packing " . $HAVING . " order by m.Item_name";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ $content = "";
+ //$content=$sql;
+
+ $content .= '
+
+
+ Item Name
+ Generic Name
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Package/Re-Order Qty
+ Purchase Unit Rate
+ Stock Cost
+
+
+ ';
+
+ $total_stock_value = 0;
+
+ foreach ($stock_list as $row) {
+
+ if ($row->C_Pak_Qty <= $row->re_order_qty) {
+ $tr_color = 'style="color:rgb(243, 7, 7);"';
+ } else {
+ $tr_color = '';
+ }
+
+ $content .= '
+ ' . $row->item_name . '
+ ' . $row->genericname . '
+ ' . $row->C_Pak_Qty . '
+ ' . $row->C_Unit_Stock_Qty . '
+ ' . $row->C_Pak_Sale_Qty . '
+ ' . $row->sale_unit . '
+ ' . $row->packing . '
+ ' . $row->purchase_unit_rate . '
+ ' . $row->Stock_Cost . '
+ ';
+ $total_stock_value += $row->Stock_Cost;
+ }
+
+ $content .= '
+ Total Stock Cost
+ ' . $total_stock_value . '
+ ';
+
+ $content .= '
';
+
+ //echo $content;
+ ExportExcel($content, 'Report_Medical_store_stock');
+ }
+
+ public function Stock_result_excel_2($supplier_id, $opd_date_range, $item_name, $chk_reorder, $schedule_id = '')
+ {
+
+ $HAVING = "";
+ $where = " 1=1 ";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING SUM(s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)<=p.re_order_qty";
+ }else{
+ $where .=" and (s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)>0 ";
+ }
+
+
+
+ if (($item_name <> '-') || strlen(trim($item_name)) > 0) {
+ $where .= " and p.item_name like '%" . $item_name . "%' ";
+ }
+
+ if (!($opd_date_range == '' || $opd_date_range <> '0')) {
+ $rangeArray = explode("S", $opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where .= " and s.stock_date between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ if ($schedule_id == '') {
+ } else {
+
+ $where .= " and (1<>1 ";
+ $schedule_id = explode("S", $schedule_id);
+ foreach ($schedule_id as $row) {
+ if ($row == 1) {
+ $where .= " or p.schedule_h=1 ";
+ }
+
+ if ($row == 2) {
+ $where .= " or p.schedule_h1=1 ";
+ }
+
+ if ($row == 3) {
+ $where .= " or p.schedule_x=1 ";
+ }
+
+ if ($row == 4) {
+ $where .= " or p.schedule_g=1 ";
+ }
+
+ if ($row == 5) {
+ $where .= " or p.narcotic=1 ";
+ }
+ }
+ $where .= ")";
+ }
+
+
+
+ $sql = "SELECT p.item_name, p.id,p.genericname,
+ SUM(s.tqty) AS Pak_qty,
+ SUM(s.total_unit) AS P_Unit_Qty,
+ s.packing,
+ SUM(TRUNCATE((s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)/s.packing,0)) AS C_Pak_Qty,
+ SUM(s.total_sale_unit) AS sale_unit,
+ SUM(TRUNCATE((s.total_sale_unit)/s.packing,0)) AS C_Pak_Sale_Qty,
+ p.re_order_qty,
+ SUM(s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit) AS C_Unit_Stock_Qty,
+ SUM(TRUNCATE((s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit),0)*s.purchase_unit_rate) AS Stock_Cost
+ FROM (med_product_master p JOIN purchase_invoice_item s ON p.id=s.item_code and s.item_return=0)
+ JOIN purchase_invoice m ON s.purchase_id=m.id
+ WHERE " . $where . " group by s.id " . $HAVING . " order by p.Item_name";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ echo $sql;
+
+
+ $content = "";
+ $content .= '
+
+
+ Item Name
+ Total Unit Qty
+ Current Unit Qty
+ Total Sale Unit Qty
+ Package/Re-Order Qty
+ Stock Cost
+
+
+ ';
+
+ foreach ($stock_list as $row) {
+
+ if ($row->C_Pak_Qty <= $row->re_order_qty) {
+ $tr_color = 'style="background-color: #999999;"';
+ } else {
+ $tr_color = '';
+ }
+
+ $content .= '
+ ' . $row->item_name . '
+ ' . $row->P_Unit_Qty . '
+ ' . $row->C_Unit_Stock_Qty . '
+ ' . $row->sale_unit . '
+ ' . $row->packing . '
+ ' . $row->Stock_Cost . '
+ ';
+ }
+
+ $content .= '
';
+
+ //echo $content;
+ ExportExcel($content, 'Report_Medical_store_stock');
+ }
+
+ public function Stock_result_excel_3($supplier_id, $opd_date_range, $item_name, $chk_reorder, $schedule_id = "")
+ {
+
+ $HAVING = "";
+ $where = " 1=1 ";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING SUM(p.total_unit-p.total_lost_unit-p.total_sale_unit-p.total_return_unit)<=p.re_order_qty";
+ }else{
+ $where .=" and (p.total_unit-p.total_lost_unit-p.total_sale_unit-p.total_return_unit)>0 ";
+ }
+
+ if (strlen(urldecode($item_name))>2) {
+ $where .= " and m.item_name like '%" . urldecode($item_name) . "%' ";
+ }
+
+
+
+ if (!($opd_date_range == '' || $opd_date_range == '0')) {
+ $rangeArray = explode("S", $opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where .= " and s.stock_date between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ if ($schedule_id == '') {
+ } else {
+
+ $where .= " and (1<>1 ";
+ $schedule_id = explode("S", $schedule_id);
+ foreach ($schedule_id as $row) {
+ if ($row == 1) {
+ $where .= " or p.schedule_h=1 ";
+ }
+
+ if ($row == 2) {
+ $where .= " or p.schedule_h1=1 ";
+ }
+
+ if ($row == 3) {
+ $where .= " or p.schedule_x=1 ";
+ }
+
+ if ($row == 4) {
+ $where .= " or p.schedule_g=1 ";
+ }
+
+ if ($row == 5) {
+ $where .= " or p.narcotic=1 ";
+ }
+ }
+ $where .= ")";
+ }
+
+ $sql = "SELECT m.item_name, m.id,m.genericname,m.formulation,p.expiry_date,p.mrp,p.CGST_per, SUM(p.tqty) AS Pak_qty, SUM(p.total_unit) AS P_Unit_Qty, p.batch_no,p.selling_unit_rate,p.packing,
+ SUM(TRUNCATE((p.total_unit-p.total_sale_unit-p.total_lost_unit-p.total_return_unit)/p.packing,0)) AS C_Pak_Qty, SUM(p.total_sale_unit) AS sale_unit, SUM(TRUNCATE((p.total_sale_unit)/p.packing,0)) AS C_Pak_Sale_Qty, m.re_order_qty,
+ SUM(p.total_unit-p.total_sale_unit-p.total_lost_unit-p.total_return_unit) AS C_Unit_Stock_Qty, SUM(TRUNCATE((p.total_unit-p.total_sale_unit-p.total_lost_unit-p.total_return_unit),0)*p.purchase_unit_rate) AS Stock_Cost, p.purchase_unit_rate ,
+ max(p.HSNCODE) AS HSNCODE
+ FROM (med_product_master m JOIN purchase_invoice_item p ON m.id=p.item_code and m.is_continue=1 and p.item_return=0 AND p.remove_item=0)
+ JOIN purchase_invoice i ON p.purchase_id=i.id
+ WHERE " . $where . " group by m.id,p.purchase_unit_rate,p.packing,p.batch_no,p.expiry_date " . $HAVING . " order by p.Item_name";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+
+ $content = "";
+ //$content = $sql;
+ $content .= '
+
+
+ Item Name
+ Compostion Name (Salt Name)
+ Formulation
+ Batch No.
+ Expiry
+ Package
+ Purchase Unit Qty
+ Purchase Unit Rate
+ Sale Unit Qty
+ Sale Unit Rate
+ MRP
+ Cur. Qty
+ GST Per
+ HSNCODE
+
+
+ ';
+
+ foreach ($stock_list as $row) {
+
+ if ($row->C_Pak_Qty <= $row->re_order_qty) {
+ $tr_color = 'style="background-color: #999999;"';
+ } else {
+ $tr_color = '';
+ }
+
+ $content .= '
+ ' . $row->item_name . '
+ ' . $row->genericname . '
+ ' . $row->formulation . '
+ ' . $row->batch_no . '
+ ' . $row->expiry_date . '
+ ' . $row->packing . '
+ ' . $row->P_Unit_Qty . '
+ ' . $row->purchase_unit_rate . '
+ ' . $row->sale_unit . '
+ ' . $row->selling_unit_rate . '
+ ' . $row->mrp . '
+ ' . $row->C_Unit_Stock_Qty . '
+ ' . $row->CGST_per . '
+ ' . $row->HSNCODE . '
+ ';
+ }
+
+ $content .= '
';
+
+ //echo $content;
+ ExportExcel($content, 'Report_Medical_store_stock');
+ }
+
+
+ public function get_product_stock($product_id, $remove_item = 0)
+ {
+ $supplier_id = $this->input->post('input_supplier');
+ $date_range = $this->input->post('date_range');
+
+ $product_pak = $this->input->post('product_pak');
+
+ $where = "1=1 ";
+
+ if ($date_range <> '0') {
+ $rangeArray = explode("S", $date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where .= " and p.date_of_invoice between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ $where .= " and i.item_code=$product_id and i.packing=$product_pak ";
+
+ $sql = "SELECT i.id,s.name_supplier,s.short_name,i.Item_name,
+ p.Invoice_no,p.date_of_invoice,i.mrp,i.packing,
+ i.batch_no,i.expiry_date,i.purchase_price,i.purchase_unit_rate,
+ i.qty,i.qty_free,i.tqty,i.total_unit,i.total_sale_unit,
+ i.total_return_unit,i.total_lost_unit,
+ (i.total_unit-i.total_sale_unit-i.total_lost_unit-i.total_return_unit) as cur_unit
+ FROM (purchase_invoice p JOIN purchase_invoice_item i ON p.id=i.purchase_id and i.item_return=0)
+ JOIN med_supplier s ON p.sid=s.sid
+ WHERE $where and remove_item=$remove_item
+ Order by p.id";
+
+ $query = $this->db->query($sql);
+ $data['product_purchase_detail'] = $query->result();
+
+ //echo $sql;
+
+ $this->load->view('Medical/Store/Stock_Item_history', $data);
+ }
+
+ public function get_product_stock_removed($product_id, $remove_item = 0)
+ {
+ $supplier_id = $this->input->post('input_supplier');
+ $date_range = $this->input->post('date_range');
+
+ $where = "1=1 ";
+
+ if ($date_range <> '0') {
+ $rangeArray = explode("S", $date_range);
+
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where .= " and p.date_of_invoice between '" . $minRange . "' and '" . $maxRange . "'";
+ } else {
+ $where .= " and p.date_of_invoice>=date_add(curdate(),interval -1 year)";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ $where .= " and i.item_code=$product_id";
+
+ $sql = "SELECT i.id,s.name_supplier,s.short_name,i.Item_name,
+ p.Invoice_no,p.date_of_invoice,i.mrp,
+ i.batch_no,i.expiry_date,i.purchase_price,i.purchase_unit_rate,
+ i.qty,i.qty_free,i.tqty,i.total_unit,i.total_sale_unit,
+ i.total_return_unit,i.total_lost_unit,
+ (i.total_unit-i.total_sale_unit-i.total_lost_unit) as cur_unit
+ FROM (purchase_invoice p JOIN purchase_invoice_item i ON p.id=i.purchase_id)
+ JOIN med_supplier s ON p.sid=s.sid
+ WHERE $where and remove_item=1
+ Order by p.id";
+
+ $query = $this->db->query($sql);
+ $data['product_purchase_detail'] = $query->result();
+
+ $this->load->view('Medical/Store/Stock_Item_history_removed', $data);
+ }
+
+ public function get_product_stock_return($product_id)
+ {
+ $supplier_id = $this->input->post('input_supplier');
+ $date_range = $this->input->post('date_range');
+
+ $where = "1=1 ";
+
+ if ($date_range <> '0') {
+ $rangeArray = explode("S", $date_range);
+
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where .= " and p.date_of_invoice between '" . $minRange . "' and '" . $maxRange . "'";
+ } else {
+ $where .= " and p.date_of_invoice>=date_add(curdate(),interval -1 year)";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ $where .= " and i.item_code=$product_id";
+
+ $sql = "SELECT m.p_r_invoice_no, m.date_of_invoice,m.insert_datetime,i.Item_name,i.qty,s.name_supplier
+ FROM (purchase_return_invoice m JOIN purchase_return_invoice_item i ON m.id=i.purchase_inv_id)
+ JOIN med_supplier s ON m.sid=s.sid
+ WHERE i.item_code=$product_id";
+ $query = $this->db->query($sql);
+ $data['return_purchase'] = $query->result();
+
+ $sql = "SELECT m.Invoice_no, m.date_of_invoice,m.insert_time,i.Item_name,i.qty,s.name_supplier,i.packing
+ FROM (purchase_invoice m JOIN purchase_invoice_item i ON m.id=i.purchase_id)
+ JOIN med_supplier s ON m.sid=s.sid
+ WHERE i.item_return=1 and i.item_code=$product_id";
+ $query = $this->db->query($sql);
+ $data['return_invoice_purchase'] = $query->result();
+
+
+ $this->load->view('Medical/Store/Stock_Item_history_return', $data);
+ }
+
+
+ public function Org_Bills()
+ {
+ $sql = "select * from hc_insurance where id>1 and active=1 ";
+ $query = $this->db->query($sql);
+ $data['data_insurance'] = $query->result();
+
+ $this->load->view('Medical/Report/Report_org_invoice_list', $data);
+ }
+
+ public function Org_Bills_Report($date_range, $Insurance_id, $output = 0)
+ {
+ $rangeArray = explode("S", $date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " ";
+
+ $where .= " and m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ if ($Insurance_id > 0) {
+ $where .= " and i.id = " . $Insurance_id;
+ }
+
+ $sql = "select m.inv_med_code,o.case_id_code,p.p_code,p.p_fname,m.net_amount,i.ins_company_name
+ from ((invoice_med_master m join patient_master p on m.patient_id=p.id)
+ join organization_case_master o on m.case_id=o.id)
+ join hc_insurance i on o.insurance_id=i.id
+ where m.case_id>1 and m.case_credit=1 " . $where . " ";
+ $query = $this->db->query($sql);
+ $data_insurance = $query->result();
+
+ $content = ""; // $sql;
+
+ $total_amt = 0;
+
+ $content .= '
+
+ Inv. ID
+ Org.Code
+ P Code
+ P Name
+ Amount
+ Org. Name
+ ';
+
+ foreach ($data_insurance as $row) {
+ $content .= '
+ ' . $row->inv_med_code . '
+ ' . $row->case_id_code . '
+ ' . $row->p_code . '
+ ' . $row->p_fname . '
+ ' . $row->net_amount . '
+ ' . $row->ins_company_name . '
+ ';
+ $total_amt = $total_amt + $row->net_amount;
+ }
+
+ $content .= '
+
+
+
+ Total
+ ' . $total_amt . '
+
+ ';
+ $content .= '
';
+
+ if ($output == 0) {
+ create_report_pdf_landscape($content, 'Med_Invoice_org');
+ } else {
+ ExportExcel($content, 'Med_Invoice_org');
+ }
+ }
+
+
+ public function Stock_qty_result()
+ {
+ $supplier_id = $this->input->post('input_supplier');
+ $item_name = $this->input->post('txtsearch');
+ $store_id = $this->input->post('input_store_id');
+ $chk_reorder = $this->input->post('chk_reorder');
+
+ $HAVING = "";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING (sum(i.total_unit) - sum(if(ss.sale_qty is NULL,0,ss.sale_qty)))<=pm.re_order_qty";
+ }
+
+ $where = " remove_item=0 ";
+
+ if ($supplier_id > 0) {
+ $where .= " and s.sid = " . $supplier_id;
+ }
+
+
+ if ($item_name <> '') {
+ $where .= " and i.Item_name like '%" . $item_name . "%' ";
+ }
+
+ $sql = "SELECT i.Item_name,i.item_code ,sum(distinct i.tqty),
+ pm.re_order_qty,
+ sum(i.total_unit) as T_unit,
+ sum(if(ss.sale_qty is NULL,0,ss.sale_qty)) sal_qty,
+ GROUP_CONCAT(distinct s.name_supplier) AS supplier_names
+ FROM (((purchase_invoice_item i join purchase_invoice p on i.purchase_id=p.id )
+ join med_supplier s on s.sid=p.sid)
+ JOIN med_product_master pm ON i.item_code=pm.id AND pm.is_continue=1)
+ LEFT JOIN
+ (SELECT item_code,sum(qty) AS sale_qty FROM inv_med_item GROUP BY item_code )
+ AS ss ON i.item_code= ss.item_code
+ Where " . $where . " group by i.item_code " . $HAVING . " order by i.Item_name";
+ $query = $this->db->query($sql);
+ $data['stock_list'] = $query->result();
+
+ $this->load->view('Medical/Stock/Stock_search_qty_result', $data);
+ }
+
+
+
+
+ public function Report_Med_patient()
+ {
+ $this->load->view('Medical/Report/Report_Med_patient');
+ }
+
+ public function drug_patient_distribute($date_range, $item_name, $schedule_id, $output = 0)
+ {
+ $rangeArray = explode("S", $date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $item_name = urldecode($item_name);
+ //$item_name=$this->input->post('txtsearch');
+
+ $where = " ";
+
+ $where .= " m.inv_date between '" . $minRange . "' and '" . $maxRange . "'";
+
+ $schedule_id = explode("S", $schedule_id);
+
+ if ($item_name <> '-') {
+ $where .= " and (t.item_Name like '%" . $item_name . "%' or t.batch_no ='" . $item_name . "') ";
+ } else if ($schedule_id > 0) {
+ $where .= " and (1<>1 ";
+ foreach ($schedule_id as $row) {
+ if ($row == 1) {
+ $where .= " or p.schedule_h=1 ";
+ }
+
+ if ($row == 2) {
+ $where .= " or p.schedule_h1=1 ";
+ }
+
+ if ($row == 3) {
+ $where .= " or p.schedule_x=1 ";
+ }
+
+ if ($row == 4) {
+ $where .= " or p.schedule_g=1 ";
+ }
+
+ if ($row == 5) {
+ $where .= " or p.narcotic=1 ";
+ }
+
+ if ($row == 6) {
+ $where .= " or p.high_risk=1 ";
+ }
+ }
+ $where .= ")";
+ } else {
+ $where .= " and 1<>1";
+ }
+
+
+ $sql = "select t.item_Name,m.inv_med_code,m.id as m_id,date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ date_format(t.expiry,'%m-%Y') as exp_date,
+ m.patient_id,m.patient_code,m.inv_name,m.ipd_id,m.ipd_code, t.batch_no,sum(if(t.sale_return=0,t.qty,t.qty*-1)) as t_qty,
+ TRIM(',' FROM Concat(if(p.schedule_h=1,'schedule_h,',''),
+ if(p.schedule_h1=1,'schedule_h1,',''),
+ if(p.narcotic=1,'narcotic,',''),
+ if(p.schedule_x=1,'schedule_x,',''),
+ if(p.schedule_g=1,'schedule_g,',''))) as shed_x_h
+ from (invoice_med_master m join inv_med_item t on m.id=t.inv_med_id)
+ join med_product_master p on p.id=t.item_code
+ where " . $where . " group by t.item_Name,m.id WITH ROLLUP";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+ //echo $sql;
+
+ $content = '
+
+ Inv.No.
+ Inv.Date
+ IPD No.
+ P Code/Name
+ Exp. Date
+ Batch
+ Qty
+ ';
+
+ $Head_Content = "";
+ foreach ($stock_list as $row) {
+ if ($row->m_id == '') {
+ $content .= '';
+ $content .= ' Total Qty : ';
+ $content .= ' ' . $row->t_qty . ' ';
+ $content .= ' ';
+ } else {
+ if ($Head_Content <> $row->item_Name) {
+ $content .= '';
+ $content .= ' ' . $row->item_Name . '[ ' . $row->shed_x_h . ' ] ';
+ $content .= ' ';
+ $Head_Content = $row->item_Name;
+ }
+
+ $content .= '';
+ $content .= ' ' . $row->inv_med_code . ' ';
+ $content .= ' ' . $row->str_inv_date . ' ';
+ $content .= ' ' . $row->ipd_code . ' ';
+ $content .= ' ' . $row->patient_code . ' / ' . $row->inv_name . ' ';
+ $content .= ' ' . $row->exp_date . ' ';
+ $content .= ' ' . $row->batch_no . ' ';
+ $content .= ' ' . $row->t_qty . ' ';
+ $content .= ' ';
+ }
+ }
+
+ $content .= '
';
+
+ if ($output == 0) {
+ $this->load->library('m_pdf');
+
+ $this->m_pdf->pdf->setBasePath(base_url('/'));
+ $file_name = 'Report-MedicalBill-' . date('Ymdhis') . ".pdf";
+ $filepath = $file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath, "I");
+ } else {
+ ExportExcel($content, 'Report_Medical');
+ }
+ }
+
+
+
+ public function getInvoiceTable()
+ {
+
+ $requestData = $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 => 'inv_med_code',
+ 1 => 'inv_name',
+ 2 => 'Code',
+ 3 => 'inv_date_str',
+ 4 => 'net_amount',
+ 5 => 'payment_received',
+ 6 => 'payment_balance',
+ 7 => 'id',
+ 8 => 'ipd_status',
+ 9 => 'org_status',
+ 10 => 'ipd_credit_type',
+ 11 => 'org_credit_type'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select m.inv_med_code,m.inv_name,
+ Concat(if(m.patient_code<>'',Concat(m.patient_code,' '),''),
+ if(m.ipd_code<>'',Concat('',m.ipd_code,' '),''),
+ if(m.case_id>0,Concat(o.case_id_code,' '),'')) as Code ,
+ m.inv_date,Date_Format(m.inv_date,'%d-%m-%Y') as inv_date_str,
+ m.doc_name,m.net_amount,m.payment_received,m.payment_balance,m.id,i.ipd_status,
+ o.status as org_status,
+ m.ipd_credit as ipd_credit_type,m.case_credit as org_credit_type ";
+
+ $sql_count = "Select count(*) as no_rec ";
+
+ $sql_from = " from (invoice_med_master m left join ipd_master i on m.ipd_id=i.id)
+ left join organization_case_master o on m.case_id=o.id ";
+
+ $total_sql = $sql_count . $sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec'] = $query->result();
+ $totalData = $data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where = " WHERE 1 = 1";
+
+ $sql_where_flag = 0;
+
+ // getting records as per search parameters
+ if (!empty($requestData['columns'][0]['search']['value'])) { //inv_med_code
+ $sql_where .= " AND inv_med_code LIKE '%" . $requestData['columns'][0]['search']['value'] . "' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][1]['search']['value'])) { //inv_name
+ $sql_where .= " AND inv_name LIKE '%" . $requestData['columns'][1]['search']['value'] . "%' ";
+ $sql_where_flag = 1;
+ }
+
+ if (!empty($requestData['columns'][2]['search']['value'])) { //patient_code
+ $sql_where .= " AND (patient_code LIKE '%" . $requestData['columns'][2]['search']['value'] . "' OR
+ m.ipd_code LIKE '%" . $requestData['columns'][2]['search']['value'] . "' OR
+ o.case_id_code LIKE '%" . $requestData['columns'][2]['search']['value'] . "' )";
+ $sql_where_flag = 1;
+ }
+
+ $total_filer_sql = $sql_count . $sql_from . $sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter'] = $query->result(); // when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered = $data['total_rec_filter'][0]->no_rec;
+
+ $sql_order = " ORDER BY id desc," . $columns[$requestData['order'][0]['column']] . " " . $requestData['order'][0]['dir'] . " LIMIT " . $requestData['start'] . " ," . $requestData['length'] . " "; // adding length
+
+ $Result_sql = $sql_f_all . $sql_from . $sql_where . $sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata = $query->result_array();
+
+ $output = array(
+ "draw" => intval($requestData['draw']), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval($totalData), // total number of records
+ "recordsFiltered" => intval($totalFiltered), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach ($rdata as $aRow) {
+ $row = array();
+
+ foreach ($columns as $col) {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function Invoice_med_show($inv_id)
+ {
+ $this->load->model('Medical_M');
+
+ $this->Medical_M->update_invoice_group($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+
+ $sql = "select *,(discount_amount+item_discount_amount) as inv_disc_total,(CGST_Tamount+SGST_Tamount) as TGST ,
+ if(ipd_credit>0,'Credit to IPD','CASH') as credit_status,if(case_credit>0,'Credit to Org','CASH') as credit_org_status
+ from invoice_med_master where id=" . $inv_id;
+
+ $query = $this->db->query($sql);
+ $data['invoiceMaster'] = $query->result();
+
+ $sql = "select * from inv_med_item where inv_med_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist'] = $query->result();
+
+ $sql = "select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='" . $data['invoiceMaster'][0]->patient_id . "' ";
+ $query = $this->db->query($sql);
+ $data['person_info'] = $query->result();
+
+ $sql = "select * from ipd_master where ipd_status=0 and id=" . $data['invoiceMaster'][0]->ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master'] = $query->result();
+
+ if ($data['invoiceMaster'][0]->case_id > 0) {
+ $sql = "select * from organization_case_master where id=" . $data['invoiceMaster'][0]->case_id;
+ $query = $this->db->query($sql);
+ $data['OCaseMaster'] = $query->result();
+ }
+
+ $sql = "select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history_medical where Medical_invoice_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['payment_history_medical'] = $query->result();
+
+ $this->load->view('Medical/Invoice_OLD_Master', $data);
+ }
+
+ public function update_rate()
+ {
+ $invoice_id = $this->input->post('med_invoice_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $dataupdate = array(
+ 'rate_update' => $this->input->post('input_dis_amt'),
+ 'rate_update_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->update_in_upv_item($dataupdate, $invoice_id);
+
+ $this->Medical_M->update_invoice_rate_final($invoice_id);
+ #$this->Medical_M->update_invoice_final($invoice_id);
+
+ }
+
+
+ public function update_stock_adjust()
+ {
+ $item_id = $this->input->post('item_id');
+ $qty = $this->input->post('qty');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $data_stock_adjuct = array(
+ 'item_id' => $item_id,
+ 'qty' => $qty,
+ 'date_of_adjust' => date('Y-m-d'),
+ 'update_by' => $user_name . '[' . $user_id . ']'
+ );
+
+
+ $this->load->model('Medical_M');
+
+ $ins_id = $this->Medical_M->update_purchase_item_stock_adjust($data_stock_adjuct, $item_id);
+
+ echo $ins_id;
+ }
+
+ public function remove_stock_item()
+ {
+ $item_id = $this->input->post('item_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $data_stock_adjuct = array(
+ 'item_id' => $item_id,
+ 'date_of_adjust' => date('Y-m-d'),
+ 'qty' => '0',
+ 'update_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->load->model('Medical_M');
+
+ $ins_id = $this->Medical_M->update_remove_status_item($data_stock_adjuct, $item_id);
+
+ echo $ins_id;
+ }
+
+ public function add_stock_item()
+ {
+ $item_id = $this->input->post('item_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ $data_stock_adjuct = array(
+ 'item_id' => $item_id,
+ 'date_of_adjust' => date('Y-m-d'),
+ 'qty' => '0',
+ 'update_by' => $user_name . '[' . $user_id . ']'
+ );
+
+ $this->load->model('Medical_M');
+
+ $ins_id = $this->Medical_M->add_removed_item($data_stock_adjuct, $item_id);
+
+ echo $ins_id;
+ }
+
+ public function Report_IPD_CreditBills()
+ {
+ $this->load->view('Medical/Report/Med_Report_IPD_Credit');
+ }
+
+ //Supplier Ledger
+
+ public function SupplierAccount()
+ {
+ $sql = "SELECT m.sid,m.name_supplier,m.short_name,
+ SUM(if(l.credit_debit=0,l.amount,l.amount*-1)) AS Tot_Balance,
+ date_format(MAX(if(l.credit_debit=0 AND l.purchase_id>0,l.tran_date,'')),'%d-%m-%Y') AS Last_InvDate,
+ date_format(MAX(if(l.credit_debit=1 AND l.purchase_id=0,l.tran_date,'')),'%d-%m-%Y') AS Last_Payment
+ FROM med_supplier m left JOIN med_supplier_ledger l ON m.sid=l.supplier_id
+ GROUP BY m.sid
+ ORDER BY m.name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Purchase/supplier_account', $data);
+ }
+
+ public function SupplierAccount_led($sid)
+ {
+ $sql = "SELECT m.sid,m.name_supplier,m.short_name,
+ SUM(if(l.credit_debit=0,l.amount,l.amount*-1)) AS Tot_Balance,
+ date_format(MAX(if(l.credit_debit=0 AND l.purchase_id>0,l.tran_date,'')),'%d-%m-%Y') AS Last_InvDate,
+ date_format(MAX(if(l.credit_debit=1 AND l.purchase_id=0,l.tran_date,'')),'%d-%m-%Y') AS Last_Payment
+ FROM med_supplier m left JOIN med_supplier_ledger l ON m.sid=l.supplier_id
+ where m.sid=$sid";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Purchase/supplier_account_detail', $data);
+ }
+
+ function search_result_tran($s_id, $date_range = '')
+ {
+
+ if ($date_range == '') {
+ $date_range = $this->input->post('led_date_range');
+ }
+
+ $rangeArray = explode("S", $date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " date(l.tran_date) BETWEEN '$minRange' AND '$maxRange' ";
+
+ $sql = " SELECT l.*,
+ CONCAT_WS('/',b.bank_account_name,b.bank_name) AS mode_desc
+ FROM (med_supplier_ledger l JOIN bank_account_master b ON l.bank_id=b.bank_id)
+ Where l.supplier_id=$s_id and $where order by tran_date desc";
+ $query = $this->db->query($sql);
+ $data['med_supplier_ledger'] = $query->result();
+
+
+ $sql = " SELECT sum(if(credit_debit=0,amount,amount*-1)) as Balance
+ FROM med_supplier_ledger l
+ Where l.supplier_id=$s_id and date(l.tran_date) <'$minRange' ";
+ $query = $this->db->query($sql);
+ $supplier_balance_till_date = $query->result();
+
+ $data['balance_till_date'] = $supplier_balance_till_date[0]->Balance;
+
+ $sql = " SELECT sum(if(credit_debit=0,amount,amount*-1)) as Balance
+ FROM med_supplier_ledger l
+ Where l.supplier_id=$s_id and date(l.tran_date) <='$maxRange' ";
+ $query = $this->db->query($sql);
+ $supplier_balance_till_date = $query->result();
+ $data['balance_till_date_close'] = $supplier_balance_till_date[0]->Balance;
+
+ $sql = " SELECT sum(if(credit_debit=0,amount,0)) as cr_total,
+ sum(if(credit_debit=1,amount,0)) as dr_total
+ FROM med_supplier_ledger l
+ Where l.supplier_id=$s_id and $where ";
+ $query = $this->db->query($sql);
+ $supplier_data_total_cr_dr = $query->result();
+
+ $data['cr_total'] = $supplier_data_total_cr_dr[0]->cr_total;
+ $data['dr_total'] = $supplier_data_total_cr_dr[0]->dr_total;
+
+ $data['s_id'] = $s_id;
+ $data['date_range'] = $date_range;
+
+ $this->load->view('Medical/Purchase/ledger_data', $data);
+ }
+
+ function add_entry($s_id)
+ {
+ $this->load->model('Medical_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user_id . ']';
+
+ if (isset($_POST) && count($_POST) > 0) {
+ $params = array(
+ 'supplier_id' => $s_id,
+ 'credit_debit' => $this->input->post('cr_dr_type'),
+ 'tran_date' => str_to_MysqlDate($this->input->post('tran_date')),
+ 'amount' => $this->input->post('amount'),
+ 'bank_id' => $this->input->post('mode_type'),
+ 'tran_desc' => $this->input->post('ref_cust_id'),
+ 'tran_desc' => $this->input->post('tran_desc'),
+ 'insert_by_id' => $user_id,
+ 'insert_by' => $user_name,
+ );
+
+ $insert_id = $this->Medical_M->insert_med_supplier_ledger($params);
+ redirect('Medical_backpanel/SupplierAccount_led/' . $s_id);
+ } else {
+ $data['s_id'] = $s_id;
+
+ $sql = "select * from bank_account_master";
+ $query = $this->db->query($sql);
+ $data['bank_account_master'] = $query->result();
+
+
+
+ $this->load->view('Medical/Purchase/ledger_add_entry', $data);
+ }
+ }
+
+ function edit_entry($tran_id)
+ {
+
+ $this->load->model('Medical_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . '[' . $user_id . ']';
+
+ $sql = "select * from med_supplier_ledger where id=$tran_id";
+ $query = $this->db->query($sql);
+ $data['med_supplier_ledger'] = $query->result();
+
+ $s_id = $data['med_supplier_ledger'][0]->supplier_id;
+
+ if (isset($_POST) && count($_POST) > 0) {
+ $params = array(
+ 'credit_debit' => $this->input->post('cr_dr_type'),
+ 'tran_date' => str_to_MysqlDate($this->input->post('tran_date')),
+ 'amount' => $this->input->post('amount'),
+ 'bank_id' => $this->input->post('mode_type'),
+ 'tran_desc' => $this->input->post('ref_cust_id'),
+ 'tran_desc' => $this->input->post('tran_desc'),
+ 'insert_by_id' => $user_id,
+ 'insert_by' => $user_name,
+ );
+
+ $this->Medical_M->update_med_supplier_ledger($params, $tran_id);
+ redirect('Medical_backpanel/SupplierAccount_led/' . $s_id);
+ } else {
+
+ $sql = "select * from bank_account_master";
+ $query = $this->db->query($sql);
+ $data['bank_account_master'] = $query->result();
+
+ $data['tran_id'] = $tran_id;
+
+ $this->load->view('Medical/Purchase/ledger_edit_entry', $data);
+ }
+ }
+
+ // Return Invoice
+ public function Purchase_return()
+ {
+ $this->load->view('Medical/Stock/purchase_return');
+ }
+
+ public function PurchaseReturnNew()
+ {
+ $sql = "select * from med_supplier order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data'] = $query->result();
+
+ $this->load->view('Medical/Stock/new_purchase_return_invoice', $data);
+ }
+
+ public function PurchaseReturnInvoice()
+ {
+ $sdata = trim($this->input->post('txtsearch'));
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if (trim($sdata) == '') {
+ $sql = "select p.id,p.p_r_invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d-%m-%Y') as str_date_of_invoice,p.sid,s.name_supplier,
+ s.short_name
+ from (purchase_return_invoice p join med_supplier s on p.sid=s.sid)
+
+ group by p.id
+ order by p.id desc limit 50";
+ } else {
+
+ $numric_condition = "";
+
+ if (is_numeric($sdata)) {
+ $numric_condition = " OR p.Invoice_no=" . $sdata;
+ }
+
+ $sql = "select p.id,p.p_r_invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d-%m-%Y') as str_date_of_invoice,p.sid,s.name_supplier,
+ s.short_name
+ from (purchase_return_invoice p join med_supplier s on p.sid=s.sid)
+ where (p.p_r_invoice_no LIKE '%" . $sdata . "' " . $numric_condition . " )
+ group by p.id
+ order by p.id desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice'] = $query->result();
+
+ $this->load->view('Medical/Stock/purchase_supp_list', $data);
+ }
+
+
+ public function CreatePurchaseReturn()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+
+ $sid = $this->input->post('input_supplier');
+ $d_invoice = $this->input->post('datepicker_invoice');
+
+ $where = " where sid=$sid";
+
+ $Udata = array(
+ 'sid' => $sid,
+ 'date_of_invoice' => str_to_MysqlDate($d_invoice),
+ );
+
+ $this->load->model('Medical_M');
+
+ $inser_id = $this->Medical_M->add_purchase_return_invoice($Udata);
+ $send_msg = "Added Successfully";
+
+ if ($inser_id > 0) {
+ $show_text = Show_Alert('success', 'Success', $send_msg);
+ } else {
+ $show_text = Show_Alert('danger', 'Error', $send_msg);
+ }
+
+
+ $rvar = array(
+ 'insertid' => $inser_id,
+ 'show_text' => $show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function PurchaseReturnInvoiceEdit($inv_id)
+ {
+ $sql = "select p.id,p.p_r_invoice_no as Invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d/%m/%Y') as str_date_of_invoice,
+ p.sid,s.name_supplier,s.short_name,s.gst_no,p.status as inv_status
+ from purchase_return_invoice p join med_supplier s on p.sid=s.sid
+ where p.id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice'] = $query->result();
+
+ $sql = "select p.*,r.purchase_inv_id,r.qty as r_qty,Round(r.qty/p.packing,2) AS qty_pak,r.id as r_id,if(r.batch_no_r='',p.batch_no,r.batch_no_r) as batch_no_r_s,
+ date_format(p.expiry_date,'%m/%y') as exp_date_str ,p.purchase_unit_rate*r.qty AS r_amount,p.purchase_unit_rate
+ from purchase_return_invoice_item r join purchase_invoice_item p on r.purchase_item_id=p.id
+ where purchase_inv_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice_item'] = $query->result();
+
+ $data['inv_id'] = $inv_id;
+
+ $data['content'] = $this->load->view('Medical/Stock/purchase_return_invoice_item', $data, true);
+
+ $this->load->view('Medical/Stock/purchase_return_invoice_edit', $data);
+ }
+
+ public function PurchaseReturn_invoice_item_list($inv_id)
+ {
+ $sql = "select p.*,r.purchase_inv_id,r.qty as r_qty,Round(r.qty/p.packing,2) AS qty_pak,r.id as r_id,if(r.batch_no_r='',p.batch_no,r.batch_no_r) as batch_no_r_s,
+ date_format(p.expiry_date,'%m/%y') as exp_date_str ,p.purchase_unit_rate*r.qty AS r_amount,p.purchase_unit_rate
+ from purchase_return_invoice_item r join purchase_invoice_item p on r.purchase_item_id=p.id
+ where purchase_inv_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice_item'] = $query->result();
+
+ $sql = "select * from purchase_return_invoice where id='" . $inv_id . "' ";
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice'] = $query->result();
+
+ $this->load->view('Medical/Stock/purchase_return_invoice_item', $data);
+ }
+
+ public function Purchase_Invoice_product($supp_id)
+ {
+ $data['supp_id'] = $supp_id;
+
+ $this->load->view('Medical/Stock/purchase_product_search', $data);
+ }
+
+ public function Purchase_Invoice_old($supp_id)
+ {
+ $sdata = trim($this->input->post('txtsearch'));
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if (trim($sdata) == '') {
+ $sql = "select p.id as pur_id,p.Invoice_no,p.date_of_invoice,
+ if(i.expiry_date0
+ and p.date_of_invoice>=date_add(curdate(),interval -1 year)
+ order by p.id desc ";
+ } else {
+
+ $numric_condition = "";
+
+ if (is_numeric($sdata)) {
+ $numric_condition = " OR p.Invoice_no=" . $sdata;
+ }
+
+ $sql = "select p.id as pur_id,p.Invoice_no,p.date_of_invoice,
+ if(i.expiry_date0
+ and p.date_of_invoice>=date_add(curdate(),interval -1 year)
+ order by p.id desc ";
+ }
+
+ $query = $this->db->query($sql);
+ $data['purchase_list'] = $query->result();
+
+ $this->load->view('Medical/Stock/purchase_invoice_list', $data);
+ }
+
+ public function add_remove_item()
+ {
+ $this->load->model('Medical_M');
+
+ $inv_id = $this->input->post('inv_id');
+ $item_id = $this->input->post('itemid');
+ $rqty = $this->input->post('rqty');
+
+ $rbatch_no = $this->input->post('rbatch_no');
+ $rexpiry_dt = $this->input->post('rexpiry_dt');
+
+ $user = $this->ion_auth->user()->row();
+ $user_update_info = $user->first_name . '' . $user->last_name . '[' . $user->id . ']' . date('d-m-Y H:i:s');
+
+ $sql = "select * from purchase_invoice_item where id='" . $item_id . "' ";
+ $query = $this->db->query($sql);
+ $purchase_invoice_item = $query->result();
+
+ $update = 0;
+ $msg_box = "";
+
+ if (count($purchase_invoice_item) > 0) {
+ $total_unit = $purchase_invoice_item[0]->total_unit;
+ $total_sale_unit = $purchase_invoice_item[0]->total_sale_unit;
+ $total_return_unit = $purchase_invoice_item[0]->total_return_unit;
+ $total_lost_unit = $purchase_invoice_item[0]->total_lost_unit;
+
+ $cur_unit_qty = $total_unit - $total_sale_unit - $total_return_unit - $total_lost_unit;
+
+ if ($cur_unit_qty > 0) {
+ $insert_data = array(
+ 'purchase_inv_id' => $inv_id,
+ 'purchase_item_id' => $item_id,
+ 'item_code' => $purchase_invoice_item[0]->item_code,
+ 'Item_name' => $purchase_invoice_item[0]->Item_name,
+ 'batch_no_r' => $rbatch_no,
+ 'expiry_date_r' => $rexpiry_dt,
+ 'qty' => $rqty
+ );
+
+ $this->Medical_M->add_purchase_return_invoiceitem($insert_data);
+ $update = 1;
+ $msg_box = "Item Added";
+ } else {
+ $update = 0;
+ $msg_box = "Current Item Qty is " . $cur_unit_qty;
+ }
+ } else {
+ $update = 0;
+ $msg_box = "No item found";
+ }
+
+ $sql = "select p.*,r.purchase_inv_id,r.qty as r_qty,Round(r.qty/p.packing,2) AS qty_pak,r.id as r_id,if(r.batch_no_r='',p.batch_no,r.batch_no_r) as batch_no_r_s,
+ date_format(p.expiry_date,'%m/%y') as exp_date_str ,p.purchase_unit_rate*r.qty AS r_amount,p.purchase_unit_rate
+ from purchase_return_invoice_item r join purchase_invoice_item p on r.purchase_item_id=p.id
+ where purchase_inv_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice_item'] = $query->result();
+
+ $content = $this->load->view('Medical/Stock/purchase_return_invoice_item', $data, true);
+
+ $rvar = array(
+ 'update' => $update,
+ 'msg_text' => $msg_box,
+ 'content' => $content
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function get_drug()
+ {
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "SELECT p.item_name as item_name,p.formulation,t.batch_no,t.expiry_date as expiry_date_str,t.expiry_date,
+ (t.total_unit-t.total_sale_unit-total_lost_unit-t.total_return_unit) AS c_qty,
+ t.id,t.mrp,t.selling_unit_rate,p.id AS item_code,t.packing,t.purchase_id
+ FROM med_product_master p
+ JOIN purchase_invoice_item t ON p.id=t.item_code
+ and (t.total_unit-t.total_sale_unit-t.total_lost_unit-t.total_return_unit)>0
+ and t.remove_item=0 and t.item_return=0
+ where (p.item_name like '" . $q . "%' ";
+
+ if (strlen($q) > 5) {
+ $sql = $sql . " or p.item_name SOUNDS LIKE '" . $q . "'";
+ }
+
+ $sql = $sql . ") order by p.item_name,id limit 100";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['item_name'] . ' ' . $row['formulation'])) . ' |B:' . htmlentities(stripslashes($row['batch_no'])) . ' |Pak:' . htmlentities(stripslashes($row['packing'])) . ' |Rs.' . htmlentities(stripslashes($row['mrp'])) . ' |Qty:' . htmlentities(stripslashes($row['c_qty']));
+ $new_row['value'] = htmlentities(stripslashes($row['item_name']));
+ $new_row['l_item_code'] = htmlentities(stripslashes($row['item_code']));
+ $new_row['l_ss_no'] = htmlentities(stripslashes($row['id']));
+ $new_row['l_Batch'] = htmlentities(stripslashes($row['batch_no']));
+ $new_row['l_Expiry'] = htmlentities(stripslashes($row['expiry_date_str']));
+ $new_row['l_mrp'] = htmlentities(stripslashes($row['mrp']));
+ $new_row['l_unit_rate'] = htmlentities(stripslashes($row['selling_unit_rate']));
+ $new_row['l_c_qty'] = htmlentities(stripslashes($row['c_qty']));
+ $new_row['l_packing'] = htmlentities(stripslashes($row['packing']));
+ $new_row['l_purchase_id'] = htmlentities(stripslashes($row['purchase_id']));
+ //$new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ } else {
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row;
+ echo json_encode($row_set);
+ }
+ }
+ }
+
+ public function get_batch($item_id)
+ {
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "SELECT t.batch_no
+ FROM med_product_master p
+ JOIN purchase_invoice_item t
+ where t.item_code=$item_id and t.batch_no like '" . $q . "%' ";
+
+ if (strlen($q) > 5) {
+ $sql = $sql . " or p.item_name SOUNDS LIKE '" . $q . "'";
+ }
+
+ $sql = $sql . ") order by p.item_name,id limit 100";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['batch_no']));
+ $new_row['value'] = htmlentities(stripslashes($row['batch_no']));
+
+ //$new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ } else {
+ $new_row['sql'] = $sql;
+ $row_set[] = $new_row;
+ echo json_encode($row_set);
+ }
+ }
+ }
+
+ public function remove_item_invoice($itemid)
+ {
+ $this->load->model('Medical_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_update_info = $user->first_name . '' . $user->last_name . '[' . $user->id . ']' . date('d-m-Y H:i:s');
+
+ $sql = "select * from purchase_return_invoice_item where id='" . $itemid . "' ";
+ $query = $this->db->query($sql);
+ $purchase_return_invoice_item = $query->result();
+
+ $update = 0;
+ $msg_box = "";
+
+ $content = "";
+
+ if (count($purchase_return_invoice_item) > 0) {
+ $purchase_invoice_item_id = $purchase_return_invoice_item[0]->id;
+ $r_qty = $purchase_return_invoice_item[0]->qty;
+ $inv_id = $purchase_return_invoice_item[0]->purchase_inv_id;
+
+
+
+ $this->Medical_M->delete_purchase_return_invoiceitem($itemid);
+
+ $update = 1;
+ $msg_box = "Item Removed";
+
+ $sql = "select p.*,r.purchase_inv_id,r.qty as r_qty,Round(r.qty/p.packing,2) AS qty_pak,r.id as r_id,if(r.batch_no_r='',p.batch_no,r.batch_no_r) as batch_no_r_s,
+ date_format(p.expiry_date,'%m/%y') as exp_date_str ,p.purchase_unit_rate*r.qty AS r_amount,p.purchase_unit_rate
+ from purchase_return_invoice_item r join purchase_invoice_item p on r.purchase_item_id=p.id
+ where purchase_inv_id=" . $inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_return_invoice_item'] = $query->result();
+
+ $content = $this->load->view('Medical/Stock/purchase_return_invoice_item', $data, true);
+ } else {
+ $update = 0;
+ $msg_box = "No item found";
+ }
+
+ $rvar = array(
+ 'update' => $update,
+ 'msg_text' => $msg_box,
+ 'content' => $content
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ //Transer Sale Item Purchase ID to Other
+
+ public function Expire_stock()
+ {
+ $sql = "select p.id as pur_id,p.Invoice_no,p.date_of_invoice,
+ if(i.expiry_date0
+ and p.date_of_invoice>=date_add(curdate(),interval -1 year)
+ and i.expiry_datedb->query($sql);
+ $data['purchase_list'] = $query->result();
+
+ //echo 'hello';
+ $this->load->view('Medical/Stock/expiry_stock_list', $data);
+ }
+
+ public function stocktransfer()
+ {
+ $this->load->view('Medical/Stock/stock_transfer');
+ }
+
+ public function merge_product()
+ {
+ $this->load->view('Medical/Stock/merge_product');
+ }
+
+ public function product_info($product_id)
+ {
+ $sql = "select * from med_product_master where id=$product_id";
+ $query = $this->db->query($sql);
+ $product_info = $query->result();
+
+ if (count($product_info) > 0) {
+
+ $rvar = array(
+ 'product_id' => $product_info[0]->id,
+ 'product_name' => $product_info[0]->item_name,
+ 'formulation' => $product_info[0]->formulation,
+ 'genericname' => $product_info[0]->genericname,
+
+ );
+ } else {
+ $rvar = array(
+ 'product_id' => 0,
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+
+ echo $encode_data;
+ }
+
+ public function product_merged()
+ {
+ $from_prod_id = $this->input->post('from_product_id');
+ $to_prod_id = $this->input->post('to_product_id');
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->merge_product($from_prod_id, $to_prod_id);
+
+ $rvar = array(
+ 'ssno' => 0,
+ );
+
+ $encode_data = json_encode($rvar);
+
+ echo $encode_data;
+ }
+
+ public function ssno_info($ssno)
+ {
+ $sql = "select * from purchase_invoice_item where id=$ssno";
+ $query = $this->db->query($sql);
+ $product_info = $query->result();
+
+ if (count($product_info) > 0) {
+ $total_current_unit = $product_info[0]->total_unit - $product_info[0]->total_sale_unit - $product_info[0]->total_lost_unit + $product_info[0]->total_return_unit;
+
+ $rvar = array(
+ 'ssno' => $ssno,
+ 'item_code' => $product_info[0]->item_code,
+ 'Item_name' => $product_info[0]->Item_name,
+ 'batch_no' => $product_info[0]->batch_no,
+ 'purchase_price' => $product_info[0]->purchase_price,
+ 'tqty' => $product_info[0]->tqty,
+ 'total_unit' => $product_info[0]->total_unit,
+ 'total_current_unit' => $total_current_unit,
+ 'total_sale_unit' => $product_info[0]->total_sale_unit,
+ );
+ } else {
+ $rvar = array(
+ 'ssno' => 0,
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+
+ echo $encode_data;
+ }
+
+ public function ssno_transfer()
+ {
+ $from_ssno = $this->input->post('from_ssno');
+ $to_ssno = $this->input->post('to_ssno');
+ $tqty = $this->input->post('tqty');
+
+ $this->load->model('Medical_M');
+ $this->Medical_M->transfer_ssno($from_ssno, $to_ssno, $tqty);
+
+ $rvar = array(
+ 'ssno' => 0,
+ );
+
+ $encode_data = json_encode($rvar);
+
+ echo $encode_data;
+ }
+
+
+ function search_result_tran_print($s_id, $date_range = '')
+ {
+
+ if ($date_range == '') {
+ $date_range = $this->input->post('led_date_range');
+ }
+
+ $rangeArray = explode("S", $date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where = " date(l.tran_date) BETWEEN '$minRange' AND '$maxRange' ";
+
+ $sql = "Select * from med_supplier where sid=$s_id";
+ $query = $this->db->query($sql);
+ $data['med_supplier'] = $query->result();
+
+ $data['Statement_between'] = MysqlDate_to_str($minRange) . " AND " . MysqlDate_to_str($maxRange);
+
+ $sql = " SELECT l.*,
+ CONCAT_WS('/',b.bank_account_name,b.bank_name) AS mode_desc
+ FROM (med_supplier_ledger l JOIN bank_account_master b ON l.bank_id=b.bank_id)
+ Where l.supplier_id=$s_id and $where order by tran_date,l.id ";
+ $query = $this->db->query($sql);
+ $data['med_supplier_ledger'] = $query->result();
+
+
+ $sql = " SELECT sum(if(credit_debit=0,amount,amount*-1)) as Balance
+ FROM med_supplier_ledger l
+ Where l.supplier_id=$s_id and date(l.tran_date) <'$minRange' ";
+ $query = $this->db->query($sql);
+ $supplier_balance_till_date = $query->result();
+
+ $data['balance_till_date'] = $supplier_balance_till_date[0]->Balance;
+
+ $sql = " SELECT sum(if(credit_debit=0,amount,amount*-1)) as Balance,Max(l.tran_date) as Last_date_tran
+ FROM med_supplier_ledger l
+ Where l.supplier_id=$s_id and date(l.tran_date) <='$maxRange' ";
+ $query = $this->db->query($sql);
+ $supplier_balance_till_date = $query->result();
+
+ $data['balance_till_date_close'] = $supplier_balance_till_date[0]->Balance;
+ $data['LAst_date_tran'] = $supplier_balance_till_date[0]->Last_date_tran;
+
+ $sql = " SELECT sum(if(credit_debit=0,amount,0)) as cr_total,
+ sum(if(credit_debit=1,amount,0)) as dr_total
+ FROM med_supplier_ledger l
+ Where l.supplier_id=$s_id and $where ";
+ $query = $this->db->query($sql);
+ $supplier_data_total_cr_dr = $query->result();
+
+ $data['cr_total'] = $supplier_data_total_cr_dr[0]->cr_total;
+ $data['dr_total'] = $supplier_data_total_cr_dr[0]->dr_total;
+
+ $data['s_id'] = $s_id;
+
+ $content = $this->load->view('Medical/Purchase/ledger_data_print', $data, True);
+
+ $this->load->library('m_pdf');
+
+ $this->m_pdf->pdf->setBasePath(base_url('/'));
+ $file_name = 'Report-Ledger-' . $s_id . '-' . date('Ymdhis') . ".pdf";
+ $filepath = $file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath, "I");
+ }
+
+ function Print_bill_on_uhid()
+ {
+ $this->load->view('Medical/print_bill_on_uhid');
+ }
+
+ function uhid_report($date_range, $p_code)
+ {
+ $rangeArray = explode("S", $date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql = "select * from patient_master_exten
+ where p_code='" . trim($p_code) . "'";
+ $query = $this->db->query($sql);
+ $data['patient_master'] = $query->result();
+
+ if (count($data['patient_master']) > 0) {
+ $pid = $data['patient_master'][0]->id;
+ } else {
+ $pid = 0;
+ }
+
+ if ($pid > 0) {
+ $sql = "Select id from invoice_med_master where patient_id=$pid and ipd_credit=0 and case_credit=0 and inv_date between '$minRange' AND '$maxRange'";
+ $query = $this->db->query($sql);
+ $invoice_med_master = $query->result();
+
+ $content = "";
+
+ $net_amount = "0.0";
+ $paid_amount = "0.0";
+ $balance_amount = "0.0";
+
+ foreach ($invoice_med_master as $row) {
+ $inv_id = $row->id;
+
+ $this->db->query("SELECT f_cash_opd_pre_data(" . $inv_id . ")");
+ $this->db->query("CALL f_update_med_GST(" . $inv_id . ")");
+
+ $sql = "select i.inv_med_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%y')as expiry,
+ i.price,i.qty,(i.amount) as amount,i.HSNCODE,
+ m.inv_med_code,m.id as m_id,
+ date_format(m.inv_date,'%d-%m-%Y') as str_inv_date,
+ (twdisc_amount) as twdisc_amount,
+ (i.disc_amount+i.disc_whole) as d_amt,
+ (i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per ,i.sale_return
+ from inv_med_item i join invoice_med_master m
+ on i.inv_med_id=m.id
+ where m.id=$inv_id order by i.sale_return,id";
+ $query = $this->db->query($sql);
+ $data['inv_items'] = $query->result();
+
+ $sql = "select *,
+ date_format(inv_date,'%d-%m-%Y') as str_inv_date,
+ (discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST
+ from invoice_med_master
+ where id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['invoice_med_master'] = $query->result();
+
+ $data['Doc_name'] = "";
+
+ if ($data['invoice_med_master'][0]->doc_id > 0) {
+ $doc_id = $data['invoice_med_master'][0]->doc_id;
+
+ $sql = "select * from doctor_master
+ where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master = $query->result();
+
+ $data['Doc_name'] = $doctor_master[0]->p_title . ' ' . $doctor_master[0]->p_fname;
+ } else {
+ $data['Doc_name'] = $data['invoice_med_master'][0]->doc_name;
+ }
+
+ $sql = "select p.*,if(p.credit_debit=0,p.amount,p.amount*-1) as paid_amount,
+ Concat((case p.payment_mode when 1 then 'Cash' when 2 then 'Bank Card' else 'Other' end),if(p.credit_debit=0,'',' Return')) as Payment_type_str
+ from payment_history_medical p
+ where p.Customerof_type in (1,3) and Medical_invoice_id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['payment_history'] = $query->result();
+
+ $net_amount += $data['invoice_med_master'][0]->net_amount;
+ $paid_amount += $data['invoice_med_master'][0]->payment_received;
+ $balance_amount += $data['invoice_med_master'][0]->payment_balance;
+
+ $content .= $this->load->view('Medical/Print/medical_bill_print_format_single', $data, TRUE);
+
+ $content .= " ";
+ }
+
+ $content .= "Total Net Amount : " . $net_amount . " / ";
+ $content .= "Paid Amount : " . $paid_amount . " / ";
+ $content .= "Balance Amount : " . $balance_amount;
+ } else {
+ $content = "No Record found";
+ }
+
+
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name = 'Report-MedicalBill_' . $inv_id . '_' . date('Ymdhis') . ".pdf";
+
+ $filepath = $file_name;
+
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath, "I");
+ }
+
+ function invoice_item_log()
+ {
+ $this->load->view('Medical/Stock/invoice_item_log');
+ }
+
+ function invoice_item_log_data(){
+ $opd_date_range=$this->input->post('opd_date_range');
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ $sql="SELECT m.inv_med_code,m.inv_date,m.inv_name,m.log,
+ GROUP_CONCAT(DISTINCT CONCAT_WS('#',d.item_Name,d.qty,d.price,d.twdisc_amount,d.delete_time,d.delete_by) SEPARATOR ';' ) AS del_item_list,
+ GROUP_CONCAT(DISTINCT CONCAT_WS('#',p.credit_debit,p.amount,l.update_log) SEPARATOR ';') AS payment_log
+ FROM ((invoice_med_master m JOIN inv_med_item_delete d ON d.inv_med_id=m.id)
+ LEFT JOIN payment_history_medical p ON m.id=p.Medical_invoice_id)
+ Left JOIN paymentmedical_history_log l ON p.id=l.pay_id
+ WHERE DATE(d.delete_time) BETWEEN '".$minRange."' and '".$maxRange."' AND m.ipd_id=0
+ GROUP BY m.id";
+
+ $query = $this->db->query($sql);
+ $data['Invoice_history_log']= $query->result();
+
+ //echo $sql;
+ $data['opd_date_range']=$opd_date_range;
+
+ $this->load->view('Medical/Stock/invoice_item_log_data',$data);
+ }
+}
diff --git a/old_code_ci3/controllers/Mobile_app.php b/old_code_ci3/controllers/Mobile_app.php
new file mode 100644
index 0000000..b2366f8
--- /dev/null
+++ b/old_code_ci3/controllers/Mobile_app.php
@@ -0,0 +1,384 @@
+load->database();
+ $this->load->helper(array('cookie','url','language'));
+
+ // Load form helper library
+ //$this->load->helper('form');
+
+ // Load form validation library
+ //$this->load->library('form_validation');
+
+ // Load session library
+ $this->load->library('session');
+
+ $this->load->helper('security');
+
+ }
+
+ public function index()
+ {
+ $this->load->view('Mobile_app/index');
+ }
+
+ public function load_dash()
+ {
+ $session_set_value = $this->session->all_userdata();
+ if (isset($session_set_value['remember_me']) && $session_set_value['remember_me'] == "1") {
+ $this->load->view('Mobile_app/dash_main');
+ } else {
+ redirect('Mobile_app/select_doctor_login');
+ }
+ }
+
+ public function select_doctor_login()
+ {
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id
+ and s.med_spec_id =m.id
+ where d.active=1 group by d.id ";
+ $query = $this->db->query($sql);
+
+ $data['doctor_data']= $query->result();
+
+ $this->load->view('Mobile_app/select_doctor',$data);
+ }
+
+ public function login($doc_id=0)
+ {
+ // Retrieve session data
+ $session_set_value = $this->session->all_userdata();
+
+ $data['doc_id'] = $doc_id;
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=$doc_id group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doctor_data_profile']= $query->result();
+
+ // Check for remember_me data in retrieved session data
+ if (isset($session_set_value['remember_me']) && $session_set_value['remember_me'] == "1") {
+ //$this->load->view('admin_page');
+ $this->load->view('Mobile_app/dash_main',$data);
+ } else {
+
+ // Check for validation
+ $this->form_validation->set_rules('password', 'Pin Number', 'trim|required|xss_clean');
+
+ if ($this->form_validation->run() == FALSE) {
+ //$this->load->view('login_form');
+ $this->load->view('Mobile_app/login',$data);
+ } else {
+ $username = $doc_id;
+ $password = $this->input->post('password');
+
+ $sql = "SELECT *
+ FROM doctor_master
+ WHERE id=$username and login_pin='$password'";
+
+ $query = $this->db->query($sql);
+ $data_login= $query->result();
+
+ if (count($data_login)>0) {
+ $this->session->set_userdata('remember_me', TRUE);
+
+ $sess_data = array(
+ 'p_fname'=> $data_login[0]->p_fname,
+ 'p_mname'=> $data_login[0]->p_mname,
+ 'doc_id' => $data_login[0]->id,
+ 'username' => $username,
+ 'password' => $password
+ );
+
+ $this->session->set_userdata('logged_in', $sess_data);
+ //$this->load->view('admin_page');
+
+
+
+ $data['user'] = 1;
+ $this->load->view('Mobile_app/dash_main',$data);
+
+ } else {
+ $data['error_message'] = 'Invalid Pin';
+
+ $this->load->view('Mobile_app/login', $data);
+ }
+ }
+ }
+ }
+
+ public function logout()
+ {
+ // Destroy session data
+ $this->session->sess_destroy();
+ $data['message_display'] = 'Successfully Logout';
+ redirect('Mobile_app/select_doctor_login');
+ }
+
+
+ //Customer Search
+ function patient_index_all($day=-1,$doc_id=0)
+ {
+ $data['doc_id']=$doc_id;
+ $data['day']=$day;
+
+ $data['_view'] = '';
+
+ $this->load->view('Mobile_app/patient_page',$data);
+ }
+
+ function patient_index($day=0,$doc_id=0)
+ {
+ if($doc_id==0)
+ {
+ $where="";
+ }else{
+ $where=" and o.doc_id = ".$doc_id;
+ }
+
+ if($day>=0){
+ $where_date=" and date(o.opd_book_date) = DATE_ADD(CURDATE(),INTERVAL -".$day." DAY)";
+ }
+
+ $sql = "SELECT p.*,Date_Format(o.last_opdvisit_date,'%d-%m-%Y %H:%i') AS last_date_visit,
+ o.*,
+ if(date(o.opd_book_date)=curdate(),1,0) as opd_today
+ FROM (patient_master_exten p
+ JOIN opd_master o ON p.id=o.p_id)
+ WHERE 1=1 $where_date $where
+ Group by p.id
+ order by o.opd_id desc";
+
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $data['doc_id']=$doc_id;
+ $data['day']=$day;
+
+ $data['sql']= $sql;
+
+ $data['_view'] = 'Mobile_app/patient_search_v';
+
+ $this->load->view('Mobile_app/patient_page',$data);
+ }
+
+ function patient_search()
+ {
+ $doc_id=$this->input->post('doc_id');
+ $day=$this->input->post('day');
+ $sdata=$this->input->post('data_search');
+
+ $where="1=1 ";
+
+ if($doc_id==0)
+ {
+ $where.="";
+ }else{
+ $where.=" and o.doc_id = ".$doc_id;
+ }
+
+ if($day>=0){
+ $where_date=" and date(o.opd_book_date) = DATE_ADD(CURDATE(),INTERVAL -".$day." DAY)";
+ }else{
+ $where_date="";
+ }
+
+ $sdata = preg_replace('/[^A-Za-z0-9 _\-]/', '', trim($sdata));
+
+ if(is_numeric($sdata))
+ {
+ $where.=" and (mphone1 = '".$sdata."' or udai='".$sdata."' or p_code like '%".$sdata."')" ;
+ }elseif (filter_var($sdata, FILTER_VALIDATE_EMAIL)) {
+ $where.=" email1 = '".$sdata."'" ;
+ }else{
+ $where.=" and (p_fname like '%".$sdata."%' or
+ SUBSTRING_INDEX(p_fname,' ',1) sounds like '".$sdata."')";
+ }
+
+ $sql = "SELECT p.*,Date_Format(o.last_opdvisit_date,'%d-%m-%Y %H:%i') AS last_date_visit,
+ o.*,
+ if(date(o.opd_book_date)=curdate(),1,0) as opd_today
+ FROM (patient_master_exten p
+ JOIN opd_master o ON p.id=o.p_id)
+ WHERE ".$where." ".$where_date."
+ order by o.opd_id desc ";
+
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $data['sql']= $sql;
+
+ $this->load->view('Mobile_app/patient_search_v',$data);
+
+
+
+ }
+
+ function patient_index_opd()
+ {
+ if (isset($_POST['search'])){
+
+ $doc_id=$this->input->post('doc_id');
+ $day=$this->input->post('day');
+ $sdata=$this->input->post('search');
+
+ if($doc_id==0)
+ {
+ $where="1=1 ";
+ }else{
+ $where=" o.doc_id = ".$doc_id;
+ }
+
+ if($day>=0){
+ $where_date=" and date(o.opd_book_date) = DATE_ADD(CURDATE(),INTERVAL -".$day." DAY)";
+ }else{
+ $where_date=" and date(o.opd_book_date) > DATE_ADD(CURDATE(),INTERVAL -180 DAY)";
+ }
+
+ $sdata = preg_replace('/[^A-Za-z0-9 _\-]/', '', trim($sdata));
+
+ if(is_numeric($sdata))
+ {
+ $where.=" and (mphone1 = '".$sdata."' or udai='".$sdata."' or p_code like '%".$sdata."')" ;
+ }elseif (filter_var($sdata, FILTER_VALIDATE_EMAIL)) {
+ $where.=" and email1 = '".$sdata."'" ;
+ }else{
+ $where.=" and (p_fname like '%".$sdata."%' or
+ SUBSTRING_INDEX(p_fname,' ',1) sounds like '".$sdata."')";
+ }
+
+ $sql = "SELECT p.*,Date_Format(p.last_visit,'%d-%m-%Y %H:%i') AS last_date_visit,
+ o.doc_name,
+ if(date(o.opd_book_date)=curdate(),1,0) as opd_today
+ FROM (patient_master_exten p
+ JOIN opd_master o ON p.id=o.p_id)
+ WHERE ".$where." ".$where_date." Group by p.id
+ order by o.opd_id desc ";
+
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $data['sql']= $sql;
+
+ $content=$this->load->view('Mobile_app/patient_search_v',$data,TRUE);
+
+ echo $content;
+ echo $sql;
+
+ }
+ }
+
+
+ function person_record($pno)
+ {
+ $sql="select * from patient_master_exten where id=".$pno;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date
+ from opd_master where p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['opd_List']= $query->result();
+
+ $sql="select m.id,m.invoice_code,Date_Format(m.inv_date,'%d-%m-%y') as str_inv_date,m.inv_name,
+ if(count(t.id)>0,group_concat(t.item_name SEPARATOR ' / '),'No-Item') as Item_List, m.net_amount,m.invoice_status
+ from invoice_master m left join invoice_item t on m.id=t.inv_master_id
+ where attach_type=0 and attach_id=".$pno." group by m.id order by m.id desc";
+ $query = $this->db->query($sql);
+ $data['invoice_list']= $query->result();
+
+ $sql="select i.*,m.ins_company_name,m.opd_allowed,m.charge_cash
+ from hc_insurance_card i join hc_insurance m on i.insurance_id=m.id
+ where m.active=1 and i.p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['data_insurance_card']= $query->result();
+
+ $sql="select *,Date_Format(date_registration,'%d-%m-%Y') as str_date_registration from organization_case_master where status=0 and p_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from file_upload_data where id=".$data['data'][0]->profile_file_id;
+ $query = $this->db->query($sql);
+ $file_data= $query->result();
+
+ $profile_file_path="/assets/images/no_image.jpg";
+
+ if(count($file_data)>0)
+ {
+ $pos=strpos($file_data[0]->full_path,'/uploads/',1) ;
+ $profile_file_path=substr($file_data[0]->full_path,$pos);
+ }
+
+ $data['profile_file_path']=$profile_file_path;
+
+ $sql="select * from file_upload_data where pid=".$pno." order by id desc";
+ $query = $this->db->query($sql);
+ $data['opd_file_list']= $query->result();
+
+ $this->load->view('Mobile_app/patient_opd_profile',$data);
+
+ }
+
+
+ public function show_profile_opd($p_id)
+ {
+ $data['p_id']=$p_id;
+
+ $sql="select * from patient_master_exten where id=".$p_id;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select o.* from opd_master o where o.p_id=$p_id order by o.opd_id desc";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select o.* from opd_master o where o.p_id=$p_id and date(o.apointment_date)=curdate()";
+ $query = $this->db->query($sql);
+ $data['opd_master_current']= $query->result();
+
+ $this->load->view('Mobile_app/person_file_show',$data);
+ }
+
+ public function take_opd_picture($opd_id,$pno)
+ {
+ $data['opd_id']=$opd_id;
+ $data['pno']=$pno;
+
+ $sql="select * from patient_master_exten where id=".$pno;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select o.* from opd_master o where o.opd_id=$opd_id";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+
+ $this->load->view('Mobile_app/opd_scan',$data);
+ }
+
+ //IPD Panel
+
+ public function ipd_panel($doc_id=0)
+ {
+ $sql="select * from v_ipd_list
+ where FIND_IN_SET($doc_id,doc_list)>0
+ and (ipd_status=0 or (ipd_status=1 and discharge_date>date_add(sysdate(),interval -15 day)))" ;
+ $query = $this->db->query($sql);
+ $data['ipd_data']= $query->result();
+
+ $sql="select * from v_ipd_list
+ where (ipd_status=0 or (ipd_status=1 and discharge_date>date_add(sysdate(),interval -15 day)))" ;
+ $query = $this->db->query($sql);
+ $data['ipd_data_all']= $query->result();
+
+ $this->load->view('Mobile_app/ipd_panel',$data);
+ }
+
+}
+
diff --git a/old_code_ci3/controllers/OcasePathLap.php b/old_code_ci3/controllers/OcasePathLap.php
new file mode 100644
index 0000000..6d5fb69
--- /dev/null
+++ b/old_code_ci3/controllers/OcasePathLap.php
@@ -0,0 +1,650 @@
+input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('invoice_M');
+ $this->load->model('Payment_M');
+
+ $sql="select * from invoice_master where id='".$this->input->post('lab_invoice_id')."'";
+ $query = $this->db->query($sql);
+ $inv_master= $query->result();
+
+ $invoice_id=$this->input->post('lab_invoice_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $showcontent1='
+
+
+ Payment Method by : ';
+
+ $showcontent2='
';
+
+ $pay_remark='';
+
+ if($inv_master[0]->discount_amount>0)
+ {
+ $pay_remark='Dis.Amt.:'.$inv_master[0]->discount_desc.' /Amount: '. $inv_master[0]->discount_amount.'/Update:'.$inv_master[0]->disc_update_by;
+ }
+
+ $amountpaid=$this->input->post('input_amount_paid');
+ $amountbalanace=0.00;
+
+ if($amountpaid < $inv_master[0]->net_amount )-$amountpaid;
+ {
+ $amountbalanace=$inv_master[0]->net_amount;
+ }
+
+ if($this->input->post('mode')==1)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'2',
+ 'payof_id'=>$invoice_id,
+ 'payof_code'=>$inv_master[0]->invoice_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$amountpaid,
+ 'payment_date'=>date('d/m/Y H:m:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']'
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+
+ 'payment_mode'=> '1',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'payment_mode_desc'=>'Cash',
+ 'payment_id'=>$insert_id,
+ 'confirm_invoice'=>date('d/m/Y H:m:s'),
+ 'prepared_by'=>$user_name.'['.$user_id.']'
+ );
+
+ $this->invoice_M->update( $data,$invoice_id);
+
+ $status='CASH';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==2)
+ {
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_mac',
+ 'label' => 'Card Bank Name',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_card_digit',
+ 'label' => 'Card Last 4 Digit ',
+ 'rules' => 'required|min_length[4]|max_length[4]'
+ ),
+ array(
+ 'field' => 'input_card_bank',
+ 'label' => 'Bank Name ',
+ 'rules' => 'required|min_length[1]|max_length[50]'
+ ),
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[3]|max_length[15]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+ if ($this->form_validation->run() == TRUE)
+ {
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'payof_type'=>'2',
+ 'payof_id'=>$invoice_id,
+ 'payof_code'=>$inv_master[0]->invoice_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$amountpaid,
+ 'payment_date'=>date('d/m/Y H:m:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'cust_card'=>$this->input->post('input_card_bank'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'card_tran_id'=>$this->input->post('input_card_tran')
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '2',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'payment_mode_desc'=>'Bank Card',
+ 'payment_id'=>$insert_id,
+ 'confirm_invoice'=>date('d/m/Y H:m:s'),
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'cust_card'=>$this->input->post('input_card_bank'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'prepared_by'=>$user_name.'['.$user_id.']'
+ );
+ $this->invoice_M->update( $data,$invoice_id);
+
+ $status='Bank Card';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ if($this->input->post('mode')==3)
+ {
+ $data = array(
+
+ 'payment_mode'=> '3',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'payment_mode_desc'=>'IPD Credit',
+ 'confirm_invoice'=>date('d/m/Y H:m:s'),
+ 'ipd_id'=>$this->input->post('ipd_id'),
+ 'prepared_by'=>$user_name.'['.$user_id.']'
+
+ );
+
+ $this->invoice_M->update( $data,$invoice_id);
+
+ $status='IPD Credit';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==4)
+ {
+ $data = array(
+
+ 'payment_mode'=> '3',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'payment_mode_desc'=>'Org.Case Credit',
+ 'confirm_invoice'=>date('d/m/Y H:m:s'),
+ 'insurance_case_id'=>$this->input->post('case_id'),
+ 'prepared_by'=>$user_name.'['.$user_id.']'
+
+ );
+
+ $this->invoice_M->update( $data,$invoice_id);
+
+ $status='Org. Credit';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==0)
+ {
+
+ }
+ }
+
+ public function edit_org_invoice($invoice_id)
+ {
+ $sql="select * from hc_item_type";
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $sql="select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from invoice_master where id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster']= $query->result();
+
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $ins_comp_id=$data['invoiceMaster'][0]->insurance_id;
+
+ if($ins_comp_id<2)
+ {
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from hc_items where itype=1";
+ }else{
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id=0,'','-INS')) as sdesc from v_hc_items_with_insurance
+ where itype=1 and hc_insurance_id in (0,".$ins_comp_id.")";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ $this->load->view('Invoice/Organization_Invoice_PathLab',$data);
+ }
+
+ public function addPathTest($pno,$ins_id=0)
+ {
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select * from hc_item_type";
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $ins_comp_id=0;
+
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $ins_comp_id=$data['hc_insurance_card'][0]->insurance_id;
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ if($ins_comp_id<2)
+ {
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from hc_items where itype=1 order by idesc ";
+ }else{
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id=0,'','-INS')) as sdesc from v_hc_items_with_insurance
+ where itype=1 and hc_insurance_id in (0,".$ins_comp_id.") order by idesc ";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ $this->load->model('invoice_M');
+
+ $sql="select count(*) as no_invoice from invoice_master where invoice_status=0 and insurance_card_id>0 and attach_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['chk_draft_invoice']= $query->result();
+
+ if($data['chk_draft_invoice'][0]->no_invoice<1)
+ {
+ $data['insert_invoice'] = array(
+ 'attach_type' => '0',
+ 'attach_id' => $pno,
+ 'inv_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'inv_name' => $data['person_info'][0]->p_fname,
+ 'insurance_id' => $ins_comp_id,
+ 'insurance_card_id' => $ins_id,
+ 'insurance_cash' => $data['insurance'][0]->path_cash,
+ 'insurance_credit' => $data['insurance'][0]->path_credit,
+ 'inv_a_code' => $data['person_info'][0]->p_code
+ );
+ $inser_id=$this->invoice_M->create_invoice( $data['insert_invoice']);
+ }else{
+ $sql="select id from invoice_master where invoice_status=0 and attach_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['invoice_id']= $query->result();
+
+ $inser_id=$data['invoice_id'][0]->id;
+ }
+
+ if($inser_id)
+ {
+ $sql="select * from invoice_master where id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster']= $query->result();
+
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+ }
+
+ $this->load->view('Invoice/Organization_Invoice_PathLab',$data);
+ }
+
+ public function list_pathtest_bytype()
+ {
+ $tid=$this->input->post('itype_idv');
+ $ins_id=$this->input->post('ins_id');
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from hc_items where itype=".$tid;
+
+ if($ins_id>1)
+ {
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id=0,'','-INS')) as sdesc from v_hc_items_with_insurance
+ where itype=".$tid." and hc_insurance_id in (0,".$ins_id.") order by idesc";
+
+ }else{
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from hc_items where itype=".$tid." order by idesc";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ echo '
+ Charge Code ';
+
+ echo ' ';
+ foreach($data['labitem'] as $row)
+ {
+ echo ''.$row->sdesc.' ';
+ }
+ echo '
';
+
+
+ }
+
+ public function get_echs_id()
+ {
+ $itype_name_id_srno=$this->input->post('input_charge_code');
+ $tid=$this->input->post('itype_idv');
+
+ $sql="select * from hc_items where itype=".$tid." and echs_sr_no='".$itype_name_id_srno."'";
+ //echo $sql;
+ $query = $this->db->query($sql);
+ $data['echs_data']= $query->result();
+
+ if($query->num_rows()>0)
+ {
+ echo $data['echs_data'][0]->id;
+ }else{
+ echo '0';
+ }
+ }
+
+ public function update_refer_doc()
+ {
+ $invoice_id=$this->input->post('inv_id');
+ $doc_id=$this->input->post('doc_id');
+
+ if($doc_id<1)
+ {
+ $refername=$this->input->post('refername');
+ }else{
+ $sql="select * from doctor_master where id=".$doc_id;
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+ $refername=$data['doc_master'][0]->p_fname;
+ }
+
+ $dataupdate = array(
+ 'refer_by_id' => $doc_id,
+ 'refer_by_other' => $refername
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+ }
+
+
+ public function showinvoice($invoice_id)
+ {
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $ins_comp_id=$data['invoice_master'][0]->insurance_id;
+ $ins_id=$data['invoice_master'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master where status=0 and p_id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=2 and payof_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $discount_amount=$data['invoice_master'][0]->discount_amount ;
+ $total_amount=$data['invoiceGtotal'][0]->Gtotal;
+ $net_amount=$total_amount-$discount_amount;
+ $paid_amount=$data['payment_history'][0]->paid_amount;
+ $balance_amount=$net_amount-$paid_amount;
+
+ if($balance_amount>0)
+ {
+ $payment_part=1;
+ }else{
+ $payment_part=0;
+ }
+
+ $dataupdate = array(
+ 'total_amount' => $total_amount,
+ 'net_amount' => $net_amount,
+ 'payment_part_received' => $paid_amount,
+ 'payment_part_balance' => $balance_amount,
+ 'payment_part' => $payment_part
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $this->load->view('Invoice/Organization_Invoice_PathLab_final_V',$data);
+ }
+
+ public function showitem($type)
+ {
+ $this->load->model('invoice_M');
+
+ if($type>0)
+ {
+ $ins_id=$this->input->post('ins_id');
+
+ $sql="select * from hc_items where id=".$this->input->post('itype_name_id');
+ if($ins_id>1)
+ {
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id=0,'','-INS')) as sdesc,amount1 from v_hc_items_with_insurance
+ where id=".$this->input->post('itype_name_id')." and hc_insurance_id in (0,".$ins_id.")";
+
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $item_rate=$data['itemlist'][0]->amount1;
+
+ $amount_value=$this->input->post('input_qty')*$item_rate;
+
+ }
+ else
+ {
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc,amount from hc_items where id=".$this->input->post('itype_name_id');
+
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $item_rate=$data['itemlist'][0]->amount;
+
+ $amount_value=$this->input->post('input_qty')*$item_rate;
+ }
+
+ $data['insert_invoice_item'] = array(
+ 'inv_master_id' => $this->input->post('lab_invoice_id'),
+ 'item_type' => $this->input->post('itype_idv'),
+ 'item_id' => $this->input->post('itype_name_id'),
+ 'item_name' => $data['itemlist'][0]->sdesc,
+ 'item_rate' => $item_rate,
+ 'item_added_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'item_qty' => $this->input->post('input_qty'),
+ 'item_amount' => $amount_value
+ );
+
+ $inser_id=$this->invoice_M->addinvoiceitem( $data['insert_invoice_item']);
+
+ }else{
+ $this->db->delete("invoice_item", "id=".$this->input->post('itemid'));
+ }
+
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$this->input->post('lab_invoice_id');
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$this->input->post('lab_invoice_id');
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ echo '
+
+ #
+ Item Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+ ';
+
+ $srno=0;
+
+ foreach($data['invoiceDetails'] as $row)
+ {
+ $srno=$srno+1;
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$row->item_amount.' ';
+ echo '-Remove ';
+
+ echo ' ';
+ }
+
+ echo ' ';
+
+ echo '
+ #
+
+
+
+ Gross Total
+ '.$data['invoiceGtotal'][0]->Gtotal.'
+
+
+
';
+ }
+
+ public function invoice_print($invoice_id)
+ {
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $ins_comp_id=$data['invoice_master'][0]->insurance_id;
+ $ins_id=$data['invoice_master'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select * from organization_case_master where id=".$data['invoice_master'][0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select *,(case payment_mode when 1 Then 'cash' when 2 then 'Bank Card' when 3 then 'Org Credit' else 'Pending' end) as Payment_type_str from payment_history where payof_type=2 and payof_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $this->load->view('Invoice/Organization_invoice_print_v',$data);
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Ocasemaster.php b/old_code_ci3/controllers/Ocasemaster.php
new file mode 100644
index 0000000..477e4bf
--- /dev/null
+++ b/old_code_ci3/controllers/Ocasemaster.php
@@ -0,0 +1,672 @@
+db->query($sql);
+ $data['or_case_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['or_case_master'][0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select * from hc_item_type";
+
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id>0,'Ins.','Cash')) as sdesc from v_hc_items_with_insurance where itype=1 and hc_insurance_id in (0,".$data['or_case_master'][0]->insurance_id.")";
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ $this->load->model('invoice_M');
+
+ $sql="select count(*) as no_invoice from invoice_master where invoice_status=0 and case_id=".$caseid;
+ $query = $this->db->query($sql);
+ $data['chk_draft_invoice']= $query->result();
+
+ if($data['chk_draft_invoice'][0]->no_invoice<1)
+ {
+ $data['insert_invoice'] = array(
+ 'attach_type' => '0',
+ 'attach_id' => $data['or_case_master'][0]->p_id,
+ 'case_id' => $caseid,
+ 'inv_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'inv_name' => $data['person_info'][0]->p_fname,
+ 'inv_a_code' => $data['person_info'][0]->p_code
+ );
+ $inser_id=$this->invoice_M->create_invoice( $data['insert_invoice']);
+ }else{
+ $sql="select id from invoice_master where invoice_status=0 and attach_id=".$data['or_case_master'][0]->p_id;
+ $query = $this->db->query($sql);
+ $data['invoice_id']= $query->result();
+
+ $inser_id=$data['invoice_id'][0]->id;
+ }
+
+ if($inser_id)
+ {
+ $sql="select * from invoice_master where id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster']= $query->result();
+
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+ }
+
+ $this->load->view('Invoice/Organization_Invoice_PathLab',$data);
+ }
+
+ public function create() {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_mphone1',
+ 'label' => 'Phone Number',
+ 'rules' => 'required|min_length[10]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_name',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[2]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_insurance_id',
+ 'label' => 'Insurance No',
+ 'rules' => 'required|min_length[2]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_card_holder_name',
+ 'label' => 'Insurance Card Holder Name',
+ 'rules' => 'required|min_length[2]|max_length[50]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $ins_id=$this->input->post('Insurance_id');
+ $case_type=$this->input->post('case_type');
+
+ $sql="select * from hc_insurance where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['data_insurance']= $query->result();
+
+ $ins_id_name = $data['data_insurance'][0]->ins_company_name;
+
+ $this->load->model('Ocasemaster_M');
+ $data = array(
+ 'p_phone_number' => $this->input->post('input_mphone1'),
+ 'p_name' => $this->input->post('input_name'),
+ 'p_gender' => $this->input->post('optionsRadios_gender'),
+ 'date_registration' => str_to_MysqlDate($this->input->post('datepicker_dob')),
+ 'p_id' => $this->input->post('p_id'),
+ 'case_type' => $this->input->post('case_type'),
+ 'insurance_card_id'=>$this->input->post('inc_card_id'),
+ 'insurance_no' => $this->input->post('input_insurance_id'),
+ 'insurance_no_1' => $this->input->post('input_insurance_no_1'),
+ 'insurance_no_2' => $this->input->post('input_insurance_no_2'),
+ 'insurance_no_3' => $this->input->post('input_insurance_no_3'),
+ 'insurance_card_name' => $this->input->post('input_card_holder_name'),
+ 'insurance_id' => $this->input->post('Insurance_id'),
+ 'insurance_company_name' => $ins_id_name
+ );
+
+ $sql="select * from organization_case_master
+ where status=0 and case_type=$case_type and p_id=".$this->input->post('p_id');
+ $query = $this->db->query($sql);
+ $chk_data= $query->result();
+
+ if(count($chk_data)>0)
+ {
+ $inser_id=$chk_data[0]->id;
+
+ }else{
+ $inser_id=$this->Ocasemaster_M->insert($data);
+ }
+
+ if($case_type==1)
+ {
+ $sql="select * from ipd_master
+ where case_id=0 and ipd_status=0 and p_id=".$this->input->post('p_id');
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ if(count($ipd_master)>0)
+ {
+ $this->load->model('Ipd_M');
+ $update_ipd=array(
+ 'case_id'=>$inser_id
+ );
+ $this->Ipd_M->update($update_ipd,$ipd_master[0]->id);
+
+ $update_org=array(
+ 'ipd_id'=>$ipd_master[0]->id
+ );
+ $this->Ocasemaster_M->update($update_org,$inser_id);
+ }
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'p_id'=> $this->input->post('p_id'),
+ 'ins_id'=>$ins_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else
+ {
+ $send_error=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function load($caseid)
+ {
+ $sql="select * from organization_case_master where id='".$caseid."' ";
+ $query = $this->db->query($sql);
+ $data['or_case_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['or_case_master'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select * from hc_insurance";
+ $query = $this->db->query($sql);
+ $data['data_insurance']= $query->result();
+
+ $this->load->view('Invoice/Case_Form_profile_V',$data);
+ }
+
+ public function newcase($p_no,$ins_id,$case_type=0)
+ {
+ $sql="select * from hc_insurance where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['data_insurance']= $query->result();
+
+ $sql="select * from hc_insurance_card where p_id=".$p_no." and insurance_id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $ins_comp_id=$data['hc_insurance_card'][0]->insurance_id;
+
+ $sql="select * from organization_case_master
+ where case_type=$case_type and p_id='".$p_no."' and status=0 ";
+ $query = $this->db->query($sql);
+ $data['org_case_master']= $query->result();
+
+ if($query->num_rows()<1)
+ {
+ $new_case=1;
+ }else{
+ $new_case=0;
+ }
+
+ $data['case_type']=$case_type;
+
+ $this->db->where('id', $p_no);
+ $this->db->from('patient_master');
+ $query = $this->db->get();
+ $data['data']= $query->result();
+
+ $sql="select * from hc_insurance ";
+ $query = $this->db->query($sql);
+ $data['insurance_list']= $query->result();
+
+
+ if($new_case==1)
+ {
+ $this->load->view('Invoice/Case_Form_V',$data);
+ }
+ else{
+ $this->load->view('Invoice/Case_Form_profile_V',$data);
+ }
+
+ }
+
+
+
+ public function open_case($org_ID,$case_type=0)
+ {
+ $sql="select * from organization_case_master
+ where case_type=$case_type and id= $org_ID";
+ $query = $this->db->query($sql);
+ $data['org_case_master']= $query->result();
+
+ $ins_id_org=$data['org_case_master'][0]->insurance_id;
+ $p_no=$data['org_case_master'][0]->p_id;
+
+ $sql="select * from hc_insurance_card where p_id=".$p_no." order by id desc";
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $ins_id=$data['hc_insurance_card'][0]->insurance_id;
+
+ $sql="select * from hc_insurance where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['data_insurance']= $query->result();
+
+
+ $sql="select * from hc_insurance ";
+ $query = $this->db->query($sql);
+ $data['insurance_list']= $query->result();
+
+ $data['ipd_id']=0;
+ $data['case_type']=$case_type;
+
+ if($case_type==1)
+ {
+ $sql="select * from ipd_master where case_id=$org_ID";
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ if(count($ipd_master)>0)
+ {
+ $data['ipd_id']=$ipd_master[0]->id;
+ }
+ }
+
+ $this->db->where('id', $p_no);
+ $this->db->from('patient_master');
+ $query = $this->db->get();
+ $data['data']= $query->result();
+
+ $this->load->view('Invoice/Case_Form_profile_V',$data);
+
+ }
+
+ public function update() {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_mphone1',
+ 'label' => 'Phone Number',
+ 'rules' => 'required|min_length[10]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_name',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[2]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_insurance_id',
+ 'label' => 'Insurance No',
+ 'rules' => 'required|min_length[2]|max_length[30]'
+ ),
+ array(
+ 'field' => 'datepicker_dob',
+ 'label' => 'Date of Registration',
+ 'rules' => 'required|min_length[2]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_card_holder_name',
+ 'label' => 'Insurance Card Holder Name',
+ 'rules' => 'required|min_length[2]|max_length[50]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $ins_id=$this->input->post('Insurance_id');
+ $p_id=$this->input->post('patient_id');
+ $case_type=$this->input->post('case_type');
+ $case_id=$this->input->post('c_id');
+
+ $sql="select * from hc_insurance where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['data_insurance']= $query->result();
+
+ $ins_id_name = $data['data_insurance'][0]->ins_company_name;
+
+ $sql="select * from organization_case_master where id=$case_id";
+ $query = $this->db->query($sql);
+ $org_case_master= $query->result();
+
+ $this->load->model('Ocasemaster_M');
+ $data = array(
+ 'p_phone_number' => $this->input->post('input_mphone1'),
+ 'p_name' => $this->input->post('input_name'),
+ 'p_gender' => $this->input->post('optionsRadios_gender'),
+ 'date_registration' => str_to_MysqlDate($this->input->post('datepicker_dob')),
+ 'remark' => $this->input->post('remark'),
+ 'insurance_no' => $this->input->post('input_insurance_id'),
+ 'insurance_no_1' => $this->input->post('input_insurance_no_1'),
+ 'insurance_no_2' => $this->input->post('input_insurance_no_2'),
+ 'insurance_no_3' => $this->input->post('input_insurance_no_3'),
+ 'insurance_card_name' => $this->input->post('input_card_holder_name'),
+ 'insurance_id' => $ins_id,
+ 'insurance_company_name' => $ins_id_name
+ );
+
+ $inser_id=$this->Ocasemaster_M->update($data,$case_id);
+
+ if($case_type==0)
+ {
+ $this->db->query("CALL p_org_update($case_id)");
+ }
+
+ if($case_type==1 && $org_case_master[0]->ipd_id==0)
+ {
+ $sql="select * from ipd_master where ipd_status=0 and case_id=0 and p_id=".$p_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ if(count($ipd_master)>0)
+ {
+ $this->load->model('Ipd_M');
+ $update_ipd=array(
+ 'case_id'=>$this->input->post('c_id')
+ );
+ $this->Ipd_M->update($update_ipd,$ipd_master[0]->id);
+
+ $update_org=array(
+ 'ipd_id'=>$ipd_master[0]->id
+ );
+ $this->Ocasemaster_M->update($update_org,$inser_id);
+
+ $update_ins_card=array(
+ 'insurance_id'=>$ins_id,
+ 'insurance_id'=>$ins_id_name,
+ );
+ $this->Ocasemaster_M->update($update_org,$inser_id);
+ }
+ }
+
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=> Show_Alert('success','Saved','Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else
+ {
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function confirm_payment()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('invoice_M');
+
+ $showcontent1='
+
+
+ Payment Method by : ';
+
+ $showcontent2='
';
+
+ if($this->input->post('mode')==1)
+ {
+
+ $data = array(
+
+ 'payment_mode'=> '1',
+ 'payment_status'=>'1'
+
+ );
+
+ $this->invoice_M->update( $data,$this->input->post('oid'));
+
+ $status='CASH';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==2)
+ {
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_mac',
+ 'label' => 'Card Bank Name',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_card_digit',
+ 'label' => 'Card Last 4 Digit ',
+ 'rules' => 'required|min_length[4]|max_length[4]'
+ ),
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[3]|max_length[15]'
+ )
+ );
+ $this->form_validation->set_rules($FormRules);
+ if ($this->form_validation->run() == TRUE)
+ {
+ $data = array(
+ 'payment_mode'=> '2',
+ 'payment_status'=>'1',
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'card_tran_id'=>$this->input->post('input_card_tran')
+ );
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='Bank Card';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ if($this->input->post('mode')==3)
+ {
+ $data = array(
+
+ 'payment_mode'=> '3',
+ 'payment_status'=>'1',
+ 'ech_clam_id'=>$this->input->post('input_claim_id'),
+
+ );
+
+ $this->invoice_M->update( $data,$this->input->post('oid'));
+
+ $status='ECHS Credit';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==0)
+ {
+
+ }
+ }
+
+ public function list_pathtest_bytype()
+ {
+ $tid=$this->input->post('itype_idv');
+ $insid=$this->input->post('insurance_id');
+
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id>0,'Ins.','Cash')) as sdesc from v_hc_items_with_insurance where itype='".$tid."' and hc_insurance_id in (0,".$insid.")";
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ echo '
+ Test Name
+ ';
+ foreach($data['labitem'] as $row)
+ {
+ echo ''.$row->sdesc.' ';
+ }
+ echo '
';
+
+ }
+
+ public function showinvoice($invoice_id)
+ {
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $this->load->view('Invoice_PathLab_final_V',$data);
+ }
+
+ public function showitem($type)
+ {
+ $this->load->model('invoice_M');
+
+ if($type>0)
+ {
+ $sql="select * from v_hc_items_with_insurance where id=".$this->input->post('itype_name_id');
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $amount_value=$this->input->post('input_qty')*$data['itemlist'][0]->amount;
+ $amount_value2=$this->input->post('input_qty')*$data['itemlist'][0]->amount1;
+
+ $data['insert_invoice_item'] = array(
+ 'inv_master_id' => $this->input->post('lab_invoice_id'),
+ 'item_type' => $this->input->post('itype_idv'),
+ 'item_id' => $this->input->post('itype_name_id'),
+ 'item_name' => $data['itemlist'][0]->idesc,
+ 'item_rate' => $data['itemlist'][0]->amount,
+ 'item_added_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'item_qty' => $this->input->post('input_qty'),
+ 'item_amount' => $amount_value,
+ 'item_amount1' => $amount_value2
+ );
+
+ $inser_id=$this->invoice_M->addinvoiceitem( $data['insert_invoice_item']);
+
+ }else{
+
+ $this->db->delete("invoice_item", "id=".$this->input->post('itemid'));
+ }
+
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$this->input->post('lab_invoice_id');
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(if(item_amount1>0,item_amount1,item_amount)) as Gtotal from invoice_item where inv_master_id=".$this->input->post('lab_invoice_id');
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ echo '
+
+ #
+ Type
+ Test Name
+ Rate
+ Qty
+ Cash Amt
+ INS Amount
+
+ ';
+
+ $srno=1;
+
+ foreach($data['invoiceDetails'] as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$row->item_amount.' ';
+ echo ''.$row->item_amount1.' ';
+ echo '-Remove ';
+ $srno=$srno+1;
+ echo ' ';
+ }
+
+ echo '
+ #
+
+
+
+ Gross Total
+ '.$data['invoiceGtotal'][0]->Gtotal.'
+
+
+
';
+
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Opd.php b/old_code_ci3/controllers/Opd.php
new file mode 100644
index 0000000..4816383
--- /dev/null
+++ b/old_code_ci3/controllers/Opd.php
@@ -0,0 +1,2186 @@
+load->library("Pdf");
+ }
+
+ public function addopd($pno,$org_case_id=0)
+ {
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_spec_l']= $query->result();
+
+ $data['org_case_id']=$org_case_id;
+
+ if($org_case_id>0)
+ {
+ $sql="SELECT *
+ from organization_case_master
+ where id= $org_case_id";
+ $query = $this->db->query($sql);
+ $data['org_case_master']= $query->result();
+ }
+
+ $this->load->view('opd_appointment_V',$data);
+ }
+
+
+
+ public function showfee()
+ {
+ $doc_id=$this->input->post('doc_id');
+ $p_id=$this->input->post('pid');
+ $org_case_id=$this->input->post('org_case_id');
+
+ $sql="select *
+ from doctor_master
+ where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ $no_opd_days=5-1;
+
+ if(count($doctor_master)>0)
+ {
+ $no_opd_days=$doctor_master[0]->opd_valid_no_days-1;
+ }
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$doc_id." group by d.id ";
+ $query = $this->db->query($sql);
+ $doc_info= $query->result();
+
+ $sql="SELECT * from opd_master where p_id=".$p_id." and doc_id=".$doc_id."
+ and apointment_date >= date_add(curdate(),interval -$no_opd_days day) and opd_fee_type<>3";
+ $query = $this->db->query($sql);
+ $opd_running= $query->result();
+
+ $sql="SELECT * from opd_master where p_id=".$p_id." ";
+ $query = $this->db->query($sql);
+ $opd_old= $query->result();
+
+ $fee_type_list="4,0";
+
+ $fee_type_select=1;
+
+ if(count($opd_old)>0)
+ {
+ if(count($opd_running)>0)
+ {
+ $fee_type_select=3;
+ $fee_type_list.=",3";
+ }else{
+ $fee_type_select=2;
+ $fee_type_list.=",2";
+ }
+
+ }else{
+ $fee_type_select=1;
+ $fee_type_list.=",1";
+ }
+
+ $content='';
+
+ $content.= 'Doctor Name : '.$doc_info[0]->p_fname.' / Specialization: '.$doc_info[0]->SpecName.' /
+ Gender : '.$doc_info[0]->xGender.' ';
+ $content.= ' ';
+
+
+ $sql="SELECT d.*,if(d.doc_fee_desc='',t.fee_type,d.doc_fee_desc) AS fee_desc
+ FROM doc_opd_fee d JOIN doc_fee_type t ON d.doc_fee_type=t.id
+ WHERE doc_id=".$doc_id." and t.id in (".$fee_type_list.")";
+
+ $query = $this->db->query($sql);
+ $data['doc_fee_a']= $query->result();
+
+ $sql="SELECT d.*,if(d.doc_fee_desc='',t.fee_type,d.doc_fee_desc) AS fee_desc
+ FROM doc_opd_fee d JOIN doc_fee_type t ON d.doc_fee_type=t.id
+ WHERE doc_id=".$doc_id." and t.id not in (".$fee_type_list.")";
+
+ $query = $this->db->query($sql);
+ $data['doc_fee_b']= $query->result();
+
+
+
+ $checked='';
+
+ foreach($data['doc_fee_a'] as $row)
+ {
+ if($row->id==$fee_type_select)
+ {
+ $checked='checked';
+ }
+
+ $content.= '';
+ $content.= ' ';
+ $content.= ' Rs. '.$row->amount.' ['.$row->fee_desc.' ]';
+ $content.= ' ';
+ }
+
+ $content.=" ";
+
+ $other_content='';
+
+ foreach($data['doc_fee_b'] as $row)
+ {
+ if($row->id==$fee_type_select)
+ {
+ $checked='checked';
+ }
+
+ $other_content.= '';
+ $other_content.= ' ';
+ $other_content.= ' Rs. '.$row->amount.' ['.$row->fee_desc.' ]';
+ $other_content.= ' ';
+ }
+
+ $content.='';
+ $content.='
+
+
+
+ '.$other_content.'
+
+
+
+
';
+
+ $rvar=array(
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ 'content'=>$content
+ );
+
+ $encode_data = json_encode($rvar);
+
+ echo $encode_data ;
+
+ }
+
+ public function invoice($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'cash' when 2 then 'Bank Card' when 3 then 'ECHS Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from organization_case_master
+ where status=0 and case_type=0 and p_id=".$data['patient_master'][0]->id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$data['opd_master'][0]->insurance_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['refund_order']= $query->result();
+
+ if(count($data['refund_order'])>0)
+ {
+ $data['refund_status']=1; // Refund Pending
+ }else{
+ $data['refund_status']=0 ; //No Pending
+ }
+
+ $sql="select sum(if(credit_debit=0,amount,amount*-1)) as paid_amount from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $data['paid_amount']=0;
+
+ if($data['payment_history'][0]->paid_amount=='' || $data['payment_history'][0]->paid_amount==0 )
+ {
+ $data['paid_amount']=0;
+ }else{
+ $data['paid_amount']=$data['payment_history'][0]->paid_amount;
+ }
+
+ $opd_fee_gross_amount=$data['opd_master'][0]->opd_fee_amount;
+
+ if($data['opd_master'][0]->payment_mode==4)
+ {
+ $data['pending_amount']=0;
+ }else{
+ $data['pending_amount']=$opd_fee_gross_amount-$data['paid_amount'];
+ }
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_spec_l']= $query->result();
+
+ $sql="select s.id,s.pay_type,m.bank_name
+ From hospital_bank m join hospital_bank_payment_source s on m.id=s.bank_id";
+ $query = $this->db->query($sql);
+ $data['bank_data']= $query->result();
+
+ $this->load->view('opd_invoice_V',$data);
+
+ }
+
+ public function invoice_print($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$data['opd_master'][0]->apointment_date."') AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$data['opd_master'][0]->insurance_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ if($data['opd_master'][0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$data['opd_master'][0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+ }
+
+ $this->load->view('invoice_print_v',$data);
+ }
+
+
+
+ public function opd_lettre_print($opdid)
+ {
+ $sql="Select * from opd_master where opd_id=$opdid";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $doc_id=0;
+ $no_opd_days=5-1;
+
+ if(count($opd_master)>0){
+
+ $doc_id=$opd_master[0]->doc_id;
+
+ $sql="select *
+ from doctor_master
+ where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ if(count($doctor_master)>0)
+ {
+ $no_opd_days=$doctor_master[0]->opd_valid_no_days-1;
+ }
+ }
+
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ date_format(date_add(apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$data['opd_master'][0]->apointment_date."') AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select *,date_format(date_add(apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date from opd_master
+ where p_id=".$data['opd_master'][0]->p_id." and opd_id < ".$opdid."
+ order by opd_id desc limit 1";
+ $query = $this->db->query($sql);
+ $data['old_opd']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$data['opd_master'][0]->insurance_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ if($data['opd_master'][0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$data['opd_master'][0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+ }
+
+ $this->load->view('opd_letter_head',$data);
+ }
+
+
+ public function confirm_opd()
+ {
+ $this->load->model('Opd_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.' '. $user->last_name.'['.date('d-m-Y H:i:s').']';
+
+ $sql="select * from patient_master where id=".$this->input->post('pid');
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$this->input->post('doc_id')." group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select * from doc_opd_fee where id=".$this->input->post('fee_id');
+ $query = $this->db->query($sql);
+ $data['doc_fee']= $query->result();
+
+ $sql="select * from opd_master where p_id=".$this->input->post('pid')." order by opd_id desc";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $last_Vist_date='';
+
+ if(count($data['opd_master'])>0)
+ {
+ $last_Vist_date=$data['opd_master'][0]->apointment_date;
+ }
+
+ $opd_fee_amount=$data['doc_fee'][0]->amount;
+ $opd_fee_desc=$data['doc_fee'][0]->doc_fee_desc;
+ $echs_credit=0;
+
+ $doc_id=$this->input->post('doc_id');
+
+ $data['insert'] = array(
+ 'p_id' => $this->input->post('pid'),
+ 'P_name' => strtoupper($data['person_info'][0]->p_fname),
+ 'doc_id' => $this->input->post('doc_id'),
+ 'insurance_id' => '0',
+ 'opd_fee_id' => $this->input->post('fee_id'),
+ 'opd_fee_amount' => $opd_fee_amount,
+ 'opd_fee_gross_amount' => $opd_fee_amount,
+ 'opd_fee_desc' => $opd_fee_desc,
+ 'doc_name' => $data['doc_info'][0]->p_fname,
+ 'opd_fee_type' =>$data['doc_fee'][0]->doc_fee_type,
+ 'apointment_date' =>str_to_MysqlDate($this->input->post('datepicker_appointment')),
+ 'doc_spec' => $data['doc_info'][0]->SpecName,
+ 'prepared_by' => $user_name_info,
+ );
+
+ $data['patient_master'] = array(
+ 'last_visit' => str_to_MysqlDate($this->input->post('datepicker_appointment')),
+ );
+
+ if(count($data['opd_master'])>0)
+ {
+ $data['insert']=array_merge($data['insert'],array('last_opdvisit_date'=>$data['opd_master'][0]->apointment_date));
+ }
+
+ $inser_id=$this->Opd_M->insert( $data['insert']);
+
+ if($inser_id>0)
+ {
+ $this->load->model('Patient_M');
+ $this->Patient_M->update($data['patient_master'],$this->input->post('pid'));
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'error_text'=>'OPD Register',
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function confirm_payment()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Opd_M');
+ $this->load->model('Payment_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name.'['.date('d-m-Y H:i:s').']';
+
+ $submit_page=$this->input->post('spid');
+ $oid=$this->input->post('oid');
+
+ $sql="select * from opd_master where opd_id='".$oid."'";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select COALESCE(SUM(if(credit_debit=0,amount,amount*-1)),0) AS opd_pay
+ from payment_history where payof_id='$oid' and payof_type=1";
+ $query = $this->db->query($sql);
+ $chk_payment= $query->result();
+
+ $pending_amt=$opd_master[0]->opd_fee_amount-$chk_payment[0]->opd_pay;
+
+ $pay_remark='';
+ if($opd_master[0]->opd_discount>0)
+ {
+ $pay_remark='Dis.Amt.:'.$opd_master[0]->opd_disc_remark.' /Amount: '. $opd_master[0]->opd_discount.'/Update:'.$opd_master[0]->opd_disc_update_by;
+ }
+
+ if($this->input->post('mode')==0)
+ {
+ $paydata = array(
+ 'payment_mode'=> '0',
+ 'payof_type'=>'1',
+ 'payof_id'=>$this->input->post('oid'),
+ 'payof_code'=>$opd_master[0]->opd_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$opd_master[0]->opd_fee_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name_info.' ['.$user_id.']',
+ 'update_by_id'=>$user_id,
+ 'insert_code'=>$submit_page
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '0',
+ 'payment_status'=>'1',
+ 'payment_mode_desc'=>'No Cost',
+ 'payment_id'=>$insert_id,
+ 'confirm_pay_opd'=>date('Y-m-d H:i:s'),
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='Zero Cost';
+
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$status,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==1 && $pending_amt>0)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'1',
+ 'payof_id'=>$this->input->post('oid'),
+ 'payof_code'=>$opd_master[0]->opd_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$opd_master[0]->opd_fee_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name_info.' ['.$user_id.']',
+ 'update_by_id'=>$user_id,
+ 'insert_code'=>$submit_page
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '1',
+ 'payment_status'=>'1',
+ 'payment_mode_desc'=>'Cash',
+ 'payment_id'=>$insert_id,
+ 'confirm_pay_opd'=>date('Y-m-d H:i:s'),
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='CASH';
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$status,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==2 && $pending_amt>0 )
+ {
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[3]|max_length[15]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+ if ($this->form_validation->run() == TRUE)
+ {
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'payof_type'=>'1',
+ 'payof_id'=>$this->input->post('oid'),
+ 'payof_code'=>$opd_master[0]->opd_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$opd_master[0]->opd_fee_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name_info.' ['.$user_id.']',
+ 'pay_bank_id'=>$this->input->post('cbo_pay_type'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '2',
+ 'payment_status'=>'1',
+ 'payment_mode_desc'=>'Bank/Online',
+ 'confirm_pay_opd'=>date('Y-m-d H:i:s'),
+ 'payment_id'=>$insert_id,
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='Bank Card';
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$status,
+
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error,
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ if($this->input->post('mode')==4)
+ {
+ $data = array(
+
+ 'payment_mode'=> '4',
+ 'payment_status'=>'1',
+ 'payment_mode_desc'=>'Org.Case Credit',
+ 'confirm_pay_opd'=>date('d/m/Y H:m:s'),
+ 'insurance_case_id'=>$this->input->post('case_id'),
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='Org. Case Credit';
+
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$status,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function update_discount()
+ {
+ $oid=$this->input->post('oid');
+
+ $opd_discount=$this->input->post('input_dis_amt');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from opd_master where opd_id=".$oid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $opd_fee_amount=$data['opd_master'][0]->opd_fee_gross_amount-$opd_discount;
+
+ $dataupdate = array(
+ 'opd_discount' => $this->input->post('input_dis_amt'),
+ 'opd_disc_remark' => $this->input->post('input_dis_desc'),
+ 'opd_fee_amount' => $opd_fee_amount,
+ 'opd_disc_update_by'=>$user_name.'['.$user_id.']'
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$oid);
+
+ }
+
+ public function update_doc_date()
+ {
+ $oid=$this->input->post('oid');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+
+ $doc_name_id=$this->input->post('doc_name_id');
+ $datepicker_opddate=str_to_MysqlDate($this->input->post('datepicker_opddate'));
+ $doc_opd_fee=$this->input->post('opd_fee_amt');
+
+
+ $sql="select * from opd_master where opd_id=".$oid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$doc_name_id." group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $opd_fee_amount=$doc_opd_fee-$data['opd_master'][0]->opd_discount;
+
+ $dataupdate = array(
+ 'doc_id' => $doc_name_id,
+ 'doc_name' => $data['doc_info'][0]->p_fname,
+ 'doc_spec' => $data['doc_info'][0]->SpecName,
+ 'apointment_date' => $datepicker_opddate,
+ 'opd_fee_gross_amount'=>$doc_opd_fee,
+ 'opd_fee_amount'=>$opd_fee_amount
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$oid);
+
+ $sql="select * from opd_master where opd_id=".$oid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select * from payment_history where payof_type=1 and payof_id=".$oid." and id=".$data['opd_master'][0]->payment_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ if(count($payment_history)>0)
+ {
+ $amount_diff=$payment_history[0]->amount-$opd_fee_amount;
+ if($amount_diff<>0)
+ {
+ $pay_remark=$payment_history[0]->remark." /Update OPD Rate Difference ".$amount_diff." :By ".$user_name;
+
+ $paydata = array(
+ 'amount'=>$data['opd_master'][0]->opd_fee_amount,
+ 'remark'=>$pay_remark,
+ );
+ $this->load->model('Payment_M');
+ $this->Payment_M->update($paydata,$payment_history[0]->id);
+ }
+
+ }
+
+ }
+
+ public function opd_load_doc($opdid)
+ {
+ $data['opdid']=$opdid;
+
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$data['opd_master'][0]->apointment_date."') AS age
+ from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $this->load->view('Person/OPD_file_upload',$data);
+ }
+
+
+ public function save_image($opdid)
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('webcam')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'upload_by_id'=>$user_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+
+ $user_name = $user->first_name.''. $user->last_name.':T-'.date('d-m-Y h:m:s');
+
+ $opdstatus=2;
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ echo $filename;
+ }
+ }
+ public function save_image_mobile($opdid)
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+
+ $user_id = '0';
+ $user_name = 'Mobile';
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('userfile')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ //print_r($data);
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'upload_by_id'=>$user_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+
+ $opdstatus=2;
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ echo 'File Upload successfully';
+ }
+ }
+
+ public function save_image_mobile_bak($opdid)
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+
+ $user_id = '0';
+ $user_name = 'Mobile';
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ $img = $_POST['userfile'];
+ $img = str_replace('data:image/jpeg;base64,', '', $img);
+ $img = str_replace(' ', '+', $img);
+ $data = base64_decode($img);
+
+ $file = $folder_name . '.jpeg';
+
+ $success = file_put_contents($file, $data);
+
+ print $success ? $file : 'Unable to save the file.';
+
+ if (!$success) {
+ $data = array('upload_data' => $this->upload->data());
+ print_r($data);
+
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ print_r($data);
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'upload_by_id'=>$user_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+
+ $opdstatus=2;
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ echo 'File Upload successfully';
+ }
+ }
+
+ public function opd_file_hide($file_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $upload_by_id = $user->id;
+
+ $udata = array(
+ 'show_type'=> '1',
+ 'upload_by_id'=>$upload_by_id
+ );
+ $this->load->model('File_M');
+
+ $this->File_M->update($udata,$file_id);
+
+ redirect('/Opd/opd_file_last_list');
+ }
+
+ public function opd_file_last_list($opdid='')
+ {
+ $user = $this->ion_auth->user()->row();
+ $upload_by_id = $user->id;
+
+ if($opdid=='')
+ {
+ $sql="select f.id,f.full_path,date_format(f.insert_date,'%d/%m/%Y-%H:%i') as strinsert_date,
+ f.file_ext,p.p_fname,p.str_age from file_upload_data f join patient_master_exten p on f.pid=p.id
+ where show_type=0 and upload_by_id=".$upload_by_id." order by id desc limit 5";
+ }else{
+ $sql="select f.id,f.full_path,date_format(f.insert_date,'%d/%m/%Y-%H:%i') as strinsert_date,
+ f.file_ext,p.p_fname,p.str_age from file_upload_data f join patient_master_exten p on f.pid=p.id
+ where show_type=0 and opd_id=$opdid and upload_by_id=$upload_by_id order by id desc limit 5";
+ }
+
+ $query = $this->db->query($sql);
+ $data['opd_file_list']= $query->result();
+
+ $this->load->view('Person/scan_opd_list',$data);
+ }
+
+ public function opd_file_list($opdid)
+ {
+ $sql="select * from file_upload_data where show_type=0 and opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_file_list']= $query->result();
+
+ $sql="select * from file_opd_rec where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $file_opd_rec= $query->result();
+
+ foreach($file_opd_rec as $row)
+ {
+ $full_path=$row->full_path;
+ $file_v_no=$row->v_no;
+
+ $start_no=stripos($full_path,$file_v_no);
+ $end_no=strlen($full_path);
+
+ $folder_name=substr($full_path,0,$start_no);
+
+ $files_info = get_dir_file_info($folder_name);
+
+ foreach($files_info as $key => $value) {
+ $find_file=number_format(substr_count($value['name'],$file_v_no),0);
+ if($find_file==1)
+ {
+ $index_key=str_replace($file_v_no.'_','',$value['name']);
+ $index_key=str_replace('.webm','',$index_key);
+
+ $file_list[$index_key] = $value['name'];
+ }
+ }
+
+ ksort($file_list);
+
+ $prev_file='';
+ $current_file='';
+ foreach($file_list as $key => $value) {
+ $current_file=$folder_name.'/'.$value;
+ if(strlen($prev_file)>0)
+ {
+ //First File
+ $objFH = fopen( $prev_file, "rb" );
+ $strBuffer1 = fread( $objFH, filesize( $prev_file) );
+ fclose( $objFH );
+
+ //Second File
+ $objFH = fopen( $current_file, "rb" );
+ $strBuffer2 = fread( $objFH, filesize( $current_file) );
+ fclose( $objFH );
+
+ // manipulate buffers here...
+ $strBuffer3 = $strBuffer1 . $strBuffer2;
+
+ // open for write/binary-safe
+ $objFH = fopen( $current_file, "wb" );
+ fwrite( $objFH, $strBuffer3 );
+ fclose( $objFH );
+
+ //Delete prev File
+ unlink($prev_file);
+
+ $prev_file=$current_file;
+
+ $data_upload = array(
+ 'opd_id' => $opd_id,
+ 'full_path' => $current_file,
+ );
+
+ $this->load->model('FileOPDRec_M');
+
+ $this->FileOPDRec_M->insert($data_upload,$file_v_no);
+ }
+
+ }
+
+
+
+ }
+
+ $sql="select * from file_opd_rec where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['file_opd_rec']= $query->result();
+
+ $this->load->view('Person/opd_file_show',$data);
+
+ }
+
+ public function opd_file_upload($opdid)
+ {
+ $data['opdid']=$opdid;
+
+ $this->load->view('Person/opd_scanfile_upload',$data);
+ }
+
+ public function opd_scanfiles_upload($opdid)
+ {
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $output_dir = $folder_name;
+
+ if(isset($_FILES["myfile"]))
+ {
+ $ret = array();
+
+ $error = $_FILES["myfile"]["error"];
+
+ // upload single file
+ if(!is_array($_FILES["myfile"]["name"])) //single file
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() .$_FILES["myfile"]["name"];
+ $config['upload_path'] = $folder_name;
+ $config['file_name'] = $filename;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg|pdf|doc';
+
+ $this->load->library('upload', $config);
+ echo $filename;
+ //move_uploaded_file($_FILES["myfile"]["tmp_name"],$output_dir.$fileName);
+
+ if (!$this->upload->do_upload('myfile')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+ $this->load->model('File_M');
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'opd_id'=>$opdid,
+ 'pid'=>$pid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+
+ }
+
+ $ret[]= $_FILES["myfile"]["name"];
+ }
+ else
+ {
+ // Handle Multiple files
+ $fileCount = count($_FILES["myfile"]["name"]);
+ for($i=0; $i<$fileCount; $i++)
+ {
+ $filename = 'OPD-'.$opdid.'-'.$i.'-'.time() .$_FILES["myfile"]["name"];
+
+ //$fileName = $_FILES["myfile"]["name"][$i];
+ //move_uploaded_file($_FILES["myfile"]["tmp_name"][$i],$output_dir.$fileName);
+
+ if (!$this->upload->do_upload($_FILES["myfile"]["tmp_name"][$i])) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+ $this->load->model('File_M');
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $ipd_id=$opd_master[0]->ipd_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+ }
+
+ $ret[]= $_FILES["myfile"]["name"][$i];
+ }
+ }
+ // output file names as comma seperated strings to display status
+ echo json_encode($ret);
+ }
+ }
+
+ public function opd_status($opdid,$opdstatus)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.':T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ public function get_appointment($opd_date='')
+ {
+ if($opd_date=='')
+ {
+ $opd_date=date('Y-m-d');
+
+ }
+
+ $data["opd_date"]=$opd_date;
+
+ $sql="select group_concat(DISTINCT o.doc_id ) as doc_list_opd
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id and m.id=s.med_spec_id)
+ join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'";
+ $query = $this->db->query($sql);
+ $doc_opd= $query->result();
+
+ if(count($doc_opd)>0)
+ {
+ $doc_opd_list=$doc_opd[0]->doc_list_opd;
+ }else{
+ $doc_opd_list="0";
+ }
+
+ if($doc_opd_list=='')
+ {
+ $doc_opd_list="0";
+ }
+
+ $sql="select d.id as doc_id, d.p_fname,count(DISTINCT o.opd_id) as No_opd,
+ group_concat(DISTINCT m.SpecName) as Spec,
+ count( DISTINCT CASE o.opd_status WHEN 1 THEN o.opd_id END) as count_wait,
+ count( DISTINCT CASE o.opd_status WHEN 2 THEN o.opd_id END) as count_visit,
+ count( DISTINCT CASE o.opd_status WHEN 3 THEN o.opd_id END) as count_cancel,
+ MOD(d.id,5) as color_code
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id and m.id=s.med_spec_id)
+ left join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'
+ where o.doc_id in (".$doc_opd_list.")
+ group by d.p_fname having count(DISTINCT o.opd_id)>0 ";
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+
+
+ $data['color']=array(
+ '0' => 'bg-yellow',
+ '1' => 'bg-red',
+ '2' => 'bg-green',
+ '3' => 'bg-gray',
+ '4' => 'bg-orange',
+ '5' => 'bg-blue'
+ );
+ $data['content']=$this->load->view('dashboard/opd_appointment_panel',$data,True);
+
+ $this->load->view('dashboard/appointment',$data);
+ }
+
+ public function get_appointment_data($opd_date='')
+ {
+ if($opd_date=='')
+ {
+ $opd_date=date('Y-m-d');
+
+ }
+
+ $data["opd_date"]=$opd_date;
+
+ $sql="select group_concat(DISTINCT o.doc_id ) as doc_list_opd
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id and m.id=s.med_spec_id)
+ join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'";
+ $query = $this->db->query($sql);
+ $doc_opd= $query->result();
+
+ if(count($doc_opd)>0)
+ {
+ $doc_opd_list=$doc_opd[0]->doc_list_opd;
+ }else{
+ $doc_opd_list="0";
+ }
+
+ if($doc_opd_list=='')
+ {
+ $doc_opd_list="0";
+ }
+
+ $sql="select d.id as doc_id, d.p_fname,count(DISTINCT o.opd_id) as No_opd,
+ group_concat(DISTINCT m.SpecName) as Spec,
+ count( DISTINCT CASE o.opd_status WHEN 1 THEN o.opd_id END) as count_wait,
+ count( DISTINCT CASE o.opd_status WHEN 2 THEN o.opd_id END) as count_visit,
+ count( DISTINCT CASE o.opd_status WHEN 3 THEN o.opd_id END) as count_cancel,
+ MOD(d.id,5) as color_code
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id and m.id=s.med_spec_id)
+ left join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'
+ where o.doc_id in (".$doc_opd_list.")
+ group by d.p_fname having count(DISTINCT o.opd_id)>0 ";
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+
+
+ $data['color']=array(
+ '0' => 'bg-yellow',
+ '1' => 'bg-red',
+ '2' => 'bg-green',
+ '3' => 'bg-gray',
+ '4' => 'bg-orange',
+ '5' => 'bg-blue'
+ );
+ $this->load->view('dashboard/opd_appointment_panel',$data);
+ }
+
+
+ public function opd_display($doc_id=1)
+ {
+ $opd_date=date('Y-m-d');
+
+ $data["opd_date"]=$opd_date;
+
+ $sql=" SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,o.payment_status,
+ group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id
+ ORDER BY opd_id ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_1']= $query->result();
+
+ $doc_id=2;
+
+ $sql=" SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,o.payment_status,
+ group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id
+ ORDER BY opd_id ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_2']= $query->result();
+
+ $data['color']=array();
+
+ $sql="select id,color_name,code_code from color";
+ $query = $this->db->query($sql);
+ $color= $query->result();
+
+ foreach($color as $aRow)
+ {
+ array_push($data['color'],$aRow->code_code);
+ }
+
+ $data['color1']=array(
+ '0' => 'bg-yellow',
+ '1' => 'bg-red',
+ '2' => 'bg-green',
+ '3' => 'bg-gray',
+ '4' => 'bg-orange',
+ '5' => 'bg-blue'
+ );
+
+ $this->load->view('dashboard/opd_display',$data);
+ }
+
+ public function opd_cancel($opdid)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str=$this->input->post('input_remark');
+
+ $opd_status_remark=$status_str.' [Update By:'.$user_name.']';
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount
+ from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from opd_master
+ where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select * from refund_order
+ where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ $insert_id=0;
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ if($payment_history[0]->paid_amount>0 && $opd_master[0]->opd_status==1)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 1,
+ 'refund_type_id' => $opdid,
+ 'refund_type_code' => $opd_master[0]->opd_code,
+ 'refund_type_reason' => 'Cancel OPD',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $payment_history[0]->paid_amount
+ );
+
+ $this->load->model('Payment_M');
+ $insert_id=$this->Payment_M->insert_refundorder($RefundRequest);
+ }
+ }else{
+ $insert_id=1;
+ }
+
+ $dataupdate = array(
+ 'opd_status' => '3',
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+
+ echo $insert_id;
+
+ }
+
+ public function opd_crorg($opdid,$org_code_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ if($payment_history[0]->paid_amount>0 && $opd_master[0]->opd_status==1)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 1,
+ 'refund_type_id' => $opdid,
+ 'refund_type_code' => $opd_master[0]->opd_code,
+ 'refund_type_reason' => 'Cr. to Org.',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $payment_history[0]->paid_amount
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+ }
+
+ $dataupdate = array(
+ 'payment_mode' => 3,
+ 'payment_id' => 0,
+ 'insurance_case_id' => $org_code_id,
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ public function opd_discount_update($opdid)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ $opd_discount=$this->input->post('input_dis_amt');
+ $opd_disc_remark=$this->input->post('input_dis_desc');
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ $opd_fee_amount=$opd_master[0]->opd_fee_gross_amount-$opd_discount;
+
+ if($payment_history[0]->paid_amount>0 && $opd_master[0]->opd_status==1 && $opd_fee_amount>=0 && $opd_discount>0)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 1,
+ 'refund_type_id' => $opdid,
+ 'refund_type_code' => $opd_master[0]->opd_code,
+ 'refund_type_reason' => 'Discount',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $opd_discount,
+ 'patient_id' => $opd_master[0]->p_id,
+ 'patient_name' =>$opd_master[0]->P_name
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+
+ if($opd_fee_amount>=0)
+ {
+ $dataupdate = array(
+ 'opd_discount' => $opd_discount,
+ 'opd_disc_remark' => $opd_disc_remark,
+ 'opd_fee_amount' => $opd_fee_amount,
+ 'opd_disc_update_by'=>$user_name.'['.$user_id.']'
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+ }
+ }
+
+ public function scan_opd_desktop()
+ {
+ $this->load->view('Person/opd_scan_desktop');
+ }
+
+ public function search_scan_opd()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9 _\-]/', '', trim($sdata));
+
+ if(is_numeric($sdata))
+ {
+ $where=" (mphone1 = '".$sdata."' or udai='".$sdata."' or p_code like '%".$sdata."')" ;
+ }elseif (filter_var($sdata, FILTER_VALIDATE_EMAIL)) {
+ $where=" email1 = '".$sdata."'" ;
+ }else{
+ $where=" (p_fname like '%".$sdata."%' or
+ SUBSTRING_INDEX(p_fname,' ',1) sounds like '".$sdata."')";
+ }
+
+ $sql = "SELECT p.*,o.opd_id,
+ o.doc_name,o.opd_code,Date_Format(o.opd_book_date,'%d-%m-%Y') as App_Date,
+ if(MAX(date(o.opd_book_date))=curdate(),Date_Format(MAX(o.opd_book_date),'%d-%m-%Y %H:%i'),0) as opd_today
+ FROM (patient_master_exten p JOIN opd_master o ON p.id=o.p_id)
+ WHERE ".$where." Group by o.opd_id
+ order by o.opd_id desc ";
+
+
+ $query = $this->db->query($sql);
+ $data['opd_list']= $query->result();
+
+ $this->load->view('Person/opd_scan_search',$data);
+ }
+
+
+
+ public function SelectOPD($opdid)
+ {
+
+ $sql = "select o.opd_id, o.doc_name,o.opd_code,o.P_name,o.p_id,Date_Format(o.apointment_date,'%d-%m-%Y') as App_Date,
+ p.p_code,p.mphone1,p.email1 ,if(o.insurance_id>1,'Org.','Direct') as Inv_Type,
+ m.mode_desc as PaymentMode,o.payment_mode
+ from (opd_master o join patient_master p on o.p_id=p.id ) join payment_mode m on o.payment_mode=m.id
+ WHERE o.opd_id=".$opdid;
+
+ $query = $this->db->query($sql);
+ $opd_data= $query->result();
+
+ if(count($opd_data)>0)
+ {
+ echo 'OPD Code : '.$opd_data[0]->opd_code ;
+ echo ' Doctor Name : Dr.'.$opd_data[0]->doc_name ;
+ echo ' OPD Date : '.$opd_data[0]->App_Date ;
+ echo ' Patient Name : '.$opd_data[0]->P_name ;
+ echo ' Patient Code : '.$opd_data[0]->p_code ;
+ }
+ }
+
+ public function get_appointment_list($doc_id,$opd_date='')
+ {
+ if($opd_date=='')
+ {
+ $opd_date=date('Y-m-d');
+ }
+
+ $data["opd_date"]=$opd_date;
+
+ $data["doc_id"]=$doc_id;
+
+ $sql="select d.p_fname,count(DISTINCT o.opd_id) as No_opd, d.id as doc_id,
+ group_concat(DISTINCT m.SpecName) as Spec,
+ count( DISTINCT CASE o.opd_status WHEN 1 THEN o.opd_id END) as count_wait,
+ count( DISTINCT CASE o.opd_status WHEN 2 THEN o.opd_id END) as count_visit,
+ count( DISTINCT CASE o.opd_status WHEN 3 THEN o.opd_id END) as count_cancel,
+ MOD(d.id,5) as color_code
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id
+ and m.id=s.med_spec_id)left join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'
+ where d.id ='".$doc_id."' group by d.id";
+
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+
+ $sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,p.p_fname as P_name,m.queue_no,o.opd_fee_desc,o.payment_status,p.p_rname,o.opd_no,
+ group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ LEFT JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE m.id is null and ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id ORDER BY opd_code desc ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_0']= $query->result();
+
+ $sql=" SELECT o.opd_id,o.opd_code,p.id,p.p_code,p.p_fname as P_name,m.queue_no,o.opd_fee_desc,p.p_rname,
+ m.current_queue_no,m.id,o.opd_fee_amount
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id
+ ORDER BY opd_id ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_1']= $query->result();
+
+ $sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,p.p_fname as P_name,m.queue_no,o.opd_fee_desc,o.payment_status,p.p_rname,o.opd_fee_amount,
+ group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=2 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id
+ ORDER BY opd_code ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_2']= $query->result();
+
+ $sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,p.p_fname as P_name,m.queue_no,o.opd_fee_desc,o.payment_status,p.p_rname,o.opd_fee_amount,
+ group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=3 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id
+ ORDER BY opd_code ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_3']= $query->result();
+
+ $sql="select id,color_name,code_code from color";
+ $query = $this->db->query($sql);
+ $color= $query->result();
+
+ $data['color']=array();
+
+ foreach($color as $aRow)
+ {
+ array_push($data['color'],$aRow->code_code);
+ }
+
+ $data['color1']=array(
+ '0' => 'bg-yellow',
+ '1' => 'bg-red',
+ '2' => 'bg-green',
+ '3' => 'bg-gray',
+ '4' => 'bg-orange',
+ '5' => 'bg-blue'
+ );
+
+ $data['doc_master_panel']=$this->load->view('dashboard/opd_queue_status_total',$data,true);
+ $data['tab0']=$this->load->view('dashboard/opd_queue_status_tab_0',$data,true);
+ $data['tab1']=$this->load->view('dashboard/opd_queue_status_tab_1',$data,true);
+ $data['tab2']=$this->load->view('dashboard/opd_queue_status_tab_2',$data,true);
+ $data['tab3']=$this->load->view('dashboard/opd_queue_status_tab_3',$data,true);
+
+
+ $this->load->view('dashboard/opd_list_doc',$data);
+ }
+
+
+ public function update_appointment_panel_bak()
+ {
+ $doc_id=$this->input->post('doc_id');
+ $opd_date=$this->input->post('opd_date');
+
+ if($opd_date=='')
+ {
+ $opd_date=date('Y-m-d');
+ }
+
+ $sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,o.payment_status,
+ group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ LEFT JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE m.id is null and ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id ORDER BY opd_code desc ";
+
+ $query = $this->db->query($sql);
+ $opd_list_0= $query->result();
+
+ $sql=" SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,p.p_rname,
+ group_concat('ID:',h.id,'/M:',(case h.payment_mode when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id
+ ORDER BY opd_id desc ";
+
+ $query = $this->db->query($sql);
+ $opd_list_1= $query->result();
+
+ $sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,o.payment_status,p.p_rname,
+ group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=2 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id
+ ORDER BY opd_code desc";
+
+ $query = $this->db->query($sql);
+ $opd_list_2= $query->result();
+
+ $sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,o.payment_status,p.p_rname,
+ group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending' else 'Other' end) separator ',') AS `Paymode`
+ FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+ JOIN opd_prescription m ON o.opd_id=m.opd_id)
+ LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=3 and o.doc_id ='".$doc_id."'
+ GROUP BY o.opd_id
+ ORDER BY opd_code desc ";
+
+ $query = $this->db->query($sql);
+ $opd_list_3= $query->result();
+
+ $sql="select d.p_fname,count(DISTINCT o.opd_id) as No_opd, d.id as doc_id,
+ group_concat(DISTINCT m.SpecName) as Spec,
+ count( DISTINCT CASE o.opd_status WHEN 1 THEN o.opd_id END) as count_wait,
+ count( DISTINCT CASE o.opd_status WHEN 2 THEN o.opd_id END) as count_visit,
+ count( DISTINCT CASE o.opd_status WHEN 3 THEN o.opd_id END) as count_cancel,
+ MOD(d.id,5) as color_code
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id
+ and m.id=s.med_spec_id)left join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'
+ where d.id ='".$doc_id."' group by d.id";
+
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+
+ $sql="select id,color_name,code_code from color";
+ $query = $this->db->query($sql);
+ $color= $query->result();
+
+ $data['color']=array();
+
+ foreach($color as $aRow)
+ {
+ array_push($data['color'],$aRow->code_code);
+ }
+
+ $data['color1']=array(
+ '0' => 'bg-yellow',
+ '1' => 'bg-red',
+ '2' => 'bg-green',
+ '3' => 'bg-gray',
+ '4' => 'bg-orange',
+ '5' => 'bg-blue'
+ );
+
+ //Doctor Panel
+ $doc_master_panel='';
+
+ //Master View
+ $Master_View='';
+
+ //On Booking List
+ $tab0='';
+ $srno=0;
+ foreach($opd_list_0 as $row)
+ {
+ $tab0.='
+ '.$row->opd_id.'
+ '.$row->opd_code.'
+ '.$row->P_name.'
+ '.$row->Paymode.'
+ ';
+ if($row->payment_status==1) {
+ $tab0.='Queue
+ Cancel OPD ';
+ }else{
+ $tab0.='
+ Go For Payment ';
+ }
+ $tab0.='
+
+
+ ';
+ }
+
+
+ $Master_View_head=str_replace("##HEAD_NAME##","On Booking List",$Master_View);
+ $tab0=str_replace("##CONTENT##",$tab0,$Master_View_head);
+
+ //OnWaiting List
+
+ $tab1='';
+ $srno=0;
+ foreach($opd_list_1 as $row)
+ {
+ $tab1.='
+ '.$row->queue_no.'
+ '.$row->opd_code.'
+ '.$row->P_name.'
+ '.$row->opd_fee_desc.'/'.$row->Paymode.'
+
+
+
+
+
+
+
+
+
+
+ ';
+}
+
+$Master_View_head=str_replace("##HEAD_NAME##","On Waiting List",$Master_View);
+$tab1=str_replace("##CONTENT##",$tab1,$Master_View_head);
+
+//Visited List
+$tab2='';
+
+$srno=0;
+foreach($opd_list_2 as $row)
+{
+$tab2.='
+ '.$row->opd_id.'
+ '.$row->opd_code.'
+ '.$row->P_name.'
+ '.$row->opd_fee_desc.'/'.$row->Paymode.'
+
+
+
+
+
+
+
+
+ ';
+}
+
+$Master_View_head=str_replace("##HEAD_NAME##","Visited List",$Master_View);
+$tab2=str_replace("##CONTENT##",$tab2,$Master_View_head);
+
+//Cancel List
+$tab3='';
+$srno=0;
+foreach($opd_list_3 as $row)
+{
+$tab3.='
+ '.$row->opd_id.'
+ '.$row->opd_code.'
+ '.$row->P_name.'
+ '.$row->opd_fee_desc.'/'.$row->Paymode.'
+
+
+
+ << /button>
+
+ ';
+}
+
+$Master_View_head=str_replace("##HEAD_NAME##","Visited List",$Master_View);
+$tab3=str_replace("##CONTENT##",$tab3,$Master_View_head);
+
+$rvar=array(
+'update' =>1,
+'doc_master_panel'=> $doc_master_panel,
+'tab0' => $tab0,
+'tab1' => $tab1,
+'tab2' => $tab2,
+'tab3' => $tab3,
+);
+
+$encode_data = json_encode($rvar);
+echo $encode_data;
+
+}
+
+public function update_appointment_panel()
+{
+$doc_id=$this->input->post('doc_id');
+$opd_date=$this->input->post('opd_date');
+
+if($opd_date=='')
+{
+$opd_date=date('Y-m-d');
+}
+
+$sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,o.payment_status,p.p_rname,
+group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending'
+else 'Other' end) separator ',') AS `Paymode`
+FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+LEFT JOIN opd_prescription m ON o.opd_id=m.opd_id)
+LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+WHERE m.id is null and ( o.apointment_date = '".$opd_date."' )
+and o.opd_status=1 and o.doc_id ='".$doc_id."'
+GROUP BY o.opd_id ORDER BY opd_code desc ";
+
+$query = $this->db->query($sql);
+$data['opd_list_0']= $query->result();
+
+$sql=" SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,p.p_rname,
+m.current_queue_no,m.id,o.opd_fee_amount
+FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+JOIN opd_prescription m ON o.opd_id=m.opd_id)
+LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+WHERE ( o.apointment_date = '".$opd_date."' )
+and o.opd_status=1 and o.doc_id ='".$doc_id."'
+GROUP BY o.opd_id
+ORDER BY opd_id desc ";
+
+$query = $this->db->query($sql);
+$data['opd_list_1']= $query->result();
+
+$sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,o.payment_status,p.p_rname,o.opd_fee_amount,
+group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending'
+else 'Other' end) separator ',') AS `Paymode`
+FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+JOIN opd_prescription m ON o.opd_id=m.opd_id)
+LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+WHERE ( o.apointment_date = '".$opd_date."' )
+and o.opd_status=2 and o.doc_id ='".$doc_id."'
+GROUP BY o.opd_id
+ORDER BY opd_code desc";
+
+$query = $this->db->query($sql);
+$data['opd_list_2']= $query->result();
+
+$sql="SELECT o.opd_id,o.opd_code,p.id,p.p_code,o.P_name,m.queue_no,o.opd_fee_desc,o.payment_status,p.p_rname,o.opd_fee_amount,
+group_concat('ID:',`h`.`id`,'/M:',(case `h`.`payment_mode` when 1 then 'Cash' when 2 then 'BANK ' when 0 then 'Pending'
+else 'Other' end) separator ',') AS `Paymode`
+FROM ((opd_master o JOIN patient_master p ON o.p_id=p.id)
+JOIN opd_prescription m ON o.opd_id=m.opd_id)
+LEFT JOIN payment_history h ON o.opd_id=h.payof_id AND h.payof_type=1
+WHERE ( o.apointment_date = '".$opd_date."' )
+and o.opd_status=3 and o.doc_id ='".$doc_id."'
+GROUP BY o.opd_id
+ORDER BY opd_code desc ";
+
+$query = $this->db->query($sql);
+$data['opd_list_3']= $query->result();
+
+$sql="select d.p_fname,count(DISTINCT o.opd_id) as No_opd, d.id as doc_id,
+group_concat(DISTINCT m.SpecName) as Spec,
+count( DISTINCT CASE o.opd_status WHEN 1 THEN o.opd_id END) as count_wait,
+count( DISTINCT CASE o.opd_status WHEN 2 THEN o.opd_id END) as count_visit,
+count( DISTINCT CASE o.opd_status WHEN 3 THEN o.opd_id END) as count_cancel,
+MOD(d.id,5) as color_code
+from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id
+and m.id=s.med_spec_id)left join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'
+where d.id ='".$doc_id."' group by d.id";
+
+$query = $this->db->query($sql);
+$data['doc_master']= $query->result();
+
+$sql="select id,color_name,code_code from color";
+$query = $this->db->query($sql);
+$color= $query->result();
+
+$data['color']=array();
+
+foreach($color as $aRow)
+{
+array_push($data['color'],$aRow->code_code);
+}
+
+$data['color1']=array(
+'0' => 'bg-yellow',
+'1' => 'bg-red',
+'2' => 'bg-green',
+'3' => 'bg-gray',
+'4' => 'bg-orange',
+'5' => 'bg-blue'
+);
+
+$doc_master_panel=$this->load->view('dashboard/opd_queue_status_total',$data,true);
+$tab0=$this->load->view('dashboard/opd_queue_status_tab_0',$data,true);
+$tab1=$this->load->view('dashboard/opd_queue_status_tab_1',$data,true);
+$tab2=$this->load->view('dashboard/opd_queue_status_tab_2',$data,true);
+$tab3=$this->load->view('dashboard/opd_queue_status_tab_3',$data,true);
+
+$rvar=array(
+'update' =>1,
+'doc_master_panel'=> $doc_master_panel,
+'tab0' => $tab0,
+'tab1' => $tab1,
+'tab2' => $tab2,
+'tab3' => $tab3,
+);
+
+$encode_data = json_encode($rvar);
+echo $encode_data;
+
+}
+
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Opd2.php b/old_code_ci3/controllers/Opd2.php
new file mode 100644
index 0000000..bb2b4a6
--- /dev/null
+++ b/old_code_ci3/controllers/Opd2.php
@@ -0,0 +1,2067 @@
+load->library("Pdf");
+ }
+
+ public function addopd($pno)
+ {
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_spec_l']= $query->result();
+
+ $this->load->view('opd_appointment_V',$data);
+ }
+
+ public function showfee()
+ {
+ $doc_id=$this->input->post('doc_id');
+ $p_id=$this->input->post('pid');
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$doc_id." group by d.id ";
+ $query = $this->db->query($sql);
+ $doc_info= $query->result();
+
+ $sql="SELECT * from opd_master where p_id=".$p_id." and doc_id=".$doc_id."
+ and apointment_date > date_add(sysdate(),interval -5 day) and opd_fee_type<>3";
+ $query = $this->db->query($sql);
+ $opd_running= $query->result();
+
+ $sql="SELECT * from opd_master where p_id=".$p_id." ";
+ $query = $this->db->query($sql);
+ $opd_old= $query->result();
+
+ $fee_type_list="4,0";
+
+ $fee_type_select=1;
+
+ if(count($opd_old)>0)
+ {
+ if(count($opd_running)>0)
+ {
+ $fee_type_select=3;
+ $fee_type_list.=",3";
+ }else{
+ $fee_type_select=2;
+ $fee_type_list.=",2";
+ }
+
+ }else{
+ $fee_type_select=1;
+ $fee_type_list.=",1";
+ }
+
+ $content='';
+
+ $content.= 'Doctor Name : '.$doc_info[0]->p_fname.' / Specialization: '.$doc_info[0]->SpecName.' /
+ Gender : '.$doc_info[0]->xGender.' ';
+ $content.= ' ';
+
+
+ $sql="SELECT d.*,if(d.doc_fee_desc='',t.fee_type,d.doc_fee_desc) AS fee_desc
+ FROM doc_opd_fee d JOIN doc_fee_type t ON d.doc_fee_type=t.id
+ WHERE doc_id=".$doc_id." and t.id in (".$fee_type_list.")";
+
+ $query = $this->db->query($sql);
+ $data['doc_fee_a']= $query->result();
+
+ $sql="SELECT d.*,if(d.doc_fee_desc='',t.fee_type,d.doc_fee_desc) AS fee_desc
+ FROM doc_opd_fee d JOIN doc_fee_type t ON d.doc_fee_type=t.id
+ WHERE doc_id=".$doc_id." and t.id not in (".$fee_type_list.")";
+
+ $query = $this->db->query($sql);
+ $data['doc_fee_b']= $query->result();
+
+
+
+ $checked='';
+
+ foreach($data['doc_fee_a'] as $row)
+ {
+ if($row->id==$fee_type_select)
+ {
+ $checked='checked';
+ }
+
+ $content.= '';
+ $content.= ' ';
+ $content.= ' Rs. '.$row->amount.' ['.$row->fee_desc.' ]';
+ $content.= ' ';
+ }
+
+ $content.=" ";
+
+ $other_content='';
+
+ foreach($data['doc_fee_b'] as $row)
+ {
+ if($row->id==$fee_type_select)
+ {
+ $checked='checked';
+ }
+
+ $other_content.= '';
+ $other_content.= ' ';
+ $other_content.= ' Rs. '.$row->amount.' ['.$row->fee_desc.' ]';
+ $other_content.= ' ';
+ }
+
+ $content.='';
+ $content.='
+
+
+
+ '.$other_content.'
+
+
+
+
';
+
+ $rvar=array(
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ 'content'=>$content
+ );
+
+ $encode_data = json_encode($rvar);
+
+ echo $encode_data ;
+
+ }
+
+ public function invoice($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'cash' when 2 then 'Bank Card' when 3 then 'ECHS Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from organization_case_master where status=0 and p_id=".$data['patient_master'][0]->id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['refund_order']= $query->result();
+
+ if(count($data['refund_order'])>0)
+ {
+ $data['refund_status']=1; // Refund Pending
+ }else{
+ $data['refund_status']=0 ; //No Pending
+ }
+
+ $sql="select sum(if(credit_debit=0,amount,amount*-1)) as paid_amount from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $data['paid_amount']=0;
+
+ if($data['payment_history'][0]->paid_amount=='' || $data['payment_history'][0]->paid_amount==0 )
+ {
+ $data['paid_amount']=0;
+ }else{
+ $data['paid_amount']=$data['payment_history'][0]->paid_amount;
+ }
+
+ $opd_fee_gross_amount=$data['opd_master'][0]->opd_fee_amount;
+
+ if($data['opd_master'][0]->payment_mode==4)
+ {
+ $data['pending_amount']=0;
+ }else{
+ $data['pending_amount']=$opd_fee_gross_amount-$data['paid_amount'];
+ }
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_spec_l']= $query->result();
+
+ $this->load->view('opd_invoice_V',$data);
+
+ }
+
+ public function invoice_print($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$data['opd_master'][0]->apointment_date."') AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$data['opd_master'][0]->insurance_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ if($data['opd_master'][0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$data['opd_master'][0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+ }
+
+ $this->load->view('invoice_print_v',$data);
+ }
+
+ public function invoice_print_pdf($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$opd_master[0]->apointment_date."') AS age
+ from patient_master where id='".$opd_master[0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $patient_master= $query->result();
+
+ $sql="select * from hc_insurance where id=".$opd_master[0]->insurance_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$opd_master[0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+ }
+
+ // Content Start From here
+
+ $content='OPD Charges Invoice ';
+
+ $itemlist='Items:';
+
+ $content.='
+
+
+ To
+ UHID : '.$patient_master[0]->p_code.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Sex : '.$patient_master[0]->xgender.' '.$patient_master[0]->age.' P.No. :'.$patient_master[0]->mphone1 .'
+ Address : '.$patient_master[0]->add1.','.$patient_master[0]->city.'
+
+
+ Invoice No. : '.$opd_master[0]->opd_code.'
+ Date : '.$opd_master[0]->str_apointment_date.'
+
+
+
+
+
+ ';
+ $content.='
+
+ Date
+ Charge Name
+ Doctor Name
+ Description
+ Amount
+ ';
+
+ $content.= '';
+ $content.= ''.$opd_master[0]->str_apointment_date.' ';
+ $content.= 'Consultation Fee ';
+ $content.= 'Dr.'.$opd_master[0]->doc_name.' ';
+ $content.= ''.$opd_master[0]->opd_fee_desc.' ';
+ $content.= 'Rs.'.$opd_master[0]->opd_fee_gross_amount.' ';
+ $content.= ' ';
+
+ if($opd_master[0]->opd_discount>0 )
+ {
+ $content.= '';
+ $content.= '# ';
+ $content.= ' Deduction ';
+ $content.= ''.$opd_master[0]->opd_disc_remark.' ';
+ $content.= ' Rs.'.$opd_master[0]->opd_discount.' ';
+ $content.= ' ';
+
+ }
+
+ $content.= '';
+ $content.= '# ';
+ $content.= ' ';
+ $content.= 'Net Amount ';
+ $content.= ' Rs.'.$opd_master[0]->opd_fee_amount.' ';
+ $content.= ' ';
+
+ $content.='
';
+
+ // Content End Here
+
+ if($opd_master[0]->payment_id>0 )
+ {
+ $content.='Payment No. : '.$opd_master[0]->payment_id.' ';
+ }
+
+ $content.='
+
+
+
+
+ Amount in Words : Rs. '.number_to_word($opd_master[0]->opd_fee_amount).'
+
+
+
+
+
+
+
+ Prepared By : '.$opd_master[0]->prepared_by.'
+
+
+ Signature
+
+
+ ';
+
+
+ $bar_content=$patient_master[0]->p_code.':OPD-'.$opd_master[0]->opd_code.':T'.date('dmYhms');
+ //echo $content;
+ $this->load->library("Pdf");
+ create_Invoice_pdf($content,$bar_content,'opd_invoice-'.$opdid.'-'.date('Yms'));
+ }
+
+ public function opd_lettre_print($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ date_format(date_add(apointment_date,interval 4 day),'%d-%m-%Y') as opd_Exp_Date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$data['opd_master'][0]->apointment_date."') AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select *,date_format(date_add(apointment_date,interval 4 day),'%d-%m-%Y') as opd_Exp_Date from opd_master
+ where p_id=".$data['opd_master'][0]->p_id." and opd_id < ".$opdid."
+ order by opd_id desc limit 1";
+ $query = $this->db->query($sql);
+ $data['old_opd']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$data['opd_master'][0]->insurance_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ if($data['opd_master'][0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$data['opd_master'][0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+ }
+
+ $this->load->view('opd_letter_head',$data);
+ }
+
+
+ public function confirm_opd()
+ {
+ $this->load->model('Opd_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.' '. $user->last_name.'['.date('d-m-Y H:i:s').']';
+
+ $sql="select * from patient_master where id=".$this->input->post('pid');
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$this->input->post('doc_id')." group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select * from doc_opd_fee where id=".$this->input->post('fee_id');
+ $query = $this->db->query($sql);
+ $data['doc_fee']= $query->result();
+
+ $opd_fee_amount=$data['doc_fee'][0]->amount;
+ $opd_fee_desc=$data['doc_fee'][0]->doc_fee_desc;
+ $echs_credit=0;
+
+ $doc_id=$this->input->post('doc_id');
+
+ $data['insert'] = array(
+ 'p_id' => $this->input->post('pid'),
+ 'P_name' => strtoupper($data['person_info'][0]->p_fname),
+ 'doc_id' => $this->input->post('doc_id'),
+ 'insurance_id' => '0',
+ 'opd_fee_id' => $this->input->post('fee_id'),
+ 'opd_fee_amount' => $opd_fee_amount,
+ 'opd_fee_gross_amount' => $opd_fee_amount,
+ 'opd_fee_desc' => $opd_fee_desc,
+ 'doc_name' => $data['doc_info'][0]->p_fname,
+ 'opd_fee_type' =>$data['doc_fee'][0]->doc_fee_type,
+ 'apointment_date' =>str_to_MysqlDate($this->input->post('datepicker_appointment')),
+ 'doc_spec' => $data['doc_info'][0]->SpecName,
+ 'prepared_by' => $user_name_info,
+ );
+
+ $inser_id=$this->Opd_M->insert( $data['insert']);
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'error_text'=>'Some Thing Wrong',
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function confirm_payment()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Opd_M');
+ $this->load->model('Payment_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name.'['.date('d-m-Y H:i:s').']';
+
+ $submit_page=$this->input->post('spid');
+ $oid=$this->input->post('oid');
+
+ $sql="select * from opd_master where opd_id='".$oid."'";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select * from payment_history where payof_id='".$oid."' and insert_code='".$submit_page."'";
+ $query = $this->db->query($sql);
+ $chk_payment= $query->result();
+
+ $showcontent1='
+
+
+ Payment Method by : ';
+ $showcontent2='
';
+
+ $pay_remark='';
+ if($opd_master[0]->opd_discount>0)
+ {
+ $pay_remark='Dis.Amt.:'.$opd_master[0]->opd_disc_remark.' /Amount: '. $opd_master[0]->opd_discount.'/Update:'.$opd_master[0]->opd_disc_update_by;
+ }
+
+ if($this->input->post('mode')==0)
+ {
+ $paydata = array(
+ 'payment_mode'=> '0',
+ 'payof_type'=>'1',
+ 'payof_id'=>$this->input->post('oid'),
+ 'payof_code'=>$opd_master[0]->opd_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$opd_master[0]->opd_fee_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name_info.' ['.$user_id.']',
+ 'update_by_id'=>$user_id,
+ 'insert_code'=>$submit_page
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '0',
+ 'payment_status'=>'1',
+ 'payment_mode_desc'=>'No Cost',
+ 'payment_id'=>$insert_id,
+ 'confirm_pay_opd'=>date('Y-m-d H:i:s'),
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='Zero Cost';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }else{
+ if(count($chk_payment)>0)
+ {
+ $rvar=array(
+ 'update' =>0,
+ 'showcontent'=>'Already Paid',
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+ if($this->input->post('mode')==1 && count($chk_payment)<1 )
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'1',
+ 'payof_id'=>$this->input->post('oid'),
+ 'payof_code'=>$opd_master[0]->opd_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$opd_master[0]->opd_fee_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name_info.' ['.$user_id.']',
+ 'update_by_id'=>$user_id,
+ 'insert_code'=>$submit_page
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '1',
+ 'payment_status'=>'1',
+ 'payment_mode_desc'=>'Cash',
+ 'payment_id'=>$insert_id,
+ 'confirm_pay_opd'=>date('Y-m-d H:i:s'),
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='CASH';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }else{
+ if(count($chk_payment)>0)
+ {
+ $rvar=array(
+ 'update' =>0,
+ 'showcontent'=>'Already Paid',
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ if($this->input->post('mode')==2 && count($chk_payment)<1 )
+ {
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_mac',
+ 'label' => 'Card Bank Name',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_card_digit',
+ 'label' => 'Card Last 4 Digit ',
+ 'rules' => 'required|min_length[4]|max_length[4]'
+ ),
+ array(
+ 'field' => 'input_card_bank',
+ 'label' => 'Bank Name ',
+ 'rules' => 'required|min_length[1]|max_length[50]'
+ ),
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[3]|max_length[15]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+ if ($this->form_validation->run() == TRUE)
+ {
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'payof_type'=>'1',
+ 'payof_id'=>$this->input->post('oid'),
+ 'payof_code'=>$opd_master[0]->opd_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$opd_master[0]->opd_fee_amount,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'cust_card'=>$this->input->post('input_card_bank'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'update_by_id'=>$user_id
+ );
+
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '2',
+ 'payment_status'=>'1',
+ 'payment_mode_desc'=>'Bank Card',
+ 'confirm_pay_opd'=>date('Y-m-d H:i:s'),
+ 'payment_id'=>$insert_id,
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'cust_card'=>$this->input->post('input_card_bank'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+
+ $status='Bank Card';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }else{
+ if(count($chk_payment)>0)
+ {
+ $rvar=array(
+ 'update' =>0,
+ 'showcontent'=>'Already Paid',
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ if($this->input->post('mode')==4)
+ {
+ $data = array(
+
+ 'payment_mode'=> '4',
+ 'payment_status'=>'1',
+ 'payment_mode_desc'=>'Org.Case Credit',
+ 'confirm_pay_opd'=>date('d/m/Y H:m:s'),
+ 'insurance_case_id'=>$this->input->post('case_id'),
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='Org. Case Credit';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent,
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function update_discount()
+ {
+ $oid=$this->input->post('oid');
+
+ $opd_discount=$this->input->post('input_dis_amt');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from opd_master where opd_id=".$oid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $opd_fee_amount=$data['opd_master'][0]->opd_fee_gross_amount-$opd_discount;
+
+ $dataupdate = array(
+ 'opd_discount' => $this->input->post('input_dis_amt'),
+ 'opd_disc_remark' => $this->input->post('input_dis_desc'),
+ 'opd_fee_amount' => $opd_fee_amount,
+ 'opd_disc_update_by'=>$user_name.'['.$user_id.']'
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$oid);
+
+ }
+
+ public function update_doc_date()
+ {
+ $oid=$this->input->post('oid');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+
+ $doc_name_id=$this->input->post('doc_name_id');
+ $datepicker_opddate=str_to_MysqlDate($this->input->post('datepicker_opddate'));
+ $doc_opd_fee=$this->input->post('opd_fee_amt');
+
+
+
+ $sql="select * from opd_master where opd_id=".$oid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$doc_name_id." group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $opd_fee_amount=$doc_opd_fee-$data['opd_master'][0]->opd_discount;
+
+ $dataupdate = array(
+ 'doc_id' => $doc_name_id,
+ 'doc_name' => $data['doc_info'][0]->p_fname,
+ 'doc_spec' => $data['doc_info'][0]->SpecName,
+ 'apointment_date' => $datepicker_opddate,
+ 'opd_fee_gross_amount'=>$doc_opd_fee,
+ 'opd_fee_amount'=>$opd_fee_amount
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$oid);
+
+ $sql="select * from opd_master where opd_id=".$oid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select * from payment_history where payof_type=1 and payof_id=".$oid." and id=".$data['opd_master'][0]->payment_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ if(count($payment_history)>0)
+ {
+ $amount_diff=$payment_history[0]->amount-$opd_fee_amount;
+ if($amount_diff<>0)
+ {
+ $pay_remark=$payment_history[0]->remark." /Update OPD Rate Difference ".$amount_diff." :By ".$user_name;
+
+ $paydata = array(
+ 'amount'=>$data['opd_master'][0]->opd_fee_amount,
+ 'remark'=>$pay_remark,
+ );
+ $this->load->model('Payment_M');
+ $this->Payment_M->update($paydata,$payment_history[0]->id);
+ }
+
+ }
+
+
+
+ }
+
+ public function opd_load_doc($opdid)
+ {
+ $data['opdid']=$opdid;
+
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$data['opd_master'][0]->apointment_date."') AS age
+ from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $this->load->view('Person/OPD_file_upload',$data);
+ }
+
+
+ public function save_image($opdid)
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('webcam')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'upload_by_id'=>$user_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+
+ $user_name = $user->first_name.''. $user->last_name.':T-'.date('d-m-Y h:m:s');
+
+ $opdstatus=2;
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ echo $filename;
+ }
+ }
+ public function save_image_mobile($opdid)
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+
+ $user_id = '0';
+ $user_name = 'Mobile';
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('userfile')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ //print_r($data);
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'upload_by_id'=>$user_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+
+ $opdstatus=2;
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ echo 'File Upload successfully';
+ }
+ }
+
+ public function save_image_mobile_bak($opdid)
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+
+ $user_id = '0';
+ $user_name = 'Mobile';
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ $img = $_POST['userfile'];
+ $img = str_replace('data:image/jpeg;base64,', '', $img);
+ $img = str_replace(' ', '+', $img);
+ $data = base64_decode($img);
+
+ $file = $folder_name . '.jpeg';
+
+ $success = file_put_contents($file, $data);
+
+ print $success ? $file : 'Unable to save the file.';
+
+ if (!$success) {
+ $data = array('upload_data' => $this->upload->data());
+ print_r($data);
+
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ print_r($data);
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'upload_by_id'=>$user_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+
+ $opdstatus=2;
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ echo 'File Upload successfully';
+ }
+ }
+
+ public function opd_file_hide($file_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $upload_by_id = $user->id;
+
+ $udata = array(
+ 'show_type'=> '1',
+ 'upload_by_id'=>$user_id
+ );
+ $this->load->model('File_M');
+
+ $this->File_M->update($udata,$file_id);
+
+ redirect('/Opd/opd_file_last_list');
+ }
+
+ public function opd_file_last_list($opdid='')
+ {
+ $user = $this->ion_auth->user()->row();
+ $upload_by_id = $user->id;
+
+ if($opdid=='')
+ {
+ $sql="select f.id,f.full_path,date_format(f.insert_date,'%d/%m/%Y-%H:%i') as strinsert_date,
+ f.file_ext,p.p_fname,p.str_age from file_upload_data f join patient_master_exten p on f.pid=p.id
+ where show_type=0 and upload_by_id=".$upload_by_id." order by id desc limit 5";
+ }else{
+ $sql="select f.id,f.full_path,date_format(f.insert_date,'%d/%m/%Y-%H:%i') as strinsert_date,
+ f.file_ext,p.p_fname,p.str_age from file_upload_data f join patient_master_exten p on f.pid=p.id
+ where show_type=0 and opd_id=$opdid and upload_by_id=$upload_by_id order by id desc limit 5";
+ }
+
+ $query = $this->db->query($sql);
+ $data['opd_file_list']= $query->result();
+
+ $this->load->view('Person/scan_opd_list',$data);
+ }
+
+ public function opd_file_list($opdid)
+ {
+ $sql="select * from file_upload_data where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_file_list']= $query->result();
+
+ $sql="select * from file_opd_rec where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $file_opd_rec= $query->result();
+
+ foreach($file_opd_rec as $row)
+ {
+ $full_path=$row->full_path;
+ $file_v_no=$row->v_no;
+
+ $start_no=stripos($full_path,$file_v_no);
+ $end_no=strlen($full_path);
+
+ $folder_name=substr($full_path,0,$start_no);
+
+ $files_info = get_dir_file_info($folder_name);
+
+ foreach($files_info as $key => $value) {
+ $find_file=number_format(substr_count($value['name'],$file_v_no),0);
+ if($find_file==1)
+ {
+ $index_key=str_replace($file_v_no.'_','',$value['name']);
+ $index_key=str_replace('.webm','',$index_key);
+
+ $file_list[$index_key] = $value['name'];
+ }
+ }
+
+ ksort($file_list);
+
+ $prev_file='';
+ $current_file='';
+ foreach($file_list as $key => $value) {
+ $current_file=$folder_name.'/'.$value;
+ if(strlen($prev_file)>0)
+ {
+ //First File
+ $objFH = fopen( $prev_file, "rb" );
+ $strBuffer1 = fread( $objFH, filesize( $prev_file) );
+ fclose( $objFH );
+
+ //Second File
+ $objFH = fopen( $current_file, "rb" );
+ $strBuffer2 = fread( $objFH, filesize( $current_file) );
+ fclose( $objFH );
+
+ // manipulate buffers here...
+ $strBuffer3 = $strBuffer1 . $strBuffer2;
+
+ // open for write/binary-safe
+ $objFH = fopen( $current_file, "wb" );
+ fwrite( $objFH, $strBuffer3 );
+ fclose( $objFH );
+
+ //Delete prev File
+ unlink($prev_file);
+
+ $prev_file=$current_file;
+
+ $data_upload = array(
+ 'opd_id' => $opd_id,
+ 'full_path' => $current_file,
+ );
+
+ $this->load->model('FileOPDRec_M');
+
+ $this->FileOPDRec_M->insert($data_upload,$file_v_no);
+ }
+
+ }
+
+
+
+ }
+
+ $sql="select * from file_opd_rec where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['file_opd_rec']= $query->result();
+
+ $this->load->view('Person/opd_file_show',$data);
+
+ }
+
+ public function opd_file_upload($opdid)
+ {
+ $data['opdid']=$opdid;
+
+ $this->load->view('Person/opd_scanfile_upload',$data);
+ }
+
+ public function opd_scanfiles_upload($opdid)
+ {
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $output_dir = $folder_name;
+
+ if(isset($_FILES["myfile"]))
+ {
+ $ret = array();
+
+ $error = $_FILES["myfile"]["error"];
+
+ // upload single file
+ if(!is_array($_FILES["myfile"]["name"])) //single file
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() .$_FILES["myfile"]["name"];
+ $config['upload_path'] = $folder_name;
+ $config['file_name'] = $filename;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg|pdf|doc';
+
+ $this->load->library('upload', $config);
+ echo $filename;
+ //move_uploaded_file($_FILES["myfile"]["tmp_name"],$output_dir.$fileName);
+
+ if (!$this->upload->do_upload('myfile')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+ $this->load->model('File_M');
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'opd_id'=>$opdid,
+ 'pid'=>$pid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+
+ }
+
+ $ret[]= $_FILES["myfile"]["name"];
+ }
+ else
+ {
+ // Handle Multiple files
+ $fileCount = count($_FILES["myfile"]["name"]);
+ for($i=0; $i<$fileCount; $i++)
+ {
+ $filename = 'OPD-'.$opdid.'-'.$i.'-'.time() .$_FILES["myfile"]["name"];
+
+ //$fileName = $_FILES["myfile"]["name"][$i];
+ //move_uploaded_file($_FILES["myfile"]["tmp_name"][$i],$output_dir.$fileName);
+
+ if (!$this->upload->do_upload($_FILES["myfile"]["tmp_name"][$i])) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+ $this->load->model('File_M');
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $ipd_id=$opd_master[0]->ipd_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> $user_name,
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+ }
+ }
+
+ $ret[]= $_FILES["myfile"]["name"][$i];
+ }
+ }
+ // output file names as comma seperated strings to display status
+ echo json_encode($ret);
+ }
+ }
+
+ public function opd_status($opdid,$opdstatus)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.':T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ public function get_appointment($opd_date='')
+ {
+ if($opd_date=='')
+ {
+ $opd_date=date('Y-m-d');
+ }
+
+ $data["opd_date"]=$opd_date;
+
+ $sql="select group_concat(DISTINCT o.doc_id ) as doc_list_opd
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id and m.id=s.med_spec_id)
+ join opd_master o on d.id=o.doc_id and o.apointment_date between date_add(curdate(),interval -5 day) and curdate()";
+ $query = $this->db->query($sql);
+ $doc_opd= $query->result();
+
+ if(count($doc_opd)>0)
+ {
+ $doc_opd_list=$doc_opd[0]->doc_list_opd;
+ }else{
+ $doc_opd_list="0";
+ }
+
+ if($doc_opd_list=='')
+ {
+ $doc_opd_list="0";
+ }
+
+ $sql="select d.id as doc_id, d.p_fname,count(DISTINCT o.opd_id) as No_opd,
+ group_concat(DISTINCT m.SpecName) as Spec,
+ count( DISTINCT CASE o.opd_status WHEN 1 THEN o.opd_id END) as count_wait,
+ count( DISTINCT CASE o.opd_status WHEN 2 THEN o.opd_id END) as count_visit,
+ count( DISTINCT CASE o.opd_status WHEN 3 THEN o.opd_id END) as count_cancel,
+ MOD(d.id,5) as color_code
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id and m.id=s.med_spec_id)
+ left join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'
+ where o.doc_id in (".$doc_opd_list.")
+ group by d.p_fname having count(DISTINCT o.opd_id)>0 ";
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+
+ $data['color']=array(
+ '0' => 'bg-yellow',
+ '1' => 'bg-red',
+ '2' => 'bg-green',
+ '3' => 'bg-gray',
+ '4' => 'bg-orange',
+ '5' => 'bg-blue'
+ );
+ $this->load->view('dashboard/appointment',$data);
+ }
+
+ public function get_appointment_list($doc_id,$opd_date='')
+ {
+ if($opd_date=='')
+ {
+ $opd_date=date('Y-m-d');
+ }
+
+ $data["opd_date"]=$opd_date;
+
+ $sql="select o.* from opd_master_exten o left join opd_prescription_list p on o.opd_id=p.opd_id
+ WHERE p.id is null and ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."' ORDER BY opd_code desc ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_0']= $query->result();
+
+ $sql="select o.*,p.queue_no from opd_master_exten o join opd_prescription_list p on o.opd_id=p.opd_id
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."' ORDER BY opd_code desc ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_1']= $query->result();
+
+ $sql="select * from opd_master_exten o
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=2 and o.doc_id ='".$doc_id."' ORDER BY opd_code desc";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_2']= $query->result();
+
+ $sql="select * from opd_master_exten o
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=3 and o.doc_id ='".$doc_id."' ORDER BY opd_code desc ";
+
+ $query = $this->db->query($sql);
+ $data['opd_list_3']= $query->result();
+
+ $sql="select d.p_fname,count(DISTINCT o.opd_id) as No_opd, d.id as doc_id,
+ group_concat(DISTINCT m.SpecName) as Spec,
+ count( DISTINCT CASE o.opd_status WHEN 1 THEN o.opd_id END) as count_wait,
+ count( DISTINCT CASE o.opd_status WHEN 2 THEN o.opd_id END) as count_visit,
+ count( DISTINCT CASE o.opd_status WHEN 3 THEN o.opd_id END) as count_cancel,
+ MOD(d.id,5) as color_code
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id
+ and m.id=s.med_spec_id)left join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'
+ where d.id ='".$doc_id."' group by d.id";
+
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+
+ $sql="select id,color_name,code_code from color";
+ $query = $this->db->query($sql);
+ $color= $query->result();
+
+ $data['color']=array();
+
+ foreach($color as $aRow)
+ {
+ array_push($data['color'],$aRow->code_code);
+ }
+
+ $data['color1']=array(
+ '0' => 'bg-yellow',
+ '1' => 'bg-red',
+ '2' => 'bg-green',
+ '3' => 'bg-gray',
+ '4' => 'bg-orange',
+ '5' => 'bg-blue'
+ );
+
+ $this->load->view('dashboard/opd_list_doc',$data);
+ }
+
+ public function opd_cancel($opdid)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str=$this->input->post('input_remark');
+
+ $opd_status_remark=$status_str.' [Update By:'.$user_name.']';
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ if($payment_history[0]->paid_amount>0 && $opd_master[0]->opd_status==1)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 1,
+ 'refund_type_id' => $opdid,
+ 'refund_type_code' => $opd_master[0]->opd_code,
+ 'refund_type_reason' => 'Cancel OPD',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $payment_history[0]->paid_amount
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+ }
+
+ $dataupdate = array(
+ 'opd_status' => '3',
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ public function opd_crorg($opdid,$org_code_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ if($payment_history[0]->paid_amount>0 && $opd_master[0]->opd_status==1)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 1,
+ 'refund_type_id' => $opdid,
+ 'refund_type_code' => $opd_master[0]->opd_code,
+ 'refund_type_reason' => 'Cr. to Org.',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $payment_history[0]->paid_amount
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+ }
+
+ $dataupdate = array(
+ 'payment_mode' => 3,
+ 'payment_id' => 0,
+ 'insurance_case_id' => $org_code_id,
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ public function opd_discount_update($opdid)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ $opd_discount=$this->input->post('input_dis_amt');
+ $opd_disc_remark=$this->input->post('input_dis_desc');
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ $opd_fee_amount=$opd_master[0]->opd_fee_gross_amount-$opd_discount;
+
+ if($payment_history[0]->paid_amount>0 && $opd_master[0]->opd_status==1 && $opd_fee_amount>=0 && $opd_discount>0)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 1,
+ 'refund_type_id' => $opdid,
+ 'refund_type_code' => $opd_master[0]->opd_code,
+ 'refund_type_reason' => 'Discount',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $opd_discount,
+ 'patient_id' => $opd_master[0]->p_id,
+ 'patient_name' =>$opd_master[0]->P_name
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+
+ if($opd_fee_amount>=0)
+ {
+ $dataupdate = array(
+ 'opd_discount' => $opd_discount,
+ 'opd_disc_remark' => $opd_disc_remark,
+ 'opd_fee_amount' => $opd_fee_amount,
+ 'opd_disc_update_by'=>$user_name.'['.$user_id.']'
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+ }
+ }
+
+ public function scan_opd_desktop()
+ {
+ $this->load->view('Person/opd_scan_desktop');
+ }
+
+ public function search_scan_opd()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ $sql = "select o.opd_id, o.doc_name,o.opd_code,o.P_name,o.p_id,Date_Format(o.apointment_date,'%d-%m-%Y') as App_Date,
+ p.p_code,p.mphone1,p.email1 ,if(o.insurance_id>1,'Org.','Direct') as Inv_Type,
+ m.mode_desc as PaymentMode,o.payment_mode
+ from (opd_master o join patient_master p on o.p_id=p.id ) join payment_mode m on o.payment_mode=m.id
+ WHERE (opd_code like '%".$sdata."' or p_code like '%".$sdata."' or P_name like '%".$sdata."%' or
+ mphone1 = '".$sdata."' or email1 = '".$sdata."') and o.apointment_date>Date_Add(sysdate(),interval -7 day) order by o.opd_id desc limit 100";
+
+ $query = $this->db->query($sql);
+ $data['opd_list']= $query->result();
+
+ $this->load->view('Person/opd_scan_search',$data);
+ }
+
+
+
+ public function SelectOPD($opdid)
+ {
+
+ $sql = "select o.opd_id, o.doc_name,o.opd_code,o.P_name,o.p_id,Date_Format(o.apointment_date,'%d-%m-%Y') as App_Date,
+ p.p_code,p.mphone1,p.email1 ,if(o.insurance_id>1,'Org.','Direct') as Inv_Type,
+ m.mode_desc as PaymentMode,o.payment_mode
+ from (opd_master o join patient_master p on o.p_id=p.id ) join payment_mode m on o.payment_mode=m.id
+ WHERE o.opd_id=".$opdid;
+
+ $query = $this->db->query($sql);
+ $opd_data= $query->result();
+
+ if(count($opd_data)>0)
+ {
+ echo 'OPD Code : '.$opd_data[0]->opd_code ;
+ echo ' Doctor Name : Dr.'.$opd_data[0]->doc_name ;
+ echo ' OPD Date : '.$opd_data[0]->App_Date ;
+ echo ' Patient Name : '.$opd_data[0]->P_name ;
+ echo ' Patient Code : '.$opd_data[0]->p_code ;
+ }
+ }
+
+
+ public function opd_PDF_print($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ date_format(date_add(apointment_date,interval 4 day),'%d-%m-%Y') as opd_Exp_Date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$opd_master[0]->apointment_date."') AS age from patient_master where id='".$opd_master[0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $patient_master= $query->result();
+
+ $sql="select *,date_format(date_add(apointment_date,interval 4 day),'%d-%m-%Y') as opd_Exp_Date ,
+ date_format(apointment_date,'%d-%m-%Y') as s_opd_date
+ from opd_master where p_id=".$opd_master[0]->p_id." and opd_id < ".$opdid."
+ order by opd_id desc limit 1";
+ $query = $this->db->query($sql);
+ $old_opd= $query->result();
+
+ $sql="select * from hc_insurance where id=".$opd_master[0]->insurance_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$opd_master[0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+ }
+
+ $old_uhid='';
+ if($patient_master[0]->udai<>"")
+ {
+ $old_uhid= ' /'.$patient_master[0]->udai;
+ }
+
+ $exp_date="";
+
+ if($opd_master[0]->opd_fee_type=='3'){
+ if(count($old_opd)>0){
+ $exp_date= 'OPD Start Date : '.$old_opd[0]->s_opd_date.' Valid Upto :'.$old_opd[0]->opd_Exp_Date.' ';
+ }
+ }else{
+ $exp_date="Valid Upto : ".$opd_master[0]->opd_Exp_Date ." ";
+ }
+
+ $content='
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Gender/Age : '.$patient_master[0]->xgender.' / '.$patient_master[0]->age.'
+ P.No. :'.$patient_master[0]->mphone1 .'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ OPD Fee: '.$opd_master[0]->opd_fee_amount .' ['.$opd_master[0]->opd_fee_desc .']
+ Date: '.$opd_master[0]->str_apointment_date .' '.$exp_date.'
+
+
+ Consultant Name Dr. '.$opd_master[0]->doc_name.' ['.$opd_master[0]->doc_spec.']
+
+
+
+ ';
+ //echo $content;
+
+ create_OPD_Letter_pdf($content,'opd_parchi-'.$opdid.'-'.date('Yms'));
+
+ }
+
+
+ public function update_appointment_panel()
+ {
+ $doc_id=$this->input->post('doc_id');
+ $opd_date=$this->input->post('opd_date');
+
+ if($opd_date=='')
+ {
+ $opd_date=date('Y-m-d');
+ }
+
+ $sql="select o.* from opd_master_exten o left join opd_prescription_list p on o.opd_id=p.opd_id
+ WHERE p.id is null and ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."' ORDER BY opd_code desc ";
+ $query = $this->db->query($sql);
+ $opd_list_0= $query->result();
+
+ $sql="select o.*,p.queue_no from opd_master_exten o join opd_prescription_list p on o.opd_id=p.opd_id
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=1 and o.doc_id ='".$doc_id."' ORDER BY opd_code desc ";
+ $query = $this->db->query($sql);
+ $opd_list_1= $query->result();
+
+ $sql="select * from opd_master_exten o
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=2 and o.doc_id ='".$doc_id."' ORDER BY opd_code desc";
+
+ $query = $this->db->query($sql);
+ $opd_list_2= $query->result();
+
+ $sql="select * from opd_master_exten o
+ WHERE ( o.apointment_date = '".$opd_date."' )
+ and o.opd_status=3 and o.doc_id ='".$doc_id."' ORDER BY opd_code desc ";
+
+ $query = $this->db->query($sql);
+ $opd_list_3= $query->result();
+
+ $sql="select d.p_fname,count(DISTINCT o.opd_id) as No_opd, d.id as doc_id,
+ group_concat(DISTINCT m.SpecName) as Spec,
+ count( DISTINCT CASE o.opd_status WHEN 1 THEN o.opd_id END) as count_wait,
+ count( DISTINCT CASE o.opd_status WHEN 2 THEN o.opd_id END) as count_visit,
+ count( DISTINCT CASE o.opd_status WHEN 3 THEN o.opd_id END) as count_cancel,
+ MOD(d.id,5) as color_code
+ from (doctor_master d join doc_spec s join med_spec m on d.id=s.doc_id
+ and m.id=s.med_spec_id)left join opd_master o on d.id=o.doc_id and o.apointment_date='".$opd_date."'
+ where d.id ='".$doc_id."' group by d.id";
+
+ $query = $this->db->query($sql);
+ $doc_master= $query->result();
+
+ $sql="select id,color_name,code_code from color";
+ $query = $this->db->query($sql);
+ $color= $query->result();
+
+ $data['color']=array();
+
+ foreach($color as $aRow)
+ {
+ array_push($data['color'],$aRow->code_code);
+ }
+
+ $data['color1']=array(
+ '0' => 'bg-yellow',
+ '1' => 'bg-red',
+ '2' => 'bg-green',
+ '3' => 'bg-gray',
+ '4' => 'bg-orange',
+ '5' => 'bg-blue'
+ );
+
+ //Doctor Panel
+ $doc_master_panel='';
+
+ //Master View
+ $Master_View='';
+
+ //On Booking List
+ $tab0='';
+ $srno=0;
+ foreach($opd_list_0 as $row)
+ {
+ $tab0.='
+ '.$row->opd_id.'
+ '.$row->opd_code.'
+ '.$row->P_name.'
+ '.$row->Paymode.'
+ ';
+ if($row->payment_status==1) {
+ $tab0.='Queue
+ Cancel OPD ';
+ }else{
+ $tab0.='
+ Go For Payment ';
+ }
+ $tab0.='
+
+
+ ';
+ }
+
+
+ $Master_View_head=str_replace("##HEAD_NAME##","On Booking List",$Master_View);
+ $tab0=str_replace("##CONTENT##",$tab0,$Master_View_head);
+
+ //OnWaiting List
+
+ $tab1='';
+ $srno=0;
+ foreach($opd_list_1 as $row)
+ {
+ $tab1.='
+ '.$row->queue_no.'
+ '.$row->opd_code.'
+ '.$row->P_name.'
+ '.$row->opd_fee_desc.'/'.$row->Paymode.'
+
+
+
+
+
+
+
+ Visit Done
+
+ ';
+ }
+
+ $Master_View_head=str_replace("##HEAD_NAME##","On Waiting List",$Master_View);
+ $tab1=str_replace("##CONTENT##",$tab1,$Master_View_head);
+
+ //Visited List
+ $tab2='';
+
+ $srno=0;
+ foreach($opd_list_2 as $row)
+ {
+ $tab2.='
+ '.$row->opd_id.'
+ '.$row->opd_code.'
+ '.$row->P_name.'
+ '.$row->opd_fee_desc.'/'.$row->Paymode.'
+
+
+
+
+
+
+ ';
+ }
+
+ $Master_View_head=str_replace("##HEAD_NAME##","Visited List",$Master_View);
+ $tab2=str_replace("##CONTENT##",$tab2,$Master_View_head);
+
+ //Cancel List
+ $tab3='';
+ $srno=0;
+ foreach($opd_list_3 as $row)
+ {
+ $tab3.='
+ '.$row->opd_id.'
+ '.$row->opd_code.'
+ '.$row->P_name.'
+ '.$row->opd_fee_desc.'/'.$row->Paymode.'
+
+
+ <
+
+ ';
+ }
+
+ $Master_View_head=str_replace("##HEAD_NAME##","Visited List",$Master_View);
+ $tab3=str_replace("##CONTENT##",$tab3,$Master_View_head);
+
+ $rvar=array(
+ 'update' =>1,
+ 'doc_master_panel'=> $doc_master_panel,
+ 'tab0' => $tab0,
+ 'tab1' => $tab1,
+ 'tab2' => $tab2,
+ 'tab3' => $tab3,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+
+
+ }
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Opd_online_api.php b/old_code_ci3/controllers/Opd_online_api.php
new file mode 100644
index 0000000..00bdefe
--- /dev/null
+++ b/old_code_ci3/controllers/Opd_online_api.php
@@ -0,0 +1,290 @@
+db->query($sql);
+ $data= $query->result();
+
+ }else{
+ $sql="select * from patient_master limit 10";
+ $query = $this->db->query($sql);
+ $data= $query->result();
+ }
+
+ if(!$data)
+ {
+ $rvar=array(
+ "no_record" =>0,
+ );
+ $encode_data = json_encode($rvar);
+ $data= $encode_data;
+ }
+
+ $this->response($data, REST_Controller::HTTP_OK);
+ }
+
+ public function patient_code_get($p_code="0")
+ {
+ $data=null;
+
+ if(!empty($p_code)){
+ $sql="select * from patient_master where p_code='$p_code'";
+ $query = $this->db->query($sql);
+ $data= $query->result();
+ }
+
+ if(!$data)
+ {
+ $rvar=array(
+ 'no_record' =>0,
+ );
+ $encode_data = json_encode($rvar);
+ $data= $encode_data;
+ }
+ $this->response($data, REST_Controller::HTTP_OK);
+ }
+
+ public function patient_list_get($p_code="0")
+ {
+ $data=null;
+
+ if(!empty($p_code) || strlen($p_code)>3){
+ $sql="select * from patient_master where p_code like '%$p_code' order by id desc limit 20";
+ $query = $this->db->query($sql);
+ $data= $query->result();
+ }
+
+ if(!$data)
+ {
+ $rvar=array(
+ 'no_record' =>0,
+ );
+ $encode_data = json_encode($rvar);
+ $data= $encode_data;
+ }
+ $this->response($data, REST_Controller::HTTP_OK);
+ }
+
+ public function patient_phone_get($phone_number)
+ {
+ $data=null;
+
+ if(!empty($phone_number)){
+ $sql="select * from patient_master where mphone1='$phone_number' and mphone1<>''";
+ $query = $this->db->query($sql);
+ $data= $query->result();
+ }
+
+ if(!$data)
+ {
+ $rvar=array(
+ 'no_record' =>0,
+ );
+ $encode_data = json_encode($rvar);
+ $data= $encode_data;
+ }
+ $this->response($data, REST_Controller::HTTP_OK);
+ }
+
+ public function patient_phone_list_get($phone_number)
+ {
+ $data=null;
+
+ if(!empty($phone_number)){
+ $sql="select * from patient_master where mphone1 like '$phone_number%' and mphone1<>'' order by id desc limit 20 ";
+ $query = $this->db->query($sql);
+ $data= $query->result();
+ }
+
+ if(!$data)
+ {
+ $rvar=array(
+ 'no_record' =>0,
+ );
+ $encode_data = json_encode($rvar);
+ $data= $encode_data;
+ }
+ $this->response($data, REST_Controller::HTTP_OK);
+ }
+
+ public function patient_create_post()
+ {
+ $data = array(
+ 'mphone1' => $this->input->post('mphone1'),
+ 'p_fname' => strtoupper($this->input->post('p_fname')),
+ 'gender' => $this->input->post('gender'),
+ 'p_relative' => $this->input->post('p_relative'),
+ 'p_rname' => strtoupper($this->input->post('p_rname')),
+ 'dob' => $this->input->post('dob'),
+ 'estimate_dob' => 'estimate_dob',
+
+ );
+
+ $this->load->model('Patient_M');
+
+ $inser_id=$this->Patient_M->insert($data);
+
+ if($inser_id>0)
+ {
+ $sql="Select * from patient_master where id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data= $query->result();
+
+ if(count($data)>0)
+ {
+ $rvar=[
+ 'New_UHID' =>$data[0]->id,
+ 'p_code' => $data[0]->p_code,
+ ];
+ }else{
+ $rvar=[
+ 'New_UHID' =>0,
+ ];
+ }
+ }else{
+ $rvar=[
+ 'New_UHID' =>0,
+ ];
+ }
+
+ $response_data = json_encode($rvar);
+ $response_data = $rvar;
+ //$response_data = $data;
+
+ $this->response($response_data, REST_Controller::HTTP_OK);
+
+ }
+
+ public function opd_register_post()
+ {
+
+ $user_name_info = 'OnlineUser ['.date('d-m-Y H:i:s').']';
+ $p_id= $this->input->post('hospital_patient_id');
+ $doc_id= $this->input->post('hospital_doc_id');
+ $appointment_date= $this->input->post('appointment_date');
+ $opd_fee= $this->input->post('opd_fee');
+
+ //var_dump($this->input->post());
+
+ $sql="select * from patient_master where id=".$p_id;
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$doc_id." group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select * from opd_master where p_id=".$p_id." order by opd_id desc";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select * from opd_master where p_id=$p_id and apointment_date='$appointment_date' and doc_id=$doc_id ";
+ $query = $this->db->query($sql);
+ $opd_master_exit= $query->result();
+
+ $this->load->model('Opd_M');
+
+ $last_Vist_date='';
+
+ if(count($data['opd_master'])>0)
+ {
+ $last_Vist_date=$data['opd_master'][0]->apointment_date;
+ }
+
+ $opd_fee_amount=$this->input->post('opd_fee');
+ $opd_fee_desc="Online Booked";
+
+
+ $data['insert'] = array(
+ 'p_id' => $p_id,
+ 'P_name' => strtoupper($data['person_info'][0]->p_fname),
+ 'doc_id' => $doc_id,
+ 'insurance_id' => '0',
+ 'opd_fee_id' => '0',
+ 'opd_fee_amount' => $opd_fee_amount,
+ 'opd_fee_gross_amount' => $opd_fee_amount,
+ 'opd_fee_desc' => $opd_fee_desc,
+ 'doc_name' => $data['doc_info'][0]->p_fname,
+ 'opd_fee_type' =>0,
+ 'apointment_date' =>$appointment_date,
+ 'doc_spec' => $data['doc_info'][0]->SpecName,
+ 'prepared_by' => $user_name_info,
+ 'payment_status'=>1,
+ 'payment_mode_desc'=> 'Online',
+ 'online_book'=> 1,
+ );
+
+ $data['patient_master'] = array(
+ 'last_visit' => $appointment_date,
+ );
+
+ if(count($data['opd_master'])>0)
+ {
+ $data['insert']=array_merge($data['insert'],array('last_opdvisit_date'=>$data['opd_master'][0]->apointment_date));
+ }
+
+ $inser_id=0;
+
+ if(count($opd_master_exit)==0){
+ $inser_id=$this->Opd_M->insert( $data['insert']);
+ }else{
+ $inser_id=$opd_master_exit[0]->opd_id;
+ }
+
+
+ if($inser_id>0)
+ {
+ $this->load->model('Patient_M');
+ $this->Patient_M->update_online($data['patient_master'],$p_id);
+
+ $sql="select * from opd_master where opd_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $opd_book= $query->result();
+
+ if(count($opd_book)>0)
+ {
+ $rvar=[
+ 'OPD_ID' =>$opd_book[0]->opd_id,
+ 'DOC_NAME' =>$opd_book[0]->doc_name,
+ 'BOOKNO' =>$opd_book[0]->opd_id.'-'.$opd_book[0]->opd_no,
+ 'BOOKDATE' =>MysqlDate_to_str($opd_book[0]->apointment_date),
+ 'PHONENO' =>$data['person_info'][0]->mphone1,
+ ];
+ }else{
+ $rvar=[
+ 'OPD_ID' =>0,
+ ];
+ }
+ }else{
+ $rvar=[
+ 'OPD_ID' =>0,
+ ];
+ }
+
+ $response_data = json_encode($rvar);
+ $response_data = $rvar;
+
+ $this->response($response_data, REST_Controller::HTTP_OK);
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Opd_prescription.php b/old_code_ci3/controllers/Opd_prescription.php
new file mode 100644
index 0000000..24c372e
--- /dev/null
+++ b/old_code_ci3/controllers/Opd_prescription.php
@@ -0,0 +1,2976 @@
+load->model('Prescription_M');
+ $this->load->model('Patient_M');
+ }
+
+ // Prescription
+ public function create_revist_opd($opdid)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,if(apointment_date>date_add(CURDATE(),interval -7 day),0,1) as Exp_date from opd_master_exten where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $pno=$data['opd_master'][0]->p_id;
+ $doc_id=$data['opd_master'][0]->doc_id;
+ $opd_date=$data['opd_master'][0]->apointment_date;
+ $Exp_date=$data['opd_master'][0]->Exp_date;
+
+ $opd_status=$data['opd_master'][0]->opd_status;
+
+ $sql="select max(queue_no) as max_queue from opd_prescription where date_opd_visit=curdate() and doc_id='".$doc_id."'";
+ $query = $this->db->query($sql);
+ $max_queue= $query->result();
+
+ if(count($max_queue)>0)
+ {
+ $max_queue_no=$max_queue[0]->max_queue;
+ }else{
+ $max_queue_no=0;
+ }
+
+ $max_queue_no=$max_queue_no+1;
+
+ $sql="select * from opd_prescription where visit_status=0 and HCODE=".HCODE." and opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_prescription']= $query->result();
+
+ $msg_send="";
+
+ if(count($data['opd_prescription'])==0 )
+ {
+ if($Exp_date==0 && $opd_status==2)
+ {
+ $datainsert = array(
+ 'HCODE' => HCODE,
+ 'opd_id' => $opdid,
+ 'p_id' => $pno,
+ 'revisit'=>'1',
+ 'queue_no'=>$max_queue_no,
+ 'date_opd_visit'=>date('Y-m-d'),
+ 'update_by'=>$user_name
+ );
+
+ $this->Prescription_M->insert_opd_prescription($datainsert);
+
+ $msg_send="OPD Created";
+
+ }elseif($opd_status==1){
+ $msg_send="OPD Pending";
+ }else{
+ $msg_send="OPD Expired";
+ }
+
+ }else{
+ $msg_send="Revisit Already Created :";
+ }
+
+ echo $msg_send;
+ }
+
+ public function create_opd_queue($opdid)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *
+ from opd_master
+ where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $pno=$data['opd_master'][0]->p_id;
+ $doc_id=$data['opd_master'][0]->doc_id;
+ $opd_date=$data['opd_master'][0]->apointment_date;
+
+ $opd_status=$data['opd_master'][0]->opd_status;
+
+ $sql="select max(queue_no) as max_queue from opd_prescription
+ where date_opd_visit=curdate() and doc_id='".$doc_id."'";
+ $query = $this->db->query($sql);
+ $max_queue= $query->result();
+
+ if(count($max_queue)>0)
+ {
+ $max_queue_no=$max_queue[0]->max_queue;
+ }else{
+ $max_queue_no=0;
+ }
+
+ $max_queue_no=$max_queue_no+1;
+
+ $sql="select * from opd_prescription where visit_status=0 and opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_prescription']= $query->result();
+
+ $msg_send="";
+
+ if(count($data['opd_prescription'])==0 )
+ {
+ if($opd_status==1)
+ {
+ $datainsert = array(
+ 'opd_id' => $opdid,
+ 'p_id' => $pno,
+ 'revisit'=>'0',
+ 'queue_no'=>$max_queue_no,
+ 'doc_id'=>$doc_id,
+ 'date_opd_visit'=>date('Y-m-d'),
+ 'update_by'=>$user_name
+ );
+
+ $this->Prescription_M->insert_opd_prescription($datainsert);
+
+ $msg_send="OPD in Queue Now";
+ }else{
+ $msg_send="OPD Already Done, Create Revisit";
+ }
+
+ }else{
+ $msg_send="OPD Already in Queue";
+ }
+
+ echo $msg_send;
+ }
+
+ public function show_profile_opd($p_id)
+ {
+ $data['p_id']=$p_id;
+
+ $sql="select * from patient_master_exten where id=".$p_id;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select o.* from opd_master o where o.p_id=$p_id order by o.opd_id desc";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select o.* from opd_master o where o.p_id=$p_id and date(o.apointment_date)=curdate()";
+ $query = $this->db->query($sql);
+ $data['opd_master_current']= $query->result();
+
+ //$this->load->view('Person/person_file_show',$data);
+
+ $this->load->view('dashboard/OPD_old_prescription',$data);
+
+ }
+
+ public function show_old_Prescribed($p_id,$currect_opd)
+ {
+
+ $sql="select o.* from opd_master o
+ where o.p_id=$p_id and o.opd_id<>$currect_opd order by o.opd_id desc";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select * from opd_prescription where opd_id=$currect_opd";
+ $query = $this->db->query($sql);
+ $current_opd_master= $query->result();
+
+ $data['doc_id']=$current_opd_master[0]->doc_id;
+ $data['opd_id']=$current_opd_master[0]->opd_id;
+ $data['opd_session_id']=$current_opd_master[0]->id;
+ $data['p_id']=$current_opd_master[0]->p_id;
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/rx_patient_old_medicine',$data);
+
+ }
+
+
+ public function show_medical_item($p_id)
+ {
+ $data['p_id']=$p_id;
+
+ $sql="SELECT *
+ from invoice_med_master
+ WHERE patient_id=$p_id
+ ORDER BY id desc";
+ $query = $this->db->query($sql);
+ $data['invoice_med_master']= $query->result();
+
+ $this->load->view('dashboard/opd_medical_bill',$data);
+
+ }
+
+ public function show_profile_investigation($p_id)
+ {
+ $data['p_id']=$p_id;
+
+ $sql="SELECT i.id,i.inv_date,i.invoice_code,GROUP_CONCAT(t.item_name) as Item_list,i.net_amount,
+ i.attach_id,
+ date_format(i.inv_date,'%d-%m-%Y') as inv_date_str
+ FROM invoice_master i JOIN invoice_item t ON i.id=t.inv_master_id
+ WHERE i.attach_id=$p_id
+ GROUP BY i.id ";
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ //$this->load->view('Person/person_file_show',$data);
+
+ $this->load->view('dashboard/Investigation_history',$data);
+
+ }
+
+ public function Prescription($opdid)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $pno=$data['opd_master'][0]->p_id;
+ $doc_id=$data['opd_master'][0]->doc_id;
+
+ $sql="select d.id,d.p_code,d.p_fname,d.p_title,d.mphone1,d.mphone2,
+ if(d.gender=1,'Male','Female') as xgender,Get_Age(d.dob) as age,
+ d.dob,d.zip,d.email1,d.email2,d.register_date,d.add1,d.add2,d.city,
+ d.state,d.country,d.active, group_concat(distinct m.SpecName) as SpecName
+ from (doctor_master d left join (doc_spec s
+ join med_spec m on s.med_spec_id=m.id) on d.id=s.doc_id)
+ where d.id=".$doc_id." group by d.id";
+
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+
+ $sql="SELECT m.mor_id,m.morbidities,c.p_id
+ FROM morbidities_master m left JOIN patient_morbidities c ON m.mor_id=c.morbidities AND c.p_id=$pno
+ Where m.active=1";
+ $query = $this->db->query($sql);
+ $data['morbidities']= $query->result();
+
+
+ $sql="select * from opd_prescription where visit_status=0 and opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_prescription']= $query->result();
+
+ $sql="select *
+ from patient_master_exten where id=".$pno;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select *
+ from patient_master where id=".$pno;
+ $query = $this->db->query($sql);
+ $data['Pdata']= $query->result();
+
+ $sql="select * from invprofiles ";
+ $query = $this->db->query($sql);
+ $data['invprofiles']= $query->result();
+
+ $sql="select * from investigation where short_name<>'' order by short_name,sort_id ";
+ $query = $this->db->query($sql);
+ $data['short_investigation']= $query->result();
+
+ $sql="select * from complaints_master where show_in_short=1 order by Name ";
+ $query = $this->db->query($sql);
+ $data['short_complaint']= $query->result();
+
+ $data['doc_id']=$doc_id;
+
+ if(count($data['opd_prescription'])==0)
+ {
+ $datainsert = array(
+ 'opd_id' => $opdid,
+ 'p_id' => $pno,
+ 'doc_id'=>$doc_id,
+ 'update_by'=>$user_name
+ );
+
+ $this->Prescription_M->insert_opd_prescription($datainsert);
+
+ $sql="select * from opd_prescription where session_id=0 and opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_prescription']= $query->result();
+ }
+
+ //old Data from Last OPD
+ $sql="Select * from opd_prescription where p_id=$pno and opd_id<$opdid order by opd_id desc limit 1";
+ $query = $this->db->query($sql);
+ $opd_prescription_old= $query->result();
+
+ $data['old_complaint_list']=array();
+ $data['old_diagnosis_list']=array();
+ $data['old_Provisional_diagnosis_list']=array();
+
+ if(count($opd_prescription_old)>0)
+ {
+ $str_complaint=trim(trim($opd_prescription_old[0]->complaints,','));
+ if(strlen($str_complaint)>1)
+ {
+ $data['old_complaint_list']=explode(',',$str_complaint);
+ }
+
+ $str_diagnosis=trim(trim($opd_prescription_old[0]->diagnosis,','));
+ if(strlen($str_diagnosis)>1){
+ $data['old_diagnosis_list']=explode(',',$str_diagnosis);
+ }
+
+ $str_Provisional_diagnosis=trim(trim($opd_prescription_old[0]->Provisional_diagnosis,','));
+ if(strlen($str_Provisional_diagnosis)>1){
+ $data['old_Provisional_diagnosis_list']=explode(',',$str_Provisional_diagnosis);
+ }
+ }
+
+ $opd_session_id=$data['opd_prescription'][0]->id;
+
+ $data['p_id']=$pno;
+ $data['opd_id']=$opdid;
+ $data['opd_session_id']=$opd_session_id;
+
+ $this->load->view('dashboard/OPDPrescription',$data);
+ }
+
+ public function get_finding_exam()
+ {
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select distinct Finding_Examinations from opd_prescription where Finding_Examinations like '%".$q."%' ";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['Finding_Examinations']));
+ $new_row['value']=htmlentities(stripslashes($row['Finding_Examinations']));
+
+ //$new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function show_profile_image($p_id,$opd_id,$doc_id)
+ {
+ $data['p_id']=$p_id;
+
+ $sql="select *,IFNULL(GET_AGE_BY_DOB(dob),age) as str_age,
+ Date_Format(insert_date,'%Y-%m-%d') as str_regdate,
+ if(gender=1,'Male','Female') as xgender ,
+ if(date_add(insert_date,interval 12 hour)>sysdate(),1,0) as p_edit
+ from patient_master where id=".$p_id;
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $data['opd_id']=$opd_id;
+ $data['doc_id']=$doc_id;
+
+
+ $this->load->view('dashboard/person_profile_photo_from_doctor',$data);
+ }
+
+ public function prescribed_dose($opd_id,$opd_session_id)
+ {
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $data['opd_drug']= $query->result();
+
+ $sql="select * from opd_dose_shed ";
+ $query = $this->db->query($sql);
+ $data['opd_dose_shed']= $query->result();
+
+ $sql="select * from opd_dose_when";
+ $query = $this->db->query($sql);
+ $data['opd_dose_when']= $query->result();
+
+ $sql="select * from opd_dose_frequency";
+ $query = $this->db->query($sql);
+ $data['opd_dose_frequency']= $query->result();
+
+ $sql="select * from opd_dose_where";
+ $query = $this->db->query($sql);
+ $data['opd_dose_where']= $query->result();
+
+ $sql="select * from opd_dose_duration";
+ $query = $this->db->query($sql);
+ $opd_dose_duration= $query->result();
+
+ $sql="select * from med_formulation";
+ $query = $this->db->query($sql);
+ $med_formulation= $query->result();
+
+ $sql="SELECT o.id,o.next_visit_desc,DATE_ADD(CURDATE(),INTERVAL o.no_of_days DAY) AS next_date,
+ Concat(next_visit_desc,' (', Date_Format(DATE_ADD(CURDATE(),INTERVAL o.no_of_days DAY),'%d-%m-%Y') ,')') as next_visit_day
+ FROM opd_nextvisit o order by no_of_days";
+ $query = $this->db->query($sql);
+ $data['opd_nextvisit']= $query->result();
+
+ $data['opd_dose_duration']='';
+ foreach($opd_dose_duration as $row)
+ {
+ $data['opd_dose_duration'].='"'.$row->duration.'",';
+ }
+
+ $data['med_formulation']='';
+ foreach($med_formulation as $row)
+ {
+ $data['med_formulation'].='"'.$row->formulation.'",';
+ }
+
+
+ $sql="select * from opd_dose_remark";
+ $query = $this->db->query($sql);
+ $opd_dose_remark= $query->result();
+
+ $data['opd_dose_remark']='';
+ foreach($opd_dose_remark as $row)
+ {
+ $data['opd_dose_remark'].='"'.$row->dose_remark.'",';
+ }
+
+
+ $sql="select * from opd_advice";
+ $query = $this->db->query($sql);
+ $data['opd_advise']= $query->result();
+
+ $sql="select * from opd_master where opd_id=$opd_id";
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *
+ from opd_prescription_advice where opd_id=$opd_id";
+ $query = $this->db->query($sql);
+ $data['opd_patient_advice']= $query->result();
+
+ $data['advice_given']=$this->load->view('dashboard/opd_prescribed_advice',$data,true);
+
+ $sql="select * from opd_prescription where opd_id=$opd_id";
+ $query = $this->db->query($sql);
+ $data['opd_prescription']= $query->result();
+
+ $data['doc_id']=$data['opd_master'][0]->doc_id;
+ $data['opd_id']=$opd_id;
+ $data['opd_session_id']=$opd_session_id;
+ $data['p_id']=$data['opd_master'][0]->p_id;
+
+ $this->load->view('dashboard/opd_prescribed_dose',$data);
+
+ }
+
+
+ function add_patient_advice()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $opd_id=$this->input->post('opd_id');
+ $opd_pre_id=$this->input->post('opd_session_id');
+
+ $advice_id=$this->input->post('advice_id');
+
+ $sql="select * from opd_advice where id=$advice_id";
+ $query = $this->db->query($sql);
+ $opd_advice= $query->result();
+
+ $opd_advice_text="";
+ $opd_advice_text_hindi="";
+
+ if(count($opd_advice)>0){
+ $opd_advice_text=$opd_advice[0]->advice;
+ $opd_advice_text_hindi=$opd_advice[0]->advice_hindi;
+ }
+
+ $data_insert=array(
+ 'opd_id'=>$opd_id,
+ 'opd_pre_id'=>$opd_pre_id,
+ 'advice_id'=>$advice_id,
+ 'advice_txt'=>$opd_advice_text,
+ 'advice_txt_hindi'=>$opd_advice_text_hindi,
+ );
+
+
+ $this->Prescription_M->insert_opd_patient_advice($data_insert);
+
+ $sql="select *
+ from opd_prescription_advice where opd_id=$opd_id";
+ $query = $this->db->query($sql);
+ $data['opd_patient_advice']= $query->result();
+
+ $this->load->view('dashboard/opd_prescribed_advice',$data);
+
+
+ }
+
+ function del_patient_advice($advice_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $sql="select * from opd_prescription_advice where id=$advice_id";
+ $query = $this->db->query($sql);
+ $opd_advice= $query->result();
+
+ $opd_id=$opd_advice[0]->opd_id;
+
+
+ $this->Prescription_M->remove_opd_patient_advice($advice_id);
+
+ $sql="select *
+ from opd_prescription_advice where opd_id=$opd_id";
+ $query = $this->db->query($sql);
+ $data['opd_patient_advice']= $query->result();
+
+ $this->load->view('dashboard/opd_prescribed_advice',$data);
+
+ }
+
+ public function get_invprofiles($invPCode)
+ {
+ if($invPCode=='')
+ {
+ $invPCode="0";
+ }else{
+ $invPCode = str_replace('-',',',$invPCode);
+ }
+
+ $sql="select p.Code as p_Code,p.Name,i.Name,i.Code as i_Code
+ from (invprofiles p join invtprofiles j on p.Code=j.ProfileCode )
+ join investigation i on i.Code=j.InvestigationCode
+ where p.Code in (".$invPCode.")
+ order by p.Name,j.printOrder";
+ $query = $this->db->query($sql);
+ $invprofiles= $query->result();
+
+ $content="";
+
+ foreach($invprofiles as $row)
+ {
+ $content.= '
+
+ '.$row->Name.'
+
+
';
+ }
+
+ $content.='';
+
+ echo $content;
+ }
+
+ public function add_AdviseInvest($invACode,$opdSession)
+ {
+ $rangeArray = explode("-",$invACode);
+
+ foreach($rangeArray as $value)
+ {
+ $sql="select * from opd_prescription_investigation
+ where opd_pre_id=".$opdSession." and investigation_code=".$value." order by investigation_name";
+ $query = $this->db->query($sql);
+ $invChk= $query->result();
+
+ if(count($invChk)==0)
+ {
+ $sql="select *
+ from investigation
+ where Code='".$value."' ";
+ $query = $this->db->query($sql);
+ $invprofiles= $query->result();
+
+ $investigation_name="";
+ if(count($invprofiles)>0)
+ {
+ $investigation_name=$invprofiles[0]->Name;
+ }
+
+ $datainsert = array(
+ 'opd_pre_id' => $opdSession,
+ 'investigation_code' => $value,
+ 'investigation_name' => $investigation_name
+ );
+
+
+ $this->Prescription_M->insert_p_investigation($datainsert);
+ }
+ }
+
+ $sql="select * from opd_prescription_investigation
+ where opd_pre_id=".$opdSession." order by investigation_name";
+ $query = $this->db->query($sql);
+ $invOPDprofiles= $query->result();
+
+ $content="";
+
+ foreach($invOPDprofiles as $row)
+ {
+ $content.= '
+ '.$row->investigation_name.'
+
+ Remove
+ ';
+ }
+ $content.="
";
+ echo $content;
+ }
+
+ public function Remove_AdviseInvest($invACode,$opdSession)
+ {
+ $sql="select * from opd_prescription_investigation
+ where opd_pre_id=".$opdSession." and investigation_code=".$invACode." ";
+
+ $query = $this->db->query($sql);
+ $invChk= $query->result();
+
+
+
+ if(count($invChk)>0)
+ {
+ $this->Prescription_M->remove_p_investigation($invChk[0]->id);
+ }
+
+ $sql="select * from opd_prescription_investigation
+ where opd_pre_id=".$opdSession." order by investigation_name";
+ $query = $this->db->query($sql);
+ $invOPDprofiles= $query->result();
+
+ $content="";
+
+ foreach($invOPDprofiles as $row)
+ {
+ $content.= '
+ '.$row->investigation_name.'
+
+ Remove
+ ';
+ }
+ $content.="
";
+ echo $content;
+ }
+
+ public function get_complaints(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from complaints_master where Name like '%".$q."%' ";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['Name']));
+ $new_row['value']=htmlentities(stripslashes($row['Name']));
+
+ $new_row['complaints_no']=htmlentities(stripslashes($row['Code']));
+
+ $new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+
+ public function get_surgery(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from surgery where Name like '%".$q."%' ";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['Name']));
+ $new_row['value']=htmlentities(stripslashes($row['Name']));
+
+ $new_row['surgery_no']=htmlentities(stripslashes($row['Code']));
+
+ $new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_disease(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from disease_master where Name like '%".$q."%' order by Name";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['Name']));
+ $new_row['value']=htmlentities(stripslashes($row['Name']));
+
+ $new_row['complaints_no']=htmlentities(stripslashes($row['Code']));
+
+ $new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_investigation(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from investigation where Name like '%".$q."%' or short_name like '%".$q."%' order by Name";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['Name']));
+ $new_row['value']=htmlentities(stripslashes($row['Name']));
+
+ $new_row['investigation_no']=htmlentities(stripslashes($row['Code']));
+
+ $new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function vital_data($opd_session_id)
+ {
+ $sql="select * from opd_prescription where id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $opd_prescription= $query->result();
+
+ $content="";
+
+ if($opd_prescription[0]->bp<>'')
+ {
+ $content.="BP : ".$opd_prescription[0]->bp." / ".$opd_prescription[0]->diastolic." ";
+ }
+
+ if($opd_prescription[0]->pulse<>'')
+ {
+ $content.="Pulse : ".$opd_prescription[0]->pulse." ";
+ }
+
+ if($opd_prescription[0]->temp<>'')
+ {
+ $content.="Temp : ".$opd_prescription[0]->temp." C"." ";
+ }
+
+ if($opd_prescription[0]->spo2<>'')
+ {
+ $content.="SpO2 : ".$opd_prescription[0]->spo2." %"." ";
+ }
+
+ if($opd_prescription[0]->glucose<>'')
+ {
+ $content.="Blood Sugar : ".$opd_prescription[0]->glucose." ";
+ }
+
+ $content.="
";
+
+ echo $content;
+
+ }
+
+ public function get_remark($p_id)
+ {
+ $sql="select * from patient_remark where p_id=".$p_id." Order by id desc";
+ $query = $this->db->query($sql);
+ $patient_remark= $query->result();
+
+ $content="";
+
+ foreach($patient_remark as $row)
+ {
+ $content.="".nl2br($row->remark)." ";
+ $content.="Update By:".$row->insert_by." ";
+ }
+
+ $data['content']= $content;
+
+
+ }
+
+ public function patient_remark($p_id)
+ {
+ $sql="select *,Date_Format(insert_datetime,'%d/%m/%Y %H:%i') as ins_time from patient_remark where p_id=".$p_id." Order by id desc";
+ $query = $this->db->query($sql);
+ $data['patient_remark']= $query->result();
+
+ $sql="select * from tag_master Order by tag_name";
+ $query = $this->db->query($sql);
+ $data['tag_master']= $query->result();
+
+ $sql="SELECT a.*,t.tag_name,t.tag_type_id
+ FROM patient_tag_assign a JOIN tag_master t ON a.tag_id=t.id
+ WHERE isdelete=0 and a.p_id=$p_id";
+ $query = $this->db->query($sql);
+ $data['patient_tag_list']= $query->result();
+
+ $data['p_id']=$p_id;
+
+ $this->load->view('dashboard/patient_remark',$data);
+ }
+
+
+
+ public function get_medical(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from opd_med_master
+ where item_name like '%".$q."%' order by item_name";
+
+ $sql=$sql." limit 10";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['item_name'])).' ['.htmlentities(stripslashes($row['formulation'])).']';
+ $new_row['value']=htmlentities(stripslashes($row['item_name']));
+ $new_row['med_id']=htmlentities(stripslashes($row['id']));
+ $new_row['item_name']=htmlentities(stripslashes($row['item_name']));
+ $new_row['formulation']=htmlentities(stripslashes($row['formulation']));
+ $new_row['genericname']=htmlentities(stripslashes($row['genericname']));
+
+ $new_row['dosage']=htmlentities(stripslashes($row['dosage']));
+ $new_row['dosage_when']=htmlentities(stripslashes($row['dosage_when']));
+ $new_row['dosage_freq']=htmlentities(stripslashes($row['dosage_freq']));
+ $new_row['no_of_days']=htmlentities(stripslashes($row['no_of_days']));
+ $new_row['qty']=htmlentities(stripslashes($row['qty']));
+ $new_row['remark']=htmlentities(stripslashes($row['remark']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ }else{
+ $row_set[] ='';
+ }
+
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+
+ // Enhanced medicine autocomplete API
+ public function get_medicine_autocomplete()
+ {
+ $this->load->helper('url');
+
+ // Get search parameters
+ $query = $this->input->get('query') ?: $this->input->get('term');
+ $category = $this->input->get('category') ?: 'medicine_name';
+ $limit = (int)($this->input->get('limit') ?: 10);
+
+ if (empty($query) || strlen($query) < 1) {
+ echo json_encode(['success' => false, 'data' => []]);
+ return;
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $doc_id = $user->id;
+
+ $response_data = [];
+
+ switch($category) {
+ case 'medicine_name':
+ $sql = "SELECT DISTINCT item_name as text, 'global' as scope, id as med_id, formulation, genericname
+ FROM opd_med_master
+ WHERE item_name LIKE ?
+ ORDER BY item_name
+ LIMIT ?";
+ $result = $this->db->query($sql, ['%' . $query . '%', $limit]);
+
+ foreach($result->result() as $row) {
+ $response_data[] = [
+ 'text' => $row->text,
+ 'scope' => $row->scope,
+ 'med_id' => $row->med_id,
+ 'formulation' => $row->formulation,
+ 'genericname' => $row->genericname
+ ];
+ }
+ break;
+
+ case 'dosage':
+ $dosage_patterns = [
+ '1-0-1', '1-1-1', '0-1-0', '1-0-0', '0-0-1', '2-1-1', '1-1-2',
+ '1/2-0-1/2', '1/2-1/2-1/2', '2-0-2', '1-2-1', '3-2-1', '1-1-1-1',
+ '2-2-2', '1/4-1/4-1/4', '3/4-3/4-3/4', 'As required', 'SOS'
+ ];
+ foreach($dosage_patterns as $pattern) {
+ if (stripos($pattern, $query) !== false) {
+ $response_data[] = ['text' => $pattern, 'scope' => 'global'];
+ }
+ }
+ break;
+
+ case 'dosage_when':
+ $when_options = [
+ 'Before meal', 'After meal', 'With meal', 'Empty stomach',
+ 'At bedtime', 'Morning', 'Evening', 'As directed'
+ ];
+ foreach($when_options as $option) {
+ if (stripos($option, $query) !== false) {
+ $response_data[] = ['text' => $option, 'scope' => 'global'];
+ }
+ }
+ break;
+
+ case 'dosage_frequency':
+ $frequency_options = [
+ 'Daily', 'Twice daily', 'Thrice daily', 'Four times daily',
+ 'Once weekly', 'Twice weekly', 'Every other day', 'As needed',
+ 'Every 4 hours', 'Every 6 hours', 'Every 8 hours', 'Every 12 hours'
+ ];
+ foreach($frequency_options as $option) {
+ if (stripos($option, $query) !== false) {
+ $response_data[] = ['text' => $option, 'scope' => 'global'];
+ }
+ }
+ break;
+
+ case 'dosage_duration':
+ $duration_options = [
+ '3 days', '5 days', '7 days', '10 days', '14 days', '21 days', '30 days',
+ '1 week', '2 weeks', '3 weeks', '1 month', '2 months', '3 months',
+ 'Till symptoms subside', 'Continue as advised'
+ ];
+ foreach($duration_options as $option) {
+ if (stripos($option, $query) !== false) {
+ $response_data[] = ['text' => $option, 'scope' => 'global'];
+ }
+ }
+ break;
+ }
+
+ echo json_encode([
+ 'success' => true,
+ 'data' => array_slice($response_data, 0, $limit)
+ ]);
+ }
+
+ public function opd_prescription_save()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_update_info = $user->first_name.''. $user->last_name.'['.$user->id.']'.date('d-m-Y H:i:s');
+
+ $opd_session_id=$this->input->post('opd_session_id');
+ $opd_id=$this->input->post('opd_id');
+ $input_Examinations=$this->input->post('input_Examinations');
+ $input_Prescriber=$this->input->post('input_Prescriber');
+
+ $p_id=$this->input->post('p_id');
+
+ $input_complaints=trim($this->input->post('input_complaints'));
+ $input_Investigation=trim($this->input->post('input_Investigation'));
+ $input_diagnosis=trim($this->input->post('input_diagnosis'));
+ $input_Provisional_diagnosis=trim($this->input->post('input_Provisional_diagnosis'));
+
+ $input_BP=$this->input->post('input_BP');
+ $input_Diastolic=$this->input->post('input_Diastolic');
+ $input_Height=$this->input->post('input_Height');
+ $input_Weight=$this->input->post('input_Weight');
+ $input_Waist=$this->input->post('input_Waist');
+ $input_RR=$this->input->post('input_RR');
+
+ $input_Tempature=$this->input->post('input_Tempature');
+ $input_Pulse=$this->input->post('input_Pulse');
+
+ $input_SPO2=$this->input->post('input_SPO2');
+ $input_glucose=$this->input->post('input_glucose');
+
+ $opd_prescription_paediatric_chk=$this->input->post('opd_prescription_paediatric_chk');
+ $opd_prescription_pregnancy_chk=$this->input->post('opd_prescription_pregnancy_chk');
+ $opd_prescription_lactation_chk=$this->input->post('opd_prescription_lactation_chk');
+ $opd_prescription_liver_insufficiency_chk=$this->input->post('opd_prescription_liver_insufficiency_chk');
+ $opd_prescription_renal_insufficiency_chk=$this->input->post('opd_prescription_renal_insufficiency_chk');
+ $opd_prescription_pulmonary_insufficiency_chk=$this->input->post('opd_prescription_pulmonary_insufficiency_chk');
+ $opd_prescription_corona_suspected_chk=$this->input->post('opd_prescription_corona_suspected_chk');
+ $opd_prescription_dengue_chk=$this->input->post('opd_prescription_dengue_chk');
+
+ $opd_prescription_smoking_chk=$this->input->post('opd_prescription_smoking_chk');
+ $opd_prescription_alcohol_chk=$this->input->post('opd_prescription_alcohol_chk');
+ $opd_prescription_drug_chk=$this->input->post('opd_prescription_drug_chk');
+
+
+ $input_pallor=$this->input->post('input_pallor');
+ $input_Icterus=$this->input->post('input_Icterus');
+ $input_cyanosis=$this->input->post('input_cyanosis');
+ $input_clubbing=$this->input->post('input_clubbing');
+ $input_edema=$this->input->post('input_edema');
+
+ $pain_value=$this->input->post('pain_value');
+
+ $morbidities = $this->input->post('morbidities_list');
+
+ $morbidities_list = explode("-", $morbidities);
+
+ $sql="select * from opd_prescription where opd_id=".$opd_id." and id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $dataRec= $query->result();
+
+ $content="Nothing Done";
+
+ if(count($dataRec)>0)
+ {
+ $dataupdate = array(
+ 'Finding_Examinations' => strtoupper($input_Examinations),
+ 'Prescriber_Remarks' => strtoupper($input_Prescriber),
+ 'bp' => $input_BP,
+ 'diastolic' => $input_Diastolic,
+ 'pulse' => $input_Pulse,
+ 'height' => $input_Height,
+ 'weight' => $input_Weight,
+ 'waist' => $input_Waist,
+ 'temp' => $input_Tempature,
+ 'rr_min' => $input_RR,
+ 'spo2' => $input_SPO2,
+ 'glucose' => $input_glucose,
+ 'update_by' => $user_update_info,
+
+ 'complaints' => strtoupper($input_complaints),
+ 'Investigation' => strtoupper($input_Investigation),
+ 'diagnosis' => strtoupper($input_diagnosis),
+ 'Provisional_diagnosis' => strtoupper($input_Provisional_diagnosis),
+
+ 'paediatric' => $opd_prescription_paediatric_chk,
+ 'pregnancy' => $opd_prescription_pregnancy_chk,
+ 'lactation' => $opd_prescription_lactation_chk,
+ 'liver_insufficiency' => $opd_prescription_liver_insufficiency_chk,
+ 'renal_insufficiency' => $opd_prescription_renal_insufficiency_chk,
+ 'pulmonary_insufficiency' => $opd_prescription_pulmonary_insufficiency_chk,
+ 'corona_suspected'=> $opd_prescription_corona_suspected_chk,
+ 'dengue'=> $opd_prescription_dengue_chk,
+
+ 'pallor' => strtoupper($input_pallor),
+ 'Icterus' => strtoupper($input_Icterus),
+ 'cyanosis' => strtoupper($input_cyanosis),
+ 'clubbing' => strtoupper($input_clubbing),
+ 'edema' => strtoupper($input_edema),
+
+ 'pain_value' => $pain_value,
+
+ );
+
+ $dataPatientMaster=array(
+ 'is_smoking' => $opd_prescription_smoking_chk,
+ 'is_alcohol'=> $opd_prescription_alcohol_chk,
+ 'is_drug_abuse'=> $opd_prescription_drug_chk,
+ );
+
+ $this->Prescription_M->update_opd_prescription($dataupdate,$opd_session_id);
+
+ $this->Patient_M->update($dataPatientMaster,$p_id);
+
+ $sql="SELECT m.mor_id,m.morbidities
+ FROM morbidities_master m Where m.active=1";
+ $query = $this->db->query($sql);
+ $morbidities_data= $query->result();
+
+
+ foreach($morbidities_data as $row){
+ if(in_array($row->mor_id,$morbidities_list)){
+ $this->Prescription_M->update_patient_morbidities($p_id,$row->mor_id,0);
+ }else{
+ $this->Prescription_M->update_patient_morbidities($p_id,$row->mor_id,1);
+ }
+ }
+
+ $content="Update Done";
+ }
+
+ echo $content;
+ }
+
+ public function save_prescribed_extra()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+ $opd_session_id=$this->input->post('opd_session_id');
+
+ $advice=$this->input->post('input_advice');
+ $next_visit=$this->input->post('input_next_visit');
+ $refer_to=$this->input->post('input_refer_to');
+
+ $sql="select * from opd_prescription where id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $dataRec= $query->result();
+
+ $content="Nothing Done";
+
+ if(count($dataRec)>0)
+ {
+ $dataupdate = array(
+ 'advice' => $advice,
+ 'next_visit' => $next_visit,
+ 'refer_to'=> $refer_to,
+ );
+
+
+ $this->Prescription_M->update_opd_prescription($dataupdate,$opd_session_id);
+
+ $content="Update Done";
+ }
+
+ echo $content;
+ }
+
+
+
+
+
+
+ //Medical
+
+ public function add_medical()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $input_med_name=strtoupper($this->input->post('input_med_name'));
+ $input_med_type=$this->input->post('input_med_type');
+ $input_dosage=$this->input->post('input_dosage');
+ $input_dosage_when=$this->input->post('input_dosage_when');
+ $input_dosage_freq=$this->input->post('input_dosage_freq');
+ $input_dose_where=$this->input->post('input_dose_where');
+ $input_no_of_days=$this->input->post('input_no_of_days');
+ $input_qty=$this->input->post('input_qty');
+ $input_remark=strtoupper($this->input->post('input_remark'));
+ $hid_med_id=$this->input->post('hid_med_id');
+ $opd_session_id=$this->input->post('opd_session_id');
+ $opd_med_item_id=$this->input->post('opd_med_item_id');
+
+ $insert_master = array(
+ 'item_name' => $input_med_name,
+ 'formulation' => $input_med_type,
+ );
+
+ if($hid_med_id==0)
+ {
+ $sql="Select * from opd_med_master Where Trim(item_name)='$input_med_name'";
+ $query = $this->db->query($sql);
+ $opd_med_master= $query->result();
+
+ if(count($opd_med_master)>0){
+ $hid_med_id=$opd_med_master[0]->id;
+ }else{
+ $hid_med_id=$this->Prescription_M->insert_med_master($insert_master);
+ }
+ }
+
+ $datainsert = array(
+ 'opd_pre_id' => $opd_session_id,
+ 'med_name' => $input_med_name,
+ 'med_id' => $hid_med_id,
+ 'med_type' => $input_med_type,
+ 'dosage' => $input_dosage,
+ 'dosage_when' => $input_dosage_when,
+ 'dosage_freq' => $input_dosage_freq,
+ 'dosage_where' => $input_dose_where,
+ 'qty' => $input_qty,
+ 'no_of_days' => $input_no_of_days,
+ 'remark' => $input_remark,
+ 'update_by' => $user_name
+ );
+
+ $update_master = array(
+ 'formulation' => $input_med_type,
+ 'dosage' => $input_dosage,
+ 'dosage_when' => $input_dosage_when,
+ 'dosage_freq' => $input_dosage_freq,
+ 'dosage_where' => $input_dose_where,
+ 'qty' => $input_qty,
+ 'no_of_days' => $input_no_of_days,
+ 'remark' => $input_remark,
+ );
+
+ $this->Prescription_M->update_med_master($update_master,$hid_med_id);
+
+ if($opd_med_item_id>0)
+ {
+ $this->Prescription_M->update_p_medical($datainsert,$opd_med_item_id);
+ }else{
+ $this->Prescription_M->insert_p_medical($datainsert);
+ }
+
+ $content="";
+
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $data['opd_drug']= $query->result();
+
+ $content=$this->load->view('dashboard/opd_prescription_med_list',$data,TRUE);
+
+ echo $content;
+
+ }
+
+ public function medical_Select()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $opd_session_id=$this->input->post('opd_session_id');
+ $rec_id=$this->input->post('med_prec_id');
+
+ $sql="select * from opd_prescrption_prescribed
+ where id=".$rec_id." and opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $dataRec= $query->result();
+
+ $rvar=array(
+ "id" => $dataRec[0]->id,
+ "opd_session_id" => $opd_session_id,
+ "med_name" => $dataRec[0]->med_name,
+ "med_type" => $dataRec[0]->med_type,
+ "dosage" => $dataRec[0]->dosage,
+ "dosage_when" => $dataRec[0]->dosage_when,
+ "dosage_freq" => $dataRec[0]->dosage_freq,
+ "no_of_days" => $dataRec[0]->no_of_days,
+ "qty" => $dataRec[0]->qty,
+ "remark" => $dataRec[0]->remark,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function medical_prescribed_Remove($p_med_id,$opd_session_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+
+
+ $sql="select * from opd_prescrption_prescribed
+ where id=$p_med_id";
+ $query = $this->db->query($sql);
+ $dataRec= $query->result();
+
+ if(count($dataRec)>0)
+ {
+ $this->load->model('Doctor_M');
+ $this->Prescription_M->remove_p_medical($p_med_id);
+ }
+
+ $content="";
+
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $data['opd_drug']= $query->result();
+
+ $content=$this->load->view('dashboard/opd_prescription_med_list',$data,TRUE);
+
+ echo $content;
+ }
+
+ public function update_medical()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $medical_remarks=$this->input->post('medical_remarks');
+ $opd_session_id=$this->input->post('opd_session_id');
+ $rec_id=$this->input->post('invACode');
+
+ $sql="select * from opd_prescrption_prescribed
+ where id=".$rec_id." and opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $dataRec= $query->result();
+
+ $content="Nothing Done";
+
+ if(count($dataRec)>0)
+ {
+ $dataupdate = array(
+ 'remark' => $medical_remarks,
+ 'update_by' => $user_name
+ );
+
+
+ $this->Prescription_M->update_p_medical($dataupdate,$rec_id);
+
+ $content="Update Done";
+ }
+
+ echo $content;
+ }
+
+
+ public function remove_medical($p_med_id,$rx_group_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $sql="select * from opd_prescrption_prescribed_template
+ where id=$p_med_id";
+ $query = $this->db->query($sql);
+ $dataRec= $query->result();
+
+ if(count($dataRec)>0)
+ {
+ $this->load->model('Doctor_M');
+ $this->Doctor_M->remove_p_medical($p_med_id);
+ }
+
+ $sql="select * from opd_prescription_template
+ Where id=$rx_group_id";
+ $query = $this->db->query($sql);
+ $data['opd_prescription_template']= $query->result();
+
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed_template pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ Where rx_group_id=$rx_group_id";
+ $query = $this->db->query($sql);
+ $data['opd_prescrption_prescribed_template']= $query->result();
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/rx_group_medicine_list',$data);
+ }
+
+
+ public function opd_prescription_print($opdid,$opd_session_id,$print_type=0)
+ {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="Select * from opd_master where opd_id=$opdid";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pno=$opd_master[0]->p_id;
+
+ $doc_id=0;
+ $no_opd_days=5-1;
+
+ if(count($opd_master)>0){
+
+ $doc_id=$opd_master[0]->doc_id;
+
+ $sql="select d.* ,group_concat(m.SpecName) as SpecName
+ FROM (doctor_master d left JOIN doc_spec s on d.id =s.doc_id)
+ join med_spec m on s.med_spec_id =m.id
+ WHERE d.id=$doc_id ";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ if(count($doctor_master)>0)
+ {
+ $no_opd_days=$doctor_master[0]->opd_valid_no_days-1;
+ }
+ }
+
+ $sql="SELECT o.*,DATE_FORMAT(o.apointment_date,'%d-%m-%Y') as str_apointment_date,
+
+ date_format(date_add(o.apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date,
+ date_format(opd_book_date,'%d-%m-%Y %H:%i') as str_opd_book_date ,
+ (case o.payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str ,
+ d.doc_sign,DATE_FORMAT(o.last_opdvisit_date,'%d-%m-%Y') as str_last_opdvisit_date,
+ d.opd_print_format
+ from opd_master o JOIN doctor_master d ON o.doc_id=d.id where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $data['opd_master']=$opd_master;
+
+ $sql="select * from opd_prescription where opd_id=".$opdid." and id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $opd_prescription= $query->result();
+
+ $sql="select * from opd_prescription_advice where opd_id=".$opdid." and opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $opd_prescription_advice= $query->result();
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$opd_master[0]->apointment_date."') AS str_age,
+ date_format(last_visit,'%d-%m-%Y %H:%i') as last_visit_str
+ from patient_master where id='".$opd_master[0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $pdata= $query->result();
+
+ $sql="Select count(*) as rec_opd from opd_master where p_id=$pno";
+ $query = $this->db->query($sql);
+ $no_opd= $query->result();
+
+ $total_no_visit=$no_opd[0]->rec_opd;
+
+ $data['patient_master']=$pdata;
+ $patient_master=$pdata;
+
+ $total_no_visit=$no_opd[0]->rec_opd+$patient_master[0]->no_of_visit;
+
+ $sql="select *,date_format(date_add(apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date ,
+ date_format(apointment_date,'%d-%m-%Y') as s_opd_date
+ from opd_master where p_id=".$opd_master[0]->p_id." and doc_id=".$opd_master[0]->doc_id."
+ and apointment_date >= date_add(sysdate(),interval -$no_opd_days day) and opd_fee_type<>3";
+ $query = $this->db->query($sql);
+ $old_opd= $query->result();
+
+ $data['old_opd']=$old_opd;
+
+ $sql="select * from hc_insurance where id=".$opd_master[0]->insurance_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ $data['insurance']=$insurance;
+
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$opd_master[0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+
+ $data['case_master']=$case_master;
+ }
+
+ $old_uhid='';
+ if($patient_master[0]->udai<>"")
+ {
+ $old_uhid= ' /'.$patient_master[0]->udai;
+ }
+ $data['old_uhid']=$old_uhid;
+
+ $exp_date="";
+
+ if($opd_master[0]->opd_fee_type=='3'){
+ if(count($old_opd)>0){
+ $exp_date= 'OPD Start Date : '.$old_opd[0]->s_opd_date.' Valid Upto :'.$old_opd[0]->opd_Exp_Date.' ';
+ }
+ }else{
+ $exp_date="Valid Upto : ".$opd_master[0]->opd_Exp_Date ."";
+ }
+
+ $last_opdvisit_date="";
+
+ if($opd_master[0]->last_opdvisit_date=='')
+ {
+ if($patient_master[0]->last_visit=='')
+ {
+ $last_opdvisit_date="";
+ }else{
+ $last_opdvisit_date=' Last Visit :'.$patient_master[0]->last_visit_str;
+ }
+
+
+ }else{
+ $last_opdvisit_date=' Last Visit :'.$opd_master[0]->str_last_opdvisit_date;
+ }
+
+ $sql="SELECT group_concat(m.short_name) AS m_name
+ FROM morbidities_master m JOIN patient_morbidities c ON m.mor_id=c.morbidities AND c.p_id=".$pno;
+ $query = $this->db->query($sql);
+ $patient_morbidities= $query->result();
+
+ $data['morbidities']="";
+
+ if($patient_morbidities[0]->m_name<>'')
+ {
+ $data['morbidities']=$patient_morbidities[0]->m_name;
+ }
+
+ $data['Complication']='';
+ if($opd_prescription[0]->pregnancy==1)
+ {
+ $data['Complication'].='Pregnancy,';
+ }
+
+ if($opd_prescription[0]->lactation==1)
+ {
+ $data['Complication'].='Lactation,';
+ }
+
+ if($opd_prescription[0]->liver_insufficiency==1)
+ {
+ $data['Complication'].='Liver insufficiency,';
+ }
+
+ if($opd_prescription[0]->renal_insufficiency==1)
+ {
+ $data['Complication'].='Renal Insufficiency,';
+ }
+
+ if($opd_prescription[0]->pulmonary_insufficiency==1)
+ {
+ $data['Complication'].='Pulmonary Insufficiency,';
+ }
+
+ if($opd_prescription[0]->corona_suspected==1)
+ {
+ $data['Complication'].='Corona Suspected,';
+ }
+
+ if($opd_prescription[0]->dengue==1)
+ {
+ $data['Complication'].='Dengue,';
+ }
+
+ $data['Addiction']='';
+
+ if($patient_master[0]->is_smoking==1)
+ {
+ $data['Addiction'].='Smoking,';
+ }
+
+ if($patient_master[0]->is_alcohol==1)
+ {
+ $data['Addiction'].='Alcoholic,';
+ }
+
+ if($patient_master[0]->is_drug_abuse==1)
+ {
+ $data['Addiction'].='Drug Abuse,';
+ }
+
+
+
+ $data['exp_date']=$exp_date;
+ $data['last_opdvisit_date']=$last_opdvisit_date;
+
+ $data['doc_name']='Dr. '.$opd_master[0]->doc_name;
+ $data['doc_sign']=nl2br($opd_master[0]->doc_sign);
+ $data['SpecName']=$doctor_master[0]->SpecName;
+
+
+ $data['pName']=$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname) ;
+ $data['pRelative']=$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname) ;
+ $data['age_sex']=$patient_master[0]->str_age.' / '.$patient_master[0]->xgender;
+ $data['opd_no']=$opd_master[0]->opd_code;
+ $data['opd_date']=$opd_master[0]->str_apointment_date;
+
+ $data['opd_fee']= 'Rs.'.$opd_master[0]->opd_fee_amount .' '.$opd_master[0]->opd_fee_desc ;
+ $data['opd_fee_desc']= $opd_master[0]->opd_fee_desc ;
+
+ $data['opd_sr_no']=$opd_master[0]->opd_no;
+
+ $data['str_opd_book_date']=$opd_master[0]->str_opd_book_date;
+
+
+ $data['short_info']='Sr No.: '.$opd_master[0]->opd_no .'
+ OPD Fee : Rs.'.$opd_master[0]->opd_fee_amount .' '.$opd_master[0]->opd_fee_desc .'
+ UHID : '.$patient_master[0]->p_code.'
+ P Add. :'.$patient_master[0]->add1.','.$patient_master[0]->city.'';
+
+ $data['short_info_1']='Sr No.: '.$opd_master[0]->opd_no .'
+ / OPD Fee : Rs.'.$opd_master[0]->opd_fee_amount .' '.$opd_master[0]->opd_fee_desc .' /
+ UHID : '.$patient_master[0]->p_code.' / No. of Visit : '.$total_no_visit.' '.$last_opdvisit_date;
+
+ $data['uhid_no']=$patient_master[0]->p_code;
+ $data['phoneno']=$patient_master[0]->mphone1;
+ $data['p_address']=$patient_master[0]->add1.','.$patient_master[0]->city.'';
+ $data['total_no_visit']=$total_no_visit;
+ $data['exp_date']=$exp_date;
+
+ $data['opd_book_date']=$opd_master[0]->opd_book_date;
+ $sql="SELECT pt.* ,d.dose_show_sign AS dose_shed,d.dose_show_desc AS dose_shed_hindi,
+ dw.dose_sign_desc AS dose_when,dw.dose_sign_hindi AS dose_when_hindi,
+ df.dose_sign_desc AS dose_frequency,df.dose_sign_hindi AS dose_frequency_hindi,
+ d_on.dose_sign_desc AS dose_where,d_on.dose_sign_hindi AS dose_where_hindi,
+ m.genericname
+ FROM ((((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id)
+ LEFT JOIN opd_med_master m ON pt.med_id =m.id
+ where opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $opd_p_prescribed= $query->result();
+
+ $top_content="";
+ $barContent="";
+
+ $top_content.="
OPD No.:".$opd_master[0]->opd_code." / Date : ".$opd_master[0]->str_apointment_date."
";
+ $top_content.="Patient ID :".$pdata[0]->p_code."
+ Patient Name : ".$pdata[0]->p_fname."
+ Gender: ".$pdata[0]->xgender."
+ Age:".$pdata[0]->str_age."
";
+
+ $barContent.="OPD No:".$opd_master[0]->opd_code. PHP_EOL ."OD:".$opd_master[0]->str_apointment_date. PHP_EOL ."Doc.:".$opd_master[0]->doc_name."[".$opd_master[0]->doc_spec."]". PHP_EOL ;
+ $barContent.="PID:".$pdata[0]->p_code. PHP_EOL ."PN:".$pdata[0]->p_fname."/".$pdata[0]->xgender."/A:".$pdata[0]->str_age. PHP_EOL;
+
+ $vital_content="";
+
+ if($opd_prescription[0]->pulse<>'')
+ {
+ $vital_content.=" Pulse : ".$opd_prescription[0]->pulse." bpm";
+ }
+
+ if($opd_prescription[0]->diastolic<>'')
+ {
+
+ if($opd_prescription[0]->bp<>'')
+ {
+ $vital_content.=" BP : ".$opd_prescription[0]->bp;
+ }
+
+ $vital_content.="/".$opd_prescription[0]->diastolic;
+
+ $vital_content.=" mmHg";
+ }
+
+ if($opd_prescription[0]->spo2<>'')
+ {
+ $vital_content.=" / SpO2: ".$opd_prescription[0]->spo2." %";
+ }
+
+ if($opd_prescription[0]->temp<>'')
+ {
+ $vital_content.=" / Temp: ".$opd_prescription[0]->temp." F";
+ }
+
+
+ if($opd_prescription[0]->weight<>'')
+ {
+ $vital_content.=" / Weight : ".$opd_prescription[0]->weight." KG";
+ }
+
+ if($opd_prescription[0]->height<>'')
+ {
+ $vital_content.=" / Height : ".$opd_prescription[0]->height." cm";
+ }
+
+ $vital_content="".$vital_content."
";
+
+ $Complaint="";
+
+ if($opd_prescription[0]->complaints!='')
+ {
+ $Complaint="Complaint : ";
+ $Complaint.=''.nl2br(trim(trim($opd_prescription[0]->complaints),",")).' ';
+ }
+
+ $painscale="";
+
+ if($opd_prescription[0]->pain_value>0)
+ {
+ $painscale="Pain Scale : ";
+ $pain_value=$opd_prescription[0]->pain_value;
+ if($pain_value==1){
+ $painscale.='Mild Pain';
+ }elseif($pain_value==2){
+ $painscale.='Moderate';
+ }elseif($pain_value==3){
+ $painscale.='Intence';
+ }elseif($pain_value==4){
+ $painscale.='Worst Pain Possible';
+ }
+ }
+
+
+ $data['painscale_img']=' ';
+ if($opd_prescription[0]->pain_value>=0)
+ {
+ $data['painscale_img']=' ';
+ }
+
+ $Provisional_diagnosis="";
+
+ if($opd_prescription[0]->Provisional_diagnosis!='')
+ {
+ $Provisional_diagnosis="Provisional Diagnosis : ";
+ $Provisional_diagnosis.=' '.nl2br(trim(trim($opd_prescription[0]->Provisional_diagnosis),",")).' ';
+
+ }
+
+ $diagnosis="";
+
+ if($opd_prescription[0]->diagnosis!='')
+ {
+ $diagnosis="Diagnosis : ";
+ $diagnosis.=' '.nl2br(trim(trim($opd_prescription[0]->diagnosis),",")).' ';
+
+ }
+
+ $investigation="";
+ if($opd_prescription[0]->investigation!='')
+ {
+ $investigation="Investigation Advised : ";
+ $investigation.=' '.nl2br(trim(trim($opd_prescription[0]->investigation),",")).' ';
+ }
+
+
+ $Finding_Examinations="";
+
+ if($opd_prescription[0]->Finding_Examinations!='')
+ {
+ $Finding_Examinations="Findings : ";
+ $Finding_Examinations.=' '.nl2br(trim(trim($opd_prescription[0]->Finding_Examinations),",")).' ';
+
+ }
+
+ $Prescriber_Remarks="";
+
+ if($opd_prescription[0]->Prescriber_Remarks!='')
+ {
+ $Prescriber_Remarks="Prescriber Diagnosis : ";
+ $Prescriber_Remarks.=' '.nl2br(trim(trim($opd_prescription[0]->Prescriber_Remarks),",")).' ';
+
+ }
+
+
+ $advice="";
+
+ if(($opd_prescription[0]->advice!='') || count($opd_prescription_advice)>0)
+ {
+ $advice="Advice : ";
+ }
+
+ if($opd_prescription[0]->advice!='')
+ {
+ $advice.=''.nl2br($opd_prescription[0]->advice).' ';
+ }
+
+ foreach($opd_prescription_advice as $row){
+ $advice.=''.$row->advice_txt_hindi.' ';
+ }
+
+ $next_visit="";
+
+ if($opd_prescription[0]->next_visit!='')
+ {
+ $next_visit="Next Visit : ";
+ $next_visit.=''.$opd_prescription[0]->next_visit.' ';
+ }
+
+ $refer_to="";
+
+ if($opd_prescription[0]->refer_to!='')
+ {
+ $refer_to="Refer To : ";
+ $refer_to.=''.$opd_prescription[0]->refer_to.' ';
+ }
+
+ $medical='';
+ $sr_no=1;
+ if(count($opd_p_prescribed)>0)
+ {
+ $medical="Rx : ";
+ $medical.= '
+
+
+ Medicine Name
+ Dosage
+ Qty
+ Day
+ ';
+
+ foreach($opd_p_prescribed as $row)
+ {
+ $medical_extend="";
+
+ $medical.='
+ '.$sr_no.' - '.$row->med_type.' '.$row->med_name.'
+ '.$row->dose_shed.' / '.$row->dose_shed_hindi.' '.$row->dose_when_hindi.' '.$row->dose_frequency_hindi.'
+ '.$row->qty.'
+ '.$row->no_of_days.'
+ ';
+ $medical.='
+ ';
+ if(strlen($row->genericname)>0 || strlen($row->remark)>0 || strlen($row->dose_shed_hindi)>0)
+ {
+ if(strlen($row->genericname)>1)
+ {
+ $medical.='Composition : '.$row->genericname.'
';
+ }
+
+ if(strlen($row->remark)>0)
+ {
+ $medical.='Notes : '.$row->remark.'
';
+ }
+ }
+
+ $medical.='
+ ';
+
+ $sr_no=$sr_no+1;
+
+ }
+ $medical.="
";
+ }
+
+
+ $doctor="";
+ $doctor.='Dr. '.$opd_master[0]->doc_name.' ['.$opd_master[0]->doc_spec.']
';
+
+ $data['Complaint']= trim(trim($Complaint),",") ;
+ $data['diagnosis']= trim(trim($diagnosis),",");
+ $data['Provisional_diagnosis']= trim(trim($Provisional_diagnosis),",");
+ $data['investigation']= trim(trim($investigation),",");
+ $data['medical']= trim(trim($medical),",");
+ $data['doctor']= trim(trim($doctor),",");
+ $data['top_content']= trim(trim($top_content),",");
+ $data['vital_content']= trim(trim($vital_content),",");
+
+ $data['Finding_Examinations']= trim(trim($Finding_Examinations),",");
+ $data['Prescriber_Remarks']= trim(trim($Prescriber_Remarks),",");
+
+ $data['advice']= trim(trim($advice),",");
+ $data['next_visit']= trim(trim($next_visit),",");
+ $data['refer_to']= trim(trim($refer_to),",");
+
+ $data['painscale']=$painscale;
+
+
+ $this->load->library('M_pdf');
+
+ $file_name='Prescription-Rx-'.$opd_master[0]->opd_code."-".date('Ymdhis').".pdf";
+
+ //$filepath=$folder_name.'/'.$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+
+ if($print_type==0)
+ {
+ $print_format=$doctor_master[0]->rx_plain_paper;
+ $content=$this->load->view('/dashboard/'.$print_format,$data,TRUE);
+ }elseif($print_type==1){
+ $print_format=$doctor_master[0]->rx_blank_letter_head;
+ $content=$this->load->view('/dashboard/'.$print_format,$data,TRUE);
+ }else{
+ $print_format=$doctor_master[0]->rx_pre_print_letter_head_format;
+ $content=$this->load->view('/dashboard/'.$print_format,$data,TRUE);
+ }
+
+ // OPD Visit Done
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.':T-'.date('d-m-Y h:m:s');
+
+ $status_str='Visit Done : Auto';
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => 2,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+
+ // OPD Visit Done End Here
+
+ $this->m_pdf->pdf->shrink_tables_to_fit = 1;
+ //echo $content;
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($file_name,"I");
+
+ }
+
+ public function upload_video()
+ {
+ $folder_name='uploads/opdvideo/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+
+ if(isset($_FILES["audiovideo"])){
+ // Define a name for the file
+ $fileName = "myaudiovideo.webm";
+
+ // In this case the current directory of the PHP script
+ $uploadDirectory = $folder_name.'/'. $fileName;
+
+ // Move the file to your server
+ if (!move_uploaded_file($_FILES["audiovideo"]["tmp_name"], $uploadDirectory)) {
+ echo("Couldn't upload video !");
+ }
+ else{
+ echo("File Moved");
+ }
+ }
+ elseif(isset($_FILES["audio"])){
+ // Define a name for the file
+ $fileName = "myaudio.webm";
+
+ // In this case the current directory of the PHP script
+ $uploadDirectory = $folder_name.'/'. $fileName;
+
+ // Move the file to your server
+ if (!move_uploaded_file($_FILES["audio"]["tmp_name"], $uploadDirectory)) {
+ echo("Couldn't upload video !");
+ }
+ else{
+ echo("File Moved");
+ }
+ }
+ elseif(isset($_FILES["video"])){
+ // Define a name for the file
+ $fileName = "myvideo.webm";
+
+ // In this case the current directory of the PHP script
+ $uploadDirectory = $folder_name.'/'. $fileName;
+
+ // Move the file to your server
+ if (!move_uploaded_file($_FILES["video"]["tmp_name"], $uploadDirectory)) {
+ echo("Couldn't upload video !");
+ }
+ else{
+ echo("File Moved");
+ }
+ }
+ elseif(isset($_FILES["stream"])){
+ // Define a name for the file
+ $fileName = $_POST["name"];
+ $file_number = $_POST["file_number"];
+ $opd_id=$_POST["opd_id"];
+ $file_name_id=$_POST["file_name_id"];
+
+ $folder_name=$folder_name.'/'.$opd_id;
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+ // In this case the current directory of the PHP script
+ $uploadDirectory = $folder_name.'/'. $fileName.'.webm';
+
+ // Move the file to your server
+ if (!move_uploaded_file($_FILES["stream"]["tmp_name"], $uploadDirectory)) {
+ echo("Couldn't upload video !");
+ }
+ else{
+ //update last file
+ $last_file_number=$file_number-1;
+ $strFile2 = $folder_name.'/'."Main_video_".$file_number.'.webm';
+ $strFile1 = $folder_name.'/'."Main_video_".$last_file_number.'.webm';
+
+ $final_file=$folder_name.'/'.$file_name_id.'_'.$file_number.'.webm';
+
+ $last_final_file=$folder_name.'/'.$file_name_id.'_'.$last_file_number.'.webm';
+
+ if($last_file_number>0)
+ {
+ $last_final_file=$folder_name.'/'.$file_name_id.'_'.$last_file_number.'.webm';
+ }
+
+ $chk_file=file_exists($last_final_file);
+ if($chk_file==1)
+ {
+ //First File
+ $objFH = fopen( $last_final_file, "rb" );
+ $strBuffer1 = fread( $objFH, filesize( $last_final_file) );
+ fclose( $objFH );
+
+ //Second File
+ $objFH = fopen( $strFile2, "rb" );
+ $strBuffer2 = fread( $objFH, filesize( $strFile2) );
+ fclose( $objFH );
+
+ // manipulate buffers here...
+ $strBuffer3 = $strBuffer1 . $strBuffer2;
+
+ // open for write/binary-safe
+ $objFH = fopen( $final_file, "wb" );
+ fwrite( $objFH, $strBuffer3 );
+ fclose( $objFH );
+
+ unlink($last_final_file);
+ unlink($strFile2);
+ //unlink($strFile1);
+ }else{
+
+ //Second File
+ $objFH = fopen( $strFile2, "rb" );
+ $strBuffer2 = fread( $objFH, filesize( $strFile2) );
+ fclose($objFH);
+
+ // manipulate buffers here...
+ $strBuffer3 = $strBuffer2;
+
+ // open for write/binary-safe
+ $objFH = fopen( $final_file, "wb" );
+ fwrite( $objFH, $strBuffer3 );
+ fclose( $objFH );
+
+ echo 'File Not Found';
+ unlink($strFile2);
+ }
+
+ $data_upload = array(
+ 'opd_id' => $opd_id,
+ 'full_path' => $final_file,
+ );
+
+ $this->load->model('FileOPDRec_M');
+
+ $this->FileOPDRec_M->insert($data_upload,$file_name_id);
+
+ echo("Success");
+
+
+ }
+ }
+ else{
+ echo "No file uploaded";
+ }
+ }
+
+ //Suggest Panel
+
+ function new_rx_group($doc_id=0)
+ {
+ $data['doc_id']=$doc_id;
+ $this->load->view('dashboard/opd_prescription_suggest_panel/rx_group_new',$data);
+ }
+
+ function rx_group($opd_id,$doc_id)
+ {
+ $data['opd_id']=$opd_id;
+ $data['doc_id']=$doc_id;
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/rx_group_save',$data);
+ }
+
+ function rx_group_select($rx_group_id)
+ {
+ $opd_session_id = $this->input->post('opd_session_id');
+ $rx_group_id=$this->input->post('rx_group_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']'.date('d-m-Y H:i:s');
+
+
+
+ $sql="select * from opd_prescrption_prescribed_template
+ Where rx_group_id=$rx_group_id";
+ $query = $this->db->query($sql);
+ $prescrption_prescribed= $query->result();
+
+ if(count($prescrption_prescribed)>0 && $rx_group_id>0)
+ {
+ foreach($prescrption_prescribed as $row)
+ {
+ $prescrption_prescribed_data=array(
+ 'opd_pre_id' => $opd_session_id,
+ 'med_id' => $row->med_id,
+ 'med_name' => $row->med_name,
+ 'med_type' => $row->med_type,
+ 'dosage' => $row->dosage,
+ 'dosage_when' => $row->dosage_when,
+ 'dosage_freq' => $row->dosage_freq,
+ 'qty' => $row->qty,
+ 'no_of_days' => $row->no_of_days,
+ 'remark' => $row->remark,
+ 'update_by' => $user_name,
+ );
+
+ $this->Prescription_M->insert_p_medical($prescrption_prescribed_data);
+
+ }
+ }
+
+ $content="";
+
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $data['opd_drug']= $query->result();
+
+ $content=$this->load->view('dashboard/opd_prescription_med_list',$data,TRUE);
+
+ echo $content;
+ }
+
+ function add_medicince_opd($opd_pre_prescribed_id,$opd_session_id)
+ {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']'.date('d-m-Y H:i:s');
+
+
+
+ $sql="select * from opd_prescrption_prescribed
+ Where id=$opd_pre_prescribed_id";
+ $query = $this->db->query($sql);
+ $prescrption_prescribed= $query->result();
+
+ foreach($prescrption_prescribed as $row)
+ {
+ $prescrption_prescribed_data=array(
+ 'opd_pre_id' => $opd_session_id,
+ 'med_id' => $row->med_id,
+ 'med_name' => $row->med_name,
+ 'med_type' => $row->med_type,
+ 'dosage' => $row->dosage,
+ 'dosage_when' => $row->dosage_when,
+ 'dosage_freq' => $row->dosage_freq,
+ 'dosage_where' => $row->dosage_where,
+ 'qty' => $row->qty,
+ 'no_of_days' => $row->no_of_days,
+ 'remark' => $row->remark,
+ 'update_by' => $user_name,
+ );
+
+ $this->Prescription_M->insert_p_medical($prescrption_prescribed_data);
+
+ }
+
+ $content="";
+
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $data['opd_drug']= $query->result();
+
+ $content=$this->load->view('dashboard/opd_prescription_med_list',$data,TRUE);
+
+ echo $content;
+ }
+
+ function add_medicine_opd_all($current_opd_id,$opd_session_id)
+ {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']'.date('d-m-Y H:i:s');
+
+
+
+ $sql="select * from opd_prescrption_prescribed
+ Where opd_pre_id=$opd_session_id";
+ $query = $this->db->query($sql);
+ $prescrption_prescribed= $query->result();
+
+ if(count($prescrption_prescribed)>0)
+ {
+ foreach($prescrption_prescribed as $row)
+ {
+ $prescrption_prescribed_data=array(
+ 'opd_pre_id' => $current_opd_id,
+ 'med_id' => $row->med_id,
+ 'med_name' => $row->med_name,
+ 'med_type' => $row->med_type,
+ 'dosage' => $row->dosage,
+ 'dosage_when' => $row->dosage_when,
+ 'dosage_freq' => $row->dosage_freq,
+ 'qty' => $row->qty,
+ 'no_of_days' => $row->no_of_days,
+ 'remark' => $row->remark,
+ 'update_by' => $user_name,
+ );
+
+ $this->Prescription_M->insert_p_medical($prescrption_prescribed_data);
+
+ }
+ }
+
+ $content="";
+
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.opd_pre_id=".$opd_session_id;
+ $query = $this->db->query($sql);
+ $data['opd_drug']= $query->result();
+
+ $content=$this->load->view('dashboard/opd_prescription_med_list',$data,TRUE);
+
+ echo $content;
+ }
+
+
+
+ function save_rx_group_list($doc_id=0)
+ {
+ $sql="SELECT p.*,group_concat(m.med_name SEPARATOR ' ' ) AS med_name_list
+ from opd_prescription_template p LEFT JOIN opd_prescrption_prescribed_template m
+ ON p.id=m.rx_group_id
+ WHERE p.doc_id=$doc_id or p.doc_id=0
+ GROUP BY p.id";
+ $query = $this->db->query($sql);
+ $data['rx_group_list']= $query->result();
+
+ $data['Color']=array(
+ 'bg-primary text-white',
+ 'bg-secondary text-white',
+ 'bg-success text-white',
+ 'bg-danger text-white',
+ 'bg-warning text-dark',
+ 'bg-info text-white',
+ 'bg-light text-dark',
+ 'bg-dark text-white',
+ 'bg-white text-dark',
+ );
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/rx_group_list',$data);
+ }
+
+ function save_rx_group_show($rx_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select * from opd_prescription_template where id=$rx_id";
+ $query = $this->db->query($sql);
+ $rx_master= $query->result();
+
+ $sql="select * from opd_prescrption_prescribed_template where rx_group_id=$rx_id";
+ $query = $this->db->query($sql);
+ $rx_prescribed= $query->result();
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/opd_prev',$data);
+
+ }
+
+
+ function update_opd_queue($opd_session_id)
+ {
+ $sql="select * from opd_prescription where id=$opd_session_id";
+ $query = $this->db->query($sql);
+ $opd_prescription= $query->result();
+
+ if(count($opd_prescription)>0){
+ $doc_id=$opd_prescription[0]->doc_id;
+ $date_opd_visit=$opd_prescription[0]->date_opd_visit;
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update_opd_queue_no($opd_session_id,$doc_id,$date_opd_visit);
+ }
+
+ echo 'Queue Update';
+
+ }
+
+ function rx_group_panel()
+ {
+ $sql="select * from opd_prescription_template order by rx_group_name";
+ $query = $this->db->query($sql);
+ $data['rx_master']= $query->result();
+
+ $this->load->view('dashboard/rx_group',$data);
+
+ }
+
+
+ function rx_group_list()
+ {
+ $sql="select * from opd_prescription_template order by rx_group_name";
+ $query = $this->db->query($sql);
+ $data['rx_master']= $query->result();
+
+ $this->load->view('dashboard/rx_group_list',$data);
+
+ }
+
+ function save_rx_group_edit($rx_id)
+ {
+
+ $sql="select * from opd_prescription_template where id=$rx_id";
+ $query = $this->db->query($sql);
+ $data['rx_master']= $query->result();
+
+ $sql="select * from opd_prescrption_prescribed_template where rx_group_id=$rx_id";
+ $query = $this->db->query($sql);
+ $data['rx_prescribed']= $query->result();
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/rx_group_show',$data);
+
+ }
+
+
+
+ function save_rx_group_from_opd_prescription()
+ {
+ $opd_id = $this->input->post('opd_session_id');
+ $rx_group_name=$this->input->post('rx_group_name');
+ $doc_id=$this->input->post('doc_id');
+
+ $this->load->model('Doctor_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $sql="select * from opd_prescription
+ Where id=$opd_id";
+ $query = $this->db->query($sql);
+ $opd_prescription= $query->result();
+
+ echo $sql;
+
+ $rx_group_id=0;
+
+ if(count($opd_prescription)>0)
+ {
+ $opd_prescription_data=array(
+ 'rx_group_name' => $rx_group_name,
+ 'doc_id' => $doc_id,
+ 'update_by' => $user_name,
+ 'Finding_Examinations' => $opd_prescription[0]->Finding_Examinations,
+ 'Prescriber_Remarks' => $opd_prescription[0]->Prescriber_Remarks,
+ 'complaints' => $opd_prescription[0]->complaints,
+ 'diagnosis' => $opd_prescription[0]->diagnosis,
+ 'investigation' => $opd_prescription[0]->investigation,
+ );
+
+ $opd_pre_id=$opd_prescription[0]->id;
+
+ $rx_group_id=$this->Doctor_M->insert_opd_prescription_template($opd_prescription_data);
+
+ $sql="select * from opd_prescrption_prescribed
+ Where opd_pre_id=$opd_pre_id";
+ $query = $this->db->query($sql);
+ $prescrption_prescribed= $query->result();
+
+ if(count($prescrption_prescribed)>0 && $rx_group_id>0)
+ {
+ foreach($prescrption_prescribed as $row)
+ {
+ $prescrption_prescribed_data=array(
+ 'rx_group_id' => $rx_group_id,
+ 'med_id' => $row->med_id,
+ 'med_name' => $row->med_name,
+ 'med_type' => $row->med_type,
+ 'dosage' => $row->dosage,
+ 'dosage_when' => $row->dosage_when,
+ 'dosage_freq' => $row->dosage_freq,
+ 'qty' => $row->qty,
+ 'no_of_days' => $row->no_of_days,
+ 'remark' => $row->remark,
+ 'update_by' => $user_name,
+ );
+
+ $rx_group_sub=$this->Doctor_M->insert_opd_prescrption_prescribed_template($prescrption_prescribed_data);
+ }
+ }
+ }
+
+ echo $rx_group_id;
+ }
+
+ function save_rx_group()
+ {
+ $rx_group_name = $this->input->post('input_rx_group_name');
+ $complaints=$this->input->post('input_complaints');
+ $diagnosis=$this->input->post('input_diagnosis');
+ $investigation=$this->input->post('input_investigation');
+ $Finding_Examinations=$this->input->post('input_Finding_Examinations');
+ $id=$this->input->post('hid_rx_id');
+
+ $this->load->model('Doctor_M');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $opd_prescription_data=array(
+ 'rx_group_name' => $rx_group_name,
+ 'update_by' => $user_name,
+ 'Finding_Examinations' => $Finding_Examinations,
+ 'complaints' => $complaints,
+ 'diagnosis' => $diagnosis,
+ 'investigation' => $investigation,
+ );
+
+ if($id>0)
+ {
+ $this->Doctor_M->update_opd_prescription_template($opd_prescription_data,$id);
+ $rx_group_id=$id;
+ $show_text="Data Saved";
+ }else{
+ $rx_group_id=$this->Doctor_M->insert_opd_prescription_template($opd_prescription_data);
+ $show_text="Data Added";
+ }
+
+ $rvar=array(
+ 'insertid' =>$rx_group_id,
+ 'show_text'=>$show_text
+ );
+
+
+ echo json_encode($rvar);
+
+ }
+
+ function rx_group_medicine($rx_group_id)
+ {
+ $sql="select * from opd_prescription_template
+ Where id=$rx_group_id";
+ $query = $this->db->query($sql);
+ $data['opd_prescription_template']= $query->result();
+
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed_template pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ Where rx_group_id=$rx_group_id";
+ $query = $this->db->query($sql);
+ $data['opd_prescrption_prescribed_template']= $query->result();
+
+ $sql="select * from opd_dose_shed ";
+ $query = $this->db->query($sql);
+ $data['opd_dose_shed']= $query->result();
+
+ $sql="select * from opd_dose_when";
+ $query = $this->db->query($sql);
+ $data['opd_dose_when']= $query->result();
+
+ $sql="select * from opd_dose_frequency";
+ $query = $this->db->query($sql);
+ $data['opd_dose_frequency']= $query->result();
+
+ $sql="select * from opd_dose_where";
+ $query = $this->db->query($sql);
+ $data['opd_dose_where']= $query->result();
+
+ $data['rx_group_id']=$rx_group_id;
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/rx_group_medicine',$data);
+
+ }
+
+
+ function rx_opd_medicine()
+ {
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_med_master pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ Order by pt.item_name";
+ $query = $this->db->query($sql);
+ $data['opd_med_master']= $query->result();
+
+ $sql="select * from opd_dose_shed ";
+ $query = $this->db->query($sql);
+ $data['opd_dose_shed']= $query->result();
+
+ $sql="select * from opd_dose_when";
+ $query = $this->db->query($sql);
+ $data['opd_dose_when']= $query->result();
+
+ $sql="select * from opd_dose_frequency";
+ $query = $this->db->query($sql);
+ $data['opd_dose_frequency']= $query->result();
+
+ $sql="select * from opd_dose_where";
+ $query = $this->db->query($sql);
+ $data['opd_dose_where']= $query->result();
+
+
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/opd_medicine_panel',$data);
+
+ }
+
+
+ function rx_group_medicine_save($rx_group_id)
+ {
+ $this->load->model('Doctor_M');
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $med_name = $this->input->post('input_med_name');
+ $med_type=$this->input->post('input_med_type');
+ $dosage=$this->input->post('input_dosage');
+ $dosage_when=$this->input->post('input_dosage_when');
+ $dosage_freq=$this->input->post('input_dosage_freq');
+ $no_of_days=$this->input->post('input_no_of_days');
+ $qty=$this->input->post('input_qty');
+ $remark=$this->input->post('input_remark');
+ $med_id=$this->input->post('hid_med_id');
+ $dosage_where=$this->input->post('input_dose_where');
+ $genericname=$this->input->post('input_genericname');
+
+ $rx_group_id=$rx_group_id;
+ $hid_p_med_id=$this->input->post('hid_p_med_id');
+
+ $insert_master = array(
+ 'item_name' => $med_name,
+ 'formulation' => $med_type,
+ 'dosage' => $dosage,
+ 'dosage_when' => $dosage_when,
+ 'dosage_freq' => $dosage_freq,
+ 'dosage_where' => $dosage_where,
+ 'genericname' => $genericname,
+ 'qty' => $qty,
+ 'no_of_days' => $no_of_days,
+ 'remark' => $remark,
+ 'genericname' => $genericname
+ );
+
+ if($med_id==0)
+ {
+ $med_id=$this->Prescription_M->insert_med_master($insert_master);
+ }else{
+ $update_master = array(
+ 'dosage' => $dosage,
+ 'dosage_when' => $dosage_when,
+ 'dosage_freq' => $dosage_freq,
+ 'dosage_where' => $dosage_where,
+ 'qty' => $qty,
+ 'no_of_days' => $no_of_days,
+ 'remark' => $remark,
+ 'genericname' => $genericname
+ );
+
+ $this->Prescription_M->update_med_master($update_master,$med_id);
+ }
+
+ $prescrption_prescribed_data=array(
+ 'rx_group_id' => $rx_group_id,
+ 'med_id' => $med_id,
+ 'med_name' => $med_name,
+ 'med_type' => $med_type,
+ 'dosage' => $dosage,
+ 'dosage_when' => $dosage_when,
+ 'dosage_freq' => $dosage_freq,
+ 'qty' => $qty,
+ 'no_of_days' => $no_of_days,
+ 'remark' => $remark,
+ 'dosage_where'=>$dosage_where,
+ 'update_by' => $user_name,
+ );
+
+ if($hid_p_med_id>0)
+ {
+ $rx_group_id_INSERT=$this->Doctor_M->update_opd_prescrption_prescribed_template($prescrption_prescribed_data,$hid_p_med_id);
+ $show_text="Data Update";
+ }else{
+ $rx_group_id_INSERT=$this->Doctor_M->insert_opd_prescrption_prescribed_template($prescrption_prescribed_data);
+ $show_text="Data Added";
+ }
+
+ $sql="select * from opd_prescrption_prescribed_template
+ Where id=$rx_group_id";
+ $query = $this->db->query($sql);
+ $data['prescrption_prescribed']= $query->result();
+
+ $sql="SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed_template pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ Where rx_group_id=$rx_group_id";
+ $query = $this->db->query($sql);
+ $data['opd_prescrption_prescribed_template']= $query->result();
+
+ $this->load->view('dashboard/opd_prescription_suggest_panel/rx_group_medicine_list',$data);
+
+ }
+
+
+ public function medical_Select_prescription_template()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $p_med_id=$this->input->post('p_med_id');
+
+ $sql="select * from opd_prescrption_prescribed_template
+ where id=$p_med_id";
+ $query = $this->db->query($sql);
+ $prescribed_template= $query->result();
+
+ $rvar=array(
+ "med_id" => $prescribed_template[0]->med_id,
+ "med_name" => $prescribed_template[0]->med_name,
+ "med_type" => $prescribed_template[0]->med_type,
+ "dosage" => $prescribed_template[0]->dosage,
+ "dosage_when" => $prescribed_template[0]->dosage_when,
+ "dosage_freq" => $prescribed_template[0]->dosage_freq,
+ "qty" => $prescribed_template[0]->qty,
+ "no_of_days" => $prescribed_template[0]->no_of_days,
+ "remark" => $prescribed_template[0]->remark,
+ "p_med_id"=>$p_med_id,
+ 'genericname'=>$prescribed_template[0]->genericname,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ function patient_glucose_data($p_id)
+ {
+ $sql="Select p.id,Date_Format(p.test_datetime,'%d-%m-%Y') AS test_date,
+ if(p.test_type=0,p.test_value,'') AS r_sugar,
+ if(p.test_type=1,p.test_value,'') AS f_sugar,
+ if(p.test_type=2,p.test_value,'') AS a_sugar
+ from patient_glucose_chart p
+ where p.p_id=$p_id order by p.test_datetime desc";
+ $query = $this->db->query($sql);
+ $data['patient_glucose_data']= $query->result();
+
+ $data['p_id']=$p_id;
+
+ $this->load->view('dashboard/patient_glucose_data',$data);
+ }
+
+ function add_glucose_value($p_id)
+ {
+
+
+ $patient_glucose_data=array(
+ 'p_id' => $p_id,
+ 'test_datetime'=> str_to_MysqlDate($this->input->post('datepicker_dot')),
+ 'test_value' => $this->input->post('input_glucose_value'),
+ 'test_type' => $this->input->post('input_test_type'),
+ );
+
+ $rx_group_id_INSERT=$this->Prescription_M->insert_patient_glucose_chart($patient_glucose_data);
+
+ $send_error=validation_errors();
+ $rvar=array(
+ 'insertid' =>$rx_group_id_INSERT,
+ 'msg'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ function patient_glucose_data_del($p_id,$g_id)
+ {
+
+ $this->Prescription_M->remove_patient_glucose_chart($g_id);
+
+ $sql="Select p.id,Date_Format(p.test_datetime,'%d-%m-%Y') AS test_date,
+ if(p.test_type=0,p.test_value,'') AS r_sugar,
+ if(p.test_type=1,p.test_value,'') AS f_sugar,
+ if(p.test_type=2,p.test_value,'') AS a_sugar
+ from patient_glucose_chart p
+ where p.p_id=$p_id order by p.test_datetime desc";
+ $query = $this->db->query($sql);
+ $data['patient_glucose_data']= $query->result();
+
+ $data['p_id']=$p_id;
+
+ $content=$this->load->view('dashboard/patient_glucose_data',$data,true);
+
+ echo $content;
+ }
+
+ function patient_investigation_data($p_id)
+ {
+ $sql="Select p.*
+ from patient_investigation p
+ where p.p_id=$p_id order by p.date_investigation desc";
+ $query = $this->db->query($sql);
+ $data['patient_investigation_data']= $query->result();
+
+ $data['p_id']=$p_id;
+
+ $this->load->view('dashboard/patient_investigation',$data);
+ }
+
+ function add_investigation_value($p_id)
+ {
+
+
+ $normal_range='';
+ $isbold='';
+ $out_range='';
+
+ $patient_investigation_data=array(
+ 'p_id' => $p_id,
+ 'date_investigation'=> str_to_MysqlDate($this->input->post('datepicker_investigation')),
+ 'investigation_id' => $this->input->post('input_investigation_ID'),
+ 'investigation_name' => $this->input->post('input_investigation'),
+ 'result' => $this->input->post('input_investigation_value'),
+ 'result_text' => $this->input->post('input_investigation_report'),
+ 'normal_range' => $normal_range,
+ 'isbold' => $isbold,
+ 'out_range' => $out_range,
+ );
+
+ $investigation_INSERT=$this->Prescription_M->insert_patient_investigation($patient_investigation_data);
+
+ $send_error=validation_errors();
+ $rvar=array(
+ 'insertid' =>$investigation_INSERT,
+ 'msg'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ function patient_investigation_value_del($p_id,$inv_id)
+ {
+
+ $this->Prescription_M->remove_patient_investigation($inv_id);
+
+ $sql="Select p.*
+ from patient_investigation p
+ where p.p_id=$p_id order by p.date_investigation desc";
+ $query = $this->db->query($sql);
+ $data['patient_investigation_data']= $query->result();
+
+ $data['p_id']=$p_id;
+
+ $content=$this->load->view('dashboard/patient_investigation',$data,true);
+
+ echo $content;
+
+ }
+
+ function doc_online($doc_id)
+ {
+ $sql="Select * from doctor_master where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ $data['doc_name']=$doctor_master[0]->p_fname;
+ $data['doc_id']=$doc_id;
+
+ $this->load->view('center_room/center_room',$data);
+
+ }
+
+ // OPD Medicince
+
+ function opd_medicince()
+ {
+ $sql="Select id,item_name,formulation,genericname,company_name from opd_med_master order by item_name";
+ $query = $this->db->query($sql);
+ $data['opd_med_master']= $query->result();
+
+ $this->load->view('OPD/opd_medicince',$data);
+ }
+
+ function opd_medicince_remove($med_id)
+ {
+ $this->Prescription_M->remove_med_master($med_id);
+ echo 'Item Deleted';
+ }
+
+ function opd_medicince_show($med_id)
+ {
+ $sql="Select * from opd_med_master where id=$med_id";
+ $query = $this->db->query($sql);
+ $opd_med_master= $query->result();
+
+ if(count($opd_med_master)>0)
+ {
+ echo ''.$opd_med_master[0]->id.'
+ '.$opd_med_master[0]->formulation.' '.$opd_med_master[0]->item_name.'
+ '.$opd_med_master[0]->genericname.'
+ '.$opd_med_master[0]->company_name.'
+ Edit
+ Remove ';
+ }else{
+ echo '
+
+
+
+
+ ';
+ }
+
+ }
+
+ function opd_medicince_edit($med_id)
+ {
+ $sql="Select * from opd_med_master where id=$med_id";
+ $query = $this->db->query($sql);
+ $data['opd_med_master']= $query->result();
+
+ if (isset($data['opd_med_master'][0]->id)) {
+ if (isset($_POST) && count($_POST) > 0) {
+
+ $company_id=$this->input->post('company_id');
+ $formulation = $this->input->post('formulation');
+
+ $sql="Select * from med_company where id=$company_id";
+ $query = $this->db->query($sql);
+ $med_company= $query->result();
+
+ if(count($med_company)>0){
+ $company_name=$med_company[0]->company_name;
+ }else{
+ $company_name='';
+ }
+
+ $sql="Select * from med_formulation where formulation='$formulation'";
+ $query = $this->db->query($sql);
+ $med_formulation= $query->result();
+
+ if(count($med_formulation)>0){
+ $med_formulation_id=$med_formulation[0]->id;
+ }else{
+ $med_formulation_id=0;
+ }
+
+ $params = array(
+ 'item_name' => $this->input->post('item_name'),
+ 'formulation' => $this->input->post('formulation'),
+ 'formulation_id' => $med_formulation_id,
+ 'company_id' => $company_id,
+ 'company_name' => $company_name,
+ 'genericname' => $this->input->post('genericname'),
+ );
+
+ $this->Prescription_M->update_med_master($params,$med_id);
+
+ echo 'Data Updated';
+ } else {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $sql="Select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation']= $query->result();
+
+ $this->load->view('OPD/opd_medicince_edit',$data);
+ }
+ } else {
+ echo 'The Medicince you are trying to edit does not exist.';
+ }
+
+
+ }
+
+ function opd_medicince_add()
+ {
+ if (isset($_POST) && count($_POST) > 0) {
+
+ $company_id=$this->input->post('company_id');
+ $formulation = $this->input->post('formulation');
+
+
+ $sql="Select * from med_company where id=$company_id";
+ $query = $this->db->query($sql);
+ $med_company= $query->result();
+
+ if(count($med_company)>0){
+ $company_name=$med_company[0]->company_name;
+ }else{
+ $company_name='';
+ }
+
+ $sql="Select * from med_formulation where formulation='$formulation'";
+ $query = $this->db->query($sql);
+ $med_formulation= $query->result();
+
+ if(count($med_formulation)>0){
+ $med_formulation_id=$med_formulation[0]->id;
+ }else{
+ $med_formulation_id=0;
+ }
+
+ $params = array(
+ 'item_name' => $this->input->post('item_name'),
+ 'formulation' => $this->input->post('formulation'),
+ 'formulation_id' => $med_formulation_id,
+ 'company_id' => $company_id,
+ 'company_name' => $company_name,
+ 'genericname' => $this->input->post('genericname'),
+ );
+
+ $this->Prescription_M->insert_med_master($params);
+
+ echo 'Data Insert';
+ } else {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $sql="Select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation']= $query->result();
+
+ $this->load->view('OPD/opd_medicince_add',$data);
+ }
+
+
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Opd_print.php b/old_code_ci3/controllers/Opd_print.php
new file mode 100644
index 0000000..ff04e0a
--- /dev/null
+++ b/old_code_ci3/controllers/Opd_print.php
@@ -0,0 +1,904 @@
+db->query($sql);
+ $opd_master= $query->result();
+
+ $doc_id=0;
+ $no_opd_days=5-1;
+
+ if(count($opd_master)>0){
+
+ $doc_id=$opd_master[0]->doc_id;
+
+ $sql="select *
+ from doctor_master
+ where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ $sql="select d.* ,group_concat(m.SpecName) as SpecName
+ FROM (doctor_master d left JOIN doc_spec s on d.id =s.doc_id)
+ join med_spec m on s.med_spec_id =m.id
+ WHERE d.id=$doc_id ";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ if(count($doctor_master)>0)
+ {
+ $no_opd_days=$doctor_master[0]->opd_valid_no_days-1;
+ }
+ }
+
+ $sql="SELECT o.*,DATE_FORMAT(o.apointment_date,'%d-%m-%Y') as str_apointment_date,
+ date_format(opd_book_date,'%d-%m-%Y %H:%i') as str_opd_book_date ,
+ date_format(date_add(o.apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date,
+ (case o.payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str ,
+ d.doc_sign,DATE_FORMAT(o.last_opdvisit_date,'%d-%m-%Y') as str_last_opdvisit_date,
+ d.opd_print_format
+ from opd_master o JOIN doctor_master d ON o.doc_id=d.id where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $data['opd_master']=$opd_master;
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$opd_master[0]->apointment_date."') AS age ,
+ date_format(last_visit,'%d-%m-%Y') as last_visit_str
+ from patient_master where id='".$opd_master[0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $patient_master= $query->result();
+
+ $pid=$opd_master[0]->p_id;
+
+ $sql="Select count(*) as rec_opd from opd_master where p_id=$pid";
+ $query = $this->db->query($sql);
+ $no_opd= $query->result();
+
+ $data['patient_master']=$patient_master;
+
+ $total_no_visit=$no_opd[0]->rec_opd+$patient_master[0]->no_of_visit;
+
+ $sql="select *,date_format(date_add(apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date
+ from opd_master where p_id=".$opd_master[0]->p_id." and doc_id=".$opd_master[0]->doc_id."
+ and apointment_date >= date_add(sysdate(),interval -$no_opd_days day) and opd_fee_type<>3";
+ $query = $this->db->query($sql);
+ $old_opd= $query->result();
+
+ $data['old_opd']=$old_opd;
+
+ $sql="select * from hc_insurance where id=".$opd_master[0]->insurance_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ $data['insurance']=$insurance;
+
+ $data['case_id']='';
+
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$opd_master[0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+
+ $data['case_master']=$case_master;
+
+ if(count($case_master)>0){
+ $data['case_id']="Org. Case ID : ".$case_master[0]->case_id_code;
+ }
+ }
+
+ $old_uhid='';
+ if($patient_master[0]->udai<>"")
+ {
+ $old_uhid= ' /'.$patient_master[0]->udai;
+ }
+ $data['old_uhid']=$old_uhid;
+
+ $exp_date="";
+
+ if($opd_master[0]->opd_fee_type=='3'){
+ if(count($old_opd)>0){
+ $exp_date= 'OPD Start Date : '.$old_opd[0]->s_opd_date.' Valid Upto :'.$old_opd[0]->opd_Exp_Date.' ';
+ }
+ }else{
+ $exp_date="Valid Upto : ".$opd_master[0]->opd_Exp_Date ."";
+ }
+
+ if($opd_master[0]->last_opdvisit_date=='')
+ {
+ if($patient_master[0]->last_visit=='')
+ {
+ $last_opdvisit_date="";
+ }else{
+ $last_opdvisit_date=' Last Visit :'.$patient_master[0]->last_visit_str;
+ }
+
+
+ }else{
+ $last_opdvisit_date=' Last Visit :'.$opd_master[0]->str_last_opdvisit_date;
+ }
+
+ $data['last_opdvisit_date']=$last_opdvisit_date;
+
+ $data['exp_date']=$exp_date;
+
+ $data['doc_info']='Dr. '.$opd_master[0]->doc_name.' '.nl2br($opd_master[0]->doc_sign);
+ $data['SpecName']=$doctor_master[0]->SpecName;
+ $data['str_opd_book_date']=$opd_master[0]->str_opd_book_date;
+
+ $content='
+
+
+
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Gender/Age : '.$patient_master[0]->xgender.' / '.$patient_master[0]->age.'
+ Mob :'.$patient_master[0]->mphone1 .'
+ Address :'.$patient_master[0]->add1.','.$patient_master[0]->add2.' ,'.$patient_master[0]->city.'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ Date: '.$opd_master[0]->str_apointment_date .' '.$exp_date.'
+ OPD Fee: '.$opd_master[0]->opd_fee_amount .' ['.$opd_master[0]->opd_fee_desc .']
+
+
+
+ Dr. '.$opd_master[0]->doc_name.'
+ '.$doctor_master[0]->SpecName.'
+ '.nl2br($doctor_master[0]->doc_sign).'
+
+ No. of Visit : '.$total_no_visit.'
+
+
+
';
+ //echo $content;
+
+
+ $data['content']=$content;
+
+ $content_3='
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Gender/Age : '.$patient_master[0]->xgender.' / '.$patient_master[0]->age.'
+ Phone No. :'.$patient_master[0]->mphone1 .'
+ Address :'.$patient_master[0]->add1.','.$patient_master[0]->add2.' ,'.$patient_master[0]->city.'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ OPD Fee: '.$opd_master[0]->opd_fee_amount .' ['.$opd_master[0]->opd_fee_desc .']
+ Date: '.$opd_master[0]->str_apointment_date .'
+ '.$last_opdvisit_date.'
+ No. of Visit : '.$total_no_visit.$exp_date.'
+
+
+
+ ';
+
+ $data['content_3']=$content_3;
+
+
+ $content_4='
+
+
+
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Gender/Age : '.$patient_master[0]->xgender.' / '.$patient_master[0]->age.'
+ Phone No. :'.$patient_master[0]->mphone1 .'
+ Address :'.$patient_master[0]->add1.','.$patient_master[0]->add2.' ,'.$patient_master[0]->city.'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ Date: '.$opd_master[0]->str_apointment_date .'
+ '.$last_opdvisit_date.'
+ No. of Visit : '.$total_no_visit.' '.$exp_date.'
+
+
+
+ ';
+
+ $data['content_4']=$content_4;
+
+ $data['pName']=$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname) ;
+ $data['pRelative']=$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname) ;
+ $data['age_sex']=$patient_master[0]->age.' / '.$patient_master[0]->xgender;
+ $data['opd_no']=$opd_master[0]->opd_code;
+ $data['opd_date']=$opd_master[0]->str_apointment_date;
+
+ $data['opd_fee']= 'Rs.'.$opd_master[0]->opd_fee_amount .' '.$opd_master[0]->opd_fee_desc ;
+
+ $data['opd_fee_desc']= $opd_master[0]->opd_fee_desc ;
+
+ $data['opd_sr_no']=$opd_master[0]->opd_no;
+
+ $data['short_info']='Sr No.: '.$opd_master[0]->opd_no .'
+ OPD Fee : Rs.'.$opd_master[0]->opd_fee_amount .' '.$opd_master[0]->opd_fee_desc .'
+ UHID : '.$patient_master[0]->p_code.'
+ P Add. :'.$patient_master[0]->add1.','.$patient_master[0]->city.'';
+
+ $data['short_info_1']='Sr No.: '.$opd_master[0]->opd_no .'
+ / OPD Fee : Rs.'.$opd_master[0]->opd_fee_amount .' '.$opd_master[0]->opd_fee_desc .' /
+ UHID : '.$patient_master[0]->p_code.' / No. of Visit : '.$total_no_visit.' '.$last_opdvisit_date;
+
+ $data['uhid_no']=$patient_master[0]->p_code;
+ $data['phoneno']=$patient_master[0]->mphone1;
+ $data['p_address']=$patient_master[0]->add1.','.$patient_master[0]->city.'';
+ $data['opd_fee']= 'Rs.'.$opd_master[0]->opd_fee_amount .' '.$opd_master[0]->opd_fee_desc ;
+ $data['total_no_visit']=$total_no_visit;
+ $data['exp_date']=$exp_date;
+
+ $data['opd_book_date']=$opd_master[0]->opd_book_date;
+
+ $this->load->library('m_pdf');
+
+ $file_name='opd_parchi-'.$opdid.'-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ if($opd_master[0]->opd_print_format==''){
+ $print_content=$this->load->view('dashboard/opd_print_parcha',$data,TRUE);
+ }else{
+ $print_content=$this->load->view('dashboard/'.$opd_master[0]->opd_print_format,$data,TRUE);
+ }
+
+ //echo $print_content;
+
+ $this->m_pdf->pdf->WriteHTML($print_content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function opd_blank_print($opdid)
+ {
+ $bar_content="";
+
+ $sql="Select * from opd_master where opd_id=$opdid";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $p_id=$opd_master[0]->p_id;
+
+ $sql="Select count(*) as No_visit from opd_master where p_id=$p_id";
+ $query = $this->db->query($sql);
+ $no_of_opd_data= $query->result();
+
+ $no_of_visit=$no_of_opd_data[0]->No_visit;
+
+ $doc_id=0;
+ $no_opd_days=5-1;
+
+ if(count($opd_master)>0){
+
+ $doc_id=$opd_master[0]->doc_id;
+
+ $sql="select *
+ from doctor_master
+ where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ if(count($doctor_master)>0)
+ {
+ $no_opd_days=$doctor_master[0]->opd_valid_no_days-1;
+ }
+ }
+
+
+ $sql="SELECT o.*,DATE_FORMAT(o.apointment_date,'%d-%m-%Y') as str_apointment_date,
+ date_format(date_add(o.apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date,
+ (case o.payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str ,
+ d.doc_sign,DATE_FORMAT(o.last_opdvisit_date,'%d-%m-%Y') as str_last_opdvisit_date,
+ d.opd_print_format,d.opd_blank_print
+ from opd_master o JOIN doctor_master d ON o.doc_id=d.id where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $data['opd_master']=$opd_master;
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$opd_master[0]->apointment_date."') AS age from patient_master where id='".$opd_master[0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $patient_master= $query->result();
+
+ $data['patient_master']=$patient_master;
+
+ $sql="select *,date_format(date_add(apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date ,
+ date_format(apointment_date,'%d-%m-%Y') as s_opd_date
+ from opd_master where p_id=".$opd_master[0]->p_id." and doc_id=".$opd_master[0]->doc_id."
+ and apointment_date >= date_add(sysdate(),interval -$no_opd_days day) and opd_fee_type<>3";
+ $query = $this->db->query($sql);
+ $old_opd= $query->result();
+
+ $data['old_opd']=$old_opd;
+
+ $sql="select * from hc_insurance where id=".$opd_master[0]->insurance_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ $data['insurance']=$insurance;
+
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$opd_master[0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+
+ $data['case_master']=$case_master;
+ }
+
+ $old_uhid='';
+ if($patient_master[0]->udai<>"")
+ {
+ $old_uhid= ' /'.$patient_master[0]->udai;
+ }
+ $data['old_uhid']=$old_uhid;
+
+ $exp_date="";
+
+ if($opd_master[0]->opd_fee_type=='3'){
+ if(count($old_opd)>0){
+ $exp_date= 'OPD Start Date : '.$old_opd[0]->s_opd_date.' Valid Upto :'.$old_opd[0]->opd_Exp_Date.' ';
+ }
+ }else{
+ $exp_date="Valid Upto : ".$opd_master[0]->opd_Exp_Date ." ";
+ }
+
+ if($opd_master[0]->last_opdvisit_date=='')
+ {
+ $last_opdvisit_date="";
+ }else{
+ $last_opdvisit_date='Last Visit :'.$opd_master[0]->str_last_opdvisit_date;
+ }
+
+ $data['exp_date']=$exp_date;
+
+ $bar_content.=$patient_master[0]->p_code.'/'.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname);
+ $bar_content.='/'.$opd_master[0]->opd_no.'/'.$opd_master[0]->str_apointment_date.'/'.date('dmYHis');
+
+ $content='
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Gender/Age : '.$patient_master[0]->xgender.' / '.$patient_master[0]->age.'
+ Phone No. :'.$patient_master[0]->mphone1 .'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ OPD Fee: '.$opd_master[0]->opd_fee_amount .' ['.$opd_master[0]->opd_fee_desc .']
+ Date: '.$opd_master[0]->str_apointment_date .' '.$exp_date.'
+
+
+ Address :'.$patient_master[0]->add1.','.$patient_master[0]->add2.' ,'.$patient_master[0]->city.'
+ '.$last_opdvisit_date.'
+ No. of Visit : '.$no_of_visit.'
+
+
+
+ ';
+ $data['content']=$content;
+
+ $content_2='
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ Gender : '.$patient_master[0]->xgender.' / Age : '.$patient_master[0]->age.'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+
+
+ Phone No. :'.$patient_master[0]->mphone1 .'
+ Address :'.$patient_master[0]->add1.','.$patient_master[0]->add2.' '.$patient_master[0]->city.'
+ No. of Visit : '.$no_of_visit.'
+ '.$last_opdvisit_date.'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ OPD Fee: '.$opd_master[0]->opd_fee_amount .' ['.$opd_master[0]->opd_fee_desc .']
+ Date: '.$opd_master[0]->str_apointment_date .'
+
+
+
+ ';
+ //echo $content;
+
+ $data['content_2']=$content_2;
+
+ $content_3='
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Gender/Age : '.$patient_master[0]->xgender.' / '.$patient_master[0]->age.'
+ Phone No. :'.$patient_master[0]->mphone1 .'
+ Address :'.$patient_master[0]->add1.','.$patient_master[0]->add2.' ,'.$patient_master[0]->city.'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ OPD Fee: '.$opd_master[0]->opd_fee_amount .' ['.$opd_master[0]->opd_fee_desc .']
+ Date: '.$opd_master[0]->str_apointment_date .'
+ '.$last_opdvisit_date.'
+ No. of Visit : '.$no_of_visit.'
+
+
+
+ ';
+
+ $data['content_3']=$content_3;
+
+ $content_4='
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Gender/Age : '.$patient_master[0]->xgender.' / '.$patient_master[0]->age.'
+ Phone No. :'.$patient_master[0]->mphone1 .'
+ Address :'.$patient_master[0]->add1.','.$patient_master[0]->add2.' ,'.$patient_master[0]->city.'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ Date: '.$opd_master[0]->str_apointment_date .'
+ '.$last_opdvisit_date.'
+ No. of Visit : '.$no_of_visit.'
+
+
+
+ ';
+
+ $data['content_4']=$content_4;
+
+
+ $data['patient_master']=$patient_master;
+ $data['opd_master']=$opd_master;
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetWatermarkText(H_Name);
+ //$this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name='opd_parchi-'.$opdid.'-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$print_content=$this->load->view('dashboard/opd_letter_head_print',$data,TRUE);
+
+ $print_content=$this->load->view('dashboard/'.$opd_master[0]->opd_blank_print,$data,TRUE);
+
+ //echo $print_content;
+
+ $this->m_pdf->pdf->WriteHTML($print_content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+
+
+ public function opd_day_care($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ date_format(date_add(apointment_date,interval 4 day),'%d-%m-%Y') as opd_Exp_Date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$opd_master[0]->apointment_date."') AS age from patient_master where id='".$opd_master[0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $patient_master= $query->result();
+
+ $sql="select *,date_format(date_add(apointment_date,interval 4 day),'%d-%m-%Y') as opd_Exp_Date ,
+ date_format(apointment_date,'%d-%m-%Y') as s_opd_date
+ from opd_master where p_id=".$opd_master[0]->p_id." and opd_id < ".$opdid."
+ order by opd_id desc limit 1";
+ $query = $this->db->query($sql);
+ $old_opd= $query->result();
+
+ $sql="select *,date_format(date_add(apointment_date,interval 4 day),'%d-%m-%Y') as opd_Exp_Date ,
+ date_format(apointment_date,'%d-%m-%Y') as s_opd_date
+ from opd_master where p_id=".$opd_master[0]->p_id." and doc_id=".$opd_master[0]->doc_id."
+ and apointment_date > date_add(sysdate(),interval -5 day) and opd_fee_type<>3";
+ $query = $this->db->query($sql);
+ $old_opd= $query->result();
+
+ $data['old_opd']=$old_opd;
+
+ $sql="select * from hc_insurance where id=".$opd_master[0]->insurance_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$opd_master[0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+ }
+
+ $old_uhid='';
+ if($patient_master[0]->udai<>"")
+ {
+ $old_uhid= ' /'.$patient_master[0]->udai;
+ }
+
+
+ $content='
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Sex : '.$patient_master[0]->xgender.' '.$patient_master[0]->age.'
+
+
+ Date: '.$opd_master[0]->str_apointment_date .'
+ Admit Time: ____________________
+ Discharge Time: ___________________
+
+
+
';
+
+ //echo $content;
+ $data['content']=$content;
+ $data['patient_master']=$patient_master;
+ $data['opd_master']=$opd_master;
+
+ $this->load->library('m_pdf');
+
+ $file_name='opd_parchi-'.$opdid.'-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ $print_content=$this->load->view('dashboard/day_care_format',$data,TRUE);
+
+ //echo $print_content;
+
+ $this->m_pdf->pdf->WriteHTML($print_content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function opd_Cont_print($opdid)
+ {
+ $sql="Select * from opd_master where opd_id=$opdid";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $doc_id=0;
+ $no_opd_days=5-1;
+
+ if(count($opd_master)>0){
+
+ $doc_id=$opd_master[0]->doc_id;
+
+ $sql="select *
+ from doctor_master
+ where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ if(count($doctor_master)>0)
+ {
+ $no_opd_days=$doctor_master[0]->opd_valid_no_days-1;
+ }
+ }
+
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ date_format(date_add(apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$opd_master[0]->apointment_date."') AS age from patient_master where id='".$opd_master[0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $patient_master= $query->result();
+
+ $sql="select *,date_format(date_add(apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date ,
+ date_format(apointment_date,'%d-%m-%Y') as s_opd_date
+ from opd_master where p_id=".$opd_master[0]->p_id." and opd_id < ".$opdid."
+ order by opd_id desc limit 1";
+ $query = $this->db->query($sql);
+ $old_opd= $query->result();
+
+ $sql="select *,date_format(date_add(apointment_date,interval $no_opd_days day),'%d-%m-%Y') as opd_Exp_Date ,
+ date_format(apointment_date,'%d-%m-%Y') as s_opd_date
+ from opd_master where p_id=".$opd_master[0]->p_id." and doc_id=".$opd_master[0]->doc_id."
+ and apointment_date >= date_add(sysdate(),interval -$no_opd_days day) and opd_fee_type<>3";
+ $query = $this->db->query($sql);
+ $old_opd= $query->result();
+
+ $data['old_opd']=$old_opd;
+
+ $sql="select * from hc_insurance where id=".$opd_master[0]->insurance_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$opd_master[0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+ }
+
+ $old_uhid='';
+ if($patient_master[0]->udai<>"")
+ {
+ $old_uhid= ' /'.$patient_master[0]->udai;
+ }
+
+ $exp_date="";
+
+ if($opd_master[0]->opd_fee_type=='3'){
+ if(count($old_opd)>0){
+ $exp_date= 'OPD Start Date : '.$old_opd[0]->s_opd_date.' Valid Upto :'.$old_opd[0]->opd_Exp_Date.' ';
+ }
+ }else{
+ $exp_date="Valid Upto : ".$opd_master[0]->opd_Exp_Date ." ";
+ }
+
+ $content='
+
+
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Sex : '.$patient_master[0]->xgender.' '.$patient_master[0]->age.'
+ P.No. :'.$patient_master[0]->mphone1 .'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ OPD No.: '.$opd_master[0]->opd_code.'
+ OPD Fee: '.$opd_master[0]->opd_fee_amount .' ['.$opd_master[0]->opd_fee_desc .']
+ Date: '.$opd_master[0]->str_apointment_date .' '.$exp_date.'
+
+
+ Dr. '.$opd_master[0]->doc_name.'
+ '.nl2br($opd_master[0]->doc_sign).'
+
+
+
';
+
+ //echo $content;
+
+ $this->load->library('m_pdf');
+
+ $file_name='opd_parchi-'.$opdid.'-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$print_content=$this->load->view('dashboard/day_care_format',$data,TRUE);
+
+ //echo $print_content;
+
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function invoice_print_pdf($opdid)
+ {
+ $sql="Select * from opd_master where opd_id=$opdid";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $doc_id=0;
+ $no_opd_days=5-1;
+
+ if(count($opd_master)>0){
+
+ $doc_id=$opd_master[0]->doc_id;
+
+ $sql="select *
+ from doctor_master
+ where id=$doc_id";
+ $query = $this->db->query($sql);
+ $doctor_master= $query->result();
+
+ if(count($doctor_master)>0)
+ {
+ $no_opd_days=$doctor_master[0]->opd_valid_no_days-1;
+ }
+ }
+
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$opd_master[0]->apointment_date."') AS age
+ from patient_master where id='".$opd_master[0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $patient_master= $query->result();
+
+ $sql="select * from hc_insurance where id=".$opd_master[0]->insurance_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$opd_master[0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+ }
+
+ // Content Start From here
+
+ $content='OPD Invoice Receipt ';
+
+ $itemlist='Items:';
+
+ $content.='
+
+
+ To
+ UHID : '.$patient_master[0]->p_code.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Sex : '.$patient_master[0]->xgender.' '.$patient_master[0]->age.' P.No. :'.$patient_master[0]->mphone1 .'
+ Address : '.$patient_master[0]->add1.','.$patient_master[0]->city.'
+
+
+ Invoice No. : '.$opd_master[0]->opd_code.'
+ Date : '.$opd_master[0]->str_apointment_date.'
+ Print Time : '.date('d-m-Y H:i:s').'
+
+
+
+
+
+
';
+ $content.='
+
+ Date
+ Charge Name
+ Doctor Name
+ Description
+ Amount
+ ';
+
+ $content.= '';
+ $content.= ''.$opd_master[0]->str_apointment_date.' ';
+ $content.= 'Consultation Fee ';
+ $content.= 'Dr.'.$opd_master[0]->doc_name.' ';
+ $content.= ''.$opd_master[0]->opd_fee_desc.' ';
+ $content.= 'Rs.'.$opd_master[0]->opd_fee_gross_amount.' ';
+ $content.= ' ';
+
+ if($opd_master[0]->opd_discount>0 )
+ {
+ $content.= '';
+ $content.= '# ';
+ $content.= ' Deduction ';
+ $content.= ''.$opd_master[0]->opd_disc_remark.' ';
+ $content.= ' Rs.'.$opd_master[0]->opd_discount.' ';
+ $content.= ' ';
+
+ }
+
+ $content.= '';
+ $content.= '# ';
+ $content.= ' ';
+ $content.= 'Net Amount ';
+ $content.= ' Rs.'.$opd_master[0]->opd_fee_amount.' ';
+ $content.= ' ';
+
+ $content.='
';
+
+ // Content End Here
+
+ if($opd_master[0]->payment_id>0 )
+ {
+ $content.='Payment No. : '.$opd_master[0]->payment_id.' ';
+ }
+
+ $content.='
+
+
+
+
+ Amount in Words : Rs. '.number_to_word($opd_master[0]->opd_fee_amount).'
+
+
+
+
+
+
+
+ Prepared By : '.$opd_master[0]->prepared_by.'
+
+
+ Signature
+
+
+
';
+
+ $data['content']=$content;
+
+ $data['bar_content']=$patient_master[0]->p_code.':OPD-'.$opd_master[0]->opd_code.':T'.date('dmYhms');
+
+ //echo $content;
+ //$this->load->library("Pdf");
+ //create_Invoice_pdf($content,$bar_content,'opd_invoice-'.$opdid.'-'.date('Yms'));
+
+ //load mPDF library
+
+ $this->load->library('m_pdf');
+
+ $file_name='opd_parchi-'.$opdid.'-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ $print_content=$this->load->view('dashboard/opd_invoice_print',$data,TRUE);
+
+ //$print_content=$content;
+
+
+ //echo $print_content;
+ $this->m_pdf->pdf->SetJS('this.print();');
+
+ $this->m_pdf->pdf->WriteHTML($print_content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }
+
+}
diff --git a/old_code_ci3/controllers/Opdcase.php b/old_code_ci3/controllers/Opdcase.php
new file mode 100644
index 0000000..29359b0
--- /dev/null
+++ b/old_code_ci3/controllers/Opdcase.php
@@ -0,0 +1,218 @@
+db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_spec_l']= $query->result();
+
+ $sql="select * from hc_insurance_card where p_id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['insurance_card']= $query->result();
+
+ $this->load->view('opd_app_insurance_V',$data);
+ }
+
+ public function showfee()
+ {
+ $sql="select * from doc_opd_fee where doc_id=".$this->input->post('doc_id');
+ $query = $this->db->query($sql);
+ $data['doc_fee_a']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$this->input->post('doc_id')." group by d.id ";
+ $query = $this->db->query($sql);
+ $doc_info= $query->result();
+
+ $content='';
+
+ $content.= 'Name : '.$doc_info[0]->p_fname.' / Specialization: '.$doc_info[0]->SpecName.' /
+ Gender : '.$doc_info[0]->xGender.' ';
+ $content.= ' ';
+
+ $sql="select * from hc_insurance where id=".$this->input->post('insurance_id');
+ $query = $this->db->query($sql);
+ $data['opd_fee_a']= $query->result();
+
+ foreach($data['opd_fee_a'] as $row)
+ {
+ $content.= '';
+ $content.= ' ';
+ $content.= ' Rs. '.$row->opd_fee.'[Insurance OPD Fee Apply]';
+ $content.= ' ';
+ }
+
+ $content.="";
+
+ $rvar=array(
+ 'csrfName' => $this->security->get_csrf_token_name(),
+ 'csrfHash' => $this->security->get_csrf_hash(),
+ 'content'=>$content
+ );
+
+ $encode_data = json_encode($rvar);
+
+ echo $encode_data ;
+ }
+
+ public function invoice($opdid)
+ {
+ $sql="select *,date_format(apointment_date,'%d-%m-%Y') as str_apointment_date,
+ (case payment_status when 1 Then 'cash' when 2 then 'Bank Card' when 3 then 'ECHS Credit' else 'Pending' end) as Payment_type_str from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from ipd_master where ipd_status=0 and p_id=".$data['opd_master'][0]->p_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from organization_case_master
+ where status=0 and case_type=0 and p_id=".$data['patient_master'][0]->id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$data['opd_master'][0]->insurance_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=1 and refund_type_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['refund_order']= $query->result();
+
+ if(count($data['refund_order'])>0)
+ {
+ $data['refund_status']=1; // Refund Pending
+ }else{
+ $data['refund_status']=0 ; //No Pending
+ }
+
+ $sql="select sum(if(credit_debit=0,amount,amount*-1)) as paid_amount from payment_history where payof_type=1 and payof_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $data['paid_amount']=0;
+
+ if($data['payment_history'][0]->paid_amount=='' || $data['payment_history'][0]->paid_amount==0 )
+ {
+ $data['paid_amount']=0;
+ }else{
+ $data['paid_amount']=$data['payment_history'][0]->paid_amount;
+ }
+
+ $opd_fee_gross_amount=$data['opd_master'][0]->opd_fee_amount;
+
+ if($data['opd_master'][0]->payment_mode==4)
+ {
+ $data['pending_amount']=0;
+ }else{
+ $data['pending_amount']=$opd_fee_gross_amount-$data['paid_amount'];
+ }
+
+
+ $this->load->view('opd_invoice_V',$data);
+ }
+
+ public function invoice_print($opdid)
+ {
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$data['opd_master'][0]->p_id."' ";
+
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$data['opd_master'][0]->insurance_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ if($data['opd_master'][0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master where id=".$data['opd_master'][0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+ }
+
+ $this->load->view('invoice_print_v',$data);
+ }
+
+ public function confirm_opd()
+ {
+ $this->load->model('Opd_M');
+
+ $sql="select * from patient_master where id=".$this->input->post('pid');
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select d.id ,d.p_fname ,group_concat(m.SpecName) as SpecName,if(d.gender=1,'Male','Female') as xGender
+ from doctor_master d join doc_spec s join med_spec m on d.id =s.doc_id and s.med_spec_id =m.id
+ where d.active=1 and d.id=".$this->input->post('doc_id')." group by d.id ";
+ $query = $this->db->query($sql);
+ $data['doc_info']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$this->input->post('insurance_id');
+ $query = $this->db->query($sql);
+ $data['doc_fee']= $query->result();
+
+ $opd_fee_amount=$data['doc_fee'][0]->opd_fee;
+ $opd_fee_desc=$data['doc_fee'][0]->opd_desc;
+
+ $data['insert'] = array(
+ 'p_id' => $this->input->post('pid'),
+ 'P_name' => $data['person_info'][0]->p_fname,
+ 'doc_id' => $this->input->post('doc_id'),
+ 'insurance_id' => $this->input->post('insurance_id'),
+ 'opd_fee_id' => $this->input->post('fee_id'),
+ 'opd_fee_amount' => $opd_fee_amount,
+ 'opd_fee_gross_amount' => $opd_fee_amount,
+ 'opd_fee_desc' => $opd_fee_desc,
+ 'doc_name' => $data['doc_info'][0]->p_fname,
+ 'doc_spec' => $data['doc_info'][0]->SpecName,
+ 'apointment_date' =>str_to_MysqlDate($this->input->post('datepicker_appointment')),
+ 'opd_fee_type' => '1'
+ );
+
+ $inser_id=$this->Opd_M->insert( $data['insert']);
+
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function confirm_payment()
+ {
+
+ }
+ }
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Org_Packing.php b/old_code_ci3/controllers/Org_Packing.php
new file mode 100644
index 0000000..2fd91f3
--- /dev/null
+++ b/old_code_ci3/controllers/Org_Packing.php
@@ -0,0 +1,602 @@
+load->view('Org/Org_packing');
+ }
+
+ public function Search_packing()
+ {
+ $sdata=trim($this->input->post('txtsearch'));
+
+ if(trim($sdata)=='')
+ {
+ $sql="SELECT p.id,date_format(p.date_of_create,'%d-%m-%Y') AS d_o_c,
+ p.label_no,p.files_status,COUNT(c.id) AS No_Rec,
+ if(p.org_type=0,'OPD','IPD') as list_type
+ FROM org_packing p left JOIN organization_case_master c ON p.id=c.packing_id
+ GROUP BY p.id
+ ORDER BY p.date_of_create desc limit 50";
+ }else{
+
+ $numric_condition="";
+
+ if(is_numeric($sdata))
+ {
+ $numric_condition=" OR p.Invoice_no=".$sdata ;
+ }
+
+ $sql="SELECT p.id,date_format(p.date_of_create,'%d-%m-%Y') AS d_o_c,
+ p.label_no,p.files_status,COUNT(c.id) AS No_Rec,
+ if(p.org_type=0,'OPD','IPD') as list_type
+ FROM org_packing p left JOIN organization_case_master c ON p.id=c.packing_id
+ where (p.label_no LIKE '%".$sdata."%' ".$numric_condition." )
+ GROUP BY p.id
+ ORDER BY p.date_of_create desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['packing_list']= $query->result();
+
+ $this->load->view('Org/Search_result',$data);
+
+ }
+
+ public function PackingNew()
+ {
+ $this->load->view('Org/new_Org_Packing');
+
+ }
+
+ public function PackingEdit($id)
+ {
+ $data['id']=$id;
+
+ $sql="select * from org_packing where id=$id";
+ $query = $this->db->query($sql);
+ $data['org_packing']= $query->result();
+
+ $this->load->view('Org/edit_Org_Packing',$data);
+
+ }
+
+ public function CreatePackNew()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_packingcode',
+ 'label' => 'Invoice No',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+
+ $invoice_code=$this->input->post('input_packingcode');
+ $org_type=$this->input->post('cbo_billtype');
+ $datepicker_packing=$this->input->post('datepicker_packing');
+
+ if(is_numeric($invoice_code))
+ $where=" where label_no=".$invoice_code ;
+ else
+ $where=" where label_no='".$invoice_code."'";
+
+ $sql="select count(*) as no_rec from org_packing ".$where;
+ $query = $this->db->query($sql);
+ $chk_rec= $query->result();
+
+ if($chk_rec[0]->no_rec==0)
+ {
+ $Udata = array(
+ 'date_of_create'=> str_to_MysqlDate($datepicker_packing),
+ 'label_no'=> $invoice_code,
+ 'org_type'=>$org_type
+ );
+
+ $this->load->model('Ocasemaster_M');
+
+ $inser_id=$this->Ocasemaster_M->insert_org_pack($Udata);
+ $send_msg="Added Successfully";
+
+ if($inser_id>0)
+ {
+ $show_text=$send_msg;
+ }else{
+ $show_text=$send_msg;
+ }
+ }else{
+ $show_text='Record Already Exist';
+ $inser_id=0;
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else{
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'show_text'=>$send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function EditPack()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_packingcode',
+ 'label' => 'Invoice No',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+
+ $invoice_code=$this->input->post('input_packingcode');
+ $org_type=$this->input->post('cbo_billtype');
+ $datepicker_packing=$this->input->post('datepicker_packing');
+ $id=$this->input->post('packing_id');
+
+ if(is_numeric($invoice_code))
+ $where=" label_no=".$invoice_code ;
+ else
+ $where=" label_no='".$invoice_code."'";
+
+ $sql="select count(*) as no_rec from org_packing where id<>$id and ".$where;
+ $query = $this->db->query($sql);
+ $chk_rec= $query->result();
+
+ if($chk_rec[0]->no_rec==0)
+ {
+ $Udata = array(
+ 'date_of_create'=> str_to_MysqlDate($datepicker_packing),
+ 'label_no'=> $invoice_code,
+ 'org_type'=>$org_type
+ );
+
+ $this->load->model('Ocasemaster_M');
+
+ $inser_id=$this->Ocasemaster_M->update_org_pack($Udata,$id);
+ $send_msg="Update Successfully";
+
+ if($inser_id>0)
+ {
+ $show_text=$send_msg;
+ }else{
+ $show_text=$send_msg;
+ }
+ }else{
+ $show_text='Record Already Exist';
+ $inser_id=0;
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else{
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'show_text'=>$send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function PackNewEdit($id)
+ {
+ $sql="select *
+ from org_packing
+ where id=".$id;
+ $query = $this->db->query($sql);
+ $data['org_packing']= $query->result();
+
+ $sql="SELECT o.*,o.case_id_code,o.insurance_company_name,
+ p.p_code,p.p_fname,p.age,o.insurance_no,o.insurance_no_1,
+ if(o.case_type=0,'OPD','IPD') as IPD_OPD
+ FROM organization_case_master o JOIN patient_master_exten p ON o.p_id=p.id
+ WHERE o.packing_id=$id
+ ORDER BY o.packing_short";
+ $query = $this->db->query($sql);
+ $data['org_packing_list']= $query->result();
+
+ $data['packing_id']=$id;
+
+ $data['org_packing_list']=$this->load->view('Org/org_packing_list',$data,true);
+
+ $this->load->view('Org/Org_item_Edit',$data);
+ }
+
+ public function PackMasterEdit($id)
+ {
+ $sql="select p.*,s.name_supplier from purchase_invoice p join med_supplier s on p.sid=s.sid where p.id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_data']= $query->result();
+
+ $sql="select * from purchase_invoice_item where purchase_id='".$inv_id."' ";
+ $query = $this->db->query($sql);
+ $data['purchase_item']= $query->result();
+
+ $this->load->view('Medical/Purchase/purchase_invoice_master_edit',$data);
+
+ }
+
+ public function Pack_list($packing_id)
+ {
+ $sql="SELECT o.*,o.case_id_code,o.insurance_company_name,
+ p.p_code,p.p_fname,p.age,o.insurance_no,o.insurance_no_1,
+ if(o.case_type=0,'OPD','IPD') as IPD_OPD
+ FROM organization_case_master o JOIN patient_master_exten p ON o.p_id=p.id
+ WHERE o.packing_id=$packing_id
+ ORDER BY o.packing_short";
+ $query = $this->db->query($sql);
+ $data['org_packing_list']= $query->result();
+
+ $data['packing_id']=$packing_id;
+
+ $this->load->view('Org/org_packing_list',$data);
+
+ }
+
+
+ public function Add_list($org_id,$packing_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.' ['.date('d-m-Y h:i:s').']';
+
+ $sql="SELECT *
+ FROM organization_case_master o
+ WHERE o.packing_id=$packing_id and id=$org_id";
+ $query = $this->db->query($sql);
+ $org_check= $query->result();
+
+
+ $sql="SELECT Max(o.packing_short) as m_short
+ FROM organization_case_master o
+ WHERE o.packing_id=$packing_id
+ ORDER BY o.packing_short";
+ $query = $this->db->query($sql);
+ $org_short_max= $query->result();
+
+ $max_short_no=$org_short_max[0]->m_short;
+
+ $max_short_no=$max_short_no+1;
+
+ $dataupdate = array(
+ 'packing_id' => $packing_id,
+ 'packing_update_by'=> $user_name,
+ 'packing_short' => $max_short_no
+ );
+
+ $this->load->model('Ocasemaster_M');
+
+ if(count($org_check)>0)
+ {
+ $send_msg="Already Added";
+ }else{
+ $this->Ocasemaster_M->update($dataupdate,$org_id);
+ $send_msg="Added Successfully";
+ }
+
+ $sql="SELECT o.*,o.case_id_code,o.insurance_company_name,
+ p.p_code,p.p_fname,p.age,o.insurance_no,o.insurance_no_1,
+ if(o.case_type=0,'OPD','IPD') as IPD_OPD
+ FROM organization_case_master o JOIN patient_master_exten p ON o.p_id=p.id
+ WHERE o.packing_id=$packing_id
+ ORDER BY o.packing_short";
+ $query = $this->db->query($sql);
+ $data['org_packing_list']= $query->result();
+
+ $data['packing_id']=$packing_id;
+
+ $this->load->view('Org/org_packing_list',$data);
+ }
+
+ public function remove_item_packing($org_id,$packing_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.' ['.date('d-m-Y h:i:s').']';
+
+ $dataupdate = array(
+ 'packing_id' => 0,
+ 'packing_update_by'=> $user_name,
+ 'packing_short' => 0
+ );
+
+ $this->load->model('Ocasemaster_M');
+
+ $this->Ocasemaster_M->update($dataupdate,$org_id);
+ $send_msg="Remove Successfully";
+
+ $sql="SELECT o.*,o.case_id_code,o.insurance_company_name,
+ p.p_code,p.p_fname,p.age,o.insurance_no,o.insurance_no_1,
+ if(o.case_type=0,'OPD','IPD') as IPD_OPD
+ FROM organization_case_master o JOIN patient_master_exten p ON o.p_id=p.id
+ WHERE o.packing_id=$packing_id
+ ORDER BY o.packing_short";
+ $query = $this->db->query($sql);
+ $data['org_packing_list']= $query->result();
+
+ $data['packing_id']=$packing_id;
+
+ $this->load->view('Org/org_packing_list',$data);
+ }
+
+ public function Print_List($Packing_id,$output=0)
+ {
+ $sql="SELECT *
+ FROM organization_case_master
+ WHERE packing_id=$Packing_id";
+ $query = $this->db->query($sql);
+ $org_master= $query->result();
+
+ if($org_master[0]->case_type==0)
+ {
+ redirect('/Org_Packing/Print_opd_List/'.$Packing_id.'/'.$output);
+ }else{
+ redirect('/Org_Packing/Print_ipd_List/'.$Packing_id.'/'.$output);
+ }
+ }
+
+ function Print_opd_List($Packing_id,$output=0)
+ {
+ $sql="SELECT org.*, group_concat(opd.doc_name) AS Doc_name,
+ p.p_code,p.p_fname,p.age,
+ if(org.case_type=0,'OPD','IPD') as IPD_OPD,
+ (org.inv_opd_amt+org.inv_opd_charge_amt+inv_opd_med_amt) AS claim_amt,
+ if(opd.opd_id IS NULL,Date_Format(MIN(i.inv_date),'%d-%m-%Y'),Date_Format(MIN(opd.apointment_date),'%d-%m-%Y')) AS opd_date
+ FROM ((organization_case_master org JOIN patient_master_exten p ON org.p_id=p.id)
+ LEFT JOIN opd_master opd ON org.id=opd.insurance_case_id)
+ LEFT JOIN invoice_master i ON org.id=i.insurance_case_id
+ WHERE org.packing_id=$Packing_id
+ GROUP BY org.id
+ ORDER BY org.packing_short";
+ $query = $this->db->query($sql);
+ $org_packing_list= $query->result();
+
+ $data['Packing_id']=$Packing_id;
+
+ $content="";
+
+ $content.='';
+
+ $content.='
+
+ Set No.
+ Sr.No
+ Claim ID
+ Bill No.
+ Name of Patient
+ OPD Date
+ Consultant Name
+ Sub. Date
+ Amount Claimed
+ Passed Amt.
+ Ded. amt
+
+ ';
+ $sr_no=0;
+
+ foreach($org_packing_list as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$row->packing_short.'
+ '.$sr_no.'
+ '.$row->insurance_no_1.'
+ '.$row->id.'
+ '.$row->p_fname.'
+ '.$row->opd_date.'
+ '.$row->Doc_name.'
+ '.$row->org_submit_date.'
+ '.$row->claim_amt.'
+ '.$row->final_approve_amount.'
+
+ ';
+ }
+
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+
+ $file_name='Report-ORG-'.date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'OPD_Org_List'.date('Ymdhis'));
+ }
+ }
+
+ function Print_ipd_List($Packing_id,$output=0)
+ {
+ $sql="SELECT org.*,ipd.doc_name AS Doc_name,
+ p.p_code,p.p_fname,p.age,
+ if(org.case_type=0,'OPD','IPD') as IPD_OPD,
+ ipd.net_amount AS claim_amt,
+ ipd.str_register_date,ipd.str_discharge_date,org.org_submit_date,ipd.ipd_code,
+ DATE_FORMAT(org.org_submit_date,'%d-%m-%Y') AS str_org_submit_date,
+ ipd.id as ipd_id
+ FROM ((organization_case_master org JOIN patient_master_exten p ON org.p_id=p.id)
+ JOIN v_ipd_list ipd ON ipd.id=org.ipd_id)
+ WHERE org.packing_id=$Packing_id
+ ORDER BY org.packing_short";
+ $query = $this->db->query($sql);
+ $org_packing_list= $query->result();
+
+ $sql="Select * from org_packing where id=$Packing_id";
+ $query = $this->db->query($sql);
+ $org_packing= $query->result();
+
+ $org_packing_set=$org_packing[0]->label_no;
+
+ $data['Packing_id']=$Packing_id;
+
+ $content="";
+
+ $content.='';
+
+ $content.='
+
+ Set No.
+ Sr.No
+ IPD No.
+ Claim ID
+ Bill No.
+ Name of Patient
+ Admit. Dt.
+ Discharge Dt.
+ Sub. Date
+ Consultant Name
+ Amount Claimed
+ Passed Amt.
+ Ded. amt
+
+ ';
+ $sr_no=0;
+
+ foreach($org_packing_list as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$org_packing_set.'
+ '.$sr_no.'
+ '.$row->ipd_code.'
+ '.$row->insurance_no_1.'
+ '.$row->ipd_id.'
+ '.$row->p_fname.'
+ '.$row->str_register_date.'
+ '.$row->str_discharge_date.'
+ '.$row->str_org_submit_date.'
+ '.$row->Doc_name.'
+ '.$row->claim_amt.'
+ '.$row->final_approve_amount.'
+
+ ';
+ }
+
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+
+ $file_name='Report-ipd_org-'.date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'OPD_Org_List'.date('Ymdhis'));
+ }
+
+ }
+
+ public function org_case_search()
+ {
+
+ $search_string = $this->input->post('data_search');
+ $data['packing_id']=$this->input->post('packing_id');
+
+ $sql="select *
+ from org_packing
+ where id=".$data['packing_id'];
+ $query = $this->db->query($sql);
+ $data['org_packing']= $query->result();
+
+ $list_type=$data['org_packing'][0]->org_type;
+ $data['list_type']=$list_type;
+
+ if(strlen($search_string)>3)
+ {
+
+ if($list_type==0)
+ {
+ $sql="SELECT o.*,o.case_id_code,o.insurance_company_name,
+ p.p_code,p.p_fname,p.age,o.insurance_no,o.insurance_no_1,
+ if(o.case_type=0,'OPD','IPD') as IPD_OPD
+ FROM organization_case_master o JOIN patient_master_exten p ON o.p_id=p.id
+ WHERE o.case_type=0 and (o.case_id_code LIKE '%$search_string'
+ OR o.insurance_no='$search_string'
+ OR o.insurance_no_1='$search_string'
+ OR o.ipd_id='$search_string')
+ ORDER BY o.id Limit 10";
+ }else{
+ $sql="SELECT o.*,o.case_id_code,o.insurance_company_name, p.p_code,p.p_fname,p.age,o.insurance_no,
+ o.insurance_no_1, if(o.case_type=0,'OPD','IPD') as IPD_OPD
+ FROM (organization_case_master o JOIN patient_master_exten p ON o.p_id=p.id )
+ JOIN ipd_master i ON o.ipd_id=i.id
+ WHERE o.case_type=1 and (o.case_id_code LIKE '%$search_string'
+ OR o.insurance_no='$search_string'
+ OR o.insurance_no_1='$search_string'
+ OR i.ipd_code LIKE '%$search_string')
+ ORDER BY o.id Limit 10";
+ }
+
+ $query = $this->db->query($sql);
+ $data['org_list']= $query->result();
+
+ $this->load->view('Org/org_list',$data);
+
+
+ }else{
+ echo 'Search with Min 4 Char.';
+ }
+
+ }
+
+
+}
diff --git a/old_code_ci3/controllers/OrganizationInvoice.php b/old_code_ci3/controllers/OrganizationInvoice.php
new file mode 100644
index 0000000..2ee9759
--- /dev/null
+++ b/old_code_ci3/controllers/OrganizationInvoice.php
@@ -0,0 +1,368 @@
+input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('invoice_M');
+
+ $showcontent1='
+
+
+ Payment Method by : ';
+ $showcontent2='
';
+
+ if($this->input->post('mode')==1)
+ {
+
+ $data = array(
+
+ 'payment_mode'=> '1',
+ 'payment_status'=>'1'
+
+ );
+
+ $this->invoice_M->update( $data,$this->input->post('oid'));
+
+ $status='CASH';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==2)
+ {
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_mac',
+ 'label' => 'Card Bank Name',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_card_digit',
+ 'label' => 'Card Last 4 Digit ',
+ 'rules' => 'required|min_length[4]|max_length[4]'
+ ),
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[3]|max_length[15]'
+ )
+ );
+ $this->form_validation->set_rules($FormRules);
+ if ($this->form_validation->run() == TRUE)
+ {
+ $data = array(
+ 'payment_mode'=> '2',
+ 'payment_status'=>'1',
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'card_tran_id'=>$this->input->post('input_card_tran')
+ );
+ $this->Opd_M->update( $data,$this->input->post('oid'));
+
+ $status='Bank Card';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ if($this->input->post('mode')==3)
+ {
+ $data = array(
+
+ 'payment_mode'=> '3',
+ 'payment_status'=>'1',
+ 'ech_clam_id'=>$this->input->post('input_claim_id'),
+
+ );
+
+ $this->invoice_M->update( $data,$this->input->post('oid'));
+
+ $status='ECHS Credit';
+ $showcontent=$showcontent1.$status.$showcontent2;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ if($this->input->post('mode')==0)
+ {
+
+ }
+ }
+
+ public function addPathTest($pno,$ins_id=0)
+ {
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $sql="select * from hc_item_type";
+
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $ins_comp_id=0;
+
+ if($ins_id>1)
+ {
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $ins_comp_id=$data['hc_insurance_card'][0]->insurance_id;
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+ }
+
+ if($ins_comp_id<2)
+ {
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from hc_items where itype=1";
+ }else{
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id=0,'','-INS')) as sdesc from v_hc_items_with_insurance
+ where itype=1 and hc_insurance_id in (0,".$ins_comp_id.")";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ $this->load->model('invoice_M');
+
+ $sql="select count(*) as no_invoice from invoice_master where invoice_status=0 and attach_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['chk_draft_invoice']= $query->result();
+
+ if($data['chk_draft_invoice'][0]->no_invoice<1)
+ {
+ $data['insert_invoice'] = array(
+ 'attach_type' => '0',
+ 'attach_id' => $pno,
+ 'inv_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'inv_name' => $data['person_info'][0]->p_fname,
+ 'ins_id' => $ins_comp_id,
+ 'inv_a_code' => $data['person_info'][0]->p_code
+ );
+ $inser_id=$this->invoice_M->create_invoice( $data['insert_invoice']);
+ }else{
+ $sql="select id from invoice_master where invoice_status=0 and attach_id=".$pno;
+ $query = $this->db->query($sql);
+ $data['invoice_id']= $query->result();
+
+ $inser_id=$data['invoice_id'][0]->id;
+ }
+
+ if($inser_id)
+ {
+ $sql="select * from invoice_master where id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster']= $query->result();
+
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+ }
+
+ $this->load->view('Invoice_PathLab',$data);
+ }
+
+ public function list_pathtest_bytype()
+ {
+ $tid=$this->input->post('itype_idv');
+ $ins_id=$this->input->post('ins_id');
+
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from hc_items where itype=".$tid;
+
+ if($ins_id>1)
+ {
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id=0,'','-INS')) as sdesc from v_hc_items_with_insurance
+ where itype=".$tid." and hc_insurance_id in (0,".$ins_id.")";
+
+ }else{
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from hc_items where itype=".$tid;
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ echo '
+ Test Name
+ ';
+ foreach($data['labitem'] as $row)
+ {
+ echo ''.$row->sdesc.' ';
+ }
+ echo '
';
+
+ }
+
+
+
+ public function showinvoice($invoice_id)
+ {
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+
+ $this->load->view('Invoice_PathLab_final_V',$data);
+ }
+
+ public function showitem($type)
+ {
+ $this->load->model('invoice_M');
+
+ if($type>0)
+ {
+ $ins_id=$this->input->post('ins_id');
+
+ $sql="select * from hc_items where id=".$this->input->post('itype_name_id');
+ if($ins_id>1)
+ {
+ $sql="select id,Concat(idesc,' : [',amount1,']',if(hc_insurance_id=0,'','-INS')) as sdesc,amount1 from v_hc_items_with_insurance
+ where id=".$this->input->post('itype_name_id')." and hc_insurance_id in (0,".$ins_id.")";
+
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $item_rate=$data['itemlist'][0]->amount1;
+
+ $amount_value=$this->input->post('input_qty')*$item_rate;
+
+ }
+ else
+ {
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc,amount from hc_items where id=".$this->input->post('itype_name_id');
+
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $item_rate=$data['itemlist'][0]->amount;
+
+ $amount_value=$this->input->post('input_qty')*$item_rate;
+ }
+
+ $data['insert_invoice_item'] = array(
+ 'inv_master_id' => $this->input->post('lab_invoice_id'),
+ 'item_type' => $this->input->post('itype_idv'),
+ 'item_id' => $this->input->post('itype_name_id'),
+ 'item_name' => $data['itemlist'][0]->sdesc,
+ 'item_rate' => $item_rate,
+ 'item_added_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'item_qty' => $this->input->post('input_qty'),
+ 'item_amount' => $amount_value
+ );
+
+ $inser_id=$this->invoice_M->addinvoiceitem( $data['insert_invoice_item']);
+
+ }else{
+ $this->db->delete("invoice_item", "id=".$this->input->post('itemid'));
+ }
+
+ $sql="select i.*,t.desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$this->input->post('lab_invoice_id');
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$this->input->post('lab_invoice_id');
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ echo '
+
+ #
+ Type
+ Test Name
+ Rate
+ Qty
+ Amount
+
+ ';
+
+ $srno=1;
+
+ foreach($data['invoiceDetails'] as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$row->item_amount.' ';
+ echo '-Remove ';
+ $srno=$srno+1;
+ echo ' ';
+ }
+
+ echo '
+ #
+
+
+
+ Gross Total
+ '.$data['invoiceGtotal'][0]->Gtotal.'
+
+
+
';
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Orgcase.php b/old_code_ci3/controllers/Orgcase.php
new file mode 100644
index 0000000..89c05ae
--- /dev/null
+++ b/old_code_ci3/controllers/Orgcase.php
@@ -0,0 +1,1255 @@
+input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9]/', '', $sdata);
+
+ $sql = "select c.id,c.p_id,c.case_id_code,sum(o.opd_fee_amount) as OPD_Amount,sum(i.net_amount) as Invoice_Amount,
+ c.insurance_company_name,c.p_name,p.p_code,c.date_registration,insurance_card_name,
+ (case c.status when 0 then 'Pending'
+ when 1 then 'Ready for submission'
+ when 2 then 'Submitted'
+ when 3 then 'Payment Done'
+ else 'Other' end) as str_status,
+ Date_Format(c.date_registration,'%d-%m-%Y') as date_registration_in
+ from (organization_case_master c join patient_master p on c.p_id=p.id )
+ left join opd_master o on c.id=o.insurance_case_id
+ left join invoice_master i on c.id=i.insurance_case_id
+ group by c.id ";
+
+ if($sdata!='')
+ {
+ $sql.=" WHERE case_id_code = '".$sdata."' or p_name like '%".$sdata."%' or
+ p_code = '".$sdata." order by c.id desc limit 20";
+ }else
+ {
+ $sql.=" order by c.id desc limit 20";
+ }
+
+ $query = $this->db->query($sql);
+ $data['searchdata']= $query->result();
+
+ $this->load->view('Invoice/Case_List',$data);
+ }
+
+ public function search_all()
+ {
+ $this->load->view('Invoice/case_list_all');
+ }
+
+ public function case_invoice($casecode,$print=0,$caseid=0,$med_include=1)
+ {
+ if($caseid<1)
+ {
+ $sql="select * from organization_case_master where case_id_code='".$casecode."'";
+ }else{
+ $sql="select * from organization_case_master where id='".$caseid."'";
+ }
+
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $pno=$data['orgcase'][0]->p_id;
+ $caseid=$data['orgcase'][0]->id;
+
+ $this->db->query("CALL p_org_update(".$caseid.")");
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$inc_card_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ //$sql="select * from v_case_invoice v
+ // where v.id=".$caseid." order by Charge_type,Adate ";
+
+ //$query = $this->db->query($sql);
+ //$data['showinvoice']= $query->result();
+
+ $sql="select * from v_case_invoice_1 v
+ where v.id=".$caseid." order by Charge_type,Adate ";
+ $query = $this->db->query($sql);
+ $data['showinvoice1']= $query->result();
+
+ $sql="select * from v_case_invoice_2 v
+ where v.id=".$caseid." order by Charge_type,Adate ";
+ $query = $this->db->query($sql);
+ $data['showinvoice2']= $query->result();
+
+ //$sql="select sum(amount) as GTotal from v_case_invoice v
+ // where v.id=".$caseid." ";
+ //$query = $this->db->query($sql);
+ //$data['invoiceGtotal']= $query->result();
+
+ $sql="select m.*,m.id as med_id
+ from invoice_med_master m join ipd_master p join organization_case_master o
+ on m.ipd_id=p.id and p.case_id=o.id and m.ipd_credit=1 and m.ipd_credit_type=1
+ where o.id=".$caseid." ";
+
+ $query = $this->db->query($sql);
+ $data['MedInvoice_data']= $query->result();
+
+ $sql="select sum(m.net_amount) as Med_Amount,o.id ,count(m.id) as no_inv
+ from invoice_med_master m join ipd_master p join organization_case_master o
+ on m.ipd_id=p.id and p.case_id=o.id and m.ipd_credit=1 and m.ipd_credit_type=1
+ where o.id=".$caseid." group by o.id ";
+
+ $query = $this->db->query($sql);
+ $data['MedInvoice']= $query->result();
+
+ if(count($data['MedInvoice'])==0)
+ {
+ $sql="select m.* ,m.id as med_id
+ from invoice_med_master m join organization_case_master o
+ on m.case_id=o.id and m.case_credit=1
+ where o.id=".$caseid." ";
+
+ $query = $this->db->query($sql);
+ $data['MedInvoice_data']= $query->result();
+
+ $sql="select sum(m.net_amount) as Med_Amount,o.id ,count(m.id) as no_inv
+ from invoice_med_master m join organization_case_master o
+ on m.case_id=o.id and m.case_credit=1
+ where o.id=".$caseid." group by o.id ";
+
+ $query = $this->db->query($sql);
+ $data['MedInvoice']= $query->result();
+ }
+
+ $data['med_include']=$med_include;
+
+ $sql="select p.* ,date_format(payment_date,'%d-%m-%Y') as str_date,
+ if(credit_debit=0,if(payment_mode=1,'CASH','BANK'),if(payment_mode=1,'CASH RETURN','BANK RETURN')) as Pay_mode
+ from payment_history p
+ where p.payof_type=3 and p.payof_id=$caseid";
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+
+ if($print>0)
+ {
+ $this->load->library('m_pdf');
+ $file_name='Org_Invoice_-'.$casecode.'-'.date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->curlAllowUnsafeSslRequests = true;
+ $this->m_pdf->useSubstitutions = false;
+ $print_content=$this->load->view('Invoice/caseinvoice_print_V',$data,TRUE);
+ //echo $print_content;
+ $this->m_pdf->pdf->WriteHTML($print_content);
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+ $this->load->view('Invoice/caseinvoice_V',$data);
+ }
+
+ }
+
+ public function case_invoice_ipd($caseid)
+ {
+ $sql="select * from organization_case_master where id='".$caseid."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $pno=$data['orgcase'][0]->p_id;
+ $caseid=$data['orgcase'][0]->id;
+
+ $this->db->query("CALL p_org_update(".$caseid.")");
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$inc_card_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ //$sql="select * from v_case_invoice v
+ // where v.id=".$caseid." order by Charge_type,Adate ";
+
+ //$query = $this->db->query($sql);
+ //$data['showinvoice']= $query->result();
+
+ $sql="select * from v_case_invoice_1 v
+ where v.id=".$caseid." order by Charge_type,Adate ";
+ $query = $this->db->query($sql);
+ $data['showinvoice1']= $query->result();
+
+ $sql="select * from v_case_invoice_2 v
+ where v.id=".$caseid." order by Charge_type,Adate ";
+ $query = $this->db->query($sql);
+ $data['showinvoice2']= $query->result();
+
+ $this->load->view('Invoice/caseinvoice_ipd_V',$data);
+
+ }
+
+ public function ORG_info(){
+
+ $org_no = $this->input->post('input_org_no');
+
+ $sql="select * from organization_case_master
+ where case_type=0 and case_id_code='$org_no' ";
+ $query = $this->db->query($sql);
+ $data_org= $query->result();
+
+ if(count($data_org)>0)
+ {
+ $UHID=$data_org[0]->p_id;
+
+ $sql="select * from patient_master_exten where id='$UHID' ";
+ $query = $this->db->query($sql);
+ $data_person= $query->result();
+
+ $Patient_id=$data_person[0]->id;
+ $Patient_info=$data_person[0]->p_code.'/'.$data_person[0]->p_fname.' '.$data_person[0]->p_relative.' '.$data_person[0]->p_rname.' /Age :'.$data_person[0]->str_age;
+
+ $org_info=$Patient_info.'/'.$data_org[0]->insurance_company_name.
+ '/Reg.:'.$data_org[0]->insurance_no_1.'/Reg.Dt:'.$data_org[0]->date_registration;
+
+ $org_id=$data_org[0]->id;
+
+ }else{
+ $org_id=0;
+ $org_info='';
+
+ }
+
+ $rvar=array(
+ 'org_id' =>$org_id,
+ 'org_info'=>$org_info
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function update_itemrateqty()
+ {
+ $item_type_id=$this->input->post('item_type_id');
+ $item_id=$this->input->post('item_id');
+
+ $rate=$this->input->post('rate');
+ $orgcode=$this->input->post('orgcode');
+ $insurance_id=$this->input->post('insurance_id');
+ $master_item_id=$this->input->post('master_item_id');
+
+ $sql="select * from invoice_item
+ where id=".$item_id." ";
+ $query = $this->db->query($sql);
+ $invoice_item= $query->result();
+
+ $qty=0;
+
+ if(count($invoice_item)>0)
+ {
+ $qty=$invoice_item[0]->item_qty;
+ }
+
+ $this->load->model('invoice_M');
+
+ $amount_value=$qty * $rate;
+
+ $data['update_invoice_item'] = array(
+ 'item_qty' => $qty,
+ 'item_rate' => $rate,
+ 'item_amount' => $amount_value,
+ 'org_code' => $orgcode
+ );
+
+ $inser_id=$this->invoice_M->update_item( $data['update_invoice_item'],$item_id);
+
+ $this->load->model('item_M');
+
+ $data['update_insurance_item'] = array(
+ 'hc_items_id' => $master_item_id,
+ 'hc_insurance_id' => $insurance_id,
+ 'amount1' => $amount_value,
+ 'code' => $orgcode
+ );
+
+
+ $sql="select * from hc_items_insurance where hc_items_id=".$master_item_id." and hc_insurance_id=".$insurance_id;
+ $query = $this->db->query($sql);
+ $chkitem= $query->result();
+
+ if($insurance_id==2)
+ {
+ if(count($chkitem)>0 )
+ {
+ $insDone=$this->item_M->update_in_item( $data['update_insurance_item'],$chkitem[0]->id);
+ }else{
+ $insDone=$this->item_M->insert_in_item( $data['update_insurance_item']);
+ }
+ }
+
+
+ $sql="select * from invoice_item where id=".$item_id;
+ $query = $this->db->query($sql);
+ $data['invoiceitem']= $query->result();
+
+ $invoice_id=0;
+
+ if(count($data['invoiceitem'])>0)
+ {
+ $invoice_id=$data['invoiceitem'][0]->inv_master_id;
+ }
+
+ $sql="select i.*,t.group_desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select *,(case payment_mode when 1 Then 'Cash' when 2 then 'Bank Card' when 3 then 'IPD Credit' when 4 then 'Org. Credit' else 'Pending' end) as Payment_type_str from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $discount_amount=$data['invoice_master'][0]->discount_amount ;
+ $correction_amount=$data['invoice_master'][0]->correction_amount ;
+
+ $total_amount=$data['invoiceGtotal'][0]->Gtotal;
+ $net_amount=$total_amount-$discount_amount;
+ $net_amount=$net_amount-$correction_amount;
+ $balance_amount=$net_amount;
+
+ $dataupdate = array(
+ 'total_amount' => $total_amount,
+ 'net_amount' => $net_amount
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+
+ }
+
+ public function update_status()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Ocasemaster_M');
+
+ $case_id=$this->input->post('caseid');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from organization_case_master where id='".$case_id."'";
+ $query = $this->db->query($sql);
+ $case_master= $query->result();
+
+ $log=$case_master[0]->log.'\nUpdate Status:'.$this->input->post('status').'-Upd By:'.$user_name.'['.$user_id.']'.date('d/m/Y H:m:s');
+
+ $status=$this->input->post('status');
+
+ $org_submit_date= str_to_MysqlDate($this->input->post('org_submit_date'));
+
+ $data = array(
+ 'status'=> $status,
+ 'log'=>$log,
+ );
+
+ if($status==1)
+ {
+ $data['org_submit_date']=$org_submit_date;
+ }
+
+ $this->Ocasemaster_M->update( $data,$case_id);
+
+ }
+
+ public function org_contingent_update()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $htmldata=$this->input->post('HTMLData');
+ $case_id=$this->input->post('case_id');
+
+ $this->load->model('Ocasemaster_M');
+ $data['master'] = array(
+ 'contingent_bill' => $htmldata,
+ 'contingent_update_by' => $user_name
+ );
+
+ $case_id=$this->input->post('case_id');
+ $this->Ocasemaster_M->update($data['master'],$case_id);
+
+ $rvar=array(
+ 'update' =>'1',
+ 'msg' => 'Update Done '.$case_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function case_invoice_print($caseid)
+ {
+
+ $sql="select * from organization_case_master where id=".$caseid;
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $pno=$data['orgcase'][0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$inc_card_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select * from v_case_invoice v
+ where v.id=".$caseid." order by s_Date ";
+
+ $query = $this->db->query($sql);
+ $data['showinvoice']= $query->result();
+
+ $sql="select sum(amount) as GTotal from v_case_invoice v
+ where v.id=".$caseid." ";
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $this->load->view('Invoice/caseinvoice_V',$data);
+
+ }
+
+ public function getCaseTable()
+ {
+
+ $requestData= $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 =>'case_id_code',
+ 1 => 'Reg_No',
+ 2 => 'p_f_info',
+ 3 => 'date_registration',
+ 4=> 'insurance_card_name',
+ 5=> 'insurance_company_name',
+ 6=> 'str_status'
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "select c.id,c.p_id,c.case_id_code,Concat(c.insurance_no,'/',c.insurance_no_1) as Reg_No,
+ c.insurance_company_name,Concat(c.p_name,' ','[',p_code,if(i.id is null,'',concat('/',i.ipd_code)),']') as p_f_info,p.p_code,
+ c.date_registration,c.insurance_card_name,c.status,
+ (case c.status when 0 then 'Pending'
+ when 1 then 'Ready for submission'
+ when 2 then 'submitted' else 'Other' end) as str_status,c.insurance_id,
+ Date_Format(c.date_registration,'%d-%m-%Y') as date_registration_in ,i.ipd_code ";
+
+ $sql_count="Select count(*) as no_rec ";
+
+ $sql_from=" from ((organization_case_master c join patient_master p on c.p_id=p.id )
+ left join ipd_master i on c.id=i.case_id and p.id=i.p_id) ";
+
+ $total_sql=$sql_count.$sql_from;
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec']= $query->result();
+ $totalData=$data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where=" WHERE c.case_type=0 ";
+
+ $sql_where_flag=0;
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][0]['search']['value']) ){ //CaseCode-InsuranceCard-ClaimNo
+ $sql_where.=" AND case_id_code LIKE '%".$requestData['columns'][0]['search']['value']."' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][1]['search']['value']) ){ //p_code-P-Name
+ $sql_where.=" AND ( p.p_fname LIKE '%".$requestData['columns'][1]['search']['value']."%' ";
+ $sql_where.=" OR p.mphone1 LIKE '".$requestData['columns'][1]['search']['value']."' ";
+ $sql_where.=" OR i.ipd_code LIKE '%".$requestData['columns'][1]['search']['value']."' ";
+ $sql_where.=" OR p_code LIKE '%".$requestData['columns'][1]['search']['value']."' )";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][2]['search']['value']) ){ //insurance_card_name
+ $sql_where.=" AND c.insurance_card_name LIKE '%".$requestData['columns'][2]['search']['value']."%' ";
+ $sql_where_flag=1;
+ }
+
+ //if( !empty($requestData['columns'][3]['search']['value']) ){ //insurance_company_name
+ // $sql_where.=" AND insurance_company_name LIKE '%".$requestData['columns'][3]['search']['value']."%' ";
+ // $sql_where_flag=1;
+ //}
+
+ if( !empty($requestData['columns'][3]['search']['value'])){ //insurance_card_name
+
+ if($requestData['columns'][3]['search']['value'] < 0){
+ $sql_where.=" AND c.insurance_id not in (1,2,53,63) ";
+ $sql_where_flag=1;}
+
+ if($requestData['columns'][3]['search']['value']>0){
+ $sql_where.=" AND c.insurance_id = '".$requestData['columns'][3]['search']['value']."' ";
+ $sql_where_flag=1;}
+ }
+
+
+ if( !empty($requestData['columns'][4]['search']['value']) ){ //insurance_company_name
+ $sql_where.=" AND ( c.insurance_no LIKE '".$requestData['columns'][4]['search']['value']."%' ";
+ $sql_where.=" OR c.insurance_no_1 LIKE '".$requestData['columns'][4]['search']['value']."%' ) ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][5]['search']['value'])){ //insurance_card_name
+ $sql_where.=" AND c.status = '".$requestData['columns'][5]['search']['value']."' ";
+ $sql_where_flag=1;
+ }
+
+ $total_filer_sql=$sql_count.$sql_from.$sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered=$data['total_rec_filter'][0]->no_rec;
+
+ $sql_order=" group by c.id ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+ $Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata= $query->result_array();
+
+ $output = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach($rdata as $aRow)
+ {
+ $row = array();
+
+ foreach($columns as $col)
+ {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function contingent_bill($caseid,$print=0)
+ {
+ $sql="select * from organization_case_master where id='".$caseid."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $pno=$data['orgcase'][0]->p_id;
+ $caseid=$data['orgcase'][0]->id;
+ $claim_id=$data['orgcase'][0]->insurance_no_1;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$inc_card_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $content=$data['orgcase'][0]->contingent_bill;
+
+ if($print==1)
+ {
+ //echo $content;
+ $page_head="";
+
+ $content=$page_head.$content;
+ //create_report_pdf($content,'Report_1.pdf');
+ $this->load->library('m_pdf');
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ $this->load->view('Invoice/Org_Contingent_bill',$data);
+ }
+
+ }
+
+
+ public function create_contingent_bill($caseid)
+ {
+ $sql="select * from organization_case_master where id='".$caseid."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ $pno=$data['orgcase'][0]->p_id;
+ $caseid=$data['orgcase'][0]->id;
+ $claim_id=$data['orgcase'][0]->insurance_no_1;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $ins_comp_id=$data['orgcase'][0]->insurance_id;
+ $inc_card_id=$data['orgcase'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$inc_card_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select * from v_case_invoice v
+ where v.id=".$caseid." order by Charge_type,Adate ";
+
+ $query = $this->db->query($sql);
+ $data['showinvoice']= $query->result();
+
+ $sql="select sum(amount) as GTotal from v_case_invoice v
+ where v.id=".$caseid." ";
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $content="";
+
+
+ $content.='CLAIM ID : '.$claim_id.' ';
+ $content.="Name of Hospital : ".H_Name."
";
+
+ $content.='CONTINGENT BILL ';
+
+ $content.='';
+ $content.='Voucher No. ______________________________ Date : ……………………… ';
+ $content.='Amount of allotment : Rs.…………………………… ';
+ $content.='Amount expended and for which bills have already been submitted for payment : Rs.…………………………… ';
+ $content.='Balance of allotment excliding the amount of this bills : Rs.…………………………… ';
+ $content.='
';
+ $content.='Expenditure an account of : Treatment/ Super Treatment/ Special investigation / Consultant fee
';
+
+ $content.='';
+ $content.='';
+ $content.='In respect ofName of Patient: '.strtoupper($data['orgcase'][0]->p_name).' ';
+ $content.='Relation : '.strtoupper($data['orgcase'][0]->relation_with_cardholder).' ';
+ $content.='Service No.: '.strtoupper($data['orgcase'][0]->insurance_no_2).' ';
+ $content.=' ';
+
+ $content.='';
+ $content.="ESM Name : ".strtoupper($data['orgcase'][0]->insurance_card_name).' ';
+ $content.="ECHS CARD No. : ".strtoupper($data['orgcase'][0]->insurance_no).' ';
+ $content.="Rank : ".strtoupper($data['orgcase'][0]->card_remark).' ';
+ $content.=' ';
+ $content.='
';
+
+ $content.='Authority: ';
+ $content.='Government of India letter No. 24 (3)/03/US/(WE)/D (Res) (i) dated 08 Sep 2003 ';
+ $content.='Government of India letter No. 24 (8)/03/US/(WE)/D (Res) dated 19 Dec 2003 ';
+ $content.='Central Organization ECHS Letter NoB/49773/AG/ECHS dated 25 May 2004.
';
+
+ $sql='select c.id,c.case_id_code,c.p_id,sum(o.opd_fee_amount) as tamount,
+ count(o.opd_id) as item_qty,Min(o.opd_fee_amount) as rate
+ from opd_master o join organization_case_master c on o.insurance_case_id=c.id
+ where opd_status in (1,2) and id='.$caseid.' group by c.id';
+
+ $query = $this->db->query($sql);
+ $opd= $query->result();
+
+ $sql="select i.item_type,t.`desc` AS item_name,sum(i.item_amount) as tamount,sum(i.item_qty) as unit,i.item_rate
+ from invoice_master m join invoice_item i join hc_item_type t
+ on m.id=i.inv_master_id and i.item_type=t.itype_id
+ where item_type=34 and m.ipd_include=1 and invoice_status=1 and
+ insurance_case_id=$caseid
+ group by i.item_type";
+ $query = $this->db->query($sql);
+ $data['invoice_list_1']= $query->result();
+
+ $sql="select i.item_type,t.`desc` AS item_name,sum(i.item_amount) as tamount,sum(i.item_qty) as unit,i.item_rate
+ from invoice_master m join invoice_item i join hc_item_type t
+ on m.id=i.inv_master_id and i.item_type=t.itype_id
+ where item_type not in (34,35) and m.ipd_include=1 and invoice_status=1 and
+ insurance_case_id=$caseid
+ group by i.item_type";
+ $query = $this->db->query($sql);
+ $data['invoice_list_2']= $query->result();
+
+ $sql="select i.item_type,t.`desc` AS item_name,sum(i.item_amount) as tamount,sum(i.item_qty) as unit,i.item_rate
+ from invoice_master m join invoice_item i join hc_item_type t
+ on m.id=i.inv_master_id and i.item_type=t.itype_id
+ where item_type=35 and m.ipd_include=1 and invoice_status=1 and
+ insurance_case_id=$caseid
+ group by i.item_type";
+ $query = $this->db->query($sql);
+ $data['invoice_list_3']= $query->result();
+
+ $sql="select i.item_type,i.item_name,t.group_desc,sum(i.item_amount) as tamount,sum(i.item_qty) as unit,
+ i.item_rate
+ FROM (ipd_master m join ipd_invoice_item i on m.id=i.ipd_id)
+ join ipd_item_type t ON i.item_type=t.itype_id
+ and i.item_type=t.itype_id
+ WHERE i.package_id=0 and t.itype_id=2 AND m.case_id=$caseid
+ group by i.item_type";
+ $query = $this->db->query($sql);
+ $data['ipd_invoice_list_1']= $query->result();
+
+ $sql="select i.item_type,i.item_name,t.group_desc,sum(i.item_amount) as tamount,sum(i.item_qty) as unit,
+ i.item_rate
+ FROM (ipd_master m join ipd_invoice_item i on m.id=i.ipd_id)
+ join ipd_item_type t ON i.item_type=t.itype_id
+ and i.item_type=t.itype_id
+ WHERE i.package_id=0 and t.itype_id not in (2,6) AND m.case_id=$caseid
+ group by i.item_type";
+ $query = $this->db->query($sql);
+ $data['ipd_invoice_list_2']= $query->result();
+
+ $sql="select i.item_type,i.item_name,t.group_desc,sum(i.item_amount) as tamount,sum(i.item_qty) as unit,
+ i.item_rate
+ FROM (ipd_master m join ipd_invoice_item i on m.id=i.ipd_id)
+ join ipd_item_type t ON i.item_type=t.itype_id
+ and i.item_type=t.itype_id
+ WHERE i.package_id=0 and t.itype_id=6 AND m.case_id=$caseid
+ group by i.item_type";
+ $query = $this->db->query($sql);
+ $data['ipd_invoice_list_3']= $query->result();
+
+ $sql="select sum(m.net_amount) as Med_Amount,o.id ,count(m.id) as no_inv
+ from invoice_med_master m join ipd_master p join organization_case_master o
+ on m.ipd_id=p.id and p.case_id=o.id and m.ipd_credit=1 and m.ipd_credit_type=1
+ where o.id=".$caseid." group by o.id ";
+ $query = $this->db->query($sql);
+ $data['MedInvoice']= $query->result();
+
+ $sql="SELECT p.*
+ FROM ipd_package p JOIN ipd_master m ON p.ipd_id=m.id
+ WHERE m.case_id=$caseid";
+ $query = $this->db->query($sql);
+ $data['ipd_package']= $query->result();
+
+
+ if(count($data['MedInvoice'])==0)
+ {
+ $sql="select sum(m.net_amount) as Med_Amount,o.id ,count(m.id) as no_inv
+ from invoice_med_master m join organization_case_master o
+ on m.case_id=o.id and m.case_credit=1
+ where o.id=".$caseid." group by o.id ";
+
+ $query = $this->db->query($sql);
+ $data['MedInvoice']= $query->result();
+ }
+
+ $sql="select p.* from ipd_master p join organization_case_master o
+ on p.case_id=o.id where o.id=". $caseid;
+ $query = $this->db->query($sql);
+ $IPDMaster= $query->result();
+
+ $tableHead='
+
+ Sr.No.
+ Date
+ Details of Expenditure
+ Number or Quantity
+ Rate
+ Per
+ Amount
+ ';
+ $tbody="";
+ $srno=0;
+ $total_gross_bill=0.00;
+
+ if(count($opd)>0)
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' OPD
+ '.$opd[0]->rate.' '.$opd[0]->item_qty.'
+ '.$opd[0]->rate.' CGHS '.$opd[0]->tamount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$opd[0]->tamount;
+ }
+
+ foreach($data['ipd_package'] as $row)
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' Package :'.$row->package_name.'
+ '.$row->package_Amount.' 1 '.$row->package_Amount.' CGHS '.$row->package_Amount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$row->package_Amount;
+ }
+
+ foreach($data['invoice_list_1'] as $row)
+ {
+ if($row->item_type<>'')
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' '.$row->item_name.'
+ '.$row->item_rate.' '.$row->unit.' '.$row->item_rate.' CGHS '.$row->tamount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$row->tamount;
+ }
+ }
+
+ foreach($data['ipd_invoice_list_1'] as $row)
+ {
+ if($row->item_type<>'')
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' '.$row->item_name.'
+ '.$row->item_rate.' '.$row->unit.' '.$row->item_rate.' CGHS '.$row->tamount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$row->tamount;
+ }
+ }
+
+ foreach($data['invoice_list_2'] as $row)
+ {
+ if($row->item_type<>'')
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' '.$row->item_name.'
+ '.$row->item_rate.' '.$row->unit.' '.$row->item_rate.' CGHS '.$row->tamount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$row->tamount;
+ }
+ }
+
+ foreach($data['ipd_invoice_list_2'] as $row)
+ {
+ if($row->item_type<>'')
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' '.$row->item_name.'
+ '.$row->item_rate.' '.$row->unit.' '.$row->item_rate.' CGHS '.$row->tamount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$row->tamount;
+ }
+ }
+
+ foreach($data['invoice_list_3'] as $row)
+ {
+ if($row->item_type<>'')
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' '.$row->item_name.'
+ '.$row->item_rate.' '.$row->unit.' '.$row->item_rate.' CGHS '.$row->tamount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$row->tamount;
+ }
+ }
+
+ foreach($data['ipd_invoice_list_3'] as $row)
+ {
+ if($row->item_type<>'')
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' '.$row->item_name.'
+ '.$row->item_rate.' '.$row->unit.' '.$row->item_rate.' CGHS '.$row->tamount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$row->tamount;
+ }
+ }
+
+
+
+ foreach($data['ipd_invoice_list_2'] as $row)
+ {
+ if($row->item_type<>'')
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' '.$row->item_name.'
+ '.$row->item_rate.' '.$row->unit.' '.$row->item_rate.' CGHS '.$row->tamount.' ';
+ $tbody.=" ";
+ $total_gross_bill=$total_gross_bill+$row->tamount;
+ }
+ }
+
+ if(count($data['MedInvoice'])>0)
+ {
+ $srno=$srno+1;
+ $tbody.='';
+ $tbody.=''.$srno.' '.date('Y-m-d').' Medicine
+ '.$data['MedInvoice'][0]->Med_Amount.' '.$data['MedInvoice'][0]->no_inv.'
+ '.$data['MedInvoice'][0]->Med_Amount.' '.$data['MedInvoice'][0]->Med_Amount.' ';
+ $tbody.=' ';
+ $total_gross_bill=$total_gross_bill+$data['MedInvoice'][0]->Med_Amount;
+ }
+
+ $tbody.='Gross Total '.Round($total_gross_bill,0).' ';
+
+ if(count($IPDMaster)>0)
+ {
+ if($IPDMaster[0]->chargeamount1>0)
+ {
+ $tbody.='';
+ $tbody.=''.$IPDMaster[0]->charge1.'
+ '.$IPDMaster[0]->chargeamount1.' ';
+ $tbody.=' ';
+ $total_gross_bill=$total_gross_bill+$IPDMaster[0]->chargeamount1;
+ }
+
+ if($IPDMaster[0]->chargeamount2>0)
+ {
+ $tbody.='';
+ $tbody.=''.$IPDMaster[0]->charge2.'
+ '.$IPDMaster[0]->chargeamount2.' ';
+ $tbody.=' ';
+ $total_gross_bill=$total_gross_bill+$IPDMaster[0]->chargeamount2;
+ }
+
+ if($IPDMaster[0]->Discount>0)
+ {
+ $tbody.='';
+ $tbody.=''.$IPDMaster[0]->Discount_Remark.'
+ '.$IPDMaster[0]->Discount.' ';
+ $tbody.=' ';
+ $total_gross_bill=$total_gross_bill-$IPDMaster[0]->Discount;
+ }
+
+ if($IPDMaster[0]->Discount2>0)
+ {
+ $tbody.='';
+ $tbody.=''.$IPDMaster[0]->Discount_Remark2.'
+ '.$IPDMaster[0]->Discount3.' ';
+ $tbody.=' ';
+ $total_gross_bill=$total_gross_bill-$IPDMaster[0]->Discount2;
+ }
+
+ if($IPDMaster[0]->Discount3>0)
+ {
+ $tbody.='';
+ $tbody.=''.$IPDMaster[0]->Discount_Remark3.'
+ '.$IPDMaster[0]->Discount3.' ';
+ $tbody.=' ';
+ $total_gross_bill=$total_gross_bill-$IPDMaster[0]->Discount3;
+ }
+
+ }
+
+ $tableFooter="";
+ $tableFooter.='Net Total '.Round($total_gross_bill,0).' ';
+
+ $tableFooter.="
";
+
+ $content.=$tableHead.$tbody.$tableFooter;
+
+ $content.="Net Amount due(In words) : Rs. ".number_to_word(Round($total_gross_bill,0))."
";
+
+ $content.=" Date : ...................... Pre Received Payment ";
+ $content.=" From : ...................... .....................
";
+
+ $content.='Certified that ';
+ $content.='
Certified that above have been claimed on the basis of approved charges as noted in MOA signed for the treatment of ECHS member. ';
+ $content.='The rate is/are fair and reasonable and less than CGHS rates ';
+ $content.='The expenditure incurred is debatable to major Head 2076 Minor head 107, Sub Head E-Medical treatment related expenditure code head 365/00. ';
+ $content.='The expenditure has been incurred the interest of Ex-Serviceman ';
+
+ $content.='Vetted and Recommended / Not Recommended Sig of OIC ECHS Polyclinic ';
+ $content.=' Date : ...................... Place: ...........................................
';
+
+ $dataupdate = array(
+ 'contingent_bill' => $content
+ );
+
+ $this->load->model('Ocasemaster_M');
+ $this->Ocasemaster_M->update($dataupdate,$caseid);
+
+ $sql="select * from organization_case_master where id='".$caseid."'";
+ $query = $this->db->query($sql);
+ $data['orgcase']= $query->result();
+
+ echo 'Created';
+
+ //create_report_pdf($content,'Report_1.pdf');
+
+ }
+
+ public function org_confirm_payment()
+ {
+ $amount_r=$this->input->post('amount_r');
+ $amount_d=$this->input->post('amount_d');
+ $amount_claim=$this->input->post('amount_claim');
+ $amount_tds=$this->input->post('amount_tds');
+ $date_payment=str_to_MysqlDate($this->input->post('date_payment'));
+ $pay_info=$this->input->post('pay_info');
+ $org_id=$this->input->post('org_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $this->load->model('Ocasemaster_M');
+
+ $data= array(
+ 'pay_date_received' => $date_payment,
+ 'amount_recived' => $amount_r,
+ 'amount_deduction' => $amount_d,
+ 'amount_claim' => $amount_claim,
+ 'amount_tds' => $amount_tds,
+ 'amount_payment_info' => $pay_info,
+ 'status' => '3',
+ 'amount_update_by' => $user_name
+ );
+
+ $this->Ocasemaster_M->update( $data,$org_id);
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>'Update'
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+
+ public function org_payment_request()
+ {
+ $sql="select * from org_payment_request ";
+ $query = $this->db->query($sql);
+ $data['org_info']= $query->result();
+
+ $sql="select * from v_ipd_list where org_id='".$data['org_info'][0]->id."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) as str_age from patient_master where id='".$data['org_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $this->load->view('Invoice/org_case_payment',$data);
+ }
+
+ public function load_model_box($caseidcode)
+ {
+ $sql="select * from organization_case_master where case_id_code='".$caseidcode."' ";
+ $query = $this->db->query($sql);
+ $data['org_info']= $query->result();
+
+ $sql="select * from v_ipd_list where org_id='".$data['org_info'][0]->id."' ";
+ $query = $this->db->query($sql);
+ $data['ipd_info']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) as str_age from patient_master where id='".$data['org_info'][0]->p_id."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ $this->load->view('Invoice/org_case_payment',$data);
+ }
+
+ public function payment_request()
+ {
+ $input_pay_amount=$this->input->post('input_pay_amount');
+ $caseidcode=$this->input->post('caseid');
+ $input_remark=$this->input->post('input_remark');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $sql="select * from organization_case_master where id='".$caseidcode."' ";
+ $query = $this->db->query($sql);
+ $org_info= $query->result();
+
+ $sql="select * from org_payment_request where payment_process=0 and org_id='".$caseidcode."' ";
+ $query = $this->db->query($sql);
+ $org_payment_request= $query->result();
+
+ $patient_id=0;
+ $org_date=date('Y-m-d H:i:s');
+
+ if(count($org_info)>0)
+ {
+ $patient_id=$org_info[0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) as str_age from patient_master where id='".$patient_id."' ";
+ $query = $this->db->query($sql);
+ $person_info= $query->result();
+
+ $org_date=$org_info[0]->insert_datetime;
+ $patient_name=$person_info[0]->p_fname;
+
+ $org_code=$org_info[0]->case_id_code;
+ }
+
+ $paydata = array(
+ 'org_id'=> $caseidcode,
+ 'org_code'=>$org_code,
+ 'patient_id'=>$patient_id,
+ 'org_date'=>$org_date,
+ 'patient_name'=>$patient_name,
+ 'payment_amount'=>$input_pay_amount,
+ 'payment_request_datetime'=>date('Y-m-d H:i:s'),
+ 'request_by_id'=>$user_id,
+ 'request_by'=>$user_name,
+ 'remark'=>$input_remark,
+ );
+
+ $this->load->model('Payment_M');
+
+ if(count($org_payment_request)<1)
+ {
+ $insert_id=$this->Payment_M->insert_org_payment($paydata);
+ }else{
+ $this->Payment_M->update_org_payment($paydata,$org_payment_request[0]->id);
+ $insert_id=$org_payment_request[0]->id;
+ }
+
+ echo 'Request has been Created : Req. ID -> '.$insert_id;
+ }
+
+
+ public function refund_request()
+ {
+ $input_refund_amount=$this->input->post('input_refund_amount');
+ $caseidcode=$this->input->post('caseid');
+ $input_remark=$this->input->post('input_refund_remark');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $sql="select * from organization_case_master where id='".$caseidcode."' ";
+ $query = $this->db->query($sql);
+ $org_info= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=3 and refund_type_id=$caseidcode";
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ $patient_id=0;
+ $org_date=date('Y-m-d H:i:s');
+
+ if(count($org_info)>0)
+ {
+ $patient_id=$org_info[0]->p_id;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) as str_age from patient_master where id='".$patient_id."' ";
+ $query = $this->db->query($sql);
+ $person_info= $query->result();
+
+ $org_date=$org_info[0]->insert_datetime;
+ $patient_name=$person_info[0]->p_fname;
+
+ $org_code=$org_info[0]->case_id_code;
+ }
+
+ $RefundRequest = array(
+ 'refund_type' => 3,
+ 'refund_type_id' => $caseidcode,
+ 'refund_type_code' => $org_code,
+ 'refund_type_reason' => $input_remark,
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $input_refund_amount,
+ 'patient_id' => $patient_id,
+ 'patient_name' =>$patient_name
+ );
+
+ $this->load->model('Payment_M');
+
+ if(count($refund_order)<1)
+ {
+ $insert_id=$this->Payment_M->insert_refundorder($RefundRequest);
+ echo 'Refund Request has been Created : Req. ID -> '.$insert_id;
+ }else{
+ echo 'Refund Request Pending, Please Refund or Cancel Last Refund Request';
+ }
+
+ }
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Package.php b/old_code_ci3/controllers/Package.php
new file mode 100644
index 0000000..d186a93
--- /dev/null
+++ b/old_code_ci3/controllers/Package.php
@@ -0,0 +1,342 @@
+db->query($sql);
+ $data['data'] = $query->result();
+
+ $this->load->view('IPD_Package/item_type_search_v', $data);
+ }
+
+ public function search_adv($itype_id = 1)
+ {
+
+ $sql = "SELECT * FROM package where pakage_group_id=" . $itype_id;
+ $query = $this->db->query($sql);
+ $data = $query->result();
+ echo ' Print ';
+
+ echo '
+
+
+ Package Name
+ Amount
+
+
+
+ ';
+ if (count($data) > 0) {
+ for ($i = 0; $i < count($data); ++$i) {
+ echo '
+ ' . $data[$i]->ipd_pakage_name . '
+ ' . $data[$i]->Pakage_Min_Amount . '
+
+ Edit It....
+
+ ';
+ }
+ }
+
+ echo '
+
+
+ Package Name
+ Amount
+
+
+
+
';
+ echo "";
+ }
+
+ public function search()
+ {
+ $sql = "SELECT * FROM package_group order by pakage_group_name";
+ $query = $this->db->query($sql);
+ $data['package_group'] = $query->result();
+
+ $sql = "SELECT * FROM package where pakage_group_id=1";
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $this->load->view('IPD_Package/item_search_V', $data);
+ }
+
+
+ public function search_ipd()
+ {
+ $sql = "SELECT * FROM ipd_item_type order by group_desc";
+ $query = $this->db->query($sql);
+ $data['labitemtype'] = $query->result();
+
+ $sql = "SELECT * FROM ipd_items where itype=1";
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $this->load->view('IPD_Package/item_search_V', $data);
+ }
+
+ public function search_print($itype_id = 1)
+ {
+
+ $sql = "SELECT * FROM v_hc_items where itype=" . $itype_id . " order by group_desc";
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $this->load->view('IPD_Package/item_item_list', $data);
+ }
+
+ function itemtype_record($id)
+ {
+ $sql = "SELECT *,(case is_ipd_opd when 0 then 'OPD-IPD' when 1 then 'OPD' when 2 then 'IPD' end) as isIPD_OPD
+ FROM hc_item_type where itype_id='" . $id . "' order by group_desc";
+ $query = $this->db->query($sql);
+ $data['data_item'] = $query->result();
+
+ $this->load->view('IPD_Package/item_type_profile', $data);
+ }
+
+ function item_record($id)
+ {
+
+ $sql = "select * from package where id=" . $id;
+ $query = $this->db->query($sql);
+ $data['data_item'] = $query->result();
+
+ $sql = "select * from v_insurance_package_list where c_item_id=$id";
+ $query = $this->db->query($sql);
+ $data['data_insurance_item'] = $query->result();
+
+ $sql = "select * from hc_insurance where id>1";
+ $query = $this->db->query($sql);
+ $data['data_insurance'] = $query->result();
+
+ $this->load->view('IPD_Package/item_profile_V', $data);
+ }
+
+ public function UpdateRecord()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Package_M');
+
+ $data = array(
+ 'ipd_pakage_name' => $this->input->post('input_Package_name'),
+ 'Pakage_description' => $this->input->post('input_Pakage_description'),
+ 'Pakage_Min_Amount' => $this->input->post('input_Pakage_Min_Amount'),
+ 'update_by' => date('Y-m-d H:i:s')
+ );
+ $old_id = $this->input->post('p_id');
+ $update = $this->Package_M->update($data, $old_id);
+
+ if ($update > 0) {
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => Show_Alert('success', 'Saved', 'Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function AddRecord()
+ {
+ $sql = "select * from package_group";
+ $query = $this->db->query($sql);
+ $data['data_item_type'] = $query->result();
+
+ $this->load->view('IPD_Package/item_create_V', $data);
+ }
+
+
+ public function AddItemTypeRecord()
+ {
+ $this->load->view('IPD_Package/item_type_create');
+ }
+
+ public function CreateRecord()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Package_M');
+ $data = array(
+ 'pakage_group_id' => $this->input->post('Item_Type'),
+ 'ipd_pakage_name' => $this->input->post('input_Item_name'),
+ 'Pakage_Min_Amount' => $this->input->post('input_amount'),
+ 'update_date' => date('Y-m-d H:i:s'),
+
+ );
+
+ $inser_id = $this->Package_M->insert($data);
+
+ if ($inser_id > 0) {
+
+ $rvar = array(
+ 'insertid' => $inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function AddInsuranceItemRecord()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Package_M');
+ $data = array(
+ 'hc_items_id' => $this->input->post('p_id'),
+ 'hc_insurance_id' => $this->input->post('ins_company_name'),
+ 'i_amount' => $this->input->post('input_amount'),
+ 'code' => $this->input->post('input_item_code')
+ );
+
+ $inser_id = $this->Package_M->insert_in_item($data);
+
+ if ($inser_id > 0) {
+ $sql = "select * from v_insurance_package_list where c_item_id=" . $this->input->post('p_id');
+ $query = $this->db->query($sql);
+ $data_insurance_item = $query->result();
+
+ echo '
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($data_insurance_item); ++$i) {
+ echo '
+ ' . $data_insurance_item[$i]->ins_company_name . '
+ ' . $data_insurance_item[$i]->i_amount . '
+ ' . $data_insurance_item[$i]->code . '
+ Delete
+ ';
+ }
+ echo '
';
+ }
+ }
+
+ public function remove_record_item()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Package_M');
+ $data = array(
+ 'isdelete' => $this->input->post('in_remove_id')
+ );
+
+ $inser_id = $this->Package_M->delete_in_item($data, $this->input->post('in_remove_id'));
+
+ if ($inser_id > 0) {
+ $sql = "select * from v_insurance_item_list where c_item_id=" . $this->input->post('p_id');
+ $query = $this->db->query($sql);
+ $data_insurance_item = $query->result();
+
+ echo '
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+ ';
+ for ($i = 0; $i < count($data_insurance_item); ++$i) {
+ echo '
+ ' . $data_insurance_item[$i]->ins_company_name . '
+ ' . $data_insurance_item[$i]->i_amount . '
+ ' . $data_insurance_item[$i]->code . '
+ Delete
+ ';
+ }
+ echo '
';
+ }
+ }
+
+
+ public function _render_page($view, $data = null, $returnhtml = false) //I think this makes more sense
+ {
+
+ $this->viewdata = (empty($data)) ? $this->data : $data;
+
+ $view_html = $this->load->view($view, $this->viewdata, $returnhtml);
+
+ if ($returnhtml) return $view_html; //This will return html on 3rd argument being true
+ }
+
+
+ public function CreateItemTypeRecord()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Package_M');
+ $data = array(
+ 'is_ipd_opd' => $this->input->post('Item_Type_ipd'),
+ 'group_desc' => $this->input->post('input_Item_type')
+ );
+
+ $inser_id = $this->Package_M->insert_type($data);
+
+ if ($inser_id > 0) {
+
+ $rvar = array(
+ 'insertid' => $inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function UpdateItemTypeRecord()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $this->load->model('Package_M');
+
+ $data = array(
+ 'is_ipd_opd' => $this->input->post('Item_Type_ipd'),
+ 'group_desc' => $this->input->post('input_Item_type')
+ );
+
+ $old_id = $this->input->post('itemtype_id');
+ $update = $this->Package_M->update_type($data, $old_id);
+
+ if ($update > 0) {
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => Show_Alert('success', 'Saved', 'Data Saved successfully')
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+}
diff --git a/old_code_ci3/controllers/PathLab.php b/old_code_ci3/controllers/PathLab.php
new file mode 100644
index 0000000..a60011e
--- /dev/null
+++ b/old_code_ci3/controllers/PathLab.php
@@ -0,0 +1,1354 @@
+input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('Invoice_M');
+ $this->load->model('Payment_M');
+
+ $invoice_id=$this->input->post('invoice_id');
+
+ $sql="select * from invoice_master where id='".$invoice_id."'";
+ $query = $this->db->query($sql);
+ $inv_master= $query->result();
+
+ $sql="select sum(if(credit_debit=0,amount,amount*-1)) as tPayment
+ from payment_history where payof_type=2 and payof_id='".$invoice_id."'";
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $TotPaymentR=0;
+
+ if(count($payment_history)>0)
+ {
+ $TotPaymentR=$payment_history[0]->tPayment;
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $pay_remark='';
+
+ if($inv_master[0]->discount_amount>0)
+ {
+ $pay_remark='Dis.Amt.:'.$inv_master[0]->discount_desc.' /Amount: '. $inv_master[0]->discount_amount.'/Update:'.$inv_master[0]->disc_update_by;
+ }
+
+ $amountpaid=$this->input->post('input_amount_paid');
+ $bank_id=$this->input->post('cbo_pay_type');
+
+ if($amountpaid<0){
+ $amountpaid=$amountpaid*-1;
+ }
+
+ $amountbalanace=0.00;
+
+ if($amountpaid < $inv_master[0]->net_amount );
+ {
+ $amountbalanace=$inv_master[0]->net_amount-$TotPaymentR;
+ }
+
+ if($this->input->post('mode')==1)
+ {
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'payof_type'=>'2',
+ 'payof_id'=>$invoice_id,
+ 'payof_code'=>$inv_master[0]->invoice_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$amountpaid,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'update_by_id'=>$user_id
+ );
+
+ if($amountpaid<=$amountbalanace)
+ {
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '1',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'payment_id'=>$insert_id,
+ 'payment_mode_desc'=>'Cash',
+ 'confirm_invoice'=>date('Y-m-d H:i:s'),
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Invoice_M->update( $data,$invoice_id);
+ }
+
+ $status='CASH';
+ $showcontent=$status;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+ }
+
+ if($this->input->post('mode')==2)
+ {
+ $FormRules = array(
+ array(
+ 'field' => 'input_card_tran',
+ 'label' => 'Card Transcation ID',
+ 'rules' => 'required|min_length[3]|max_length[15]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'payof_type'=>'2',
+ 'payof_id'=>$invoice_id,
+ 'payof_code'=>$inv_master[0]->invoice_code,
+ 'credit_debit'=>'0',
+ 'amount'=>$amountpaid,
+ 'payment_date'=>date('Y-m-d H:i:s'),
+ 'remark'=>$pay_remark,
+ 'update_by'=>$user_name.'['.$user_id.']',
+ 'pay_bank_id'=>$this->input->post('cbo_pay_type'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'update_by_id'=>$user_id
+ );
+
+ if($amountpaid<=$amountbalanace)
+ {
+ $insert_id=$this->Payment_M->insert($paydata);
+
+ $data = array(
+ 'payment_mode'=> '2',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'payment_mode_desc'=>'Bank Card/Online',
+ 'confirm_invoice'=>date('Y-m-d H:i:s'),
+ 'payment_id'=>$insert_id,
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'cust_card'=>$this->input->post('input_card_bank'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Invoice_M->update( $data,$invoice_id);
+ }
+
+
+
+ $status='Bank Card';
+ $showcontent=$status;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+ $encode_data = json_encode($rvar);
+
+ }
+ else{
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+
+ $encode_data = json_encode($rvar);
+ }
+ }
+
+ if($this->input->post('mode')==3)
+ {
+ $data = array(
+ 'payment_mode'=> '3',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'confirm_invoice'=>date('Y-m-d H:i:s'),
+ 'payment_mode_desc'=>'IPD Credit',
+ 'ipd_id'=>$this->input->post('ipd_id'),
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Invoice_M->update( $data,$invoice_id);
+
+ $sql="select * from ipd_master where id=".$this->input->post('ipd_id');
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ if(count($ipd_master)>0)
+ {
+ $data = array(
+ 'insurance_case_id'=>$ipd_master[0]->case_id
+ );
+
+ $this->Invoice_M->update( $data,$invoice_id);
+
+ }
+ $status='IPD Credit';
+
+ $rvar=array(
+ 'update' =>1
+ );
+
+ $encode_data = json_encode($rvar);
+ }
+
+ if($this->input->post('mode')==4)
+ {
+ $data = array(
+ 'payment_mode'=> '4',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'payment_mode_desc'=>'Org.Case Credit',
+ 'confirm_invoice'=>date('Y-m-d H:i:s'),
+ 'insurance_case_id'=>$this->input->post('case_id'),
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Invoice_M->update($data,$invoice_id);
+
+ $status='Org. Credit';
+
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$status
+ );
+
+ $encode_data = json_encode($rvar);
+
+ }
+
+ if($this->input->post('mode')==5)
+ {
+ $data = array(
+ 'payment_mode'=> '1',
+ 'payment_status'=>'1',
+ 'invoice_status'=>'1',
+ 'payment_id'=>'0',
+ 'payment_mode_desc'=>'Zero Amount',
+ 'confirm_invoice'=>date('Y-m-d H:i:s'),
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id
+ );
+
+ $this->Invoice_M->update( $data,$invoice_id);
+
+ $status='Zero Amount';
+ $showcontent=$status;
+
+ $rvar=array(
+ 'update' =>1,
+ 'showcontent'=>$showcontent
+ );
+
+ $encode_data = json_encode($rvar);
+
+ }
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update_invoice_final($invoice_id);
+
+
+ echo $encode_data;
+ }
+
+ public function IPD_Invoice_Edit($Invoice_ID)
+ {
+ $sql="select * from invoice_master where id=".$Invoice_ID;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster']= $query->result();
+
+ $sql="select i.*,t.group_desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$Invoice_ID;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$Invoice_ID;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $pno=$data['invoiceMaster'][0]->attach_id;
+ $ipd_no=$data['invoiceMaster'][0]->ipd_id;
+ $ins_id=$data['invoiceMaster'][0]->insurance_card_id;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ if($ins_id>0)
+ {
+ $sql="select * from hc_item_type order by group_desc";
+ }else{
+ $sql="select * from hc_item_type where itype_id<>33 order by group_desc ";
+ }
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $path_cash=1;
+ $path_credit=1;
+
+ $ins_comp_id=0;
+ if($ins_id>0)
+ {
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $ins_comp_id=$data['hc_insurance_card'][0]->insurance_id;
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $path_cash=$data['insurance'][0]->path_cash;
+ $path_credit=$data['insurance'][0]->path_credit;
+ }
+
+ $data['pdata']=$ins_comp_id;
+
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ if($ins_comp_id<2)
+ {
+ $sql="select id,Concat(idesc,' : {',amount,'}') as sdesc from hc_items where itype=1 order by idesc ";
+ }else{
+ $sql="select m.id,m.itype,m.idesc,m.amount,t.itype_id,t.is_ipd_opd,t.group_desc,
+ i.hc_insurance_id ,if(i.hc_insurance_id is null,m.amount,i.amount1) as amount1,
+ Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (hc_items m join hc_item_type t on m.itype=t.itype_id)
+ left join
+ (select * from hc_items_insurance where hc_insurance_id=".$ins_comp_id." and isdelete=0 ) as i on m.id=i.hc_items_id
+ where itype_id=1 order by m.idesc";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ $this->load->model('invoice_M');
+
+ $today = date("Y-m-d");
+ $expire = $data['invoiceMaster'][0]->inv_date; //from db
+
+ $today_dt = new DateTime($today);
+ $inv_dt = new DateTime($expire);
+
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days
+ from ipd_master where id=".$data['invoiceMaster'][0]->ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ if(count($data['ipd_master'])>0)
+ {
+ if($data['ipd_master'][0]->ipd_status==0)
+ {
+ $ipd_status=0;
+ }else{
+ $ipd_status=1;
+ }
+ }else{
+ $ipd_status=1;
+ }
+
+ if($this->ion_auth->in_group('ChargeInvoiceUpdate') || ($ipd_status==0 && $this->ion_auth->in_group('IPDPayment') ))
+ {
+ $this->load->view('Invoice_PathLab',$data);
+ }else{
+
+ }
+
+ //$this->load->view('Invoice_ipd_credit',$data);
+ }
+
+
+ public function addPathTest($pno,$ins_id=0,$opd_id=0)
+ {
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+ $query = $this->db->query($sql);
+ $data['person_info']= $query->result();
+
+ if($opd_id>0)
+ {
+ $sql="select * from opd_master where p_id='".$pno."' and opd_id=".$opd_id." order by opd_id desc limit 1";
+ }else{
+ $sql="select * from opd_master where p_id='".$pno."' order by opd_id desc limit 1";
+ }
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ if(count($data['opd_master'])>0)
+ {
+ $select_doc=$data['opd_master'][0]->doc_id;
+ $opd_code=$data['opd_master'][0]->opd_code;
+ }else{
+ $select_doc=0;
+ $opd_code='';
+ }
+
+ $sql="select l.doc_id from ipd_master p join ipd_master_doc_list l on p.id=l.ipd_id
+ where p.ipd_status=0 and p.p_id=".$pno." ";
+ $query = $this->db->query($sql);
+ $data['ipd_master_docid']= $query->result();
+
+ if(count($data['ipd_master_docid'])>0)
+ {
+ $select_doc=$data['ipd_master_docid'][0]->doc_id;
+ }
+
+ if($ins_id>0)
+ {
+ $sql="select * from hc_item_type order by group_desc";
+ }else{
+ $sql="select * from hc_item_type where itype_id<>33 order by group_desc";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitemtype']= $query->result();
+
+ $path_cash=1;
+ $path_credit=1;
+
+
+ $ins_comp_id=0;
+ if($ins_id>0)
+ {
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $ins_comp_id=$data['hc_insurance_card'][0]->insurance_id;
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $path_cash=$data['insurance'][0]->path_cash;
+ $path_credit=$data['insurance'][0]->path_credit;
+ }
+
+ $data['pdata']=$ins_comp_id;
+
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+
+
+
+ if($ins_comp_id<2)
+ {
+ $sql="select id,Concat(idesc,' : {',amount,'}') as sdesc from hc_items where itype=1 order by idesc ";
+ }else{
+ $sql="select m.id,m.itype,m.idesc,m.amount,t.itype_id,t.is_ipd_opd,t.group_desc,
+ i.hc_insurance_id ,if(i.hc_insurance_id is null,m.amount,i.amount1) as amount1,
+ Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (hc_items m join hc_item_type t on m.itype=t.itype_id)
+ left join
+ (select * from hc_items_insurance where hc_insurance_id=".$ins_comp_id." and isdelete=0 ) as i on m.id=i.hc_items_id
+ where itype_id=1 order by m.idesc";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+ $this->load->model('invoice_M');
+
+ if($ins_id>0)
+ {
+ $sql="select * from invoice_master where invoice_status=0 and insurance_card_id>0 and attach_id=".$pno;
+ }else{
+ $sql="select * from invoice_master where invoice_status=0 and insurance_card_id=0 and attach_id=".$pno;
+ }
+
+ $query = $this->db->query($sql);
+ $data['chk_draft_invoice']= $query->result();
+
+ if(count($data['chk_draft_invoice'])<1)
+ {
+ $data['insert_invoice'] = array(
+ 'attach_type' => '0',
+ 'opd_code' => $opd_code,
+ 'attach_id' => $pno,
+ 'refer_by_id' => $select_doc,
+ 'inv_date' => date('Y-m-d H:i:s'),
+ 'inv_name' => $data['person_info'][0]->p_fname,
+ 'insurance_id' => $ins_comp_id,
+ 'insurance_card_id' => $ins_id,
+ 'insurance_cash' => $path_cash,
+ 'insurance_credit' => $path_credit,
+ 'inv_a_code' => $data['person_info'][0]->p_code
+ );
+ $inser_id=$this->invoice_M->create_invoice( $data['insert_invoice']);
+ }else{
+ $today = date("Y-m-d");
+ $expire = $data['chk_draft_invoice'][0]->inv_date; //from db
+
+ $today_dt = new DateTime($today);
+ $inv_dt = new DateTime($expire);
+
+ if ($inv_dt < $today_dt) {
+
+ //$this->db->delete("invoice_master", "id=".$data['chk_draft_invoice'][0]->id);
+ //$this->db->delete("invoice_item", "inv_master_id=".$data['chk_draft_invoice'][0]->id);
+
+ $data['insert_invoice'] = array(
+ 'attach_type' => '0',
+ 'attach_id' => $pno,
+ 'opd_code' => $opd_code,
+ 'refer_by_id' => $select_doc,
+ 'inv_date' => date('Y-m-d H:i:s'),
+ 'inv_name' => $data['person_info'][0]->p_fname,
+ 'insurance_id' => $ins_comp_id,
+ 'insurance_card_id' => $ins_id,
+ 'insurance_cash' => $path_cash,
+ 'insurance_credit' => $path_credit,
+ 'inv_a_code' => $data['person_info'][0]->p_code
+ );
+ //$inser_id=$data['chk_draft_invoice'][0]->id;
+ $inser_id=$this->invoice_M->create_invoice( $data['insert_invoice']);
+ }else{
+ $inser_id=$data['chk_draft_invoice'][0]->id;
+ }
+ }
+
+ if($inser_id)
+ {
+ $sql="select * from invoice_master where id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster']= $query->result();
+
+ $sql="select i.*,t.group_desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$inser_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+ }
+
+ $sql="select *,if(ipd_status=0,DATEDIFF(sysdate(),register_date),DATEDIFF(discharge_date,register_date)) as no_days from ipd_master where ipd_status=0 and p_id=".$data['invoiceMaster'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $this->load->view('Invoice_PathLab',$data);
+ //$this->load->view('Invoice_ipd_credit',$data);
+ }
+
+ public function list_pathtest_bytype()
+ {
+ $tid=$this->input->post('itype_idv');
+ $ins_id=$this->input->post('ins_id');
+
+ $sql="select id,Concat(idesc,' : {',amount,'}') as sdesc from hc_items where itype=".$tid;
+
+ if($ins_id>1)
+ {
+ $sql="select m.id,m.itype,m.idesc,m.amount,t.itype_id,t.is_ipd_opd,t.group_desc,
+ i.hc_insurance_id ,if(i.hc_insurance_id is null,m.amount,i.amount1) as amount1,
+ Concat(m.idesc,'{',if(i.hc_insurance_id is null,m.amount,i.amount1),'}',if(i.id is null,'',concat('[',i.code,']'))) as sdesc
+ from (hc_items m join hc_item_type t on m.itype=t.itype_id)
+ left join
+ (select * from hc_items_insurance where hc_insurance_id=".$ins_id." and isdelete=0 ) as i on m.id=i.hc_items_id
+ where itype_id=".$tid." order by m.idesc ";
+ }else{
+ $sql="select id,Concat(idesc,' : [',amount,']') as sdesc from hc_items where itype=".$tid." order by idesc ";
+ }
+
+ $query = $this->db->query($sql);
+ $data['labitem']= $query->result();
+
+
+ echo '
+ Charge Name
+ ';
+ foreach($data['labitem'] as $row)
+ {
+ echo ''.$row->sdesc.' ';
+ }
+ echo '
';
+
+ //echo $sql;
+
+ }
+
+ public function update_refer_doc()
+ {
+ $invoice_id=$this->input->post('inv_id');
+ $doc_id=$this->input->post('doc_id');
+ $inv_date=str_to_MysqlDate($this->input->post('inv_date'));
+
+ if($doc_id<1)
+ {
+ $refername=$this->input->post('refername');
+ }else{
+ $sql="select * from doctor_master where id=".$doc_id;
+ $query = $this->db->query($sql);
+ $data['doc_master']= $query->result();
+ $refername=$data['doc_master'][0]->p_fname;
+ }
+
+
+ $dataupdate = array(
+ 'refer_by_id' => $doc_id,
+ 'inv_date' => $inv_date,
+ 'refer_by_other' => $refername,
+ 'invoice_status' =>'1',
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+
+ }
+
+ public function get_echs_id()
+ {
+ $itype_name_id_srno=$this->input->post('input_charge_code');
+ $tid=$this->input->post('itype_idv');
+
+ $sql="select * from hc_items where itype=".$tid." and echs_sr_no='".$itype_name_id_srno."'";
+ //echo $sql;
+ $query = $this->db->query($sql);
+ $data['echs_data']= $query->result();
+
+ if($query->num_rows()>0)
+ {
+ echo $data['echs_data'][0]->id;
+ }else{
+ echo '0';
+ }
+ }
+
+
+
+ public function showinvoice($invoice_id)
+ {
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update_invoice_final($invoice_id);
+
+ $sql="select i.*,t.group_desc
+ from invoice_item i join hc_item_type t on i.item_type=t.itype_id
+ where i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select *,
+ (case payment_mode
+ when 1 Then 'Cash'
+ when 2 then 'Bank Card/Online'
+ when 3 then 'IPD Credit'
+ when 4 then 'Org. Credit'
+ else 'Pending' end) as Payment_type_str
+ from invoice_master
+ where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $ins_comp_id=$data['invoice_master'][0]->insurance_id;
+ $ins_id=$data['invoice_master'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+ $sql="select * from patient_master_exten
+ where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select * from ipd_master
+ where ipd_status=0 and p_id=".$data['invoice_master'][0]->attach_id;
+
+ if($data['invoice_master'][0]->ipd_id >0)
+ {
+ $sql="select * from ipd_master where id=".$data['invoice_master'][0]->ipd_id;
+ }
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $sql="select * from invoice_item i join hc_item_type t on i.item_type=t.itype_id
+ where t.is_ipd_opd=2 and i.inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $IPD_Credit= $query->result();
+
+ if(count($IPD_Credit)>0)
+ {
+ $data['IPD_Credit']="1";
+ }else{
+ $data['IPD_Credit']="0";
+ }
+
+ $sql="select *
+ from organization_case_master
+ where case_type=0 and status=0 and p_id=".$data['invoice_master'][0]->attach_id;
+
+ if($data['invoice_master'][0]->insurance_case_id>0)
+ {
+ $sql="select * from organization_case_master
+ where case_type=0 and id=".$data['invoice_master'][0]->insurance_case_id;
+ }elseif(count($data['ipd_master'])>0){
+ if($data['ipd_master'][0]->case_id>0)
+ {
+ $sql="select * from organization_case_master where case_type=0 and id=".$data['ipd_master'][0]->case_id;
+ }
+ }
+
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+
+ $sql="select s.id,s.pay_type,m.bank_name
+ From hospital_bank m join hospital_bank_payment_source s on m.id=s.bank_id";
+ $query = $this->db->query($sql);
+ $data['bank_data']= $query->result();
+
+ $this->load->view('Invoice_PathLab_final_V',$data);
+ }
+
+ public function update_discount()
+ {
+ $invoice_id=$this->input->post('invoice_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $dataupdate = array(
+ 'discount_amount' => $this->input->post('input_dis_amt'),
+ 'discount_desc' => $this->input->post('input_dis_desc'),
+ 'disc_update_by'=>$user_name.'['.$user_id.']'
+ );
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=2 and payof_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $discount_amount=$data['invoice_master'][0]->discount_amount ;
+ $correction_amount=$data['invoice_master'][0]->correction_amount ;
+
+ $total_amount=$data['invoiceGtotal'][0]->Gtotal;
+ $net_amount=$total_amount-$discount_amount;
+ $net_amount=$net_amount-$correction_amount;
+ $paid_amount=$data['payment_history'][0]->paid_amount;
+ $balance_amount=$net_amount-$paid_amount;
+
+ if($balance_amount>0 && $paid_amount>0)
+ {
+ $payment_part=1;
+ }else{
+ $payment_part=0;
+ }
+
+ $dataupdate = array(
+ 'total_amount' => $total_amount,
+ 'net_amount' => $net_amount,
+ 'payment_part_received' => $paid_amount,
+ 'payment_part_balance' => $balance_amount,
+ 'payment_part' => $payment_part,
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+
+ }
+
+
+ public function showitem($type)
+ {
+ $this->load->model('invoice_M');
+
+ if($type==1)
+ {
+ $ins_id=$this->input->post('ins_id');
+
+ $sql="select * from hc_items where id=".$this->input->post('itype_name_id');
+ if($ins_id>1)
+ {
+ $sql="select m.id,m.itype,m.idesc as sdesc,m.amount,t.itype_id,t.is_ipd_opd,t.group_desc,i.isdelete,
+ if(i.hc_insurance_id is null,0,i.hc_insurance_id) as hc_insurance_id ,if(i.hc_insurance_id is null,
+ m.amount,i.amount1) as amount1,
+ if(i.hc_insurance_id is null,'',i.code) as org_code
+ from (hc_items m left join hc_items_insurance i on m.id=i.hc_items_id and i.isdelete=0 and i.hc_insurance_id=".$ins_id." )
+ join hc_item_type t on m.itype=t.itype_id where m.id=".$this->input->post('itype_name_id');
+
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $item_rate=$data['itemlist'][0]->amount1;
+ $org_code=$data['itemlist'][0]->org_code;
+
+ $item_custom_rate=$this->input->post('input_rate');
+
+ if($item_custom_rate>0)
+ {
+ $item_rate=$item_custom_rate;
+ }
+
+ $amount_value=$this->input->post('input_qty')*$item_rate;
+
+ }
+ else
+ {
+ $sql="select id,idesc as sdesc,amount from hc_items where id=".$this->input->post('itype_name_id');
+
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $item_rate=$data['itemlist'][0]->amount;
+
+ $org_code='';
+
+ $item_custom_rate=$this->input->post('input_rate');
+
+ if($item_custom_rate>0)
+ {
+ $item_rate=$item_custom_rate;
+ }
+ $amount_value=$this->input->post('input_qty')*$item_rate;
+ }
+
+ $data['insert_invoice_item'] = array(
+ 'inv_master_id' => $this->input->post('lab_invoice_id'),
+ 'item_type' => $this->input->post('itype_idv'),
+ 'item_id' => $this->input->post('itype_name_id'),
+ 'item_name' => $data['itemlist'][0]->sdesc,
+ 'item_rate' => $item_rate,
+ 'item_added_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'item_qty' => $this->input->post('input_qty'),
+ 'item_amount' => $amount_value,
+ 'ins_id' => $ins_id,
+ 'org_code' => $org_code
+ );
+
+ $sql="select * from invoice_item where inv_master_id=".$this->input->post('lab_invoice_id')." and item_id=".$this->input->post('itype_name_id');
+ $query = $this->db->query($sql);
+
+ $itemcheck= $query->result();
+
+ if(count($itemcheck)<1)
+ {
+ $inser_id=$this->invoice_M->addinvoiceitem( $data['insert_invoice_item']);
+ }
+
+ }if($type==2)
+ {
+ $amount_value=$this->input->post('update_qty') * $this->input->post('item_rate');
+
+ $data['update_invoice_item'] = array(
+ 'item_added_date' => str_to_MysqlDate(date('d/m/Y')),
+ 'item_qty' => $this->input->post('update_qty'),
+ 'item_amount' => $amount_value
+ );
+
+ $inser_id=$this->invoice_M->update_item( $data['update_invoice_item'],$this->input->post('itemid'));
+
+ }else{
+ $this->invoice_M->deleteinvoiceitem($this->input->post('itemid'));
+ echo 'DataDelete '.$this->input->post('itemid');
+ //$this->db->delete("invoice_item", "id=".$this->input->post('itemid'));
+ }
+
+ $sql="select i.*,t.group_desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$this->input->post('lab_invoice_id')." Order by i.id";
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $invoice_id=$this->input->post('lab_invoice_id');
+
+ $sql="select * from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$this->input->post('lab_invoice_id');
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $total_amount=$data['invoiceGtotal'][0]->Gtotal;
+ $discount_amount=$data['invoice_master'][0]->discount_amount ;
+ $total_amount=$data['invoiceGtotal'][0]->Gtotal;
+ $net_amount=$total_amount-$discount_amount;
+
+ $dataupdate = array(
+ 'total_amount' => $total_amount,
+ 'net_amount' => $net_amount
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+
+
+ echo '';
+ }
+
+ public function invoice_print($invoice_id)
+ {
+ $sql="select i.*,t.group_desc from invoice_item i join hc_item_type t on i.item_type=t.itype_id where i.inv_master_id=".$invoice_id." order by i.id";
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+ $sql="select sum(item_amount) as Gtotal from invoice_item where inv_master_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select *,(case invoice_status when 0 then 'Pending' when 1 then '' when 2 then 'Cancelled Invoice' else 'Other' end) as Invoice_status_str,
+ (case payment_mode when 1 Then 'Cash' when 2 then 'Bank Card'
+ when 3 then 'IPD Credit' when 4 then 'Org. Credit' else 'Pending' end) as Payment_type_str
+ from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$data['invoice_master'][0]->inv_date."') AS age from patient_master
+ where id=".$data['invoice_master'][0]->attach_id;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select *,get_payment_type(payment_mode,credit_debit) as Payment_type_str from payment_history where payof_type=2 and payof_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $ins_comp_id=$data['invoice_master'][0]->insurance_id;
+ $ins_id=$data['invoice_master'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $data['hc_insurance_card']= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $data['insurance']= $query->result();
+
+
+
+ $sql="select * from organization_case_master where id=".$data['invoice_master'][0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ $this->load->view('invoice_pathlab_print_V',$data);
+
+ }
+
+ public function charge_crorg($inv_id,$org_code_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=2 and payof_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=2 and refund_type_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ if($payment_history[0]->paid_amount>0 && $invoice_master[0]->invoice_status==1)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 2,
+ 'refund_type_id' => $inv_id,
+ 'refund_type_code' => $invoice_master[0]->invoice_code,
+ 'refund_type_reason' => 'Cr. to Org.',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $payment_history[0]->paid_amount,
+ 'patient_id' => $invoice_master[0]->attach_id,
+ 'patient_name' =>strtoupper($invoice_master[0]->inv_name)
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+ }
+
+ $dataupdate = array(
+ 'payment_mode' => 4,
+ 'payment_mode_desc' => 'Org. Credit',
+ 'payment_id' => 0,
+ 'insurance_case_id' => $org_code_id,
+ 'payment_status'=>1,
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id,
+ 'confirm_invoice'=>date('Y-m-d H:i:s'),
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$inv_id);
+ }
+
+ public function invoice_PDF_print($invoice_id,$page_size=0)
+ {
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update_invoice_final($invoice_id);
+
+
+ $sql="select i.*,t.group_desc
+ from invoice_item i join hc_item_type t on i.item_type=t.itype_id
+ where i.inv_master_id=".$invoice_id." order by t.group_desc,i.id";
+ $query = $this->db->query($sql);
+ $data['invoiceDetails']= $query->result();
+
+
+ $sql="select *,(case invoice_status when 0 then 'Pending' when 1 then '' when 2 then 'Cancelled Invoice' else 'Other' end) as Invoice_status_str,
+ (case payment_mode when 1 Then 'Cash' when 2 then 'Bank Card'
+ when 3 then 'IPD Credit' when 4 then 'Org. Credit' else 'Pending' end) as Payment_type_str ,
+ date_format(confirm_invoice,'%d-%m-%Y %H:%i:%s') as confirm_invoice_datetime
+ from invoice_master where id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $sql="select *,if(gender=1,'M','F') as xgender,
+ GET_AGE_2(dob,age,age_in_month,estimate_dob,'".$data['invoice_master'][0]->inv_date."') AS age from patient_master
+ where id='".$data['invoice_master'][0]->attach_id."' ";
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $sql="select *,get_payment_type(payment_mode,credit_debit) as Payment_type_str
+ from payment_history where payof_type=2 and payof_id=".$invoice_id;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $ins_comp_id=$data['invoice_master'][0]->insurance_id;
+ $ins_id=$data['invoice_master'][0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id=".$ins_id;
+ $query = $this->db->query($sql);
+ $hc_insurance_card= $query->result();
+
+ $sql="select * from hc_insurance where id=".$ins_comp_id;
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+
+ $sql="select *,i.short_name
+ from organization_case_master o join hc_insurance i on o.insurance_id=i.id
+ where o.id=".$data['invoice_master'][0]->insurance_case_id;
+ $query = $this->db->query($sql);
+ $data['case_master']= $query->result();
+
+ //load mPDF library
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetWatermarkText(H_Name);
+ //$this->m_pdf->pdf->showWatermarkText = true;
+
+ $file_name='Charge_Invoice-'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ $dataupdate = array(
+ 'is_print_out'=>1,
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$invoice_id);
+
+ if($page_size==0)
+ {
+ $content=$this->load->view('Invoice/invoice_print',$data,TRUE);
+ }elseif($page_size==1){
+ $content=$this->load->view('Invoice/invoice_print_a5',$data,TRUE);
+ }elseif($page_size==2){
+ $content=$this->load->view('Invoice/invoice_print_a4_double',$data,TRUE);
+ }
+
+ //echo $content;
+
+ // $this->m_pdf->pdf->showImageErrors = false;
+
+ // $this->m_pdf->pdf->curlAllowUnsafeSslRequests = true;
+ $this->m_pdf->pdf->useSubstitutions = false;
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output("TEST.pdf","I");
+
+ }
+
+
+
+ public function charge_crIPD($inv_id,$ipd_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount
+ from payment_history where payof_type=2 and payof_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select * from ipd_master where id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $ipd_master= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=2 and refund_type_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ if($payment_history[0]->paid_amount>0 && $invoice_master[0]->invoice_status==1)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 2,
+ 'refund_type_id' => $inv_id,
+ 'refund_type_code' => $invoice_master[0]->invoice_code,
+ 'refund_type_reason' => 'Cr. to IPD.',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $payment_history[0]->paid_amount,
+ 'patient_id' => $invoice_master[0]->attach_id,
+ 'patient_name' =>strtoupper($invoice_master[0]->inv_name)
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+ }
+
+ $dataupdate = array(
+ 'payment_mode' => 3,
+ 'payment_mode_desc' => 'IPD Credit',
+ 'payment_id' => 0,
+ 'insurance_case_id' => $ipd_master[0]->case_id,
+ 'ipd_id' => $ipd_id,
+ 'payment_status' => 1,
+ 'prepared_by'=>$user_name.'['.$user_id.']',
+ 'prepared_by_id'=>$user_id,
+ 'confirm_invoice'=>date('Y-m-d H:i:s'),
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$inv_id);
+ }
+
+
+ public function cancel_inv($inv_id)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=2 and payof_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select * from refund_order
+ where refund_process=0 and refund_type=2 and refund_type_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ if($payment_history[0]->paid_amount>0 && $invoice_master[0]->invoice_status==1)
+ {
+ $RefundRequest = array(
+ 'refund_type' => 2,
+ 'refund_type_id' => $inv_id,
+ 'refund_type_code' => $invoice_master[0]->invoice_code,
+ 'refund_type_reason' => 'Cancel Invoice',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $payment_history[0]->paid_amount,
+ 'patient_id' => $invoice_master[0]->attach_id,
+ 'patient_name' =>strtoupper($invoice_master[0]->inv_name)
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+
+ $dataupdate = array(
+ 'payment_id' => 0,
+ 'invoice_status' => 2
+ );
+
+ $this->load->model('Invoice_M');
+ $this->Invoice_M->update($dataupdate,$inv_id);
+ }else{
+
+ }
+
+
+ }
+
+ public function charge_refund($inv_id,$inv_refund_amount)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user->id.']:T-'.date('d-m-Y h:m:s');
+
+ $status_str="";
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $sql="select sum(if(credit_debit>0,amount*-1,amount)) as paid_amount from payment_history where payof_type=2 and payof_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from invoice_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $invoice_master= $query->result();
+
+ $sql="select * from refund_order where refund_process=0 and refund_type=2 and refund_type_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $refund_order= $query->result();
+
+ if(count($payment_history)>0 && count($refund_order)<1)
+ {
+ if($payment_history[0]->paid_amount>0 && $invoice_master[0]->invoice_status==1 && $inv_refund_amount<=$payment_history[0]->paid_amount)
+ {
+ if($inv_refund_amount<0)
+ {
+ $inv_refund_amount=$inv_refund_amount*-1;
+ }
+
+ $RefundRequest = array(
+ 'refund_type' => 2,
+ 'refund_type_id' => $inv_id,
+ 'refund_type_code' => $invoice_master[0]->invoice_code,
+ 'refund_type_reason' => 'Return Extra Charge',
+ 'approved_by_id' => $user_id,
+ 'approved_by' => $user_name,
+ 'refund_amount' => $inv_refund_amount,
+ 'patient_id' => $invoice_master[0]->attach_id,
+ 'patient_name' =>strtoupper($invoice_master[0]->inv_name)
+ );
+
+ $this->load->model('Payment_M');
+ $this->Payment_M->insert_refundorder($RefundRequest);
+ }
+ }
+
+ }
+
+ public function deleteinvoice()
+ {
+ $inv_id=$this->input->post('inv_id');
+ $this->db->delete("invoice_master", "id=".$inv_id);
+ $this->db->delete("invoice_item", "inv_master_id=".$inv_id);
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Patient.php b/old_code_ci3/controllers/Patient.php
new file mode 100644
index 0000000..09da2a8
--- /dev/null
+++ b/old_code_ci3/controllers/Patient.php
@@ -0,0 +1,850 @@
+load->model('Patient_M');
+ }
+
+ public function index()
+ {
+ $sql = "select * from hc_insurance";
+ $query = $this->db->query($sql);
+ $data['data_insurance'] = $query->result();
+
+ $sql = "select * from blood_group order by id";
+ $query = $this->db->query($sql);
+ $data['blood_group'] = $query->result();
+
+ $this->load->view('Patient_V', $data);
+ }
+
+ public function search_adv()
+ {
+ $sdata = "";
+
+ $input_mphone1 = $this->input->post('input_mphone1');
+ $input_Aadhar = $this->input->post('input_udai');
+ $input_relative_name = $this->input->post('input_relative_name');
+ $input_name = $this->input->post('input_name');
+
+ if (strlen($input_mphone1) > 0) {
+ $sdata = $sdata . " or mphone1 = '" . $input_mphone1 . "'";
+ }
+
+ if (strlen($input_Aadhar) > 0) {
+ $sdata = $sdata . " or udai = '" . $input_Aadhar . "'";
+ }
+
+ if (strlen($input_relative_name) > 0) {
+ $sdata = $sdata . " or (trim(p_rname) = '" . trim($input_relative_name) . "' and Trim(p_fname)='" . trim($input_name) . "') ";
+ }
+
+ $sql = "SELECT id,Concat(p_fname,'/',if(gender=1,'M','F'),'/',p_relative,' ',p_rname) as Sresult
+ FROM patient_master WHERE 1<>1 " . $sdata . " order by id desc";
+ $query = $this->db->query($sql);
+ $search_result = $query->result();
+
+ $data['search_result'] = $search_result;
+
+
+ $this->load->view('search_adv_data', $data);
+ }
+
+ public function search()
+ {
+ $sdata = $this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9 _.@\-]/', '', trim($sdata));
+
+ if (strlen($sdata) == 0) {
+ $sql = "SELECT p.*,GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age ,
+ Date_Format(p.last_visit,'%d-%m-%Y') AS Last_Visit
+ FROM patient_master p
+ group BY p.id
+ order BY p.last_visit DESC
+ LIMIT 100 ";
+ } else {
+
+ $sdate_array = explode(" ", $sdata);
+ $search_string = " 1=1 ";
+
+ foreach ($sdate_array as $row_data) {
+ if (is_numeric($row_data)) {
+ $search_string .= " and (p.p_code like '%$row_data'
+ or p.mphone1 = '$row_data'
+ or p.udai='$row_data' )";
+ } elseif (ctype_alpha($row_data)) {
+ $search_string .= " and (p.p_fname like '%$row_data%'
+ or p.email1 = '$row_data'
+ or SUBSTRING_INDEX(p.p_fname,' ',1) sounds like '" . $row_data . "')";
+ } else {
+ $search_string .= " and (p.p_code like '$row_data'
+ or p.email1 = '$row_data' )";
+ }
+ }
+
+ $sql = "SELECT p.*,GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age ,
+ Date_Format(p.last_visit,'%d-%m-%Y') AS Last_Visit
+ FROM patient_master p
+ WHERE $search_string
+ group BY p.id
+ order BY p.last_visit DESC ";
+ }
+
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $this->load->view('Patient_Search_V', $data);
+ }
+
+
+ public function search_opd()
+ {
+ $sql = "SELECT p.*,GET_AGE_1(dob,age,age_in_month,estimate_dob) AS age ,
+ Date_Format(o.apointment_date,'%d-%m-%Y') AS opd_Visit,o.doc_name,o.doc_spec,o.opd_code,i.short_name
+ FROM (patient_master p join opd_master o on p.id =o.p_id)
+ Left join hc_insurance i on i.id = o.insurance_id
+ order BY o.opd_id DESC LIMIT 100 ";
+
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $content = $this->load->view('Patient_Search_opd', $data, true);
+
+ echo $content;
+ }
+
+ function person_record($pno, $edit = 0)
+ {
+ $sql = "select *,GET_AGE_1(dob,age,age_in_month,estimate_dob) as str_age,
+ Date_Format(insert_date,'%Y-%m-%d') as str_regdate,
+ if(gender=1,'Male','Female') as xgender ,
+ if(date_add(insert_date,interval 12 hour)>sysdate(),1,0) as p_edit
+ from patient_master where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $required_age = $data['data'][0]->age;
+ $required_age_in_month = $data['data'][0]->age_in_month;
+ $required_dob = $data['data'][0]->dob;
+ $estimate_dob = $data['data'][0]->estimate_dob;
+
+ if ($required_age == '' && $estimate_dob == 1) {
+ if ($required_age == '0') {
+ if ($required_age_in_month == 0 || $required_age_in_month == '') {
+ $edit = 1;
+ }
+ }
+ }
+
+ if ($required_dob == '' && $estimate_dob == 0) {
+ $edit = 1;
+ }
+
+
+ $sql = "select *,p.p_fname,if(apointment_date=curdate(),1,0) as new_opd,
+ date_format(apointment_date,'%d-%m-%Y') as str_apointment_date
+ from opd_master o join patient_master p on o.p_id=p.id where p_id=$pno Order by opd_code desc";
+ $query = $this->db->query($sql);
+ $data['opd_List'] = $query->result();
+
+ $sql = "select m.id,m.invoice_code,Date_Format(m.inv_date,'%d-%m-%y') as str_inv_date,m.inv_name,
+ if(count(t.id)>0,group_concat(t.item_name SEPARATOR ' / '),'No-Item') as Item_List, m.net_amount,m.invoice_status
+ from invoice_master m left join invoice_item t on m.id=t.inv_master_id
+ where attach_type=0 and attach_id=" . $pno . " group by m.id order by m.id desc";
+ $query = $this->db->query($sql);
+ $data['invoice_list'] = $query->result();
+
+ $sql = "select i.*,m.ins_company_name,m.opd_allowed,m.charge_cash
+ from hc_insurance_card i join hc_insurance m on i.insurance_id=m.id
+ where i.p_id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['data_insurance_card'] = $query->result();
+
+ $sql = "select *,Date_Format(date_registration,'%d-%m-%Y') as str_date_registration
+ from organization_case_master where status=0 and case_type=0 and p_id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['case_master_opd'] = $query->result();
+
+ $sql = "SELECT o.*,DATE_FORMAT(o.date_registration,'%d-%m-%Y') as str_date_registration ,
+ i.ipd_code,i.register_date
+ from organization_case_master o left JOIN ipd_master i ON o.ipd_id=i.id
+ WHERE o.status=0 AND o.case_type=1 and o.p_id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['case_master_ipd'] = $query->result();
+
+ $sql = "select * from file_upload_data where id=" . $data['data'][0]->profile_file_id;
+ $query = $this->db->query($sql);
+ $file_data = $query->result();
+
+ $profile_file_path = "/assets/images/no_image.jpg";
+
+ $sql = "SELECT * from blood_group order by id";
+ $query = $this->db->query($sql);
+ $data['blood_group'] = $query->result();
+
+ $sql = "select * from tag_master Order by tag_name";
+ $query = $this->db->query($sql);
+ $data['tag_master'] = $query->result();
+
+ $sql = "SELECT a.*,t.tag_name,t.tag_type_id
+ FROM patient_tag_assign a JOIN tag_master t ON a.tag_id=t.id
+ WHERE isdelete=0 and a.p_id=$pno";
+ $query = $this->db->query($sql);
+ $data['patient_tag_list'] = $query->result();
+
+ if (count($file_data) > 0) {
+ $pos = strpos($file_data[0]->full_path, '/uploads/', 1);
+ $profile_file_path = substr($file_data[0]->full_path, $pos);
+ }
+
+ $data['profile_file_path'] = $profile_file_path;
+
+ if ($edit == 0) {
+ $this->load->view('Person_profile_V', $data);
+ } else {
+ $this->load->view('Person_Edit_V', $data);
+ }
+ }
+
+ public function update_1()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_name',
+ 'label' => 'Name',
+ 'rules' => 'required|min_length[2]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+
+ $data = array(
+ 'mphone1' => $this->input->post('input_mphone1'),
+ 'p_fname' => strtoupper($this->input->post('input_name')),
+ 'gender' => $this->input->post('optionsRadios_gender'),
+ 'dob' => str_to_MysqlDate($this->input->post('datepicker_dob')),
+ 'zip' => $this->input->post('input_zip'),
+ 'add1' => $this->input->post('input_address'),
+ 'city' => $this->input->post('input_city'),
+ 'district' => $this->input->post('input_district'),
+ 'state' => $this->input->post('input_state'),
+ 'age' => $this->input->post('input_age'),
+ 'title' => $this->input->post('cbo_title'),
+ 'p_relative' => strtoupper($this->input->post('cbo_relation')),
+ 'p_rname' => $this->input->post('input_relative_name'),
+ 'email1' => $this->input->post('input_email'),
+ 'age' => $this->input->post('input_age'),
+ 'age_in' => $this->input->post('cbo_age')
+ );
+
+ $pid = $this->input->post('p_id');
+ $this->Patient_M->update($data, $pid);
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => 'Data Saved successfully'
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_error = validation_errors();
+ $rvar = array(
+ 'update' => 0,
+ 'error_text' => $send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+ public function update()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $chk_age = $this->input->post('chk_age');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_name',
+ 'label' => 'Name of Patient',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ )
+
+ );
+
+ $age_month = $this->input->post('input_age_month');
+ $age_year = $this->input->post('input_age_year');
+
+
+ if ($chk_age == 'on') {
+ $estimate_dob = 1;
+
+ if ($age_year == '' && $age_month == '') {
+ array_push(
+ $FormRules,
+ array(
+ 'field' => 'input_age_year',
+ 'label' => 'Patient Age',
+ 'rules' => 'required|min_length[1]|max_length[4]'
+ )
+ );
+ }
+ } else {
+ $estimate_dob = 0;
+ array_push(
+ $FormRules,
+ array(
+ 'field' => 'datepicker_dob',
+ 'label' => 'Date of Birth',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+ }
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+
+ $data = array(
+ 'mphone1' => $this->input->post('input_mphone1'),
+ 'p_fname' => strtoupper($this->input->post('input_name')),
+ 'gender' => $this->input->post('optionsRadios_gender'),
+ 'zip' => $this->input->post('input_zip'),
+ 'add1' => strtoupper($this->input->post('input_address')),
+ 'city' => strtoupper($this->input->post('input_city')),
+ 'district' => strtoupper($this->input->post('input_district')),
+ 'state' => strtoupper($this->input->post('input_state')),
+ 'title' => $this->input->post('cbo_title'),
+ 'p_relative' => strtoupper($this->input->post('cbo_relation')),
+ 'p_rname' => strtoupper($this->input->post('input_relative_name')),
+ 'email1' => strtoupper($this->input->post('input_email')),
+ 'udai' => strtoupper($this->input->post('input_Aadhar')),
+ 'estimate_dob' => $estimate_dob,
+ 'blood_group' => $this->input->post('input_blood_group')
+ );
+
+ if ($chk_age == 'on') {
+ $data['age'] = $age_year;
+ $data['age_in_month'] = $age_month;
+ } else {
+ $data['dob'] = str_to_MysqlDate($this->input->post('datepicker_dob'));
+ }
+
+ $pid = $this->input->post('p_id');
+ $this->Patient_M->update($data, $pid);
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => 'Data Saved successfully'
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_error = validation_errors();
+ $rvar = array(
+ 'update' => 0,
+ 'error_text' => $send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function update_aadhar()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $data = array(
+ 'udai' => $this->input->post('udai'),
+ );
+
+ $pid = $this->input->post('p_id');
+ $this->Patient_M->update($data, $pid);
+ $rvar = array(
+ 'update' => 1,
+ 'showcontent' => 'Data Saved successfully'
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function create()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $chk_age = $this->input->post('chk_age');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_name',
+ 'label' => 'Name of Patient',
+ 'rules' => 'required|min_length[1]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_relative_name',
+ 'rules' => 'required|min_length[1]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_mphone1',
+ 'rules' => 'required|min_length[10]|max_length[10]'
+ )
+
+ );
+
+ $age_month = $this->input->post('input_age_month');
+ $age_year = $this->input->post('input_age_year');
+
+
+ if ($chk_age == 'on') {
+ $estimate_dob = 1;
+
+ if ($age_year == '' && $age_month == '') {
+ array_push(
+ $FormRules,
+ array(
+ 'field' => 'input_age_year',
+ 'label' => 'Patient Age',
+ 'rules' => 'required|min_length[1]|max_length[4]'
+ )
+ );
+ }
+ } else {
+ $estimate_dob = 0;
+ array_push(
+ $FormRules,
+ array(
+ 'field' => 'datepicker_dob',
+ 'label' => 'Date of Birth',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+ }
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+
+ $data = array(
+ 'mphone1' => $this->input->post('input_mphone1'),
+ 'p_fname' => strtoupper($this->input->post('input_name')),
+ 'gender' => $this->input->post('optionsRadios_gender'),
+ 'zip' => $this->input->post('input_zip'),
+ 'add1' => strtoupper($this->input->post('input_address')),
+ 'city' => strtoupper($this->input->post('input_city')),
+ 'district' => strtoupper($this->input->post('input_district')),
+ 'state' => strtoupper($this->input->post('input_state')),
+ 'title' => $this->input->post('cbo_title'),
+ 'p_relative' => $this->input->post('cbo_relation'),
+ 'p_rname' => strtoupper($this->input->post('input_relative_name')),
+ 'blood_group' => strtoupper($this->input->post('input_blood_group')),
+ 'udai' => strtoupper($this->input->post('input_udai')),
+ 'estimate_dob' => $estimate_dob
+ );
+
+ if ($chk_age == 'on') {
+ $data['age'] = $age_year;
+ $data['age_in_month'] = $age_month;
+ } else {
+ $data['dob'] = str_to_MysqlDate($this->input->post('datepicker_dob'));
+ }
+
+ $inser_id = $this->Patient_M->insert($data);
+ $rvar = array(
+ 'insertid' => $inser_id
+ );
+
+ // Check Multiple UHID
+ $sdata = '';
+ //$sdata=$sdata." or udai = '".$this->input->post('input_udai')."'";
+ $sdata = $sdata . " or (trim(p_rname) = '" . trim(strtoupper($this->input->post('input_relative_name'))) . "' and Trim(p_fname)='" . trim(strtoupper($this->input->post('input_name'))) . "') ";
+
+ $sql = "SELECT id,Concat(p_code,'/',p_fname,'/',if(gender=1,'M','F'),'/',p_relative,' ',p_rname) as Sresult
+ FROM patient_master WHERE 1<>1 " . $sdata . " and id<>$inser_id order by id desc";
+ $query = $this->db->query($sql);
+ $search_result = $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_name = $user->first_name . '' . $user->last_name . '[Date:' . date('d-m-Y h:i:s') . ']-' . $user->id;
+
+ $log_text = '';
+
+ foreach ($search_result as $row) {
+ $log_text .= $row->Sresult . PHP_EOL;
+ }
+
+ if (count($search_result) > 0) {
+ $data = array(
+ 'new_uhid' => $inser_id,
+ 'name_of_person' => strtoupper($this->input->post('input_name')),
+ 'new_patient_code' => '',
+ 'date_of_registration' => date('Y-m-d h:i:s'),
+ 'update_by' => $user_name,
+ 'remark_duplicate' => $log_text,
+ );
+
+ $inser_id = $this->Patient_M->insert_log_patient_multiple($data);
+ }
+
+ //End of Chking Multiple UHID
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_error = validation_errors();
+ $rvar = array(
+ 'insertid' => 0,
+ 'error_text' => $send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function show_cards($pno, $card_no = 0)
+ {
+
+ $sql = "select * from patient_master where id=" . $pno;
+ $query = $this->db->query($sql);
+ $data['pdata'] = $query->result();
+
+ $inc_card_no = $data['pdata'][0]->insurance_card_id;
+
+ $sql = "select * from hc_insurance_card where id>1 and id=" . $inc_card_no;
+ $query = $this->db->query($sql);
+ $data['data_insurance_card'] = $query->result();
+
+ $sql = "select * from hc_insurance where id>1 and active=1 order by ins_company_name ";
+ $query = $this->db->query($sql);
+ $data['data_insurance'] = $query->result();
+
+ $this->load->view('insurance/insurance_card', $data);
+ }
+
+ public function city()
+ {
+ $this->load->model('Patient_M');
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+ $this->Patient_M->get_city($q);
+ }
+ }
+
+ public function P_info()
+ {
+
+ $UHID = $this->input->post('input_uhid');
+
+ $sql = "select * from patient_master_exten where p_code='$UHID' ";
+ $query = $this->db->query($sql);
+ $data = $query->result();
+
+ if (count($data) > 0) {
+ $Patient_id = $data[0]->id;
+ $Patient_info = $data[0]->p_fname . ' ' . $data[0]->p_relative . ' ' . $data[0]->p_rname . ' /Age :' . $data[0]->str_age;
+ } else {
+ $Patient_id = 0;
+ $Patient_info = '';
+ }
+
+ $rvar = array(
+ 'Patient_id' => $Patient_id,
+ 'Patient_info' => $Patient_info
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function update_card()
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_insurance_id',
+ 'label' => 'Insurance No',
+ 'rules' => 'required|min_length[2]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_card_holder_name',
+ 'label' => 'Insurance Card Holder Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE) {
+
+ $data = array(
+ 'insurance_id' => $this->input->post('Insurance_id'),
+ 'p_id' => $this->input->post('p_id'),
+ 'insurance_no' => $this->input->post('input_insurance_id'),
+ 'card_holder_name' => strtoupper($this->input->post('input_card_holder_name')),
+ 'issue_date' => str_to_MysqlDate($this->input->post('datepicker_issue_date')),
+ 'expiry_date' => str_to_MysqlDate($this->input->post('datepicker_expiry_date')),
+ 'relation_patient_cardholder' => strtoupper($this->input->post('input_Relation'))
+ );
+
+ $card_no = $this->input->post('inscard_id');
+ $inser_id = $card_no;
+
+ if ($card_no == "0") {
+ $inser_id = $this->Patient_M->insert_card($data);
+ } else {
+ $this->Patient_M->update_card($data, $card_no);
+ }
+
+ $data = array(
+ 'insurance_card_id' => $inser_id,
+ 'insurance_id' => $this->input->post('Insurance_id'),
+ 'insurance_no' => $this->input->post('input_insurance_id'),
+ 'card_holder_name' => strtoupper($this->input->post('input_card_holder_name')),
+ 'issue_date' => str_to_MysqlDate($this->input->post('datepicker_issue_date')),
+ 'expiry_date' => str_to_MysqlDate($this->input->post('datepicker_expiry_date')),
+ 'relation_patient_cardholder' => strtoupper($this->input->post('input_Relation'))
+ );
+
+ $this->Patient_M->update($data, $this->input->post('p_id'));
+
+ $rvar = array(
+ 'insertid' => $inser_id
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ } else {
+ $send_error = validation_errors();
+ $rvar = array(
+ 'insertid' => 0,
+ 'error_text' => $send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function show_profile_opd($p_id)
+ {
+ $data['p_id'] = $p_id;
+
+ $sql = "select * from patient_master_exten where id=" . $p_id;
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+ $sql = "select o.* from opd_master o where o.p_id=$p_id order by o.opd_id desc";
+ $query = $this->db->query($sql);
+ $data['opd_master'] = $query->result();
+
+ $sql = "select o.* from opd_master o where o.p_id=$p_id and date(o.apointment_date)=curdate()";
+ $query = $this->db->query($sql);
+ $data['opd_master_current'] = $query->result();
+
+ //$this->load->view('Person/person_file_show',$data);
+
+ $this->load->view('Person/Person_Profile', $data);
+ }
+
+ public function show_profile_image($p_id)
+ {
+ $data['p_id'] = $p_id;
+
+ $sql = "select *,GET_AGE_1(dob,age,age_in_month,estimate_dob) as str_age,
+ Date_Format(insert_date,'%Y-%m-%d') as str_regdate,
+ if(gender=1,'Male','Female') as xgender ,
+ if(date_add(insert_date,interval 12 hour)>sysdate(),1,0) as p_edit
+ from patient_master where id=" . $p_id;
+ $query = $this->db->query($sql);
+ $data['data'] = $query->result();
+
+
+ $this->load->view('Person/person_profile_photo', $data);
+ }
+
+
+ public function save_profile_image($p_id)
+ {
+ $filename = 'P-' . $p_id . '-' . time() . '.jpg';
+
+ $folder_name = 'uploads/' . date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('webcam')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ } else {
+ $data = array('upload_data' => $this->upload->data());
+
+ $this->load->model('File_M');
+
+ $file_insert_id = $this->File_M->insert($data['upload_data']);
+
+ $udata = array(
+ 'upload_by' => $user_name,
+ 'pid' => $p_id,
+ 'opd_id' => '0',
+ 'ipd_id' => '0',
+ 'case_id' => '0',
+ 'upload_by_id' => $user_id
+ );
+
+ if ($file_insert_id > 0) {
+ $this->File_M->update($udata, $file_insert_id);
+
+ $user_name = $user->first_name . '' . $user->last_name . ':T-' . date('d-m-Y h:m:s');
+
+ $dataupdate = array(
+ 'profile_file_id' => $file_insert_id,
+ 'profile_picture_update_by' => $user_name
+ );
+
+ $this->Patient_M->update($dataupdate, $p_id);
+ }
+
+ echo $filename;
+ }
+ }
+
+ //Patient Tag
+
+ function add_comments($p_id)
+ {
+ if (!$this->input->is_ajax_request()) {
+ exit('no valid req.');
+ }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name . ' [Date:' . date('d-m-Y h:i') . ']';
+
+ $comments_data = array(
+ 'p_id' => $p_id,
+ 'remark' => $this->input->post('add_notes'),
+ 'insert_by_id' => $user_id,
+ 'insert_by' => $user_name
+ );
+
+ $insert_id = $this->Patient_M->insert_remark($comments_data);
+
+ if ($insert_id > 0) {
+ $rvar = array(
+ 'update' => $insert_id,
+ 'error_text' => 'Update Done ' . $insert_id
+ );
+ } else {
+ $rvar = array(
+ 'update' => 0,
+ 'error_text' => 'Some Error',
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ function patient_tag()
+ {
+ $this->load->model('Patienttag_M');
+
+ $tag_id = $this->input->post('tag_id');
+ $p_id = $this->input->post('p_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name . '' . $user->last_name;
+
+ if ($this->input->post('isadd') == 1) {
+
+ $sql = "Select *
+ from patient_tag_assign
+ where isdelete=0 and p_id='$p_id' and tag_id='$tag_id'";
+ $query = $this->db->query($sql);
+ $no_rec = $query->num_rows();
+
+ if ($no_rec == 0) {
+ $data = array(
+ 'p_id' => $p_id,
+ 'tag_id' => $tag_id,
+ 'assign_by_id' => $user_id,
+ 'assign_by' => $user_name . '[' . $user_id . ']' . date('d-m-Y H:i'),
+ );
+ $inser_id = $this->Patienttag_M->insert_patient_tag_assign($data);
+ }
+ } else {
+
+ $cust_tag_assign = $this->input->post('cust_tag_assign');
+
+ $data = array(
+ 'isdelete' => 1,
+ 'delete_by' => $this->session->userdata('username') . '[' . $this->session->userdata('agent_id') . ']' . date('d-m-Y H:i'),
+ );
+
+ $this->Patienttag_M->update_patient_tag_assign($data, $cust_tag_assign);
+ }
+
+ echo '1';
+ }
+
+
+
+ //AutoList of Person Names
+
+ public function get_name()
+ {
+
+ if (isset($_GET['term'])) {
+ $q = strtolower($_GET['term']);
+
+ $sql = "select * from name_list where name like '" . $q . "%' ";
+
+ $sql = $sql . "order by name limit 20";
+
+ $query = $this->db->query($sql);
+
+ if ($query->num_rows() > 0) {
+ foreach ($query->result_array() as $row) {
+ $new_row['label'] = htmlentities(stripslashes($row['name']));
+ $new_row['value'] = htmlentities(stripslashes($row['name']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+}
diff --git a/old_code_ci3/controllers/Payment.php b/old_code_ci3/controllers/Payment.php
new file mode 100644
index 0000000..8b6f46a
--- /dev/null
+++ b/old_code_ci3/controllers/Payment.php
@@ -0,0 +1,313 @@
+load->model('Patient_M');
+
+ }
+
+ function index()
+ {
+ $this->load->view('Invoice/payment_search');
+ }
+
+ function payment_record()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $rec_no = preg_replace('/[^A-Za-z0-9 _.@\-]/', '', trim($sdata));
+
+ $sql="select * from payment_history where id='".$rec_no."'";
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select * from users where active=1";
+ $query = $this->db->query($sql);
+ $data['all_user_list']= $query->result_array();
+
+
+ $data['invoice_no']='';
+
+ if(count($data['payment_history'])>0)
+ {
+ $charge_type=$data['payment_history'][0]->payof_type;
+ $payof_id=$data['payment_history'][0]->payof_id;
+
+
+ if($charge_type==1)
+ {
+ $sql="select * from opd_master where opd_id=".$payof_id;
+ $query = $this->db->query($sql);
+ $data['opd_master']= $query->result();
+
+ $pid=$data['opd_master'][0]->p_id;
+
+ $data['invoice_no']=$data['opd_master'][0]->opd_code;
+
+ $data['inv_Type']='OPD';
+ }
+
+ if($charge_type==2)
+ {
+ $sql="select * from invoice_master where id=".$payof_id;
+ $query = $this->db->query($sql);
+ $data['invoice_master']= $query->result();
+
+ $pid=$data['invoice_master'][0]->attach_id;
+
+ $data['invoice_no']=$data['invoice_master'][0]->invoice_code;
+
+ $data['inv_Type']='OPD Charge';
+ }
+
+ if($charge_type==3)
+ {
+ $sql="select * from org_payment_request where id=".$payof_id;
+ $query = $this->db->query($sql);
+ $data['org_payment_request']= $query->result();
+
+ $pid=$data['org_payment_request'][0]->patient_id;
+
+ $data['invoice_no']=$data['org_payment_request'][0]->org_code;
+
+ $data['inv_Type']='ORG Charge';
+ }
+
+ if($charge_type==4)
+ {
+ $sql="select * from ipd_master where id=".$payof_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $pid=$data['ipd_master'][0]->p_id;
+
+ $data['invoice_no']=$data['ipd_master'][0]->ipd_code;
+
+ $data['inv_Type']='IPD Payment';
+ }
+
+ $sql="select * from patient_master_exten where id=".$pid;
+ $query = $this->db->query($sql);
+ $data['patient_master']= $query->result();
+
+ $data['rec_no']=$rec_no;
+
+ $sql="select s.id,s.pay_type,m.bank_name
+ From hospital_bank m join hospital_bank_payment_source s on m.id=s.bank_id";
+ $query = $this->db->query($sql);
+ $data['bank_data']= $query->result();
+
+ $this->load->view('Invoice/payment_edit',$data);
+
+ }else{
+ echo 'No Record Found';
+ }
+ }
+
+ public function change_to_bank()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $pay_id=$this->input->post('pay_id');
+
+ $sql="select * from payment_history where id=".$pay_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ if(count($payment_history)>0)
+ {
+ $payof_id=$payment_history[0]->payof_id;
+
+ $paydata = array(
+ 'payment_mode'=> '2',
+ 'pay_bank_id'=>$this->input->post('cbo_pay_type'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ 'update_remark'=>'Change To Bank'
+ );
+
+ $paydata_log = array(
+ 'pay_id'=> $pay_id,
+ 'update_type'=>'1',
+ 'update_by'=> $user_name,
+ );
+
+ $this->load->model('Payment_M');
+
+ $insert_id=$this->Payment_M->insert_payment_history_log($paydata_log);
+ $this->Payment_M->update($paydata,$pay_id);
+
+ if($payment_history[0]->payof_type==1)
+ {
+ $dataupdate = array(
+ 'payment_mode'=> '2',
+ 'payment_mode_desc'=>'BANK',
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$payof_id);
+
+ }elseif($payment_history[0]->payof_type==4)
+ {
+ $dataupdate = array(
+ 'payment_mode'=> '2',
+ 'payment_mode_desc'=>'BANK',
+ );
+ $this->load->model('Ipd_M');
+ //$this->Ipd_M->update_payment_ipd($dataupdate,$payof_id);
+ }
+
+ }
+ }
+
+ public function change_to_cash()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $pay_id=$this->input->post('pay_id');
+
+ $sql="select * from payment_history where id=".$pay_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ if(count($payment_history)>0)
+ {
+ $payof_id=$payment_history[0]->payof_id;
+
+ $paydata = array(
+ 'payment_mode'=> '1',
+ );
+
+ $paydata_log = array(
+ 'pay_id'=> $payof_id,
+ 'update_type'=>'1',
+ 'update_by'=> $user_name,
+ 'update_remark'=>'Change To CASH'
+ );
+
+ $this->load->model('Payment_M');
+ $insert_id=$this->Payment_M->insert_payment_history_log($paydata_log);
+ $this->Payment_M->update($paydata,$pay_id);
+
+ if($payment_history[0]->payof_type==1)
+ {
+ $dataupdate = array(
+ 'payment_mode'=> '1',
+ 'payment_mode_desc'=>'CASH',
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$payof_id);
+
+ }elseif($payment_history[0]->payof_type==4)
+ {
+ $dataupdate = array(
+ 'payment_mode'=> '1',
+ 'payment_mode_desc'=>'CASH',
+ );
+
+ $this->load->model('Ipd_M');
+ //$this->Ipd_M->update_payment_ipd($dataupdate,$payof_id);
+ }
+
+ }
+
+
+ }
+
+ public function change_user()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $pay_id=$this->input->post('pay_id');
+ $user_list=$this->input->post('user_list');
+
+ $sql="select * from payment_history where id=".$pay_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from users where id=".$user_list;
+ $query = $this->db->query($sql);
+ $user_data= $query->result();
+
+
+ if(count($payment_history)>0)
+ {
+ $payof_id=$payment_history[0]->payof_id;
+
+ $paydata = array(
+ 'update_by'=> $user_data[0]->first_name.' '.$user_data[0]->last_name.'['.$payment_history[0]->insert_time.']['.$user_list.']',
+ 'update_by_id'=> $user_list,
+ );
+
+ $paydata_log = array(
+ 'pay_id'=> $payof_id,
+ 'update_type'=>'3',
+ 'update_by'=> $user_name,
+ 'update_remark'=>'Change Update User From :'.$payment_history[0]->update_by
+ );
+
+ $this->load->model('Payment_M');
+ $insert_id=$this->Payment_M->insert_payment_history_log($paydata_log);
+ $this->Payment_M->update($paydata,$pay_id);
+
+
+ }
+
+ }
+
+ public function change_amount()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $pay_id=$this->input->post('pay_id');
+ $change_value=$this->input->post('change_value');
+
+ $sql="select * from payment_history where id=".$pay_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ if(count($payment_history)>0)
+ {
+ $payof_id=$payment_history[0]->payof_id;
+
+ $paydata = array(
+ 'amount'=> $change_value,
+ );
+
+ $paydata_log = array(
+ 'pay_id'=> $payof_id,
+ 'update_type'=>'4',
+ 'update_by'=> $user_name,
+ 'update_remark'=>'Change Amount , OLD Amt.'.$payment_history[0]->amount
+ );
+
+ $this->load->model('Payment_M');
+ $insert_id=$this->Payment_M->insert_payment_history_log($paydata_log);
+ $this->Payment_M->update($paydata,$pay_id);
+
+
+ }
+
+ }
+}
+
diff --git a/old_code_ci3/controllers/Payment_Medical.php b/old_code_ci3/controllers/Payment_Medical.php
new file mode 100644
index 0000000..4926e5e
--- /dev/null
+++ b/old_code_ci3/controllers/Payment_Medical.php
@@ -0,0 +1,291 @@
+load->view('Medical/payment_search');
+ }
+
+ function payment_record()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $rec_no = preg_replace('/[^A-Za-z0-9 _.@\-]/', '', trim($sdata));
+
+ $sql="select *,if(credit_debit=0,amount,amount*-1) as Amount_str from payment_history_medical where id=".$rec_no;
+ $query = $this->db->query($sql);
+ $data['payment_history']= $query->result();
+
+ $sql="select * from users where active=1";
+ $query = $this->db->query($sql);
+ $data['all_user_list']= $query->result_array();
+
+ $data['invoice_no']='';
+
+ if(count($data['payment_history'])>0)
+ {
+ $Customerof_type=$data['payment_history'][0]->Customerof_type;
+ $Customerof_id=$data['payment_history'][0]->Customerof_id;
+ $Medical_invoice_id=$data['payment_history'][0]->Medical_invoice_id;
+ $ipd_id=$data['payment_history'][0]->ipd_id;
+
+ if($Customerof_type==1) //OPD Bill
+ {
+ $sql="select * from invoice_med_master where id=".$Medical_invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_med_master']= $query->result();
+
+ $data['invoice_to_name']=$data['invoice_med_master'][0]->inv_name;
+
+ $data['invoice_no']=$data['invoice_med_master'][0]->inv_med_code;
+
+ $data['inv_Type']='OPD';
+ }
+
+ if($Customerof_type==2) // IPD Bill
+ {
+ $sql="select * from ipd_master where id=".$ipd_id;
+ $query = $this->db->query($sql);
+ $data['ipd_master']= $query->result();
+
+ $data['invoice_to_name']=$data['ipd_master'][0]->P_name;
+
+ $data['invoice_no']=$data['ipd_master'][0]->ipd_code;
+
+ $data['inv_Type']='IPD Medical Bill';
+ }
+
+ if($Customerof_type==3) //CASH BILL
+ {
+ $sql="select * from invoice_med_master where id=".$Medical_invoice_id;
+ $query = $this->db->query($sql);
+ $data['invoice_med_master']= $query->result();
+
+ $data['invoice_to_name']=$data['invoice_med_master'][0]->inv_name;
+
+ $data['invoice_no']=$data['invoice_med_master'][0]->inv_med_code;
+
+ $data['inv_Type']='CASH';
+ }
+
+ $data['rec_no']=$rec_no;
+
+ $this->load->view('Medical/payment_edit',$data);
+
+ }else{
+ echo 'No Record Found';
+ }
+ }
+
+ public function change_to_bank()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $pay_id=$this->input->post('pay_id');
+
+ $sql="select * from payment_history_medical where id=".$pay_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ if(count($payment_history)>0)
+ {
+
+
+ $paydata = array(
+ 'amount'=>$payment_history[0]->amount,
+ 'payment_mode'=> '2',
+ 'card_bank'=>$this->input->post('input_card_mac'),
+ 'cust_card'=>$this->input->post('input_card_bank'),
+ 'card_remark'=>$this->input->post('input_card_digit'),
+ 'card_tran_id'=>$this->input->post('input_card_tran'),
+ );
+
+ $paydata_log = array(
+ 'pay_id'=> $pay_id,
+ 'update_type'=>'2',
+ 'update_by'=> $user_name,
+ );
+
+ $this->load->model('Medical_M');
+
+ $insert_id=$this->Medical_M->insert_payment_history_log($paydata_log);
+ $this->Medical_M->update_payment($paydata,$pay_id);
+
+ }
+ }
+
+ public function change_to_cash()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $pay_id=$this->input->post('pay_id');
+
+ $sql="select * from payment_history_medical where id=".$pay_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ if(count($payment_history)>0)
+ {
+
+
+ $paydata = array(
+ 'payment_mode'=> '1',
+ 'amount'=>$payment_history[0]->amount,
+ );
+
+ $paydata_log = array(
+ 'pay_id'=> $pay_id,
+ 'update_type'=>'1',
+ 'update_by'=> $user_name,
+ );
+
+ $this->load->model('Medical_M');
+
+ $insert_id=$this->Medical_M->insert_payment_history_log($paydata_log);
+ $this->Medical_M->update_payment($paydata,$pay_id);
+
+ }
+
+ }
+
+ public function update_amount()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $pay_id=$this->input->post('pay_id');
+ $change_value=$this->input->post('change_value');
+
+ $sql="select * from payment_history_medical where id=".$pay_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ if(count($payment_history)>0)
+ {
+ $paydata = array(
+ 'amount'=> $change_value,
+ );
+
+ $old_amt=$payment_history[0]->amount;
+
+ $paydata_log = array(
+ 'pay_id'=> $pay_id,
+ 'update_type'=>'3',
+ 'update_by'=> $user_name,
+ 'update_log'=>'Old Amt. : '.$old_amt,
+ );
+
+ $this->load->model('Medical_M');
+
+ $insert_id=$this->Medical_M->insert_payment_history_log($paydata_log);
+ $this->Medical_M->update_payment($paydata,$pay_id);
+
+ $customer_type=$payment_history[0]->Customerof_type;
+ $inv_id=$payment_history[0]->Medical_invoice_id;
+ $ipd_id=$payment_history[0]->Medical_invoice_id;
+
+ if($customer_type==2){
+ $this->Medical_M->update_invoice_group_gst($ipd_id,1);
+ }else{
+
+ $this->Medical_M->update_invoice_group($inv_id);
+ $this->Medical_M->update_invoice_final($inv_id);
+ }
+
+ }
+ }
+
+ public function change_user()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $pay_id=$this->input->post('pay_id');
+ $user_list=$this->input->post('user_list');
+
+ $sql="select * from payment_history_medical where id=".$pay_id;
+ $query = $this->db->query($sql);
+ $payment_history= $query->result();
+
+ $sql="select * from users where id=".$user_list;
+ $query = $this->db->query($sql);
+ $user_data= $query->result();
+
+
+ if(count($payment_history)>0)
+ {
+ $amount = $payment_history[0]->amount;
+
+ $paydata = array(
+ 'update_by'=> $user_data[0]->first_name.' '.$user_data[0]->last_name.'['.$payment_history[0]->insert_time.']['.$user_list.']',
+ 'update_by_id'=> $user_list,
+ 'amount'=> $amount,
+ );
+
+ $paydata_log = array(
+ 'pay_id'=> $pay_id,
+ 'update_type'=>'3',
+ 'update_by'=> $user_name,
+ 'update_remark'=>'Change Update User From :'.$payment_history[0]->update_by
+ );
+
+ $this->load->model('Medical_M');
+ $insert_id=$this->Medical_M->insert_payment_history_log($paydata_log);
+ $this->Medical_M->update_payment($paydata,$pay_id);
+
+
+ }
+
+ }
+
+ public function payment_log(){
+ $this->load->view('Medical/payment_log');
+ }
+
+ public function payment_log_data(){
+
+ $opd_date_range=$this->input->post('opd_date_range');
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ $sql="SELECT p.* ,
+ (case p.Customerof_type when 1 then p.Medical_invoice_code when 2 then p.ipd_id when 3 then p.Medical_invoice_code ELSE 'Unknown' END) AS Inv_code,
+ (case p.Customerof_type when 1 then 'UHID' when 2 then 'IPD' when 3 then 'CASH' ELSE 'Unknown' END) AS Bill_type
+ ,l.update_by,l.insert_datetime AS log_insert,l.update_type,l.update_log,
+ (case update_type when 3 then 'Change Amount' when 2 then 'Cash to Bank' when 1 then 'Bank to Cash' ELSE 'Unknown' END ) AS LOG_type
+ FROM payment_history_medical p JOIN paymentmedical_history_log l ON p.id=l.pay_id
+ where date(l.insert_datetime) between '".$minRange."' and '".$maxRange."'";
+ $query = $this->db->query($sql);
+ $data['paymentmedical_history_log']= $query->result();
+
+ //echo $sql;
+ $data['opd_date_range']=$opd_date_range;
+
+ $this->load->view('Medical/payment_log_data',$data);
+ }
+
+}
+
diff --git a/old_code_ci3/controllers/PhoneHMS.php b/old_code_ci3/controllers/PhoneHMS.php
new file mode 100644
index 0000000..1ecabfa
--- /dev/null
+++ b/old_code_ci3/controllers/PhoneHMS.php
@@ -0,0 +1,265 @@
+load->database();
+ $this->load->library(array('ion_auth','form_validation'));
+ $this->load->helper(array('url','language'));
+
+ $this->form_validation->set_error_delimiters($this->config->item('error_start_delimiter', 'ion_auth'), $this->config->item('error_end_delimiter', 'ion_auth'));
+
+ $this->lang->load('auth');
+
+ $this->load->model('SMS_M');
+ }
+
+ public function Login()
+ {
+ $login_id=$this->input->post('login');
+ $mobilecode=$this->input->post('mcode');
+
+ if ($this->ion_auth->login($login_id, $mobilecode, true))
+ {
+ $rvar=array(
+ 'loginID' => 1,
+ 'msg' => 'Wrong User Id or Password'
+ );
+ }
+ else
+ {
+ $rvar=array(
+ 'loginID' => 0,
+ 'msg' => 'Wrong User Id or Password'
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo header("Access-Control-Allow-Origin: *");
+ echo $encode_data;
+ }
+
+ public function PhoneGapProcess($reqcode=0)
+ {
+ if($reqcode==0)
+ {
+ if ($this->ion_auth->logged_in())
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $rvar=array(
+ 'loginName' => $user_name,
+ 'user_id' => $user_id
+ );
+ }else{
+ $rvar=array(
+ 'loginName' => '',
+ 'user_id' => 0
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo header("Access-Control-Allow-Origin: *");
+ echo $encode_data;
+ }
+
+ // Search OPD in Database
+
+ if($reqcode==1)
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ $sql = "select o.opd_id, o.doc_name,o.opd_code,o.P_name,o.p_id,Date_Format(o.apointment_date,'%d-%m-%Y') as App_Date,
+ p.p_code,p.mphone1,p.email1 ,if(o.insurance_id>1,'Org.','Direct') as Inv_Type,
+ m.mode_desc as PaymentMode,o.payment_mode
+ from (opd_master o join patient_master p on o.p_id=p.id ) join payment_mode m on o.payment_mode=m.id
+ WHERE (opd_code like '%".$sdata."' or p_code like '%".$sdata."' or P_name like '%".$sdata."%' or
+ mphone1 = '".$sdata."' or email1 = '".$sdata."') and o.apointment_date>Date_Add(curdate(),interval -7 day) order by o.opd_id desc limit 10";
+
+
+ $query = $this->db->query($sql);
+ $opd_list= $query->result_array();
+
+ $columns = array(
+ 0 =>'opd_id',
+ 1 => 'doc_name',
+ 2 => 'opd_code',
+ 3 => 'P_name',
+ 4=> 'App_Date',
+ 5=> 'p_code',
+ 6=> 'mphone1',
+ 7=> 'Inv_Type'
+ );
+
+ $output = array(
+ "recordsTotal" => intval( count($opd_list) ), // total number of records
+ "recdata" =>$opd_list,
+ "url" => substr($_SERVER['PHP_SELF'],0,19)
+ );
+
+ $encode_data = json_encode($output);
+ echo header("Access-Control-Allow-Origin: *");
+ echo $encode_data;
+
+ }
+
+ }
+
+ public function SelectOPD($opdid)
+ {
+ $sql = "select o.opd_id, o.doc_name,o.opd_code,o.P_name,o.p_id,Date_Format(o.apointment_date,'%d-%m-%Y') as App_Date,
+ p.p_code,p.mphone1,p.email1 ,if(o.insurance_id>1,'Org.','Direct') as Inv_Type,
+ m.mode_desc as PaymentMode,o.payment_mode
+ from (opd_master o join patient_master p on o.p_id=p.id ) join payment_mode m on o.payment_mode=m.id
+ WHERE o.opd_id=".$opdid;
+
+ $query = $this->db->query($sql);
+ $opd_data= $query->result_array();
+
+ $output = array(
+ "recordsTotal" => intval( count($opd_data) ), // total number of records
+ "recdata" =>$opd_data
+ );
+
+ $encode_data = json_encode($output);
+ echo header("Access-Control-Allow-Origin: *");
+ echo $encode_data;
+ }
+
+ public function save_image_opd($opdid)
+ {
+ $filename = 'OPD-'.$opdid.'-'.time() . '.jpg';
+
+ $folder_name='uploads/'.date('Ymd');
+
+ if (!file_exists($folder_name)) {
+ mkdir($folder_name, 0777, true);
+ }
+
+ //echo $folder_name;
+
+ $config['upload_path'] = $folder_name;
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ //$new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $filename;
+
+ $this->load->library('upload', $config);
+
+ if (!$this->upload->do_upload('file')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }else{
+ $data = array('upload_data' => $this->upload->data());
+
+ $this->load->model('File_M');
+
+ $file_insert_id=$this->File_M->insert($data['upload_data']);
+
+ $sql="select * from opd_master where opd_id=".$opdid;
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $pid=0;
+ $ipd_id=0;
+ $org_id=0;
+
+ if(count($opd_master)>0)
+ {
+ $pid=$opd_master[0]->p_id;
+ $ipd_id=$opd_master[0]->ipd_id;
+ $org_id=$opd_master[0]->insurance_case_id;
+ }
+
+ $udata = array(
+ 'upload_by'=> 'PhoneGap',
+ 'pid'=>$pid,
+ 'opd_id'=>$opdid,
+ 'ipd_id'=>$ipd_id,
+ 'case_id'=>$org_id,
+ 'upload_by_id'=>'0'
+ );
+
+ if($file_insert_id>0)
+ {
+ $this->File_M->update($udata,$file_insert_id);
+
+ //$user_name = $user->first_name.''. $user->last_name.':T-'.date('d-m-Y h:m:s');
+ $user_name ='PhoneGap';
+
+ $opdstatus=2;
+
+ if($opdstatus=='2')
+ {
+ $status_str='Visit Done';
+ }elseif($opdstatus=='3')
+ {
+ $status_str='Visit Cancel';
+ }
+
+ $opd_status_remark=$status_str.' Update By:'.$user_name;
+
+ $dataupdate = array(
+ 'opd_status' => $opdstatus,
+ 'opd_status_remark' => $opd_status_remark
+ );
+
+ $this->load->model('Opd_M');
+ $this->Opd_M->update($dataupdate,$opdid);
+ }
+
+ $rvar=array(
+ 'filename' => $filename,
+ 'upload' => 1
+ );
+
+ $encode_data = json_encode($rvar);
+ echo header("Access-Control-Allow-Origin: *");
+ echo $encode_data;
+
+ }
+ }
+
+ public function save_sms()
+ {
+ echo 'Hello';
+
+ $data = array(
+ 'sender' => $this->input->post('sender'),
+ 'inNumber' => $this->input->post('inNumber'),
+ 'content' => $this->input->post('content'),
+ 'keyword' => $this->input->post('keyword'),
+ 'comments' => trim(str_replace('JC','',$this->input->post('comments'))),
+ 'msgId' => $this->input->post('msgId'),
+ 'rcvd' => $this->input->post('rcvd'),
+ );
+
+ $insert_id=$this->SMS_M->insert_sms_inbox($data);
+
+
+ if(strlen($comments)>0)
+ {
+ $data_array=explode(" ",$comments);
+
+ $cmd_ID='';
+
+ if(isset($data_array[0]))
+ {
+ $cmd_ID=$data_array[0];
+ }
+
+ }
+
+
+ }
+
+
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/controllers/PhoneSMS.php b/old_code_ci3/controllers/PhoneSMS.php
new file mode 100644
index 0000000..5d1e072
--- /dev/null
+++ b/old_code_ci3/controllers/PhoneSMS.php
@@ -0,0 +1,28 @@
+load->model('SMS_M');
+ }
+
+ public function show_lab_report($file_id_encrpt)
+ {
+ $file_id=decode_dst($file_id_encrpt);
+
+ $sql="select * from file_upload_data where id=".$file_id;
+ $query = $this->db->query($sql);
+ $data['lab_file_details']= $query->result();
+
+ $this->load->view('PhoneSMS/lab_report_show',$data);
+ }
+
+
+
+
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Product_master.php b/old_code_ci3/controllers/Product_master.php
new file mode 100644
index 0000000..4f0614a
--- /dev/null
+++ b/old_code_ci3/controllers/Product_master.php
@@ -0,0 +1,632 @@
+load->view('Medical/Purchase/drug_master_list');
+ }
+
+ public function Product_search()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if(trim($sdata)=='')
+ {
+ $sql="select * from med_product_master order by id desc limit 100";
+ }else{
+ $sql="select * from med_product_master
+ where (item_name LIKE '%".$sdata."%'
+ OR genericname LIKE '%".$sdata."%'
+ OR id = '".$sdata."')";
+ }
+
+ $query = $this->db->query($sql);
+ $data['product_list']= $query->result();
+
+ $this->load->view('Medical/Purchase/product_search_result',$data);
+ }
+
+ public function Product_edit($Product_id)
+ {
+ $sql="SELECT m.* ,group_concat(c.med_cat_id) as cat_list
+ from med_product_master m left join med_product_cat_assign c on m.id=c.med_product_id
+ where m.id=".$Product_id;
+ $query = $this->db->query($sql);
+ $data['product_data']= $query->result();
+
+ $sql="Select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation']= $query->result();
+
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $sql="Select * from med_product_cat_master order by med_cat_desc";
+ $query = $this->db->query($sql);
+ $data['med_product_cat_master']= $query->result();
+
+
+ $this->load->view('Medical/Purchase/product_edit',$data);
+ }
+
+ public function Product_delete($Product_id)
+ {
+ $sql="Select count(*) as no_rec from inv_med_item where item_code=".$Product_id;
+ $query = $this->db->query($sql);
+ $product_sale_data= $query->result();
+
+ $sql="Select count(*) as no_rec from purchase_invoice_item where item_code=".$Product_id;
+ $query = $this->db->query($sql);
+ $product_purchase_data= $query->result();
+
+ $is_delete_master=0;
+
+ $data_show="";
+
+ if($product_sale_data[0]->no_rec>0 || $product_purchase_data[0]->no_rec>0)
+ {
+ if($product_sale_data[0]->no_rec>0){
+ $data_show.="This Product in Sale Invoice, So cann't Delete
";
+ }
+
+ if($product_purchase_data[0]->no_rec>0){
+ $data_show.="This Product in Purchase Invoice, So cann't Delete
";
+ }
+
+ }else{
+
+ $this->load->model('product_master_M');
+ $is_delete_master=$this->product_master_M->delete_master($Product_id);
+
+ if($is_delete_master==0)
+ {
+ $data_show.="Some Error on Delete this product
";
+ }else{
+ $data_show.="Deleted
";
+ }
+
+ }
+
+ echo $data_show;
+
+
+ }
+
+ public function NewProduct()
+ {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $sql="Select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation']= $query->result();
+
+ $sql="Select * from med_product_cat_master order by med_cat_desc";
+ $query = $this->db->query($sql);
+ $data['med_product_cat_master']= $query->result();
+
+
+ $this->load->view('Medical/Purchase/product_new',$data);
+ }
+
+ public function get_drug_master(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from drug_temp
+ where itemname like '".$q."%'";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['itemname'])).' | '.htmlentities(stripslashes($row['formulation_length'])).' | '.htmlentities(stripslashes($row['genericname']));
+ $new_row['value']=htmlentities(stripslashes($row['itemname'])).' | '.htmlentities(stripslashes($row['formulation_length'])).' | '.htmlentities(stripslashes($row['genericname']));
+
+ $new_row['l_itemname']=htmlentities(stripslashes($row['itemname']));
+
+ $new_row['l_genericname']=htmlentities(stripslashes($row['genericname']));
+
+ $new_row['l_formulation']=htmlentities(stripslashes($row['formulation']));
+
+ $new_row['l_company_name']=htmlentities(stripslashes($row['company_name']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }else{
+ echo 'No Data';
+ }
+ }
+
+ public function get_formulation_desc(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from med_formulation where formulation like '".$q."%'";
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['formulation_length']));
+ $new_row['value']=htmlentities(stripslashes($row['formulation']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_genericname(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $where="";
+
+ if(strlen($q)>3)
+ {
+ $where=" or gen_desc like '%".$q."%'";
+ }
+
+ $sql="select * from med_genric_name
+ where gen_desc like '".$q."%'".$where;
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['gen_desc']));
+ $new_row['value']=htmlentities(stripslashes($row['gen_desc']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_company_name(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from med_company where company_name like '".$q."%'";
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['company_name']));
+ $new_row['value']=htmlentities(stripslashes($row['company_name']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function product_master_update($product_id=0)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $is_unique = '';
+
+ if($product_id>0)
+ {
+
+ $original_value = $this->db->query("SELECT item_name FROM med_product_master WHERE id = ".$product_id)->row()->item_name ;
+
+ if(strtoupper($this->input->post('input_item_name')) != strtoupper($original_value)) {
+ $is_unique = '|is_unique[med_product_master.item_name]';
+ } else {
+ $is_unique = '';
+ }
+ }
+
+
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_item_name',
+ 'label' => 'Product Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'.$is_unique
+ ),
+ array(
+ 'field' => 'input_formulation',
+ 'label' => 'Formulation',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_packing_type',
+ 'label' => 'Packing',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_re_order_qty',
+ 'label' => 'Re-Order Qty',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_HSNCODE',
+ 'label' => 'HSNCODE',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_CGST',
+ 'label' => 'CGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_CGST',
+ 'label' => 'CGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_SGST',
+ 'label' => 'SGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $related_drug_id=$this->input->post('related_drug_id');
+
+ $ban_flag_id = ($this->input->post('chk_ban_flag_id')=='on'?1:0);
+
+ $narcotic = ($this->input->post('chk_narcotic')=='on'?1:0);
+ $schedule_h = ($this->input->post('chk_schedule_h')=='on'?1:0);
+ $schedule_h1 = ($this->input->post('chk_schedule_h1')=='on'?1:0);
+ $schedule_x = ($this->input->post('chk_schedule_x')=='on'?1:0);
+ $schedule_g = ($this->input->post('chk_schedule_g')=='on'?1:0);
+ $high_risk = ($this->input->post('chk_high_risk')=='on'?1:0);
+
+
+ $batch_applicable = ($this->input->post('chk_batch_applicable')=='on'?1:0);
+ $is_continue = ($this->input->post('chk_is_continue')=='on'?1:0);
+ $exp_date_applicable = ($this->input->post('chk_exp_date_applicable')=='on'?1:0);
+
+ $this->load->model('product_master_M');
+
+ $Pdata = array(
+ 'related_drug_id' => $related_drug_id,
+ 'item_name' => $this->input->post('input_item_name'),
+ 'formulation' => $this->input->post('input_formulation'),
+ 'genericname' => $this->input->post('input_genericname'),
+ 'packing' => $this->input->post('input_packing_type'),
+ 're_order_qty' => $this->input->post('input_re_order_qty'),
+ 'CGST_per' => $this->input->post('input_CGST'),
+ 'SGST_per' => $this->input->post('input_SGST'),
+ 'HSNCODE' => $this->input->post('input_HSNCODE'),
+
+ 'ban_flag_id' => $ban_flag_id,
+ 'batch_applicable' => $batch_applicable,
+ 'is_continue' => $is_continue,
+ 'exp_date_applicable' => $exp_date_applicable,
+
+ 'rack_no' => $this->input->post('input_rack_no'),
+ 'shelf_no' => $this->input->post('input_shelf_no'),
+ 'cold_storage' => $this->input->post('input_cold_storage'),
+
+ 'company_id' => $this->input->post('input_company_name'),
+
+ 'schedule_h' => $schedule_h,
+ 'schedule_h1' => $schedule_h1,
+ 'narcotic' => $narcotic,
+ 'schedule_x' => $schedule_x,
+ 'schedule_g' => $schedule_g,
+ 'high_risk' => $high_risk,
+ );
+
+ $show_text='';
+
+ $is_update_stock=0;
+
+ if($product_id<1)
+ {
+ $Pdata['insert_by'] = $user_name_info;
+ $is_update_stock=$this->product_master_M->insert($Pdata);
+ $product_id_update=$is_update_stock;
+ }else{
+ $Pdata['update_by'] = $user_name_info;
+ $is_update_stock=$this->product_master_M->update($Pdata,$product_id);
+ $product_id_update=$product_id;
+ }
+
+ $cat_id_list=$this->input->post('med_cat_id');
+
+ if($cat_id_list<>''){
+ $cat_id_list_string = implode(',', $cat_id_list);
+ }else{
+ $cat_id_list_string ="0";
+ }
+
+ $cat_assingn=$this->product_master_M->insert_update_product_cat_assign($cat_id_list_string,$product_id_update);
+
+ if($is_update_stock>0)
+ {
+ $send_msg="Updated";
+ }else{
+ $send_msg="Error : Update in Stock Table";
+ }
+
+ if($is_update_stock>0)
+ {
+ $show_text=Show_Alert('success','Updated',$send_msg);
+ }else{
+ $show_text=Show_Alert('danger','Error',$send_msg);
+ }
+
+ $rvar=array(
+ 'is_update_stock' =>$is_update_stock,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else
+ {
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'is_update_stock' =>0,
+ 'show_text'=>Show_Alert('danger','Error',$send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function company_master_list()
+ {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $this->load->view('Medical/Purchase/company_list',$data);
+ }
+
+ public function CompanyListSub()
+ {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $this->load->view('Medical/Purchase/company_list_sub',$data);
+
+ }
+
+ public function CompanyEdit($cid=0)
+ {
+ $sql="select * from med_company where id=".$cid;
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+
+
+ $this->load->view('Medical/Purchase/company_edit',$data);
+ }
+
+ public function CompanyUpdate()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_company_name',
+ 'label' => 'Company Name',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $cid=$this->input->post('hid_cid');
+ $company_name=$this->input->post('input_company_name');
+ $contact_person_name=$this->input->post('input_contact_person_name');
+ $contact_phone_no=$this->input->post('input_contact_phone_no');
+
+ $Udata = array(
+ 'company_name'=> $company_name,
+ 'contact_person_name'=> $contact_person_name,
+ 'contact_phone_no'=> $contact_phone_no,
+ );
+
+ $this->load->model('Medical_M');
+
+ if($cid>0)
+ {
+ $this->Medical_M->update_company($Udata,$cid);
+ $inser_id=$cid;
+ $send_msg="Saved Successfully";
+ }else{
+ $inser_id=$this->Medical_M->insert_company($Udata);
+ $send_msg="Added Successfully";
+ }
+
+ if($inser_id>0)
+ {
+ $show_text=$send_msg;
+ }else{
+ $show_text=$send_msg;
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else{
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'show_text'=>$send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function medicine_category()
+ {
+ $sql="Select * from med_product_cat_master order by med_cat_desc";
+ $query = $this->db->query($sql);
+ $data['med_product_cat_master']= $query->result();
+
+ $this->load->view('Medical/Purchase/med_product_cat_list',$data);
+ }
+
+ public function medicine_category_edit($cid=0)
+ {
+ $sql="select * from med_product_cat_master where id=".$cid;
+ $query = $this->db->query($sql);
+ $data['med_product_cat_master']= $query->result();
+
+ $this->load->view('Medical/Purchase/medicine_category_edit',$data);
+ }
+
+ public function medicine_category_Sub()
+ {
+ $sql="Select * from med_product_cat_master order by med_cat_desc";
+ $query = $this->db->query($sql);
+ $data['med_product_cat_master']= $query->result();
+
+ $this->load->view('Medical/Purchase/medicine_category_Sub',$data);
+
+ }
+
+ public function medicine_category_Update()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_med_cat_desc',
+ 'label' => 'Medicince Category Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'
+ ),
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $cid=$this->input->post('hid_cid');
+ $med_cat_desc=$this->input->post('input_med_cat_desc');
+
+ $Udata = array(
+ 'med_cat_desc'=> $med_cat_desc,
+ );
+
+ $this->load->model('Medical_M');
+
+ if($cid>0)
+ {
+ $this->Medical_M->update_med_product_cat_master($Udata,$cid);
+ $inser_id=$cid;
+ $send_msg="Saved Successfully";
+ }else{
+ $inser_id=$this->Medical_M->insert_med_product_cat_master($Udata);
+ $send_msg="Added Successfully";
+ }
+
+ if($inser_id>0)
+ {
+ $show_text=$send_msg;
+ }else{
+ $show_text=$send_msg;
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else{
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'show_text'=>$send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+
+
+ public function get_product_master(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from med_product_master
+ where item_name like '".$q."%'";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['item_name'])).' | '.htmlentities(stripslashes($row['formulation'])).' | '.htmlentities(stripslashes($row['genericname']));
+ $new_row['value']=htmlentities(stripslashes($row['item_name'])).' | '.htmlentities(stripslashes($row['formulation']));
+ //$new_row['value']=htmlentities(stripslashes($row['itemname']));
+
+ $new_row['l_item_code']=htmlentities(stripslashes($row['id']));
+
+ $new_row['l_itemname']=htmlentities(stripslashes($row['item_name']));
+
+ $new_row['l_packing']=htmlentities(stripslashes($row['packing']));
+ $new_row['l_CGST_per']=htmlentities(stripslashes($row['CGST_per']));
+ $new_row['l_SGST_per']=htmlentities(stripslashes($row['SGST_per']));
+ $new_row['l_HSNCODE']=htmlentities(stripslashes($row['HSNCODE']));
+
+ $new_row['l_genericname']=htmlentities(stripslashes($row['genericname']));
+
+ $new_row['l_formulation']=htmlentities(stripslashes($row['formulation']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }else{
+ echo 'No Data';
+ }
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Product_stock_master.php b/old_code_ci3/controllers/Product_stock_master.php
new file mode 100644
index 0000000..74e41a3
--- /dev/null
+++ b/old_code_ci3/controllers/Product_stock_master.php
@@ -0,0 +1,483 @@
+load->view('Medical/Storestock/drug_master_list');
+ }
+
+ public function Product_search()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if(trim($sdata)=='')
+ {
+ $sql="select * from med_store_product_master order by id desc limit 100";
+ }else{
+ $sql="select * from med_store_product_master
+ where (item_name LIKE '%".$sdata."%'
+ OR genericname LIKE '%".$sdata."%'
+ OR id = '".$sdata."')";
+ }
+
+ $query = $this->db->query($sql);
+ $data['product_list']= $query->result();
+
+ $this->load->view('Medical/Storestock/product_search_result',$data);
+ }
+
+ public function Product_edit($Product_id)
+ {
+ $sql="Select * from med_store_product_master where id=".$Product_id;
+ $query = $this->db->query($sql);
+ $data['product_data']= $query->result();
+
+ $this->load->view('Medical/Storestock/product_edit',$data);
+ }
+
+ public function Product_delete($Product_id)
+ {
+ $sql="Select count(*) as no_rec from inv_stock_item where item_code=".$Product_id;
+ $query = $this->db->query($sql);
+ $product_sale_data= $query->result();
+
+ $sql="Select count(*) as no_rec from purchase_invoice_item_stock where item_code=".$Product_id;
+ $query = $this->db->query($sql);
+ $product_purchase_data= $query->result();
+
+ $is_delete_master=0;
+
+ $data_show="";
+
+ if($product_sale_data[0]->no_rec>0 || $product_purchase_data[0]->no_rec>0)
+ {
+ if($product_sale_data[0]->no_rec>0){
+ $data_show.="This Product in Sale Invoice, So cann't Delete
";
+ }
+
+ if($product_purchase_data[0]->no_rec>0){
+ $data_show.="This Product in Purchase Invoice, So cann't Delete
";
+ }
+
+ }else{
+
+ $this->load->model('Product_stock_master_M');
+ $is_delete_master=$this->Product_stock_master_M->delete_master($Product_id);
+
+ if($is_delete_master==0)
+ {
+ $data_show.="Some Error on Delete this product
";
+ }else{
+ $data_show.="Deleted
";
+ }
+
+ }
+
+ echo $data_show;
+
+
+ }
+
+ public function NewProduct()
+ {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $sql="Select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation']= $query->result();
+
+ $this->load->view('Medical/Storestock/product_new',$data);
+ }
+
+ public function get_drug_master(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from drug_temp
+ where itemname like '".$q."%'";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['itemname'])).' | '.htmlentities(stripslashes($row['formulation_length'])).' | '.htmlentities(stripslashes($row['genericname']));
+ $new_row['value']=htmlentities(stripslashes($row['itemname'])).' | '.htmlentities(stripslashes($row['formulation_length'])).' | '.htmlentities(stripslashes($row['genericname']));
+
+ $new_row['l_itemname']=htmlentities(stripslashes($row['itemname']));
+
+ $new_row['l_genericname']=htmlentities(stripslashes($row['genericname']));
+
+ $new_row['l_formulation']=htmlentities(stripslashes($row['formulation']));
+
+ $new_row['l_company_name']=htmlentities(stripslashes($row['company_name']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }else{
+ echo 'No Data';
+ }
+ }
+
+ public function get_formulation_desc(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from med_formulation where formulation like '".$q."%'";
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['formulation_length']));
+ $new_row['value']=htmlentities(stripslashes($row['formulation']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_genericname(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $where="";
+
+ if(strlen($q)>3)
+ {
+ $where=" or gen_desc like '%".$q."%'";
+ }
+
+ $sql="select * from med_genric_name
+ where gen_desc like '".$q."%'".$where;
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['gen_desc']));
+ $new_row['value']=htmlentities(stripslashes($row['gen_desc']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function get_company_name(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from med_company where company_name like '".$q."%'";
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['company_name']));
+ $new_row['value']=htmlentities(stripslashes($row['company_name']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+ public function product_master_update($product_id=0)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $is_unique = '';
+
+ if($product_id>0)
+ {
+
+ $original_value = $this->db->query("SELECT item_name FROM med_store_product_master WHERE id = ".$product_id)->row()->item_name ;
+
+ if(strtoupper($this->input->post('input_item_name')) != strtoupper($original_value)) {
+ $is_unique = '|is_unique[med_product_master.item_name]';
+ } else {
+ $is_unique = '';
+ }
+ }
+
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_item_name',
+ 'label' => 'Product Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'.$is_unique
+ ),
+ array(
+ 'field' => 'input_packing_type',
+ 'label' => 'Packing',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_re_order_qty',
+ 'label' => 'Re-Order Qty',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $related_drug_id=$this->input->post('related_drug_id');
+
+ $ban_flag_id = ($this->input->post('chk_ban_flag_id')=='on'?1:0);
+
+ $narcotic = ($this->input->post('chk_narcotic')=='on'?1:0);
+ $schedule_h = ($this->input->post('chk_schedule_h')=='on'?1:0);
+ $schedule_h1 = ($this->input->post('chk_schedule_h1')=='on'?1:0);
+ $schedule_x = ($this->input->post('chk_schedule_x')=='on'?1:0);
+ $schedule_g = ($this->input->post('chk_schedule_g')=='on'?1:0);
+ $high_risk = ($this->input->post('chk_high_risk')=='on'?1:0);
+
+
+ $batch_applicable = ($this->input->post('chk_batch_applicable')=='on'?1:0);
+ $is_continue = ($this->input->post('chk_is_continue')=='on'?1:0);
+ $exp_date_applicable = ($this->input->post('chk_exp_date_applicable')=='on'?1:0);
+
+ $this->load->model('Product_stock_master_M');
+
+ $Pdata = array(
+ 'related_drug_id' => $related_drug_id,
+ 'item_name' => $this->input->post('input_item_name'),
+ 'formulation' => $this->input->post('input_formulation'),
+ 'genericname' => $this->input->post('input_genericname'),
+ 'packing' => $this->input->post('input_packing_type'),
+ 're_order_qty' => $this->input->post('input_re_order_qty'),
+ 'CGST_per' => $this->input->post('input_CGST'),
+ 'SGST_per' => $this->input->post('input_SGST'),
+ 'HSNCODE' => $this->input->post('input_HSNCODE'),
+
+ 'ban_flag_id' => $ban_flag_id,
+ 'batch_applicable' => $batch_applicable,
+ 'is_continue' => $is_continue,
+ 'exp_date_applicable' => $exp_date_applicable,
+
+ 'rack_no' => $this->input->post('input_rack_no'),
+ 'shelf_no' => $this->input->post('input_shelf_no'),
+ 'cold_storage' => $this->input->post('input_cold_storage'),
+
+ 'company_name' => $this->input->post('input_company_name'),
+
+ 'schedule_h' => $schedule_h,
+ 'schedule_h1' => $schedule_h1,
+ 'narcotic' => $narcotic,
+ 'schedule_x' => $schedule_x,
+ 'schedule_g' => $schedule_g,
+ 'high_risk' => $high_risk,
+ );
+
+ $show_text='';
+
+ $is_update_stock=0;
+
+ if($product_id<1)
+ {
+ $Pdata['insert_by'] = $user_name_info;
+ $is_update_stock=$this->Product_stock_master_M->insert($Pdata);
+ }else{
+ $Pdata['update_by'] = $user_name_info;
+ $is_update_stock=$this->Product_stock_master_M->update($Pdata,$product_id);
+ }
+
+ if($is_update_stock>0)
+ {
+ $send_msg="Updated";
+ }else{
+ $send_msg="Error : Update in Stock Table";
+ }
+
+ if($is_update_stock>0)
+ {
+ $show_text=Show_Alert('success','Updated',$send_msg);
+ }else{
+ $show_text=Show_Alert('danger','Error',$send_msg);
+ }
+
+ $rvar=array(
+ 'is_update_stock' =>$is_update_stock,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else
+ {
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'is_update_stock' =>0,
+ 'show_text'=>Show_Alert('danger','Error',$send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function company_master_list()
+ {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $this->load->view('Medical/Purchase/company_list',$data);
+ }
+
+ public function CompanyListSub()
+ {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $this->load->view('Medical/Purchase/company_list_sub',$data);
+
+ }
+
+ public function CompanyEdit($cid=0)
+ {
+ $sql="select * from med_company where id=".$cid;
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+
+
+ $this->load->view('Medical/Purchase/company_edit',$data);
+ }
+
+ public function CompanyUpdate()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_company_name',
+ 'label' => 'Company Name',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $cid=$this->input->post('hid_cid');
+ $company_name=$this->input->post('input_company_name');
+ $contact_person_name=$this->input->post('input_contact_person_name');
+ $contact_phone_no=$this->input->post('input_contact_phone_no');
+
+ $Udata = array(
+ 'company_name'=> $company_name,
+ 'contact_person_name'=> $contact_person_name,
+ 'contact_phone_no'=> $contact_phone_no,
+ );
+
+ $this->load->model('Medical_M');
+
+ if($cid>0)
+ {
+ $this->Medical_M->update_company($Udata,$cid);
+ $inser_id=$cid;
+ $send_msg="Saved Successfully";
+ }else{
+ $inser_id=$this->Medical_M->insert_company($Udata);
+ $send_msg="Added Successfully";
+ }
+
+ if($inser_id>0)
+ {
+ $show_text=$send_msg;
+ }else{
+ $show_text=$send_msg;
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else{
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'show_text'=>$send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+
+
+ public function get_product_master(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="select * from med_store_product_master
+ where item_name like '".$q."%'";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['item_name'])).' | '.htmlentities(stripslashes($row['formulation'])).' | '.htmlentities(stripslashes($row['genericname']));
+ $new_row['value']=htmlentities(stripslashes($row['item_name'])).' | '.htmlentities(stripslashes($row['formulation']));
+ //$new_row['value']=htmlentities(stripslashes($row['itemname']));
+
+ $new_row['l_item_code']=htmlentities(stripslashes($row['id']));
+
+ $new_row['l_itemname']=htmlentities(stripslashes($row['item_name']));
+
+ $new_row['l_packing']=htmlentities(stripslashes($row['packing']));
+ $new_row['l_CGST_per']=htmlentities(stripslashes($row['CGST_per']));
+ $new_row['l_SGST_per']=htmlentities(stripslashes($row['SGST_per']));
+ $new_row['l_HSNCODE']=htmlentities(stripslashes($row['HSNCODE']));
+
+ $new_row['l_genericname']=htmlentities(stripslashes($row['genericname']));
+
+ $new_row['l_formulation']=htmlentities(stripslashes($row['formulation']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }else{
+ echo 'No Data';
+ }
+ }
+
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Reffer.php b/old_code_ci3/controllers/Reffer.php
new file mode 100644
index 0000000..1a36bb3
--- /dev/null
+++ b/old_code_ci3/controllers/Reffer.php
@@ -0,0 +1,164 @@
+load->model('Reffer_M');
+
+ }
+
+ function index()
+ {
+ $sql="select *,date_format(date_of_add,'%d-%m-%Y') as str_dateadd from refer_master order by f_name";
+ $query = $this->db->query($sql);
+ $data['refer_master']= $query->result();
+
+ $this->load->view('hospital_refer/reffer_index',$data);
+ }
+
+ function reffer_add()
+ {
+ $sql="select * from refer_type ";
+ $query = $this->db->query($sql);
+ $data['refer_type']= $query->result();
+
+ $this->load->view('hospital_refer/reffer_add',$data);
+ }
+
+ function reffer_edit($refer_id)
+ {
+ $sql="select * from refer_master where id=$refer_id";
+ $query = $this->db->query($sql);
+ $data['data']= $query->result();
+
+ $sql="select * from refer_type ";
+ $query = $this->db->query($sql);
+ $data['refer_type']= $query->result();
+
+
+ $this->load->view('hospital_refer/reffer_edit',$data);
+ }
+
+ function save_new_user()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $cbo_title=$this->input->post('cbo_title');
+ $input_name=$this->input->post('input_name');
+ $cbo_refer_type=$this->input->post('cbo_refer_type');
+ $input_phone_number=$this->input->post('input_phone_number');
+
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_name',
+ 'label' => 'Name of Patient',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ );
+
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+
+ $data = array(
+ 'title' => $cbo_title,
+ 'f_name' => strtoupper($input_name),
+ 'refer_type' => $cbo_refer_type,
+ 'date_of_add' => date('Y-m-d H:i:s'),
+ 'insert_by' => $user_name,
+ 'phone_number'=> $input_phone_number,
+ 'active' => 1,
+ );
+
+
+ $inser_id=$this->Reffer_M->insert($data);
+ $rvar=array(
+ 'insertid' =>$inser_id
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else
+ {
+ $send_error=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+
+ function save_user($reffer_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $cbo_title=$this->input->post('cbo_title');
+ $input_name=$this->input->post('input_name');
+ $cbo_refer_type=$this->input->post('cbo_refer_type');
+ $input_phone_number=$this->input->post('input_phone_number');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_name',
+ 'label' => 'Name of Patient',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ );
+
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+
+ $data = array(
+ 'title' => $cbo_title,
+ 'f_name' => strtoupper($input_name),
+ 'refer_type' => $cbo_refer_type,
+ 'date_of_add' => date('Y-m-d H:i:s'),
+ 'insert_by' => $user_name,
+ 'phone_number'=> $input_phone_number,
+ 'active' => 1,
+ );
+
+ $this->Reffer_M->update($data,$reffer_id);
+ $rvar=array(
+ 'update' =>1
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else
+ {
+ $send_error=validation_errors();
+ $rvar=array(
+ 'update' =>0,
+ 'error_text'=>$send_error
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Report.php b/old_code_ci3/controllers/Report.php
new file mode 100644
index 0000000..a1d4fe9
--- /dev/null
+++ b/old_code_ci3/controllers/Report.php
@@ -0,0 +1,2395 @@
+load->library("Pdf");
+ }
+
+ public function opd() {
+
+ $this->load->library('table');
+
+ $template = array(
+ 'table_open' => '',
+ 'thead_open' => '',
+ 'thead_close' => ' ',
+
+ 'heading_row_start' => '',
+ 'heading_row_end' => ' ',
+ 'heading_cell_start' => '',
+ 'heading_cell_end' => ' ',
+
+ 'tbody_open' => '',
+ 'tbody_close' => ' ',
+
+ 'row_start' => '',
+ 'row_end' => ' ',
+ 'cell_start' => '',
+ 'cell_end' => ' ',
+
+ 'row_alt_start' => '',
+ 'row_alt_end' => ' ',
+ 'cell_alt_start' => '',
+ 'cell_alt_end' => ' ',
+
+ 'table_close' => '
'
+ );
+
+ $this->table->set_template($template);
+
+ $query = $this->db->query("select o.opd_code,o.P_name,o.apointment_date,o.doc_name
+ from opd_master o");
+
+ $table_show = $this->table->generate($query);
+
+ $content=$table_show;
+ $this->load->library('m_pdf');
+
+ $file_name="Report-OPD-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function index()
+ {
+ $this->load->view('Report/ReportMain');
+ }
+ public function report_opd_app()
+ {
+
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/rep_opd_p',$data);
+ }
+
+
+ public function report_charge_app()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/rep_other_charge',$data);
+ }
+
+ public function report_ipdpayment_app()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode where id in (1,2) ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/ipd_payment_report',$data);
+ }
+
+ public function report_totalpayment_app()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode where id in (1,2) ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/rep_total_payment',$data);
+ }
+
+ public function report_emp_total_app()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode where id in (1,2) ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/rep_collocation_emp',$data);
+ }
+
+ public function report_opd_app_show($opd_date_range,
+ $doc_name_id,$emp_name_id,$paymode_id,$order_1,$order_2,$group_by,$output=0)
+ {
+ $sql_f_all = "select o.opd_code,
+ o.P_name ,p_code ,Date_Format(o.apointment_date,'%d-%m-%Y') as 'App_Date',
+ o.doc_name ,if(o.insurance_id>1,'Org.','Direct') as 'Type',
+ m.mode_desc as 'PayMode',o.opd_fee_gross_amount as 'GrossAmt',
+ o.opd_discount as Discount, o.opd_fee_amount as 'FeeAmt',
+ o.prepared_by,IFNULL(GET_AGE_BY_DOB(dob),age) as Age ";
+
+ $sql_from=" from opd_master o join payment_mode m join patient_master p on o.payment_mode=m.id and p.id=o.p_id";
+
+ $sql_where=" Where (payment_mode>0 or running_opd=1) ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $data_show="";
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+ $sql_where.=" and Date(o.apointment_date) between '".$minRange."' and '".$maxRange. "'";
+
+ if($doc_name_id>0)
+ {
+ $sql_where.=" and o.doc_id='".$doc_name_id."'";
+ }
+
+ if($emp_name_id>0)
+ {
+ $sql_where.=" and o.prepared_by_id = '".$emp_name_id."'";
+ }
+
+ if($paymode_id>0)
+ {
+ $sql_where.=" and o.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by o.apointment_date";
+
+ if($order_1==0)
+ {
+ $sql_order.=' ,o.opd_id';
+ }
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,o.doc_name';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,o.prepared_by';
+ }
+
+ if($order_1==3)
+ {
+ $sql_order.=' ,m.mode_desc';
+ }
+
+ if($order_2==0)
+ {
+ $sql_order.=' ,o.opd_id';
+ }
+
+ if($order_2==1)
+ {
+ $sql_order.=' ,o.doc_name';
+ }
+
+ if($order_2==2)
+ {
+ $sql_order.=' ,o.prepared_by';
+ }
+
+
+ $table_start='';
+
+ if($group_by==0)
+ {
+ $table_head='';
+ $table_head.='OPD ID ';
+ $table_head.='Patient Name / Age ';
+ $table_head.='Patient Code ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Employee ';
+ $table_head.='Fee Amt. ';
+
+ $GroupSQL="select Date(o.apointment_date) as sdate,Date_Format(Date(o.apointment_date),'%d-%m-%Y') as strDate
+ from opd_master o ".$sql_where."
+ group by Date(o.apointment_date)";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+ foreach($data['group_rec'] as $row)
+ {
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='OPD Date : '.$row->strDate.' ';
+
+ $gwhere=" and Date(o.apointment_date)='".$row->sdate."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->opd_code.' ';
+ $table_body.=''.$rowdata->P_name.'/'.$rowdata->Age.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->PayMode.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->FeeAmt.' ';
+ $table_body.=' ';
+ $table_total_1=$table_total_1+$rowdata->FeeAmt;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $index++;
+ }
+ }
+
+ if($group_by==1)
+ {
+ $table_head='';
+ $table_head.='OPD ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Date ';
+ $table_head.='Pay Mode ';
+ $table_head.='Employee ';
+ $table_head.='Fee Amt. ';
+
+
+ $GroupSQL="select o.doc_id,doc_name
+ from opd_master o ".$sql_where." group by o.doc_id";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+ foreach($data['group_rec'] as $row)
+ {
+
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Doctor Name : Dr. '.$row->doc_name.' ';
+
+ $gwhere=" and doc_id='".$row->doc_id."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->opd_code.' ';
+ $table_body.=''.$rowdata->P_name.'/'.$rowdata->Age.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->App_Date.' ';
+ $table_body.=''.$rowdata->PayMode.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->FeeAmt.' ';
+ $table_body.=' ';
+ $table_total_1=$table_total_1+$rowdata->FeeAmt;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $index++;
+
+ }
+ }
+
+ if($group_by==2)
+ {
+ $table_head='';
+ $table_head.='OPD ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='App. Date ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Fee Amt. ';
+
+ $GroupSQL="select o.prepared_by
+ from opd_master o ".$sql_where." group by o.prepared_by";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+ foreach($data['group_rec'] as $row)
+ {
+
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Prepared By : '.$row->prepared_by.' ';
+
+ $gwhere=" and o.prepared_by='".$row->prepared_by."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->opd_code.' ';
+ $table_body.=''.$rowdata->P_name.'/'.$rowdata->Age.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->App_Date.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->PayMode.' ';
+ $table_body.=''.$rowdata->FeeAmt.' ';
+ $table_body.=' ';
+ $table_total_1=$table_total_1+$rowdata->FeeAmt;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $index++;
+
+ }
+ }
+
+
+ if($group_by==3)
+ {
+ $table_head='';
+ $table_head.='OPD ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Date ';
+ $table_head.='Doctor Name ';
+ $table_head.='Employee ';
+ $table_head.='Fee Amt. ';
+
+ $GroupSQL="select o.payment_mode,m.mode_desc as 'PayMode'
+ from opd_master o join payment_mode m on o.payment_mode=m.id
+ ".$sql_where." group by o.payment_mode";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+ foreach($data['group_rec'] as $row)
+ {
+
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Payment Mode : '.$row->PayMode.' ';
+
+ $gwhere=" and o.payment_mode='".$row->payment_mode."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->opd_code.' ';
+ $table_body.=''.$rowdata->P_name.'/'.$rowdata->Age.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->App_Date.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->FeeAmt.' ';
+ $table_body.=' ';
+ $table_total_1=$table_total_1+$rowdata->FeeAmt;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $index++;
+
+ }
+ }
+
+ $content=$data_show;
+ $file_name="Report-OPD".date('Ymdhis').".pdf";
+
+
+ if($output==0)
+ {
+
+ $this->load->library('m_pdf');
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($content,$file_name);
+ }
+
+
+
+ }
+
+
+ public function report_charge_app_show($opd_date_range,
+ $doc_name_id,$emp_name_id,$paymode_id,$order_1,$order_2,$group_by,$output=0)
+ {
+ $sql_f_all = "select i.id,i.invoice_code,p.p_fname,p.p_code,i.refer_by_other,
+ i.inv_date,Date_Format(i.inv_date,'%d-%m-%Y') as str_inv_date,i.invoice_status,
+ if(i.insurance_id>1,'Org.','Direct') as PType,i.prepared_by,
+ if(i.correction_amount>0,i.correction_net_amount,i.net_amount) as Amount,m.mode_desc ,
+ group_concat(t.item_name) as test_list";
+
+ $sql_from=" from invoice_master i join patient_master p join payment_mode m join invoice_item t
+ on i.attach_id=p.id and i.attach_type=0 and i.payment_mode=m.id and i.id=t.inv_master_id";
+
+ $sql_where=" Where i.invoice_status>0 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+
+
+ $sql_where.=" and Date(i.inv_date) between Date('".$minRange."') and Date('".$maxRange. "') ";
+
+ if($doc_name_id>0)
+ {
+ $sql_where.=" and i.refer_by_id='".$doc_name_id."'";
+ }
+
+ if($emp_name_id>0)
+ {
+ $sql_where.=" and i.prepared_by like '%[".$emp_name_id."]' ";
+ }
+
+ if($paymode_id>0)
+ {
+ $sql_where.=" and i.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by i.inv_date";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,i.refer_by_other';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,i.prepared_by';
+ }
+
+ if($order_1==3)
+ {
+ $sql_order.=' ,m.mode_desc';
+ }
+
+ if($order_2==1)
+ {
+ $sql_order.=' ,i.refer_by_other';
+ }
+
+ if($order_2==2)
+ {
+ $sql_order.=' ,i.prepared_by';
+ }
+
+
+ $table_start='';
+
+ if($group_by==0)
+ {
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Employee ';
+ $table_head.='Inv. Amt. ';
+
+ $GroupSQL="select Date(i.inv_date) as sdate,Date_Format(Date(i.inv_date),'%d-%m-%Y') as strDate
+ from invoice_master i where i.invoice_status>0 and Date(i.inv_date) between'".$minRange."' and '".$maxRange. "'
+ group by Date(i.inv_date)";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+
+ foreach($data['group_rec'] as $row)
+ {
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Invoice Date : '.$row->strDate.' ';
+
+ $gwhere=" and Date(i.inv_date)='".$row->sdate."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' group by i.id '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0;
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->invoice_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->refer_by_other.' ';
+ $table_body.=''.$rowdata->mode_desc.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->Amount.' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata->test_list.' ';
+ $table_total_1=$table_total_1+$rowdata->Amount;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+
+ }
+ }
+
+ if($group_by==1)
+ {
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Employee ';
+ $table_head.='Amount ';
+
+ $GroupSQL="select i.refer_by_id,refer_by_other
+ from invoice_master i where i.invoice_status>0 and Date(i.inv_date) between'".$minRange."' and '".$maxRange. "' group by i.refer_by_id";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+ foreach($data['group_rec'] as $row)
+ {
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Doctor Name : Dr. '.$row->refer_by_other.' ';
+
+ $gwhere=" and i.refer_by_id='".$row->refer_by_id."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' group by i.id '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->invoice_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->inv_date.' ';
+ $table_body.=''.$rowdata->mode_desc.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->Amount.' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata->test_list.' ';
+ $table_total_1=$table_total_1+$rowdata->Amount;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ }
+ }
+
+ if($group_by==2)
+ {
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Invoice Date ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Amount ';
+
+ $GroupSQL="select i.prepared_by
+ from opd_master i where i.invoice_status>0 and Date(i.apointment_date) between'".$minRange."' and '".$maxRange. "' group by i.prepared_by";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+
+ foreach($data['group_rec'] as $row)
+ {
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Prepared By : '.$row->prepared_by.' ';
+
+ $gwhere=" and i.prepared_by='".$row->prepared_by."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' group by i.id '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->invoice_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->inv_date.' ';
+ $table_body.=''.$rowdata->refer_by_other.' ';
+ $table_body.=''.$rowdata->mode_desc.' ';
+ $table_body.=''.$rowdata->Amount.' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata->test_list.' ';
+ $table_total_1=$table_total_1+$rowdata->Amount;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ }
+ }
+
+
+ if($group_by==3)
+ {
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Inv.Date ';
+ $table_head.='Ref. Doc. Name ';
+ $table_head.='Employee ';
+ $table_head.='Amount ';
+
+ $GroupSQL="select i.payment_mode,m.mode_desc as 'PayMode'
+ from invoice_master i join payment_mode m on i.payment_mode=m.id
+ where i.invoice_status>0 and Date(i.inv_date) between'".$minRange."' and '".$maxRange. "' group by i.payment_mode";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+ foreach($data['group_rec'] as $row)
+ {
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Payment Mode : '.$row->PayMode.' ';
+
+ $gwhere=" and i.payment_mode='".$row->payment_mode."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' group by i.id '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->invoice_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->inv_date.' ';
+ $table_body.=''.$rowdata->refer_by_other.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->Amount.' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata->test_list.' ';
+ $table_total_1=$table_total_1+$rowdata->Amount;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+
+
+ }
+ }
+
+ $content=$data_show;
+ $file_name="Report-OPD-".date('Ymdhis').".pdf";
+
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+
+ }else{
+
+ ExportExcel($content,$file_name);
+ }
+
+
+ }
+
+
+ public function report_ipdpayment_app_show($opd_date_range,
+ $doc_name_id,$emp_name_id,$paymode_id,$order_1,$order_2,$group_by,$output=0)
+ {
+ $sql_f_all = "select i.id,i.ipd_code,i.ipd_status,m.p_fname,m.p_code,contact_person_Name,
+ i.register_date,p.payment_date,p.id as pay_id,
+ Date_format(p.payment_date,'%d-%m-%Y') as strPayDate,
+ if(i.ipd_status=0,'Admit','Discharged') as IPD_Status,
+ if(p.credit_debit=0,p.amount,0) as C_Amount,
+ if(p.credit_debit=1,p.amount,0) as D_Amount,
+ if(p.payment_mode=1,'CASH','BANK') AS payment_mode_desc,
+ doc.doc_name,doc_list,p.update_by AS prepared_by,p.remark,
+ if(i.case_id=0,'','INSURED') as insurance_type";
+
+ $sql_from=" FROM ((payment_history p join ipd_master i on i.id=p.payof_id AND p.payof_type=4)
+ join patient_master m ON i.p_id=m.id)
+ JOIN (select l.ipd_id,group_concat(d.p_fname) as doc_name,group_concat(d.id) as doc_list from ipd_master_doc_list l
+ join doctor_master d on l.doc_id=d.id group by l.ipd_id ) as doc
+ on i.id=doc.ipd_id";
+
+ $sql_where=" Where 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+ $sql_where.=" and Date(p.payment_date) between '".$minRange."' and '".$maxRange. "'";
+
+ if($doc_name_id>0)
+ {
+ $sql_where.=" and FIND_IN_SET('".$doc_name_id."',doc_list) ";
+ }
+
+ if($emp_name_id>0)
+ {
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.") ";
+ }
+
+ if($paymode_id>0)
+ {
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by p.payment_date";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,doc.doc_name';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,p.update_by';
+ }
+
+ if($order_1==3)
+ {
+ $sql_order.=' ,p.payment_mode';
+ }
+
+ if($order_2==1)
+ {
+ $sql_order.=' ,doc.doc_name';
+ }
+
+ if($order_2==2)
+ {
+ $sql_order.=' ,p.update_by';
+ }
+
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='Pay ID ';
+ $table_head.='IPD No ';
+ $table_head.='Patient Name ';
+ $table_head.='Pay Date ';
+ $table_head.='Pay Mode ';
+ $table_head.='TPA/Direct ';
+ $table_head.='Amount (Cr.) ';
+ $table_head.='Amount (Dr.) ';
+ $table_head.='Remark ';
+ $table_head.='Dr.Name ';
+ $table_head.='Employee ';
+
+ $data_show="";
+
+ if($group_by==-1)
+ {
+ $data_show.='Payment Date between: '.$minRange.' and '.$maxRange. ' ';
+
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->pay_id.' ';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->insurance_type.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+ }
+
+ $TOTAL_AMT=$table_total_1-$table_Dr_total_1;
+ $table_footer='';
+ $table_footer.='Net Amt. (Cr-Dr) : '.$TOTAL_AMT.' ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+
+ }
+
+
+
+ if($group_by==0)
+ {
+
+
+ $GroupSQL="select Date(p.payment_date) as sdate,Date_Format(Date(p.payment_date),'%d-%m-%Y') as strDate
+ From ((payment_history p join ipd_master i on i.id=p.payof_id AND p.payof_type=4)
+ join patient_master m ON i.p_id=m.id)
+ where Date(p.payment_date) between'".$minRange."' and '".$maxRange. "'
+ group by Date(p.payment_date) ";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+ foreach($data['group_rec'] as $row)
+ {
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Payment Date : '.$row->strDate.' ';
+
+ $gwhere=" and Date(p.payment_date)='".$row->sdate."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->pay_id.' ';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->insurance_type.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+
+ }
+ }
+
+ if($group_by==1)
+ {
+
+
+ $GroupSQL="select doc.doc_name
+ from ((payment_history p join ipd_master i on i.id=p.payof_id AND p.payof_type=4)
+ join patient_master m ON i.p_id=m.id)
+ JOIN
+ (select l.ipd_id,group_concat(d.p_fname) as doc_name,group_concat(d.id) as doc_list from ipd_master_doc_list l
+ join doctor_master d on l.doc_id=d.id group by l.ipd_id ) as doc
+ on i.id=doc.ipd_id
+ where Date(p.payment_date) between'".$minRange."' and '".$maxRange. "' group by doc.doc_name";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ $index = 0;
+ $data_show="";
+
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Doctor Name : Dr. '.$row->doc_name.' ';
+
+ $gwhere=" and doc.doc_name='".$row->doc_name."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->pay_id.' ';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->insurance_type.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+
+ }
+ }
+
+ if($group_by==2)
+ {
+
+ $GroupSQL="select p.update_by as prepared_by
+ from ((payment_history p join ipd_master i on i.id=p.payof_id AND p.payof_type=4)
+ join patient_master m ON i.p_id=m.id)
+ Where Date(p.payment_date) between'".$minRange."' and '".$maxRange. "' group by p.prepared_by";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+ foreach($data['group_rec'] as $row)
+ {
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Prepared By : '.$row->prepared_by.' ';
+
+ $gwhere=" and p.update_by='".$row->prepared_by."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->pay_id.' ';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->insurance_type.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ }
+ }
+
+
+ if($group_by==3)
+ {
+
+ $GroupSQL="select p.payment_mode,p.payment_mode_desc
+ from ((payment_history p join ipd_master i on i.id=p.payof_id AND p.payof_type=4)
+ join patient_master m ON i.p_id=m.id)
+ Where Date(p.payment_date) between'".$minRange."' and '".$maxRange. "' group by p.payment_mode ";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ $index = 0;
+ $data_show="";
+
+
+ foreach($data['group_rec'] as $row)
+ {
+ if($index>0)
+ {
+ $data_show.="";
+ }
+
+ $data_show.='Payment Mode : '.$row->payment_mode_desc.' ';
+
+ $gwhere=" and p.payment_mode='".$row->payment_mode."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->pay_id.' ';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->insurance_type.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ }
+ }
+
+ $content=$data_show;
+
+
+ if($output==0)
+ {
+
+ $this->load->library('m_pdf');
+
+ // $content;
+ $file_name="Report-opd-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($content,'IPD_List_payment');
+ }
+
+ }
+
+ public function report_total_payment_app_show($opd_date_range,$emp_name_id,$paymode_id,$order_1,$output=0)
+ {
+ $sql_f_all = "select p.id,p.payment_date,date_format(p.payment_date,'%d-%m-%Y %H:%m') as str_payment_date,
+ case p.payof_type when 1 then 'OPD'
+ when 2 then 'Charges' when 3 then 'ORG' when 4 then 'IPD' else 'Other' end as PayType,
+ payof_id,p.payof_code,
+ if(credit_debit=0,amount,0) as Cr_Amount,
+ if(credit_debit=1,amount,0) as Dr_Amount,
+ p.remark,p.update_by,get_patientinfo(p.payof_type,payof_id) as P_Name,
+ case p.payment_mode when 1 then 'Cash' when 2 then 'Bank' end as Pay_Mode";
+
+ $sql_from=" from payment_history p ";
+
+ $sql_where=" Where 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(p.payment_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and p.payment_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.")";
+ }
+
+ if($paymode_id<1)
+ {
+ $sql_where.=" and p.payment_mode in (1,2) ";
+ }else{
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by p.id";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,p.update_by';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,p.payment_mode';
+ }
+
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='PayID ';
+ $table_head.='Date ';
+ $table_head.='Type of Payment ';
+ $table_head.='OPD/IPD/In. Code ';
+ $table_head.='Pay Mode ';
+ $table_head.='Amt (Cr.) ';
+ $table_head.='Amt (Dr.) ';
+ $table_head.='Remark ';
+ $table_head.='Employee ';
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ //echo $sql_f_all.$sql_from.$sql_where.' '.$sql_order;
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ // $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->id.' ';
+ $table_body.=''.$rowdata->str_payment_date.' ';
+ $table_body.=''.$rowdata->PayType.' ';
+ $table_body.=''.$rowdata->payof_code.' '.$rowdata->P_Name.' ';
+ $table_body.=''.$rowdata->Pay_Mode.' ';
+ $table_body.=''.$rowdata->Cr_Amount.' ';
+ $table_body.=''.$rowdata->Dr_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->update_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->Cr_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->Dr_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $Total_Amount=$table_total_1-$table_Dr_total_1;
+
+ $data_show.='Total Amount : '.$Total_Amount.'
';
+
+ if($output==0)
+ {
+ $content= $data_show;
+
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($data_show,'Payment');
+ }
+ }
+
+ public function report_charge_type($opd_date_range,$output=0)
+ {
+ $sql_f_all = "select p.id,p.payment_date,date_format(p.payment_date,'%d-%m-%Y %H:%m') as str_payment_date,
+ case p.payof_type when 1 then 'OPD'
+ when 2 then 'Charges' when 4 then 'IPD' else 'Other' end as PayType,
+ payof_id,p.payof_code,
+ if(credit_debit=0,amount,0) as Cr_Amount,
+ if(credit_debit=1,amount,0) as Dr_Amount,
+ p.remark,p.update_by,get_patientinfo(p.payof_type,payof_id) as P_Name,
+ case p.payment_mode when 1 then 'Cash' when 2 then 'Bank' end as Pay_Mode";
+
+ $sql_from=" from payment_history p ";
+
+ $sql_where=" Where 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(p.payment_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and p.payment_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.")";
+ }
+
+ if($paymode_id<1)
+ {
+ $sql_where.=" and p.payment_mode in (1,2) ";
+ }else{
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by p.id";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,p.update_by';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,p.payment_mode';
+ }
+
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='PayID ';
+ $table_head.='Date ';
+ $table_head.='Type of Payment ';
+ $table_head.='OPD/IPD/In. Code ';
+ $table_head.='Pay Mode ';
+ $table_head.='Amt (Cr.) ';
+ $table_head.='Amt (Dr.) ';
+ $table_head.='Remark ';
+ $table_head.='Employee ';
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ //echo $sql_f_all.$sql_from.$sql_where.' '.$sql_order;
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->id.' ';
+ $table_body.=''.$rowdata->str_payment_date.' ';
+ $table_body.=''.$rowdata->PayType.' ';
+ $table_body.=''.$rowdata->payof_code.' '.$rowdata->P_Name.' ';
+ $table_body.=''.$rowdata->Pay_Mode.' ';
+ $table_body.=''.$rowdata->Cr_Amount.' ';
+ $table_body.=''.$rowdata->Dr_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->update_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->Cr_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->Dr_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $Total_Amount=$table_total_1-$table_Dr_total_1;
+
+ $data_show.='Total Amount : '.$Total_Amount.'
';
+
+ $content=$data_show;
+ $this->load->library('m_pdf');
+
+
+
+ if($output==0)
+ {
+ $file_name="Report-opd-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($content,'IPD_List_payment');
+ }
+ }
+
+
+ public function report_emp_total($opd_date_range,$emp_name_id,$paymode_id,$order_1,$output=0)
+ {
+ $sql_f_all = "select p.update_by,
+ sum(if(p.payof_type=1,if(p.credit_debit=0,p.amount,0),0)) as OPD_Amount,
+ sum(if(p.payof_type=2,if(p.credit_debit=0,p.amount,0),0)) as Charge_Amount,
+ sum(if(p.payof_type=4,if(p.credit_debit=0,p.amount,0),0)) as IPD_Amount,
+ sum(if(p.payof_type=3,if(p.credit_debit=0,p.amount,0),0)) as ORG_Amount,
+ sum(if(p.credit_debit=1,p.amount,0)) as Return_Amount,
+ sum(if(p.credit_debit=0,p.amount,p.amount*-1)) as total_Amount ";
+
+ $sql_from=" from payment_history p ";
+
+ $sql_where=" Where 1=1 ";
+
+ $sql_group_by=" group by p.update_by_id ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(p.payment_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and p.payment_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.")";
+ }
+
+ if($paymode_id<1)
+ {
+ $sql_where.=" and p.payment_mode in (1,2) ";
+ }else{
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by p.update_by";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,p.update_by';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,p.payment_mode';
+ }
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='User ID ';
+ $table_head.='OPD Amount ';
+ $table_head.='Charge Amount ';
+ $table_head.='IPD Amount ';
+ $table_head.='ORG Amount ';
+ $table_head.='Return Amount ';
+ $table_head.='Total ';
+ $table_head.=' ';
+
+ $table_footer='';
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_opd=0.00;
+ $table_total_ipd=0.00;
+ $table_total_org=0.00;
+ $table_total_charge=0.00;
+ $table_total_return=0.00;
+ $table_total_all=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->update_by.' ';
+ $table_body.=''.$rowdata->OPD_Amount.' ';
+ $table_body.=''.$rowdata->Charge_Amount.' ';
+ $table_body.=''.$rowdata->IPD_Amount.' ';
+ $table_body.=''.$rowdata->ORG_Amount.' ';
+
+ $table_body.=''.$rowdata->Return_Amount.' ';
+ $table_body.=''.$rowdata->total_Amount.' ';
+ $table_body.=' ';
+
+
+ $table_total_opd=$table_total_opd+$rowdata->OPD_Amount;
+ $table_total_ipd=$table_total_ipd+$rowdata->IPD_Amount;
+ $table_total_org=$table_total_org+$rowdata->ORG_Amount;
+ $table_total_charge=$table_total_charge+$rowdata->Charge_Amount;
+ $table_total_return=$table_total_return+$rowdata->Return_Amount;
+ $table_total_all=$table_total_all+$rowdata->total_Amount;
+
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_opd.' ';
+ $table_footer.=''.$table_total_charge.' ';
+ $table_footer.=''.$table_total_ipd.' ';
+ $table_footer.=''.$table_total_org.' ';
+ $table_footer.=''.$table_total_return.' ';
+ $table_footer.=''.$table_total_all.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ if($output==0)
+ {
+ $content=$data_show;
+ $this->load->library('m_pdf');
+
+ $file_name="Report-opd-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+
+ ExportExcel($data_show,'Payment_Complie');
+ }
+ }
+
+ public function report_emp_total_daywise($opd_date_range,$emp_name_id,$paymode_id,$order_1,$output=0)
+ {
+ $sql_f_all = "select p.update_by_id,date_format(p.payment_date,'%d-%m-%Y') as g_payment_date,p.update_by,
+ sum(if(p.payof_type=1,if(p.credit_debit=0,p.amount,0),0)) as OPD_Amount,
+ sum(if(p.payof_type=2,if(p.credit_debit=0,p.amount,0),0)) as Charge_Amount,
+ sum(if(p.payof_type=4,if(p.credit_debit=0,p.amount,0),0)) as IPD_Amount,
+ sum(if(p.payof_type=3,if(p.credit_debit=0,p.amount,0),0)) as ORG_Amount,
+ sum(if(p.credit_debit=1,p.amount,0)) as Return_Amount,
+ sum(if(p.credit_debit=0,p.amount,p.amount*-1)) as total_Amount ";
+
+ $sql_from=" from payment_history p ";
+
+ $sql_where=" Where 1=1 ";
+
+ $sql_group_by=" group by date(p.payment_date), p.update_by_id ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+ $sql_where.=" and Date(p.payment_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.")";
+ }
+
+ if($paymode_id<1)
+ {
+ $sql_where.=" and p.payment_mode in (1,2) ";
+ }else{
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by date(p.payment_date)";
+
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='User ID ';
+ $table_head.='OPD Amount ';
+ $table_head.='Charge Amount ';
+ $table_head.='IPD Amount ';
+ $table_head.='ORG Amount ';
+ $table_head.='Return Amount ';
+ $table_head.='Total ';
+ $table_head.=' ';
+
+ $table_footer='';
+
+ $sql=$sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.' WITH rollup';
+
+ $query = $this->db->query($sql);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $data_show='';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ if($rowdata->g_payment_date=='' && $rowdata->update_by_id==''){
+
+ $table_footer='';
+ $table_footer.='Grand Total ';
+ $table_footer.=''.$rowdata->OPD_Amount.' ';
+ $table_footer.=''.$rowdata->Charge_Amount.' ';
+ $table_footer.=''.$rowdata->IPD_Amount.' ';
+ $table_footer.=''.$rowdata->ORG_Amount.' ';
+
+ $table_footer.=''.$rowdata->Return_Amount.' ';
+ $table_footer.=''.$rowdata->total_Amount.' ';
+ $table_footer.=' ';
+
+ $data_show.='Date(YYYY-MM-DD h:m) '.$rowdata->g_payment_date.'
';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ }else if($rowdata->update_by_id=='')
+ {
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$rowdata->OPD_Amount.' ';
+ $table_footer.=''.$rowdata->Charge_Amount.' ';
+ $table_footer.=''.$rowdata->IPD_Amount.' ';
+ $table_footer.=''.$rowdata->ORG_Amount.' ';
+
+ $table_footer.=''.$rowdata->Return_Amount.' ';
+ $table_footer.=''.$rowdata->total_Amount.' ';
+ $table_footer.=' ';
+
+ $data_show.='Date(YYYY-MM-DD h:m) '.$rowdata->g_payment_date.'
';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+ $data_show.='';
+ $table_body='';
+ $table_footer='';
+
+ }else{
+ $table_body.='';
+ $table_body.=''.$rowdata->update_by.' ';
+ $table_body.=''.$rowdata->OPD_Amount.' ';
+ $table_body.=''.$rowdata->Charge_Amount.' ';
+ $table_body.=''.$rowdata->IPD_Amount.' ';
+ $table_body.=''.$rowdata->ORG_Amount.' ';
+
+ $table_body.=''.$rowdata->Return_Amount.' ';
+ $table_body.=''.$rowdata->total_Amount.' ';
+ $table_body.=' ';
+
+ }
+ }
+
+ $content=$data_show;
+ if($output==0)
+ {
+
+ $this->load->library('m_pdf');
+
+ $file_name="Report-opd-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ //echo $content;
+ }else{
+
+ ExportExcel($content,'Payment_Complie');
+ }
+ }
+
+
+ public function report_opd_page()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/OPD_Report_Doctor',$data);
+ }
+
+ public function report_opd($opd_date_range,$doc_name_id,$output=0)
+ {
+ $sql_where=" 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+ $sql_where.=" and o.apointment_date between '".$minRange."' and '".$maxRange. "'";
+
+ if($doc_name_id>0)
+ {
+ $sql_where.=" and o.doc_id='".$doc_name_id."'";
+ }
+
+
+ $sql="select o.doc_id,o.doc_name,o.apointment_date,count(o.opd_id) as no_opd,
+ sum(o.opd_fee_amount) as OPD_Amount,
+
+ sum(if(o.payment_mode in (1,2),'1',0)) as Cash_no,
+ sum(if(o.payment_mode in (1,2),o.opd_fee_amount,0)) as Cash_Amount,
+
+ sum(if(o.payment_mode=4,'1',0)) as Org_Credit_no,
+ sum(if(o.payment_mode=4,o.opd_fee_amount,0)) as Org_Credit_Amount
+
+ from opd_master o
+ where ".$sql_where." and o.payment_status=1 AND o.opd_status IN (1,2)
+ group by o.doc_id,o.apointment_date with ROLLUP";
+
+ $query = $this->db->query($sql);
+ $opdlist= $query->result();
+
+ $srno=1;
+
+ $tableHead='
+
+
+ Doctor Name
+ Date
+ Total
+ Total.Amt.
+ No.Cash OPD
+ Cash Amt.
+ Org.OPD Credit
+ Org.Cr.Amt.
+ Net OPD
+ Net Amount
+
+ ';
+
+ $line='';
+ $tablefooter='
';
+ $FooterHead='';
+ foreach($opdlist as $row)
+ {
+
+ if($row->doc_id=='')
+ {
+
+ }elseif($row->apointment_date=='')
+ {
+ $line.='';
+ $line.='Total of Dr.'.$row->doc_name.' '.PHP_EOL;
+ $line.=''.$row->no_opd.' '.PHP_EOL;
+ $line.=''.$row->OPD_Amount.' '.PHP_EOL;
+ $line.=''.$row->Cash_no.' '.PHP_EOL;
+ $line.=''.$row->Cash_Amount.' '.PHP_EOL;
+ $line.=''.$row->Org_Credit_no.' '.PHP_EOL;
+ $line.=''.$row->Org_Credit_Amount.' '.PHP_EOL;
+ $line.=''.$row->no_opd.' '.PHP_EOL;
+ $line.=''.$row->OPD_Amount.' '.PHP_EOL;
+
+ $line.=" ";
+
+ $FooterHead.='Doctor :Dr. '.$row->doc_name.' / Total Net OPD : '.$row->no_opd.' / Total Amount : Rs.'.number_format($row->OPD_Amount,2).' ';
+
+
+ }else
+ {
+ $line.='';
+ $line.=''.$row->doc_name.' '.PHP_EOL;
+ $line.=''.$row->apointment_date.' '.PHP_EOL;
+ $line.=''.$row->no_opd.' '.PHP_EOL;
+ $line.=''.$row->OPD_Amount.' '.PHP_EOL;
+ $line.=''.$row->Cash_no.' '.PHP_EOL;
+ $line.=''.$row->Cash_Amount.' '.PHP_EOL;
+ $line.=''.$row->Org_Credit_no.' '.PHP_EOL;
+ $line.=''.$row->Org_Credit_Amount.' '.PHP_EOL;
+ $line.=''.$row->no_opd.' '.PHP_EOL;
+ $line.=''.$row->OPD_Amount.' '.PHP_EOL;
+
+ $line.=" ";
+ }
+ }
+
+ $print_data= $tableHead.$line.$tablefooter.' '.$FooterHead;
+ $content=$print_data;
+
+ if($output==0)
+ {
+
+ $this->load->library('m_pdf');
+
+ $file_name="Report-opd-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+
+ ExportExcel($content,'OPDList');
+ }
+
+ }
+
+ function report_opd_total()
+ {
+
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/opd_report_total',$data);
+ }
+
+
+ function opd_total_data($opd_date_range,$doc_name_id,$emp_name_id,$paymode_id,$output=0)
+ {
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $sql_where =" 1=1 " ;
+
+ $sql_where.=" and o.apointment_date between '".$minRange."' and '".$maxRange. "'";
+
+ if($doc_name_id>0)
+ {
+ $sql_where.=" and o.doc_id='".$doc_name_id."'";
+ }
+
+ if($emp_name_id>0)
+ {
+ $sql_where.=" and o.prepared_by like '%[".$emp_name_id."]'";
+ }
+
+ if($paymode_id>0)
+ {
+ $sql_where.=" and o.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql="SELECT o.doc_name,
+ o.opd_fee_desc,o.opd_fee_amount,
+ sum(if(o.opd_status IN (1,2),1,0)) AS No_opd,
+ sum(if(o.opd_status IN (1,2),o.opd_fee_amount,0)) AS T_Amt
+ FROM opd_master o
+ where ".$sql_where."
+ AND o.opd_status IN (1,2) and
+ o.payment_status=1 AND (payment_mode>0 or running_opd=1)
+ GROUP BY o.opd_fee_id,o.opd_fee_type,o.opd_fee_amount";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $OPD_list= $query->result();
+
+ $sql="SELECT o.doc_name,
+ o.opd_fee_desc,o.opd_fee_amount,
+ sum(if(o.opd_status IN (3),1,0)) AS No_opd,
+ sum(if(o.opd_status IN (3),o.opd_fee_amount,0)) AS T_Amt
+ FROM opd_master o
+ where ".$sql_where."
+ AND o.opd_status IN (3) and
+ o.payment_status=1 AND (payment_mode>0 or running_opd=1)
+ GROUP BY o.opd_fee_id,o.opd_fee_type,o.opd_fee_amount";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $OPD_list_cancel= $query->result();
+
+ $content='';
+
+ $content.='
+ #
+ Dr Name
+ OPD Type
+ OPD Fee
+ No. of OPD
+ Tot.
+ ';
+ $sr_no=0;
+ $total_Payment=0;
+ $total_opd=0;
+
+ foreach($OPD_list as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ Dr. '.$row->doc_name.'
+ '.$row->opd_fee_desc.'
+ '.$row->opd_fee_amount.'
+ '.$row->No_opd.'
+ '.$row->T_Amt.'
+ ';
+ $total_Payment+= $row->T_Amt;
+ $total_opd+= $row->No_opd;
+ }
+
+ $content.='
+ #
+
+
+ Total
+ '.$total_opd.'
+ '.$total_Payment.'
+ ';
+
+ $content.="
";
+
+ //Cancel OPD
+
+ $content_cancel='
+ Cancel OPD
+ ';
+
+ $content_cancel.='
+ #
+ Dr Name
+ OPD Type
+ OPD Fee
+ No. of OPD
+ Tot.
+ ';
+ $sr_no=0;
+ $total_Payment=0;
+ $total_opd=0;
+
+ foreach($OPD_list_cancel as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content_cancel.='
+ '.$sr_no.'
+ Dr. '.$row->doc_name.'
+ '.$row->opd_fee_desc.'
+ '.$row->opd_fee_amount.'
+ '.$row->No_opd.'
+ '.$row->T_Amt.'
+ ';
+ $total_Payment+= $row->T_Amt;
+ $total_opd+= $row->No_opd;
+ }
+
+ $content_cancel.='
+ #
+
+
+ Total
+ '.$total_opd.'
+ '.$total_Payment.'
+ ';
+
+ $content_cancel.="
";
+
+ if(count($OPD_list_cancel)>0){
+ $content.=$content_cancel;
+ }
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+
+ $file_name='Report-OPD-'.date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'OPD_List'.date('Yms'));
+ }
+
+ }
+
+ public function report_totalpayment_bank_app()
+ {
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="SELECT b.id,b.bank_name,a.pay_type,a.id AS ac_id
+ FROM hospital_bank b JOIN hospital_bank_payment_source a ON b.id=a.bank_id";
+ $query = $this->db->query($sql);
+ $data['hospital_bank_payment_source']= $query->result();
+
+ $this->load->view('Report/rep_total_bank_payment',$data);
+ }
+
+
+ public function report_total_payment_bank_show($opd_date_range,$emp_name_id,$bank_id,$output=0)
+ {
+ $sql_f_all = "Select p.id,p.payment_date,date_format(p.payment_date,'%d-%m-%Y %H:%m') as str_payment_date,
+ case p.payof_type when 1 then 'OPD'
+ when 2 then 'Charges' when 3 then 'ORG' when 4 then 'IPD' else 'Other' end as PayType,
+ payof_id,p.payof_code,
+ if(credit_debit=0,amount,0) as Cr_Amount,
+ if(credit_debit=1,amount,0) as Dr_Amount,
+ p.remark,p.update_by,get_patientinfo(p.payof_type,payof_id) as P_Name,
+ case p.payment_mode when 1 then 'Cash' when 2 then 'Bank' end as Pay_Mode,
+ CONCAT(h.bank_name,':',b.pay_type) AS bank_pay_source";
+
+ $sql_from=" FROM (payment_history p LEFT JOIN hospital_bank_payment_source b ON p.pay_bank_id=b.id)
+ JOIN hospital_bank h ON b.bank_id=h.id ";
+
+ $sql_where=" Where 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if (!$this->ion_auth->in_group('ReportOLDREC')) {
+ $date1=date_create($minRange);
+ $date2=date_create(date('Y-m-d'));
+
+ $diff=date_diff($date1,$date2);
+
+ //echo $diff->format('%a');
+
+ $int_diff=$diff->format('%a');
+
+ if($int_diff>2)
+ {
+ date_sub($date2,date_interval_create_from_date_string("1 days"));
+ // date_format($date2,"Y-m-d");
+ $minRange=date_format($date2,"Y-m-d");;
+ }
+ }
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(p.payment_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and p.payment_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.")";
+ }
+
+ if($bank_id<1)
+ {
+ $sql_where.=" and p.payment_mode =2 ";
+ }else{
+ $sql_where.=" and p.payment_mode =2 and p.pay_bank_id = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by p.id";
+
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='PayID ';
+ $table_head.='Date ';
+ $table_head.='Bank ';
+ $table_head.='OPD/IPD/In. Code ';
+ $table_head.='Bank Source ';
+ $table_head.='Amt (Cr.) ';
+ $table_head.='Amt (Dr.) ';
+ $table_head.='Remark ';
+ $table_head.='Employee ';
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $sql= $sql_f_all.$sql_from.$sql_where.' '.$sql_order;
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ // $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->id.' ';
+ $table_body.=''.$rowdata->str_payment_date.' ';
+ $table_body.=''.$rowdata->PayType.' ';
+ $table_body.=''.$rowdata->payof_code.' '.$rowdata->P_Name.' ';
+ $table_body.=''.$rowdata->bank_pay_source.' ';
+ $table_body.=''.$rowdata->Cr_Amount.' ';
+ $table_body.=''.$rowdata->Dr_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->update_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->Cr_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->Dr_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $Total_Amount=$table_total_1-$table_Dr_total_1;
+
+ $data_show.='Total Amount : '.$Total_Amount.'
';
+
+
+
+ if($output==0)
+ {
+ $content= $data_show;
+
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($data_show.$sql,'Payment');
+ }
+ }
+
+
+
+}
+
+
+
+/* End of file c_test.php */
+/* Location: ./application/controllers/c_test.php */
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Report2.php b/old_code_ci3/controllers/Report2.php
new file mode 100644
index 0000000..429fec5
--- /dev/null
+++ b/old_code_ci3/controllers/Report2.php
@@ -0,0 +1,1151 @@
+db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from hc_item_type where is_ipd_opd in (0,1)";
+ $query = $this->db->query($sql);
+ $data['item_type_list']= $query->result();
+
+ $this->load->view('Report/rep_diagnosis',$data);
+ }
+
+ function report_Diagnosis_CASH()
+ {
+ $sql="select * from doctor_master where active=1";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from hc_item_type where is_ipd_opd in (0,1)";
+ $query = $this->db->query($sql);
+ $data['item_type_list']= $query->result();
+
+ $this->load->view('Report/rep_diagnosis_cash',$data);
+ }
+
+
+ function report_Diagnosis_EMP()
+ {
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from hc_item_type where is_ipd_opd in (0,1)";
+ $query = $this->db->query($sql);
+ $data['item_type_list']= $query->result();
+
+ $this->load->view('Report/rep_diagnosis_empwise',$data);
+ }
+
+ function report_Diagnosis_EMP_2()
+ {
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from hc_item_type where is_ipd_opd in (0,1)";
+ $query = $this->db->query($sql);
+ $data['item_type_list']= $query->result();
+
+ $this->load->view('Report/rep_diagnosis_empwise_2',$data);
+ }
+
+ function ipd_invoice_print($ipdno,$print=0) {
+
+ $sql="select * from ipd_master where id=".$ipdno;
+ $query = $this->db->query($sql);
+ $ipdmaster= $query->result();
+
+ $pno=$ipdmaster[0]->p_id;
+ $discount=$ipdmaster[0]->Discount;
+
+ $sql="select *,if(gender=1,'Male','Female') as xgender,
+ IFNULL(GET_AGE_BY_DOB(dob),age) AS age from patient_master where id='".$pno."' ";
+
+ $query = $this->db->query($sql);
+ $person_info= $query->result();
+
+ $total_med=0.00;
+ $total_charges=0.00;
+
+ if($ipdmaster[0]->case_id>0)
+ {
+ $sql="select * from organization_case_master where id='".$ipdmaster[0]->case_id."'";
+ $query = $this->db->query($sql);
+ $orgcase= $query->result();
+
+ $ins_comp_id=$orgcase[0]->insurance_id;
+ $inc_card_id=$orgcase[0]->insurance_card_id;
+
+ $sql="select * from hc_insurance_card where id='".$inc_card_id."'";
+ $query = $this->db->query($sql);
+ $hc_insurance_card= $query->result();
+
+ $sql="select * from hc_insurance where id='".$ins_comp_id."'";
+ $query = $this->db->query($sql);
+ $insurance= $query->result();
+ }
+
+ $sql="select * from v_ipd_bill_invoice v
+ where v.ipd_id=".$ipdno." ";
+
+ $query = $this->db->query($sql);
+ $showinvoice= $query->result();
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_med_master where payment_status=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $inv_med_total= $query->result();
+
+ $total_med=$inv_med_total[0]->tnet_amount;
+
+ $sql="select sum(net_amount) as tnet_amount from invoice_master where payment_status=1 and ipd_id = ".$ipdno;
+ $query = $this->db->query($sql);
+ $inv_charge_total= $query->result();
+
+ $total_charges=$inv_charge_total[0]->tnet_amount;
+
+ $sql="select *,case payment_mode when 1 then 'Cash' when 2 then 'Bank Card' when 3 then 'Return Cash ' when 4 then 'Bank Return' else 'Other' end as pay_mode from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $ipd_payment= $query->result();
+
+ $sql="select sum(if(credit_debit=0,amount,amount*-1)) as t_ipd_pay from ipd_payment where ipd_id='".$ipdno."' ";
+ $query = $this->db->query($sql);
+ $ipd_payment_total= $query->result();
+
+ $total_payment=$ipd_payment_total[0]->t_ipd_pay;
+
+ $net_amount=($total_charges+$total_med)-$discount;
+
+ $balance=$total_payment-$net_amount;
+
+ $inv_total=array(
+ 'total_med' => $total_med,
+ 'total_charges' => $total_charges,
+ 'total_payment' => $total_payment,
+ 'ipd_id' => $ipdno,
+ 'discount' => $discount,
+ 'balance' => $balance,
+ 'net_amount' => $net_amount
+ );
+
+ // make string html string
+
+ $htmlcontent='
+
+ #
+ Description
+ Unit
+ Rate
+ Amount
+ ';
+
+ $srno=1;
+ $headdesc='';
+ foreach($showinvoice as $row)
+ {
+ if($headdesc!=$row->Charge_type)
+ {
+ $htmlcontent.= '';
+ $htmlcontent.= ' ';
+ $htmlcontent.= ''.$row->Charge_type.' ';
+ $htmlcontent.= ' ';
+ $headdesc=$row->Charge_type;
+ }
+ $htmlcontent.= '';
+ $htmlcontent.= ''.$srno.' ';
+ $htmlcontent.= ''.$row->idesc.' ';
+ $htmlcontent.= ''.$row->no_qty.' ';
+ $htmlcontent.= ''.$row->item_rate.' ';
+ $htmlcontent.= ''.$row->amount.' ';
+ $srno=$srno+1;
+ $htmlcontent.= ' ';
+ }
+
+
+ // Total Show
+ $htmlcontent.='
+ #
+
+
+ Gross Total
+ '.$inv_total['total_charges'].'
+ ';
+
+ if($ipdmaster[0]->Discount>0) {
+ $htmlcontent.='
+ #
+ Discount Remark :'.$ipdmaster[0]->Discount_Remark.'
+
+ Discount
+ '.$ipdmaster[0]->Discount.'
+ ';
+ }
+
+ $htmlcontent.='
+ #
+
+
+ Net Amount
+ '.$inv_total['net_amount'].'
+ ';
+
+ $htmlcontent.='
+ #
+
+ Payment Recd. ';
+
+ $i=1;
+ foreach($ipd_payment as $row)
+ {
+ $i=$i+1;
+ $htmlcontent.= '['.$row->id.':'.$row->pay_mode.':'.$row->amount.'] /';
+ if($i & 1)
+ {
+ $htmlcontent.= ' ';
+ }
+ }
+
+ $htmlcontent.='
+
+
+ '.$ipd_payment_total[0]->t_ipd_pay.'
+ ';
+
+
+ $htmlcontent.='
+ #
+
+
+ Balance
+ '.$inv_total['balance'].'
+ ';
+
+ $htmlcontent.='
';
+
+ $content=$htmlcontent;
+ $this->load->library('m_pdf');
+
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+
+ }
+
+ public function report_Diagnosis_total($opd_date_range,$doc_id,$Diagnosis_id)
+ {
+ $sql_f_all = "select m.refer_by_other,y.group_desc,t.item_name,count(t.id) as No_test,
+ sum(t.item_qty) as No_qty,
+ sum(Round(if(m.invoice_status=1,(t.item_amount-(t.item_amount*m.discount_amount/m.total_amount)),0),2)) as Total_Amount,
+ sum(if(m.invoice_status=1,t.item_amount,0)) as Total_Act_Amount ";
+
+ $sql_from=" from invoice_master m join invoice_item t join hc_item_type y
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and y.is_ipd_opd in (0,1)
+ and m.invoice_status=1";
+
+ $sql_where=" Where 1=1 ";
+
+ $sql_group_by=" group by m.refer_by_id,m.refer_by_other,t.item_id ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(m.inv_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and m.inv_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ if($doc_id>0)
+ {
+ $doc_id=str_replace('S',',',$doc_id);
+
+ $sql_where.=" and m.refer_by_id in (".$doc_id.")";
+ }
+
+ if($Diagnosis_id>0)
+ {
+ $Diagnosis_id=str_replace('S',',',$Diagnosis_id);
+ $sql_where.=" and t.item_type in (".$Diagnosis_id.")";
+ }
+
+ $sql_order=" Order by m.refer_by_other,y.group_desc,t.item_name";
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.=' ';
+ $table_head.=' ';
+ $table_head.='Test Name ';
+ $table_head.='No. of Test ';
+ $table_head.='Amount ';
+ $table_head.='Cost Amt ';
+ $table_head.=' ';
+
+ $table_footer='';
+
+
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order);
+ $rowdata= $query->result();
+
+ //echo $sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order;
+
+ $table_body='';
+ $table_Doctor_Total=0.00;
+ $table_qty_total=0.00;
+ $table_Diagnosis_Head_Total=0.00;
+ $table_Grand_Total=0.00;
+
+ $table_Doctor_act_Total=0.00;
+ $table_Diagnosis_act_Head_Total=0.00;
+ $table_Grand_act_Total=0.00;
+ $table_grand_qty_total=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+ $doc_name_head='';
+ $Diagnosis_head='';
+
+
+ for( $i = 0; $irefer_by_other<>$doc_name_head)
+ {
+ $table_body.='';
+ $table_body.='Refer By : '.$rowdata[$i]->refer_by_other.' ';
+ $table_body.=' ';
+ }
+
+ $doc_name_head=$rowdata[$i]->refer_by_other;
+
+ if($rowdata[$i]->group_desc<>$Diagnosis_head)
+ {
+
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->group_desc.' ';
+ $table_body.=' ';
+ }
+
+ $Diagnosis_head=$rowdata[$i]->group_desc;
+
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->item_name.' ';
+ $table_body.=''.$rowdata[$i]->No_qty.' ';
+ $table_body.=''.$rowdata[$i]->Total_Amount.' ';
+ $table_body.=''.$rowdata[$i]->Total_Act_Amount.' ';
+ $table_body.=' ';
+
+ $table_Doctor_Total=$table_Doctor_Total+$rowdata[$i]->Total_Amount;
+ $table_Diagnosis_Head_Total=$table_Diagnosis_Head_Total+$rowdata[$i]->Total_Amount;
+ $table_Grand_Total=$table_Grand_Total+$rowdata[$i]->Total_Amount;
+ $table_qty_total=$table_qty_total+$rowdata[$i]->No_qty;
+
+ $table_Doctor_act_Total=$table_Doctor_act_Total+$rowdata[$i]->Total_Act_Amount;
+ $table_Diagnosis_act_Head_Total=$table_Diagnosis_act_Head_Total+$rowdata[$i]->Total_Act_Amount;
+ $table_Grand_act_Total=$table_Grand_act_Total+$rowdata[$i]->Total_Act_Amount;
+ $table_grand_qty_total=$table_grand_qty_total+$rowdata[$i]->No_qty;
+
+ if($Diagnosis_id<1)
+ {
+ if($igroup_desc<>$Diagnosis_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total of '.$Diagnosis_head.' ';
+ $table_body.=''.$table_Diagnosis_Head_Total.' ';
+ $table_body.=''.$table_Diagnosis_act_Head_Total.' ';
+ $table_body.=' ';
+
+ $table_Diagnosis_Head_Total=0.00;
+ $table_Diagnosis_act_Head_Total=0.00;
+ $table_qty_total=0.00;
+ }
+ }else{
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total of '.$Diagnosis_head.' ';
+ $table_body.=''.$table_Diagnosis_Head_Total.' ';
+ $table_body.=''.$table_Diagnosis_act_Head_Total.' ';
+ $table_body.=' ';
+
+ $table_Diagnosis_Head_Total=0.00;
+ $table_Diagnosis_act_Head_Total=0.00;
+ $table_qty_total=0.00;
+ }
+
+ }
+
+ if($irefer_by_other<>$doc_name_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total Doctor Head ';
+ $table_body.=''.$table_qty_total.' ';
+ $table_body.=''.$table_Doctor_Total.' ';
+ $table_body.=''.$table_Doctor_act_Total.' ';
+ $table_body.=' ';
+
+ $table_Doctor_Total=0.00;
+ $table_Doctor_act_Total=0.00;
+ $table_qty_total=0.00;
+
+ }
+ }else{
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total Doctor Head ';
+ $table_body.=''.$table_qty_total.' ';
+ $table_body.=''.$table_Doctor_Total.' ';
+ $table_body.=''.$table_Doctor_act_Total.' ';
+ $table_body.=' ';
+
+ $table_Doctor_Total=0.00;
+ $table_Doctor_act_Total=0.00;
+ $table_qty_total=0.00;
+ }
+
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=''.$table_grand_qty_total.' ';
+ $table_footer.=''.$table_Grand_Total.' ';
+ $table_footer.=''.$table_Grand_act_Total.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $content=$data_show;
+ $this->load->library('m_pdf');
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+
+ public function report_Diagnosis_Emp_total($opd_date_range,$emp_name_id,$Diagnosis_id)
+ {
+ $sql_f_all = "select m.invoice_code,p.p_code,p.p_fname,y.group_desc,t.item_name,t.item_qty,Round(if(m.invoice_status=1,(t.item_amount-(t.item_amount*m.discount_amount/m.total_amount)),0),2) as item_amount,
+ ph.RPaidAmount,ph.gupdate_by,ph.gupdate_by_id ";
+
+ $sql_from=" from ((invoice_master m join invoice_item t join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id )
+ join (select p.payof_type,p.payof_id,p.payof_code,sum(if(p.credit_debit=0,p.amount,p.amount*-1)) as RPaidAmount,
+ group_concat(distinct p.update_by) as gupdate_by,group_concat(distinct p.update_by_id) as gupdate_by_id
+ from payment_history p where p.payof_type=2
+ group by p.payof_type,p.payof_id) as ph on m.id=ph.payof_id) ";
+
+ $sql_where=" Where 1=1 ";
+
+ $sql_group_by=" ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(m.inv_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and m.inv_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and m.prepared_by_id in (".$emp_name_id.")";
+ }
+
+ if($Diagnosis_id>0)
+ {
+ $Diagnosis_id=str_replace('S',',',$Diagnosis_id);
+
+ $sql_where.=" and t.item_type in (".$Diagnosis_id.") ";
+ }
+
+ $sql_order=" Order by ph.gupdate_by,y.group_desc,t.item_name";
+
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.=' ';
+ $table_head.=' ';
+ $table_head.='Patient Code/Name ';
+ $table_head.='Test Name ';
+ $table_head.='Amount ';
+ $table_head.=' ';
+
+ $table_footer='';
+
+ $sql="SELECT m.invoice_code,p.p_code,p.p_fname,y.group_desc,t.item_name,t.item_qty, Round((t.item_amount-(t.item_amount*m.discount_amount/m.total_amount)),2) as item_amount,
+ m.prepared_by,m.prepared_by_id
+ FROM ((invoice_master m join invoice_item t ON m.id=t.inv_master_id AND m.invoice_status=1)
+ join hc_item_type y ON t.item_type=y.itype_id)
+ JOIN patient_master p ON m.attach_id=p.id
+ $sql_where
+ GROUP BY m.prepared_by_id,y.itype_id,t.id
+ Order By m.prepared_by,y.group_desc,m.invoice_code";
+
+ $query = $this->db->query($sql);
+ $rowdata= $query->result();
+
+ $table_body='';
+ $table_emp_Total=0.00;
+ $table_Diagnosis_Head_Total=0.00;
+ $table_Grand_Total=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+ $emp_name_head='';
+ $Diagnosis_head='';
+
+ for( $i = 0; $iprepared_by<>$emp_name_head)
+ {
+ $table_body.='';
+ $table_body.='Emp.Name : '.$rowdata[$i]->prepared_by.' ';
+ $table_body.=' ';
+ }
+
+ $emp_name_head=$rowdata[$i]->prepared_by;
+
+ if($rowdata[$i]->group_desc<>$Diagnosis_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->group_desc.' ';
+ $table_body.=' ';
+ }
+
+ $Diagnosis_head=$rowdata[$i]->group_desc;
+
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->p_code.'/'.$rowdata[$i]->p_fname.' ';
+ $table_body.=''.$rowdata[$i]->invoice_code.' ';
+ $table_body.=''.$rowdata[$i]->item_name.' ';
+ $table_body.=''.$rowdata[$i]->item_amount.' ';
+ $table_body.=' ';
+
+ $table_emp_Total=$table_emp_Total+$rowdata[$i]->item_amount;
+ $table_Diagnosis_Head_Total=$table_Diagnosis_Head_Total+$rowdata[$i]->item_amount;
+ $table_Grand_Total=$table_Grand_Total+$rowdata[$i]->item_amount;
+
+ if($Diagnosis_id<1)
+ {
+ if($igroup_desc<>$Diagnosis_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total of '.$Diagnosis_head.' ';
+ $table_body.=''.$table_Diagnosis_Head_Total.' ';
+ $table_body.=' ';
+
+ $table_Diagnosis_Head_Total=0.00;
+ }
+ }else{
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total of '.$Diagnosis_head.' ';
+ $table_body.=''.$table_Diagnosis_Head_Total.' ';
+ $table_body.=' ';
+
+ $table_Diagnosis_Head_Total=0.00;
+ }
+
+ }
+
+ if($iprepared_by<>$emp_name_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total Emp Head ';
+ $table_body.=''.$table_emp_Total.' ';
+ $table_body.=' ';
+
+ $table_emp_Total=0.00;
+
+ }
+ }else{
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total Emp. Head ';
+ $table_body.=''.$table_emp_Total.' ';
+ $table_body.=' ';
+
+ $table_emp_Total=0.00;
+ }
+
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=''.$table_Grand_Total.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $sql_where.=" and (m.payment_part_balance>0 or m.discount_amount>0) ";
+ //Foot Data Describe Discount
+ $sql_f_all_2="select m.invoice_code,p.p_code,p.p_fname,m.discount_amount,m.discount_desc,m.disc_update_by,m.total_amount,
+ ph.RPaidAmount,ph.gupdate_by,ph.gupdate_by_id ,m.payment_part_received,m.payment_part_balance";
+
+ //echo $sql_f_all_2.$sql_from.$sql_where.' group by m.id'.$sql_order;
+ $query2=$sql_f_all_2.$sql_from.$sql_where.' group by m.id'.$sql_order;
+ $query = $this->db->query($sql_f_all_2.$sql_from.$sql_where.' group by m.id'.$sql_order);
+ $rowfootdata= $query->result();
+
+ if(count($rowfootdata)>0)
+ {
+
+ $data_show.=' ';
+
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Code/Name ';
+ $table_head.='T Amount ';
+ $table_head.='Disc.Amt ';
+ $table_head.='Disc.By ';
+ $table_head.='Rec.Amt. ';
+ $table_head.='Balance ';
+ $table_head.=' ';
+
+ $T_Discount_Amt=0.00;
+ $T_Balance_Amt=0.00;
+
+ $table_body="";
+
+ for( $i = 0; $i';
+ $table_body.=''.$rowfootdata[$i]->invoice_code.' ';
+ $table_body.=''.$rowfootdata[$i]->p_code.'/'.$rowfootdata[$i]->p_fname.' ';
+ $table_body.=''.$rowfootdata[$i]->total_amount.' ';
+ $table_body.=''.$rowfootdata[$i]->discount_amount.' ';
+ $table_body.=''.$rowfootdata[$i]->discount_desc.' ';
+ $table_body.=''.$rowfootdata[$i]->RPaidAmount.' ';
+ $table_body.=''.$rowfootdata[$i]->payment_part_balance.' ';
+ $table_body.='';
+
+ $T_Discount_Amt=$T_Discount_Amt+$rowfootdata[$i]->discount_amount;
+ $T_Balance_Amt=$T_Balance_Amt+$rowfootdata[$i]->payment_part_balance;
+ }
+
+ $table_footer='';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=''.$T_Discount_Amt.' ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=''.$T_Balance_Amt.' ';
+ $table_footer.=' ';
+
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+ }
+
+ $content=$data_show;
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ public function report_Diagnosis_Emp_total_2($opd_date_range,$emp_name_id,$Diagnosis_id)
+ {
+ $sql_f_all = "select m.invoice_code,p.p_code,p.p_fname,y.group_desc,t.item_name,t.item_qty,
+ Round(if(m.invoice_status=1,(t.item_amount-(t.item_amount*m.discount_amount/m.total_amount)),0),2) as item_amount,
+ m.invoice_status ";
+ $sql_from=" from (invoice_master m join invoice_item t join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id
+ and payment_status=1 and m.invoice_status=1) ";
+
+ $sql_where=" Where 1=1 ";
+
+ $sql_group_by=" ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(m.inv_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and m.inv_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ if($Diagnosis_id>0)
+ {
+ $Diagnosis_id=str_replace('S',',',$Diagnosis_id);
+
+ $sql_where.=" and t.item_type in (".$Diagnosis_id.") ";
+ }
+
+ $sql_order=" Order by y.group_desc,t.item_name";
+
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.=' ';
+ $table_head.=' ';
+ $table_head.='Patient Code/Name ';
+ $table_head.='Test Name ';
+ $table_head.='Amount ';
+ $table_head.=' ';
+
+ $table_footer='';
+
+ $query1=$sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order;
+ $query = $this->db->query($query1);
+ $rowdata= $query->result();
+
+
+ $table_body='';
+ $table_emp_Total=0.00;
+ $table_Diagnosis_Head_Total=0.00;
+ $table_Grand_Total=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+ $emp_name_head='';
+ $Diagnosis_head='';
+
+ for( $i = 0; $igroup_desc<>$Diagnosis_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->group_desc.' ';
+ $table_body.=' ';
+ }
+
+ $Diagnosis_head=$rowdata[$i]->group_desc;
+
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->p_code.'/'.$rowdata[$i]->p_fname.' ';
+ $table_body.=''.$rowdata[$i]->invoice_code.' ';
+ $table_body.=''.$rowdata[$i]->item_amount.' ';
+ $table_body.=' ';
+
+
+ $table_Diagnosis_Head_Total=$table_Diagnosis_Head_Total+$rowdata[$i]->item_amount;
+ $table_Grand_Total=$table_Grand_Total+$rowdata[$i]->item_amount;
+
+ if($Diagnosis_id<1)
+ {
+ if($igroup_desc<>$Diagnosis_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total of '.$Diagnosis_head.' ';
+ $table_body.=''.$table_Diagnosis_Head_Total.' ';
+ $table_body.=' ';
+
+ $table_Diagnosis_Head_Total=0.00;
+ }
+ }else{
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total of '.$Diagnosis_head.' ';
+ $table_body.=''.$table_Diagnosis_Head_Total.' ';
+ $table_body.=' ';
+
+ $table_Diagnosis_Head_Total=0.00;
+ }
+
+ }
+
+
+
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=''.$table_Grand_Total.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $content=$data_show;
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+
+ public function report_Diagnosis_item_count($opd_date_range,$emp_name_id,$Diagnosis_id)
+ {
+ $sql_f_all = "select m.invoice_code,p.p_code,p.p_fname,y.group_desc,t.item_name,t.item_qty,
+ if(m.invoice_status=1,t.item_amount,0) as item_amount,m.invoice_status ";
+ $sql_from=" from (invoice_master m join invoice_item t join hc_item_type y join patient_master p
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and p.id=m.attach_id
+ and payment_status=1 and m.invoice_status=1) ";
+
+ $sql_where=" Where 1=1 ";
+
+ $sql_group_by=" ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(m.inv_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and m.inv_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ if($Diagnosis_id>0)
+ {
+ $Diagnosis_id=str_replace('S',',',$Diagnosis_id);
+
+ $sql_where.=" and t.item_type in (".$Diagnosis_id.") ";
+ }
+
+ $sql_order=" Order by y.group_desc,t.item_name";
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.=' ';
+ $table_head.=' ';
+ $table_head.='Patient Code/Name ';
+ $table_head.='Test Name ';
+ $table_head.='Amount ';
+ $table_head.=' ';
+
+ $table_footer='';
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+
+
+
+ $query1=$sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order;
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order);
+ $rowdata= $query->result();
+
+ $table_body='';
+ $table_emp_Total=0.00;
+ $table_Diagnosis_Head_Total=0.00;
+ $table_Grand_Total=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+ $emp_name_head='';
+ $Diagnosis_head='';
+
+ for( $i = 0; $igroup_desc<>$Diagnosis_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->group_desc.' ';
+ $table_body.=' ';
+ }
+
+ $Diagnosis_head=$rowdata[$i]->group_desc;
+
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->p_code.'/'.$rowdata[$i]->p_fname.' ';
+ $table_body.=''.$rowdata[$i]->invoice_code.' ';
+ $table_body.=''.$rowdata[$i]->item_amount.' ';
+ $table_body.=' ';
+
+
+ $table_Diagnosis_Head_Total=$table_Diagnosis_Head_Total+$rowdata[$i]->item_amount;
+ $table_Grand_Total=$table_Grand_Total+$rowdata[$i]->item_amount;
+
+ if($Diagnosis_id<1)
+ {
+ if($igroup_desc<>$Diagnosis_head)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total of '.$Diagnosis_head.' ';
+ $table_body.=''.$table_Diagnosis_Head_Total.' ';
+ $table_body.=' ';
+
+ $table_Diagnosis_Head_Total=0.00;
+ }
+ }else{
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.='Total of '.$Diagnosis_head.' ';
+ $table_body.=''.$table_Diagnosis_Head_Total.' ';
+ $table_body.=' ';
+
+ $table_Diagnosis_Head_Total=0.00;
+ }
+
+ }
+
+
+
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=' ';
+ $table_footer.=''.$table_Grand_Total.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $content=$data_show;
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+
+
+
+
+ public function report_Diagnosis_total_cash($opd_date_range,$doc_id,$Diagnosis_id,$output=0)
+ {
+ $sql_f_all = "select m.refer_by_id,d.p_fname,t.item_id,t.item_type,m.refer_by_other,
+ y.group_desc,t.item_name,count(t.id) as No_test,
+ sum(t.item_qty) as No_qty,sum(t.item_amount) as Total_Amount,
+ Round(sum(t.item_amount*m.net_amount/m.total_amount),2) as net_total";
+
+ $sql_from=" from (invoice_master m join invoice_item t join hc_item_type y
+ on m.id=t.inv_master_id and t.item_type=y.itype_id and y.is_ipd_opd in (0,1))
+ join doctor_master d on m.refer_by_id=d.id";
+
+ $sql_where=" Where m.payment_mode in (1,2) and m.payment_status=1 and m.invoice_status=1 and refer_by_id>0 ";
+
+ $sql_group_by=" group by m.refer_by_id Asc ,t.item_type Asc,t.item_id Asc with rollup ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(m.inv_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and m.inv_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ if($doc_id>0)
+ {
+ $doc_id=str_replace('S',',',$doc_id);
+
+ $sql_where.=" and m.refer_by_id in (".$doc_id.")";
+ }
+
+ if($Diagnosis_id>0)
+ {
+ $Diagnosis_id=str_replace('S',',',$Diagnosis_id);
+ $sql_where.=" and t.item_type in (".$Diagnosis_id.")";
+ }
+
+ $sql_order=" ";
+
+ $table_body='';
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.=' ';
+ $table_head.=' ';
+ $table_head.='Test Name ';
+ $table_head.='No. of Test ';
+ $table_head.='Amount (with Discount Amt.) ';
+ $table_head.=' ';
+
+ $table_footer='';
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order);
+ $rowdata= $query->result();
+
+ for( $i = 0; $i';
+ $table_body.='Dr. '.$rowdata[$i]->p_fname.' ';
+ $table_body.='';
+
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->group_desc.' ';
+ $table_body.=' ';
+ }
+
+ if($rowdata[$i]->item_id==null)
+ {
+ if($rowdata[$i]->item_type==null)
+ {
+ if($rowdata[$i]->refer_by_id==null)
+ {
+ $table_body.='';
+ $table_body.='Grand Total of All Doctors ';
+ $table_body.=''.$rowdata[$i]->net_total.' ';
+ $table_body.=' ';
+ }else{
+ $table_body.='';
+ $table_body.='Total of : Dr. '.$rowdata[$i]->p_fname.' ';
+ $table_body.=''.$rowdata[$i]->net_total.' ';
+ $table_body.=' ';
+
+ if(count($rowdata)>$i && $rowdata[$i+1]->refer_by_id !=null)
+ {
+ $table_body.='';
+ $table_body.='Dr. '.$rowdata[$i+1]->p_fname.' ';
+ $table_body.=' ';
+
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i+1]->group_desc.' ';
+ $table_body.=' ';
+ }
+ }
+
+ }else{
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.='Total of :'.$rowdata[$i]->group_desc.' ';
+ $table_body.=''.$rowdata[$i]->net_total.' ';
+ $table_body.=' ';
+
+ if(count($rowdata)>$i && $rowdata[$i+1]->refer_by_id <>null)
+ {
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i+1]->group_desc.' ';
+ $table_body.=' ';
+ }
+ }
+ }else{
+ $table_body.='';
+ $table_body.=' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata[$i]->item_name.' ';
+ $table_body.=''.$rowdata[$i]->No_qty.' ';
+ $table_body.=''.$rowdata[$i]->net_total.' ';
+ $table_body.=' ';
+ }
+ }
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ //echo $data_show;
+
+ if($output==0)
+ {
+ $content=$data_show;
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($data_show,'Diagnosis_Qty_cash'.date('Ymd'));
+ }
+ }
+
+
+ }
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Report3.php b/old_code_ci3/controllers/Report3.php
new file mode 100644
index 0000000..75af2f1
--- /dev/null
+++ b/old_code_ci3/controllers/Report3.php
@@ -0,0 +1,839 @@
+db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from h_insurance_group ";
+ $query = $this->db->query($sql);
+ $data['ins_group']= $query->result();
+
+ $sql="select * from hc_insurance order by short_name";
+ $query = $this->db->query($sql);
+ $data['hc_insurance']= $query->result();
+
+ $this->load->view('Report/Report_IPD',$data);
+ }
+
+ function ipd_report_2()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from h_insurance_group ";
+ $query = $this->db->query($sql);
+ $data['ins_group']= $query->result();
+
+ $sql="select * from hc_insurance order by short_name";
+ $query = $this->db->query($sql);
+ $data['hc_insurance']= $query->result();
+
+ $this->load->view('Report/IPD_Current_List',$data);
+ }
+
+ function ipd_report_3()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from h_insurance_group ";
+ $query = $this->db->query($sql);
+ $data['ins_group']= $query->result();
+
+ $this->load->view('Report/Report_medical',$data);
+ }
+
+ function ipd_discharge($daterange,$doc_name_id,$ipd_type,$ipd_status,$ipd_date,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+
+ $order_by="";
+
+ if($ipd_status>-1)
+ {
+ $where.=" and p.ipd_status=".$ipd_status;
+ }
+
+ if($ipd_date==0)
+ {
+ $where.=" and date(p.register_date) between '".$minRange."' and '".$maxRange."' " ;
+ $order_by.=" p.id";
+ }elseif($ipd_date==1)
+ {
+ $where.=" and date(p.discharge_date) between '".$minRange."' and '".$maxRange."' " ;
+ $order_by.=" p.discharge_date";
+ }
+
+ if($doc_name_id<>0)
+ {
+ $doc_array=explode("S",$doc_name_id);
+ $where.="and ( 1<>1 ";
+ foreach($doc_array as $row)
+ {
+ $where.=" OR FIND_IN_SET('".$row."',doc_list) ";
+ }
+
+ $where.=")";
+ }
+
+ if($ipd_type>=1){
+ $where.=" and group_ins=".$ipd_type." ";
+ }else if($ipd_type<0){
+ $where.=" and insurance_id=".($ipd_type*-1)." ";
+ }
+
+
+
+ $content="";
+
+ $sql="select p.ipd_code,p.p_fname,Date_Format(p.register_date,'%d-%m-%Y') as str_register_date,p_code,
+ Date_Format(p.discharge_date,'%d-%m-%Y') as str_discharge_date,p.admit_type,p.doc_name,p.status_desc,
+ p.charge_amount,p.package_charge_amount,p.med_amount,p.package_med_amount,p.chargeamount_all,p.Discount_all,
+ (p.charge_amount+p.med_amount+p.chargeamount_all-p.Discount_all) as net_Amount,p.paid_amount
+ from v_ipd_list p where ".$where." group by p.id order by $order_by";
+
+ //$content.= $sql;
+ $query = $this->db->query($sql);
+ $dischargelist= $query->result();
+
+ $total_paid_amount=0.00;
+ $total_net_amount=0.00;
+
+ $content="";
+
+ $content.='';
+
+ $content.='
+
+ #
+ IPD / UHID Code
+ Person Name
+ Admit /Discharge Date
+ Doc. Name
+ Net Amount
+ Paid Amt.
+ Status
+ TYPE
+
+ ';
+
+ $sr_no=0;
+ foreach($dischargelist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->ipd_code.' '.$row->p_code.'
+ '.$row->p_fname.'
+ '.$row->str_register_date.' '.$row->str_discharge_date.'
+ '.$row->doc_name.'
+ '.$row->net_Amount.'
+ '.$row->paid_amount.'
+ '.$row->status_desc.'
+ '.$row->admit_type.'
+ ';
+
+ $total_paid_amount+= $row->paid_amount;
+ $total_net_amount+= $row->net_Amount;
+ }
+
+ $content.='
+ #
+
+
+
+
+ '.$total_net_amount.'
+ '.$total_paid_amount.'
+
+
+ ';
+
+
+ $content.="
";
+ if($output==0)
+ {
+
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($content,'IPD_List');
+ }
+
+
+
+
+ }
+
+ function ipd_discharge_details($daterange,$doc_name_id,$ipd_type,$ipd_status,$ipd_date,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+ $order_by="";
+
+ if($ipd_status>-1)
+ {
+ $where.=" and p.ipd_status=".$ipd_status;
+ }
+
+ if($ipd_date==0)
+ {
+ $where.=" and p.register_date between '".$minRange."' and '".$maxRange."' " ;
+ $order_by.=" p.id";
+ }elseif($ipd_date==1)
+ {
+ $where.=" and p.discharge_date between '".$minRange."' and '".$maxRange."' " ;
+ $order_by.=" p.discharge_date";
+ }
+
+ if($doc_name_id<>0)
+ {
+ $doc_array=explode("S",$doc_name_id);
+ $where.="and ( 1<>1 ";
+ foreach($doc_array as $row)
+ {
+ $where.=" OR FIND_IN_SET('".$row."',doc_list) ";
+ }
+
+ $where.=")";
+ }
+
+ if($ipd_type>=1){
+ $where.=" and group_ins=".$ipd_type." ";
+ }else if($ipd_type<0){
+ $where.=" and insurance_id=".($ipd_type*-1)." ";
+ }
+
+
+ $sql="select p.ipd_code,p.P_mobile1,case_id_code,insurance_no,insurance_no_1,insurance_no_2,Org_insurance_comp,xgender,str_age,
+ p.p_fname,Date_Format(p.register_date,'%d-%m-%Y') as str_register_date,p.reg_time,p_code,
+ Date_Format(p.discharge_date,'%d-%m-%Y') as str_discharge_date,p.admit_type,p.doc_name,p.Bed_Desc,
+ p.charge_amount,p.package_charge_amount,p.med_amount,p.package_med_amount,p.chargeamount_all,p.Discount_all,
+ (p.charge_amount+p.med_amount+p.chargeamount_all-p.Discount_all) as net_Amount,p.paid_amount,
+ p.amount_recived,amount_deduction,p.org_approved_amount,status_desc
+ from v_ipd_list p where ".$where." group by p.id order by $order_by";
+
+ $query = $this->db->query($sql);
+ $dischargelist= $query->result();
+
+ $total_paid_amount=0.00;
+ $total_net_amount=0.00;
+
+ $content='';
+
+ $content.='
+ #
+ IPD Code
+ P Code
+ Person Name
+ Gender
+ Age
+
+
+ Card No.
+ Claim ID/Case ID
+ Claim ID/Case ID
+
+ Admit Date
+ Ad. Time
+ Discharge Date
+ Doc. Name
+
+ Charge Amt.
+ Medicine Amt.
+ Other Charge
+ Discount
+ Net Amount
+ Paid Amt.
+
+ TPA
+ Case Code
+ Insurance
+
+ TPA Approved Amt.
+ TPA Amt. Rec.
+ TPA Amt. Ded.
+
+ Pack. Amt.
+ Pack. Med. Amt.
+ Discharge Status
+
+
+ ';
+
+ $sr_no=0;
+ foreach($dischargelist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->ipd_code.'
+ '.$row->p_code.'
+ '.$row->p_fname.'
+ '.$row->xgender.'
+ '.$row->str_age.'
+
+ '.$row->insurance_no.'
+ '.$row->insurance_no_1.'
+ '.$row->insurance_no_2.'
+
+ '.$row->str_register_date.'
+ '.$row->reg_time.'
+ '.$row->str_discharge_date.'
+ '.$row->doc_name.'
+
+ '.$row->charge_amount.'
+ '.$row->med_amount.'
+ '.$row->chargeamount_all.'
+ '.$row->Discount_all.'
+ '.$row->net_Amount.'
+ '.$row->paid_amount.'
+
+ '.$row->admit_type.'
+ '.$row->case_id_code.'
+ '.$row->Org_insurance_comp.'
+
+ '.$row->org_approved_amount.'
+ '.$row->amount_recived.'
+ '.$row->amount_deduction.'
+
+ '.$row->package_charge_amount.'
+ '.$row->package_med_amount.'
+ '.$row->status_desc.'
+
+ ';
+ $total_paid_amount+= $row->paid_amount;
+ $total_net_amount+= $row->net_Amount;
+ }
+
+ $content.='
+ #
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ '.$total_net_amount.'
+ '.$total_paid_amount.'
+
+
+
+
+
+
+
+
+ ';
+
+
+ $content.="
";
+
+ //echo $content;
+ ExportExcel($content,'IPD_List');
+
+ }
+
+ function ipd_discharge_medical($daterange,$doc_name_id,$ipd_type,$ipd_status,$ipd_date,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" (p.med_amount>0 or p.package_med_amount>0 )" ;
+
+ if($ipd_status>-1)
+ {
+ $where.=" and p.ipd_status=".$ipd_status;
+ }
+
+ if($ipd_date==0)
+ {
+ $where.=" and p.register_date between '".$minRange."' and '".$maxRange."' " ;
+ }elseif($ipd_date==1)
+ {
+ $where.=" and p.discharge_date between '".$minRange."' and '".$maxRange."' " ;
+ }
+
+ if($doc_name_id>0)
+ {
+ $where.=" and FIND_IN_SET('".$doc_name_id."',doc_list) ";
+ }
+
+ if($ipd_type>=1){
+ $where.=" and group_ins=".$ipd_type." ";
+ }else if($ipd_type<0){
+ $where.=" and insurance_id=".($ipd_type*-1)." ";
+ }
+
+ $sql="select p.ipd_code,case_id_code,insurance_no,insurance_no_1,insurance_no_2,Org_insurance_comp,
+ p.p_fname,Date_Format(p.register_date,'%d-%m-%Y') as str_register_date,p_code,
+ Date_Format(p.discharge_date,'%d-%m-%Y') as str_discharge_date,p.admit_type,p.doc_name,p.Bed_Desc,
+ p.charge_amount,p.package_charge_amount,p.med_amount,p.package_med_amount,p.chargeamount_all,p.Discount_all,
+ (p.charge_amount+p.med_amount+p.chargeamount_all-p.Discount_all) as net_Amount,p.paid_amount,
+ p.amount_recived,amount_deduction,p.org_approved_amount
+ from v_ipd_list p where ".$where." group by p.id order by id";
+
+ $query = $this->db->query($sql);
+ $dischargelist= $query->result();
+
+ $total_med_amount=0.00;
+ $package_med_amount=0.00;
+ $total_net_amount=0.00;
+
+ $content="Date(YYYY-MM-DD) between ".$minRange." and ".$maxRange." ";
+
+ $content.='';
+
+ $content.='
+ #
+ IPD Code
+ Person Name
+ TPA
+ Net Amount
+ Medicine Amt.
+ Medicine Pack. Amt.
+ Doc. Name
+ ';
+
+ $sr_no=0;
+ foreach($dischargelist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->ipd_code.'
+ '.$row->p_fname.'
+ '.$row->admit_type.'
+ '.$row->net_Amount.'
+ '.$row->med_amount.'
+ '.$row->package_med_amount.'
+ '.$row->doc_name.'
+ ';
+ $total_med_amount+= $row->med_amount;
+ $package_med_amount+= $row->package_med_amount;
+ $total_net_amount+= $row->net_Amount;
+ }
+
+ $content.='
+ #
+
+
+
+ '.$total_net_amount.'
+ '.$total_med_amount.'
+ '.$package_med_amount.'
+
+ ';
+
+ $med_cr_amt=$package_med_amount+$total_med_amount;
+
+ $content.='
+ #
+ Total Medical Cr. Amount
+ '.$med_cr_amt.'
+
+ ';
+
+ $content.="
";
+
+ if($output==0)
+ {
+
+ $this->load->library('m_pdf');
+
+ $file_name="Report-Medical_".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($content,'IPD_Medical_List');
+ }
+
+ }
+
+
+ function ipd_current($doc_name_id,$ipd_type,$sortorder,$output=0)
+ {
+
+ $where =" p.ipd_status=0 " ;
+
+ if($doc_name_id>0)
+ {
+ $where.=" and FIND_IN_SET('".$doc_name_id."',doc_list) ";
+ }
+
+ if($ipd_type>=1){
+ $where.=" and group_ins=".$ipd_type." ";
+ }else if($ipd_type<0){
+ $where.=" and insurance_id=".($ipd_type*-1)." ";
+ }
+
+ $orderby=" Order By ";
+
+ if($sortorder==0)
+ {
+ $orderby.=" p.id";
+ }elseif($sortorder==1)
+ {
+ $orderby.=" p.register_date";
+ }elseif($sortorder==2)
+ {
+ $orderby.=" p.p_fname";
+ }else{
+ $orderby.=" p.Bed_Desc";
+ }
+
+ $sql="select p.ipd_code,p.p_fname,Date_Format(p.register_date,'%d-%m-%Y') as str_register_date,
+ Date_Format(p.discharge_date,'%d-%m-%Y') as str_discharge_date,p.admit_type,p.doc_name,p.Bed_Desc,
+ charge_amount,paid_amount,p.app_status,p.color,p.org_approved_amount,p.net_amount,
+ p.balance_amount,no_days
+ from v_ipd_list p where ".$where." group by p.id ".$orderby;
+
+ $query = $this->db->query($sql);
+ $dischargelist= $query->result();
+
+ $content='';
+
+ $content.='
+ #
+ IPD Code
+ Person Name
+ Bed No
+ Admit Date
+ No.Days
+ Doc. Name
+ TYPE
+ Org. Status
+ App. Amt.
+ Bill Amt.
+ Bal. Amt.
+ Paid Amt.
+ ';
+
+ $sr_no=0;
+ foreach($dischargelist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->ipd_code.'
+ '.$row->p_fname.'
+ '.$row->Bed_Desc.'
+ '.$row->str_register_date.' '.$row->str_discharge_date.'
+ '.$row->no_days.'
+ '.$row->doc_name.'
+ '.$row->admit_type.'
+ '.$row->app_status.'
+ '.$row->org_approved_amount.'
+ '.$row->net_amount.'
+ '.$row->balance_amount.'
+ '.$row->paid_amount.'
+ ';
+ }
+
+ $content.="
";
+
+ if($output==0)
+ {
+ echo $content;
+ }else{
+
+ ExportExcel($content,'Current_IPD_List'+date('Ymdhis'));
+ }
+
+
+ }
+ function report_Diagnosis_Qty_main()
+ {
+ $sql="select * from hc_item_type where is_ipd_opd in (0,1)";
+ $query = $this->db->query($sql);
+ $data['item_type_list']= $query->result();
+
+ $this->load->view('Report3/diagnosis_qty',$data);
+ }
+
+
+ function report_Diagnosis_Qty_total($opd_date_range,$Diagnosis_id,$output=0)
+ {
+ $sql_field="select t.item_type,y.group_desc,t.item_name,
+ sum(t.item_qty) as t_item_qty,
+ sum(t.item_amount) as item_amount,
+ sum(Round(t.item_amount*(1-m.discount_amount/m.total_amount))) as item_amount_net
+ from (invoice_item t join invoice_master m
+ on m.id=t.inv_master_id) join hc_item_type y on t.item_type=y.itype_id ";
+
+ $sql_where=" where m.invoice_status=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(m.inv_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and m.inv_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ if($Diagnosis_id>0)
+ {
+ $Diagnosis_id=str_replace('S',',',$Diagnosis_id);
+
+ $sql_where.=" and t.item_type in (".$Diagnosis_id.") ";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+ $sql_group=" group by t.item_type,t.item_id order by t.item_type";
+
+ $sql=$sql_field.$sql_where.$sql_group;
+
+ $query = $this->db->query($sql);
+ $Diagnosis_Data= $query->result();
+
+ $content='';
+
+ $content.='
+ #
+ Diagnosis Group
+ Diagnosis
+ Qty
+ Amount
+ Net Amount
+ ';
+
+ $sr_no=0;
+ $item_amount=0;
+ $item_amount_net=0;
+
+ foreach($Diagnosis_Data as $row)
+ {
+ $sr_no=$sr_no+1;
+ $item_amount+=$row->item_amount;
+ $item_amount_net+=$row->item_amount_net;
+ $content.='
+ '.$sr_no.'
+ '.$row->group_desc.'
+ '.$row->item_name.'
+ '.$row->t_item_qty.'
+ '.$row->item_amount.'
+ '.$row->item_amount_net.'
+ ';
+ }
+ $content.='
+ #
+ Total
+
+
+ '.$item_amount.'
+ '.$item_amount_net.'
+ ';
+
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+
+ ExportExcel($content,'Diagnosis_Qty'.date('Ymd'));
+ }
+
+ }
+
+ function ipd_item_reports()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from ipd_item_type order by 'desc'";
+ $query = $this->db->query($sql);
+ $data['item_type_list']= $query->result();
+
+ $this->load->view('Report/Report_medical',$data);
+ }
+
+ function ipd_item_reports_data($daterange,$Diagnosis_id,$doc_name_id,$ipd_status,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+
+ $order_by=" i.id";
+
+ if($ipd_status>-1)
+ {
+ $where.=" and i.ipd_status=".$ipd_status;
+ }
+
+ if($Diagnosis_id>0)
+ {
+ $Diagnosis_id=str_replace('S',',',$Diagnosis_id);
+
+ $where.=" and t.item_type in (".$Diagnosis_id.") ";
+ }
+
+ if($doc_name_id>0)
+ {
+ $doc_list=str_replace("S",",",$doc_name_id);
+
+ $where.=" and t.doc_id in ($doc_list)";
+ }
+
+ $where.=" and date(i.register_date) between '".$minRange."' and '".$maxRange."' " ;
+
+ $sql="SELECT i.id,i.ipd_code,i.p_fname,date_format(i.register_date,'%d-%m-%Y') AS register_date_str,
+ DATE_FORMAT(i.discharge_date,'%d-%m-%Y') AS discharge_date_str,i.doc_name as ipd_doc_name,
+ t.item_name,t.item_rate,t.item_qty,t.item_amount,t.doc_name,t.doc_id,
+ ROUND(t.item_amount-(t.item_amount*((i.Discount_all)/(i.net_amount+i.Discount_all)))) AS Aft_Amt,
+ ROUND(((i.Discount_all*100)/(i.net_amount+i.Discount_all)),2) AS Dis_per
+ FROM v_ipd_list i JOIN ipd_invoice_item t ON i.id=t.ipd_id
+ Where $where Order By $order_by";
+ $query = $this->db->query($sql);
+ $data['ipd_item_data']= $query->result();
+
+
+ $content=$this->load->view('Report/Report_medical_template',$data,true);
+
+ //echo $content;
+
+ if($output==0)
+ {
+
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($content,'IPD_List');
+ }
+
+
+ }
+
+
+ function ipd_item_refer_reports()
+ {
+ $sql="select * from refer_master where active=1 order by f_name";
+ $query = $this->db->query($sql);
+ $data['refer_master']= $query->result();
+
+ $sql="select * from ipd_item_type order by 'desc'";
+ $query = $this->db->query($sql);
+ $data['item_type_list']= $query->result();
+
+ $this->load->view('Report/Report_refer_ipd',$data);
+ }
+
+ function ipd_item_refer_reports_data($daterange,$refer_id,$ipd_status,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+
+ $order_by=" i.id";
+
+ if($ipd_status>-1)
+ {
+ $where.=" and i.ipd_status=".$ipd_status;
+ }
+
+ if($refer_id>0)
+ {
+ $refer_list=str_replace("S",",",$refer_id);
+
+ $where.=" and r.refer_by in ($refer_list)";
+ }
+
+ $where.=" and date(i.register_date) between '".$minRange."' and '".$maxRange."' " ;
+
+ $sql="SELECT i.id,i.ipd_code,i.p_fname,date_format(i.register_date,'%d-%m-%Y') AS register_date_str,
+ DATE_FORMAT(i.discharge_date,'%d-%m-%Y') AS discharge_date_str,
+ i.doc_name as ipd_doc_name, i.net_amount,i.balance_amount, m.title,m.f_name,r.refer_type,t.type_desc
+ FROM ((v_ipd_list i JOIN ipd_refer r ON i.id=r.ipd_id) JOIN refer_type t ON r.refer_type=t.id)
+ JOIN refer_master m ON r.refer_by=m.id
+ Where $where Order By $order_by";
+ $query = $this->db->query($sql);
+ $data['ipd_refer_data']= $query->result();
+
+
+ $content=$this->load->view('Report/Report_refer_template',$data,true);
+
+ //echo $content;
+
+ if($output==0)
+ {
+
+ $this->load->library('m_pdf');
+
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }else{
+
+ ExportExcel($content,'IPD_List');
+ }
+
+
+ }
+
+}
diff --git a/old_code_ci3/controllers/Report4.php b/old_code_ci3/controllers/Report4.php
new file mode 100644
index 0000000..a307f9b
--- /dev/null
+++ b/old_code_ci3/controllers/Report4.php
@@ -0,0 +1,261 @@
+db->query($sql);
+ $data['ins_group']= $query->result();
+
+ $sql="select * from hc_insurance order by short_name ";
+ $query = $this->db->query($sql);
+ $data['hc_insurance']= $query->result();
+
+ $this->load->view('Report3/ECHS_IPD',$data);
+ }
+
+ function echs_opd_list_main()
+ {
+ $sql="select * from h_insurance_group ";
+ $query = $this->db->query($sql);
+ $data['ins_group']= $query->result();
+
+ $sql="select * from hc_insurance order by short_name ";
+ $query = $this->db->query($sql);
+ $data['hc_insurance']= $query->result();
+
+ $this->load->view('Report3/ECHS_OPD',$data);
+ }
+
+ function echs_ipd_list_data($daterange,$org_status,$ipd_type,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+
+ $where.=" and p.ipd_status=1";
+
+ if($org_status>=0)
+ {
+ $where.=" and p.status=".$org_status;
+ }
+
+ $where.=" and p.register_date between '".$minRange."' and '".$maxRange."' " ;
+
+ if($ipd_type>0){
+ $where.=" and group_ins=".$ipd_type." ";
+ }elseif($ipd_type<0){
+ $where.=" and insurance_id=".($ipd_type*-1)." ";
+ }
+
+
+ $sql="select p.ipd_code,p.p_fname,Date_Format(p.register_date,'%d-%m-%Y') as str_register_date,p_code,
+ Date_Format(p.discharge_date,'%d-%m-%Y') as str_discharge_date,p.admit_type,p.doc_name,p.Bed_Desc,
+ charge_amount,paid_amount,p.org_submit_status,p.status,
+ concat(p.insurance_no,'/',p.insurance_no_1) as case_info,
+ p.med_amount,p.Discount_all,p.chargeamount_all,p.insurance_id,p.ins_company_name,
+ p.amount_recived,p.amount_deduction,p.app_status,p.color,
+ (p.charge_amount+p.med_amount+p.chargeamount_all-p.Discount_all) as net_total
+ from v_ipd_list p where ".$where." group by p.p_id,p.doc_list order by id";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $dischargelist= $query->result();
+
+ $total_Payment=0.00;
+
+ $content='';
+
+ $content.='
+ #
+ Case Info.
+ IPD Code
+ P Code
+ Person Name
+ Org. Status
+ Admit Date
+ Discharge Date
+ Org Name
+ Doc. Name
+ Net Amt.
+ Amt Received
+ Amt Deduct
+ ';
+ $sr_no=0;
+ foreach($dischargelist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->case_info.'
+ '.$row->ipd_code.'
+ '.$row->p_code.'
+ '.$row->p_fname.'
+ '.$row->org_submit_status.'
+ '.$row->str_register_date.'
+ '.$row->str_discharge_date.'
+ '.$row->ins_company_name.'
+ '.$row->doc_name.'
+ '.$row->net_total.'
+ '.$row->amount_recived.'
+ '.$row->amount_deduction.'
+ ';
+ $total_Payment+= $row->net_total;
+ }
+
+ $content.='
+ #
+
+
+
+
+
+
+
+ Total
+ '.$total_Payment.'
+ ';
+
+ $content.="
";
+
+ if($output==0)
+ {
+ //echo $content;
+ //create_report_pdf_landscape($content,'ECHS_IPD_List'.date('Yms'));
+ $this->load->library('m_pdf');
+
+ $file_name="Report-ECHS_IPD_List_".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+
+ }else{
+ ExportExcel($content,'ECHS_IPD_List'.date('Yms'));
+ }
+
+ }
+
+ function echs_opd_list_data($daterange,$org_status,$ipd_type,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+
+ if($org_status>=0)
+ {
+ $where.=" and o.status=".$org_status;
+ }
+
+ $where.=" and o.date_registration between '".$minRange."' and '".$maxRange."' " ;
+
+ if($ipd_type>0){
+ $where.=" and in_master.id=".$ipd_type." ";
+ }elseif($ipd_type<0){
+ $where.=" and o.insurance_id=".($ipd_type*-1)." ";
+ }
+
+ $sql="select o.id,o.case_id_code,Concat(o.insurance_no,'/',o.insurance_no_1) as case_info,p.p_fname,
+ `o`.`status`,p.p_code,p.p_fname,
+ (case `o`.`status` when 0 then 'Pending' when 1 then 'Ready' when 2 then 'Submit' else 'Nothing' end) AS `org_submit_status`,
+ (o.inv_opd_amt+o.inv_opd_charge_amt) as Charge_amount,
+ o.inv_opd_med_amt as med_net_amount,
+ o.date_registration,date_format(o.date_registration,'%d-%m-%Y') as str_date_registration
+ from (organization_case_master o join patient_master p on o.p_id=p.id and o.case_type=0)
+ join hc_insurance as in_master on in_master.id = o.insurance_id
+ where ".$where." and (o.inv_opd_amt+o.inv_opd_charge_amt+o.inv_opd_med_amt)>0
+ group by o.id order by o.id";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $dischargelist= $query->result();
+
+ $total_Payment=0.00;
+ $total_Med_Payment=0.00;
+
+ $content='';
+
+ $content.='
+ #
+ Bill No.
+ Case Info.
+ Org. Code
+ UHID
+ Person Name
+ Date
+ Charge Amt.
+ Med. Amt.
+ Net Amt.
+ ';
+
+ $sr_no=0;
+ $total_net_amount=0.00;
+ foreach($dischargelist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $net_amount=($row->Charge_amount+$row->med_net_amount);
+ $content.='
+ '.$sr_no.'
+ '.$row->id.'
+ '.$row->case_info.'
+ '.$row->case_id_code.'
+ '.$row->p_code.'
+ '.$row->p_fname.'
+ '.$row->str_date_registration.'
+ '.$row->Charge_amount.'
+ '.$row->med_net_amount.'
+ '.$net_amount.'
+ ';
+ $total_Payment+= $row->Charge_amount;
+ $total_Med_Payment+= $row->med_net_amount;
+ $total_net_amount+= $net_amount;
+
+ }
+ $content.='
+ #
+
+
+
+
+
+
+ '.$total_Payment.'
+ '.$total_Med_Payment.'
+ '.$total_net_amount.'
+ ';
+
+ $content.="
";
+
+ if($output==0)
+ {
+ //echo $content;
+ //create_report_pdf_landscape($content,'ECHS_OPD_List'.date('Yms'));
+ $this->load->library('m_pdf');
+
+ $file_name="Report-ECHS_OPD_List_".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'ECHS_OPD_List'.date('Yms'));
+ }
+
+ }
+
+
+
+}
+
+/* End of file c_test.php */
+/* Location: ./application/controllers/c_test.php */
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Report5.php b/old_code_ci3/controllers/Report5.php
new file mode 100644
index 0000000..f27d3e9
--- /dev/null
+++ b/old_code_ci3/controllers/Report5.php
@@ -0,0 +1,393 @@
+db->query($sql);
+ $data['doclist']= $query->result();
+
+ $this->load->view('Report5/Report_Document',$data);
+ }
+
+ function document_list_data($daterange,$dr_id,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+
+ if($dr_id>0)
+ {
+ $where.=" and doc.id =".$dr_id;
+ }
+
+ $where.=" and d.date_issue between '".$minRange."' and '".$maxRange."' " ;
+
+ $sql="SELECT p.id,p.p_fname,p.p_rname,p.p_relative,p.p_code,
+ d.doc_subject,d.date_issue,date_format(d.date_issue,'%d-%m-%Y') AS str_date_issue,
+ d.id AS Doc_id,f.doc_name,
+ doc.p_fname AS dr_name,doc.id AS dr_id
+ FROM ((patient_master_exten p JOIN patient_doc d ON p.id=d.p_id)
+ JOIN doctor_master doc ON d.dr_id=doc.id)
+ Join doc_format_master f ON d.doc_format_id=f.df_id where ".$where." ";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $doclist= $query->result();
+
+ $content='';
+
+ $content.='
+ #
+ Doc. ID
+ Person Name / Relative Name
+ PCode/UHID
+ Doctor Name
+ Issue Date
+ Document Name
+ ';
+ $sr_no=0;
+ foreach($doclist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->Doc_id.'
+ '.$row->p_fname.'{'.$row->p_relative.' '.$row->p_rname.'}
+ '.$row->p_code.'
+ '.$row->dr_name.'
+ '.$row->str_date_issue.'
+ '.$row->doc_name.'
+ ';
+ }
+
+ $content.='
+ #
+
+
+
+
+
+
+ ';
+
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'document_List'.date('Yms'));
+ }
+
+ }
+
+ // Xray Chest List
+ public function Report_XRay_chest()
+ {
+ $this->load->view('Report5/Report_XRay_chest');
+ }
+
+ public function XRay_chest_data($daterange,$output=0){
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+
+ $sql="SELECT p.p_code,p.p_fname,p.xgender,p.str_age,p.mphone1,p_address,
+ date_format(m.inv_date,'%d-%m-%Y') AS str_test_date,i.item_name,t.group_desc,i.item_id
+ FROM ((patient_master_exten p JOIN invoice_master m ON p.id=m.attach_id)
+ JOIN invoice_item i ON m.id=i.inv_master_id)
+ JOIN hc_item_type t ON i.item_type=t.itype_id
+ WHERE m.inv_date BETWEEN '".$minRange."' AND '".$maxRange."'
+ AND i.item_id=61 ";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $doclist= $query->result();
+
+ $content=''.H_Name.' ';
+ $content.=''.H_address_1.' ';
+
+ $content.='X-Ray Chest ';
+
+ $content.='';
+
+ $content.='
+ #
+ PCode/UHID
+ Patient Name
+ Age
+ Gender
+ Address
+ Phone Number
+ Test Date
+ Test Name
+ ';
+ $sr_no=0;
+ foreach($doclist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->p_code.'
+ '.$row->p_fname.'
+ '.$row->str_age.'
+ '.$row->xgender.'
+ '.$row->p_address.'
+ '.$row->mphone1.'
+ '.$row->str_test_date.'
+ '.$row->item_name.'
+ ';
+ }
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'XRay_chest_list'.date('Yms'));
+ }
+ }
+
+
+ // Corona
+ public function corona_suspected()
+ {
+ $this->load->view('Report5/Report_corona_suspected');
+ }
+
+ function corona_suspected_data($daterange,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" " ;
+
+ $where.=" and m.apointment_date between '".$minRange."' and '".$maxRange."' " ;
+
+ $sql="SELECT p.p_code,p.p_fname,p.xgender,p.str_age,p.mphone1,p_address,
+ date_format(m.apointment_date,'%d-%m-%Y') AS str_apointment_date,o.complaints
+ FROM (opd_prescription o JOIN opd_master m ON m.opd_id=o.opd_id)
+ JOIN patient_master_exten p ON m.p_id=p.id
+ WHERE o.corona_suspected=1 ".$where." ";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $doclist= $query->result();
+
+ $content=''.H_Name.' ';
+ $content.=''.H_address_1.' ';
+
+ $content.='Corona Suspected Data ';
+
+ $content.='';
+
+ $content.='
+ #
+ Patient Name
+ Age
+ Gender
+ Address
+ Phone Number
+ Visit Date
+ Symptoms
+ ';
+ $sr_no=0;
+ foreach($doclist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->p_fname.'
+ '.$row->str_age.'
+ '.$row->xgender.'
+ '.$row->p_address.'
+ '.$row->mphone1.'
+ '.$row->str_apointment_date.'
+ '.$row->complaints.'
+ ';
+ }
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'corona_suspected'.date('Yms'));
+ }
+ }
+
+ // pregnancy
+ public function pregnancy_search()
+ {
+ $this->load->view('Report5/Report_pregnancy_suspected');
+ }
+
+ function pregnancy_data($daterange,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" " ;
+
+ $where.=" and m.apointment_date between '".$minRange."' and '".$maxRange."' " ;
+
+ $sql="SELECT p.p_code,p.p_fname,p.xgender,p.str_age,p.mphone1,p_address,
+ date_format(m.apointment_date,'%d-%m-%Y') AS str_apointment_date,o.complaints
+ FROM (opd_prescription o JOIN opd_master m ON m.opd_id=o.opd_id)
+ JOIN patient_master_exten p ON m.p_id=p.id
+ WHERE o.pregnancy=1 ".$where." ";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $doclist= $query->result();
+
+ $content=''.H_Name.' ';
+ $content.=''.H_address_1.' ';
+
+ $content.='Pregnancy Data ';
+
+ $content.='';
+
+ $content.='
+ #
+ Patient Name
+ Age
+ Gender
+ Address
+ Phone Number
+ Visit Date
+ Symptoms
+ ';
+ $sr_no=0;
+ foreach($doclist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->p_fname.'
+ '.$row->str_age.'
+ '.$row->xgender.'
+ '.$row->p_address.'
+ '.$row->mphone1.'
+ '.$row->str_apointment_date.'
+ '.$row->complaints.'
+ ';
+ }
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'pregnancy_data'.date('Yms'));
+ }
+ }
+
+
+ //Dengue
+ public function dengue()
+ {
+ $this->load->view('Report5/Report_dengue');
+ }
+
+ function dengue_data($daterange,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" " ;
+
+ $where.=" and m.apointment_date between '".$minRange."' and '".$maxRange."' " ;
+
+ $sql="SELECT p.p_code,p.p_fname,p.xgender,p.str_age,p.mphone1,p_address,
+ date_format(m.apointment_date,'%d-%m-%Y') AS str_apointment_date,o.complaints
+ FROM (opd_prescription o JOIN opd_master m ON m.opd_id=o.opd_id)
+ JOIN patient_master_exten p ON m.p_id=p.id
+ WHERE o.dengue=1 ".$where." ";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $doclist= $query->result();
+
+ $content=''.H_Name.' ';
+ $content.=''.H_address_1.' ';
+
+ $content.='Dengue Patient Data ';
+
+ $content.='';
+
+ $content.='
+ #
+ Patient Name
+ Age
+ Gender
+ Address
+ Phone Number
+ Visit Date
+ Symptoms
+ ';
+ $sr_no=0;
+ foreach($doclist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$row->p_fname.'
+ '.$row->str_age.'
+ '.$row->xgender.'
+ '.$row->p_address.'
+ '.$row->mphone1.'
+ '.$row->str_apointment_date.'
+ '.$row->complaints.'
+ ';
+ }
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'dengue_data'.date('Yms'));
+ }
+ }
+
+
+}
+
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Report6.php b/old_code_ci3/controllers/Report6.php
new file mode 100644
index 0000000..de0b464
--- /dev/null
+++ b/old_code_ci3/controllers/Report6.php
@@ -0,0 +1,119 @@
+'ULTRASOUND',
+ '2'=>'MRI',
+ '3'=>'X-RAY',
+ '4'=>'CT SCAN',
+ '5'=>'PATHOLOGY ',
+ );
+
+ $this->load->view('Report6/Report_Lab_Log',$data);
+ }
+
+
+
+ function lab_log_data($daterange,$lab_type,$output=0)
+ {
+ $rangeArray = explode("S",$daterange);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where =" 1=1 " ;
+
+ if($lab_type>0)
+ {
+ $where.=" and r.lab_type =".$lab_type;
+ }
+
+ $where.=" and l.log_insert_time between '".$minRange."' and '".$maxRange."' " ;
+
+ $sql="SELECT l.*,r.invoice_code,r.patient_name,r.lab_type
+ FROM lab_log l JOIN lab_request r ON l.lab_repo_id=r.id
+ WHERE ".$where." ";
+
+ //echo $sql;
+
+ $query = $this->db->query($sql);
+ $doclist= $query->result();
+
+ $lab_type_data=array(
+ '1'=>'ULTRASOUND',
+ '2'=>'MRI',
+ '3'=>'X-RAY',
+ '4'=>'CT SCAN',
+ '5'=>'PATHOLOGY ',
+ );
+ $content="Data Between from ".$minRange."' to '".$maxRange."' " ;
+
+ $content.='';
+
+ $content.='
+ #
+ Lab
+ Date Time
+ Invoice /Lab No.
+ Person Name
+ Log Type
+ Log Faults
+ UpdateBy
+ Remark/Comment
+ ';
+ $sr_no=0;
+ foreach($doclist as $row)
+ {
+ $sr_no=$sr_no+1;
+ $content.='
+ '.$sr_no.'
+ '.$lab_type_data[$row->lab_type].'
+ '.$row->log_insert_time.'
+ '.$row->invoice_code.'
+ '.$row->patient_name.'
+ '.$row->log_type.'
+ '.$row->log_Faults.'
+ '.$row->log_by.'
+ '.$row->comments.'
+ ';
+ }
+
+ $content.='
+ #
+ Lab
+ Date Time
+ Invoice /Lab No.
+ Person Name
+ Log Type
+ Log Faults
+ UpdateBy
+ Remark/Comment
+ ';
+
+ $content.="
";
+
+ if($output==0)
+ {
+ $this->load->library('m_pdf');
+ $file_name="Report-".date('Ymdhis').".pdf";
+ $filepath=$file_name;
+ $this->m_pdf->pdf->WriteHTML($content);
+ $this->m_pdf->pdf->Output($filepath,"I");
+ }else{
+ ExportExcel($content,'document_List'.date('Yms'));
+ }
+
+ }
+
+
+
+
+}
+
\ No newline at end of file
diff --git a/old_code_ci3/controllers/ReportPanel2.php b/old_code_ci3/controllers/ReportPanel2.php
new file mode 100644
index 0000000..58db238
--- /dev/null
+++ b/old_code_ci3/controllers/ReportPanel2.php
@@ -0,0 +1,1998 @@
+load->library("Pdf");
+ }
+
+ public function opd() {
+
+ $this->load->library('table');
+
+ $template = array(
+ 'table_open' => '',
+ 'thead_open' => '',
+ 'thead_close' => ' ',
+
+ 'heading_row_start' => '',
+ 'heading_row_end' => ' ',
+ 'heading_cell_start' => '',
+ 'heading_cell_end' => ' ',
+
+ 'tbody_open' => '',
+ 'tbody_close' => ' ',
+
+ 'row_start' => '',
+ 'row_end' => ' ',
+ 'cell_start' => '',
+ 'cell_end' => ' ',
+
+ 'row_alt_start' => '',
+ 'row_alt_end' => ' ',
+ 'cell_alt_start' => '',
+ 'cell_alt_end' => ' ',
+
+ 'table_close' => '
'
+ );
+
+ $this->table->set_template($template);
+
+ $query = $this->db->query("select o.opd_code,o.P_name,o.apointment_date,o.doc_name
+ from opd_master o");
+
+ $table_show = $this->table->generate($query);
+
+ //echo $table_show;
+ // create new PDF document
+ $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+
+ // set document information
+ $pdf->SetCreator(PDF_CREATOR);
+ $pdf->SetAuthor('IHC:D.S.Bisht');
+ $pdf->SetTitle('IHC:OPD List');
+ $pdf->SetSubject('IHC:OPD List');
+ $pdf->SetKeywords('IHC:OPD List, PDF, OPD, List, guide');
+
+ // set default header data
+ $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
+ $pdf->setFooterData(array(0,64,0), array(0,64,128));
+
+ // set header and footer fonts
+ $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+ $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+ // set default monospaced font
+ $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+ // set auto page breaks
+ $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+ // set image scale factor
+ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // set some language-dependent strings (optional)
+ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
+ require_once(dirname(__FILE__).'/lang/eng.php');
+ $pdf->setLanguageArray($l);
+ }
+
+ // ---------------------------------------------------------
+
+ // set default font subsetting mode
+ $pdf->setFontSubsetting(true);
+
+ // Set font
+ // dejavusans is a UTF-8 Unicode font, if you only need to
+ // print standard ASCII chars, you can use core fonts like
+ // helvetica or times to reduce file size.
+ $pdf->SetFont('dejavusans', '', 14, '', true);
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ // set text shadow effect
+ $pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
+
+ $test= 'Report Sample Page TEsted ';
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+ // ---------------------------------------------------------
+
+ // Close and output PDF document
+ // This method has several options, check the source code documentation for more information.
+ $pdf->Output('OPD_001.pdf', 'I');
+
+ //============================================================+
+ // END OF FILE
+ //============================================================+
+ }
+
+ public function index()
+ {
+ $this->load->view('Report/ReportMain');
+ }
+ public function report_opd_app()
+ {
+
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/rep_opd_p',$data);
+ }
+
+
+ public function report_charge_app()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/rep_other_charge',$data);
+ }
+
+ public function report_ipdpayment_app()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode where id in (1,2) ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/ipd_payment_report',$data);
+ }
+
+ public function report_totalpayment_app()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode where id in (1,2) ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/rep_total_payment',$data);
+ }
+
+ public function report_emp_total_app()
+ {
+ $sql="select * from doctor_master where active=1 order by p_fname";
+ $query = $this->db->query($sql);
+ $data['doclist']= $query->result();
+
+ $sql="select * from users where active=1 order by first_name";
+ $query = $this->db->query($sql);
+ $data['emplist']= $query->result();
+
+ $sql="select * from payment_mode where id in (1,2) ";
+ $query = $this->db->query($sql);
+ $data['paymodelist']= $query->result();
+
+ $this->load->view('Report/rep_collocation_emp',$data);
+ }
+
+ public function report_opd_app_show($opd_date_range,
+ $doc_name_id,$emp_name_id,$paymode_id,$order_1,$order_2,$group_by)
+ {
+ $sql_f_all = "select o.opd_code,
+ o.P_name ,
+ p_code ,
+ Date_Format(o.apointment_date,'%d-%m-%Y') as 'App_Date',
+ o.doc_name ,
+ if(o.insurance_id>1,'Org.','Direct') as 'Type',
+ m.mode_desc as 'PayMode',
+ o.opd_fee_gross_amount as 'GrossAmt',
+ o.opd_discount as Discount,
+ o.opd_fee_amount as 'FeeAmt',
+ o.prepared_by,IFNULL(GET_AGE_BY_DOB(dob),age) as Age ";
+
+ $sql_from=" from opd_master o join payment_mode m join patient_master p on o.payment_mode=m.id and p.id=o.p_id";
+
+ $sql_where=" Where 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+ $sql_where.=" and o.apointment_date between '".$minRange."' and '".$maxRange. "'";
+
+ if($doc_name_id>0)
+ {
+ $sql_where.=" and o.doc_id='".$doc_name_id."'";
+ }
+
+ if($emp_name_id>0)
+ {
+ $sql_where.=" and o.prepared_by like '%[".$emp_name_id."]'";
+ }
+
+ if($paymode_id>0)
+ {
+ $sql_where.=" and o.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by o.apointment_date";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,o.doc_name';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,o.prepared_by';
+ }
+
+ if($order_1==3)
+ {
+ $sql_order.=' ,m.mode_desc';
+ }
+
+ if($order_2==1)
+ {
+ $sql_order.=' ,o.doc_name';
+ }
+
+ if($order_2==2)
+ {
+ $sql_order.=' ,o.prepared_by';
+ }
+
+ //echo $table_show;
+ // create new PDF document
+ $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+
+ // set document information
+ $pdf->SetCreator(PDF_CREATOR);
+ $pdf->SetAuthor('IHC:D.S.Bisht');
+ $pdf->SetTitle('IHC:OPD List');
+ $pdf->SetSubject('IHC:OPD List');
+ $pdf->SetKeywords('IHC:OPD List, PDF, OPD, List, guide');
+
+ // set default header data
+ $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
+ $pdf->setFooterData(array(0,64,0), array(0,64,128));
+
+ // set header and footer fonts
+ $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+ $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+ // set default monospaced font
+ $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+ // set auto page breaks
+ $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+ // set image scale factor
+ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // set some language-dependent strings (optional)
+ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
+ require_once(dirname(__FILE__).'/lang/eng.php');
+ $pdf->setLanguageArray($l);
+ }
+
+ // ---------------------------------------------------------
+
+ // set default font subsetting mode
+ $pdf->setFontSubsetting(true);
+
+ // Set font
+ // dejavusans is a UTF-8 Unicode font, if you only need to
+ // print standard ASCII chars, you can use core fonts like
+ // helvetica or times to reduce file size.
+ $pdf->SetFont('dejavusans', '', 8, '', true);
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+
+ // set text shadow effect
+ //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
+
+ $table_start='';
+
+ if($group_by==0)
+ {
+ $table_head='';
+ $table_head.='OPD ID ';
+ $table_head.='Patient Name / Age ';
+ $table_head.='Patient Code ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Employee ';
+ $table_head.='Fee Amt. ';
+
+ $GroupSQL="select Date(o.apointment_date) as sdate,Date_Format(Date(o.apointment_date),'%d-%m-%Y') as strDate
+ from opd_master o where Date(o.apointment_date) between '".$minRange."' and '".$maxRange. "'
+ group by Date(o.apointment_date)";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='OPD Date : '.$row->strDate.' ';
+
+ $gwhere=" and Date(o.apointment_date)='".$row->sdate."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->opd_code.' ';
+ $table_body.=''.$rowdata->P_name.'/'.$rowdata->Age.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->PayMode.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->FeeAmt.' ';
+ $table_body.=' ';
+ $table_total_1=$table_total_1+$rowdata->FeeAmt;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+ if($group_by==1)
+ {
+ $table_head='';
+ $table_head.='OPD ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Date ';
+ $table_head.='Pay Mode ';
+ $table_head.='Employee ';
+ $table_head.='Fee Amt. ';
+
+
+ $GroupSQL="select o.doc_id,doc_name
+ from opd_master o where Date(o.apointment_date) between '".$minRange."' and '".$maxRange. "' group by o.doc_id";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Doctor Name : Dr. '.$row->doc_name.' ';
+
+ $gwhere=" and doc_id='".$row->doc_id."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->opd_code.' ';
+ $table_body.=''.$rowdata->P_name.'/'.$rowdata->Age.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->App_Date.' ';
+ $table_body.=''.$rowdata->PayMode.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->FeeAmt.' ';
+ $table_body.=' ';
+ $table_total_1=$table_total_1+$rowdata->FeeAmt;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+ if($group_by==2)
+ {
+ $table_head='';
+ $table_head.='OPD ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='App. Date ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Fee Amt. ';
+
+ $GroupSQL="select o.prepared_by
+ from opd_master o where Date(o.apointment_date) between'".$minRange."' and '".$maxRange. "' group by o.prepared_by";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Prepared By : '.$row->prepared_by.' ';
+
+ $gwhere=" and o.prepared_by='".$row->prepared_by."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->opd_code.' ';
+ $table_body.=''.$rowdata->P_name.'/'.$rowdata->Age.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->App_Date.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->PayMode.' ';
+ $table_body.=''.$rowdata->FeeAmt.' ';
+ $table_body.=' ';
+ $table_total_1=$table_total_1+$rowdata->FeeAmt;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+
+ if($group_by==3)
+ {
+ $table_head='';
+ $table_head.='OPD ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Date ';
+ $table_head.='Doctor Name ';
+ $table_head.='Employee ';
+ $table_head.='Fee Amt. ';
+
+ $GroupSQL="select o.payment_mode,m.mode_desc as 'PayMode'
+ from opd_master o join payment_mode m on o.payment_mode=m.id where Date(o.apointment_date) between'".$minRange."' and '".$maxRange. "' group by o.payment_mode";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Payment Mode : '.$row->PayMode.' ';
+
+ $gwhere=" and o.payment_mode='".$row->payment_mode."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->opd_code.' ';
+ $table_body.=''.$rowdata->P_name.'/'.$rowdata->Age.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->App_Date.' ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->FeeAmt.' ';
+ $table_body.=' ';
+ $table_total_1=$table_total_1+$rowdata->FeeAmt;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+ // ---------------------------------------------------------
+
+ // Close and output PDF document
+ // This method has several options, check the source code documentation for more information.
+ $pdf->Output('OPD_001.pdf', 'I');
+
+ //============================================================+
+ // END OF FILE
+ //============================================================+
+ }
+
+
+ public function report_charge_app_show($opd_date_range,
+ $doc_name_id,$emp_name_id,$paymode_id,$order_1,$order_2,$group_by)
+ {
+ $sql_f_all = "select i.id,i.invoice_code,p.p_fname,p.p_code,i.refer_by_other,
+ i.inv_date,Date_Format(i.inv_date,'%d-%m-%Y') as str_inv_date,i.invoice_status,
+ if(i.insurance_id>1,'Org.','Direct') as PType,i.prepared_by,
+ if(i.correction_amount>0,i.correction_net_amount,i.net_amount) as Amount,m.mode_desc ,
+ group_concat(t.item_name) as test_list";
+
+ $sql_from=" from invoice_master i join patient_master p join payment_mode m join invoice_item t
+ on i.attach_id=p.id and i.attach_type=0 and i.payment_mode=m.id and i.id=t.inv_master_id";
+
+ $sql_where=" Where i.invoice_status>0 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+ $sql_where.=" and Date(i.inv_date) between Date('".$minRange."') and Date('".$maxRange. "') ";
+
+ if($doc_name_id>0)
+ {
+ $sql_where.=" and i.refer_by_id='".$doc_name_id."'";
+ }
+
+ if($emp_name_id>0)
+ {
+ $sql_where.=" and i.prepared_by like '%[".$emp_name_id."]' ";
+ }
+
+ if($paymode_id>0)
+ {
+ $sql_where.=" and i.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by i.inv_date";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,i.refer_by_other';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,i.prepared_by';
+ }
+
+ if($order_1==3)
+ {
+ $sql_order.=' ,m.mode_desc';
+ }
+
+ if($order_2==1)
+ {
+ $sql_order.=' ,i.refer_by_other';
+ }
+
+ if($order_2==2)
+ {
+ $sql_order.=' ,i.prepared_by';
+ }
+
+ //echo $table_show;
+ // create new PDF document
+ $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+
+ // set document information
+ $pdf->SetCreator(PDF_CREATOR);
+ $pdf->SetAuthor('IHC:D.S.Bisht');
+ $pdf->SetTitle('IHC:OPD List');
+ $pdf->SetSubject('IHC:OPD List');
+ $pdf->SetKeywords('IHC:OPD List, PDF, OPD, List, guide');
+
+ // set default header data
+ $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
+ $pdf->setFooterData(array(0,64,0), array(0,64,128));
+
+ // set header and footer fonts
+ $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+ $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+ // set default monospaced font
+ $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ $pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+ // set auto page breaks
+ $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+ // set image scale factor
+ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // set some language-dependent strings (optional)
+ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
+ require_once(dirname(__FILE__).'/lang/eng.php');
+ $pdf->setLanguageArray($l);
+ }
+
+ // ---------------------------------------------------------
+
+ // set default font subsetting mode
+ $pdf->setFontSubsetting(true);
+
+ // Set font
+ // dejavusans is a UTF-8 Unicode font, if you only need to
+ // print standard ASCII chars, you can use core fonts like
+ // helvetica or times to reduce file size.
+ $pdf->SetFont('dejavusans', '', 8, '', true);
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+
+ // set text shadow effect
+ //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
+
+ $table_start='';
+
+ if($group_by==0)
+ {
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Employee ';
+ $table_head.='Inv. Amt. ';
+
+ $GroupSQL="select Date(i.inv_date) as sdate,Date_Format(Date(i.inv_date),'%d-%m-%Y') as strDate
+ from invoice_master i where i.invoice_status>0 and Date(i.inv_date) between'".$minRange."' and '".$maxRange. "'
+ group by Date(i.inv_date)";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Invoice Date : '.$row->strDate.' ';
+
+ $gwhere=" and Date(i.inv_date)='".$row->sdate."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' group by i.id '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->invoice_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->refer_by_other.' ';
+ $table_body.=''.$rowdata->mode_desc.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->Amount.' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata->test_list.' ';
+ $table_total_1=$table_total_1+$rowdata->Amount;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+ if($group_by==1)
+ {
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Employee ';
+ $table_head.='Amount ';
+
+ $GroupSQL="select i.refer_by_id,refer_by_other
+ from invoice_master i where i.invoice_status>0 and Date(i.inv_date) between'".$minRange."' and '".$maxRange. "' group by i.refer_by_id";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Doctor Name : Dr. '.$row->refer_by_other.' ';
+
+ $gwhere=" and i.refer_by_id='".$row->refer_by_id."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' group by i.id '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->invoice_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->inv_date.' ';
+ $table_body.=''.$rowdata->mode_desc.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->Amount.' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata->test_list.' ';
+ $table_total_1=$table_total_1+$rowdata->Amount;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+ if($group_by==2)
+ {
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Invoice Date ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Mode ';
+ $table_head.='Amount ';
+
+ $GroupSQL="select i.prepared_by
+ from opd_master i where i.invoice_status>0 and Date(i.apointment_date) between'".$minRange."' and '".$maxRange. "' group by i.prepared_by";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Prepared By : '.$row->prepared_by.' ';
+
+ $gwhere=" and i.prepared_by='".$row->prepared_by."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' group by i.id '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->invoice_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->inv_date.' ';
+ $table_body.=''.$rowdata->refer_by_other.' ';
+ $table_body.=''.$rowdata->mode_desc.' ';
+ $table_body.=''.$rowdata->Amount.' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata->test_list.' ';
+ $table_total_1=$table_total_1+$rowdata->Amount;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+
+ if($group_by==3)
+ {
+ $table_head='';
+ $table_head.='Invoice ID ';
+ $table_head.='Patient Name ';
+ $table_head.='Patient Code ';
+ $table_head.='Inv.Date ';
+ $table_head.='Ref. Doc. Name ';
+ $table_head.='Employee ';
+ $table_head.='Amount ';
+
+ $GroupSQL="select i.payment_mode,m.mode_desc as 'PayMode'
+ from invoice_master i join payment_mode m on i.payment_mode=m.id
+ where i.invoice_status>0 and Date(i.inv_date) between'".$minRange."' and '".$maxRange. "' group by i.payment_mode";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Payment Mode : '.$row->PayMode.' ';
+
+ $gwhere=" and i.payment_mode='".$row->payment_mode."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' group by i.id '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->invoice_code.' ';
+ $table_body.=''.$rowdata->p_fname.' ';
+ $table_body.=''.$rowdata->p_code.' ';
+ $table_body.=''.$rowdata->inv_date.' ';
+ $table_body.=''.$rowdata->refer_by_other.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=''.$rowdata->Amount.' ';
+ $table_body.=' ';
+ $table_body.=''.$rowdata->test_list.' ';
+ $table_total_1=$table_total_1+$rowdata->Amount;
+ }
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+
+
+ // ---------------------------------------------------------
+
+ // Close and output PDF document
+ // This method has several options, check the source code documentation for more information.
+ $pdf->Output('INV_001.pdf', 'I');
+
+ //============================================================+
+ // END OF FILE
+ //============================================================+
+ }
+
+
+ public function report_ipdpayment_app_show($opd_date_range,
+ $doc_name_id,$emp_name_id,$paymode_id,$order_1,$order_2,$group_by)
+ {
+ $sql_f_all = "select i.id,i.ipd_code,i.ipd_status,m.p_fname,m.p_code,contact_person_Name,
+ i.register_date,p.pay_date,p.enter_pay_date,p.payment_id,
+ if(Date(p.pay_date)=date(p.enter_pay_date),p.pay_date,Concat(p.pay_date,' ',p.enter_pay_date)) as strPayDate,
+ if(i.ipd_status=0,'Admit','Discharged') as IPD_Status,
+ if(credit_debit=0,p.amount,0) as C_Amount,
+ if(credit_debit=1,p.amount,0) as D_Amount,p.payment_mode_desc,
+ doc.doc_name,doc_list,p.prepared_by ";
+
+ $sql_from=" from ipd_payment p join ipd_master i join patient_master m join
+ (select l.ipd_id,group_concat(d.p_fname) as doc_name,group_concat(d.id) as doc_list from ipd_master_doc_list l
+ join doctor_master d on l.doc_id=d.id group by l.ipd_id ) as doc
+ on i.id=p.ipd_id and i.p_id=m.id and i.id=doc.ipd_id";
+
+ $sql_where=" Where 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+ $sql_where.=" and Date(p.pay_date) between '".$minRange."' and '".$maxRange. "'";
+
+ if($doc_name_id>0)
+ {
+ $sql_where.=" and FIND_IN_SET('".$doc_name_id."',doc_list) ";
+ }
+
+ if($emp_name_id>0)
+ {
+ $sql_where.=" and p.prepared_by like '%[".$emp_name_id."]' ";
+ }
+
+ if($paymode_id>0)
+ {
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+
+ $sql_order=" Order by p.pay_date";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,doc.doc_name';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,p.prepared_by';
+ }
+
+ if($order_1==3)
+ {
+ $sql_order.=' ,p.payment_mode_desc';
+ }
+
+ if($order_2==1)
+ {
+ $sql_order.=' ,doc.doc_name';
+ }
+
+ if($order_2==2)
+ {
+ $sql_order.=' ,p.prepared_by';
+ }
+
+ //echo $table_show;
+ // create new PDF document
+ $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+
+ // set document information
+ $pdf->SetCreator(PDF_CREATOR);
+ $pdf->SetAuthor('IHC:D.S.Bisht');
+ $pdf->SetTitle('IHC:OPD List');
+ $pdf->SetSubject('IHC:OPD List');
+ $pdf->SetKeywords('IHC:OPD List, PDF, OPD, List, guide');
+
+ // set default header data
+ $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
+ $pdf->setFooterData(array(0,64,0), array(0,64,128));
+
+ // set header and footer fonts
+ $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+ $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+ // set default monospaced font
+ $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+ $pdf->SetMargins(5, PDF_MARGIN_TOP, 0.25);
+ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+ // set auto page breaks
+ $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+ // set image scale factor
+ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // set some language-dependent strings (optional)
+ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
+ require_once(dirname(__FILE__).'/lang/eng.php');
+ $pdf->setLanguageArray($l);
+ }
+
+ // ---------------------------------------------------------
+
+ // set default font subsetting mode
+ $pdf->setFontSubsetting(true);
+
+ // Set font
+ // dejavusans is a UTF-8 Unicode font, if you only need to
+ // print standard ASCII chars, you can use core fonts like
+ // helvetica or times to reduce file size.
+ $pdf->SetFont('dejavusans', '', 8, '', true);
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+
+ // set text shadow effect
+ //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='IPD No ';
+ $table_head.='Patient Name / Patient Code ';
+ $table_head.='Doctor Name ';
+ $table_head.='Pay Date ';
+ $table_head.='Pay Mode ';
+ $table_head.='Amount (Cr.) ';
+ $table_head.='Amount (Dr.) ';
+ $table_head.='Employee ';
+
+ if($group_by==0)
+ {
+
+
+ $GroupSQL="select Date(p.pay_date) as sdate,Date_Format(Date(p.pay_date),'%d-%m-%Y') as strDate
+ from ipd_payment p join ipd_master i join patient_master m on i.id=p.ipd_id and i.p_id=m.id
+ where Date(p.pay_date) between'".$minRange."' and '".$maxRange. "'
+ group by Date(p.pay_date) ";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Payment Date : '.$row->strDate.' ';
+
+ $gwhere=" and Date(p.pay_date)='".$row->sdate."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.='['.$rowdata->p_code.']'.$rowdata->p_fname.' {'.$rowdata->contact_person_Name.'} ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+ if($group_by==1)
+ {
+
+
+ $GroupSQL="select doc.doc_name
+ from ipd_payment p join ipd_master i join patient_master m join
+ (select l.ipd_id,group_concat(d.p_fname) as doc_name,group_concat(d.id) as doc_list from ipd_master_doc_list l
+ join doctor_master d on l.doc_id=d.id group by l.ipd_id ) as doc
+ on i.id=p.ipd_id and i.p_id=m.id and i.id=doc.ipd_id
+ where Date(p.pay_date) between'".$minRange."' and '".$maxRange. "' group by doc.doc_name";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Doctor Name : Dr. '.$row->doc_name.' ';
+
+ $gwhere=" and doc.doc_name='".$row->doc_name."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.='['.$rowdata->p_code.']'.$rowdata->p_fname.' {'.$rowdata->contact_person_Name.'} ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+ if($group_by==2)
+ {
+
+
+ $GroupSQL="select p.prepared_by
+ from ipd_payment p join ipd_master i join patient_master m
+ on i.id=p.ipd_id and i.p_id=m.id
+ Where Date(p.pay_date) between'".$minRange."' and '".$maxRange. "' group by p.prepared_by";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Prepared By : '.$row->prepared_by.' ';
+
+ $gwhere=" and p.prepared_by='".$row->prepared_by."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.='['.$rowdata->p_code.']'.$rowdata->p_fname.' {'.$rowdata->contact_person_Name.'} ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+
+ if($group_by==3)
+ {
+
+ $GroupSQL="select p.payment_mode,p.payment_mode_desc
+ from ipd_payment p join ipd_master i join patient_master m
+ on i.id=p.ipd_id and i.p_id=m.id
+ Where Date(p.pay_date) between'".$minRange."' and '".$maxRange. "' group by p.payment_mode ";
+
+ $query = $this->db->query($GroupSQL);
+ $data['group_rec']= $query->result();
+
+ foreach($data['group_rec'] as $row)
+ {
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $data_show='Payment Mode : '.$row->payment_mode_desc.' ';
+
+ $gwhere=" and p.payment_mode='".$row->payment_mode."'";
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->ipd_code.' ';
+ $table_body.='['.$rowdata->p_code.']'.$rowdata->p_fname.' {'.$rowdata->contact_person_Name.'} ';
+ $table_body.=''.$rowdata->doc_name.' ';
+ $table_body.=''.$rowdata->strPayDate.' ';
+ $table_body.=''.$rowdata->payment_mode_desc.' ';
+ $table_body.=''.$rowdata->C_Amount.' ';
+ $table_body.=''.$rowdata->D_Amount.' ';
+ $table_body.=''.$rowdata->prepared_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->C_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->D_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ }
+ }
+
+ // ---------------------------------------------------------
+
+ // Close and output PDF document
+ // This method has several options, check the source code documentation for more information.
+ $pdf->Output('ipd_payment_list.pdf', 'I');
+
+ //============================================================+
+ // END OF FILE
+ //============================================================+
+ }
+
+ public function report_total_payment_app_show($opd_date_range,$emp_name_id,$paymode_id,$order_1)
+ {
+ $sql_f_all = "select p.id,p.payment_date,date_format(p.payment_date,'%d-%m-%Y %H:%m') as str_payment_date,
+ case p.payof_type when 1 then 'OPD'
+ when 2 then 'Charges' when 4 then 'IPD' else 'Other' end as PayType,
+ payof_id,p.payof_code,
+ if(credit_debit=0,amount,0) as Cr_Amount,
+ if(credit_debit=1,amount,0) as Dr_Amount,
+ p.remark,p.update_by,get_patientinfo(p.payof_type,payof_id) as P_Name,
+ case p.payment_mode when 1 then 'Cash' when 2 then 'Bank' end as Pay_Mode";
+
+ $sql_from=" from payment_history p ";
+
+ $sql_where=" Where 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(p.payment_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and p.payment_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.")";
+ }
+
+ if($paymode_id>0)
+ {
+ if($paymode_id==1)
+ {
+ $sql_where.=" and p.payment_mode in (1,3) ";
+ }else{
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+ }
+
+ $sql_order=" Order by p.id";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,p.update_by';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,p.payment_mode';
+ }
+
+ //echo $table_show;
+ // create new PDF document
+ $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+
+ // set document information
+ $pdf->SetCreator(PDF_CREATOR);
+ $pdf->SetAuthor('IHC:D.S.Bisht');
+ $pdf->SetTitle('IHC:OPD List');
+ $pdf->SetSubject('IHC:OPD List');
+ $pdf->SetKeywords('IHC:OPD List, PDF, OPD, List, guide');
+
+ // set default header data
+ $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
+ $pdf->setFooterData(array(0,64,0), array(0,64,128));
+
+ // set header and footer fonts
+ $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+ $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+ // set default monospaced font
+ $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+ $pdf->SetMargins(5, PDF_MARGIN_TOP, 0.25);
+ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+ // set auto page breaks
+ $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+ // set image scale factor
+ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // set some language-dependent strings (optional)
+ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
+ require_once(dirname(__FILE__).'/lang/eng.php');
+ $pdf->setLanguageArray($l);
+ }
+
+ // ---------------------------------------------------------
+
+ // set default font subsetting mode
+ $pdf->setFontSubsetting(true);
+
+ // Set font
+ // dejavusans is a UTF-8 Unicode font, if you only need to
+ // print standard ASCII chars, you can use core fonts like
+ // helvetica or times to reduce file size.
+ $pdf->SetFont('dejavusans', '', 9, '', true);
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+
+ // set text shadow effect
+ //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='PayID ';
+ $table_head.='Date ';
+ $table_head.='Type of Payment ';
+ $table_head.='OPD/IPD/In. Code ';
+ $table_head.='Pay Mode ';
+ $table_head.='Amt (Cr.) ';
+ $table_head.='Amt (Dr.) ';
+ $table_head.='Remark ';
+ $table_head.='Employee ';
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ //echo $sql_f_all.$sql_from.$sql_where.' '.$sql_order;
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->id.' ';
+ $table_body.=''.$rowdata->str_payment_date.' ';
+ $table_body.=''.$rowdata->PayType.' ';
+ $table_body.=''.$rowdata->payof_code.' '.$rowdata->P_Name.' ';
+ $table_body.=''.$rowdata->Pay_Mode.' ';
+ $table_body.=''.$rowdata->Cr_Amount.' ';
+ $table_body.=''.$rowdata->Dr_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->update_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->Cr_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->Dr_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $Total_Amount=$table_total_1-$table_Dr_total_1;
+
+ $data_show.='Total Amount : '.$Total_Amount.'
';
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+ // ---------------------------------------------------------
+
+ // Close and output PDF document
+ // This method has several options, check the source code documentation for more information.
+ $pdf->Output('Total_payment_list.pdf', 'I');
+
+ //============================================================+
+ // END OF FILE
+ //============================================================+
+ }
+
+ public function report_charge_type($opd_date_range)
+ {
+ $sql_f_all = "select p.id,p.payment_date,date_format(p.payment_date,'%d-%m-%Y %H:%m') as str_payment_date,
+ case p.payof_type when 1 then 'OPD'
+ when 2 then 'Charges' when 4 then 'IPD' else 'Other' end as PayType,
+ payof_id,p.payof_code,
+ if(credit_debit=0,amount,0) as Cr_Amount,
+ if(credit_debit=1,amount,0) as Dr_Amount,
+ p.remark,p.update_by,get_patientinfo(p.payof_type,payof_id) as P_Name,
+ case p.payment_mode when 1 then 'Cash' when 2 then 'Bank' end as Pay_Mode";
+
+ $sql_from=" from payment_history p ";
+
+ $sql_where=" Where 1=1 ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(p.payment_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and p.payment_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.")";
+ }
+
+ if($paymode_id>0)
+ {
+ if($paymode_id==1)
+ {
+ $sql_where.=" and p.payment_mode in (1,3) ";
+ }else{
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+ }
+
+ $sql_order=" Order by p.id";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,p.update_by';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,p.payment_mode';
+ }
+
+ //echo $table_show;
+ // create new PDF document
+ $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+
+ // set document information
+ $pdf->SetCreator(PDF_CREATOR);
+ $pdf->SetAuthor('IHC:D.S.Bisht');
+ $pdf->SetTitle('IHC:OPD List');
+ $pdf->SetSubject('IHC:OPD List');
+ $pdf->SetKeywords('IHC:OPD List, PDF, OPD, List, guide');
+
+ // set default header data
+ $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
+ $pdf->setFooterData(array(0,64,0), array(0,64,128));
+
+ // set header and footer fonts
+ $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+ $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+ // set default monospaced font
+ $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+ $pdf->SetMargins(5, PDF_MARGIN_TOP, 0.25);
+ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+ // set auto page breaks
+ $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+ // set image scale factor
+ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // set some language-dependent strings (optional)
+ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
+ require_once(dirname(__FILE__).'/lang/eng.php');
+ $pdf->setLanguageArray($l);
+ }
+
+ // ---------------------------------------------------------
+
+ // set default font subsetting mode
+ $pdf->setFontSubsetting(true);
+
+ // Set font
+ // dejavusans is a UTF-8 Unicode font, if you only need to
+ // print standard ASCII chars, you can use core fonts like
+ // helvetica or times to reduce file size.
+ $pdf->SetFont('dejavusans', '', 9, '', true);
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+
+ // set text shadow effect
+ //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='PayID ';
+ $table_head.='Date ';
+ $table_head.='Type of Payment ';
+ $table_head.='OPD/IPD/In. Code ';
+ $table_head.='Pay Mode ';
+ $table_head.='Amt (Cr.) ';
+ $table_head.='Amt (Dr.) ';
+ $table_head.='Remark ';
+ $table_head.='Employee ';
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+ //echo $sql_f_all.$sql_from.$sql_where.' '.$sql_order;
+
+ $table_body='';
+ $table_total_1=0.00;
+ $table_Dr_total_1=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->id.' ';
+ $table_body.=''.$rowdata->str_payment_date.' ';
+ $table_body.=''.$rowdata->PayType.' ';
+ $table_body.=''.$rowdata->payof_code.' '.$rowdata->P_Name.' ';
+ $table_body.=''.$rowdata->Pay_Mode.' ';
+ $table_body.=''.$rowdata->Cr_Amount.' ';
+ $table_body.=''.$rowdata->Dr_Amount.' ';
+ $table_body.=''.$rowdata->remark.' ';
+ $table_body.=''.$rowdata->update_by.' ';
+ $table_body.=' ';
+
+ $table_total_1=$table_total_1+$rowdata->Cr_Amount;
+ $table_Dr_total_1=$table_Dr_total_1+$rowdata->Dr_Amount;
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_1.' ';
+ $table_footer.=''.$table_Dr_total_1.' ';
+ $table_footer.=' ';
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ $Total_Amount=$table_total_1-$table_Dr_total_1;
+
+ $data_show.='Total Amount : '.$Total_Amount.'
';
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+ // ---------------------------------------------------------
+
+ // Close and output PDF document
+ // This method has several options, check the source code documentation for more information.
+ $pdf->Output('Total_payment_list.pdf', 'I');
+
+ //============================================================+
+ // END OF FILE
+ //============================================================+
+ }
+
+
+ public function report_emp_total($opd_date_range,$emp_name_id,$paymode_id,$order_1)
+ {
+ $sql_f_all = "select p.update_by,
+ sum(if(p.payof_type=1,if(p.credit_debit=0,p.amount,0),0)) as OPD_Amount,
+ sum(if(p.payof_type=2,if(p.credit_debit=0,p.amount,0),0)) as Charge_Amount,
+ sum(if(p.payof_type=4,if(p.credit_debit=0,p.amount,0),0)) as IPD_Amount,
+ sum(if(p.credit_debit=1,p.amount,0)) as Return_Amount,
+ sum(if(p.credit_debit=0,p.amount,p.amount*-1)) as total_Amount ";
+
+ $sql_from=" from payment_history p ";
+
+ $sql_where=" Where 1=1 ";
+
+ $sql_group_by=" group by p.update_by_id ";
+
+ $rangeArray = explode("S",$opd_date_range);
+ $minRange = str_replace('T',' ',$rangeArray[0]);
+ $maxRange = str_replace('T',' ',$rangeArray[1]);
+
+ if($minRange==$maxRange)
+ {
+ $sql_where.=" and Date(p.payment_date) between Date('".$minRange."') and Date('".$maxRange. "')";
+ }else{
+ $sql_where.=" and p.payment_date between '".$minRange."' and '".$maxRange. "'";
+ }
+
+ $data_show='Date(YYYY-MM-DD h:m) between '.$minRange.' and '.$maxRange.'
';
+
+
+ if($emp_name_id<>0)
+ {
+ $emp_name_id=str_replace('S',',',$emp_name_id);
+
+ $sql_where.=" and p.update_by_id in (".$emp_name_id.")";
+ }
+
+ if($paymode_id>0)
+ {
+ if($paymode_id==1)
+ {
+ $sql_where.=" and p.payment_mode in (1,3) ";
+ }else{
+ $sql_where.=" and p.payment_mode = '".$paymode_id."'";
+ }
+ }
+
+ $sql_order=" Order by p.update_by";
+
+ if($order_1==1)
+ {
+ $sql_order.=' ,p.update_by';
+ }
+
+ if($order_1==2)
+ {
+ $sql_order.=' ,p.payment_mode';
+ }
+
+ //echo $table_show;
+ // create new PDF document
+ $pdf = new TCPDF(PDF_PAGE_ORIENTATION, PDF_UNIT, PDF_PAGE_FORMAT, true, 'UTF-8', false);
+
+ // set document information
+ $pdf->SetCreator(PDF_CREATOR);
+ $pdf->SetAuthor('IHC:D.S.Bisht');
+ $pdf->SetTitle('IHC:OPD List');
+ $pdf->SetSubject('IHC:OPD List');
+ $pdf->SetKeywords('IHC:OPD List, PDF, OPD, List, guide');
+
+ // set default header data
+ $pdf->SetHeaderData(PDF_HEADER_LOGO, PDF_HEADER_LOGO_WIDTH, PDF_HEADER_TITLE, PDF_HEADER_STRING, array(0,64,255), array(0,64,128));
+ $pdf->setFooterData(array(0,64,0), array(0,64,128));
+
+ // set header and footer fonts
+ $pdf->setHeaderFont(Array(PDF_FONT_NAME_MAIN, '', PDF_FONT_SIZE_MAIN));
+ $pdf->setFooterFont(Array(PDF_FONT_NAME_DATA, '', PDF_FONT_SIZE_DATA));
+
+ // set default monospaced font
+ $pdf->SetDefaultMonospacedFont(PDF_FONT_MONOSPACED);
+
+ // set margins
+ //$pdf->SetMargins(PDF_MARGIN_LEFT, PDF_MARGIN_TOP, PDF_MARGIN_RIGHT);
+ $pdf->SetMargins(5, PDF_MARGIN_TOP, 0.25);
+ $pdf->SetHeaderMargin(PDF_MARGIN_HEADER);
+ $pdf->SetFooterMargin(PDF_MARGIN_FOOTER);
+
+ // set auto page breaks
+ $pdf->SetAutoPageBreak(TRUE, PDF_MARGIN_BOTTOM);
+
+ // set image scale factor
+ $pdf->setImageScale(PDF_IMAGE_SCALE_RATIO);
+
+ // set some language-dependent strings (optional)
+ if (@file_exists(dirname(__FILE__).'/lang/eng.php')) {
+ require_once(dirname(__FILE__).'/lang/eng.php');
+ $pdf->setLanguageArray($l);
+ }
+
+ // ---------------------------------------------------------
+
+ // set default font subsetting mode
+ $pdf->setFontSubsetting(true);
+
+ // Set font
+ // dejavusans is a UTF-8 Unicode font, if you only need to
+ // print standard ASCII chars, you can use core fonts like
+ // helvetica or times to reduce file size.
+ $pdf->SetFont('dejavusans', '', 9, '', true);
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+
+ // set text shadow effect
+ //$pdf->setTextShadow(array('enabled'=>true, 'depth_w'=>0.2, 'depth_h'=>0.2, 'color'=>array(196,196,196), 'opacity'=>1, 'blend_mode'=>'Normal'));
+
+ $table_start='';
+
+ $table_head='';
+ $table_head.='User ID ';
+ $table_head.='OPD Amount ';
+ $table_head.='Charge Amount ';
+ $table_head.='IPD Amount ';
+ $table_head.='Return Amount ';
+ $table_head.='Total ';
+ $table_head.=' ';
+
+
+ $table_footer='';
+
+ // Add a page
+ // This method has several options, check the source code documentation for more information.
+ $pdf->AddPage();
+
+ //echo $sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order;
+
+
+ $query = $this->db->query($sql_f_all.$sql_from.$sql_where.' '.$sql_group_by.$sql_order);
+ $data['gsub_rec']= $query->result();
+
+
+ $table_body='';
+ $table_total_opd=0.00;
+ $table_total_ipd=0.00;
+ $table_total_charge=0.00;
+ $table_total_return=0.00;
+ $table_total_all=0.00;
+
+ //echo $sql_f_all.$sql_from.$sql_where.$gwhere.' '.$sql_order.' ';
+
+ foreach($data['gsub_rec'] as $rowdata)
+ {
+ $table_body.='';
+ $table_body.=''.$rowdata->update_by.' ';
+ $table_body.=''.$rowdata->OPD_Amount.' ';
+ $table_body.=''.$rowdata->Charge_Amount.' ';
+ $table_body.=''.$rowdata->IPD_Amount.' ';
+ $table_body.=''.$rowdata->Return_Amount.' ';
+ $table_body.=''.$rowdata->total_Amount.' ';
+ $table_body.=' ';
+
+
+ $table_total_opd=$table_total_opd+$rowdata->OPD_Amount;
+ $table_total_ipd=$table_total_ipd+$rowdata->IPD_Amount;
+ $table_total_charge=$table_total_charge+$rowdata->Charge_Amount;
+ $table_total_return=$table_total_return+$rowdata->Return_Amount;
+ $table_total_all=$table_total_all+$rowdata->total_Amount;
+
+ }
+
+ $table_footer='';
+ $table_footer.='Total ';
+ $table_footer.=''.$table_total_opd.' ';
+ $table_footer.=''.$table_total_charge.' ';
+ $table_footer.=''.$table_total_ipd.' ';
+ $table_footer.=''.$table_total_return.' ';
+ $table_footer.=''.$table_total_all.' ';
+ $table_footer.=' ';
+
+ $data_show.=$table_start.$table_head.$table_body.$table_footer.$table_end;
+
+ //echo $data_show;
+
+ // Set some content to print
+ $html = <<writeHTMLCell(0, 0, '', '', $html, 0, 1, 0, true, '', true);
+
+
+ // ---------------------------------------------------------
+
+ // Close and output PDF document
+ // This method has several options, check the source code documentation for more information.
+
+ $pdf->Output('Total_payment_list.pdf', 'I');
+
+ //============================================================+
+ // END OF FILE
+ //============================================================+
+ }
+
+
+}
+
+/* End of file c_test.php */
+/* Location: ./application/controllers/c_test.php */
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Room_bed.php b/old_code_ci3/controllers/Room_bed.php
new file mode 100644
index 0000000..bc4aa9b
--- /dev/null
+++ b/old_code_ci3/controllers/Room_bed.php
@@ -0,0 +1,57 @@
+load->database();
+ }
+
+ public function index()
+ {
+ $sql="SELECT b.* ,v.p_fname,v.p_relative,v.p_rname,v.doc_name,v.ipd_code,v.p_code,v.admit_type
+ From hc_bed_master b left JOIN v_ipd_list v ON b.bed_used_p_id=v.id";
+ $query = $this->db->query($sql);
+ $data['bed_master']= $query->result();
+
+ $this->load->view('IPD/Bed_panel',$data);
+ }
+
+ public function ipd_list()
+ {
+ $sql="select * from v_ipd_list where ipd_status=0";
+
+ $query = $this->db->query($sql);
+ $ipd_bed_list= $query->result();
+
+
+ }
+
+ public function get_admit_ipd_list(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="SELECT *
+ from v_ipd_list
+ where ipd_status=0 and
+ (p_fname LIKE '$q%' or p_code like '%$q' or ipd_code like '%$q')
+ order BY p_fname ";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['ipd_code'])).' | '.htmlentities(stripslashes($row['p_fname'])).' | '.htmlentities(stripslashes($row['str_register_date']));
+ $new_row['value']=htmlentities(stripslashes($row['id']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Setting.php b/old_code_ci3/controllers/Setting.php
new file mode 100644
index 0000000..a028125
--- /dev/null
+++ b/old_code_ci3/controllers/Setting.php
@@ -0,0 +1,16 @@
+load->view('setting/setting_main');
+ }
+
+}
diff --git a/old_code_ci3/controllers/Stock.php b/old_code_ci3/controllers/Stock.php
new file mode 100644
index 0000000..bd3b07a
--- /dev/null
+++ b/old_code_ci3/controllers/Stock.php
@@ -0,0 +1,1250 @@
+load->view('Medical/Stock/indent_request');
+ }
+
+ public function Indent_Request_Search()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if(trim($sdata)=='')
+ {
+ $sql=" SELECT m.indent_id,m.indent_code,s.store_name,
+ m.request_status,m.created_date,
+ GROUP_CONCAT(t.product_name) AS product_list,
+ i.indent_id AS process_indent_id,
+ (case m.request_status
+ when 0 then 'Pending'
+ when 1 then 'Send To Store'
+ when 2 then 'Accept and Process'
+ when 3 then 'Processed and Verification Pending'
+ when 4 then concat('Send to Counter :',s.store_name)
+ when 5 then concat('Accept By Counter :',s.store_name)
+ else 'UnKnown' end) as request_status_str,
+ (case m.indent_type when 0 then 'Auto' when 1 then 'By Counter Store' when 2 then 'Main Store' else 'UnKnown' end) as indent_request_type_str
+ FROM (((med_indent_request m Left JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ JOIN store_master s ON m.store_id=s.store_id)
+ LEFT JOIN med_indent_process i ON m.indent_id=i.indent_id
+ where m.request_status >0 and m.indent_type in (0,1)
+ GROUP BY m.indent_id order by m.indent_id desc limit 50";
+ }else{
+ $sql=" SELECT m.indent_id,m.indent_code,s.store_name,
+ m.request_status,m.created_date,
+ GROUP_CONCAT(t.product_name) AS product_list,
+ i.indent_id AS process_indent_id,
+ (case m.request_status
+ when 0 then 'Pending'
+ when 1 then 'Send To Store'
+ when 2 then 'Accept and Process'
+ when 3 then 'Processed and Verification Pending'
+ when 4 then concat('Send to Counter :',s.store_name)
+ when 5 then concat('Accept By Counter :',s.store_name)
+ else 'UnKnown' end) as request_status_str,
+ (case m.indent_type when 0 then 'Auto' when 1 then 'By Counter Store' when 2 then 'Main Store' else 'UnKnown' end) as indent_request_type_str
+ FROM (((med_indent_request m Left JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ JOIN store_master s ON m.store_id=s.store_id)
+ LEFT JOIN med_indent_process i ON m.indent_id=i.indent_id
+ WHERE t.product_name LIKE '%".$sdata."%' OR m.indent_code LIKE '%".$sdata."'
+ and m.request_status >0 and m.indent_type in (0,1)
+ GROUP BY m.indent_id order by m.indent_id desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['indent_req_list']= $query->result();
+
+ $this->load->view('Medical/Stock/indent_request_search_result',$data);
+ }
+
+
+ public function indent_request_item_store_list_view($indent_id)
+ {
+ $sql="SELECT m.*,s.store_name
+ from med_indent_request m JOIN store_master s ON m.store_id=s.store_id
+ where m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request']= $query->result();
+
+ $sql="SELECT t.*,p.item_name,p.formulation,p.genericname,p.packing
+ FROM ((med_indent_request m JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ WHERE m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request_items']= $query->result();
+
+ $data['indent_status_cont']=array(
+ 'Pending','Send to Store','Accept By Store','Processing Items','Send to Counter','Accept By Counter'
+ );
+
+ $this->load->view('Medical/Stock/indent_req_view_with_store',$data);
+ }
+
+ public function indent_issue_items($indent_id)
+ {
+ $sql="SELECT m.*,s.store_name
+ from med_indent_request m JOIN store_master s ON m.store_id=s.store_id
+ where m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request']= $query->result();
+
+ $sql="select * from med_indent_process where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_process']= $query->result();
+
+ $sql="SELECT t.*,p.item_name,p.formulation,p.genericname,p.packing
+ FROM ((med_indent_request m JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ WHERE m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request_items']= $query->result();
+
+ $data['indent_status_cont']=array(
+ 'Pending','Send to Store','Accept By Store','Processing Items','Send to Counter','Accept By Counter'
+ );
+
+ $this->load->view('Medical/Stock/indent_issue_items',$data);
+
+ }
+
+ public function indent_issue_items_view($indent_id)
+ {
+ $sql="SELECT m.*,s.store_name
+ from med_indent_request m JOIN store_master s ON m.store_id=s.store_id
+ where m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request']= $query->result();
+
+ $sql="select * from med_indent_process where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_process']= $query->result();
+
+ $data['indent_status_cont']=array(
+ 'Pending','Send to Store','Accept By Store','Processing Items','Send to Counter','Accept By Counter'
+ );
+
+ $this->load->view('Medical/Stock/indent_issue_item_view',$data);
+
+ }
+
+ public function indent_issue_items_sub($indent_id,$indent_view=0)
+ {
+ $sql="SELECT t.*,p.item_name,p.formulation,p.genericname,p.packing ,SUM(a.qty) AS issued_qty
+ FROM ((med_indent_request m JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ LEFT JOIN med_indent_process_items a ON m.indent_id=a.indent_id AND t.id=a.indent_item_id
+ WHERE m.indent_id=".$indent_id." GROUP BY m.indent_id,t.id";
+
+ $query = $this->db->query($sql);
+ $med_indent_request_items= $query->result();
+
+ $srno=0;
+ $content='
+
+ #
+ Item Name
+ Formulation
+ Qty.
+ Min Qty
+ Issued Qty
+ ';
+ foreach($med_indent_request_items as $row)
+ {
+ $srno=$srno+1;
+ $content.= '';
+ $content.= ''.$srno.' ';
+ if($indent_view==0)
+ {
+ $content.= ''.$row->item_name.' ';
+ }else{
+ $content.= ''.$row->item_name.' ';;
+ }
+
+ $content.= ''.$row->formulation.' ';
+ $content.= ''.$row->request_qty.' ';
+ $content.= ''.$row->min_requirement.' ';
+ $content.= ''.$row->issued_qty.' ';
+ $content.= ' ';
+ }
+
+ $content.='
+ #
+ Item Name
+ Formulation
+ Qty.
+ Min Qty
+ Issued Qty
+
+
';
+ echo $content;
+ }
+
+
+ public function indent_issue_items_stock($product_id,$indent_id,$indent_item_id)
+ {
+ $sql="SELECT s.id,s.purchase_id,s.Item_name,s.batch_no,s.expiry_date,s.tqty,i.qty as issue_item,i.store_stock_id
+ FROM (purchase_invoice_item s JOIN med_product_master p ON s.item_code=p.id)
+ LEFT JOIN med_indent_process_items i ON i.ssno=s.id
+ AND i.indent_id=".$indent_id." AND i.indent_item_id=".$indent_item_id." WHERE s.item_code=".$product_id;
+
+ $query = $this->db->query($sql);
+ $data['stock_list']= $query->result();
+
+ $data['product_id']=$product_id;
+ $data['indent_id']=$indent_id;
+ $data['indent_item_id']=$indent_item_id;
+
+ $this->load->view('Medical/Stock/indent_stock_list',$data);
+
+ }
+
+ public function indent_process_update_Qty()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('product_master_M');
+
+
+ $product_id=$this->input->post('hid_product_id');
+ $indent_id=$this->input->post('hid_indent_id');
+ $indent_item_id=$this->input->post('hid_indent_item_id');
+
+ $ssno=$this->input->post('pur_item_id');
+ $qty_issue=$this->input->post('qty_issue');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $sql="select * from med_indent_process where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $med_indent_process= $query->result();
+
+ if(count($med_indent_process)<1)
+ {
+ $Pdata = array(
+ 'store_accept_time' => date('d-m-Y H:i:s'),
+ 'store_accept_by' => $user_id,
+ 'store_accept_by_name' => $user_name_info,
+ 'indent_id' => $indent_id,
+ 'indent_process_status' =>0,
+ 'verify_status'=>0,
+ );
+ $inser_id=$this->product_master_M->insert_med_indent_process($Pdata);
+ }
+
+ $Pdata = array(
+ 'indent_id' => $indent_id,
+ 'indent_item_id' => $indent_item_id,
+ 'product_id' => $product_id,
+ 'qty' => $qty_issue,
+ 'ssno' => $ssno
+ );
+
+ $sql="select * from med_indent_process_items
+ where indent_id=".$indent_id." and
+ indent_item_id=".$indent_item_id."
+ and product_id=".$product_id." and ssno=".$ssno;
+ $query = $this->db->query($sql);
+ $med_indent_process_items= $query->result();
+
+ //echo $sql;
+
+ if(count($med_indent_process_items)>0)
+ {
+ $indent_process_item_id=$med_indent_process_items[0]->id;
+ $this->product_master_M->update_med_indent_process_items($Pdata,$indent_process_item_id);
+ }else{
+ $inser_id=$this->product_master_M->insert_med_indent_process_items($Pdata);
+ }
+
+ $rvar=array(
+ 'is_update_stock' =>1,
+ 'show_text'=>'Updated'
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ function indent_process_items_list($indent_id)
+ {
+ $sql="SELECT i.indent_id,i.id AS request_item_id,t.id AS process_item_id,i.product_name,t.ssno,p.batch_no,p.expiry_date,i.request_qty,
+ SUM(t.qty) AS t_qty
+ FROM ((med_indent_process m join med_indent_process_items t ON m.indent_id=t.indent_id)
+ JOIN med_indent_request_items i ON m.indent_id=i.indent_id AND i.id=t.indent_item_id)
+ JOIN purchase_invoice_item p ON t.ssno=p.id
+ where i.indent_id=".$indent_id."
+ GROUP BY i.indent_id,i.id,t.id WITH rollup";
+ $query = $this->db->query($sql);
+ $med_indent_process_items= $query->result();
+
+ $content='';
+
+ $content.="
Issued Items ";
+
+ $content.='
+
+ #
+ Batch No.
+ Expiry Date
+ Issued Qty.
+ ';
+ $srno=0;
+ $header_name="";
+ foreach($med_indent_process_items as $row)
+ {
+ if($row->indent_id=='')
+ {
+
+ }elseif($row->request_item_id==''){
+
+ }elseif($row->process_item_id==''){
+ $content.=' ';
+ $content.= 'Item Name : Total Qty of '.$row->product_name.' ';
+ $content.= ''.$row->t_qty.' ';
+ $content.= ' ';
+ $content.= ' ';
+ }else{
+ if($header_name!=$row->product_name)
+ {
+ $content.=' ';
+ $content.= ''.$row->product_name.' ';
+ $content.= ' ';
+ $content.= ' ';
+ }
+
+ $header_name=$row->product_name;
+
+ $srno=$srno+1;
+ $content.=' ';
+ $content.= ''.$srno.' ';
+ $content.= ''.$row->batch_no.' ';
+ $content.= ''.$row->expiry_date.' ';
+ $content.= ''.$row->t_qty.' ';
+ $content.= ' ';
+ }
+ }
+
+ $content.= '
';
+
+ $content.= '
';
+ $content.='';
+ $content.='
+
+
';
+ $content.= '
';
+ echo $content;
+
+ }
+
+ //indent Accept By Store
+
+ function indent_store_accept_items_list($indent_id)
+ {
+ $sql="SELECT m.*,s.store_name
+ from med_indent_request m JOIN store_master s ON m.store_id=s.store_id
+ where m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request']= $query->result();
+
+ $this->load->view('Medical/Stock/indent_accept_items_list',$data);
+ }
+
+
+ function indent_accept_items_list($indent_id,$item_id=0)
+ {
+ $where=" i.indent_id=$indent_id";
+ if($item_id>0)
+ {
+ $where.=" and i.id =$item_id";
+ }
+
+ $sql="SELECT i.indent_id,i.id AS request_item_id,t.id AS process_item_id,i.product_name,
+ t.ssno,p.batch_no,p.expiry_date,i.request_qty,t.store_stock_id,
+ SUM(t.qty) AS t_qty,r.request_status
+ FROM (((med_indent_process m join med_indent_process_items t ON m.indent_id=t.indent_id)
+ JOIN med_indent_request_items i ON m.indent_id=i.indent_id AND i.id=t.indent_item_id)
+ JOIN purchase_invoice_item p ON t.ssno=p.id)
+ JOIN med_indent_request r on i.indent_id=r.indent_id
+ where $where
+ GROUP BY i.indent_id,i.id,t.id WITH rollup";
+
+ $query = $this->db->query($sql);
+ $med_indent_process_items= $query->result();
+
+ $content="";
+
+ $content.='
+
+ #
+ Batch No.
+ Expiry Date
+ Issued Qty.
+ Accept All
+ ';
+ $srno=0;
+ $header_name="";
+ foreach($med_indent_process_items as $row)
+ {
+ if($row->indent_id=='')
+ {
+
+ }elseif($row->request_item_id==''){
+
+ }elseif($row->process_item_id==''){
+ $content.=' ';
+ $content.= ' Total Qty of '.$row->product_name.' : ';
+ $content.= ''.$row->t_qty.' ';
+ $content.= ' ';
+ $content.= ' ';
+ }else{
+ if($header_name!=$row->product_name)
+ {
+ $content.=' ';
+ $content.= ''.$row->product_name.' ';
+ $content.= ' ';
+ $content.= ' ';
+ }
+
+ $header_name=$row->product_name;
+
+ $srno=$srno+1;
+ $content.=' ';
+ $content.= ''.$srno.' ';
+ $content.= ''.$row->batch_no.' ';
+ $content.= ''.$row->expiry_date.' ';
+ $content.= ''.$row->t_qty.' ';
+ if($row->store_stock_id==0 && $row->request_status==4)
+ {
+ $content.= 'Accept ';
+ }else{
+ $content.= ' ';
+ }
+
+ $content.= ' ';
+ }
+ }
+
+ $content.= '
';
+
+ $content.= '';
+
+ echo $content;
+
+ }
+
+
+
+ public function indent_process_accept_Qty()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('product_master_M');
+
+ $indent_id=$this->input->post('indent_id');
+ $process_item_id=$this->input->post('process_item_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $sql="select * from med_indent_request where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $med_indent_request= $query->result();
+
+ $store_id=$med_indent_request[0]->store_id;
+
+ $sql="select * from med_indent_process_items where id=".$process_item_id." and indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $med_indent_process_items= $query->result();
+
+ if(count($med_indent_process_items)>0)
+ {
+ $sql="select * from purchase_invoice_item where id=".$med_indent_process_items[0]->ssno;
+ $query = $this->db->query($sql);
+ $purchase_invoice_item= $query->result();
+
+ $item_unit_qty=$med_indent_process_items[0]->qty*$purchase_invoice_item[0]->packing;
+
+ $Pdata = array(
+ 'store_id' => $store_id,
+ 'ind_proc_item_id' => $process_item_id,
+ 'product_id' => $med_indent_process_items[0]->product_id,
+ 'ssno' => $med_indent_process_items[0]->ssno,
+ 'item_qty' => $med_indent_process_items[0]->qty,
+ 'item_unit_qty' => $item_unit_qty,
+ 'insert_date' => date('Y-m-d H:i:s'),
+ 'accept_by' => $user_id,
+ 'accept_by_name' => $user_name_info,
+ 'accept_time' => date('Y-m-d H:i:s'),
+ );
+
+ $insert_id=$this->product_master_M->insert_store_stock_items($Pdata);
+
+ if($insert_id>0)
+ {
+ $Pdata = array(
+ 'store_stock_id' => $insert_id,
+ );
+
+ $insert_id=$this->product_master_M->update_med_indent_process_items($Pdata,$process_item_id);
+ }
+ }
+
+ $rvar=array(
+ 'is_update_stock' =>1,
+ 'show_text'=>'Updated'
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+
+ public function indent_process_accept_Qty_all($indent_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $this->load->model('product_master_M');
+
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $sql="select * from med_indent_request where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $med_indent_request= $query->result();
+
+ $store_id=$med_indent_request[0]->store_id;
+
+ $sql="select * from med_indent_process_items where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $med_indent_process_items= $query->result();
+
+ foreach($med_indent_process_items as $row)
+ {
+ $sql="select * from purchase_invoice_item where id=".$row->ssno;
+ $query = $this->db->query($sql);
+ $purchase_invoice_item= $query->result();
+
+ $process_item_id=$row->id;
+
+ $item_unit_qty=$row->qty*$purchase_invoice_item[0]->packing;
+
+ $Pdata = array(
+ 'store_id' => $store_id,
+ 'ind_proc_item_id' => $process_item_id,
+ 'product_id' => $row->product_id,
+ 'ssno' => $row->ssno,
+ 'item_qty' => $row->qty,
+ 'item_unit_qty' => $item_unit_qty,
+ 'insert_date' => date('Y-m-d H:i:s'),
+ 'accept_by' => $user_id,
+ 'accept_by_name' => $user_name_info,
+ 'accept_time' => date('Y-m-d H:i:s'),
+ );
+
+ $insert_id=$this->product_master_M->insert_store_stock_items($Pdata);
+
+ if($insert_id>0)
+ {
+ $Pdata = array(
+ 'store_stock_id' => $insert_id,
+ );
+
+ $insert_id=$this->product_master_M->update_med_indent_process_items($Pdata,$process_item_id);
+ }
+ }
+
+ $rvar=array(
+ 'is_update_stock' =>1,
+ 'show_text'=>'Updated'
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+
+
+ //Store Indent Transfer Direct
+
+ public function indent_counter_list()
+ {
+ $sql="select * from store_master order by store_name";
+ $query = $this->db->query($sql);
+ $data['store_master']= $query->result();
+
+ $this->load->view('Medical/Stock/indent_counter_list',$data);
+ }
+
+ public function Indent_counter_Search()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if(trim($sdata)=='')
+ {
+ $sql=" SELECT m.indent_id,m.indent_code,s.store_name,
+ m.request_status,m.created_date,
+ GROUP_CONCAT(t.product_name) AS product_list,
+ i.indent_id AS process_indent_id,
+ (case m.request_status
+ when 0 then 'Pending'
+ when 1 then 'Send To Store'
+ when 2 then 'Accept and Process'
+ when 3 then 'Processed and Verification Pending'
+ when 4 then concat('Send to Counter :',s.store_name)
+ when 5 then concat('Accept By Counter :',s.store_name)
+ else 'UnKnown' end) as request_status_str,
+ (case m.indent_type when 0 then 'Auto' when 1 then 'By Counter Store' when 2 then 'Main Store' else 'UnKnown' end) as indent_request_type_str
+ FROM (((med_indent_request m Left JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ JOIN store_master s ON m.store_id=s.store_id)
+ LEFT JOIN med_indent_process i ON m.indent_id=i.indent_id
+ where m.indent_type = 2
+ GROUP BY m.indent_id order by m.indent_id desc limit 50";
+ }else{
+ $sql=" SELECT m.indent_id,m.indent_code,s.store_name,
+ m.request_status,m.created_date,
+ GROUP_CONCAT(t.product_name) AS product_list,
+ i.indent_id AS process_indent_id,
+ (case m.request_status
+ when 0 then 'Pending'
+ when 1 then 'Send To Store'
+ when 2 then 'Accept and Process'
+ when 3 then 'Processed and Verification Pending'
+ when 4 then concat('Send to Counter :',s.store_name)
+ when 5 then concat('Accept By Counter :',s.store_name)
+ else 'UnKnown' end) as request_status_str,
+ (case m.indent_type when 0 then 'Auto' when 1 then 'By Counter Store' when 2 then 'Main Store' else 'UnKnown' end) as indent_request_type_str
+ FROM (((med_indent_request m Left JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ JOIN store_master s ON m.store_id=s.store_id)
+ LEFT JOIN med_indent_process i ON m.indent_id=i.indent_id
+ WHERE t.product_name LIKE '%".$sdata."%' OR m.indent_code LIKE '%".$sdata."'
+ and m.indent_type = 2
+ GROUP BY m.indent_id order by m.indent_id desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['indent_req_list']= $query->result();
+
+ $this->load->view('Medical/Stock/indent_counter_search_result',$data);
+ }
+
+ public function Create_Indent_counter($store_id=3)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+
+ $sql="SELECT m.indent_id,COUNT(t.id) AS No_item
+ from med_indent_request m LEFT join med_indent_request_items t ON m.indent_id=t.id
+ where store_id='".$store_id."' and indent_type <>2
+ GROUP BY m.indent_id having COUNT(t.id)=0";
+ $query = $this->db->query($sql);
+ $pending_nil_indent= $query->result();
+
+ $user_update_log='Indent Create By '.$user_name_info.'.';
+
+ $Udata = array(
+ 'store_id'=> $store_id,
+ 'indent_type'=> '2',
+ 'created_date'=> date('Y-m-d H:i:s'),
+ 'request_status'=>'0',
+ 'request_status_log'=>$user_update_log,
+ );
+
+ $this->load->model('product_master_M');
+
+ if(count($pending_nil_indent)>0)
+ {
+ $this->product_master_M->update_med_indent_request($Udata,$pending_nil_indent[0]->indent_id);
+ $inser_id=$pending_nil_indent[0]->indent_id;
+ }else{
+ $inser_id=$this->product_master_M->insert_med_indent_request($Udata);
+ }
+
+ $send_msg="Added Successfully";
+
+ if($inser_id>0)
+ {
+ redirect('Stock/Indent_counter_Edit/'.$inser_id);
+ }else{
+ echo $send_msg;
+ }
+
+ }
+
+ public function Indent_counter_Edit($indent_id)
+ {
+ $sql="SELECT m.*,s.store_name
+ from med_indent_request m Left JOIN store_master s ON m.store_id=s.store_id
+ where m.indent_id=".$indent_id;
+
+ $query = $this->db->query($sql);
+ $data['med_indent_request']= $query->result();
+
+ $sql="SELECT t.*,p.item_name,p.formulation,p.genericname,p.packing
+ FROM ((med_indent_request m JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ WHERE m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request_items']= $query->result();
+
+ $data['indent_status_cont']=array(
+ 'Pending','Send to Store','Accept By Store','Processing Items','Send to Counter','Accept By Counter'
+ );
+
+ $this->load->view('Medical/Stock/indent_counter_edit',$data);
+ }
+
+ public function get_product_master(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $where_str=" i.item_name like '".$q."%'";
+
+ if(strlen($q)>3)
+ {
+ $where_str=" or batch_no like '".$q."%'";
+ }
+
+ $sql="SELECT i.Item_name,i.tqty,i.id,i.item_code,i.batch_no,date_format(p.date_of_invoice,'%d-%m-%Y') as purchase_date,
+ date_format(i.expiry_date,'%m-%Y') AS exp_date ,m.formulation,i.mrp,m.packing,
+ (i.tqty-sum(COALESCE(s.item_qty,0))) as Pending_stock_invoice
+ FROM ((purchase_invoice_item i JOIN purchase_invoice p ON i.purchase_id=p.id)
+ left JOIN store_stock s ON i.id=s.ssno )
+ JOIN med_product_master m ON i.item_code=m.id
+ WHERE $where_str
+ GROUP BY i.item_code,i.id
+ HAVING (i.tqty-sum(COALESCE(s.item_qty,0)))>0
+ ORDER BY i.Item_name,i.id ";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['Item_name'])).' | '.htmlentities(stripslashes($row['batch_no'])).' | '.htmlentities(stripslashes($row['formulation'])).' | '.htmlentities(stripslashes($row['exp_date']));
+ $new_row['value']=htmlentities(stripslashes($row['Item_name'])).' | '.htmlentities(stripslashes($row['formulation']));
+ //$new_row['value']=htmlentities(stripslashes($row['itemname']));
+
+ $new_row['l_item_code']=htmlentities(stripslashes($row['item_code']));
+ $new_row['l_item_ssno']=htmlentities(stripslashes($row['id']));
+ $new_row['l_item_qty']=htmlentities(stripslashes($row['Pending_stock_invoice']));
+ $new_row['l_packing']=htmlentities(stripslashes($row['packing']));
+ $new_row['l_itemname']=htmlentities(stripslashes($row['Item_name'])).' | '.htmlentities(stripslashes($row['formulation']));
+
+ $new_row['l_batch_mrp_exp']=htmlentities(stripslashes($row['batch_no'])).' / '.htmlentities(stripslashes($row['mrp'])).' / '.htmlentities(stripslashes($row['exp_date']));
+
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }else{
+ $new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ echo json_encode($row_set);
+ }
+
+ }else{
+ echo 'No Data';
+ }
+ }
+
+ public function Indent_product_stock($product_id)
+ {
+ $sql="SELECT i.Item_name,i.qty,i.id,i.item_code,i.batch_no,p.date_of_invoice,
+ date_format(i.expiry_date,'%m-%Y') AS exp_date ,
+ (i.qty-sum(COALESCE(s.item_qty,0))) as Pending_stock_invoice
+ FROM (purchase_invoice_item i JOIN purchase_invoice p ON i.purchase_id=p.id)
+ left JOIN store_stock s ON i.id=s.ssno
+ WHERE i.item_code=$product_id
+ GROUP BY i.item_code,i.id
+ HAVING (i.qty-sum(COALESCE(s.item_qty,0)))>0
+ ORDER BY i.Item_name,i.id ";
+ $query = $this->db->query($sql);
+ $data['product_store']= $query->result();
+
+ $this->load->view('Medical/Stock/indent_counter_edit_stock_list',$data);
+ }
+
+ public function indent_request_item_list($indent_id)
+ {
+ $sql="SELECT m.*,s.store_name
+ from med_indent_request m JOIN store_master s ON m.store_id=s.store_id
+ where m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request']= $query->result();
+
+ $sql="SELECT t.*,p.item_name,p.formulation,p.genericname,p.packing
+ FROM ((med_indent_request m JOIN med_indent_request_items t ON m.indent_id=t.indent_id)
+ JOIN med_product_master p ON t.product_id=p.id)
+ WHERE m.indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['med_indent_request_items']= $query->result();
+
+ $this->load->view('Medical/Stock/indent_counter_item_list',$data);
+
+ }
+
+ public function indent_update_item($indent_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $sql="select * from med_indent_request where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $med_indent_request= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_item_name',
+ 'label' => 'Product Name',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ ),
+
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $indent_id=$this->input->post('indent_id');
+ $indent_item_id=$this->input->post('med_indent_request_items_id');
+
+ $this->load->model('product_master_M');
+
+ $Pdata = array(
+ 'indent_id' => $indent_id,
+ 'product_id' => $this->input->post('product_id'),
+ 'product_name' => $this->input->post('input_item_name'),
+ 'request_qty' => $this->input->post('input_Qty'),
+ 'cat' => '1',
+ 'insert_by' => $user_name_info,
+ );
+
+ $show_text='';
+
+ $is_update_stock=0;
+
+ if($indent_item_id<1)
+ {
+ $is_update_stock=$this->product_master_M->insert_med_indent_request_items($Pdata);
+ }else{
+ $is_update_stock=$this->product_master_M->update_med_indent_request_items($Pdata,$indent_item_id);
+ }
+
+ if($is_update_stock>0)
+ {
+ $send_msg="Updated";
+ }else{
+ $send_msg="Error : Update in Indent Request Table";
+ }
+
+ if($is_update_stock>0)
+ {
+ $show_text=Show_Alert('success','Updated',$send_msg);
+ }else{
+ $show_text=Show_Alert('danger','Error',$send_msg);
+ }
+
+ $rvar=array(
+ 'is_update_stock' =>$is_update_stock,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else
+ {
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'is_update_stock' =>0,
+ 'show_text'=>Show_Alert('danger','Error',$send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+ public function Transfer_invoice_to_counter($inv_id,$store_id) {
+ $this->load->model('product_master_M');
+
+ $sql="SELECT COUNT(*) AS no_record
+ FROM (purchase_invoice p JOIN purchase_invoice_item i ON p.id=i.purchase_id)
+ WHERE p.id=$inv_id";
+ $query = $this->db->query($sql);
+ $sql_result= $query->result();
+
+ $msg="";
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ if(count($sql_result)>0)
+ {
+ $no_record=$sql_result[0]->no_record;
+ if($no_record>0)
+ {
+ $sql="SELECT (SUM(i.qty+COALESCE(i.qty_free,0))-sum(COALESCE(s.item_qty,0))) as Pending_stock_invoice
+ FROM (purchase_invoice_item i left JOIN store_stock s ON i.id=s.ssno)
+ WHERE i.purchase_id=$inv_id
+ GROUP BY i.purchase_id";
+ $query = $this->db->query($sql);
+ $sql_result= $query->result();
+
+ if(count($sql_result)>0)
+ {
+ $Pending_stock_invoice=$sql_result[0]->Pending_stock_invoice;
+
+ if($Pending_stock_invoice>0)
+ {
+ //Check Pending Indent: Create on Direct Purchase Invoice
+
+ /*
+ $sql="SELECT m.indent_id,COUNT(t.id) AS No_item
+ from med_indent_request m LEFT join med_indent_request_items t ON m.indent_id=t.id
+ where store_id='".$store_id."' and indent_type=2
+ GROUP BY m.indent_id having COUNT(t.id)=0";
+ $query = $this->db->query($sql);
+ $pending_nil_indent= $query->result();
+
+ echo $sql;
+
+ */
+
+ $user_update_log='Indent Create By '.$user_name_info.'.';
+
+ $Udata = array(
+ 'store_id'=> $store_id,
+ 'indent_type'=> '2',
+ 'created_date'=> date('Y-m-d H:i:s'),
+ 'request_status'=>'3',
+ 'request_status_log'=>$user_update_log,
+ );
+
+ /*
+
+ if(count($pending_nil_indent)>0)
+ {
+ $this->product_master_M->update_med_indent_request($Udata,$pending_nil_indent[0]->indent_id);
+ $indent_id=$pending_nil_indent[0]->indent_id;
+ }else{
+ $indent_id=$this->product_master_M->insert_med_indent_request($Udata);
+ }
+
+ */
+
+ $indent_id=$this->product_master_M->insert_med_indent_request($Udata);
+
+
+ //Indent Process Create here
+ $Pdata = array(
+ 'store_accept_time' => date('d-m-Y H:i:s'),
+ 'store_accept_by' => $user_id,
+ 'store_accept_by_name' => $user_name_info,
+ 'indent_id' => $indent_id,
+ 'remark' => $user_update_log,
+ );
+
+ $process_indent_id=$this->product_master_M->insert_med_indent_process($Pdata);
+
+ // Get Purchase Invoice List
+ $sql="SELECT i.Item_name,i.qty,i.id,i.item_code,
+ sum((i.qty+COALESCE(i.qty_free,0))-sum(COALESCE(s.item_qty,0))) as Pending_stock_invoice
+ FROM (purchase_invoice_item i left JOIN store_stock s ON i.id=s.ssno)
+ WHERE i.purchase_id=$inv_id
+ GROUP BY i.purchase_id,i.item_code";
+ $query = $this->db->query($sql);
+ $sql_result= $query->result();
+
+ foreach($sql_result as $row)
+ {
+ //Entry in indent_request_list
+
+ $Udata = array(
+ 'indent_id'=> $indent_id,
+ 'product_id'=> $row->item_code,
+ 'product_name'=> $row->Item_name,
+ 'request_qty'=> $row->Pending_stock_invoice,
+ 'datetime_before'=> date('Y-m-d H:i:s'),
+ 'insert_by'=> $user_id,
+ 'update_by'=> $user_id,
+ );
+ $indent_item_id=$this->product_master_M->insert_med_indent_request_items($Udata);
+
+ //Entry in indent_process_items
+
+ $Pdata = array(
+ 'indent_id' => $indent_id,
+ 'indent_item_id' => $indent_item_id,
+ 'product_id' => $row->item_code,
+ 'qty' =>$row->Pending_stock_invoice,
+ 'ssno' => $row->id,
+ );
+
+ $inser_id=$this->product_master_M->insert_med_indent_process_items($Pdata);
+
+ }
+
+ $msg="Indent Created and Process";
+
+ /* Code For Indent Verified and Send to Store And Accept By Store .
+ Remove or Comment , if Indent Verification Step Require
+ */
+
+ /* $indent_id Already Define */
+ $request_status = '4';
+
+ $sql="select * from med_indent_request where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $med_indent_request= $query->result();
+
+ // 0 Pending , 1 For Send,2 Accept and Process,3 Processed and Verification Pending,4 Verifired & Send by Main Store,5 Accept By Counter
+ $indent_status_cont=array(
+ 'Pending','Send to Store','Accept By Store','Processing Items','Send to Counter','Accept By Counter'
+ );
+
+ $request_status_log="";
+
+ if(count($med_indent_request)>0)
+ {
+ $request_status_log.=$med_indent_request[0]->request_status_log;
+ }
+
+ $request_status_log.='Status Change Direct to Store Wih Verification By '.$indent_status_cont[$request_status].' By '.$user_name_info;
+
+ $Pdata = array(
+ 'request_status' => $request_status,
+ 'last_update_time' => date('Y-m-d H:i:s'),
+ 'request_status_log'=>$request_status_log,
+ );
+
+ if(count($med_indent_request)>0){
+ $is_update_stock=$this->product_master_M->update_med_indent_request($Pdata,$indent_id);
+ $msg= $indent_status_cont[$request_status];
+ }else{
+ $msg= 'Indent Record Not Found';
+ }
+
+ /* Indent Accept by Counter Auto */
+
+ redirect('Stock/indent_process_accept_Qty_all/'.indent_id);
+
+ /* Code End Here */
+
+
+ }else{
+ $msg="No Items found in Purchase Item";
+ }
+
+ }else{
+ $msg="No Items found in Purchase Item";
+ }
+
+ }else{
+ $msg="No Items found in Purchase Item";
+ }
+
+ }else{
+ $msg="No Invoice Found";
+ }
+
+ echo $msg;
+ }
+
+ public function indent_request_item_delete($indent_id,$indent_item_id_del)
+ {
+ $this->load->model('product_master_M');
+
+ $sql="SELECT r.id,r.product_name,s.ssno,s.store_id
+ FROM (med_indent_request_items r JOIN med_indent_process_items p ON r.id=p.indent_item_id)
+ LEFT JOIN store_stock s ON s.ind_proc_item_id=p.id
+ WHERE r.id=$indent_item_id_del";
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $rvar=array(
+ 'is_delete' =>0,
+ 'show_text'=>'Nothing Happen',
+ );
+
+ if(count($result)>0)
+ {
+ $ssno=$result[0]->ssno;
+
+ if($ssno=='')
+ {
+ $is_delete=$this->product_master_M->delete_med_indent_request_item($indent_id,$indent_item_id_del);
+
+ $rvar=array(
+ 'is_delete' =>1,
+ 'show_text'=>'Removed Successfully',
+ );
+ }else{
+ $rvar=array(
+ 'is_delete' =>0,
+ 'show_text'=>'After Indent Process, Cannot Delete',
+ );
+ }
+ }else{
+ $rvar=array(
+ 'is_delete' =>0,
+ 'show_text'=>'No Record Found',
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function indent_update_item_direct($indent_id)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $sql="select * from med_indent_request where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $med_indent_request= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_add_qty',
+ 'label' => 'Product Name',
+ 'rules' => 'required|numeric|greater_than[0]',
+ ),
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $indent_id=$this->input->post('indent_id');
+ $product_id=$this->input->post('product_id');
+ $product_name=$this->input->post('product_name');
+ $add_qty=$this->input->post('input_add_qty');
+ $inv_ssno=$this->input->post('inv_ssno');
+ $indent_item_id=$this->input->post('med_indent_request_items_id');
+
+ $this->load->model('product_master_M');
+
+ #Check indent Process
+ $sql="select indent_process_id
+ from med_indent_process where indent_id=$indent_id";
+ $query = $this->db->query($sql);
+ $sql_result= $query->result();
+
+ $user_update_log='ADD By :'.$user_name_info;
+
+ if(count($sql_result)==0)
+ {
+ $Pdata = array(
+ 'store_accept_time' => date('d-m-Y H:i:s'),
+ 'store_accept_by' => $user_id,
+ 'store_accept_by_name' => $user_name_info,
+ 'indent_id' => $indent_id,
+ 'remark' => $user_update_log,
+ );
+
+ $process_indent_id=$this->product_master_M->insert_med_indent_process($Pdata);
+ }
+
+ $Udata = array(
+ 'indent_id'=> $indent_id,
+ 'product_id'=> $product_id,
+ 'product_name'=> $product_name,
+ 'request_qty'=> $add_qty,
+ 'datetime_before'=> date('Y-m-d H:i:s'),
+ 'insert_by'=> $user_id,
+ 'update_by'=> $user_id,
+ );
+
+ if($indent_item_id>0)
+ {
+ $this->product_master_M->update_med_indent_request_items($Udata,$indent_item_id);
+ }else{
+ $indent_item_id=$this->product_master_M->insert_med_indent_request_items($Udata);
+ }
+
+ $Pdata = array(
+ 'indent_id' => $indent_id,
+ 'indent_item_id' => $indent_item_id,
+ 'product_id' => $product_id,
+ 'qty' =>$add_qty,
+ 'ssno' => $inv_ssno,
+ );
+
+ $sql="select id
+ from med_indent_process_items
+ where indent_id=$indent_id and indent_item_id=$indent_item_id and ssno=$inv_ssno";
+ $query = $this->db->query($sql);
+ $sql_result= $query->result();
+
+ if(count($sql_result)>0)
+ {
+ $med_indent_process_items_id=$sql_result[0]->id;
+ $this->product_master_M->update_med_indent_process_items($Pdata,$med_indent_process_items_id);
+ }else{
+ $med_indent_process_items_id=$this->product_master_M->insert_med_indent_process_items($Pdata);
+ }
+
+ $show_text='Update Done';
+
+ $is_update_stock=1;
+
+ $rvar=array(
+ 'is_update_stock' =>$is_update_stock,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ else
+ {
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'is_update_stock' =>0,
+ 'show_text'=>Show_Alert('danger','Error',$send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Storestock.php b/old_code_ci3/controllers/Storestock.php
new file mode 100644
index 0000000..f110ed5
--- /dev/null
+++ b/old_code_ci3/controllers/Storestock.php
@@ -0,0 +1,2126 @@
+load->model('Stock_M');
+ $this->load->model('Master_M');
+
+ }
+
+ public function index()
+ {
+
+ $this->load->view('Storestock/Dashboard');
+ }
+
+ public function Indent_List()
+ {
+ $this->load->view('Storestock/Draft_indent');
+ }
+
+ //Product Master
+ public function Product_search()
+ {
+ $sdata=$this->input->post('txtsearch');
+
+ $sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if(trim($sdata)=='')
+ {
+ $sql="select * from med_store_product_master order by id desc limit 100";
+ }else{
+ $sql="select * from med_store_product_master
+ where (item_name LIKE '%".$sdata."%'
+ OR genericname LIKE '%".$sdata."%'
+ OR id = '".$sdata."')";
+ }
+
+ $query = $this->db->query($sql);
+ $data['product_list']= $query->result();
+
+ $this->load->view('Medical/Purchase/product_search_result',$data);
+ }
+
+ public function Product_edit($Product_id)
+ {
+ $sql="Select * from med_store_product_master where id=".$Product_id;
+ $query = $this->db->query($sql);
+ $data['product_data']= $query->result();
+
+ $sql="Select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation']= $query->result();
+
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $this->load->view('Medical/Purchase/product_edit',$data);
+ }
+
+ public function Product_delete($Product_id)
+ {
+ $sql="Select count(*) as no_rec from inv_med_item where item_code=".$Product_id;
+ $query = $this->db->query($sql);
+ $product_sale_data= $query->result();
+
+ $sql="Select count(*) as no_rec from purchase_invoice_item where item_code=".$Product_id;
+ $query = $this->db->query($sql);
+ $product_purchase_data= $query->result();
+
+ $is_delete_master=0;
+
+ $data_show="";
+
+ if($product_sale_data[0]->no_rec>0 || $product_purchase_data[0]->no_rec>0)
+ {
+ if($product_sale_data[0]->no_rec>0){
+ $data_show.="This Product in Sale Invoice, So cann't Delete
";
+ }
+
+ if($product_purchase_data[0]->no_rec>0){
+ $data_show.="This Product in Purchase Invoice, So cann't Delete
";
+ }
+
+ }else{
+
+ $this->load->model('product_master_M');
+ $is_delete_master=$this->product_master_M->delete_master($Product_id);
+
+ if($is_delete_master==0)
+ {
+ $data_show.="Some Error on Delete this product
";
+ }else{
+ $data_show.="Deleted
";
+ }
+
+ }
+
+ echo $data_show;
+
+
+ }
+
+ public function NewProduct()
+ {
+ $sql="Select * from med_company order by company_name";
+ $query = $this->db->query($sql);
+ $data['med_company']= $query->result();
+
+ $sql="Select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation']= $query->result();
+
+ $this->load->view('Medical/Purchase/product_new',$data);
+ }
+
+
+
+
+ //End Product Master
+
+ public function getIndentTable()
+ {
+ //Single Store Remove Store ID feild
+
+ $requestData= $_REQUEST;
+
+ $columns = array(
+ // datatable column index => database column name
+ 0 => 'indent_code',
+ 1 => 'issued_name',
+ 2=> 'indent_date_str',
+ 3=> 'id',
+ );
+
+ // getting total number records without any search
+ $sql_f_all = "SELECT m.id,m.indent_code,m.issued_name,m.indent_date,DATE_FORMAT(m.indent_date,'%d-%m-%Y') as indent_date_str ";
+
+ $sql_count="Select count(*) as no_rec ";
+
+ $sql_from=" from invoice_stock_master m";
+
+ //$total_sql=$sql_count.$sql_from;
+ $total_sql="Select count(*) as no_rec from invoice_stock_master m";
+
+ $query = $this->db->query($total_sql);
+ $data['total_rec']= $query->result();
+ $totalData=$data['total_rec'][0]->no_rec;
+
+ $totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+
+ $sql_where=" WHERE 1=1 ";
+
+ $sql_where_flag=0;
+
+ // getting records as per search parameters
+ if( !empty($requestData['columns'][0]['search']['value']) ){ //indent_code
+ $sql_where.=" AND indent_code LIKE '%".$requestData['columns'][0]['search']['value']."' ";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][1]['search']['value']) ){ //issued_name
+ $stext=$requestData['columns'][1]['search']['value'];
+ $sql_where.=" AND (issued_name LIKE '%".$stext."' )";
+ $sql_where_flag=1;
+ }
+
+ if( !empty($requestData['columns'][2]['search']['value']) ){ //indent_date
+ $stext=$requestData['columns'][2]['search']['value'];
+ $sql_where.=" AND (indent_date = '".$stext."' )";
+ $sql_where_flag=1;
+ }
+
+ $total_filer_sql=$sql_count.$sql_from.$sql_where;
+
+ $query = $this->db->query($total_filer_sql);
+ $data['total_rec_filter']= $query->result();// when there is a search parameter then we have to modify total number filtered rows as per search result.
+ $totalFiltered=$data['total_rec_filter'][0]->no_rec;
+
+ $sql_order=" ORDER BY id desc,". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+ $Result_sql=$sql_f_all.$sql_from.$sql_where.$sql_order;
+
+ $query = $this->db->query($Result_sql);
+ $rdata= $query->result_array();
+
+ //$totalFiltered=count($rdata);
+
+ $output = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => array(),
+ "sql" => $Result_sql
+ );
+
+ foreach($rdata as $aRow)
+ {
+ $row = array();
+
+ foreach($columns as $col)
+ {
+ $row[] = $aRow[$col];
+ }
+
+ $output['data'][] = $row;
+ }
+
+ echo json_encode($output); // send data as json format
+
+ }
+
+ public function new_indent()
+ {
+ $sql="select * from location_master ";
+ $query = $this->db->query($sql);
+ $data['location_master']= $query->result();
+
+ $sql="select * from employee_master ";
+ $query = $this->db->query($sql);
+ $data['employee_master']= $query->result();
+
+ $this->load->view('Storestock/new_indent',$data);
+ }
+
+ public function Indent_create($location_type)
+ {
+
+ $date_indent=$this->input->post('date_indent');
+ $loc_id=$this->input->post('loc_id');
+
+ $issued_name="";
+
+ if($location_type==1){
+ $sql="select * from location_master where l_id=$loc_id ";
+ $query = $this->db->query($sql);
+ $location_master= $query->result();
+
+ if(count($location_master)>0){
+ $issued_name=$location_master[0]->loc_name;
+ }
+
+ }elseif($location_type==2){
+ $sql="select * from employee_master where emp_id=$loc_id ";
+ $query = $this->db->query($sql);
+ $employee_master= $query->result();
+
+ if(count($employee_master)>0){
+ $issued_name=$employee_master[0]->emp_name.' ['.$employee_master[0]->emp_code.']';
+ }
+
+ }
+
+ $data['invoice_stock_master'] = array(
+ 'indent_date' => str_to_MysqlDate($date_indent),
+ 'location_type' => $location_type,
+ 'location_id' => $loc_id,
+ 'issued_name' => $issued_name,
+ );
+
+ $inser_id=$this->Stock_M->insert_indent($data['invoice_stock_master']);
+
+ redirect('Storestock/Indent_show/'.$inser_id);
+
+ }
+
+ public function Indent_show($indent_id)
+ {
+
+ $sql="select * from invoice_stock_master where id=$indent_id ";
+ $query = $this->db->query($sql);
+ $data['invoice_stock_master']= $query->result();
+
+ $sql="SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_stock_item i JOIN purchase_invoice_item_stock p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where indent_id=".$indent_id." GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['inv_stock_item']= $query->result();
+
+ $sql="select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,
+ sum(SGST) as TSGST
+ from inv_stock_item where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $data['content']=$this->load->view('Storestock/indent_item_list',$data,true);
+
+ $this->load->view('Storestock/indent_edit',$data);
+
+ }
+
+ public function Indent_Items_list($indent_id)
+ {
+ $sql="select * from inv_stock_item where indent_id=$indent_id Order by id";
+ $query = $this->db->query($sql);
+ $data['inv_stock_item']= $query->result();
+
+ $sql="select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,
+ sum(SGST) as TSGST
+ from inv_stock_item where indent_id=".$indent_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+
+ $content=$this->load->view('Storestock/indent_item_list',$data,true);
+
+ echo $content;
+ }
+
+
+ // Purchase Stock
+
+ public function Purchase()
+ {
+ $this->load->view('Storestock/Purchase/supplier_list');
+ }
+
+ public function PurchaseMasterEdit($inv_id)
+ {
+ $sql="select * from stock_supplier order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data']= $query->result();
+
+ $sql="select p.*,s.name_supplier from purchase_invoice_stock p join stock_supplier s on p.sid=s.sid where p.id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_data']= $query->result();
+
+ $sql="select * from purchase_invoice_item_stock where purchase_id='".$inv_id."' ";
+ $query = $this->db->query($sql);
+ $data['purchase_item']= $query->result();
+
+ $this->load->view('Storestock/Purchase/purchase_invoice_master_edit',$data);
+
+ }
+
+
+ public function UpdatePurchase()
+ {
+ $rec_id=$this->input->post('hid_purchaseid');
+ $sid=$this->input->post('input_supplier');
+ $invoice_code=$this->input->post('input_invoicecode');
+ $d_invoice=$this->input->post('datepicker_invoice');
+ $ischallan=$this->input->post('cbo_billtype');
+
+ $Udata = array(
+ 'sid'=> $sid,
+ 'date_of_invoice'=> str_to_MysqlDate($d_invoice),
+ 'Invoice_no'=> $invoice_code,
+ 'ischallan'=>$ischallan
+ );
+
+ $update_id=$this->Stock_M->update_purchase($Udata,$rec_id);
+
+ $rvar=array(
+ 'insertid' =>1,
+ 'show_text'=>'Data Update'
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function UpdatePurchaseInvoiceStatus($purchase_inv_id,$inv_status)
+ {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $Udata = array(
+ 'inv_status'=> $inv_status,
+ 'inv_status_update_by'=> $user_name_info,
+ );
+
+ $update_id=$this->Stock_M->update_purchase($Udata,$purchase_inv_id);
+
+ redirect('Storestock/PurchaseMasterEdit/'.$purchase_inv_id);
+
+ }
+
+ public function PurchaseNew()
+ {
+ $sql="select * from stock_supplier where active=1 order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data']= $query->result();
+
+ $this->load->view('Storestock/Purchase/new_purchase_invoice',$data);
+ }
+
+ public function SupplierList()
+ {
+ $sql="select * from stock_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data']= $query->result();
+
+ $this->load->view('Storestock/Purchase/supplier_master',$data);
+ }
+
+ public function PurchaseInvoice()
+ {
+ $sdata=trim($this->input->post('txtsearch'));
+
+ //$sdata = preg_replace('/[^A-Za-z0-9_ \-]/', '', $sdata);
+
+ if(trim($sdata)=='')
+ {
+ $sql="select p.id,p.Invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d-%m-%Y') as str_date_of_invoice,p.sid,s.name_supplier,
+ s.short_name,s.gst_no,
+ p.T_Net_Amount as tamount,p.ischallan
+ from (purchase_invoice_stock p join stock_supplier s on p.sid=s.sid)
+
+ group by p.id
+ order by p.id desc limit 50";
+ }else{
+
+ $numric_condition="";
+
+ if(is_numeric($sdata))
+ {
+ $numric_condition=" OR p.Invoice_no=".$sdata ;
+ }
+
+ $sql="select p.id,p.Invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d-%m-%Y') as str_date_of_invoice,
+ p.sid,s.name_supplier,s.short_name,s.gst_no,
+ p.T_Net_Amount as tamount,p.ischallan
+ from (purchase_invoice_stock p join stock_supplier s on p.sid=s.sid)
+ where (p.Invoice_no LIKE '%".$sdata."%' ".$numric_condition." )
+ group by p.id order by p.id desc limit 50";
+ }
+
+ $query = $this->db->query($sql);
+ $data['purchase_list']= $query->result();
+
+ $this->load->view('Storestock/Purchase/purchase_supp_list',$data);
+ }
+
+ public function purchase_invoice_item_list_old($item_code)
+ {
+ $sql="SELECT s.name_supplier, date_format(p.date_of_invoice,'%d-%m-%Y') as date_of_invoice_str,
+ i.Item_name,i.packing,i.purchase_price,i.qty,i.qty_free,i.mrp
+ FROM (purchase_invoice_stock p JOIN purchase_invoice_item_stock i ON p.id=i.purchase_id)
+ JOIN med_supplier s ON p.sid=s.sid
+ WHERE i.item_code=$item_code ORDER BY i.id DESC LIMIT 5 ";
+ $query = $this->db->query($sql);
+ $data['purchase_item_old']= $query->result();
+
+ $this->load->view('Storestock/Purchase/purchase_item_old',$data);
+
+ }
+
+ public function print_purchase($inv_id)
+ {
+ $sql="select * from stock_supplier order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data']= $query->result();
+
+ $sql="select p.*,s.name_supplier from purchase_invoice_stock p join stock_supplier s on p.sid=s.sid where p.id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_master_data']= $query->result();
+
+ $sql="select * from purchase_invoice_item_stock where purchase_id='".$inv_id."' ";
+ $query = $this->db->query($sql);
+ $data['purchase_item']= $query->result();
+
+ $content = $this->load->view('Storestock/Purchase/purchase_invoice_item_print', $data, true);
+
+ //load mPDF library
+
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(H_Name);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name='Return_Invoice-'.$inv_id."-".date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //echo $content;
+
+ $this->m_pdf->pdf->debug = true;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output("TEST.pdf","I");
+ }
+
+ public function PurchaseInvoiceEdit($inv_id)
+ {
+ $sql="select p.id,p.Invoice_no,p.date_of_invoice,date_format(p.date_of_invoice,'%d/%m/%Y') as str_date_of_invoice,
+ p.sid,s.name_supplier,s.short_name,s.gst_no,p.inv_status,p.ischallan
+ from purchase_invoice_stock p join stock_supplier s on p.sid=s.sid
+ where p.id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_invoice']= $query->result();
+
+ $sql="select * from purchase_invoice_item_stock where purchase_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['purchase_invoice_item']= $query->result();
+
+ $sql="select * from med_gst_per ";
+ $query = $this->db->query($sql);
+ $data['med_gst_per']= $query->result();
+
+ $this->load->view('Storestock/Purchase/purchase_invoice_edit',$data);
+ }
+
+ public function purchase_update_stock($inv_id,$return_stock=0)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $sql="select * from purchase_invoice_stock where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $purchase_invoice= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_product_code',
+ 'label' => 'Not Found in Database',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_drug_hid',
+ 'label' => 'Product Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_product_mrp',
+ 'label' => 'Product MRP',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_selling_price',
+ 'label' => 'Selling Price',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_Qty',
+ 'label' => 'Product Qty',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_package',
+ 'label' => 'Package',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_HSNCODE',
+ 'label' => 'HSNCODE',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_CGST',
+ 'label' => 'CGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_SGST',
+ 'label' => 'SGST',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ ),
+ array(
+ 'field' => 'input_purchase_price',
+ 'label' => 'Purchase Price',
+ 'rules' => 'required|min_length[1]|max_length[10]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $item_code=$this->input->post('input_product_code');
+ $item_id=$this->input->post('invoice_item_id');
+
+ $datepicker_doe_month=$this->input->post('datepicker_doe_month');
+ $datepicker_doe_year=$this->input->post('datepicker_doe_year');
+
+ $datepicker_doe="20".$datepicker_doe_year."-".$datepicker_doe_month."-01";
+
+ $this->load->model('Medical_M');
+
+ $Pdata = array(
+ 'purchase_id' => $inv_id,
+ 'item_code' => $item_code,
+ 'item_name' => $this->input->post('input_drug_hid'),
+ 'packing' => $this->input->post('input_package'),
+ 'batch_no' => $this->input->post('input_batch_code'),
+ 'purchase_price' => $this->input->post('input_purchase_price'),
+ 'expiry_date' => $datepicker_doe,
+ 'mrp' => $this->input->post('input_product_mrp'),
+
+ 'qty' => $this->input->post('input_Qty'),
+ 'qty_free' => $this->input->post('input_Qty_Free'),
+
+ 'discount' => $this->input->post('input_disc_price'),
+
+ 'CGST_per' => $this->input->post('input_CGST'),
+ 'SGST_per' => $this->input->post('input_SGST'),
+
+ 'HSNCODE' => $this->input->post('input_HSNCODE'),
+
+ 'cold_storage' => $this->input->post('input_storage'),
+ 'shelf_no' => $this->input->post('input_shelf_no'),
+ 'rack_no' => $this->input->post('input_rack_no'),
+ 'stock_date' => $purchase_invoice[0]->date_of_invoice,
+
+ 'selling_price' => $this->input->post('input_selling_price'),
+
+ 'sch_disc_amt' => $this->input->post('input_sch_amount'),
+ 'sch_disc_per' => $this->input->post('input_sch_disc'),
+
+ 'insert_by' => $user_name_info,
+
+ 'item_return' => $return_stock
+ );
+
+ $show_text='';
+
+ $is_update_stock=0;
+
+ $send_msg="";
+
+ if($item_id<1)
+ {
+ $is_update_stock=$this->Stock_M->insert_purchase_item($Pdata);
+ $send_msg="Added";
+ }else{
+ $sql="select * from purchase_invoice_item_stock where id='$item_id' ";
+ $query = $this->db->query($sql);
+ $drug_item= $query->result();
+
+ if(count($drug_item)>0){
+ $tot_sale_qty=$drug_item[0]->total_sale_unit;
+
+ $qty = $this->input->post('input_Qty');
+ $qty_free= $this->input->post('input_Qty_Free');
+
+ $packing=$this->input->post('input_package');
+
+ $tot_qty=($qty+$qty_free)*$packing;
+
+ if($tot_sale_qty<=$tot_qty)
+ {
+ $is_update_stock=$this->Stock_M->update_purchase_item($Pdata,$item_id);
+ if($is_update_stock>0)
+ {
+ $send_msg="Updated";
+ }else{
+ $send_msg="Error : Update in Stock Table";
+ }
+ }else{
+ $send_msg="Error : Update Qty is Less then saled Qty :".$tot_qty." / Saled :".$tot_sale_qty;
+
+ //Update While Qty in Minus
+
+ $is_update_stock=$this->Stock_M->update_purchase_item($Pdata,$item_id);
+ if($is_update_stock>0)
+ {
+ $send_msg="Updated : But Error : Update Qty is Less then saled Qty :".$tot_qty." / Saled :".$tot_sale_qty;
+ }else{
+ $send_msg="Error : Update in Stock Table";
+ }
+
+ }
+
+ }else{
+ $send_msg="Error : Record Not Found in Stock Table";
+ }
+ }
+
+ $rvar=array(
+ 'is_update_stock' =>$is_update_stock,
+ 'product_code' => $item_code,
+ 'show_text'=>$send_msg
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else
+ {
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'is_update_stock' =>0,
+ 'show_text'=>$send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function purchase_invoice_item_list($inv_id)
+ {
+ $sql="select *,date_format(expiry_date,'%m/%y') as exp_date_str from purchase_invoice_item_stock where purchase_id='".$inv_id."' ";
+ $query = $this->db->query($sql);
+ $data['purchase_item']= $query->result();
+
+ $sql="select * from purchase_invoice_stock where id='".$inv_id."' ";
+ $query = $this->db->query($sql);
+ $data['purchase_invoice']= $query->result();
+
+
+ $this->load->view('Storestock/Purchase/purchase_invoice_item',$data);
+
+ }
+
+ function purchase_invoice_item_edit($inv_id,$inv_item_id)
+ {
+ $sql="select *,
+ date_format(expiry_date,'%m') as str_expiry_month ,
+ date_format(expiry_date,'%y') as str_expiry_year
+ from purchase_invoice_item_stock where id=".$inv_item_id." and purchase_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $purchase_invoice_item= $query->result();
+
+ if(count($purchase_invoice_item)>0)
+ {
+ $rvar=array(
+ 'is_update_stock'=>'1',
+ 'item_id' =>$purchase_invoice_item[0]->id,
+ 'product_code' =>$purchase_invoice_item[0]->item_code,
+ 'product_mrp' => $purchase_invoice_item[0]->mrp,
+ 'selling_price'=>$purchase_invoice_item[0]->selling_price,
+ 'batch_code'=>$purchase_invoice_item[0]->batch_no,
+ 'disc_price'=>$purchase_invoice_item[0]->discount,
+ 'qty'=>$purchase_invoice_item[0]->qty,
+ 'qty_free'=>$purchase_invoice_item[0]->qty_free,
+ 'package'=>$purchase_invoice_item[0]->packing,
+ 'purchase_price'=>$purchase_invoice_item[0]->purchase_price,
+ 'datepicker_doe_month'=>$purchase_invoice_item[0]->str_expiry_month,
+ 'datepicker_doe_year'=>$purchase_invoice_item[0]->str_expiry_year,
+ 'drug'=>$purchase_invoice_item[0]->Item_name,
+
+ 'sch_disc_amt'=>$purchase_invoice_item[0]->sch_disc_amt,
+ 'sch_disc_per'=>$purchase_invoice_item[0]->sch_disc_per,
+
+ 'HSNCODE'=>$purchase_invoice_item[0]->HSNCODE,
+ 'CGST_per'=>$purchase_invoice_item[0]->CGST_per,
+ 'SGST_per'=>$purchase_invoice_item[0]->SGST_per,
+
+ 'cold_storage'=>$purchase_invoice_item[0]->cold_storage,
+ 'shelf_no'=>$purchase_invoice_item[0]->shelf_no,
+ 'rack_no'=>$purchase_invoice_item[0]->rack_no,
+
+ );
+ }else{
+ $rvar=array(
+ 'is_update_stock'=>'0',
+ 'show_text'=>$sql
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function add_item($type,$req=0)
+ {
+
+ $inser_id=1;
+ $Error_Show='';
+ $exist=0;
+ $input_id=0;
+
+ $store_stock_id=$this->input->post('l_ssno');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name_info = $user->first_name.''. $user->last_name .'['.$user_id.']'.date('d-m-Y H:i:s');
+
+ if($type==1)
+ {
+ $inv_id=$this->input->post('inv_id');
+ $qty=$this->input->post('qty');
+ $disc=$this->input->post('disc');
+ $product_unit_rate=$this->input->post('product_unit_rate');
+
+ $sql="SELECT p.item_name as item_name,t.batch_no,t.expiry_date,
+ (t.total_unit-t.total_sale_unit) AS S_qty,
+ t.mrp,t.selling_unit_rate,p.id AS master_product_id,
+ t.id as purchase_item_id,p.formulation,
+ t.HSNCODE,t.CGST_per,t.SGST_per,t.packing
+ FROM med_store_product_master p
+ JOIN purchase_invoice_item_stock t ON p.id=t.item_code
+ where t.id= ".$store_stock_id;
+ $query = $this->db->query($sql);
+ $data['itemlist']= $query->result();
+
+ $sql="select * from inv_stock_item where indent_id=".$inv_id."
+ and store_stock_id=".$store_stock_id;
+ $query = $this->db->query($sql);
+ $itemExist= $query->result();
+
+ $CGST=$data['itemlist'][0]->CGST_per;
+ $SGST=$data['itemlist'][0]->SGST_per;
+
+ //$item_rate=$data['itemlist'][0]->unit_rate;
+ $item_rate=$product_unit_rate;
+
+ $amount_value=$qty*$item_rate;
+
+ $disc_amount=$amount_value*$disc/100;
+
+ $Tamount_value=$amount_value-$disc_amount;
+
+ $HSNCODE=$data['itemlist'][0]->HSNCODE;
+
+ $stock_qty=$data['itemlist'][0]->S_qty;
+
+ if($qty>$stock_qty)
+ {
+ $inser_id=0;
+ $Error_Show='Stock Qty. is less than Required Qty : Current Qty :'.$stock_qty;
+ }elseif($stock_qty==0){
+ $stock_qty=0;
+ $inser_id=0;
+ $Error_Show='Stock is Empty';
+ }
+
+ if($inser_id>0)
+ {
+ $data['insert_inv_med_item'] = array(
+ 'indent_id' => $inv_id,
+ 'item_code' => $data['itemlist'][0]->master_product_id,
+ 'item_Name' => $data['itemlist'][0]->item_name,
+ 'formulation' => $data['itemlist'][0]->formulation,
+ 'qty' => $qty,
+ 'batch_no' => $data['itemlist'][0]->batch_no,
+ 'expiry' => $data['itemlist'][0]->expiry_date,
+ 'price' => $item_rate,
+ 'price2' => $item_rate,
+ 'mrp' => $data['itemlist'][0]->mrp,
+ 'disc_per' => $disc,
+ 'disc_amount' => $disc_amount,
+ 'amount' => $amount_value,
+ 'tamount' => $Tamount_value,
+ 'CGST_per'=> $CGST,
+ 'SGST_per'=> $SGST,
+ 'HSNCODE'=> $HSNCODE,
+ 'store_stock_id'=>$data['itemlist'][0]->purchase_item_id,
+ 'update_by_id'=>$user_id,
+ 'update_by_remark'=>$user_name_info,
+ 'packing'=>$data['itemlist'][0]->packing,
+ );
+
+ if(count($itemExist)>0)
+ {
+ $Error_Show='Please Check Also Same Item List';
+ $exist=count($itemExist);
+ $input_id=$itemExist[0]->id;
+ $input_id=0;
+ }
+
+ $inser_id=$this->Stock_M->add_indentitem( $data['insert_inv_med_item']);
+ }
+ }
+ else if($type==2)
+ {
+ $update_qty=$this->input->post('u_qty');
+ $itemid=$this->input->post('itemid');
+
+ $sql="select * from inv_stock_item where id=".$itemid;
+ $query = $this->db->query($sql);
+ $data['inv_med_item']= $query->result();
+
+ $CGST=$data['inv_med_item'][0]->CGST_per;
+ $SGST=$data['inv_med_item'][0]->SGST_per;
+ $disc=$data['inv_med_item'][0]->disc_per;
+
+ $inv_id=$data['inv_med_item'][0]->indent_id;
+
+ $store_stock_id=$data['inv_med_item'][0]->store_stock_id;
+
+ $sql="SELECT p.item_name,t.batch_no,t.expiry_date,
+ (t.total_unit-t.total_sale_unit) AS S_qty,
+ t.mrp,t.selling_unit_rate,p.id AS master_product_id,
+ t.id as purchase_item_id,p.formulation,
+ t.HSNCODE,t.CGST_per,t.SGST_per,t.packing
+ FROM med_store_product_master p
+ JOIN purchase_invoice_item_stock t ON p.id=t.item_code
+ where t.id= ".$store_stock_id;
+
+ $query = $this->db->query($sql);
+ $item_master= $query->result();
+
+ $stock_qty=0;
+
+ $old_qty=$data['inv_med_item'][0]->qty;
+ $diff_qty=$update_qty-$old_qty;
+
+ if($diff_qty>0)
+ {
+ if(count($item_master)>0)
+ {
+ $stock_qty=$item_master[0]->S_qty;
+ if($diff_qty>$stock_qty)
+ {
+ $inser_id=0;
+ $Error_Show='Stock Qty. is less than Required Qty : Current Qty :'.$stock_qty;
+ }
+ }else{
+ $stock_qty=0;
+ $inser_id=0;
+ $Error_Show='Stock is Empty';
+ }
+ }
+
+ if($inser_id>0)
+ {
+ $item_rate=$data['inv_med_item'][0]->price;
+ $amount_value=$update_qty*$item_rate;
+
+ $disc_amount=$amount_value*$disc/100;
+
+ $Tamount_value=$amount_value-$disc_amount;
+
+ $data['update_inv_med_item'] = array(
+ 'qty' => $update_qty,
+ 'disc_amount' => $disc_amount,
+ 'amount' => $amount_value,
+ 'tamount' => $Tamount_value,
+ 'store_stock_id'=>$store_stock_id,
+ 'packing'=>$data['inv_med_item'][0]->packing,
+ 'indent_id' => $inv_id,
+ );
+
+ $this->Stock_M->update_indentitem($data['update_inv_med_item'],$itemid);
+ $inser_id=$itemid;
+
+ }
+
+ //$this->Medical_M->update_invoice_group($inv_id);
+ //$this->Medical_M->update_invoice_final($inv_id);
+
+ }else{
+ $itemid=$this->input->post('itemid');
+
+ $sql="select * from inv_stock_item where id=".$itemid;
+ $query = $this->db->query($sql);
+ $inv_items= $query->row_array();
+
+ $inv_id=$inv_items['indent_id'];
+
+ $this->Stock_M->delete_indentitem($itemid,$inv_items);
+
+ }
+
+ $content='';
+
+ if($inser_id>0)
+ {
+ //$this->Medical_M->update_invoice_final($inv_id);
+
+ $sql="SELECT i.*,ifnull(DATEDIFF(expiry,CURDATE()),1000) AS no_day,
+ SUM(p.total_unit-p.total_sale_unit-total_return_unit-total_lost_unit)/p.packing AS cur_qty
+ FROM (inv_stock_item i JOIN purchase_invoice_item_stock p ON i.item_code=p.item_code AND p.remove_item=0 )
+ where indent_id=".$inv_id." GROUP BY i.id";
+ $query = $this->db->query($sql);
+ $data['inv_stock_item']= $query->result();
+
+ $sql="select item_code
+ from inv_stock_item where indent_id=".$inv_id." Group by item_code Having count(id)>1";
+ $query = $this->db->query($sql);
+ $data['inv_items_multiple']= $query->result();
+
+ $sql="select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,
+ sum(disc_amount) as t_dis_amt from inv_stock_item where indent_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+ $sql="select * from invoice_stock_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceMaster']= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $data['user_id'] = $user->id;
+
+ $data['sale_return']=$data['invoiceMaster'][0]->sale_return;
+
+ $content=$this->load->view('Storestock/indent_item_list',$data,true);
+ //$content='';
+ }
+
+ $rvar=array(
+ 'exist' =>$exist,
+ 'insertid' =>$inser_id,
+ 'content'=>$content,
+ 'error'=>$Error_Show,
+ 'input_id'=>$input_id,
+ 'csrf_dst_name_value'=>$this->security->get_csrf_hash()
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ public function purchase_invoice_item_delete($inv_id,$inv_item_del)
+ {
+
+ $sql="select * from purchase_invoice_item_stock where id='$inv_item_del' ";
+ $query = $this->db->query($sql);
+ $drug_item= $query->result();
+
+ if(count($drug_item)>0){
+ $sale_qty=$drug_item[0]->total_sale_unit;
+
+ if($sale_qty>0)
+ {
+ $rvar=array(
+ 'is_update_stock' =>0,
+ 'show_text'=>'Sold some Quantity of this Item',
+ );
+
+ }else{
+ $is_update_stock=$this->Stock_M->delete_purchase_item($inv_id,$inv_item_del);
+ $rvar=array(
+ 'is_update_stock' =>1,
+ 'show_text'=>'Removed Successfully',
+ );
+ }
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+
+ public function final_invoice($inv_id)
+ {
+
+ $this->Stock_M->update_invoice_final($inv_id);
+
+ $sql="select *,(discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST from invoice_stock_master where id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['invoice_stock_master']= $query->result();
+
+ $sql="select * from inv_stock_item where indent_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select sum(amount) as Gtotal,sum(tamount) as tamt,sum(CGST) as TCGST,sum(SGST) as TSGST,
+ sum(disc_amount) as t_dis_amt from inv_stock_item where indent_id=".$inv_id;
+ $query = $this->db->query($sql);
+ $data['invoiceGtotal']= $query->result();
+
+
+ $this->load->view('Storestock/Store_Final_Invoice',$data);
+ }
+
+
+
+ public function get_drug(){
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="SELECT p.item_name as item_name,p.formulation,t.batch_no,t.expiry_date as expiry_date_str,t.expiry_date,
+ (t.total_unit-t.total_sale_unit-total_lost_unit-t.total_return_unit) AS c_qty,
+ t.id,t.mrp,t.selling_unit_rate,p.id AS item_code,t.packing
+ FROM med_store_product_master p
+ JOIN purchase_invoice_item_stock t ON p.id=t.item_code
+ and (t.total_unit-t.total_sale_unit-t.total_lost_unit-t.total_return_unit)>0
+ and (expiry_date>date_add(sysdate(),interval 1 day) or p.exp_date_applicable=0)
+ and t.remove_item=0 and t.item_return=0
+ where (p.item_name like '".$q."%' ";
+
+ if(strlen($q)>5)
+ {
+ $sql=$sql. " or p.item_name SOUNDS LIKE '".$q."'";
+ }
+
+ $sql=$sql.") order by p.item_name,id limit 100";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['item_name'].' '.$row['formulation'])).' |B:'.htmlentities(stripslashes($row['batch_no'])). ' |Pak:'.htmlentities(stripslashes($row['packing'])).' |Rs.'.htmlentities(stripslashes($row['mrp'])).' |Qty:'.htmlentities(stripslashes($row['c_qty']));
+ $new_row['value']=htmlentities(stripslashes($row['item_name']));
+ $new_row['l_item_code']=htmlentities(stripslashes($row['item_code']));
+ $new_row['l_ss_no']=htmlentities(stripslashes($row['id']));
+ $new_row['l_Batch']=htmlentities(stripslashes($row['batch_no']));
+ $new_row['l_Expiry']=htmlentities(stripslashes($row['expiry_date_str']));
+ $new_row['l_mrp']=htmlentities(stripslashes($row['mrp']));
+ $new_row['l_unit_rate']=htmlentities(stripslashes($row['selling_unit_rate']));
+ $new_row['l_c_qty']=htmlentities(stripslashes($row['c_qty']));
+ $new_row['l_packing']=htmlentities(stripslashes($row['packing']));
+ //$new_row['sql']=$sql;
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }else{
+ $new_row['sql']=$sql;
+ $row_set[] = $new_row;
+ echo json_encode($row_set);
+ }
+ }
+ }
+
+ public function get_drug_master(){
+
+ if (isset($_GET['term'])){
+ $q = strtolower($_GET['term']);
+
+ $sql="SELECT m.* ,p.id as ss_no,m.packing as p_packing,p.mrp,p.purchase_price,p.discount,
+ p.batch_no,date_format(expiry_date,'%m') as str_expiry_month ,
+ date_format(expiry_date,'%y') as str_expiry_year ,
+ m.batch_applicable,m.exp_date_applicable,
+ if(p.id is null,m.CGST_per,p.CGST_per) as p_CGST_per,
+ if(p.id is null,m.SGST_per,p.SGST_per) as p_SGST_per,
+ if(p.id is null,m.rack_no,p.rack_no) as p_rack_no,
+ if(p.id is null,m.shelf_no,p.shelf_no) as p_shelf_no,
+ if(p.id is null,m.cold_storage,p.cold_storage) as p_cold_storage
+
+ FROM med_store_product_master m
+ LEFT JOIN (SELECT * from purchase_invoice_item_stock
+ WHERE id in (select max(id) from purchase_invoice_item_stock
+ WHERE Item_name LIKE '".$q."%'
+ group BY item_code ) ) as p ON m.id=p.item_code
+ WHERE m.is_continue=1 and m.Item_name LIKE '".$q."%'
+ order BY m.item_name ";
+
+ $sql=$sql." limit 20";
+
+ $query = $this->db->query($sql);
+
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['item_name'])).' | '.htmlentities(stripslashes($row['p_packing'])).' | '.htmlentities(stripslashes($row['mrp']));
+ $new_row['value']=htmlentities(stripslashes($row['item_name']));
+ $new_row['l_item_code']=htmlentities(stripslashes($row['id']));
+ $new_row['l_mrp']=htmlentities(stripslashes($row['mrp']));
+
+ $new_row['l_packing']=htmlentities(stripslashes($row['packing']));
+ $new_row['l_CGST_per']=htmlentities(stripslashes($row['p_CGST_per']));
+ $new_row['l_SGST_per']=htmlentities(stripslashes($row['p_SGST_per']));
+ $new_row['l_HSNCODE']=htmlentities(stripslashes($row['HSNCODE']));
+
+ $new_row['l_batch_no']=htmlentities(stripslashes($row['batch_no']));
+
+ $new_row['l_purchase_price']=htmlentities(stripslashes($row['purchase_price']));
+
+ $new_row['l_package']=htmlentities(stripslashes($row['p_packing']));
+ $new_row['l_disc_price']=htmlentities(stripslashes($row['discount']));
+
+ $new_row['l_rack_no']=htmlentities(stripslashes($row['p_rack_no']));
+ $new_row['l_shelf_no']=htmlentities(stripslashes($row['p_shelf_no']));
+ $new_row['l_cold_storage']=htmlentities(stripslashes($row['p_cold_storage']));
+
+ $new_row['batch_applicable']=htmlentities(stripslashes($row['batch_applicable']));
+ $new_row['exp_date_applicable']=htmlentities(stripslashes($row['exp_date_applicable']));
+
+ $new_row['datepicker_doe_month']=htmlentities(stripslashes($row['str_expiry_month']));
+ $new_row['datepicker_doe_year']=htmlentities(stripslashes($row['str_expiry_year']));
+
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }else{
+ $row_set[] = array();
+ echo json_encode($row_set);
+ }
+ }
+ }
+
+ public function challan_invoice($supplier_id)
+ {
+ $sql="SELECT p.id,t.id AS ss_no,p.Invoice_no,p.date_of_invoice,
+ date_format(p.date_of_invoice,'%d-%m-%Y') as str_date_of_invoice,p.sid,s.name_supplier,
+ s.short_name,s.gst_no,
+ p.T_Net_Amount as tamount,p.ischallan,
+ t.Item_name,t.qty,t.qty_free,t.mrp
+ FROM (purchase_invoice_stock p join stock_supplier s on p.sid=s.sid)
+ JOIN purchase_invoice_item_stock t ON p.id=t.purchase_id
+ where p.sid=$supplier_id and p.ischallan=1
+ group by p.id,t.id ";
+
+ $query = $this->db->query($sql);
+ $data['purchase_challan_item']= $query->result();
+
+ $this->load->view('Storestock/Purchase/purchase_challan_list',$data);
+ }
+
+ public function challan_item_to_purchase($ss_no,$purchase_id)
+ {
+ $sql="select * from purchase_invoice_item_stock where id=$ss_no";
+ $query = $this->db->query($sql);
+ $purchase_invoice_item= $query->result();
+
+ if(count($purchase_invoice_item)>0)
+ {
+ $old_purchase_id=$purchase_invoice_item[0]->purchase_id;
+
+ $Pdata = array(
+ 'purchase_id' => $purchase_id,
+ 'old_purchase_id' => $old_purchase_id,
+ );
+
+ $is_update_stock=$this->Stock_M->update_purchase_item($Pdata,$ss_no);
+ //$this->db->query("CALL p_purchase_invoice(".$old_purchase_id.")");
+
+ $rvar=array(
+ 'is_transfer' =>$is_update_stock,
+ 'show_text'=>"Item Addedd Successfully",
+ );
+
+ }else{
+ $rvar=array(
+ 'is_transfer' =>0,
+ 'show_text'=>"Item Not Found ",
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function challan_item_return($ss_no)
+ {
+ $sql="select * from purchase_invoice_item_stock where old_purchase_id>0 and id=$ss_no";
+ $query = $this->db->query($sql);
+ $purchase_invoice_item= $query->result();
+
+ if(count($purchase_invoice_item)>0)
+ {
+ $old_challan_id=$purchase_invoice_item[0]->old_purchase_id;
+ $current_pur_id=$purchase_invoice_item[0]->purchase_id;
+
+ $sql="select * from purchase_invoice_stock where id=$old_challan_id";
+ $query = $this->db->query($sql);
+ $challan_invoice= $query->result();
+
+ if(count($challan_invoice)>0)
+ {
+ $Pdata = array(
+ 'purchase_id' => $old_challan_id,
+ 'old_purchase_id' => 0,
+ );
+
+
+ $is_update_stock=$this->Stock_M->update_purchase_item($Pdata,$ss_no);
+ //$this->db->query("CALL p_purchase_invoice(".$current_pur_id.")");
+
+ $rvar=array(
+ 'is_transfer' =>$is_update_stock,
+ 'show_text'=>"Item Addedd Successfully",
+ );
+ }else{
+
+ $Pdata = array(
+ 'purchase_id' => $old_challan_id,
+ 'old_purchase_id' => 0,
+ );
+
+
+ $is_update_stock=$this->Stock_M->update_purchase_item($Pdata,$ss_no);
+
+
+ $rvar=array(
+ 'is_transfer' =>0,
+ 'show_text'=>"Challan Not Found ",
+ );
+ }
+
+
+ }else{
+ $rvar=array(
+ 'is_transfer' =>0,
+ 'show_text'=>"Item Not Found ",
+ );
+ }
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+
+ public function purchase_invoice_delete($inv_id)
+ {
+
+ $sql="select * from purchase_invoice_item_stock where purchase_id=$inv_id";
+ $query = $this->db->query($sql);
+ $purchase_invoice_item= $query->result();
+
+ if (count($purchase_invoice_item)>0){
+ $rvar=array(
+ 'is_delete' =>0,
+ 'show_text'=>"Invoice has Items, Empty the item list",
+ );
+ }else{
+
+ $is_delete=$this->Stock_M->delete_purchase($inv_id);
+ $rvar=array(
+ 'is_delete' =>1,
+ 'show_text'=>"Invoice has been deleted",
+ );
+ }
+
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+ public function SupplierListSub()
+ {
+ $sql="select * from stock_supplier order by name_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data']= $query->result();
+
+ $this->load->view('Storestock/Purchase/supplier_master_sub',$data);
+ }
+
+ public function SupplierEdit($sid=0)
+ {
+ $sql="select * from stock_supplier where sid=".$sid;
+ $query = $this->db->query($sql);
+ $data['supplier_data']= $query->result();
+
+ $sql="select * from india_state ";
+ $query = $this->db->query($sql);
+ $data['india_state']= $query->result();
+
+ $this->load->view('Storestock/Purchase/supplier_Edit',$data);
+ }
+
+ public function CreatePurchase()
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_invoicecode',
+ 'label' => 'Invoice No',
+ 'rules' => 'required|min_length[3]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $sid=$this->input->post('input_supplier');
+ $invoice_code=$this->input->post('input_invoicecode');
+ $d_invoice=$this->input->post('datepicker_invoice');
+ $ischallan=$this->input->post('cbo_billtype');
+
+ $where=" where sid=$sid";
+
+ if(is_numeric($invoice_code))
+ $where.=" and Invoice_no=".$invoice_code ;
+ else
+ $where.=" and Invoice_no='".$invoice_code."'";
+
+ $sql="select count(*) as no_rec from purchase_invoice ".$where;
+ $query = $this->db->query($sql);
+ $chk_rec= $query->result();
+
+ if($chk_rec[0]->no_rec==0)
+ {
+ $Udata = array(
+ 'sid'=> $sid,
+ 'date_of_invoice'=> str_to_MysqlDate($d_invoice),
+ 'Invoice_no'=> $invoice_code,
+ 'ischallan'=>$ischallan
+ );
+
+ $inser_id=$this->Stock_M->insert_purchase($Udata);
+ $send_msg="Added Successfully";
+
+ if($inser_id>0)
+ {
+ $show_text=$send_msg;
+ }else{
+ $show_text=$send_msg;
+ }
+ }else{
+ $show_text='Record Already Exist';
+ $inser_id=0;
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else{
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'show_text'=>$send_msg
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function SupplierUpdate($sid=0)
+ {
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'input_name_supplier',
+ 'label' => 'Supplier Name',
+ 'rules' => 'required|min_length[3]|max_length[100]'
+ ),
+ array(
+ 'field' => 'input_short_name',
+ 'label' => 'Short Name',
+ 'rules' => 'required|min_length[1]|max_length[30]'
+ ),
+ array(
+ 'field' => 'input_gst_no',
+ 'label' => 'GST No.',
+ 'rules' => 'required|min_length[5]|max_length[15]'
+ ),
+ array(
+ 'field' => 'input_state',
+ 'label' => 'State',
+ 'rules' => 'required|min_length[1]|max_length[20]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ $sid=$this->input->post('hid_sid');
+ $name_supplier=$this->input->post('input_name_supplier');
+ $short_name=$this->input->post('input_short_name');
+ $contact_no=$this->input->post('input_contact_no');
+ $gst_no=$this->input->post('input_gst_no');
+ $city=$this->input->post('input_city');
+ $state=$this->input->post('input_state');
+
+ $Udata = array(
+ 'name_supplier'=> $name_supplier,
+ 'short_name'=> $short_name,
+ 'contact_no'=> $contact_no,
+ 'gst_no'=> $gst_no,
+ 'city'=> $city,
+ 'state'=> $state
+ );
+
+
+ if($sid>0)
+ {
+ $inser_id=$this->Stock_M->update_supplier($Udata,$sid);
+ $send_msg="Saved Successfully";
+ }else{
+ $inser_id=$this->Stock_M->insert_supplier($Udata);
+ $send_msg="Added Successfully";
+ }
+
+ if($inser_id>0)
+ {
+ $show_text=Show_Alert('success','Success',$send_msg);
+ }else{
+ $show_text=Show_Alert('danger','Error',$send_msg);
+ }
+
+ $rvar=array(
+ 'insertid' =>$inser_id,
+ 'show_text'=>$show_text
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+ else{
+ $send_msg=validation_errors();
+ $rvar=array(
+ 'insertid' =>0,
+ 'show_text'=>Show_Alert('danger','Error',$send_msg)
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+
+ }
+
+ public function StockDrugList()
+ {
+ $this->load->view('Storestock/Medical_stock_drug');
+ }
+
+ // Store Main
+ public function main_store()
+ {
+ $this->load->view('Storestock/Stock/main_store_dashboard');
+ }
+
+
+ // Location Master
+ public function location_master_list()
+ {
+ $sql="select * from location_master order by loc_name ";
+ $query = $this->db->query($sql);
+ $data['location_master']= $query->result();
+
+ $this->load->view('Storestock/Stock/location_master_list',$data);
+ }
+
+ function Location_add()
+ {
+ $this->load->view('MasterData/location_master_add');
+ }
+
+ function Location_edit($l_id)
+ {
+ $sql="select * from location_master where l_id= $l_id";
+ $query = $this->db->query($sql);
+ $data['location_master']= $query->result();
+
+ $this->load->view('MasterData/location_master_edit',$data);
+ }
+
+ function Location_save()
+ {
+ $input_loc_name = $this->input->post('input_loc_name');
+ $input_loc_desc = $this->input->post('input_loc_desc');
+ $hid_l_id = $this->input->post('hid_location_id');
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.' ['.$user_id.']';
+
+ $insert_data=array(
+ 'loc_name'=>$input_loc_name,
+ 'loc_desc'=>$input_loc_desc,
+ 'loc_add_by'=>$user_name.' : '.date('Y-m-d H:i:s'),
+ );
+
+ if($hid_l_id==0){
+ $inser_id=$this->Master_M->insert_location_master($insert_data);
+ }else{
+ $inser_id=$this->Master_M->update_location_master($insert_data,$hid_l_id);
+ }
+
+ echo $inser_id;
+ }
+
+
+
+ // Print Indent
+
+ public function print_single_indent($inv_id,$print_format=0)
+ {
+ //$cash 0 for Cash Only,1 for Credit only,2 Package Credit only,3 for All
+
+ $this->Stock_M->update_invoice_final($inv_id);
+
+ $sql="select i.indent_id,i.id,i.item_Name,i.formulation,
+ i.batch_no,Date_Format(i.expiry,'%m-%y')as expiry,
+ i.price,i.qty,(i.amount) as amount,i.HSNCODE,
+ m.indent_code,m.id as m_id,
+ date_format(m.indent_date,'%d-%m-%Y') as str_inv_date,
+ (twdisc_amount) as twdisc_amount,
+ (i.disc_amount+i.disc_whole) as d_amt,
+ (i.CGST+i.SGST) as gst,
+ (i.CGST_per+i.SGST_per) as gst_per ,i.sale_return
+ from inv_stock_item i join invoice_stock_master m
+ on i.indent_id=m.id
+ where m.id=$inv_id order by i.sale_return,id";
+ $query = $this->db->query($sql);
+ $data['inv_items']= $query->result();
+
+ $sql="select *,
+ date_format(indent_date,'%d-%m-%Y') as str_inv_date,
+ (discount_amount+item_discount_amount) as inv_disc_total,
+ (CGST_Tamount+SGST_Tamount) as TGST
+ from invoice_stock_master
+ where id=$inv_id";
+ $query = $this->db->query($sql);
+ $data['invoice_stock_master']= $query->result();
+
+
+ //load mPDF library
+ $this->load->library('m_pdf');
+
+ //$this->m_pdf->pdf->SetProtection(array(), '1234567', '277395');
+
+ $this->m_pdf->pdf->SetWatermarkText(M_store);
+ $this->m_pdf->pdf->showWatermarkText = false;
+
+ $file_name='Report-MedicalBill_'.$inv_id.'_'.date('Ymdhis').".pdf";
+
+ $filepath=$file_name;
+
+ //$this->load->view('Medical/medical_bill_print_format',$data);
+
+ $content=$this->load->view('Storestock/Store_Print',$data,TRUE);
+ //echo $content;
+
+ //generate the PDF from the given html
+ $this->m_pdf->pdf->WriteHTML($content);
+
+ //download it.
+ $this->m_pdf->pdf->Output($filepath,"I");
+
+ }
+
+ // Store Stock
+
+ public function store_stock()
+ {
+ $sql="select * from stock_supplier";
+ $query = $this->db->query($sql);
+ $data['supplier_data']= $query->result();
+
+ $sql = "select * from med_formulation order by formulation_length";
+ $query = $this->db->query($sql);
+ $data['med_formulation'] = $query->result();
+
+ $this->load->view('Storestock/store_stock_search', $data);
+ }
+
+ public function store_Stock_result()
+ {
+ $supplier_id = $this->input->post('input_supplier');
+ $item_name = $this->input->post('txtsearch');
+ $store_id = $this->input->post('input_store_id');
+ $chk_reorder = $this->input->post('chk_reorder');
+
+ $HAVING = "";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING SUM(s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)<=p.re_order_qty";
+ }
+
+ $where = " remove_item=0 ";
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid = " . $supplier_id;
+ }
+
+
+ if ($item_name <> '') {
+ $where .= " and p.Item_name like '%" . $item_name . "%' ";
+ }
+
+ $sql = "SELECT i.Item_name,i.item_code ,sum(distinct i.tqty),
+ pm.re_order_qty,
+ sum(i.total_unit) as T_unit,
+ sum(if(ss.sale_qty is NULL,0,ss.sale_qty)) sal_qty,
+ GROUP_CONCAT(distinct s.name_supplier) AS supplier_names
+ FROM (((purchase_invoice_item_stock i join purchase_invoice_stock p on i.purchase_id=p.id )
+ join stock_supplier s on s.sid=p.sid)
+ JOIN med_store_product_master pm ON i.item_code=pm.id AND pm.is_continue=1)
+ LEFT JOIN
+ (SELECT item_code,sum(qty) AS sale_qty FROM inv_stock_item GROUP BY item_code )
+ AS ss ON i.item_code= ss.item_code
+ Where " . $where . " group by i.item_code " . $HAVING . " order by i.Item_name";
+
+
+ $sql = "SELECT p.id, p.item_name,
+ IFNULL(s.item_code,0) AS item_found,
+ ifnull(s.packing,p.packing) as packing,
+ SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit) as C_Unit_Stock_Qty,
+ Concat(TRUNCATE(SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit)/s.packing,0),
+ ':',
+ MOD(SUM(s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit),s.packing)) as C_Pak_Qty,
+ sum(s.total_unit) as P_Unit_Qty,
+ sum(s.total_unit)/s.packing as Pak_qty,
+ sum(s.total_sale_unit) as sale_unit,
+ sum(s.total_sale_unit)/s.packing as C_Pak_Sale_Qty,
+ p.re_order_qty,
+ s.total_lost_unit
+ FROM (med_store_product_master p
+ JOIN purchase_invoice_item_stock s ON p.id=s.item_code AND s.remove_item=0 AND s.item_return=0)
+ JOIN purchase_invoice_stock m ON s.purchase_id=m.id and p.is_continue=1
+ WHERE " . $where . " group by p.id,s.packing " . $HAVING . " order by p.Item_name ";
+
+ $query = $this->db->query($sql);
+ $data['stock_list'] = $query->result();
+
+ //echo $sql;
+
+ $this->load->view('Storestock/Stock_search_qty_result', $data);
+ }
+
+
+ public function get_product_stock($product_id, $remove_item = 0)
+ {
+ $supplier_id = $this->input->post('input_supplier');
+ $date_range = $this->input->post('date_range');
+
+ $product_pak = $this->input->post('product_pak');
+
+ $where = "1=1 ";
+
+ if ($date_range <> '0') {
+ $rangeArray = explode("S", $date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where .= " and p.date_of_invoice between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ $where .= " and i.item_code=$product_id and i.packing=$product_pak ";
+
+ $sql = "SELECT i.id,s.name_supplier,s.short_name,i.Item_name,
+ p.Invoice_no,p.date_of_invoice,i.mrp,i.packing,
+ i.batch_no,i.expiry_date,i.purchase_price,i.purchase_unit_rate,
+ i.qty,i.qty_free,i.tqty,i.total_unit,i.total_sale_unit,
+ i.total_return_unit,i.total_lost_unit,
+ (i.total_unit-i.total_sale_unit-i.total_lost_unit-i.total_return_unit) as cur_unit
+ FROM (purchase_invoice_stock p JOIN purchase_invoice_item_stock i ON p.id=i.purchase_id and i.item_return=0)
+ JOIN med_supplier s ON p.sid=s.sid
+ WHERE $where and remove_item=$remove_item
+ Order by p.id";
+
+ $query = $this->db->query($sql);
+ $data['product_purchase_detail'] = $query->result();
+
+ $this->load->view('Storestock/Stock_Item_history', $data);
+ }
+
+ public function Stock_result_excel($chk_reorder, $item_name = "", $schedule_id = '')
+ {
+ $HAVING = "";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING (SUM(TRUNCATE((p.total_unit-p.total_sale_unit-p.total_lost_unit-p.total_return_unit)/p.packing,0)))<=m.re_order_qty";
+ }
+
+ $where = " 1=1 ";
+
+ if ($item_name <> '-') {
+ $where .= " and m.item_name like '%" . urldecode($item_name) . "%' ";
+ }
+
+ if ($schedule_id == '0') {
+ } else {
+
+ $schedule_id = explode("S", $schedule_id);
+ if (count($schedule_id) > 0) {
+ $where .= " ( ";
+ }
+ foreach ($schedule_id as $row) {
+ if ($row == 1) {
+ $where .= " or m.schedule_h=1 ";
+ }
+
+ if ($row == 2) {
+ $where .= " or m.schedule_h1=1 ";
+ }
+
+ if ($row == 3) {
+ $where .= " or m.schedule_x=1 ";
+ }
+
+ if ($row == 4) {
+ $where .= " or m.schedule_g=1 ";
+ }
+
+ if ($row == 5) {
+ $where .= " or m.narcotic=1 ";
+ }
+ }
+ if (count($schedule_id) > 0) {
+ $where .= " ) ";
+ }
+ }
+
+
+
+ $where .= " and i.date_of_invoice>date_add(curdate(),interval -24 month) ";
+
+ $sql = "SELECT m.item_name, m.id,m.genericname,
+ SUM(p.tqty) AS Pak_qty,
+ SUM(p.total_unit) AS P_Unit_Qty,
+ m.packing,
+ SUM(TRUNCATE((p.total_unit-p.total_sale_unit)/p.packing,0)) AS C_Pak_Qty,
+ SUM(p.total_sale_unit) AS sale_unit,
+ SUM(TRUNCATE((p.total_sale_unit)/p.packing,0)) AS C_Pak_Sale_Qty,
+ m.re_order_qty,
+ SUM(p.total_unit-p.total_sale_unit) AS C_Unit_Stock_Qty,
+ SUM(TRUNCATE((p.total_unit-p.total_sale_unit-p.total_lost_unit-p.total_return_unit),0))*MAX(p.purchase_unit_rate) AS Stock_Cost,
+ p.purchase_unit_rate
+ FROM (med_store_product_master m JOIN purchase_invoice_item_stock p
+ ON m.id=p.item_code and m.is_continue=1 and p.item_return=0 AND p.remove_item=0)
+ JOIN purchase_invoice_stock i ON p.purchase_id=i.id
+ WHERE " . $where . " group by m.id " . $HAVING . " order by m.Item_name";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+
+
+ $content = "";
+ //$content.=$sql;
+ $content .= '
+
+
+ Item Name
+ Generic Name
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Package/Re-Order Qty
+ Purchase Unit Rate
+ Stock Cost
+
+
+ ';
+
+ $total_stock_value = 0;
+
+ foreach ($stock_list as $row) {
+
+ if ($row->C_Pak_Qty <= $row->re_order_qty) {
+ $tr_color = 'style="background-color: #999999;"';
+ } else {
+ $tr_color = '';
+ }
+
+ $content .= '
+ ' . $row->item_name . '
+ ' . $row->genericname . '
+ ' . $row->C_Pak_Qty . '
+ ' . $row->C_Unit_Stock_Qty . '
+ ' . $row->C_Pak_Sale_Qty . '
+ ' . $row->sale_unit . '
+ ' . $row->packing . '
+ ' . $row->purchase_unit_rate . '
+ ' . $row->Stock_Cost . '
+ ';
+ $total_stock_value += $row->Stock_Cost;
+ }
+
+ $content .= '
+ Total Stock Cost
+ ' . $total_stock_value . '
+ ';
+
+ $content .= '
';
+
+ ExportExcel($content, 'Report_Medical_store_stock');
+ }
+
+ public function Stock_result_excel_2($supplier_id, $opd_date_range, $item_name, $chk_reorder, $schedule_id = '')
+ {
+
+ $HAVING = "";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING SUM(s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)<=p.re_order_qty";
+ }
+
+ $where = " 1=1 ";
+
+ if ($item_name <> '-') {
+ $where .= " and p.item_name like '%" . $item_name . "%' ";
+ }
+
+ if (!($opd_date_range == '' || $opd_date_range <> '0')) {
+ $rangeArray = explode("S", $opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where .= " and s.stock_date between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ if ($schedule_id == '') {
+ } else {
+
+ $where .= " and (1<>1 ";
+ $schedule_id = explode("S", $schedule_id);
+ foreach ($schedule_id as $row) {
+ if ($row == 1) {
+ $where .= " or p.schedule_h=1 ";
+ }
+
+ if ($row == 2) {
+ $where .= " or p.schedule_h1=1 ";
+ }
+
+ if ($row == 3) {
+ $where .= " or p.schedule_x=1 ";
+ }
+
+ if ($row == 4) {
+ $where .= " or p.schedule_g=1 ";
+ }
+
+ if ($row == 5) {
+ $where .= " or p.narcotic=1 ";
+ }
+ }
+ $where .= ")";
+ }
+
+
+ $sql = "SELECT p.item_name, p.id,p.genericname,
+ SUM(s.tqty) AS Pak_qty,
+ SUM(s.total_unit) AS P_Unit_Qty,
+ s.packing,
+ SUM(TRUNCATE((s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit)/s.packing,0)) AS C_Pak_Qty,
+ SUM(s.total_sale_unit) AS sale_unit,
+ SUM(TRUNCATE((s.total_sale_unit)/s.packing,0)) AS C_Pak_Sale_Qty,
+ p.re_order_qty,
+ SUM(s.total_unit-s.total_sale_unit) AS C_Unit_Stock_Qty,
+ SUM(TRUNCATE((s.total_unit-s.total_sale_unit),0))*MAX(s.purchase_unit_rate) AS Stock_Cost
+ FROM (med_store_product_master p JOIN purchase_invoice_item_stock s ON p.id=s.item_code and s.item_return=0)
+ JOIN purchase_invoice_stock m ON s.purchase_id=m.id
+ WHERE " . $where . " group by p.id,s.packing " . $HAVING . " order by p.Item_name";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+
+ $content = "";
+ $content .= '
+
+
+ Item Name
+ Total Unit Qty
+ Current Unit Qty
+ Total Sale Unit Qty
+ Package/Re-Order Qty
+ Stock Cost
+
+
+ ';
+
+ foreach ($stock_list as $row) {
+
+ if ($row->C_Pak_Qty <= $row->re_order_qty) {
+ $tr_color = 'style="background-color: #999999;"';
+ } else {
+ $tr_color = '';
+ }
+
+ $content .= '
+ ' . $row->item_name . '
+ ' . $row->P_Unit_Qty . '
+ ' . $row->C_Unit_Stock_Qty . '
+ ' . $row->sale_unit . '
+ ' . $row->packing . '
+ ' . $row->Stock_Cost . '
+ ';
+ }
+
+ $content .= '
';
+
+ //echo $content;
+ ExportExcel($content, 'Report_Medical_store_stock');
+ }
+
+ public function Stock_result_excel_3($supplier_id, $opd_date_range, $item_name, $chk_reorder, $schedule_id = "")
+ {
+
+ $HAVING = "";
+
+ if ($chk_reorder == "on") {
+ $HAVING = " HAVING SUM(s.total_unit-s.total_lost_unit-s.total_sale_unit-s.total_return_unit)<=p.re_order_qty";
+ }
+
+ $where = " 1=1 ";
+
+ if ($item_name <> '-') {
+ $where .= " and p.item_name like '%" . $item_name . "%' ";
+ }
+
+ if (!($opd_date_range == '' || $opd_date_range == '0')) {
+ $rangeArray = explode("S", $opd_date_range);
+ $minRange = $rangeArray[0];
+ $maxRange = $rangeArray[1];
+
+ $where .= " and s.stock_date between '" . $minRange . "' and '" . $maxRange . "'";
+ }
+
+ if ($supplier_id > 0) {
+ $where .= " and m.sid=$supplier_id";
+ }
+
+ if ($schedule_id == '') {
+ } else {
+
+ $where .= " and (1<>1 ";
+ $schedule_id = explode("S", $schedule_id);
+ foreach ($schedule_id as $row) {
+ if ($row == 1) {
+ $where .= " or p.schedule_h=1 ";
+ }
+
+ if ($row == 2) {
+ $where .= " or p.schedule_h1=1 ";
+ }
+
+ if ($row == 3) {
+ $where .= " or p.schedule_x=1 ";
+ }
+
+ if ($row == 4) {
+ $where .= " or p.schedule_g=1 ";
+ }
+
+ if ($row == 5) {
+ $where .= " or p.narcotic=1 ";
+ }
+ }
+ $where .= ")";
+ }
+
+ $sql = "SELECT p.item_name, p.id,p.genericname,
+ SUM(s.tqty) AS Pak_qty,
+ SUM(s.total_unit) AS P_Unit_Qty,
+ s.packing,s.batch_no,date_format(s.expiry_date,'%m-%Y') as str_exp,
+ s.mrp,
+ TRIM(',' FROM Concat(if(p.schedule_h=1,'schedule_h,',''),
+ if(p.schedule_h1=1,'schedule_h1,',''),
+ if(p.narcotic=1,'narcotic,',''),
+ if(p.schedule_x=1,'schedule_x,',''),
+ if(p.schedule_g=1,'schedule_g,',''))) as shed_x_h,
+ s.HSNCODE,
+ SUM(TRUNCATE((s.total_unit-s.total_sale_unit-s.total_lost_unit-s.total_return_unit)/s.packing,0)) AS C_Pak_Qty,
+ SUM(s.total_sale_unit) AS sale_unit,p.SGST_per,
+ SUM(TRUNCATE((s.total_sale_unit)/s.packing,0)) AS C_Pak_Sale_Qty,
+ p.re_order_qty,
+ SUM(s.total_unit-s.total_sale_unit) AS C_Unit_Stock_Qty,s.purchase_unit_rate,
+ SUM(TRUNCATE((s.total_unit-s.total_sale_unit-total_lost_unit-s.total_return_unit),0))*MAX(s.purchase_unit_rate) AS Stock_Cost ,
+ v.name_supplier,date_format(date_of_invoice,'%d-%m-%Y') as P_Date
+ FROM ((med_store_product_master p JOIN purchase_invoice_item_stock s ON p.id=s.item_code)
+ JOIN purchase_invoice_stock m ON s.purchase_id=m.id )
+ JOIN stock_supplier v on v.sid=m.sid
+ WHERE " . $where . " group by p.id,s.packing " . $HAVING . " order by p.Item_name";
+ $query = $this->db->query($sql);
+ $stock_list = $query->result();
+
+
+ $content = "";
+ $content .= '
+
+
+ Item Name
+ Compostion Name (Salt Name)
+ Pur. Date
+ Batch No.
+ Expiry
+ Purchase Unit Qty
+ Sale Unit Qty
+ Cur. Qty
+ Shedule H / X
+ SuppLier Name
+ HSN Code
+ GST Per
+ Stock Cost
+ Purchase Rate
+ MRP
+
+
+ ';
+
+ foreach ($stock_list as $row) {
+
+ if ($row->C_Pak_Qty <= $row->re_order_qty) {
+ $tr_color = 'style="background-color: #999999;"';
+ } else {
+ $tr_color = '';
+ }
+
+ $content .= '
+ ' . $row->item_name . '
+ ' . $row->genericname . '
+ ' . $row->P_Date . '
+ ' . $row->batch_no . '
+ ' . $row->str_exp . '
+ ' . $row->P_Unit_Qty . '
+ ' . $row->sale_unit . '
+ ' . $row->C_Unit_Stock_Qty . '
+ ' . $row->shed_x_h . '
+ ' . $row->name_supplier . '
+ ' . $row->HSNCODE . '
+ ' . $row->SGST_per . '
+ ' . $row->Stock_Cost . '
+ ' . $row->purchase_unit_rate . '
+ ' . $row->mrp . '
+ ';
+ }
+
+ $content .= '
';
+
+ //echo $content;
+ ExportExcel($content, 'Report_Medical_store_stock');
+ }
+
+
+
+
+
+
+
+
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Testcont.php b/old_code_ci3/controllers/Testcont.php
new file mode 100644
index 0000000..16d936d
--- /dev/null
+++ b/old_code_ci3/controllers/Testcont.php
@@ -0,0 +1,137 @@
+load->library("Barcode");
+
+ $bar_content_bar=rawurldecode($bar_content);
+
+ $barcodeobj = new TCPDFBarcode($bar_content_bar, 'C128');
+ $barcode = $barcodeobj->getBarcodePNG(2, 30, array(0,128,0));
+ echo $barcode;
+
+ }
+
+ public function bar2($bar_content) {
+
+ $this->load->library("Barcode2");
+
+ $bar_content_bar=rawurldecode($bar_content);
+
+ $barcodeobj = new TCPDF2DBarcode($bar_content_bar, 'QRCODE,L');
+ $barcode = $barcodeobj->getBarcodePNG();
+ echo $barcode;
+ }
+
+ public function test_upload()
+ {
+ $this->load->view('testcode/test_1');
+ }
+
+ public function save_image($user_id)
+ {
+ $filename = $user_id.time() . '.jpg';
+ $filepath = '/uploads/';
+
+ $config['upload_path'] = 'uploads';
+ $config['allowed_types'] = 'gif|jpg|png|jpeg';
+
+ $new_name = time().$_FILES["webcam"]['name'];
+ $config['file_name'] = $new_name;
+
+ $this->load->library('upload', $config);
+ if (!$this->upload->do_upload('webcam')) {
+ $error = array('error' => $this->upload->display_errors());
+ echo $error['error'];
+ }
+ }
+
+
+ public function testdir($file_v_no)
+ {
+ $sql="select * from file_opd_rec where v_no=$file_v_no";
+ $query = $this->db->query($sql);
+ $chk_file= $query->result();
+
+ if(count($chk_file)>0)
+ {
+ $full_path=$chk_file[0]->full_path;
+ $start_no=stripos($full_path,$file_v_no);
+ $end_no=strlen($full_path);
+
+ $folder_name=substr($full_path,0,$start_no);
+
+ $files_info = get_dir_file_info($folder_name);
+
+ Echo '';
+ print_r($files_info);
+ Echo ' ';
+
+ foreach($files_info as $key => $value) {
+ $find_file=number_format(substr_count($value['name'],$file_v_no),0);
+ if($find_file==1)
+ {
+ echo ' File Name :'.$value['name'].' / Find File '.$file_v_no.' ';
+ $index_key=str_replace($file_v_no.'_','',$value['name']);
+ $index_key=str_replace('.webm','',$index_key);
+
+ $file_list[$index_key] = $value['name'];
+ }
+ }
+
+ ksort($file_list);
+
+ echo 'No. of Files :'. count($file_list);
+
+ $prev_file='';
+ $current_file='';
+ foreach($file_list as $key => $value) {
+ $current_file=$folder_name.'/'.$value;
+ if(strlen($prev_file)>0)
+ {
+ //First File
+ $objFH = fopen( $prev_file, "rb" );
+ $strBuffer1 = fread( $objFH, filesize( $prev_file) );
+ fclose( $objFH );
+
+ //Second File
+ $objFH = fopen( $current_file, "rb" );
+ $strBuffer2 = fread( $objFH, filesize( $current_file) );
+ fclose( $objFH );
+
+ // manipulate buffers here...
+ $strBuffer3 = $strBuffer1 . $strBuffer2;
+
+ // open for write/binary-safe
+ $objFH = fopen( $current_file, "wb" );
+ fwrite( $objFH, $strBuffer3 );
+ fclose( $objFH );
+
+ //Delete prev File
+ unlink($prev_file);
+ }
+
+ $prev_file=$current_file;
+ }
+
+ Echo '';
+ print_r($file_list);
+ Echo ' ';
+
+
+ }
+
+ }
+
+ public function test_math()
+ {
+ Test_exp("2+5*3");
+ }
+
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/User_Authentication.php b/old_code_ci3/controllers/User_Authentication.php
new file mode 100644
index 0000000..f97a6c9
--- /dev/null
+++ b/old_code_ci3/controllers/User_Authentication.php
@@ -0,0 +1,84 @@
+load->helper('form');
+
+ // Load form validation library
+ $this->load->library('form_validation');
+
+ // Load session library
+ $this->load->library('session');
+
+ $this->load->helper('security');
+}
+
+// Show login page
+public function index() {
+ $this->load->view('Mobile_app/login');
+}
+
+// Check for user login process
+public function user_login_process() {
+
+ // Retrieve session data
+ $session_set_value = $this->session->all_userdata();
+
+ // Check for remember_me data in retrieved session data
+ if (isset($session_set_value['remember_me']) && $session_set_value['remember_me'] == "1") {
+ //$this->load->view('admin_page');
+ $data['user'] = 1;
+ $this->load->view('Mobile_app/index',$data);
+ } else {
+
+ // Check for validation
+ $this->form_validation->set_rules('username', 'Username', 'trim|required|xss_clean');
+ $this->form_validation->set_rules('password', 'Password', 'trim|required|xss_clean');
+
+ if ($this->form_validation->run() == FALSE) {
+ //$this->load->view('login_form');
+ $this->load->view('Mobile_app/login');
+ } else {
+ $username = $this->input->post('username');
+ $password = $this->input->post('password');
+ if ($username == "fugo" && $password == "formget") {
+ $remember = $this->input->post('remember_me');
+ if ($remember) {
+ // Set remember me value in session
+ $this->session->set_userdata('remember_me', TRUE);
+ }
+ $sess_data = array(
+ 'username' => $username,
+ 'password' => $password
+ );
+
+ $this->session->set_userdata('logged_in', $sess_data);
+ //$this->load->view('admin_page');
+
+ $data['user'] = 1;
+ $this->load->view('Mobile_app/index',$data);
+
+ } else {
+ $data = array(
+ 'error_message' => 'Invalid Username or Password'
+ );
+ $this->load->view('Mobile_app/login', $data);
+ }
+ }
+ }
+}
+
+// Logout from admin page
+public function logout() {
+
+ // Destroy session data
+ $this->session->sess_destroy();
+ $data['message_display'] = 'Successfully Logout';
+ $this->load->view('Mobile_app/login', $data);
+}
+
+}?>
\ No newline at end of file
diff --git a/old_code_ci3/controllers/Web_medical.php b/old_code_ci3/controllers/Web_medical.php
new file mode 100644
index 0000000..9fb0eb5
--- /dev/null
+++ b/old_code_ci3/controllers/Web_medical.php
@@ -0,0 +1,9 @@
+load->view('form');
+ }
+
+ public function submission()
+ {
+
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'inputEmail3',
+ 'label' => 'Email Address',
+ 'rules' => 'required|min_length[5]|max_length[30]|valid_email'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ echo 'Your website is submitted
';
+ }
+ else
+ {
+ echo ''.validation_errors().'
';
+ }
+ }
+
+ }
diff --git a/old_code_ci3/controllers/Welcome.php b/old_code_ci3/controllers/Welcome.php
new file mode 100644
index 0000000..f14df7e
--- /dev/null
+++ b/old_code_ci3/controllers/Welcome.php
@@ -0,0 +1,105 @@
+load->view('welcome_message');
+ }
+
+ public function logout()
+ {
+ $this->ion_auth->logout();
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ public function index()
+ {
+ if (!$this->ion_auth->logged_in())
+ {
+ redirect('auth_dst/login', 'refresh');
+ }
+
+ $d= $this->ion_auth->user()->row();
+
+ $data['user'] = $d;
+
+ //print_r($d);
+
+ $sql="SELECT count(opd_id) as no_opd_id
+ FROM opd_master WHERE online_book=1 and apointment_date=date(sysdate())";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $data['No_of_online_opd']=$opd_master[0]->no_opd_id;
+
+ $this->load->view('Header',$data);
+ $this->load->view('LeftSide',$data);
+ $this->load->view('AdminMain');
+ //$this->load->view('ControlSide');
+ $this->load->view('Footer');
+ }
+
+ public function loademail()
+ {
+ $this->load->view('TestForm');
+ }
+ public function loademail2()
+ {
+ $this->load->view('TestForm2');
+ }
+
+ public function check_login()
+ {
+ if (!$this->ion_auth->logged_in())
+ {
+ $rvar=array(
+ 'login' =>1
+ );
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+ }
+ }
+
+ public function Patient()
+ {
+ $this->load->view('Patient');
+ }
+
+
+ function update_online_opd(){
+
+ $sql="SELECT count(opd_id) as no_opd_id
+ FROM opd_master
+ WHERE online_book=1 and apointment_date=date(sysdate())";
+ $query = $this->db->query($sql);
+ $opd_master= $query->result();
+
+ $No_of_online_opd=$opd_master[0]->no_opd_id;
+
+ $rvar=array(
+ 'online_opd' =>$No_of_online_opd,
+ );
+
+ $encode_data = json_encode($rvar);
+ echo $encode_data;
+
+ }
+
+
+ function opd_online_list()
+ {
+ $sql="SELECT o.*,p.p_code,p.p_fname
+ FROM opd_master o JOIN patient_master p on o.p_id=p.id
+ WHERE o.online_book=1 and o.apointment_date=date(sysdate())";
+ $query = $this->db->query($sql);
+ $data['opd_online_list']= $query->result();
+
+ $this->load->view('dashboard/opd_line_list',$data);
+
+ }
+
+
+}
diff --git a/old_code_ci3/controllers/Workplace.php b/old_code_ci3/controllers/Workplace.php
new file mode 100644
index 0000000..df55ae9
--- /dev/null
+++ b/old_code_ci3/controllers/Workplace.php
@@ -0,0 +1,14 @@
+load->view('workplace/workpanel');
+ }
+}
\ No newline at end of file
diff --git a/old_code_ci3/controllers/index.html b/old_code_ci3/controllers/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/old_code_ci3/controllers/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/old_code_ci3/controllers/php_opd_appointment_online.php b/old_code_ci3/controllers/php_opd_appointment_online.php
new file mode 100644
index 0000000..0e8327c
--- /dev/null
+++ b/old_code_ci3/controllers/php_opd_appointment_online.php
@@ -0,0 +1,248 @@
+ $apiKey, 'numbers' => $numbers, "sender" => $sender, "message" => $message);
+ // Send the POST request with cURL
+ $ch = curl_init('https://api.textlocal.in/send/');
+ curl_setopt($ch, CURLOPT_POST, true);
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $data);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ $response = curl_exec($ch);
+ curl_close($ch);
+
+}
+
+$conn_main=mysqli_connect("localhost","root","Bisht@9720958717","main_website") or die("Unable to connect to Main Server");
+
+if (mysqli_connect_errno())
+{
+ echo "Failed to connect to MySQL: " . mysqli_connect_error();
+}
+
+// New Patient Create in HMS
+
+$sql = "select * from patient_master p where p.p_id=0 order by id limit 1";
+
+$result = mysqli_query($conn_main,$sql) or die(mysqli_error($conn_main));
+
+$flag=0;
+
+while($row = mysqli_fetch_array($result))
+ {
+ $hospital_id=$row['hospital_id'];
+ $p_fname =$row['p_fname'];
+ $p_relative = $row['p_relative'];
+ $p_rname= $row['p_rname'];
+ $gender= $row['gender'];
+ $dob= $row['dob'];
+ $mphone1= $row['mphone1'];
+
+
+ $sql="select * from hospital_client where hospital_id=".$hospital_id;
+ $hospital_data = mysqli_query($conn_main,$sql) or die(mysqli_error($conn_main));
+
+ while($row_hospital = mysqli_fetch_array($hospital_data))
+ {
+ $hospital_name=$row_hospital['hospital_name'];
+ $online_url=$row_hospital['online_url'];
+ $webservice_url=$row_hospital['webservice_url'];
+ $vpn_server_id=$row_hospital['vpn_server_id'];
+
+ $data = array(
+ 'mphone1' => $mphone1,
+ 'p_fname' => strtoupper($p_fname),
+ 'gender' => $gender,
+ 'p_relative' => $p_relative,
+ 'p_rname' => strtoupper($p_rname),
+ 'dob' => $dob,
+ 'estimate_dob' => 1
+ );
+
+ $data_json = json_encode($data);
+
+ $post_url=$webservice_url.'/Opd_online_api/patient_create';
+ echo $post_url;
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $post_url);
+ curl_setopt($ch, CURLOPT_HEADER, 0);
+ //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ $response = curl_exec($ch);
+ curl_close($ch);
+
+ $retrun_data=json_decode(utf8_encode($response));
+
+ var_dump($retrun_data);
+ }
+
+ $update_sql="update patient_master
+ set p_id=".$retrun_data->New_UHID.",
+ p_code='".$retrun_data->p_code."'
+ where id=".$row['id'];
+
+ echo $update_sql;
+
+ mysqli_query($conn_main,$update_sql);
+
+ }
+
+// New Patient Created End
+
+//Update Patient_Id in OPd_BOOK Table
+$update_sql="UPDATE patient_master p JOIN opd_book b ON p.id=b.online_patient_id
+SET b.hospital_patient_id=p.p_id
+WHERE p.p_id>0 AND b.hospital_patient_id=0";
+
+mysqli_query($conn_main,$update_sql);
+
+//Update Payment Info in OPD_BOOK Table
+
+$update_sql="UPDATE opd_book b JOIN payments p ON p.product_id=b.id
+SET b.pg_id=p.id
+WHERE b.pg_id IS null";
+
+mysqli_query($conn_main,$update_sql);
+
+// OPD Registering Process Start here
+
+$sql="select * from opd_book
+where pg_id>0 and (hospital_opd_id=0 or hospital_opd_id is null)";
+
+$opd_book_data = mysqli_query($conn_main,$sql) or die(mysqli_error($conn_main));
+
+while($row_opd_book = mysqli_fetch_array($opd_book_data))
+{
+ $hospital_patient_id=$row_opd_book['hospital_patient_id'];
+ $hospital_doc_id=$row_opd_book['hospital_doc_id'];
+ $appointment_date=$row_opd_book['appointment_date'];
+ $opd_fee=$row_opd_book['opd_fee'];
+ $hospital_id=$row_opd_book['hospital_id'];
+
+ $sql="select * from hospital_client where hospital_id=".$hospital_id;
+ $hospital_data = mysqli_query($conn_main,$sql) or die(mysqli_error($conn_main));
+
+ while($row_hospital = mysqli_fetch_array($hospital_data))
+ {
+ $hospital_name=$row_hospital['hospital_name'];
+ $online_url=$row_hospital['online_url'];
+ $webservice_url=$row_hospital['webservice_url'];
+ $vpn_server_id=$row_hospital['vpn_server_id'];
+
+ $data = array(
+ 'hospital_patient_id' => $hospital_patient_id,
+ 'hospital_doc_id' => $hospital_doc_id,
+ 'appointment_date' => $appointment_date,
+ 'opd_fee'=> $opd_fee
+ );
+
+ $data_json = json_encode($data);
+
+ $post_url=$webservice_url.'/Opd_online_api/opd_register';
+ echo $post_url;
+ $ch = curl_init();
+ curl_setopt($ch, CURLOPT_URL, $post_url);
+ curl_setopt($ch, CURLOPT_HEADER, 0);
+ //curl_setopt($ch, CURLOPT_HTTPHEADER, array('Content-Type: application/json'));
+ curl_setopt($ch, CURLOPT_POST, 1);
+ curl_setopt($ch, CURLOPT_POSTFIELDS,$data);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ $response = curl_exec($ch);
+ curl_close($ch);
+
+ $retrun_data=json_decode(utf8_encode($response));
+
+ var_dump($retrun_data);
+
+ $update_sql="update opd_book
+ set hospital_opd_id=".$retrun_data->OPD_ID."
+ where id=".$row_opd_book['id'];
+
+ mysqli_query($conn_main,$update_sql);
+
+ //Send SMS
+
+ $sms_template="Your OPD Appointment with Dr. #DrName# has been Booked.
+ Booked No : #BookNo#.
+ Date: #date#
+ Time Between #time#
+ Place: #HospitalName#
+ Thanks DevSoft Tech";
+
+ $sql="Select * from opd_slot where slot_id=".$row_opd_book['slot_id'];
+ $opd_slot = mysqli_query($conn_main,$sql) or die(mysqli_error($conn_main));
+
+ if($row_opd_slot = mysqli_fetch_array($opd_slot))
+ {
+ $str_time=$row_opd_slot['slot_desc'];
+ }else{
+ $str_time=' ';
+ }
+
+ $sms_template=str_replace('#DrName#',$retrun_data->DOC_NAME,$sms_template);
+ $sms_template=str_replace('#BookNo#',$retrun_data->BOOKNO,$sms_template);
+ $sms_template=str_replace('#date#',$retrun_data->BOOKDATE,$sms_template);
+ $sms_template=str_replace('#time#',$str_time,$sms_template);
+ $sms_template=str_replace('#HospitalName#',$hospital_name,$sms_template);
+
+ $mphone1=$retrun_data->PHONENO;
+
+ $sms_send="insert into sms_outbox (hospital_id,phone_number,content)
+ values ($hospital_id,$mphone1,'$sms_template')";
+
+ $write_web_sms="insert into web_msg_content (web_content,web_content_key,msg_insert_date,hospital_id,hospital_name,phone_no)
+ values ('".$data_sms."','Medicine',sysdate(),1,'Krishna Pharmcy','".$sender_number."')";
+
+ if ($conn_main->query($sms_send) === TRUE) {
+ $last_id = $conn_main->insert_id;
+ echo "New record created successfully. Last inserted ID is: " . $last_id;
+
+ $url_link="https://m.dhms.in/msg/show/".$last_id;
+ $from_hospital=$hospital_name;
+
+ //Send SMS End
+
+ $insert_sms_sql="INSERT INTO sms_fast2sms (hospital_id, sender_id, message, variables_values, route, numbers)
+ VALUES (".$hospital_id.", 'DSTWEB', 160545, '".$hospital_name."|".$url_link."', 'dlt', '".substr($mphone1,-10)."')";
+
+ echo $insert_sms_sql;
+
+ mysqli_query($conn_main,$insert_sms_sql);
+
+ } else {
+ echo "Error: " . $sms_send . " " . $conn->error;
+ }
+
+
+
+
+
+
+
+
+
+ echo $sms_send;
+
+ mysqli_query($conn_main,$sms_send);
+ }
+
+}
+
+
+// OPD Registered , Process End Here
+mysqli_close($conn_main);
+//echo date("l jS \of F Y h:i:s A");
diff --git a/old_code_ci3/helpers/commonfunction_helper.php b/old_code_ci3/helpers/commonfunction_helper.php
new file mode 100644
index 0000000..5d066f9
--- /dev/null
+++ b/old_code_ci3/helpers/commonfunction_helper.php
@@ -0,0 +1,217 @@
+0)
+ {
+ return "checked";
+ }
+ else{
+ return "";
+ }
+}
+
+function Doc_Value($doc_id)
+{
+ return 'Hello';
+}
+
+function Show_Alert($alert_type,$Head_title,$Body_content)
+{
+ $showAlert='
+ x
+ '.$Head_title.' '.$Body_content.'
';
+
+ return $showAlert;
+}
+
+function number_to_word($number)
+{
+ $no = round($number);
+ $point = round($number - $no, 2) * 100;
+ $hundred = null;
+ $digits_1 = strlen($no);
+ $i = 0;
+ $str = array();
+ $words = array('0' => '', '1' => 'one', '2' => 'two',
+ '3' => 'three', '4' => 'four', '5' => 'five', '6' => 'six',
+ '7' => 'seven', '8' => 'eight', '9' => 'nine',
+ '10' => 'ten', '11' => 'eleven', '12' => 'twelve',
+ '13' => 'thirteen', '14' => 'fourteen',
+ '15' => 'fifteen', '16' => 'sixteen', '17' => 'seventeen',
+ '18' => 'eighteen', '19' =>'nineteen', '20' => 'twenty',
+ '30' => 'thirty', '40' => 'forty', '50' => 'fifty',
+ '60' => 'sixty', '70' => 'seventy',
+ '80' => 'eighty', '90' => 'ninety');
+ $digits = array('', 'hundred', 'thousand', 'lakh', 'crore');
+ while ($i < $digits_1) {
+ $divider = ($i == 2) ? 10 : 100;
+ $number = floor($no % $divider);
+ $no = floor($no / $divider);
+ $i += ($divider == 10) ? 1 : 2;
+ if ($number) {
+ $plural = (($counter = count($str)) && $number > 9) ? 's' : null;
+ $hundred = ($counter == 1 && $str[0]) ? ' and ' : null;
+ $str [] = ($number < 21) ? $words[$number] .
+ " " . $digits[$counter] . $plural . " " . $hundred
+ :
+ $words[floor($number / 10) * 10]
+ . " " . $words[$number % 10] . " "
+ . $digits[$counter] . $plural . " " . $hundred;
+ } else $str[] = null;
+ }
+ $str = array_reverse($str);
+ $result = implode('', $str);
+ $points = ($point) ?
+ "." . $words[$point / 10] . " " .
+ $words[$point = $point % 10] : '';
+
+
+ $rvalue="".ucwords($result)." Only";
+ return $rvalue;
+
+}
+
+function ExportExcel($table,$filename)
+{
+
+ //header("Content-type: application/x-msdownload");
+ //header('Content-Disposition: attachment; filename="filename.xls"');
+
+ // Sending headers to force the user to download the file
+ header('Content-Type: application/vnd.ms-excel');
+ header('Content-Disposition: attachment;filename="'.$filename.'_'.date('dMy').'.xls"');
+ header('Cache-Control: max-age=0');
+ header("Pragma: no-cache");
+ header("Expires: 0");
+
+ echo $table;
+}
+
+function objectToArray($d) {
+ if (is_object($d)) {
+ // Gets the properties of the given object
+ // with get_object_vars function
+ $d = get_object_vars($d);
+ }
+
+ if (is_array($d)) {
+ /*
+ * Return array converted to object
+ * Using __FUNCTION__ (Magic constant)
+ * for recursive call
+ */
+ return array_map(__FUNCTION__, $d);
+ }
+ else {
+ // Return array
+ return $d;
+ }
+}
+
+function compare_arrays($data1,$data2)
+ {
+ $data_change="";
+
+ foreach ($data2 as $key => $value)
+ {
+
+ if((isset($data1[$key])) && (strtoupper($key)!='LOG'))
+ {
+ if($value!=$data1[$key])
+ {
+ $data_change.='Field :'.$key.' Old Value:{'.$data1[$key].'} => New Value:{'.$value.'}'.PHP_EOL;
+ }
+ }
+
+ }
+
+ return $data_change;
+ }
+
+ function cal_exp($exp)
+ {
+ //$string = "(11+10)*3";
+ $string = $exp;
+ $result="Not Valid";
+ $pattern = '~^[0-9()+\-*\/.]+$~';
+ if(preg_match($pattern, $string)){
+ $math_string ="return (".$string.");";
+ $result = floatval(@eval($math_string));
+ }
+
+ if(is_numeric($result)){
+ round($result,2);
+ }
+
+ return $result;
+ }
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+?>
\ No newline at end of file
diff --git a/old_code_ci3/helpers/index.html b/old_code_ci3/helpers/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/old_code_ci3/helpers/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/old_code_ci3/models/DbRemote_M.php b/old_code_ci3/models/DbRemote_M.php
new file mode 100644
index 0000000..e69de29
diff --git a/old_code_ci3/models/DocFormat_M.php b/old_code_ci3/models/DocFormat_M.php
new file mode 100644
index 0000000..ac5e084
--- /dev/null
+++ b/old_code_ci3/models/DocFormat_M.php
@@ -0,0 +1,93 @@
+db->insert("doc_format_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_sub($data) {
+
+ if ($this->db->insert("doc_format_sub", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_sub_item($data) {
+
+ if ($this->db->insert("doc_format_sub_item", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_master($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("df_id", $old_id_no);
+ if ($this->db->update("doc_format_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function update_sub($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("doc_format_sub", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function update_sub_item($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("doc_format_sub_item", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function insert_patient_doc($data) {
+ if ($this->db->insert("patient_doc", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_patient_doc($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("patient_doc", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function insert_patient_doc_raw($data) {
+ $this->db->insert("patient_doc_raw", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_patient_doc_raw($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("patient_doc_raw", $data);
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Doctor_M.php b/old_code_ci3/models/Doctor_M.php
new file mode 100644
index 0000000..bc82b9a
--- /dev/null
+++ b/old_code_ci3/models/Doctor_M.php
@@ -0,0 +1,133 @@
+db->query($sql);
+ $result = $query->result_array();
+ //print_r($result);
+ return $result;
+ }
+
+ public function insert($data) {
+
+ if ($this->db->insert("doctor_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_spec($data) {
+
+ if ($this->db->insert("doc_spec", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_fee($data) {
+
+ if ($this->db->insert("doc_opd_fee", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_fee($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("doc_opd_fee", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("doctor_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+
+
+
+ public function delete_fee($delete_id_no) {
+ $this->db->where('id', $delete_id_no);
+ $q = $this->db->get('doc_opd_fee');
+ // if id is unique, we want to return just one row
+ $data = $q->row_array();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name . '['.date("d-m-Y h:i").']';
+
+ $data['remove_update_by']=$user_name;
+
+ if ($this->db->insert("doc_opd_fee_update", $data)) {
+ $this->db->where("id", $delete_id_no);
+ $this->db->delete("doc_opd_fee");
+ return 1;
+ }else{
+ return 0;
+ }
+ }
+
+ //opd_prescription_template
+
+ public function insert_opd_prescription_template($data) {
+ if ($this->db->insert("opd_prescription_template", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ //opd_prescription_template -> Sub opd_prescrption_prescribed_template
+ public function insert_opd_prescrption_prescribed_template($data) {
+ if ($this->db->insert("opd_prescrption_prescribed_template", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function remove_p_medical($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("opd_prescrption_prescribed_template");
+ }
+
+
+
+ public function update_opd_prescription_template($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("opd_prescription_template", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function update_opd_prescrption_prescribed_template($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("opd_prescrption_prescribed_template", $data)) {
+ return 1;
+ }else
+ return 0;
+}
+
+
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/DotPrint_M.php b/old_code_ci3/models/DotPrint_M.php
new file mode 100644
index 0000000..f00c77c
--- /dev/null
+++ b/old_code_ci3/models/DotPrint_M.php
@@ -0,0 +1,25 @@
+db->insert("dot_printer", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("dot_printer", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/old_code_ci3/models/ECHS_M.php b/old_code_ci3/models/ECHS_M.php
new file mode 100644
index 0000000..8334e9b
--- /dev/null
+++ b/old_code_ci3/models/ECHS_M.php
@@ -0,0 +1,43 @@
+db->insert("echs_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ $pid=1000000+$insert_id;
+ $pid=date('ym').$pid;
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_mem($data) {
+
+ if ($this->db->insert("echs_member", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_mem($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("echs_member", $data);
+ }
+
+ public function update($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("echs_master", $data);
+ }
+
+
+ }
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/FileMedical_M.php b/old_code_ci3/models/FileMedical_M.php
new file mode 100644
index 0000000..4508645
--- /dev/null
+++ b/old_code_ci3/models/FileMedical_M.php
@@ -0,0 +1,61 @@
+db->insert("purchase_invoice_scan_file", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ } else {
+ echo $this->db->_error_message();
+ return 0;
+ }
+ }
+
+ public function update_purchase_scan($data, $old_id_no)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("purchase_invoice_scan_file", $data);
+ }
+
+ function get_purchase_scan_filedetail($id)
+ {
+ return $this->db->get_where('purchase_invoice_scan_file', array('id' => $id))->row_array();
+ }
+
+ function get_filedetail_file_url($id)
+ {
+ if ($id == '' || $id == 0) {
+ $file_url = "No File";
+ } else {
+ $file_url = $this->db->get_where('purchase_invoice_scan_file', array('id' => $id))->row()->full_path;
+ }
+
+ return $file_url;
+ }
+
+ function delete_purchase_scan_fileupload($id)
+ {
+ $this->db->where('id', $id);
+ $q = $this->db->get('purchase_invoice_scan_file');
+ // if id is unique, we want to return just one row
+ $data = $q->row_array();
+
+ $user_name = $this->session->userdata('username') . '[' . $this->session->userdata('agent_id') . ']' . date('d-m-Y H:i:s');
+ $data['delete_by'] = $user_name;
+
+ if ($this->db->insert("purchase_invoice_scan_file_delete", $data)) {
+ return $this->db->delete('purchase_invoice_scan_file', array('id' => $id));
+ } else {
+ return 0;
+ }
+ }
+}
diff --git a/old_code_ci3/models/FileOPDRec_M.php b/old_code_ci3/models/FileOPDRec_M.php
new file mode 100644
index 0000000..a44f330
--- /dev/null
+++ b/old_code_ci3/models/FileOPDRec_M.php
@@ -0,0 +1,62 @@
+db->query($sql);
+ $chk_file= $query->result();
+
+ if(count($chk_file)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("v_no",$file_v_no);
+ $this->db->update("file_opd_rec", $data);
+ }else{
+ $data['v_no']=$file_v_no;
+ if ($this->db->insert("file_opd_rec", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else{
+ echo $this->db->_error_message();
+ return 0;
+ }
+ }
+ }
+
+ public function file_complie($file_v_no)
+ {
+ $sql="select * from file_opd_rec where v_no=$file_v_no";
+ $query = $this->db->query($sql);
+ $chk_file= $query->result();
+
+ if(count($chk_file)>0)
+ {
+ $full_path=$chk_file[0]->full_path;
+ $start_no=stripos($full_path,$file_v_no);
+ $end_no=strlen($full_path);
+
+ $folder_name=substr($full_path,0,$start_no);
+
+ $files_info = get_dir_file_info($folder_name);
+
+ Echo '';
+ print_r($files_info) ;
+ Echo ' ';
+ }
+
+ }
+
+ public function update($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("file_opd_rec", $data);
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/File_M.php b/old_code_ci3/models/File_M.php
new file mode 100644
index 0000000..b97fe5a
--- /dev/null
+++ b/old_code_ci3/models/File_M.php
@@ -0,0 +1,63 @@
+db->insert("file_upload_data", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else{
+ echo $this->db->_error_message();
+ return 0;
+ }
+ }
+
+ public function update($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("file_upload_data", $data);
+ }
+
+ function get_filedetail($id)
+ {
+ return $this->db->get_where('file_upload_data',array('id'=>$id))->row_array();
+ }
+
+ function get_filedetail_file_url($id)
+ {
+ if($id=='' || $id==0 )
+ {
+ $file_url="No File";
+
+ }else{
+ $file_url=$this->db->get_where('file_upload_data',array('id'=>$id))->row()->full_path;
+ }
+
+ return $file_url;
+ }
+
+ function delete_fileupload($id)
+ {
+ $this->db->where('id', $id);
+ $q = $this->db->get('file_upload_data');
+ // if id is unique, we want to return just one row
+ $data = $q->row_array();
+
+ $user_name=$this->session->userdata('username').'['.$this->session->userdata('agent_id').']'.date('d-m-Y H:i:s');
+ $data['delete_by']=$user_name;
+
+ if ($this->db->insert("file_upload_data_delete", $data))
+ {
+ return $this->db->delete('file_upload_data',array('id'=>$id));
+ }else{
+ return 0;
+ }
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Insurance_M.php b/old_code_ci3/models/Insurance_M.php
new file mode 100644
index 0000000..bdb8c71
--- /dev/null
+++ b/old_code_ci3/models/Insurance_M.php
@@ -0,0 +1,29 @@
+db->insert("hc_insurance", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("hc_insurance", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Invoice_M.php b/old_code_ci3/models/Invoice_M.php
new file mode 100644
index 0000000..6f07fa1
--- /dev/null
+++ b/old_code_ci3/models/Invoice_M.php
@@ -0,0 +1,95 @@
+db->insert("invoice_master", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $pid=str_pad(substr($insert_id,-7,7),7,0,STR_PAD_LEFT);
+
+ $pid='N'.date('ym').$pid;
+ $data1 = array(
+ 'invoice_code' => $pid
+ );
+
+ $this->db->set($data1);
+ $this->db->where("id", $insert_id);
+ $this->db->update("invoice_master", $data1);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function addinvoiceitem($data)
+ {
+ if ($this->db->insert("invoice_item", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $this->db->query("CALL p_cal_invoice_byItem(".$insert_id.")");
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function deleteinvoiceitem($del_id)
+ {
+ $this->db->where('id', $del_id);
+ $q = $this->db->get('invoice_item');
+ // if id is unique, we want to return just one row
+ $data = $q->row_array();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $data['update_by_id']=$user_id;
+ $data['update_by']=$user_name;
+ $data['update_action']='1';
+
+ if ($this->db->insert("invoice_item_update", $data)) {
+ $this->db->where("id", $del_id);
+ $this->db->delete("invoice_item");
+ return 1;
+ }else{
+ return 0;
+ }
+
+ $this->db->query("CALL p_cal_invoice_byItem(".$data['inv_master_id'].")");
+ }
+
+ public function update($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("invoice_master", $data);
+
+ $this->db->query("CALL p_cal_invoice_byItem(".$old_id_no.")");
+ }
+
+ public function update_item($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("invoice_item", $data);
+
+ $this->db->where('id', $old_id_no);
+ $q = $this->db->get('invoice_item');
+ // if id is unique, we want to return just one row
+ $data = $q->row_array();
+
+ $this->db->query("CALL p_cal_invoice_byItem(".$data['inv_master_id'].")");
+ }
+
+ public function update_invoice_final($inv_id)
+ {
+ $this->db->query("CALL p_cal_invoice_byItem(".$inv_id.")");
+
+ }
+}
\ No newline at end of file
diff --git a/old_code_ci3/models/Ion_auth_model.php b/old_code_ci3/models/Ion_auth_model.php
new file mode 100644
index 0000000..e2cbc6e
--- /dev/null
+++ b/old_code_ci3/models/Ion_auth_model.php
@@ -0,0 +1,2249 @@
+load->database();
+ $this->load->config('ion_auth', TRUE);
+ $this->load->helper('cookie');
+ $this->load->helper('date');
+ $this->lang->load('ion_auth');
+
+ // initialize db tables data
+ $this->tables = $this->config->item('tables', 'ion_auth');
+
+ //initialize data
+ $this->identity_column = $this->config->item('identity', 'ion_auth');
+ $this->store_salt = $this->config->item('store_salt', 'ion_auth');
+ $this->salt_length = $this->config->item('salt_length', 'ion_auth');
+ $this->join = $this->config->item('join', 'ion_auth');
+
+
+ // initialize hash method options (Bcrypt)
+ $this->hash_method = $this->config->item('hash_method', 'ion_auth');
+ $this->default_rounds = $this->config->item('default_rounds', 'ion_auth');
+ $this->random_rounds = $this->config->item('random_rounds', 'ion_auth');
+ $this->min_rounds = $this->config->item('min_rounds', 'ion_auth');
+ $this->max_rounds = $this->config->item('max_rounds', 'ion_auth');
+
+
+ // initialize messages and error
+ $this->messages = array();
+ $this->errors = array();
+ $delimiters_source = $this->config->item('delimiters_source', 'ion_auth');
+
+ // load the error delimeters either from the config file or use what's been supplied to form validation
+ if ($delimiters_source === 'form_validation')
+ {
+ // load in delimiters from form_validation
+ // to keep this simple we'll load the value using reflection since these properties are protected
+ $this->load->library('form_validation');
+ $form_validation_class = new ReflectionClass("CI_Form_validation");
+
+ $error_prefix = $form_validation_class->getProperty("_error_prefix");
+ $error_prefix->setAccessible(TRUE);
+ $this->error_start_delimiter = $error_prefix->getValue($this->form_validation);
+ $this->message_start_delimiter = $this->error_start_delimiter;
+
+ $error_suffix = $form_validation_class->getProperty("_error_suffix");
+ $error_suffix->setAccessible(TRUE);
+ $this->error_end_delimiter = $error_suffix->getValue($this->form_validation);
+ $this->message_end_delimiter = $this->error_end_delimiter;
+ }
+ else
+ {
+ // use delimiters from config
+ $this->message_start_delimiter = $this->config->item('message_start_delimiter', 'ion_auth');
+ $this->message_end_delimiter = $this->config->item('message_end_delimiter', 'ion_auth');
+ $this->error_start_delimiter = $this->config->item('error_start_delimiter', 'ion_auth');
+ $this->error_end_delimiter = $this->config->item('error_end_delimiter', 'ion_auth');
+ }
+
+
+ // initialize our hooks object
+ $this->_ion_hooks = new stdClass;
+
+ // load the bcrypt class if needed
+ if ($this->hash_method == 'bcrypt') {
+ if ($this->random_rounds)
+ {
+ $rand = rand($this->min_rounds,$this->max_rounds);
+ $params = array('rounds' => $rand);
+ }
+ else
+ {
+ $params = array('rounds' => $this->default_rounds);
+ }
+
+ $params['salt_prefix'] = $this->config->item('salt_prefix', 'ion_auth');
+ $this->load->library('bcrypt',$params);
+ }
+
+ $this->trigger_events('model_constructor');
+ }
+
+ /**
+ * Misc functions
+ *
+ * Hash password : Hashes the password to be stored in the database.
+ * Hash password db : This function takes a password and validates it
+ * against an entry in the users table.
+ * Salt : Generates a random salt value.
+ *
+ * @author Mathew
+ */
+
+ /**
+ * Hashes the password to be stored in the database.
+ *
+ * @return void
+ * @author Mathew
+ **/
+ public function hash_password($password, $salt=false, $use_sha1_override=FALSE)
+ {
+ if (empty($password))
+ {
+ return FALSE;
+ }
+
+ // bcrypt
+ if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt')
+ {
+ return $this->bcrypt->hash($password);
+ }
+
+
+ if ($this->store_salt && $salt)
+ {
+ return sha1($password . $salt);
+ }
+ else
+ {
+ $salt = $this->salt();
+ return $salt . substr(sha1($salt . $password), 0, -$this->salt_length);
+ }
+ }
+
+ /**
+ * This function takes a password and validates it
+ * against an entry in the users table.
+ *
+ * @return void
+ * @author Mathew
+ **/
+ public function hash_password_db($id, $password, $use_sha1_override=FALSE)
+ {
+ if (empty($id) || empty($password))
+ {
+ return FALSE;
+ }
+
+ $this->trigger_events('extra_where');
+
+ $query = $this->db->select('password, salt')
+ ->where('id', $id)
+ ->limit(1)
+ ->order_by('id', 'desc')
+ ->get($this->tables['users']);
+
+ $hash_password_db = $query->row();
+
+ if ($query->num_rows() !== 1)
+ {
+ return FALSE;
+ }
+
+ // bcrypt
+ if ($use_sha1_override === FALSE && $this->hash_method == 'bcrypt')
+ {
+ if ($this->bcrypt->verify($password,$hash_password_db->password))
+ {
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ // sha1
+ if ($this->store_salt)
+ {
+ $db_password = sha1($password . $hash_password_db->salt);
+ }
+ else
+ {
+ $salt = substr($hash_password_db->password, 0, $this->salt_length);
+
+ $db_password = $salt . substr(sha1($salt . $password), 0, -$this->salt_length);
+ }
+
+ if($db_password == $hash_password_db->password)
+ {
+ return TRUE;
+ }
+ else
+ {
+ return FALSE;
+ }
+ }
+
+ /**
+ * Generates a random salt value for forgotten passwords or any other keys. Uses SHA1.
+ *
+ * @return void
+ * @author Mathew
+ **/
+ public function hash_code($password)
+ {
+ return $this->hash_password($password, FALSE, TRUE);
+ }
+
+ /**
+ * Generates a random salt value.
+ *
+ * Salt generation code taken from https://github.com/ircmaxell/password_compat/blob/master/lib/password.php
+ *
+ * @return void
+ * @author Anthony Ferrera
+ **/
+ public function salt()
+ {
+
+ $raw_salt_len = 16;
+
+ $buffer = '';
+ $buffer_valid = false;
+
+ if (function_exists('mcrypt_create_iv') && !defined('PHALANGER')) {
+ $buffer = mcrypt_create_iv($raw_salt_len, MCRYPT_DEV_URANDOM);
+ if ($buffer) {
+ $buffer_valid = true;
+ }
+ }
+
+ if (!$buffer_valid && function_exists('openssl_random_pseudo_bytes')) {
+ $buffer = openssl_random_pseudo_bytes($raw_salt_len);
+ if ($buffer) {
+ $buffer_valid = true;
+ }
+ }
+
+ if (!$buffer_valid && @is_readable('/dev/urandom')) {
+ $f = fopen('/dev/urandom', 'r');
+ $read = strlen($buffer);
+ while ($read < $raw_salt_len) {
+ $buffer .= fread($f, $raw_salt_len - $read);
+ $read = strlen($buffer);
+ }
+ fclose($f);
+ if ($read >= $raw_salt_len) {
+ $buffer_valid = true;
+ }
+ }
+
+ if (!$buffer_valid || strlen($buffer) < $raw_salt_len) {
+ $bl = strlen($buffer);
+ for ($i = 0; $i < $raw_salt_len; $i++) {
+ if ($i < $bl) {
+ $buffer[$i] = $buffer[$i] ^ chr(mt_rand(0, 255));
+ } else {
+ $buffer .= chr(mt_rand(0, 255));
+ }
+ }
+ }
+
+ $salt = $buffer;
+
+ // encode string with the Base64 variant used by crypt
+ $base64_digits = 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/';
+ $bcrypt64_digits = './ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789';
+ $base64_string = base64_encode($salt);
+ $salt = strtr(rtrim($base64_string, '='), $base64_digits, $bcrypt64_digits);
+
+ $salt = substr($salt, 0, $this->salt_length);
+
+
+ return $salt;
+
+ }
+
+ /**
+ * Activation functions
+ *
+ * Activate : Validates and removes activation code.
+ * Deactivate : Updates a users row with an activation code.
+ *
+ * @author Mathew
+ */
+
+ /**
+ * activate
+ *
+ * @return void
+ * @author Mathew
+ **/
+ public function activate($id, $code = false)
+ {
+ $this->trigger_events('pre_activate');
+
+ if ($code !== FALSE)
+ {
+ $query = $this->db->select($this->identity_column)
+ ->where('activation_code', $code)
+ ->where('id', $id)
+ ->limit(1)
+ ->order_by('id', 'desc')
+ ->get($this->tables['users']);
+
+ $result = $query->row();
+
+ if ($query->num_rows() !== 1)
+ {
+ $this->trigger_events(array('post_activate', 'post_activate_unsuccessful'));
+ $this->set_error('activate_unsuccessful');
+ return FALSE;
+ }
+
+ $data = array(
+ 'activation_code' => NULL,
+ 'active' => 1
+ );
+
+ $this->trigger_events('extra_where');
+ $this->db->update($this->tables['users'], $data, array('id' => $id));
+ }
+ else
+ {
+ $data = array(
+ 'activation_code' => NULL,
+ 'active' => 1
+ );
+
+
+ $this->trigger_events('extra_where');
+ $this->db->update($this->tables['users'], $data, array('id' => $id));
+ }
+
+
+ $return = $this->db->affected_rows() == 1;
+ if ($return)
+ {
+ $this->trigger_events(array('post_activate', 'post_activate_successful'));
+ $this->set_message('activate_successful');
+ }
+ else
+ {
+ $this->trigger_events(array('post_activate', 'post_activate_unsuccessful'));
+ $this->set_error('activate_unsuccessful');
+ }
+
+
+ return $return;
+ }
+
+
+ /**
+ * Deactivate
+ *
+ * @return void
+ * @author Mathew
+ **/
+ public function deactivate($id = NULL)
+ {
+ $this->trigger_events('deactivate');
+
+ if (!isset($id))
+ {
+ $this->set_error('deactivate_unsuccessful');
+ return FALSE;
+ }
+
+ $activation_code = sha1(md5(microtime()));
+ $this->activation_code = $activation_code;
+
+ $data = array(
+ 'activation_code' => $activation_code,
+ 'active' => 0
+ );
+
+ $this->trigger_events('extra_where');
+ $this->db->update($this->tables['users'], $data, array('id' => $id));
+
+ $return = $this->db->affected_rows() == 1;
+ if ($return)
+ $this->set_message('deactivate_successful');
+ else
+ $this->set_error('deactivate_unsuccessful');
+
+ return $return;
+ }
+
+ public function clear_forgotten_password_code($code) {
+
+ if (empty($code))
+ {
+ return FALSE;
+ }
+
+ $this->db->where('forgotten_password_code', $code);
+
+ if ($this->db->count_all_results($this->tables['users']) > 0)
+ {
+ $data = array(
+ 'forgotten_password_code' => NULL,
+ 'forgotten_password_time' => NULL
+ );
+
+ $this->db->update($this->tables['users'], $data, array('forgotten_password_code' => $code));
+
+ return TRUE;
+ }
+
+ return FALSE;
+ }
+
+ /**
+ * reset password
+ *
+ * @return bool
+ * @author Mathew
+ **/
+ public function reset_password($identity, $new) {
+ $this->trigger_events('pre_change_password');
+
+ if (!$this->identity_check($identity)) {
+ $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
+ return FALSE;
+ }
+
+ $this->trigger_events('extra_where');
+
+ $query = $this->db->select('id, password, salt')
+ ->where($this->identity_column, $identity)
+ ->limit(1)
+ ->order_by('id', 'desc')
+ ->get($this->tables['users']);
+
+ if ($query->num_rows() !== 1)
+ {
+ $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
+ $this->set_error('password_change_unsuccessful');
+ return FALSE;
+ }
+
+ $result = $query->row();
+
+ $new = $this->hash_password($new, $result->salt);
+
+ // store the new password and reset the remember code so all remembered instances have to re-login
+ // also clear the forgotten password code
+ $data = array(
+ 'password' => $new,
+ 'remember_code' => NULL,
+ 'forgotten_password_code' => NULL,
+ 'forgotten_password_time' => NULL,
+ );
+
+ $this->trigger_events('extra_where');
+ $this->db->update($this->tables['users'], $data, array($this->identity_column => $identity));
+
+ $return = $this->db->affected_rows() == 1;
+ if ($return)
+ {
+ $this->trigger_events(array('post_change_password', 'post_change_password_successful'));
+ $this->set_message('password_change_successful');
+ }
+ else
+ {
+ $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
+ $this->set_error('password_change_unsuccessful');
+ }
+
+ return $return;
+ }
+
+ /**
+ * change password
+ *
+ * @return bool
+ * @author Mathew
+ **/
+ public function change_password($identity, $old, $new)
+ {
+ $this->trigger_events('pre_change_password');
+
+ $this->trigger_events('extra_where');
+
+ $query = $this->db->select('id, password, salt')
+ ->where($this->identity_column, $identity)
+ ->limit(1)
+ ->order_by('id', 'desc')
+ ->get($this->tables['users']);
+
+ if ($query->num_rows() !== 1)
+ {
+ $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
+ $this->set_error('password_change_unsuccessful');
+ return FALSE;
+ }
+
+ $user = $query->row();
+
+ $old_password_matches = $this->hash_password_db($user->id, $old);
+
+ if ($old_password_matches === TRUE)
+ {
+ // store the new password and reset the remember code so all remembered instances have to re-login
+ $hashed_new_password = $this->hash_password($new, $user->salt);
+ $data = array(
+ 'password' => $hashed_new_password,
+ 'remember_code' => NULL,
+ );
+
+ $this->trigger_events('extra_where');
+
+ $successfully_changed_password_in_db = $this->db->update($this->tables['users'], $data, array($this->identity_column => $identity));
+ if ($successfully_changed_password_in_db)
+ {
+ $this->trigger_events(array('post_change_password', 'post_change_password_successful'));
+ $this->set_message('password_change_successful');
+ }
+ else
+ {
+ $this->trigger_events(array('post_change_password', 'post_change_password_unsuccessful'));
+ $this->set_error('password_change_unsuccessful');
+ }
+
+ return $successfully_changed_password_in_db;
+ }
+
+ $this->set_error('password_change_unsuccessful');
+ return FALSE;
+ }
+
+ /**
+ * Checks username
+ *
+ * @return bool
+ * @author Mathew
+ **/
+ public function username_check($username = '')
+ {
+ $this->trigger_events('username_check');
+
+ if (empty($username))
+ {
+ return FALSE;
+ }
+
+ $this->trigger_events('extra_where');
+
+ return $this->db->where('username', $username)
+ ->group_by("id")
+ ->order_by("id", "ASC")
+ ->limit(1)
+ ->count_all_results($this->tables['users']) > 0;
+ }
+
+ /**
+ * Checks email
+ *
+ * @return bool
+ * @author Mathew
+ **/
+ public function email_check($email = '')
+ {
+ $this->trigger_events('email_check');
+
+ if (empty($email))
+ {
+ return FALSE;
+ }
+
+ $this->trigger_events('extra_where');
+
+ return $this->db->where('email', $email)
+ ->group_by("id")
+ ->order_by("id", "ASC")
+ ->limit(1)
+ ->count_all_results($this->tables['users']) > 0;
+ }
+
+ /**
+ * Identity check
+ *
+ * @return bool
+ * @author Mathew
+ **/
+ public function identity_check($identity = '')
+ {
+ $this->trigger_events('identity_check');
+
+ if (empty($identity))
+ {
+ return FALSE;
+ }
+
+ return $this->db->where($this->identity_column, $identity)
+ ->count_all_results($this->tables['users']) > 0;
+ }
+
+ /**
+ * Insert a forgotten password key.
+ *
+ * @return bool
+ * @author Mathew
+ * @updated Ryan
+ * @updated 52aa456eef8b60ad6754b31fbdcc77bb
+ **/
+ public function forgotten_password($identity)
+ {
+ if (empty($identity))
+ {
+ $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful'));
+ return FALSE;
+ }
+
+ // All some more randomness
+ $activation_code_part = "";
+ if(function_exists("openssl_random_pseudo_bytes")) {
+ $activation_code_part = openssl_random_pseudo_bytes(128);
+ }
+
+ for($i=0;$i<1024;$i++) {
+ $activation_code_part = sha1($activation_code_part . mt_rand() . microtime());
+ }
+
+ $key = $this->hash_code($activation_code_part.$identity);
+
+ // If enable query strings is set, then we need to replace any unsafe characters so that the code can still work
+ if ($key != '' && $this->config->item('permitted_uri_chars') != '' && $this->config->item('enable_query_strings') == FALSE)
+ {
+ // preg_quote() in PHP 5.3 escapes -, so the str_replace() and addition of - to preg_quote() is to maintain backwards
+ // compatibility as many are unaware of how characters in the permitted_uri_chars will be parsed as a regex pattern
+ if ( ! preg_match("|^[".str_replace(array('\\-', '\-'), '-', preg_quote($this->config->item('permitted_uri_chars'), '-'))."]+$|i", $key))
+ {
+ $key = preg_replace("/[^".$this->config->item('permitted_uri_chars')."]+/i", "-", $key);
+ }
+ }
+
+ $this->forgotten_password_code = $key;
+
+ $this->trigger_events('extra_where');
+
+ $update = array(
+ 'forgotten_password_code' => $key,
+ 'forgotten_password_time' => time()
+ );
+
+ $this->db->update($this->tables['users'], $update, array($this->identity_column => $identity));
+
+ $return = $this->db->affected_rows() == 1;
+
+ if ($return)
+ $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_successful'));
+ else
+ $this->trigger_events(array('post_forgotten_password', 'post_forgotten_password_unsuccessful'));
+
+ return $return;
+ }
+
+ /**
+ * Forgotten Password Complete
+ *
+ * @return string
+ * @author Mathew
+ **/
+ public function forgotten_password_complete($code, $salt=FALSE)
+ {
+ $this->trigger_events('pre_forgotten_password_complete');
+
+ if (empty($code))
+ {
+ $this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_unsuccessful'));
+ return FALSE;
+ }
+
+ $profile = $this->where('forgotten_password_code', $code)->users()->row(); //pass the code to profile
+
+ if ($profile) {
+
+ if ($this->config->item('forgot_password_expiration', 'ion_auth') > 0) {
+ //Make sure it isn't expired
+ $expiration = $this->config->item('forgot_password_expiration', 'ion_auth');
+ if (time() - $profile->forgotten_password_time > $expiration) {
+ //it has expired
+ $this->set_error('forgot_password_expired');
+ $this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_unsuccessful'));
+ return FALSE;
+ }
+ }
+
+ $password = $this->salt();
+
+ $data = array(
+ 'password' => $this->hash_password($password, $salt),
+ 'forgotten_password_code' => NULL,
+ 'active' => 1,
+ );
+
+ $this->db->update($this->tables['users'], $data, array('forgotten_password_code' => $code));
+
+ $this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_successful'));
+ return $password;
+ }
+
+ $this->trigger_events(array('post_forgotten_password_complete', 'post_forgotten_password_complete_unsuccessful'));
+ return FALSE;
+ }
+
+ /**
+ * register
+ *
+ * @return bool
+ * @author Mathew
+ **/
+ public function register($identity, $password, $email, $additional_data = array(), $groups = array())
+ {
+ $this->trigger_events('pre_register');
+
+ $manual_activation = $this->config->item('manual_activation', 'ion_auth');
+
+ if ($this->identity_check($identity))
+ {
+ $this->set_error('account_creation_duplicate_identity');
+ return FALSE;
+ }
+ elseif ( !$this->config->item('default_group', 'ion_auth') && empty($groups) )
+ {
+ $this->set_error('account_creation_missing_default_group');
+ return FALSE;
+ }
+
+ // check if the default set in config exists in database
+ $query = $this->db->get_where($this->tables['groups'],array('name' => $this->config->item('default_group', 'ion_auth')),1)->row();
+ if( !isset($query->id) && empty($groups) )
+ {
+ $this->set_error('account_creation_invalid_default_group');
+ return FALSE;
+ }
+
+ // capture default group details
+ $default_group = $query;
+
+ // IP Address
+ $ip_address = $this->_prepare_ip($this->input->ip_address());
+ $salt = $this->store_salt ? $this->salt() : FALSE;
+ $password = $this->hash_password($password, $salt);
+
+ // Users table.
+ $data = array(
+ $this->identity_column => $identity,
+ 'password' => $password,
+ 'email' => $email,
+ 'ip_address' => $ip_address,
+ 'created_on' => time(),
+ 'active' => ($manual_activation === false ? 1 : 0)
+ );
+
+ if ($this->store_salt)
+ {
+ $data['salt'] = $salt;
+ }
+
+ // filter out any data passed that doesnt have a matching column in the users table
+ // and merge the set user data and the additional data
+ $user_data = array_merge($this->_filter_data($this->tables['users'], $additional_data), $data);
+
+ $this->trigger_events('extra_set');
+
+ $this->db->insert($this->tables['users'], $user_data);
+
+ $id = $this->db->insert_id();
+
+ // add in groups array if it doesn't exists and stop adding into default group if default group ids are set
+ if( isset($default_group->id) && empty($groups) )
+ {
+ $groups[] = $default_group->id;
+ }
+
+ if (!empty($groups))
+ {
+ // add to groups
+ foreach ($groups as $group)
+ {
+ $this->add_to_group($group, $id);
+ }
+ }
+
+ $this->trigger_events('post_register');
+
+ return (isset($id)) ? $id : FALSE;
+ }
+
+ /**
+ * login
+ *
+ * @return bool
+ * @author Mathew
+ **/
+ public function login($identity, $password, $remember=FALSE)
+ {
+ $this->trigger_events('pre_login');
+
+ if (empty($identity) || empty($password))
+ {
+ $this->set_error('login_unsuccessful');
+ return FALSE;
+ }
+
+ $this->trigger_events('extra_where');
+
+ $query = $this->db->select($this->identity_column . ', email, id, password, active, last_login')
+ ->where($this->identity_column, $identity)
+ ->limit(1)
+ ->order_by('id', 'desc')
+ ->get($this->tables['users']);
+
+ if($this->is_time_locked_out($identity))
+ {
+ // Hash something anyway, just to take up time
+ $this->hash_password($password);
+
+ $this->trigger_events('post_login_unsuccessful');
+ $this->set_error('login_timeout');
+
+ return FALSE;
+ }
+
+ if ($query->num_rows() === 1)
+ {
+ $user = $query->row();
+
+ $password = $this->hash_password_db($user->id, $password);
+
+ if ($password === TRUE)
+ {
+ if ($user->active == 0)
+ {
+ $this->trigger_events('post_login_unsuccessful');
+ $this->set_error('login_unsuccessful_not_active');
+
+ return FALSE;
+ }
+
+ $this->set_session($user);
+
+ $this->update_last_login($user->id);
+
+ $this->clear_login_attempts($identity);
+
+ if ($remember && $this->config->item('remember_users', 'ion_auth'))
+ {
+ $this->remember_user($user->id);
+ }
+
+ $this->trigger_events(array('post_login', 'post_login_successful'));
+ $this->set_message('login_successful');
+
+ return TRUE;
+ }
+ }
+
+ // Hash something anyway, just to take up time
+ $this->hash_password($password);
+
+ $this->increase_login_attempts($identity);
+
+ $this->trigger_events('post_login_unsuccessful');
+ $this->set_error('login_unsuccessful');
+
+ return FALSE;
+ }
+
+ /**
+ * is_max_login_attempts_exceeded
+ * Based on code from Tank Auth, by Ilya Konyukhov (https://github.com/ilkon/Tank-Auth)
+ *
+ * @param string $identity
+ * @return boolean
+ **/
+ public function is_max_login_attempts_exceeded($identity) {
+ if ($this->config->item('track_login_attempts', 'ion_auth')) {
+ $max_attempts = $this->config->item('maximum_login_attempts', 'ion_auth');
+ if ($max_attempts > 0) {
+ $attempts = $this->get_attempts_num($identity);
+ return $attempts >= $max_attempts;
+ }
+ }
+ return FALSE;
+ }
+
+ /**
+ * Get number of attempts to login occured from given IP-address or identity
+ * Based on code from Tank Auth, by Ilya Konyukhov (https://github.com/ilkon/Tank-Auth)
+ *
+ * @param string $identity
+ * @return int
+ */
+ public function get_attempts_num($identity)
+ {
+ if ($this->config->item('track_login_attempts', 'ion_auth')) {
+ $ip_address = $this->_prepare_ip($this->input->ip_address());
+ $this->db->select('1', FALSE);
+ if ($this->config->item('track_login_ip_address', 'ion_auth')) {
+ $this->db->where('ip_address', $ip_address);
+ $this->db->where('login', $identity);
+ } else if (strlen($identity) > 0) $this->db->or_where('login', $identity);
+ $qres = $this->db->get($this->tables['login_attempts']);
+ return $qres->num_rows();
+ }
+ return 0;
+ }
+
+ /**
+ * Get a boolean to determine if an account should be locked out due to
+ * exceeded login attempts within a given period
+ *
+ * @return boolean
+ */
+ public function is_time_locked_out($identity) {
+
+ return $this->is_max_login_attempts_exceeded($identity) && $this->get_last_attempt_time($identity) > time() - $this->config->item('lockout_time', 'ion_auth');
+ }
+
+ /**
+ * Get the time of the last time a login attempt occured from given IP-address or identity
+ *
+ * @param string $identity
+ * @return int
+ */
+ public function get_last_attempt_time($identity) {
+ if ($this->config->item('track_login_attempts', 'ion_auth')) {
+ $ip_address = $this->_prepare_ip($this->input->ip_address());
+
+ $this->db->select('time');
+ if ($this->config->item('track_login_ip_address', 'ion_auth')) $this->db->where('ip_address', $ip_address);
+ else if (strlen($identity) > 0) $this->db->or_where('login', $identity);
+ $this->db->order_by('id', 'desc');
+ $qres = $this->db->get($this->tables['login_attempts'], 1);
+
+ if($qres->num_rows() > 0) {
+ return $qres->row()->time;
+ }
+ }
+
+ return 0;
+ }
+
+ /**
+ * increase_login_attempts
+ * Based on code from Tank Auth, by Ilya Konyukhov (https://github.com/ilkon/Tank-Auth)
+ *
+ * @param string $identity
+ **/
+ public function increase_login_attempts($identity) {
+ if ($this->config->item('track_login_attempts', 'ion_auth')) {
+ $ip_address = $this->_prepare_ip($this->input->ip_address());
+ return $this->db->insert($this->tables['login_attempts'], array('ip_address' => $ip_address, 'login' => $identity, 'time' => time()));
+ }
+ return FALSE;
+ }
+
+ /**
+ * clear_login_attempts
+ * Based on code from Tank Auth, by Ilya Konyukhov (https://github.com/ilkon/Tank-Auth)
+ *
+ * @param string $identity
+ **/
+ public function clear_login_attempts($identity, $expire_period = 86400) {
+ if ($this->config->item('track_login_attempts', 'ion_auth')) {
+ $ip_address = $this->_prepare_ip($this->input->ip_address());
+
+ $this->db->where(array('ip_address' => $ip_address, 'login' => $identity));
+ // Purge obsolete login attempts
+ $this->db->or_where('time <', time() - $expire_period, FALSE);
+
+ return $this->db->delete($this->tables['login_attempts']);
+ }
+ return FALSE;
+ }
+
+ public function limit($limit)
+ {
+ $this->trigger_events('limit');
+ $this->_ion_limit = $limit;
+
+ return $this;
+ }
+
+ public function offset($offset)
+ {
+ $this->trigger_events('offset');
+ $this->_ion_offset = $offset;
+
+ return $this;
+ }
+
+ public function where($where, $value = NULL)
+ {
+ $this->trigger_events('where');
+
+ if (!is_array($where))
+ {
+ $where = array($where => $value);
+ }
+
+ array_push($this->_ion_where, $where);
+
+ return $this;
+ }
+
+ public function like($like, $value = NULL, $position = 'both')
+ {
+ $this->trigger_events('like');
+
+ if (!is_array($like))
+ {
+ $like = array($like => array(
+ 'value' => $value,
+ 'position' => $position,
+ ));
+ }
+
+ array_push($this->_ion_like, $like);
+
+ return $this;
+ }
+
+ public function select($select)
+ {
+ $this->trigger_events('select');
+
+ $this->_ion_select[] = $select;
+
+ return $this;
+ }
+
+ public function order_by($by, $order='desc')
+ {
+ $this->trigger_events('order_by');
+
+ $this->_ion_order_by = $by;
+ $this->_ion_order = $order;
+
+ return $this;
+ }
+
+ public function row()
+ {
+ $this->trigger_events('row');
+
+ $row = $this->response->row();
+
+ return $row;
+ }
+
+ public function row_array()
+ {
+ $this->trigger_events(array('row', 'row_array'));
+
+ $row = $this->response->row_array();
+
+ return $row;
+ }
+
+ public function result()
+ {
+ $this->trigger_events('result');
+
+ $result = $this->response->result();
+
+ return $result;
+ }
+
+ public function result_array()
+ {
+ $this->trigger_events(array('result', 'result_array'));
+
+ $result = $this->response->result_array();
+
+ return $result;
+ }
+
+ public function num_rows()
+ {
+ $this->trigger_events(array('num_rows'));
+
+ $result = $this->response->num_rows();
+
+ return $result;
+ }
+
+ /**
+ * users
+ *
+ * @return object Users
+ * @author Ben Edmunds
+ **/
+ public function users($groups = NULL)
+ {
+ $this->trigger_events('users');
+
+ if (isset($this->_ion_select) && !empty($this->_ion_select))
+ {
+ foreach ($this->_ion_select as $select)
+ {
+ $this->db->select($select);
+ }
+
+ $this->_ion_select = array();
+ }
+ else
+ {
+ //default selects
+ $this->db->select(array(
+ $this->tables['users'].'.*',
+ $this->tables['users'].'.id as id',
+ $this->tables['users'].'.id as user_id'
+ ));
+ }
+
+ // filter by group id(s) if passed
+ if (isset($groups))
+ {
+ // build an array if only one group was passed
+ if (!is_array($groups))
+ {
+ $groups = Array($groups);
+ }
+
+ // join and then run a where_in against the group ids
+ if (isset($groups) && !empty($groups))
+ {
+ $this->db->distinct();
+ $this->db->join(
+ $this->tables['users_groups'],
+ $this->tables['users_groups'].'.'.$this->join['users'].'='.$this->tables['users'].'.id',
+ 'inner'
+ );
+ }
+
+ // verify if group name or group id was used and create and put elements in different arrays
+ $group_ids = array();
+ $group_names = array();
+ foreach($groups as $group)
+ {
+ if(is_numeric($group)) $group_ids[] = $group;
+ else $group_names[] = $group;
+ }
+ $or_where_in = (!empty($group_ids) && !empty($group_names)) ? 'or_where_in' : 'where_in';
+ // if group name was used we do one more join with groups
+ if(!empty($group_names))
+ {
+ $this->db->join($this->tables['groups'], $this->tables['users_groups'] . '.' . $this->join['groups'] . ' = ' . $this->tables['groups'] . '.id', 'inner');
+ $this->db->where_in($this->tables['groups'] . '.name', $group_names);
+ }
+ if(!empty($group_ids))
+ {
+ $this->db->{$or_where_in}($this->tables['users_groups'].'.'.$this->join['groups'], $group_ids);
+ }
+ }
+
+ $this->trigger_events('extra_where');
+
+ // run each where that was passed
+ if (isset($this->_ion_where) && !empty($this->_ion_where))
+ {
+ foreach ($this->_ion_where as $where)
+ {
+ $this->db->where($where);
+ }
+
+ $this->_ion_where = array();
+ }
+
+ if (isset($this->_ion_like) && !empty($this->_ion_like))
+ {
+ foreach ($this->_ion_like as $like)
+ {
+ $this->db->or_like($like);
+ }
+
+ $this->_ion_like = array();
+ }
+
+ if (isset($this->_ion_limit) && isset($this->_ion_offset))
+ {
+ $this->db->limit($this->_ion_limit, $this->_ion_offset);
+
+ $this->_ion_limit = NULL;
+ $this->_ion_offset = NULL;
+ }
+ else if (isset($this->_ion_limit))
+ {
+ $this->db->limit($this->_ion_limit);
+
+ $this->_ion_limit = NULL;
+ }
+
+ // set the order
+ if (isset($this->_ion_order_by) && isset($this->_ion_order))
+ {
+ $this->db->order_by($this->_ion_order_by, $this->_ion_order);
+
+ $this->_ion_order = NULL;
+ $this->_ion_order_by = NULL;
+ }
+
+ $this->response = $this->db->get($this->tables['users']);
+
+ return $this;
+ }
+
+ /**
+ * user
+ *
+ * @return object
+ * @author Ben Edmunds
+ **/
+ public function user($id = NULL)
+ {
+ $this->trigger_events('user');
+
+ // if no id was passed use the current users id
+ $id = isset($id) ? $id : $this->session->userdata('user_id');
+
+ $this->limit(1);
+ $this->order_by($this->tables['users'].'.id', 'desc');
+ $this->where($this->tables['users'].'.id', $id);
+
+ $this->users();
+
+ return $this;
+ }
+
+ /**
+ * get_users_groups
+ *
+ * @return array
+ * @author Ben Edmunds
+ **/
+ public function get_users_groups($id=FALSE)
+ {
+ $this->trigger_events('get_users_group');
+
+ // if no id was passed use the current users id
+ $id || $id = $this->session->userdata('user_id');
+
+ return $this->db->select($this->tables['users_groups'].'.'.$this->join['groups'].' as id, '.$this->tables['groups'].'.name, '.$this->tables['groups'].'.description')
+ ->where($this->tables['users_groups'].'.'.$this->join['users'], $id)
+ ->join($this->tables['groups'], $this->tables['users_groups'].'.'.$this->join['groups'].'='.$this->tables['groups'].'.id')
+ ->get($this->tables['users_groups']);
+ }
+
+ /**
+ * add_to_group
+ *
+ * @return bool
+ * @author Ben Edmunds
+ **/
+ public function add_to_group($group_ids, $user_id=false)
+ {
+ $this->trigger_events('add_to_group');
+
+ // if no id was passed use the current users id
+ $user_id || $user_id = $this->session->userdata('user_id');
+
+ if(!is_array($group_ids))
+ {
+ $group_ids = array($group_ids);
+ }
+
+ $return = 0;
+
+ // Then insert each into the database
+ foreach ($group_ids as $group_id)
+ {
+ if ($this->db->insert($this->tables['users_groups'], array( $this->join['groups'] => (float)$group_id, $this->join['users'] => (float)$user_id)))
+ {
+ if (isset($this->_cache_groups[$group_id])) {
+ $group_name = $this->_cache_groups[$group_id];
+ }
+ else {
+ $group = $this->group($group_id)->result();
+ $group_name = $group[0]->name;
+ $this->_cache_groups[$group_id] = $group_name;
+ }
+ $this->_cache_user_in_group[$user_id][$group_id] = $group_name;
+
+ // Return the number of groups added
+ $return += 1;
+ }
+ }
+
+ return $return;
+ }
+
+ /**
+ * remove_from_group
+ *
+ * @return bool
+ * @author Ben Edmunds
+ **/
+ public function remove_from_group($group_ids=false, $user_id=false)
+ {
+ $this->trigger_events('remove_from_group');
+
+ // user id is required
+ if(empty($user_id))
+ {
+ return FALSE;
+ }
+
+ // if group id(s) are passed remove user from the group(s)
+ if( ! empty($group_ids))
+ {
+ if(!is_array($group_ids))
+ {
+ $group_ids = array($group_ids);
+ }
+
+ foreach($group_ids as $group_id)
+ {
+ $this->db->delete($this->tables['users_groups'], array($this->join['groups'] => (float)$group_id, $this->join['users'] => (float)$user_id));
+ if (isset($this->_cache_user_in_group[$user_id]) && isset($this->_cache_user_in_group[$user_id][$group_id]))
+ {
+ unset($this->_cache_user_in_group[$user_id][$group_id]);
+ }
+ }
+
+ $return = TRUE;
+ }
+ // otherwise remove user from all groups
+ else
+ {
+ if ($return = $this->db->delete($this->tables['users_groups'], array($this->join['users'] => (float)$user_id))) {
+ $this->_cache_user_in_group[$user_id] = array();
+ }
+ }
+ return $return;
+ }
+
+ /**
+ * groups
+ *
+ * @return object
+ * @author Ben Edmunds
+ **/
+ public function groups()
+ {
+ $this->trigger_events('groups');
+
+ // run each where that was passed
+ if (isset($this->_ion_where) && !empty($this->_ion_where))
+ {
+ foreach ($this->_ion_where as $where)
+ {
+ $this->db->where($where);
+ }
+ $this->_ion_where = array();
+ }
+
+ if (isset($this->_ion_limit) && isset($this->_ion_offset))
+ {
+ $this->db->limit($this->_ion_limit, $this->_ion_offset);
+
+ $this->_ion_limit = NULL;
+ $this->_ion_offset = NULL;
+ }
+ else if (isset($this->_ion_limit))
+ {
+ $this->db->limit($this->_ion_limit);
+
+ $this->_ion_limit = NULL;
+ }
+
+ // set the order
+ if (isset($this->_ion_order_by) && isset($this->_ion_order))
+ {
+ $this->db->order_by($this->_ion_order_by, $this->_ion_order);
+ }
+
+ $this->response = $this->db->get($this->tables['groups']);
+
+ return $this;
+ }
+
+ /**
+ * group
+ *
+ * @return object
+ * @author Ben Edmunds
+ **/
+ public function group($id = NULL)
+ {
+ $this->trigger_events('group');
+
+ if (isset($id))
+ {
+ $this->where($this->tables['groups'].'.id', $id);
+ }
+
+ $this->limit(1);
+ $this->order_by('id', 'desc');
+
+ return $this->groups();
+ }
+
+ /**
+ * update
+ *
+ * @return bool
+ * @author Phil Sturgeon
+ **/
+ public function update($id, array $data)
+ {
+ $this->trigger_events('pre_update_user');
+
+ $user = $this->user($id)->row();
+
+ $this->db->trans_begin();
+
+ if (array_key_exists($this->identity_column, $data) && $this->identity_check($data[$this->identity_column]) && $user->{$this->identity_column} !== $data[$this->identity_column])
+ {
+ $this->db->trans_rollback();
+ $this->set_error('account_creation_duplicate_identity');
+
+ $this->trigger_events(array('post_update_user', 'post_update_user_unsuccessful'));
+ $this->set_error('update_unsuccessful');
+
+ return FALSE;
+ }
+
+ // Filter the data passed
+ $data = $this->_filter_data($this->tables['users'], $data);
+
+ if (array_key_exists($this->identity_column, $data) || array_key_exists('password', $data) || array_key_exists('email', $data))
+ {
+ if (array_key_exists('password', $data))
+ {
+ if( ! empty($data['password']))
+ {
+ $data['password'] = $this->hash_password($data['password'], $user->salt);
+ }
+ else
+ {
+ // unset password so it doesn't effect database entry if no password passed
+ unset($data['password']);
+ }
+ }
+ }
+
+ $this->trigger_events('extra_where');
+ $this->db->update($this->tables['users'], $data, array('id' => $user->id));
+
+ if ($this->db->trans_status() === FALSE)
+ {
+ $this->db->trans_rollback();
+
+ $this->trigger_events(array('post_update_user', 'post_update_user_unsuccessful'));
+ $this->set_error('update_unsuccessful');
+ return FALSE;
+ }
+
+ $this->db->trans_commit();
+
+ $this->trigger_events(array('post_update_user', 'post_update_user_successful'));
+ $this->set_message('update_successful');
+ return TRUE;
+ }
+
+ /**
+ * delete_user
+ *
+ * @return bool
+ * @author Phil Sturgeon
+ **/
+ public function delete_user($id)
+ {
+ $this->trigger_events('pre_delete_user');
+
+ $this->db->trans_begin();
+
+ // remove user from groups
+ $this->remove_from_group(NULL, $id);
+
+ // delete user from users table should be placed after remove from group
+ $this->db->delete($this->tables['users'], array('id' => $id));
+
+ // if user does not exist in database then it returns FALSE else removes the user from groups
+ if ($this->db->affected_rows() <= 0)
+ {
+ return FALSE;
+ }
+
+ if ($this->db->trans_status() === FALSE)
+ {
+ $this->db->trans_rollback();
+ $this->trigger_events(array('post_delete_user', 'post_delete_user_unsuccessful'));
+ $this->set_error('delete_unsuccessful');
+ return FALSE;
+ }
+
+ $this->db->trans_commit();
+
+ $this->trigger_events(array('post_delete_user', 'post_delete_user_successful'));
+ $this->set_message('delete_successful');
+ return TRUE;
+ }
+
+ /**
+ * update_last_login
+ *
+ * @return bool
+ * @author Ben Edmunds
+ **/
+ public function update_last_login($id)
+ {
+ $this->trigger_events('update_last_login');
+
+ $this->load->helper('date');
+
+ $this->trigger_events('extra_where');
+
+ $this->db->update($this->tables['users'], array('last_login' => time()), array('id' => $id));
+
+ return $this->db->affected_rows() == 1;
+ }
+
+ /**
+ * set_lang
+ *
+ * @return bool
+ * @author Ben Edmunds
+ **/
+ public function set_lang($lang = 'en')
+ {
+ $this->trigger_events('set_lang');
+
+ // if the user_expire is set to zero we'll set the expiration two years from now.
+ if($this->config->item('user_expire', 'ion_auth') === 0)
+ {
+ $expire = (60*60*24*365*2);
+ }
+ // otherwise use what is set
+ else
+ {
+ $expire = $this->config->item('user_expire', 'ion_auth');
+ }
+
+ set_cookie(array(
+ 'name' => 'lang_code',
+ 'value' => $lang,
+ 'expire' => $expire
+ ));
+
+ return TRUE;
+ }
+
+ /**
+ * set_session
+ *
+ * @return bool
+ * @author jrmadsen67
+ **/
+ public function set_session($user)
+ {
+
+ $this->trigger_events('pre_set_session');
+
+ $session_data = array(
+ 'identity' => $user->{$this->identity_column},
+ $this->identity_column => $user->{$this->identity_column},
+ 'email' => $user->email,
+ 'user_id' => $user->id, //everyone likes to overwrite id so we'll use user_id
+ 'old_last_login' => $user->last_login
+ );
+
+ $this->session->set_userdata($session_data);
+
+ $this->trigger_events('post_set_session');
+
+ return TRUE;
+ }
+
+ /**
+ * remember_user
+ *
+ * @return bool
+ * @author Ben Edmunds
+ **/
+ public function remember_user($id)
+ {
+ $this->trigger_events('pre_remember_user');
+
+ if (!$id)
+ {
+ return FALSE;
+ }
+
+ $user = $this->user($id)->row();
+
+ $salt = $this->salt();
+
+ $this->db->update($this->tables['users'], array('remember_code' => $salt), array('id' => $id));
+
+ if ($this->db->affected_rows() > -1)
+ {
+ // if the user_expire is set to zero we'll set the expiration two years from now.
+ if($this->config->item('user_expire', 'ion_auth') === 0)
+ {
+ $expire = (60*60*24*365*2);
+ }
+ // otherwise use what is set
+ else
+ {
+ $expire = $this->config->item('user_expire', 'ion_auth');
+ }
+
+ set_cookie(array(
+ 'name' => $this->config->item('identity_cookie_name', 'ion_auth'),
+ 'value' => $user->{$this->identity_column},
+ 'expire' => $expire
+ ));
+
+ set_cookie(array(
+ 'name' => $this->config->item('remember_cookie_name', 'ion_auth'),
+ 'value' => $salt,
+ 'expire' => $expire
+ ));
+
+ $this->trigger_events(array('post_remember_user', 'remember_user_successful'));
+ return TRUE;
+ }
+
+ $this->trigger_events(array('post_remember_user', 'remember_user_unsuccessful'));
+ return FALSE;
+ }
+
+ /**
+ * login_remembed_user
+ *
+ * @return bool
+ * @author Ben Edmunds
+ **/
+ public function login_remembered_user()
+ {
+ $this->trigger_events('pre_login_remembered_user');
+
+ // check for valid data
+ if (!get_cookie($this->config->item('identity_cookie_name', 'ion_auth'))
+ || !get_cookie($this->config->item('remember_cookie_name', 'ion_auth'))
+ || !$this->identity_check(get_cookie($this->config->item('identity_cookie_name', 'ion_auth'))))
+ {
+ $this->trigger_events(array('post_login_remembered_user', 'post_login_remembered_user_unsuccessful'));
+ return FALSE;
+ }
+
+ // get the user
+ $this->trigger_events('extra_where');
+ $query = $this->db->select($this->identity_column.', id, email, last_login')
+ ->where($this->identity_column, get_cookie($this->config->item('identity_cookie_name', 'ion_auth')))
+ ->where('remember_code', get_cookie($this->config->item('remember_cookie_name', 'ion_auth')))
+ ->limit(1)
+ ->order_by('id', 'desc')
+ ->get($this->tables['users']);
+
+ // if the user was found, sign them in
+ if ($query->num_rows() == 1)
+ {
+ $user = $query->row();
+
+ $this->update_last_login($user->id);
+
+ $this->set_session($user);
+
+ // extend the users cookies if the option is enabled
+ if ($this->config->item('user_extend_on_login', 'ion_auth'))
+ {
+ $this->remember_user($user->id);
+ }
+
+ $this->trigger_events(array('post_login_remembered_user', 'post_login_remembered_user_successful'));
+ return TRUE;
+ }
+
+ $this->trigger_events(array('post_login_remembered_user', 'post_login_remembered_user_unsuccessful'));
+ return FALSE;
+ }
+
+
+ /**
+ * create_group
+ *
+ * @author aditya menon
+ */
+ public function create_group($group_name = FALSE, $group_description = '', $additional_data = array())
+ {
+ // bail if the group name was not passed
+ if(!$group_name)
+ {
+ $this->set_error('group_name_required');
+ return FALSE;
+ }
+
+ // bail if the group name already exists
+ $existing_group = $this->db->get_where($this->tables['groups'], array('name' => $group_name))->num_rows();
+ if($existing_group !== 0)
+ {
+ $this->set_error('group_already_exists');
+ return FALSE;
+ }
+
+ $data = array('name'=>$group_name,'description'=>$group_description);
+
+ // filter out any data passed that doesnt have a matching column in the groups table
+ // and merge the set group data and the additional data
+ if (!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data);
+
+ $this->trigger_events('extra_group_set');
+
+ // insert the new group
+ $this->db->insert($this->tables['groups'], $data);
+ $group_id = $this->db->insert_id();
+
+ // report success
+ $this->set_message('group_creation_successful');
+ // return the brand new group id
+ return $group_id;
+ }
+
+ /**
+ * update_group
+ *
+ * @return bool
+ * @author aditya menon
+ **/
+ public function update_group($group_id = FALSE, $group_name = FALSE, $additional_data = array())
+ {
+ if (empty($group_id)) return FALSE;
+
+ $data = array();
+
+ if (!empty($group_name))
+ {
+ // we are changing the name, so do some checks
+
+ // bail if the group name already exists
+ $existing_group = $this->db->get_where($this->tables['groups'], array('name' => $group_name))->row();
+ if(isset($existing_group->id) && $existing_group->id != $group_id)
+ {
+ $this->set_error('group_already_exists');
+ return FALSE;
+ }
+
+ $data['name'] = $group_name;
+ }
+
+ // restrict change of name of the admin group
+ $group = $this->db->get_where($this->tables['groups'], array('id' => $group_id))->row();
+ if($this->config->item('admin_group', 'ion_auth') === $group->name && $group_name !== $group->name)
+ {
+ $this->set_error('group_name_admin_not_alter');
+ return FALSE;
+ }
+
+
+ // IMPORTANT!! Third parameter was string type $description; this following code is to maintain backward compatibility
+ // New projects should work with 3rd param as array
+ if (is_string($additional_data)) $additional_data = array('description' => $additional_data);
+
+
+ // filter out any data passed that doesnt have a matching column in the groups table
+ // and merge the set group data and the additional data
+ if (!empty($additional_data)) $data = array_merge($this->_filter_data($this->tables['groups'], $additional_data), $data);
+
+
+ $this->db->update($this->tables['groups'], $data, array('id' => $group_id));
+
+ $this->set_message('group_update_successful');
+
+ return TRUE;
+ }
+
+ /**
+ * delete_group
+ *
+ * @return bool
+ * @author aditya menon
+ **/
+ public function delete_group($group_id = FALSE)
+ {
+ // bail if mandatory param not set
+ if(!$group_id || empty($group_id))
+ {
+ return FALSE;
+ }
+ $group = $this->group($group_id)->row();
+ if($group->name == $this->config->item('admin_group', 'ion_auth'))
+ {
+ $this->trigger_events(array('post_delete_group', 'post_delete_group_notallowed'));
+ $this->set_error('group_delete_notallowed');
+ return FALSE;
+ }
+
+ $this->trigger_events('pre_delete_group');
+
+ $this->db->trans_begin();
+
+ // remove all users from this group
+ $this->db->delete($this->tables['users_groups'], array($this->join['groups'] => $group_id));
+ // remove the group itself
+ $this->db->delete($this->tables['groups'], array('id' => $group_id));
+
+ if ($this->db->trans_status() === FALSE)
+ {
+ $this->db->trans_rollback();
+ $this->trigger_events(array('post_delete_group', 'post_delete_group_unsuccessful'));
+ $this->set_error('group_delete_unsuccessful');
+ return FALSE;
+ }
+
+ $this->db->trans_commit();
+
+ $this->trigger_events(array('post_delete_group', 'post_delete_group_successful'));
+ $this->set_message('group_delete_successful');
+ return TRUE;
+ }
+
+ public function set_hook($event, $name, $class, $method, $arguments)
+ {
+ $this->_ion_hooks->{$event}[$name] = new stdClass;
+ $this->_ion_hooks->{$event}[$name]->class = $class;
+ $this->_ion_hooks->{$event}[$name]->method = $method;
+ $this->_ion_hooks->{$event}[$name]->arguments = $arguments;
+ }
+
+ public function remove_hook($event, $name)
+ {
+ if (isset($this->_ion_hooks->{$event}[$name]))
+ {
+ unset($this->_ion_hooks->{$event}[$name]);
+ }
+ }
+
+ public function remove_hooks($event)
+ {
+ if (isset($this->_ion_hooks->$event))
+ {
+ unset($this->_ion_hooks->$event);
+ }
+ }
+
+ protected function _call_hook($event, $name)
+ {
+ if (isset($this->_ion_hooks->{$event}[$name]) && method_exists($this->_ion_hooks->{$event}[$name]->class, $this->_ion_hooks->{$event}[$name]->method))
+ {
+ $hook = $this->_ion_hooks->{$event}[$name];
+
+ return call_user_func_array(array($hook->class, $hook->method), $hook->arguments);
+ }
+
+ return FALSE;
+ }
+
+ public function trigger_events($events)
+ {
+ if (is_array($events) && !empty($events))
+ {
+ foreach ($events as $event)
+ {
+ $this->trigger_events($event);
+ }
+ }
+ else
+ {
+ if (isset($this->_ion_hooks->$events) && !empty($this->_ion_hooks->$events))
+ {
+ foreach ($this->_ion_hooks->$events as $name => $hook)
+ {
+ $this->_call_hook($events, $name);
+ }
+ }
+ }
+ }
+
+ /**
+ * set_message_delimiters
+ *
+ * Set the message delimiters
+ *
+ * @return void
+ * @author Ben Edmunds
+ **/
+ public function set_message_delimiters($start_delimiter, $end_delimiter)
+ {
+ $this->message_start_delimiter = $start_delimiter;
+ $this->message_end_delimiter = $end_delimiter;
+
+ return TRUE;
+ }
+
+ /**
+ * set_error_delimiters
+ *
+ * Set the error delimiters
+ *
+ * @return void
+ * @author Ben Edmunds
+ **/
+ public function set_error_delimiters($start_delimiter, $end_delimiter)
+ {
+ $this->error_start_delimiter = $start_delimiter;
+ $this->error_end_delimiter = $end_delimiter;
+
+ return TRUE;
+ }
+
+ /**
+ * set_message
+ *
+ * Set a message
+ *
+ * @return void
+ * @author Ben Edmunds
+ **/
+ public function set_message($message)
+ {
+ $this->messages[] = $message;
+
+ return $message;
+ }
+
+
+
+ /**
+ * messages
+ *
+ * Get the messages
+ *
+ * @return void
+ * @author Ben Edmunds
+ **/
+ public function messages()
+ {
+ $_output = '';
+ foreach ($this->messages as $message)
+ {
+ $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##' . $message . '##';
+ $_output .= $this->message_start_delimiter . $messageLang . $this->message_end_delimiter;
+ }
+
+ return $_output;
+ }
+
+ /**
+ * messages as array
+ *
+ * Get the messages as an array
+ *
+ * @return array
+ * @author Raul Baldner Junior
+ **/
+ public function messages_array($langify = TRUE)
+ {
+ if ($langify)
+ {
+ $_output = array();
+ foreach ($this->messages as $message)
+ {
+ $messageLang = $this->lang->line($message) ? $this->lang->line($message) : '##' . $message . '##';
+ $_output[] = $this->message_start_delimiter . $messageLang . $this->message_end_delimiter;
+ }
+ return $_output;
+ }
+ else
+ {
+ return $this->messages;
+ }
+ }
+
+
+ /**
+ * clear_messages
+ *
+ * Clear messages
+ *
+ * @return void
+ * @author Ben Edmunds
+ **/
+ public function clear_messages()
+ {
+ $this->messages = array();
+
+ return TRUE;
+ }
+
+
+ /**
+ * set_error
+ *
+ * Set an error message
+ *
+ * @return void
+ * @author Ben Edmunds
+ **/
+ public function set_error($error)
+ {
+ $this->errors[] = $error;
+
+ return $error;
+ }
+
+ /**
+ * errors
+ *
+ * Get the error message
+ *
+ * @return void
+ * @author Ben Edmunds
+ **/
+ public function errors()
+ {
+ $_output = '';
+ foreach ($this->errors as $error)
+ {
+ $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##';
+ $_output .= $this->error_start_delimiter . $errorLang . $this->error_end_delimiter;
+ }
+
+ return $_output;
+ }
+
+ /**
+ * errors as array
+ *
+ * Get the error messages as an array
+ *
+ * @return array
+ * @author Raul Baldner Junior
+ **/
+ public function errors_array($langify = TRUE)
+ {
+ if ($langify)
+ {
+ $_output = array();
+ foreach ($this->errors as $error)
+ {
+ $errorLang = $this->lang->line($error) ? $this->lang->line($error) : '##' . $error . '##';
+ $_output[] = $this->error_start_delimiter . $errorLang . $this->error_end_delimiter;
+ }
+ return $_output;
+ }
+ else
+ {
+ return $this->errors;
+ }
+ }
+
+
+ /**
+ * clear_errors
+ *
+ * Clear Errors
+ *
+ * @return void
+ * @author Ben Edmunds
+ **/
+ public function clear_errors()
+ {
+ $this->errors = array();
+
+ return TRUE;
+ }
+
+
+
+ protected function _filter_data($table, $data)
+ {
+ $filtered_data = array();
+ $columns = $this->db->list_fields($table);
+
+ if (is_array($data))
+ {
+ foreach ($columns as $column)
+ {
+ if (array_key_exists($column, $data))
+ $filtered_data[$column] = $data[$column];
+ }
+ }
+
+ return $filtered_data;
+ }
+
+ protected function _prepare_ip($ip_address) {
+ // just return the string IP address now for better compatibility
+ return $ip_address;
+ }
+}
diff --git a/old_code_ci3/models/IpdDischarge_M.php b/old_code_ci3/models/IpdDischarge_M.php
new file mode 100644
index 0000000..5776420
--- /dev/null
+++ b/old_code_ci3/models/IpdDischarge_M.php
@@ -0,0 +1,416 @@
+db->insert("ipd_discharge", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_ipdDischarge($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_discharge", $data);
+ }
+
+
+ public function insert_ipd_discharge_1_a($data) {
+
+ if ($this->db->insert("ipd_discharge_1_a", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_ipd_discharge_1_a($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_discharge_1_a", $data);
+ }
+
+
+ public function update_insert_ipd_discharge_1_b($data,$ipd_id,$gen_exam_id) {
+ $sql="select id from ipd_discharge_1_b where ipd_d_id=".$ipd_id." and col_id=".$gen_exam_id;
+ $query = $this->db->query($sql);
+ $discharge_general_exam= $query->result();
+
+ if(count($discharge_general_exam)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $discharge_general_exam[0]->id);
+ $this->db->update("ipd_discharge_1_b", $data);
+
+ return $discharge_general_exam[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_1_b", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ public function update_insert_ipd_discharge_1_d($data,$ipd_id,$gen_exam_id) {
+ $sql="select id from ipd_discharge_1_d where ipd_d_id=".$ipd_id." and col_id=".$gen_exam_id;
+ $query = $this->db->query($sql);
+ $discharge_general_exam= $query->result();
+
+ if(count($discharge_general_exam)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $discharge_general_exam[0]->id);
+ $this->db->update("ipd_discharge_1_d", $data);
+
+ return $discharge_general_exam[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_1_d", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ public function update_insert_ipd_discharge_1_e($data,$ipd_id,$gen_exam_id) {
+ $sql="select id from ipd_discharge_1_e where ipd_d_id=".$ipd_id." and col_id=".$gen_exam_id;
+ $query = $this->db->query($sql);
+ $discharge_general_exam= $query->result();
+
+ if(count($discharge_general_exam)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $discharge_general_exam[0]->id);
+ $this->db->update("ipd_discharge_1_e", $data);
+
+ return $discharge_general_exam[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_1_e", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+
+
+ public function update_insert_ipd_discharge_1_b_final($data,$ipd_id,$gen_exam_id) {
+ $sql="select id from ipd_discharge_1_b_final where ipd_d_id=".$ipd_id." and col_id=".$gen_exam_id;
+ $query = $this->db->query($sql);
+ $discharge_general_exam= $query->result();
+
+ if(count($discharge_general_exam)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $discharge_general_exam[0]->id);
+ $this->db->update("ipd_discharge_1_b_final", $data);
+
+ return $discharge_general_exam[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_1_b_final", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ public function update_insert_ipd_discharge_2($data,$ipd_id) {
+ $sql="select id from ipd_discharge_2 where ipd_d_id=".$ipd_id."";
+ $query = $this->db->query($sql);
+ $discharge_general_exam= $query->result();
+
+ if(count($discharge_general_exam)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $discharge_general_exam[0]->id);
+ $this->db->update("ipd_discharge_2", $data);
+
+ return $discharge_general_exam[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_2", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ //ipd_discharge_drug_food_interaction
+
+ public function update_insert_ipd_discharge_drug_food_interaction($data,$ipd_id) {
+ $sql="select id from ipd_discharge_drug_food_interaction where ipd_id=".$ipd_id."";
+ $query = $this->db->query($sql);
+ $ipd_discharge_drug_food_interaction= $query->result();
+
+ if(count($ipd_discharge_drug_food_interaction)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $ipd_discharge_drug_food_interaction[0]->id);
+ $this->db->update("ipd_discharge_drug_food_interaction", $data);
+
+ return $ipd_discharge_drug_food_interaction[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_drug_food_interaction", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ // Surgery Table
+
+
+ public function insert_p_surgery($data) {
+ if ($this->db->insert("ipd_discharge_surgery", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_surgery($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_discharge_surgery", $data);
+ }
+
+ public function remove_p_surgery($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("ipd_discharge_surgery");
+ }
+
+ // Prosedure Table
+
+
+ public function insert_p_procedure($data) {
+ if ($this->db->insert("ipd_discharge_procedure", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_procedure($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_discharge_procedure", $data);
+ }
+
+ public function remove_p_procedure($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("ipd_discharge_procedure");
+ }
+
+
+
+ // Prescription Complaint
+
+ public function insert_p_complaint($data) {
+ if ($this->db->insert("ipd_discharge_complaint", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_complaint($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_discharge_complaint", $data);
+ }
+
+ public function remove_p_complaint($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("ipd_discharge_complaint");
+ }
+
+ public function update_insert_ipd_discharge_complaint_remark($data,$ipd_id) {
+ $sql="select id from ipd_discharge_complaint_remark where ipd_id=".$ipd_id."";
+ $query = $this->db->query($sql);
+ $data_rec= $query->result();
+
+ if(count($data_rec)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $data_rec[0]->id);
+ $this->db->update("ipd_discharge_complaint_remark", $data);
+
+ return $data_rec[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_complaint_remark", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+
+ // Diagnosis
+
+ public function insert_p_diagnosis($data) {
+ if ($this->db->insert("ipd_discharge_diagnosis", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_diagnosis($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_discharge_diagnosis", $data);
+ }
+
+ public function remove_p_diagnosis($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("ipd_discharge_diagnosis");
+ }
+
+ public function update_insert_ipd_discharge_diagnosis_remark($data,$ipd_id) {
+ $sql="select id from ipd_discharge_diagnosis_remark where ipd_id=".$ipd_id."";
+ $query = $this->db->query($sql);
+ $data_rec= $query->result();
+
+ if(count($data_rec)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $data_rec[0]->id);
+ $this->db->update("ipd_discharge_diagnosis_remark", $data);
+
+ return $data_rec[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_diagnosis_remark", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ //Investigtions
+
+ public function update_insert_ipd_discharge_investigtions_inhos($data,$ipd_id) {
+ $sql="select id from ipd_discharge_investigtions_inhos where ipd_id=".$ipd_id."";
+ $query = $this->db->query($sql);
+ $data_rec= $query->result();
+
+ if(count($data_rec)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $data_rec[0]->id);
+ $this->db->update("ipd_discharge_investigtions_inhos", $data);
+
+ return $data_rec[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_investigtions_inhos", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ //Course in the hospital
+
+
+
+ public function insert_p_course($data) {
+ if ($this->db->insert("ipd_discharge_course", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_course($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_discharge_course", $data);
+ }
+
+ public function remove_p_course($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("ipd_discharge_course");
+ }
+
+
+ public function update_insert_ipd_discharge_course_remark($data,$ipd_id) {
+ $sql="select id from ipd_discharge_course_remark where ipd_id=".$ipd_id."";
+ $query = $this->db->query($sql);
+ $data_rec= $query->result();
+
+ if(count($data_rec)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $data_rec[0]->id);
+ $this->db->update("ipd_discharge_course_remark", $data);
+
+ return $data_rec[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_course_remark", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ //Discharge Instructions
+
+ public function update_insert_ipd_discharge_instructions($data,$ipd_id) {
+ $sql="select id from ipd_discharge_instructions where ipd_id=".$ipd_id."";
+ $query = $this->db->query($sql);
+ $data_rec= $query->result();
+
+ if(count($data_rec)>0)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $data_rec[0]->id);
+ $this->db->update("ipd_discharge_instructions", $data);
+
+ return $data_rec[0]->id;
+ }else{
+ if ($this->db->insert("ipd_discharge_instructions", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+ }
+
+ //Discharge Drugs
+
+ public function insert_p_drug($data) {
+ if ($this->db->insert("ipd_discharge_prescrption_prescribed", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_drug($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_discharge_prescrption_prescribed", $data);
+ }
+
+ public function remove_p_drug($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("ipd_discharge_prescrption_prescribed");
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Ipd_M.php b/old_code_ci3/models/Ipd_M.php
new file mode 100644
index 0000000..03d0ba8
--- /dev/null
+++ b/old_code_ci3/models/Ipd_M.php
@@ -0,0 +1,285 @@
+db->query($sql);
+ $result = $query->result_array();
+ //print_r($result);
+ return $result;
+ }
+
+ public function insert($data) {
+
+ $sql = "SELECT * FROM ipd_master where ipd_status=0 and p_id=".$data['master']['p_id'];
+ $query = $this->db->query($sql);
+ $ipd_info= $query->result();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.' ['.date('d-m-Y H:i:s');
+
+ if(count($ipd_info)<1)
+ {
+ if ($this->db->insert("ipd_master", $data['master'])) {
+ $insert_id = $this->db->insert_id();
+
+ $sql="SELECT count(*) as xtimes from ipd_master where id<=".$insert_id." and p_id=".$data['master']['p_id'];
+ $query = $this->db->query($sql);
+ $ipd_times= $query->result();
+
+ $pid=str_pad(substr($insert_id,-7,7),7,0,STR_PAD_LEFT);
+ $pid='A'.date('ym').$pid;
+ $udata = array(
+ 'ipd_code' => $pid,
+ 'ipd_times' => $ipd_times[0]->xtimes,
+ );
+
+ $this->db->set($udata);
+ $this->db->where("id", $insert_id);
+ $this->db->update("ipd_master", $udata);
+
+ foreach ($data['doc_list'] as $doc_id)
+ {
+ $doc_data=array(
+ 'doc_id' => $doc_id,
+ 'ipd_id' => $insert_id,
+ 'log'=>'Insert By :'.$user_name
+ );
+ $this->db->insert("ipd_master_doc_list", $doc_data);
+ }
+
+ return $insert_id;
+ }else
+ return 0;
+ }else{
+ return $ipd_info[0]->id;
+ }
+
+ }
+
+ public function add_ipd_doc($doc_data)
+ {
+ $insert_id=0;
+ if($this->db->insert("ipd_master_doc_list", $doc_data))
+ {
+ $insert_id = $this->db->insert_id();
+ }
+ return $insert_id;
+ }
+
+
+ public function remove_ipd_doc($ipd_doc_id)
+ {
+ $this->db->where('id', $del_id);
+ $q = $this->db->get('ipd_master_doc_list');
+ $data = $q->row_array();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $data['update_by_id']=$user_id;
+ $data['update_by']=$user_name.'['.date('Y-m-d H:i:s').']';
+
+ if ($this->db->insert("ipd_master_doc_list_delete", $data)) {
+ //$this->db->where("id", $del_id);
+ $this->db->delete("ipd_master_doc_list","id=".$del_id);
+ return 1;
+ }else{
+ return 0;
+ }
+ }
+
+ public function bedassign($data) {
+ if ($this->db->insert("ipd_bed_assign", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $datau = array(
+ 'bed_used_p_id' => 0
+ );
+
+ $this->db->set($datau);
+ $this->db->where("bed_used_p_id",$data['ipd_id']);
+ $this->db->update("hc_bed_master", $datau);
+
+ $datau = array(
+ 'bed_used_p_id' => $data['ipd_id']
+ );
+
+ $this->db->set($datau);
+ $this->db->where("id", $data['bed_id']);
+ $this->db->update("hc_bed_master", $datau);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function calculate_IPD($IPD_NO)
+ {
+ $this->db->query("CALL p_cal_ipd_master($IPD_NO)");
+ }
+
+ public function update($data,$old_id_no) {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from ipd_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $data1=$query->result_array();
+
+ if(count($data1)>0)
+ {
+ $update_emp_name=$user_id.'['.$user_name.']'.date('Y-m-d H:i:s');
+ $Old_Update_data=($data1[0]['log']==''?' ':$data1[0]['log']).PHP_EOL;
+
+ $change_data=compare_arrays($data1[0],$data);
+ if(strlen($change_data)>0)
+ {
+ $data['log']=$Old_Update_data.$change_data.'Update By :'.$update_emp_name;
+ }
+
+ }
+
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_master", $data);
+ }
+
+ public function insert_ipd_item($data) {
+
+ if ($this->db->insert("ipd_invoice_item", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_ipd_item($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from ipd_invoice_item where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $data1=$query->result_array();
+
+ if(count($data1)>0)
+ {
+ $update_emp_name=$user_id.'['.$user_name.']'.date('Y-m-d H:i:s');
+ $Old_Update_data=($data1[0]['log']==''?' ':$data1[0]['log']).PHP_EOL;
+
+ $change_data=compare_arrays($data1[0],$data);
+ if(strlen($change_data)>0)
+ {
+ $data['log']=$Old_Update_data.$change_data.'Update By :'.$update_emp_name;
+ }
+ }
+
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_invoice_item", $data);
+
+ }
+
+ public function deleteIpdinvoiceitem($del_id)
+ {
+ $this->db->where('id', $del_id);
+ $q = $this->db->get('ipd_invoice_item');
+ $data = $q->row_array();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $data['update_by_id']=$user_id;
+ $data['update_by']=$user_name;
+ $data['update_action']='1';
+
+ if ($this->db->insert("ipd_invoice_item_update", $data)) {
+ //$this->db->where("id", $del_id);
+ $this->db->delete("ipd_invoice_item","id=".$del_id);
+ return 1;
+ }else{
+ return 0;
+ }
+ }
+
+ public function insert_package($data) {
+
+ if ($this->db->insert("ipd_package", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_package($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("ipd_package", $data);
+ }
+
+ public function deletepackage($del_id)
+ {
+ $this->db->where('id', $del_id);
+ $q = $this->db->get('ipd_package');
+ $data = $q->row_array();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.' D:'.date('d-m-Y h:i:s');
+
+ $data['update_by_id']=$user_id;
+ $data['update_by_action']=$user_name;
+ $data['update_action']='1';
+
+ if ($this->db->insert("ipd_package_update", $data)) {
+ //$this->db->where("id", $del_id);
+ $this->db->delete("ipd_package","id=".$del_id);
+ return 1;
+ }else{
+ return 0;
+ }
+ }
+
+
+ public function insert_refer_ipd($data) {
+ if ($this->db->insert("ipd_refer", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function remove_refer_ipd($del_id)
+ {
+ $this->db->where('id', $del_id);
+ $q = $this->db->get('ipd_refer');
+ $data = $q->row_array();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.' D:'.date('d-m-Y h:i:s');
+
+ $data['update_by_id']=$user_id;
+ $data['update_by_action']=$user_name;
+ $data['update_action']='1';
+
+ if ($this->db->insert("ipd_refer_update", $data)) {
+ //$this->db->where("id", $del_id);
+ $this->db->delete("ipd_refer","id=".$del_id);
+ return 1;
+ }else{
+ return 0;
+ }
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Item_M.php b/old_code_ci3/models/Item_M.php
new file mode 100644
index 0000000..ec746a4
--- /dev/null
+++ b/old_code_ci3/models/Item_M.php
@@ -0,0 +1,109 @@
+db->insert("hc_items", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_type($data) {
+
+ if ($this->db->insert("hc_item_type", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_type($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("itype_id", $old_id_no);
+ if ($this->db->update("hc_item_type", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function insert_in_item($data) {
+
+ if ($this->db->insert("hc_items_insurance", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_in_item($data,$old_id_no) {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,2 as action,'".$user_name."' as action_by from hc_items_insurance where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("hc_items_insurance_update", $insertdata[0]);
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("hc_items_insurance", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function delete_in_item($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,2 as action,'".$user_name."' as action_by from hc_items_insurance where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("hc_items_insurance_update", $insertdata[0]);
+ $this->db->delete("hc_items_insurance", "id=".$old_id_no);
+ }
+
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,1 as action,'".$user_name."' as action_by from hc_items where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("hc_items_update", $insertdata[0]);
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("hc_items", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Item_ipd_M.php b/old_code_ci3/models/Item_ipd_M.php
new file mode 100644
index 0000000..baf6b7a
--- /dev/null
+++ b/old_code_ci3/models/Item_ipd_M.php
@@ -0,0 +1,109 @@
+db->insert("ipd_items", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_type($data) {
+
+ if ($this->db->insert("ipd_item_type", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_type($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("itype_id", $old_id_no);
+ if ($this->db->update("ipd_item_type", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function insert_in_item($data) {
+ if ($this->db->insert("ipd_items_insurance", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_in_item($data,$old_id_no) {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,2 as action,'".$user_name."' as action_by from ipd_items_insurance where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("ipd_items_insurance_update", $insertdata[0]);
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("ipd_items_insurance", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function delete_in_item($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,2 as action,'".$user_name."' as action_by from ipd_items_insurance where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("ipd_items_insurance_update", $insertdata[0]);
+ $this->db->delete("ipd_items_insurance", "id=".$old_id_no);
+ }
+
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,1 as action,'".$user_name."' as action_by
+ from ipd_items where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("ipd_items_update", $insertdata[0]);
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("ipd_items", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Master_M.php b/old_code_ci3/models/Master_M.php
new file mode 100644
index 0000000..5476573
--- /dev/null
+++ b/old_code_ci3/models/Master_M.php
@@ -0,0 +1,66 @@
+db->insert("tag_master", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_tag_master($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("tag_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+//Location Master
+ public function insert_location_master($data) {
+
+ if ($this->db->insert("location_master", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_location_master($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("l_id", $old_id_no);
+ if ($this->db->update("location_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ //Employee Master
+ public function insert_employee_master($data) {
+
+ if ($this->db->insert("employee_master", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_employee_master($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("emp_id", $old_id_no);
+ if ($this->db->update("employee_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/old_code_ci3/models/Medical_M.php b/old_code_ci3/models/Medical_M.php
new file mode 100644
index 0000000..054b491
--- /dev/null
+++ b/old_code_ci3/models/Medical_M.php
@@ -0,0 +1,610 @@
+db->insert("drug_temp", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_drug($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("item_id", $old_id_no);
+
+ if($this->db->update("drug_temp", $data))
+ {
+ return 1;
+ }else{
+ return 0;
+ }
+ }
+
+ public function insert_stock_add($data) {
+
+ if ($this->db->insert("stock_addition", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_stock_upd($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("ss_no", $old_id_no);
+ if($this->db->update("stock_addition", $data))
+ {
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function add_invoice($data)
+ {
+ if ($this->db->insert("invoice_med_master", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $pid=str_pad(substr($insert_id,-7,7),7,0,STR_PAD_LEFT);
+
+ $pid='M'.date('ym').$pid;
+ $data1 = array(
+ 'inv_med_code' => $pid
+ );
+
+ $this->db->set($data1);
+ $this->db->where("id", $insert_id);
+ $this->db->update("invoice_med_master", $data1);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function add_invoiceitem($data)
+ {
+ if ($this->db->insert("inv_med_item", $data)) {
+ $insert_id = $this->db->insert_id();
+ $store_stock_id=$data['store_stock_id'];
+ $this->db->query("CALL p_stock_update_purchase_id(".$store_stock_id.")");
+ $this->db->query("CALL p_update_med_GST(".$data['inv_med_id'].")");
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+
+ public function update_invoiceitem($data,$old_id_no)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+
+ if($this->db->update("inv_med_item", $data))
+ {
+ $store_stock_id=$data['store_stock_id'];
+ $this->db->query("CALL p_stock_update_purchase_id(".$store_stock_id.")");
+ $this->db->query("CALL p_update_med_GST(".$data['inv_med_id'].")");
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function delete_invoiceitem($itemid,$inv_items)
+ {
+ $this->db->delete("inv_med_item", "id=".$itemid);
+
+ $update_emp_name=$this->session->userdata('username').'['.$this->session->userdata('agent_id').']'.date('Y-m-d H:i:s');
+
+ $add_data=array(
+ 'delete_by' => $update_emp_name,
+ );
+
+ $data=array_merge($inv_items,$add_data);
+
+ $store_stock_id=$data['store_stock_id'];
+
+ //echo "Purchase Id :".$store_stock_id;
+
+ $this->db->insert("inv_med_item_delete", $data);
+ $this->db->query("CALL p_update_med_GST(".$data['inv_med_id'].")");
+
+ $this->db->query("CALL p_stock_update_purchase_id(".$store_stock_id.")");
+ }
+
+ public function update_in_upv_item($data,$old_id_no) {
+ $sql="select * from invoice_med_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $data1=$query->result_array();
+
+ if(count($data1)>0)
+ {
+ $update_emp_name=$this->session->userdata('username').'['.$this->session->userdata('agent_id').']'.date('Y-m-d H:i:s');
+ $log=compare_arrays($data1[0],$data).PHP_EOL.'Update By :'.$update_emp_name;
+ $old_log=$data1[0]['log'];
+ if($old_log=='' || $old_log==null)
+ {
+ $old_log='';
+ }
+
+ $ulog=$old_log.PHP_EOL.$log;
+
+ $this->db->set($data);
+ $this->db->set('log',$ulog,true);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("invoice_med_master");
+ }
+ }
+
+ //Start Medical Company
+
+ public function insert_company($data) {
+ if ($this->db->insert("med_company", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_company($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("med_company", $data);
+ }
+
+
+ //Start Medical Company
+
+ public function insert_med_product_cat_master($data) {
+ if ($this->db->insert("med_product_cat_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_product_cat_master($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("med_product_cat_master", $data);
+ }
+
+
+ //Start Medical Payment History
+
+ public function insert_payment($data) {
+ $data['amount_1']=$data['amount'];
+
+ if ($this->db->insert("payment_history_medical", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_payment($data,$old_id_no) {
+ $data['amount_1']=$data['amount'];
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("payment_history_medical", $data);
+ }
+
+ public function insert_payment_history_log($data) {
+ if ($this->db->insert("paymentmedical_history_log", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ //End Medical Histoy
+
+ public function update_group_invoice($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("med_group_id", $old_id_no);
+ $this->db->update("inv_med_group", $data);
+ }
+
+ public function update_invoice_final($inv_id)
+ {
+ $this->db->query("CALL p_update_med_GST(".$inv_id.")");
+ }
+
+ public function update_invoice_group($inv_id)
+ {
+ $this->db->query("CALL p_update_med_group(".$inv_id.")");
+ }
+
+ public function update_invoice_group_gst($ipd,$bill_type=1)
+ {
+ $this->db->query("CALL p_update_med_group_GST(".$ipd.",".$bill_type.")");
+ }
+
+ public function update_invoice_rate_final($inv_id)
+ {
+ $this->db->query("CALL med_rate_update(".$inv_id.")");
+ }
+
+ public function transfer_ssno($from_ssno,$to_ssno,$tqty)
+ {
+ $this->db->query("CALL p_sale_transfer_ssno(".$from_ssno.",".$to_ssno.",".$tqty.")");
+ }
+
+ public function merge_product($from_prod_id,$to_prod_id)
+ {
+ $this->db->query("CALL p_combine_product_master(".$from_prod_id.",".$to_prod_id.")");
+ }
+
+ public function insert_supplier($data) {
+
+ if ($this->db->insert("med_supplier", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_supplier($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("sid", $old_id_no);
+ if($this->db->update("med_supplier", $data))
+ {
+ return $old_id_no;
+ } else{
+ return 0;
+ }
+ }
+
+ public function insert_purchase($data) {
+
+ $this->db->db_debug = false;
+
+ if($this->db->insert("purchase_invoice", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_purchase($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if($this->db->update("purchase_invoice", $data))
+ {
+ $this->db->query("CALL p_purchase_invoice(".$old_id_no.")");
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function delete_purchase($inv_id) {
+
+ $this->db->where("id", $inv_id);
+ $this->db->delete("purchase_invoice");
+
+ return 1;
+ }
+
+ public function insert_purchase_item($data) {
+ if ($this->db->insert("purchase_invoice_item", $data)) {
+ $insert_id = $this->db->insert_id();
+ $this->db->query("CALL f_update_purchase_invoice(".$insert_id.")");
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_purchase_item($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if($this->db->update("purchase_invoice_item", $data))
+ {
+ $this->db->query("CALL f_update_purchase_invoice(".$old_id_no.")");
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function delete_purchase_item($inv_id,$del_inv_item_id) {
+
+ $this->db->where("id", $del_inv_item_id);
+ $this->db->delete("purchase_invoice_item");
+
+ $this->db->query("CALL p_purchase_invoice(".$inv_id.")");
+
+ return 1;
+
+ /*
+ $sql="select count(*) as no_rec from inv_med_item where ss_no=".$del_inv_item_id;
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $sale_qty=$result[0]->no_rec;
+
+ if($sale_qty>0)
+ {
+ return 0;
+
+ }else{
+ $this->db->where("id", $del_inv_item_id);
+ $this->db->delete("purchase_invoice_item");
+
+ $this->db->query("CALL f_update_purchase_invoice(".$inv_id.")");
+
+ return 1;
+ }
+ */
+ }
+
+ public function update_purchase_item_stock_adjust($data_stock_adjuct,$item_id) {
+ $sql="select sum(qty) as total_adjust
+ from purchase_item_stock_adjust
+ where item_id=".$item_id;
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $sql="select *,(total_unit-total_lost_unit-total_sale_unit) as Cur_unit_qty
+ from purchase_invoice_item where id=".$item_id;
+ $query = $this->db->query($sql);
+ $result_item_master = $query->result();
+
+ $total_adjust=0;
+ $total_lost_unit=0;
+ $current_qty=0;
+
+ $insert_flag=0;
+
+ $qty=$data_stock_adjuct['qty'];
+
+ if(count($result_item_master)>0)
+ {
+ $total_lost_unit=$result_item_master[0]->total_lost_unit;
+ $current_qty=$result_item_master[0]->Cur_unit_qty ;
+
+ }
+
+ if(count($result)>0)
+ {
+ $total_adjust=$result[0]->total_adjust;
+ }
+
+ if($qty>0)
+ {
+ if($current_qty>=$qty)
+ {
+ $insert_flag=1;
+ }
+ }elseif($qty<0){
+ if($total_adjust>=$qty*-1)
+ {
+ $insert_flag=1;
+ }
+ }
+
+ if($insert_flag==1)
+ {
+ $total_adjust=$total_adjust+$qty;
+
+ if ($this->db->insert("purchase_item_stock_adjust", $data_stock_adjuct)) {
+ $insert_id = $this->db->insert_id();
+
+ $data = array(
+ 'total_lost_unit' => $total_adjust
+ );
+
+ $this->db->set($data);
+ $this->db->where("id", $item_id);
+ $this->db->update("purchase_invoice_item", $data);
+
+ return "Done : Re-Search Again for Update Records";
+ }else{ return "Not Insert in Stock Adjust"; }
+
+ }else{
+ return "Qty Not Correct: either Its greater then stock Qty or 0";
+ }
+
+ }
+
+ public function update_remove_status_item($data_stock_adjuct,$item_id) {
+
+ $sql="select sum(qty) as total_adjust
+ from purchase_item_stock_adjust where item_id=".$item_id;
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $sql="select *,(total_unit-total_lost_unit-total_sale_unit) as Cur_unit_qty
+ from purchase_invoice_item where item_return=0 and id=".$item_id;
+ $query = $this->db->query($sql);
+ $result_item_master = $query->result();
+
+ $total_adjust=0;
+ $total_lost_unit=0;
+ $current_qty=0;
+
+ $insert_flag=0;
+
+ if(count($result_item_master)>0)
+ {
+ $total_lost_unit=$result_item_master[0]->total_lost_unit;
+ $current_qty=$result_item_master[0]->Cur_unit_qty ;
+ }
+
+ if(count($result)>0)
+ {
+ $total_adjust=$result[0]->total_adjust;
+ }
+
+ $total_adjust=$total_adjust+$current_qty;
+
+ $data_stock_adjuct['qty']=$current_qty;
+
+ if ($this->db->insert("purchase_item_stock_adjust", $data_stock_adjuct)) {
+ $insert_id = $this->db->insert_id();
+
+ $data = array(
+ 'total_lost_unit' => $total_adjust,
+ 'remove_item' => '1'
+ );
+
+ $this->db->set($data);
+ $this->db->where("id", $item_id);
+ $this->db->update("purchase_invoice_item", $data);
+
+ return "Done : Remove ".$current_qty." Qty : Re-Search for Update Records";
+ }else{ return "Not Insert in Stock Adjust"; }
+ }
+
+ public function add_removed_item($data_stock_adjuct,$item_id)
+ {
+ if ($this->db->insert("purchase_item_stock_adjust", $data_stock_adjuct)) {
+ $insert_id = $this->db->insert_id();
+
+ $data = array(
+ 'remove_item' => '0'
+ );
+
+ $this->db->set($data);
+ $this->db->where("id", $item_id);
+ $this->db->update("purchase_invoice_item", $data);
+
+ return "Add Item in Stock ";
+ }else{
+ return "Something Wrong ";
+ }
+ }
+
+
+ public function insert_inv_med_item_return_add($data) {
+
+ if ($this->db->insert("inv_med_item_return", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function delete_return_item($inv_item_id) {
+ $this->db->where("inv_item_id", $inv_item_id);
+ $this->db->where("return_status", '0');
+ $this->db->delete("inv_med_item_return");
+ }
+
+ public function update_return_item($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+
+ if($this->db->update("inv_med_item_return", $data))
+ {
+ return 1;
+ }else{
+ return 0;
+ }
+
+ }
+
+ public function insert_med_supplier_ledger($data) {
+
+ if($this->db->insert("med_supplier_ledger", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_supplier_ledger($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+
+ if($this->db->update("med_supplier_ledger", $data))
+ {
+ return 1;
+ }else{
+ return 0;
+ }
+
+ }
+
+ //Insert Update Table purchase_return_invoice / purchase_return_invoice_item
+
+ public function add_purchase_return_invoice($data)
+ {
+ if ($this->db->insert("purchase_return_invoice", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $pid=str_pad(substr($insert_id,-3,3),3,0,STR_PAD_LEFT);
+
+ $pid='PR'.date('ym').$pid;
+ $data1 = array(
+ 'p_r_invoice_no' => $pid
+ );
+
+ $this->db->set($data1);
+ $this->db->where("id", $insert_id);
+ $this->db->update("purchase_return_invoice", $data1);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function add_purchase_return_invoiceitem($data)
+ {
+ if ($this->db->insert("purchase_return_invoice_item", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $this->db->query("CALL p_stock_purchase_return(".$insert_id.",0)");
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_purchase_return_invoiceitem($data,$old_id_no)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+
+ if($this->db->update("purchase_return_invoice_item", $data))
+ {
+ $store_stock_id=$data['store_stock_id'];
+ //$this->db->query("CALL p_stock_update_purchase_id(".$store_stock_id.")");
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function opd_reset($inv_id)
+ {
+ //$this->db->query("CALL p_cash_opd_pre_data(".$inv_id.")");
+ }
+
+ public function delete_purchase_return_invoiceitem($itemid)
+ {
+ $this->db->query("CALL p_stock_purchase_return(".$itemid.",1)");
+
+ $this->db->delete("purchase_return_invoice_item", "id=".$itemid);
+
+ $update_emp_name=$this->session->userdata('username').'['.$this->session->userdata('agent_id').']'.date('Y-m-d H:i:s');
+
+ $add_data=array(
+ 'delete_by' => $update_emp_name,
+ );
+
+ }
+
+
+
+ }
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Medical_M_03062021.php b/old_code_ci3/models/Medical_M_03062021.php
new file mode 100644
index 0000000..9c4e451
--- /dev/null
+++ b/old_code_ci3/models/Medical_M_03062021.php
@@ -0,0 +1,491 @@
+db->insert("drug_temp", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_drug($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("item_id", $old_id_no);
+
+ if($this->db->update("drug_temp", $data))
+ {
+ return 1;
+ }else{
+ return 0;
+ }
+
+ }
+
+ public function insert_stock_add($data) {
+
+ if ($this->db->insert("stock_addition", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_stock_upd($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("ss_no", $old_id_no);
+ if($this->db->update("stock_addition", $data))
+ {
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function add_invoice($data)
+ {
+ if ($this->db->insert("invoice_med_master", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $pid=str_pad(substr($insert_id,-7,7),7,0,STR_PAD_LEFT);
+
+ $pid='M'.date('ym').$pid;
+ $data1 = array(
+ 'inv_med_code' => $pid
+ );
+
+ $this->db->set($data1);
+ $this->db->where("id", $insert_id);
+ $this->db->update("invoice_med_master", $data1);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function add_invoiceitem($data)
+ {
+ if ($this->db->insert("inv_med_item", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ if($insert_id>0)
+ {
+ $this->db->set("total_sale_unit","total_sale_unit+".$data["qty"],false);
+ $this->db->where("id", $data["store_stock_id"]);
+ $this->db->update("purchase_invoice_item");
+ }
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_invoiceitem($data,$old_id_no)
+ {
+ $sql="select * from inv_med_item where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $old_qty=$result[0]->qty;
+ $diff_qty=$data["qty"]-$old_qty;
+ $store_stock_id=$result[0]->store_stock_id;
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+
+ if($this->db->update("inv_med_item", $data))
+ {
+ $this->db->set("total_sale_unit","total_sale_unit+".$diff_qty,false);
+ $this->db->where("id", $store_stock_id);
+ $this->db->update("purchase_invoice_item");
+ }
+ }
+
+ public function delete_invoiceitem($itemid)
+ {
+ $sql="select * from inv_med_item where id=".$itemid;
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $old_qty=$result[0]->qty;
+ $store_stock_id=$result[0]->store_stock_id;
+
+ if($this->db->delete("inv_med_item", "id=".$itemid))
+ {
+ $this->db->set("total_sale_unit","total_sale_unit-".$old_qty,false);
+ $this->db->where("id", $store_stock_id);
+ $this->db->update("purchase_invoice_item");
+ }
+ }
+
+ public function update_in_upv_item($data,$old_id_no) {
+ $sql="select * from invoice_med_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $data1=$query->result_array();
+
+ if(count($data1)>0)
+ {
+ $update_emp_name=$this->session->userdata('username').'['.$this->session->userdata('agent_id').']'.date('Y-m-d H:i:s');
+ $log=compare_arrays($data1[0],$data).PHP_EOL.'Update By :'.$update_emp_name;
+ $old_log=$data1[0]['log'];
+ if($old_log=='' || $old_log==null)
+ {
+ $old_log='';
+ }
+
+ $ulog=$old_log.PHP_EOL.$log;
+
+ $this->db->set($data);
+ $this->db->set('log',$ulog,true);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("invoice_med_master");
+ }
+ }
+
+ //Start Medical Company
+
+ public function insert_company($data) {
+ if ($this->db->insert("med_company", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_company($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("med_company", $data);
+ }
+
+ //Start Medical Payment History
+
+ public function insert_payment($data) {
+ if ($this->db->insert("payment_history_medical", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_payment($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("payment_history_medical", $data);
+ }
+
+ public function insert_payment_history_log($data) {
+ if ($this->db->insert("paymentmedical_history_log", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ //End Medical Histoy
+
+ public function update_group_invoice($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("med_group_id", $old_id_no);
+ $this->db->update("inv_med_group", $data);
+ }
+
+ public function update_invoice_final($inv_id)
+ {
+ $this->db->query("CALL p_update_med_GST(".$inv_id.")");
+ }
+
+ public function update_invoice_group($inv_id)
+ {
+ $this->db->query("CALL p_update_med_group(".$inv_id.")");
+ }
+
+ public function update_invoice_group_gst($ipd,$bill_type=1)
+ {
+ $this->db->query("CALL p_update_med_group_GST(".$ipd.",".$bill_type.")");
+ }
+
+ public function update_invoice_rate_final($inv_id)
+ {
+ $this->db->query("CALL med_rate_update(".$inv_id.")");
+ }
+
+ public function insert_supplier($data) {
+
+ if ($this->db->insert("med_supplier", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_supplier($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("sid", $old_id_no);
+ if($this->db->update("med_supplier", $data))
+ {
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function insert_purchase($data) {
+
+ $this->db->db_debug = false;
+
+ if($this->db->insert("purchase_invoice", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_purchase($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if($this->db->update("purchase_invoice", $data))
+ {
+ $this->db->query("CALL p_purchase_invoice(".$old_id_no.")");
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function delete_purchase($inv_id) {
+
+ $this->db->where("id", $inv_id);
+ $this->db->delete("purchase_invoice");
+
+ return 1;
+ }
+
+ public function insert_purchase_item($data) {
+ if ($this->db->insert("purchase_invoice_item", $data)) {
+ $insert_id = $this->db->insert_id();
+ $this->db->query("CALL f_update_purchase_invoice(".$insert_id.")");
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_purchase_item($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if($this->db->update("purchase_invoice_item", $data))
+ {
+ $this->db->query("CALL f_update_purchase_invoice(".$old_id_no.")");
+ return 1;
+ } else{
+ return 0;
+ }
+ }
+
+ public function delete_purchase_item($inv_id,$del_inv_item_id) {
+
+ $this->db->where("id", $del_inv_item_id);
+ $this->db->delete("purchase_invoice_item");
+
+ $this->db->query("CALL p_purchase_invoice(".$inv_id.")");
+
+ return 1;
+
+ /*
+ $sql="select count(*) as no_rec from inv_med_item where ss_no=".$del_inv_item_id;
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $sale_qty=$result[0]->no_rec;
+
+ if($sale_qty>0)
+ {
+ return 0;
+
+ }else{
+ $this->db->where("id", $del_inv_item_id);
+ $this->db->delete("purchase_invoice_item");
+
+ $this->db->query("CALL f_update_purchase_invoice(".$inv_id.")");
+
+ return 1;
+ }
+ */
+ }
+
+ public function update_purchase_item_stock_adjust($data_stock_adjuct,$item_id) {
+ $sql="select sum(qty) as total_adjust from purchase_item_stock_adjust where item_id=".$item_id;
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $sql="select *,(total_unit-total_return_unit-total_lost_unit-total_sale_unit) as Cur_unit_qty
+ from purchase_invoice_item where item_return=0 and id=".$item_id;
+ $query = $this->db->query($sql);
+ $result_item_master = $query->result();
+
+ $total_adjust=0;
+ $total_lost_unit=0;
+ $current_qty=0;
+
+ $insert_flag=0;
+
+ $qty=$data_stock_adjuct['qty'];
+
+ if(count($result_item_master)>0)
+ {
+ $total_lost_unit=$result_item_master[0]->total_lost_unit;
+ $current_qty=$result_item_master[0]->Cur_unit_qty ;
+
+ }
+
+ if(count($result)>0)
+ {
+ $total_adjust=$result[0]->total_adjust;
+ }
+
+ if($qty>0)
+ {
+ if($current_qty>=$qty)
+ {
+ $insert_flag=1;
+ }
+ }elseif($qty<0){
+ if($total_adjust>=$qty*-1)
+ {
+ $insert_flag=1;
+ }
+ }
+
+ if($insert_flag==1)
+ {
+ $total_adjust=$total_adjust+$qty;
+
+ if ($this->db->insert("purchase_item_stock_adjust", $data_stock_adjuct)) {
+ $insert_id = $this->db->insert_id();
+
+ $data = array(
+ 'total_lost_unit' => $total_adjust
+ );
+
+ $this->db->set($data);
+ $this->db->where("id", $item_id);
+ $this->db->update("purchase_invoice_item", $data);
+
+ return "Done : Re-Search Again for Update Records";
+ }else{ return "Not Insert in Stock Adjust"; }
+
+ }else{
+ return "Qty Not Correct: either Its greater then stock Qty or 0";
+ }
+
+ }
+
+ public function update_remove_status_item($data_stock_adjuct,$item_id) {
+
+ $sql="select sum(qty) as total_adjust from purchase_item_stock_adjust where item_id=".$item_id;
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $sql="select *,(total_unit-total_return_unit-total_lost_unit-total_sale_unit) as Cur_unit_qty
+ from purchase_invoice_item where item_return=0 and id=".$item_id;
+ $query = $this->db->query($sql);
+ $result_item_master = $query->result();
+
+ $total_adjust=0;
+ $total_lost_unit=0;
+ $current_qty=0;
+
+ $insert_flag=0;
+
+ if(count($result_item_master)>0)
+ {
+ $total_lost_unit=$result_item_master[0]->total_lost_unit;
+ $current_qty=$result_item_master[0]->Cur_unit_qty ;
+ }
+
+ if(count($result)>0)
+ {
+ $total_adjust=$result[0]->total_adjust;
+ }
+
+ $total_adjust=$total_adjust+$current_qty;
+
+ $data_stock_adjuct['qty']=$current_qty;
+
+ if ($this->db->insert("purchase_item_stock_adjust", $data_stock_adjuct)) {
+ $insert_id = $this->db->insert_id();
+
+ $data = array(
+ 'total_lost_unit' => $total_adjust,
+ 'remove_item' => '1'
+ );
+
+ $this->db->set($data);
+ $this->db->where("id", $item_id);
+ $this->db->update("purchase_invoice_item", $data);
+
+ return "Done : Remove ".$current_qty." Qty : Re-Search for Update Records";
+ }else{ return "Not Insert in Stock Adjust"; }
+ }
+
+ public function insert_inv_med_item_return_add($data) {
+
+ if ($this->db->insert("inv_med_item_return", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function delete_return_item($inv_item_id) {
+ $this->db->where("inv_item_id", $inv_item_id);
+ $this->db->where("return_status", '0');
+ $this->db->delete("inv_med_item_return");
+ }
+
+ public function update_return_item($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+
+ if($this->db->update("inv_med_item_return", $data))
+ {
+ return 1;
+ }else{
+ return 0;
+ }
+
+ }
+
+ public function insert_med_supplier_ledger($data) {
+
+ if($this->db->insert("med_supplier_ledger", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_supplier_ledger($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+
+ if($this->db->update("med_supplier_ledger", $data))
+ {
+ return 1;
+ }else{
+ return 0;
+ }
+
+ }
+
+ }
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Ocasemaster_M.php b/old_code_ci3/models/Ocasemaster_M.php
new file mode 100644
index 0000000..40e151d
--- /dev/null
+++ b/old_code_ci3/models/Ocasemaster_M.php
@@ -0,0 +1,53 @@
+db->insert("organization_case_master", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $pid=str_pad(substr($insert_id,-7,7),7, '0', STR_PAD_LEFT);
+ $pid='C'.date('ym').$pid;
+ $data1 = array(
+ 'case_id_code' => $pid
+ );
+
+ $this->db->set($data1);
+ $this->db->where("id", $insert_id);
+ $this->db->update("organization_case_master", $data1);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("organization_case_master", $data);
+
+
+ }
+
+
+ public function insert_org_pack($data) {
+ if ($this->db->insert("org_packing", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_org_pack($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("org_packing", $data);
+ return $old_id_no;
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Opd_M.php b/old_code_ci3/models/Opd_M.php
new file mode 100644
index 0000000..5e02a24
--- /dev/null
+++ b/old_code_ci3/models/Opd_M.php
@@ -0,0 +1,279 @@
+db->query($sql);
+ $result = $query->result_array();
+ //print_r($result);
+ return $result;
+ }
+
+ public function insert($data) {
+
+ $p_id=$data['p_id'];
+ $opd_dt=$data['apointment_date'];
+ $doc_id=$data['doc_id'];
+
+ $sql="select * from opd_master
+ where apointment_date=curdate() and (payment_status=0 or opd_status=1 ) and p_id=$p_id and doc_id=$doc_id";
+ $query = $this->db->query($sql);
+ $no_duplicate= $query->result();
+
+ $insert_id=0;
+
+ if(count($no_duplicate)==0)
+ {
+ if($this->db->insert("opd_master", $data))
+ {
+ $insert_id = $this->db->insert_id();
+
+ $sql="SELECT count(*) as xtimes from opd_master where opd_id<=".$insert_id." and p_id=".$p_id;
+ $query = $this->db->query($sql);
+ $opd_times= $query->result();
+
+ $sql="select count(*) as no_max from opd_master where apointment_date=curdate() and doc_id=".$doc_id;
+ $query = $this->db->query($sql);
+ $opd_no_data= $query->result();
+
+ $opd_no=1;
+ if(count($opd_no_data)>0)
+ {
+ $opd_no=$opd_no_data[0]->no_max;
+ }
+ //$opd_no=$opd_no+1;
+
+ $pid=str_pad(substr($insert_id,-7,7),7,0,STR_PAD_LEFT);
+ $doc_id=str_pad(substr($insert_id,-3,3),3,0,STR_PAD_LEFT);
+
+ $Oid='D'.date('ym').$pid;
+
+ $running_opd=0;
+ $last_opd_id=0;
+
+ if($data['opd_fee_type']==3)
+ {
+ $running_opd = 1;
+
+ $sql="select max(opd_id) as last_opd_id from opd_master
+ where apointment_date between date_add(curdate(),interval -4 day) and curdate()
+ and running_opd=0 and doc_id=".$doc_id. " and p_id=".$p_id;
+ $query = $this->db->query($sql);
+ $opd_no_data= $query->result();
+
+ if(count($opd_no_data)>0)
+ {
+ if($opd_no_data[0]->last_opd_id=='' || $opd_no_data[0]->last_opd_id=='0')
+ {
+ $last_opd_id=0;
+ }else{
+ $last_opd_id=$opd_no_data[0]->last_opd_id;
+ }
+ }
+ }
+
+ $dataupadate = array(
+ 'opd_code' => $Oid,
+ 'no_visit' => $opd_times[0]->xtimes,
+ 'running_opd' => $running_opd,
+ 'running_opd_id' => $last_opd_id,
+ 'opd_no'=>$opd_no,
+ );
+
+ $this->db->set($dataupadate);
+ $this->db->where("opd_id", $insert_id);
+ $this->db->update("opd_master", $dataupadate);
+
+
+ }
+ }
+
+ return $insert_id;
+ }
+
+
+ public function insert_bak($data) {
+
+ $p_id=$data['p_id'];
+ $opd_dt=$data['apointment_date'];
+ $doc_id=$data['doc_id'];
+
+ $insert_id=0;
+
+ if($data['opd_fee_type']==3)
+ {
+ $sql="SELECT * from opd_master where p_id=".$p_id." and doc_id=".$doc_id."
+ and apointment_date > date_add(sysdate(),interval -5 day)
+ order by apointment_date desc ";
+ $query = $this->db->query($sql);
+ $opd_running= $query->result();
+
+ if(count($opd_running)>0)
+ {
+ $insert_id=$opd_running[0]->opd_id;
+ $revisit_opd_id=$opd_running[0]->revisit_opd_id;
+
+ $data_visit = array(
+ 'revisit_opd_id' => $revisit_opd_id+1,
+ );
+
+ $this->db->set($data_visit);
+ $this->db->where("opd_id", $insert_id);
+ $this->db->update("opd_master", $data_visit);
+
+ }
+ }else{
+ if($this->db->insert("opd_master", $data))
+ {
+ $insert_id = $this->db->insert_id();
+
+ $sql="SELECT count(*) as xtimes from opd_master where opd_id<=".$insert_id." and p_id=".$p_id;
+ $query = $this->db->query($sql);
+ $opd_times= $query->result();
+
+ $pid=str_pad(substr($insert_id,-7,7),7,0,STR_PAD_LEFT);
+
+ $pid='D'.date('ym').$pid;
+
+ $dataupadate = array(
+ 'opd_code' => $pid,
+ 'revisit' => $opd_times[0]->xtimes,
+ );
+
+ $this->db->set($dataupadate);
+ $this->db->where("opd_id", $insert_id);
+ $this->db->update("opd_master", $dataupadate);
+ }
+ }
+
+ $sql="SELECT * from opd_visit_list where date_opd=".$opd_dt." and p_id=".$p_id;
+ $query = $this->db->query($sql);
+ $opd_visit= $query->result();
+
+ if(count($opd_visit)>0)
+ {
+ $data_visit = array(
+ 'p_name' => $data['P_name'],
+ 'opd_id' => $data['opd_id'],
+ 'opd_type' => $data['opd_fee_type'],
+ 'opd_status' => '1',
+ );
+
+ $this->db->set($data_visit);
+ $this->db->where("id", $opd_visit[0]->id);
+ $this->db->update("opd_visit_list", $data_visit);
+
+ }else{
+ $data_visit = array(
+ 'p_id' => $p_id,
+ 'p_name' => $data['P_name'],
+ 'opd_id' => $insert_id,
+ 'opd_type' => $data['opd_fee_type'],
+ 'date_opd' => $data['apointment_date'],
+ 'opd_no' => '0',
+ 'update_by' => $data['prepared_by'],
+ 'opd_status' => '1',
+ );
+
+ $this->db->insert("opd_visit_list", $data_visit);
+ }
+
+ return $insert_id;
+ }
+
+ public function update($data,$old_id_no) {
+
+ /* Auto Que */
+ $user = $this->ion_auth->user()->row();
+
+ if(isset($user->id))
+ {
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+ }else{
+ $user_id = '0';
+ $user_name = 'Mobile User';
+ }
+
+
+
+ $this->db->set($data);
+ $this->db->where("opd_id", $old_id_no);
+ $this->db->update("opd_master", $data);
+
+ $this->db->where('opd_id', $old_id_no);
+ $q = $this->db->get('opd_master');
+ // if id is unique, we want to return just one row
+ $data = $q->row_array();
+
+ $pno=$data['p_id'];
+ $doc_id=$data['doc_id'];
+ $opd_date=$data['apointment_date'];
+ $opd_status=$data['opd_status'];
+
+ $sql="select max(queue_no) as max_queue from opd_prescription
+ where date_opd_visit=curdate() and doc_id='".$doc_id."'";
+ $query = $this->db->query($sql);
+ $max_queue= $query->result();
+
+ if(count($max_queue)>0)
+ {
+ $max_queue_no=$max_queue[0]->max_queue;
+ }else{
+ $max_queue_no=0;
+ }
+
+ $max_queue_no=$max_queue_no+1;
+
+ $sql="select * from opd_prescription where visit_status=0 and opd_id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $opd_prescription= $query->result();
+
+ if(count($opd_prescription)==0 )
+ {
+
+ if($opd_status==1)
+ {
+ $datainsert = array(
+ 'opd_id' => $old_id_no,
+ 'p_id' => $pno,
+ 'revisit'=>'0',
+ 'queue_no'=>$max_queue_no,
+ 'doc_id'=>$doc_id,
+ 'date_opd_visit'=>date('Y-m-d'),
+ 'update_by'=>$user_name
+ );
+
+ $this->load->model('Prescription_M');
+ $this->Prescription_M->insert_opd_prescription($datainsert);
+
+ $msg_send="OPD in Queue Now";
+ }else{
+ $msg_send="OPD Already Done, Create Revisit";
+ }
+
+ }
+ }
+
+ public function update_opd_queue_no($opd_session_id,$doc_id,$date_opd_visit) {
+ $result = "update opd_prescription
+ SET current_queue_no=0
+ where doc_id='".$doc_id."' and date_opd_visit='".$date_opd_visit."'";
+ $qyt = $this->db->query($result);
+
+ $result = "update opd_prescription
+ SET current_queue_no=1
+ where id='".$opd_session_id."'";
+ $qyt = $this->db->query($result);
+
+ return 0;
+ }
+
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Package_M.php b/old_code_ci3/models/Package_M.php
new file mode 100644
index 0000000..ce61e17
--- /dev/null
+++ b/old_code_ci3/models/Package_M.php
@@ -0,0 +1,109 @@
+db->insert("package", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_type($data) {
+
+ if ($this->db->insert("package", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_type($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("itype_id", $old_id_no);
+ if ($this->db->update("package", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function insert_in_item($data) {
+
+ if ($this->db->insert("package_insurance", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_in_item($data,$old_id_no) {
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,2 as action,'".$user_name."' as action_by from package_insurance where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("package_insurance_update", $insertdata[0]);
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("package_insurance", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function delete_in_item($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,2 as action,'".$user_name."' as action_by from package_insurance where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("package_insurance_update", $insertdata[0]);
+ $this->db->delete("package_insurance", "id=".$old_id_no);
+ }
+
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,1 as action,'".$user_name."' as action_by from package where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("package_update", $insertdata[0]);
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("package", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/PathLab_M.php b/old_code_ci3/models/PathLab_M.php
new file mode 100644
index 0000000..680c5e7
--- /dev/null
+++ b/old_code_ci3/models/PathLab_M.php
@@ -0,0 +1,144 @@
+db->set($data);
+ $this->db->where("mstRepoKey", $old_id_no);
+ $this->db->update("lab_repo", $data);
+ }
+
+ public function insert_report($data)
+ {
+ $this->db->insert("lab_repo", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_ultrasound_report($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("radiology_ultrasound_template", $data);
+ }
+
+ public function insert_ultrasound_report($data)
+ {
+ $this->db->insert("radiology_ultrasound_template", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_item_parameter($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("mstTestKey", $old_id_no);
+ $this->db->update("lab_tests", $data);
+ }
+
+ public function insert_item_parameter($data)
+ {
+ $this->db->insert("lab_tests", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_item_parameter_option($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("lab_tests_option", $data);
+ }
+
+ public function insert_item_parameter_option($data)
+ {
+ $this->db->insert("lab_tests_option", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function insert_item_sortorder($data) {
+ $this->db->insert("lab_repotests", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_item_sortorder($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("lab_repotests", $data);
+ }
+
+ public function insert_test_request($data) {
+ $this->db->insert("lab_request", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_test_request($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("lab_request", $data);
+ }
+
+ public function insert_test_entry($data) {
+ $this->db->insert("lab_request_item", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_test_entry($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("lab_request_item", $data);
+ }
+
+ public function delete_request_entry($delete_id_no) {
+ $this->db->where('id', $delete_id_no);
+
+ $q = $this->db->get('lab_request');
+ // if id is unique, we want to return just one row
+ $data = $q->row_array();
+
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name . '['.date("d-m-Y h:i").']';
+
+ $data['remove_update_by']=$user_name;
+
+ if ($this->db->insert("lab_request_delete", $data)) {
+ $this->db->where("id", $delete_id_no);
+ $this->db->delete("lab_request");
+ return 1;
+ }else{
+ return 0;
+ }
+ }
+
+ public function insert_invoice_report($data) {
+ $this->db->insert("lab_invoice_request", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_invoice_report($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("lab_invoice_request", $data);
+ }
+
+ public function insert_lab_log($data) {
+ $this->db->insert("lab_log", $data);
+ $insert_id = $this->db->insert_id();
+ return $insert_id ;
+ }
+
+ public function update_lab_log($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("lab_log", $data);
+ }
+}
+?>
diff --git a/old_code_ci3/models/Patient_M.php b/old_code_ci3/models/Patient_M.php
new file mode 100644
index 0000000..0adfe7e
--- /dev/null
+++ b/old_code_ci3/models/Patient_M.php
@@ -0,0 +1,136 @@
+db->insert("patient_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ $pid=1000000+$insert_id;
+
+ $pid='P'.date('ym').$pid;
+ $data = array(
+ 'p_code' => $pid
+ );
+
+ $this->db->set($data);
+ $this->db->where("id", $insert_id);
+ $this->db->update("patient_master", $data);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name;
+
+ $sql="select * from patient_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $data1=$query->result_array();
+
+ if(count($data1)>0)
+ {
+ $update_emp_name=$user_id.'['.$user_name.']'.date('Y-m-d H:i:s');
+ $Old_Update_data=($data1[0]['log']==''?' ':$data1[0]['log']).PHP_EOL;
+
+ $change_data=compare_arrays($data1[0],$data);
+ if(strlen($change_data)>0)
+ {
+ $data['log']=$Old_Update_data.$change_data.'Update By :'.$update_emp_name;
+ $data['last_update']=date('Y-m-d H:i:s');
+ }
+
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("patient_master", $data);
+ }
+
+ public function update_online($data,$old_id_no) {
+
+ $user_id = 0;
+ $user_name = "online OPD";
+
+ $sql="select * from patient_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $data1=$query->result_array();
+
+ if(count($data1)>0)
+ {
+ $update_emp_name=$user_id.'['.$user_name.']'.date('Y-m-d H:i:s');
+ $Old_Update_data=($data1[0]['log']==''?' ':$data1[0]['log']).PHP_EOL;
+
+ $change_data=compare_arrays($data1[0],$data);
+ if(strlen($change_data)>0)
+ {
+ $data['log']=$Old_Update_data.$change_data.'Update By :'.$update_emp_name;
+ $data['last_update']=date('Y-m-d H:i:s');
+ }
+
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("patient_master", $data);
+ }
+
+ public function insert_card($data) {
+
+ if ($this->db->insert("hc_insurance_card", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_log_patient_multiple($data) {
+
+ if ($this->db->insert("log_patient_multiple", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_card($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("hc_insurance_card", $data);
+ }
+
+ function get_city($q){
+ $this->db->select('*');
+ $this->db->like('city', $q);
+ $query = $this->db->get('city_auto_u');
+ if($query->num_rows() > 0){
+ foreach ($query->result_array() as $row){
+ $new_row['label']=htmlentities(stripslashes($row['city'])).' | '.htmlentities(stripslashes($row['district'])).' | '.htmlentities(stripslashes($row['state']));
+ $new_row['value']=htmlentities(stripslashes($row['city']));
+ $new_row['l_city']=htmlentities(stripslashes($row['city']));
+ $new_row['l_district']=htmlentities(stripslashes($row['district']));
+ $new_row['l_state']=htmlentities(stripslashes($row['state']));
+ $row_set[] = $new_row; //build an array
+ }
+ echo json_encode($row_set); //format the array into json data
+ }
+ }
+
+
+ public function insert_remark($data) {
+
+ if ($this->db->insert("patient_remark", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Patienttag_M.php b/old_code_ci3/models/Patienttag_M.php
new file mode 100644
index 0000000..2401ea9
--- /dev/null
+++ b/old_code_ci3/models/Patienttag_M.php
@@ -0,0 +1,46 @@
+db->insert("tag_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_tag_master($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("tag_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function insert_patient_tag_assign($data) {
+
+ if ($this->db->insert("patient_tag_assign", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_patient_tag_assign($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("cpatient_tag_assign", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Payment_M.php b/old_code_ci3/models/Payment_M.php
new file mode 100644
index 0000000..c842abc
--- /dev/null
+++ b/old_code_ci3/models/Payment_M.php
@@ -0,0 +1,140 @@
+db->insert("payment_history", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("payment_history", $data);
+ }
+
+ public function insert_payment_history_log($data) {
+
+ if ($this->db->insert("payment_history_log", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function insert_refundorder($data) {
+
+ if ($this->db->insert("refund_order", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+
+ public function update_ipd_payment_to_admin($Payment_data,$ipd_master) {
+
+ $ipd_no=$Payment_data['ipd_id'];
+ $group_id=$Payment_data['Med_Group_id'];
+ $amount=$Payment_data['amount'];
+
+ $sql="Select * from inv_med_group where med_group_id=$group_id";
+ $query = $this->db->query($sql);
+ $inv_med_group= $query->result();
+
+ $net_amount=0;
+ $payment_received=0;
+ if($Payment_data['cr_dr']==0){
+ $last_payment=$amount;
+ }else{
+ $last_payment=$amount*-1;
+ }
+ $pay_datetime=$Payment_data['payment_date'];
+ $pharmacy_name="'".M_store."'";
+ $admin_phone_no="'".M_Admin_PhoneNo."'";
+ $recevied_user=$Payment_data['update_by'];
+
+
+ if(count($inv_med_group)>0){
+ $net_amount=$inv_med_group[0]->net_amount;
+ $payment_received=$inv_med_group[0]->payment_received;
+ }
+
+ $web_msg='Payment Received from IPD No. :'.$ipd_no.' ';
+ $web_msg.='Patient Name :'.$ipd_master[0]->P_name.' ';
+ $web_msg.='Total Billed amt. :'.$net_amount.' ';
+ $web_msg.='Total Paid amt. :'.$payment_received.' ';
+ $web_msg.='Last Paid amt. :'.$last_payment.' ';
+ $web_msg.='Pay Date Time :'.$pay_datetime.' ';
+ $web_msg.='Recevied By :'.$recevied_user.' ';
+ $web_msg.='Pharmacy Name :'.$pharmacy_name.' ';
+
+ $data = array(
+ 'to_number'=> $admin_phone_no,
+ 'message'=>$web_msg,
+ );
+
+ if ($this->db->insert("sms_outbox", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_refundorder($data,$rid) {
+ $this->db->set($data);
+ $this->db->where("id", $rid);
+ $this->db->update("refund_order", $data);
+ }
+
+ public function insert_org_payment($data) {
+
+ if ($this->db->insert("org_payment_request", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_org_payment($data,$rid) {
+
+ $this->db->set($data);
+ $this->db->where("id", $rid);
+ $this->db->update("org_payment_request", $data);
+ }
+
+ public function cancel_in_payment_history($old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,2 as action,'".$user_name."' as cancel_by,,'".$user_id."' as cancel_by_id
+ from payment_history where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("payment_history_cancel", $insertdata[0]);
+ $this->db->delete("payment_history", "id=".$old_id_no);
+ }
+
+ return 0;
+ }
+
+
+
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Prescription_M.php b/old_code_ci3/models/Prescription_M.php
new file mode 100644
index 0000000..c6471ce
--- /dev/null
+++ b/old_code_ci3/models/Prescription_M.php
@@ -0,0 +1,240 @@
+db->insert("opd_prescription", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_opd_prescription($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("opd_prescription", $data);
+ }
+
+
+
+ public function insert_p_investigation($data) {
+ if ($this->db->insert("opd_prescription_investigation", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function remove_p_investigation($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("opd_prescription_investigation");
+ }
+
+
+ // Prescription Surgery
+
+ public function insert_p_surgery($data) {
+ if ($this->db->insert("opd_prescription_procedures", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_surgery($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("opd_prescription_procedures", $data);
+ }
+
+ public function remove_p_surgery($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("opd_prescription_procedures");
+ }
+
+ // Prescription Complaint
+
+ public function insert_p_complaint($data) {
+ if ($this->db->insert("opd_prescription_complaint", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_complaint($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("opd_prescription_complaint", $data);
+ }
+
+ public function remove_p_complaint($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("opd_prescription_complaint");
+ }
+
+
+ // Prescription Diagnosis
+
+ public function insert_p_diagnosis($data) {
+ if ($this->db->insert("opd_prescription_diagnosis", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_diagnosis($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("opd_prescription_diagnosis", $data);
+ }
+
+ public function remove_p_diagnosis($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("opd_prescription_diagnosis");
+ }
+
+ // Prescription Medical
+
+ public function insert_p_medical($data) {
+ if ($this->db->insert("opd_prescrption_prescribed", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_p_medical($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("opd_prescrption_prescribed", $data);
+ }
+
+ public function remove_p_medical($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("opd_prescrption_prescribed");
+ }
+
+ //OPD Med Master
+
+ public function insert_med_master($data) {
+ if ($this->db->insert("opd_med_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_master($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("opd_med_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function remove_med_master($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("opd_med_master");
+ }
+
+ // opd advice
+
+ public function insert_opd_patient_advice($data) {
+ if ($this->db->insert("opd_prescription_advice", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_opd_patient_advice($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("opd_prescription_advice", $data);
+ }
+
+ public function remove_opd_patient_advice($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("opd_prescription_advice");
+ }
+
+ public function insert_patient_glucose_chart($data) {
+ if ($this->db->insert("patient_glucose_chart", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_patient_glucose_chart($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("patient_glucose_chart", $data);
+ }
+
+ public function remove_patient_glucose_chart($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("patient_glucose_chart");
+ }
+
+
+ public function insert_patient_investigation($data) {
+ if ($this->db->insert("patient_investigation", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_patient_investigation($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("patient_investigation", $data);
+ }
+
+ public function remove_patient_investigation($delid) {
+ $this->db->where("id", $delid);
+ $this->db->delete("patient_investigation");
+ }
+
+ // Update
+ public function update_patient_morbidities($p_id,$morbidities,$remove=0) {
+ $sql="SELECT * FROM patient_morbidities WHERE p_id = $p_id and morbidities = $morbidities";
+ $query = $this->db->query($sql);
+ $result = $query->result();
+
+ $count = count($result);
+
+ $m_id=0;
+
+ if($count>0){
+ $m_id=$result[0]->id;
+ }
+
+ $data=array(
+ 'p_id' => $p_id,
+ 'morbidities'=> $morbidities,
+ 'update_date'=> date('Y-m-d h:m:i'),
+ );
+
+ if($remove==0){
+ if ($m_id==0) {
+ $m_id=$this->db->insert('patient_morbidities', $data);
+ }
+ }elseif($remove==1){
+ $this->db->where("id", $m_id);
+ $this->db->delete("patient_morbidities");
+ }
+
+ return $m_id;
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Product_master_M.php b/old_code_ci3/models/Product_master_M.php
new file mode 100644
index 0000000..1895737
--- /dev/null
+++ b/old_code_ci3/models/Product_master_M.php
@@ -0,0 +1,205 @@
+db->insert("med_product_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+
+
+ public function update($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,'".$user_id."' as update_by_id,'".$user_name."' as update_by
+ from med_product_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("med_product_master_update", $insertdata[0]);
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("med_product_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function delete_master($old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,'".$user_id."' as update_by_id,'".$user_name."' as update_by
+ from med_product_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("med_product_master_update", $insertdata[0]);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->delete("med_product_master")) {
+ return 1;
+ }else
+ return 0;
+ }else{
+ return 0;
+ }
+
+ }
+
+
+ public function insert_update_product_cat_assign($data,$med_id) {
+
+ $sql="select m.id,m.med_cat_desc,a.med_cat_id AS a_id,t.id AS t_id , if(a.id=t.id,0,if(a.id IS NULL AND t.id=m.id,1,if(a.med_cat_id=m.id AND t.id IS NULL,2,0))) AS ins_del_action,a.id AS rec_id
+ FROM (med_product_cat_master m Left join med_product_cat_assign a on m.id=a.med_cat_id and a.med_product_id=$med_id )
+ LEFT JOIN med_product_cat_master t ON m.id=t.id and t.id in ($data)";
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+
+
+ foreach($insertdata as $row)
+ {
+ if ($row->ins_del_action==1) {
+ $data_ins['med_product_id']=$med_id;
+ $data_ins['med_cat_id']=$row->id;
+
+ $this->db->insert("med_product_cat_assign", $data_ins);
+ }elseif($row->ins_del_action==2){
+ $this->db->where("id", $row->rec_id);
+ $this->db->delete("med_product_cat_assign");
+ }
+ }
+
+ return 1;
+ }
+
+
+ public function insert_med_indent_request($data) {
+ if ($this->db->insert("med_indent_request", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $Ind_code=str_pad(substr($insert_id,-5,5),5,0,STR_PAD_LEFT);
+
+ $Ind_code='R'.date('ymd').$Ind_code;
+
+ $data = array(
+ 'indent_code' => $Ind_code,
+ );
+
+ $this->db->set($data);
+ $this->db->where("indent_id", $insert_id);
+ $this->db->update("med_indent_request", $data);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_indent_request($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("indent_id", $old_id_no);
+ $this->db->update("med_indent_request", $data);
+
+ }
+
+ public function insert_med_indent_request_items($data) {
+ if ($this->db->insert("med_indent_request_items", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_indent_request_items($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("med_indent_request_items", $data);
+ }
+
+ public function delete_med_indent_request_item($indent_id,$del_indent_item_id) {
+
+ $this->db->where("id", $del_indent_item_id);
+ $this->db->delete("med_indent_request_items");
+
+ $this->db->where("indent_item_id", $del_indent_item_id);
+ $this->db->delete("med_indent_process_items");
+
+ return 1;
+ }
+
+ //For Med_indent_process
+ public function insert_med_indent_process($data) {
+ if ($this->db->insert("med_indent_process", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function update_med_indent_process($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("indent_id", $old_id_no);
+ $this->db->update("med_indent_process", $data);
+ }
+
+ // Med_indent_process Items
+
+ public function insert_med_indent_process_items($data) {
+ if ($this->db->insert("med_indent_process_items", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_indent_process_items($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("med_indent_process_items", $data);
+ }
+
+ public function delete_med_indent_process_item($indent_id,$del_indent_item_id) {
+ $this->db->where("id", $del_indent_item_id);
+ $this->db->delete("med_indent_process_items");
+ return 1;
+
+ }
+
+ // Med_indent_accept Items Table : store_stock
+
+ public function insert_store_stock_items($data) {
+ if ($this->db->insert("store_stock", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_store_stock_items($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("store_stock", $data);
+ }
+
+ public function delete_store_stock_item($id) {
+ $this->db->where("id", $id);
+ $this->db->delete("store_stock");
+ return 1;
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Product_stock_master_M.php b/old_code_ci3/models/Product_stock_master_M.php
new file mode 100644
index 0000000..656d9a6
--- /dev/null
+++ b/old_code_ci3/models/Product_stock_master_M.php
@@ -0,0 +1,175 @@
+db->insert("med_store_product_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,'".$user_id."' as update_by_id,'".$user_name."' as update_by
+ from med_store_product_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("med_store_product_master_update", $insertdata[0]);
+ }
+
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("med_store_product_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function delete_master($old_id_no) {
+ $user = $this->ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'['.$user_id.']';
+
+ $sql="select *,'".$user_id."' as update_by_id,'".$user_name."' as update_by
+ from med_store_product_master where id=".$old_id_no;
+ $query = $this->db->query($sql);
+ $insertdata= $query->result();
+
+ if(count($insertdata)>0){
+ $this->db->insert("med_store_product_master_update", $insertdata[0]);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->delete("med_store_product_master")) {
+ return 1;
+ }else
+ return 0;
+ }else{
+ return 0;
+ }
+
+ }
+
+ public function insert_med_indent_request($data) {
+ if ($this->db->insert("med_indent_request", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ $Ind_code=str_pad(substr($insert_id,-5,5),5,0,STR_PAD_LEFT);
+
+ $Ind_code='R'.date('ymd').$Ind_code;
+
+ $data = array(
+ 'indent_code' => $Ind_code,
+ );
+
+ $this->db->set($data);
+ $this->db->where("indent_id", $insert_id);
+ $this->db->update("med_indent_request", $data);
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_indent_request($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("indent_id", $old_id_no);
+ $this->db->update("med_indent_request", $data);
+
+ }
+
+ public function insert_med_indent_request_items($data) {
+ if ($this->db->insert("med_indent_request_items", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_indent_request_items($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("med_indent_request_items", $data);
+ }
+
+ public function delete_med_indent_request_item($indent_id,$del_indent_item_id) {
+
+ $this->db->where("id", $del_indent_item_id);
+ $this->db->delete("med_indent_request_items");
+
+ $this->db->where("indent_item_id", $del_indent_item_id);
+ $this->db->delete("med_indent_process_items");
+
+ return 1;
+ }
+
+ //For Med_indent_process
+ public function insert_med_indent_process($data) {
+ if ($this->db->insert("med_indent_process", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function update_med_indent_process($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("indent_id", $old_id_no);
+ $this->db->update("med_indent_process", $data);
+ }
+
+ // Med_indent_process Items
+
+ public function insert_med_indent_process_items($data) {
+ if ($this->db->insert("med_indent_process_items", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_med_indent_process_items($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("med_indent_process_items", $data);
+ }
+
+ public function delete_med_indent_process_item($indent_id,$del_indent_item_id) {
+ $this->db->where("id", $del_indent_item_id);
+ $this->db->delete("med_indent_process_items");
+ return 1;
+
+ }
+
+ // Med_indent_accept Items Table : store_stock
+
+ public function insert_store_stock_items($data) {
+ if ($this->db->insert("store_stock", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_store_stock_items($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ $this->db->update("store_stock", $data);
+ }
+
+ public function delete_store_stock_item($id) {
+ $this->db->where("id", $id);
+ $this->db->delete("store_stock");
+ return 1;
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Reffer_M.php b/old_code_ci3/models/Reffer_M.php
new file mode 100644
index 0000000..2c699dd
--- /dev/null
+++ b/old_code_ci3/models/Reffer_M.php
@@ -0,0 +1,27 @@
+db->insert("refer_master", $data)) {
+ $insert_id = $this->db->insert_id();
+
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("refer_master", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+}
\ No newline at end of file
diff --git a/old_code_ci3/models/SMS_M.php b/old_code_ci3/models/SMS_M.php
new file mode 100644
index 0000000..de7792c
--- /dev/null
+++ b/old_code_ci3/models/SMS_M.php
@@ -0,0 +1,45 @@
+db->insert("sms_inbox", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_sms_inbox($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("sms_inbox", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+
+ public function insert_sms_outbox($data) {
+ if ($this->db->insert("sms_outbox", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ }else
+ return 0;
+ }
+
+ public function update_sms_outbox($data,$old_id_no) {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("sms_outbox", $data)) {
+ return 1;
+ }else
+ return 0;
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/models/Stock_M.php b/old_code_ci3/models/Stock_M.php
new file mode 100644
index 0000000..9274e75
--- /dev/null
+++ b/old_code_ci3/models/Stock_M.php
@@ -0,0 +1,204 @@
+db->insert("invoice_stock_master", $data)) {
+ $insert_id = $this->db->insert_id();
+ $pid = str_pad(substr($insert_id, -7, 7), 7, 0, STR_PAD_LEFT);
+
+ $pid = 'S' . date('ym') . $pid;
+
+ $data1 = array(
+ 'indent_code' => $pid
+ );
+
+ $this->db->set($data1);
+ $this->db->where("id", $insert_id);
+ $this->db->update("invoice_stock_master", $data1);
+ return $insert_id;
+ } else
+ return 0;
+ }
+
+
+ public function add_indentitem($data)
+ {
+ if ($this->db->insert("inv_stock_item", $data)) {
+ $insert_id = $this->db->insert_id();
+ $store_stock_id = $data['store_stock_id'];
+ $this->db->query("CALL p_stock_update_purchase_id_store(" . $store_stock_id . ")");
+ $this->db->query("CALL p_update_med_GST_store(" . $data['indent_id'] . ")");
+ return $insert_id;
+ } else
+ return 0;
+ }
+
+ public function update_indentitem($data, $old_id_no)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+
+ if ($this->db->update("inv_stock_item", $data)) {
+ $store_stock_id = $data['store_stock_id'];
+ $this->db->query("CALL p_stock_update_purchase_id_store(" . $store_stock_id . ")");
+ $this->db->query("CALL p_update_med_GST_store(" . $data['indent_id'] . ")");
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public function delete_indentitem($itemid, $inv_items)
+ {
+ $this->db->delete("inv_stock_item", "id=" . $itemid);
+
+ $update_emp_name = $this->session->userdata('username') . '[' . $this->session->userdata('agent_id') . ']' . date('Y-m-d H:i:s');
+
+ $add_data = array(
+ 'delete_by' => $update_emp_name,
+ );
+
+ $data = array_merge($inv_items, $add_data);
+
+ $store_stock_id = $data['store_stock_id'];
+
+ //echo "Purchase Id :".$store_stock_id;
+
+ $this->db->insert("inv_stock_item_delete", $data);
+ $this->db->query("CALL p_update_med_GST_store(" . $data['indent_id'] . ")");
+
+ $this->db->query("CALL p_stock_update_purchase_id_store(" . $store_stock_id . ")");
+ }
+
+ public function update_invoice_final($inv_id)
+ {
+ $this->db->query("CALL p_update_med_GST_store(" . $inv_id . ")");
+ }
+
+
+
+ //Purchase Table
+ public function insert_purchase($data)
+ {
+
+ $this->db->db_debug = false;
+
+ if ($this->db->insert("purchase_invoice_stock", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ } else
+ return 0;
+ }
+
+ public function update_purchase($data, $old_id_no)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("purchase_invoice_stock", $data)) {
+ //$this->db->query("CALL p_purchase_invoice(".$old_id_no.")");
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public function delete_purchase($inv_id)
+ {
+
+ $this->db->where("id", $inv_id);
+ $this->db->delete("purchase_invoice_stock");
+
+ return 1;
+ }
+
+ //Purchase Item
+
+ public function insert_purchase_item($data)
+ {
+ if ($this->db->insert("purchase_invoice_item_stock", $data)) {
+ $insert_id = $this->db->insert_id();
+ $this->db->query("CALL f_update_purchase_invoice_stock(" . $insert_id . ")");
+ return $insert_id;
+ } else
+ return 0;
+ }
+
+ public function update_purchase_item($data, $old_id_no)
+ {
+ $this->db->set($data);
+ $this->db->where("id", $old_id_no);
+ if ($this->db->update("purchase_invoice_item_stock", $data)) {
+ $this->db->query("CALL f_update_purchase_invoice_stock(" . $old_id_no . ")");
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public function delete_purchase_item($inv_id, $del_inv_item_id)
+ {
+
+ $this->db->where("id", $del_inv_item_id);
+ if ($this->db->delete("purchase_invoice_item_stock")) {
+
+ $this->db->query("CALL p_purchase_invoice_stock(" . $inv_id . ")");
+
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ public function insert_drug_add($data)
+ {
+ if ($this->db->insert("drug_temp", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ } else
+ return 0;
+ }
+
+ public function update_drug($data, $old_id_no)
+ {
+
+ $this->db->set($data);
+ $this->db->where("item_id", $old_id_no);
+
+ if ($this->db->update("drug_temp", $data)) {
+ return 1;
+ } else {
+ return 0;
+ }
+ }
+
+ // Store Supplier
+
+ public function insert_supplier($data)
+ {
+
+ if ($this->db->insert("stock_supplier", $data)) {
+ $insert_id = $this->db->insert_id();
+ return $insert_id;
+ } else
+ return 0;
+ }
+
+ public function update_supplier($data, $old_id_no)
+ {
+ $this->db->set($data);
+ $this->db->where("sid", $old_id_no);
+ if ($this->db->update("stock_supplier", $data)) {
+ return $old_id_no;
+ } else {
+ return 0;
+ }
+ }
+}
diff --git a/old_code_ci3/models/Store_M.php b/old_code_ci3/models/Store_M.php
new file mode 100644
index 0000000..ac688e0
--- /dev/null
+++ b/old_code_ci3/models/Store_M.php
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/old_code_ci3/views/AdminMain.php b/old_code_ci3/views/AdminMain.php
new file mode 100644
index 0000000..e856e6b
--- /dev/null
+++ b/old_code_ci3/views/AdminMain.php
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/ControlSide.php b/old_code_ci3/views/ControlSide.php
new file mode 100644
index 0000000..1ec7264
--- /dev/null
+++ b/old_code_ci3/views/ControlSide.php
@@ -0,0 +1,193 @@
+
+
+
+
+
diff --git a/old_code_ci3/views/DocAdmin/doc_input_list.php b/old_code_ci3/views/DocAdmin/doc_input_list.php
new file mode 100644
index 0000000..4c3435a
--- /dev/null
+++ b/old_code_ci3/views/DocAdmin/doc_input_list.php
@@ -0,0 +1,103 @@
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ #
+ Input Name
+ Input Code
+ Action
+
+
+
+
+
+ =$i+1 ?>
+ =$doc_Item_List[$i]->input_name ?>
+ =$doc_Item_List[$i]->input_code ?>
+
+
+
+
+
+
+ item_id;
+ $sort_current=$doc_Item_List[$i]->short_order;
+
+ if($i+1 < count($doc_Item_List))
+ {
+ $option_next=$doc_Item_List[$i+1]->item_id;
+ $sort_next=$doc_Item_List[$i+1]->short_order;
+
+ echo '
+ ';
+ }
+ if($i>0)
+ {
+ $option_prev=$doc_Item_List[$i-1]->item_id;
+ $sort_prev=$doc_Item_List[$i-1]->short_order;
+
+ echo '
+ ';
+
+ }
+ ?>
+
+
+
+
+
+
+
+ #
+ Input Name
+ Input Code
+ Action
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/DocAdmin/doc_item_edit.php b/old_code_ci3/views/DocAdmin/doc_item_edit.php
new file mode 100644
index 0000000..764724f
--- /dev/null
+++ b/old_code_ci3/views/DocAdmin/doc_item_edit.php
@@ -0,0 +1,139 @@
+0)
+ {
+ $input_id=$input_parameter[0]->id;
+ $input_name=$input_parameter[0]->input_name;
+ $input_code=$input_parameter[0]->input_code;
+ $input_type=$input_parameter[0]->input_type;
+ $input_default_value=$input_parameter[0]->input_default_value;
+ }
+?>
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ Parameter Name
+
+
+
+
+
+
+
+
+
+
+ Parameter Type
+
+ >Single Line Text
+ >Option Text
+ >Date
+ >Multiple Line Text
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/DocAdmin/doc_letterhead_print.php b/old_code_ci3/views/DocAdmin/doc_letterhead_print.php
new file mode 100644
index 0000000..a09044f
--- /dev/null
+++ b/old_code_ci3/views/DocAdmin/doc_letterhead_print.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ =$bar_content?>
+
+
+
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/DocAdmin/doc_list.php b/old_code_ci3/views/DocAdmin/doc_list.php
new file mode 100644
index 0000000..5be4200
--- /dev/null
+++ b/old_code_ci3/views/DocAdmin/doc_list.php
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+ Title
+ Description
+ Action
+
+
+
+
+
+ =$doc_master[$i]->doc_name ?>
+ =$doc_master[$i]->doc_desc ?>
+
+ Input List
+ Edit
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/DocAdmin/doc_master_edit.php b/old_code_ci3/views/DocAdmin/doc_master_edit.php
new file mode 100644
index 0000000..7abd366
--- /dev/null
+++ b/old_code_ci3/views/DocAdmin/doc_master_edit.php
@@ -0,0 +1,157 @@
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ Document Name
+ 0)
+ {
+ $doc_name=$doc_master[0]->doc_name;
+ $df_id=$doc_master[0]->df_id;
+ $doc_desc=$doc_master[0]->doc_desc;
+ $HTMLData=$doc_master[0]->doc_raw_format;
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ =$HTMLData ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id)%50]->code_code_2.';">'.$doc_pre_input[$i]->input_name.' ['.$doc_pre_input[$i]->input_code.']
';
+ }
+ ?>
+
+
+
+
+
+
+
+ Custom Define Input Parameter
+
+
+
+
+ item_id)%50]->code_code_2.';">'.$doc_Item_List[$i]->input_name.' ['.$doc_Item_List[$i]->input_code.']
';
+ }
+ ?>
+
+
+
+
+ Document Input List
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Doctor_Profile/Doctor_Search_V.php b/old_code_ci3/views/Doctor_Profile/Doctor_Search_V.php
new file mode 100644
index 0000000..813527b
--- /dev/null
+++ b/old_code_ci3/views/Doctor_Profile/Doctor_Search_V.php
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ Phone Number
+ EMail
+ Action
+
+
+
+
+
+ =$data[$i]->p_title ?> =$data[$i]->p_fname ?>
+ =$data[$i]->mphone1 ?>
+ =$data[$i]->email1 ?>
+ Edit It....
+
+
+
+
+
+ Name
+ Phone Number
+ EMail
+ Action
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Doctor_Profile/Doctor_V.php b/old_code_ci3/views/Doctor_Profile/Doctor_V.php
new file mode 100644
index 0000000..bb23567
--- /dev/null
+++ b/old_code_ci3/views/Doctor_Profile/Doctor_V.php
@@ -0,0 +1,105 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Title
+
+ Dr.
+ Mr.
+ Ms.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Save
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Doctor_Profile/Doctor_profile_V.php b/old_code_ci3/views/Doctor_Profile/Doctor_profile_V.php
new file mode 100644
index 0000000..a93029d
--- /dev/null
+++ b/old_code_ci3/views/Doctor_Profile/Doctor_profile_V.php
@@ -0,0 +1,300 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Title
+
+ p_title)?>>Dr.
+ p_title)?>>Mr.
+ p_title)?>>Ms.
+
+
+
+
+
+
+
+
+
+
+ Short Decription
+ =$data[0]->doc_sign ?>
+
+
+
+
+
+
+
+
+
+
+
+ ------Select-------
+ id.'">'.$row->SpecName.'';
+ }
+ ?>
+
+
+ Add +
+
+
+
+
+
+
+
+
+
+
+
+
+ '
');
+ $this->table->set_template($table_property);
+ $this->table->set_heading('Fee Type', 'Description', 'Amount');
+ foreach($doc_fee_list as $row)
+ {
+ if($row->id=='')
+ {
+ $button_code=' Not Define';
+ }else{
+ $button_code='Remove ';
+ }
+
+ $this->table->add_row($row->fee_type, $row->doc_fee_desc, $row->amount,$button_code);
+ }
+ echo $this->table->generate();
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Doctor_Search_V.php b/old_code_ci3/views/Doctor_Search_V.php
new file mode 100644
index 0000000..fc59066
--- /dev/null
+++ b/old_code_ci3/views/Doctor_Search_V.php
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ Phone Number
+ EMail
+ Action
+
+
+
+
+
+ =$data[$i]->p_title ?> =$data[$i]->p_fname ?>
+ =$data[$i]->mphone1 ?>
+ =$data[$i]->email1 ?>
+ Edit It....
+
+
+
+
+
+ Name
+ Phone Number
+ EMail
+ Action
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Doctor_V.php b/old_code_ci3/views/Doctor_V.php
new file mode 100644
index 0000000..d2e9ed5
--- /dev/null
+++ b/old_code_ci3/views/Doctor_V.php
@@ -0,0 +1,108 @@
+
+
+
+
+
+
+ 'myform','role'=>'form','class'=>'form1');
+ echo form_open('Doctor/AddNew',$attributes); ?>
+
+
+
+ Title
+
+ Dr.
+ Mr.
+ Ms.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Save
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Doctor_profile_V.php b/old_code_ci3/views/Doctor_profile_V.php
new file mode 100644
index 0000000..2b5463b
--- /dev/null
+++ b/old_code_ci3/views/Doctor_profile_V.php
@@ -0,0 +1,313 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Title
+
+ p_title)?>>Dr.
+ p_title)?>>Mr.
+ p_title)?>>Ms.
+
+
+
+
+
+
+
+
+
+
+ Short Decription
+ =$data[0]->doc_sign ?>
+
+
+
+
+
+
+
+
+
+
+
+ ------Select-------
+ id.'">'.$row->SpecName.'';
+ }
+ ?>
+
+
+ Add +
+
+
+
+
+
+
+
+
+
+
+
+
+ '
');
+ $this->table->set_template($table_property);
+ $this->table->set_heading('Fee Type', 'Description', 'Amount');
+ foreach($doc_fee_list as $row)
+ {
+ if($row->id=='')
+ {
+ $button_code=' Not Define';
+ }else{
+ $button_code='Remove ';
+ }
+
+ $this->table->add_row($row->fee_type, $row->doc_fee_desc, $row->amount,$button_code);
+ }
+ echo $this->table->generate();
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/DocumentPatient/Doc_update_pre_value.php b/old_code_ci3/views/DocumentPatient/Doc_update_pre_value.php
new file mode 100644
index 0000000..f35ff54
--- /dev/null
+++ b/old_code_ci3/views/DocumentPatient/Doc_update_pre_value.php
@@ -0,0 +1,134 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+ 0) {
+ for ($i = 0; $i < count($doc_format_sub); ++$i) { ?>
+
+
+ =$doc_format_sub[$i]->input_name?>
+
+
+ =$doc_format_sub[$i]->p_doc_raw_value?>
+
+ input_type ==1)
+ {
+ echo '
+
+
+ '.$doc_format_sub[$i]->input_name.'
+ ';
+ $row_data=explode(',',$doc_format_sub[$i]->p_doc_raw_value);
+
+ for ($j = 0; $j < count($row_data); ++$j)
+ {
+ //$col_data=explode(':',$row_data[$j]);
+ //echo '['.$col_data[1].']'.$col_data[2].' ';
+ echo ''.$row_data[$j].' ';
+ }
+ echo "
+
+
";
+ }elseif($doc_format_sub[$i]->input_type ==2){
+ echo '
+
';
+ }elseif($doc_format_sub[$i]->input_type ==3){
+ echo '
+
+
+ '.$doc_format_sub[$i]->input_name.'
+ '.$doc_format_sub[$i]->p_doc_raw_value.'
+
+
';
+ }else{
+ echo '
+
+
+ '.$doc_format_sub[$i]->input_name.'
+
+
+
';
+ }
+ ?>
+
+ Save
+
+
+
+
+
+ Report Complie
+ Edit Document
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/DocumentPatient/Patient_Doc_Edit.php b/old_code_ci3/views/DocumentPatient/Patient_Doc_Edit.php
new file mode 100644
index 0000000..9d3ccd9
--- /dev/null
+++ b/old_code_ci3/views/DocumentPatient/Patient_Doc_Edit.php
@@ -0,0 +1,104 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ =$patient_doc[0]->raw_data ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/DocumentPatient/Patient_Doc_master.php b/old_code_ci3/views/DocumentPatient/Patient_Doc_master.php
new file mode 100644
index 0000000..7504c07
--- /dev/null
+++ b/old_code_ci3/views/DocumentPatient/Patient_Doc_master.php
@@ -0,0 +1,139 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+ Document Type
+
+ Not in List
+ df_id.' >'.$row->doc_name.'';
+ }
+ ?>
+
+
+
+
+
+ Doctor Name
+
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Issue Date
+ Document Name
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->str_date_issue.' ';
+ echo ''.$row->doc_name.' ';
+ if($row->update_pre_value==0)
+ {
+ echo 'Update Pre-Data
+ ';
+
+ }else{
+ echo 'Edit
+ ';
+ }
+
+ echo '';
+ $srno=$srno+1;
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Footer.php b/old_code_ci3/views/Footer.php
new file mode 100644
index 0000000..88fa063
--- /dev/null
+++ b/old_code_ci3/views/Footer.php
@@ -0,0 +1,345 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ DST
+
+ DevSoft Tech
+
+
+
+
+
+ 'myform');
+ echo form_open('Report/customer_list_1',$attributes); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/Bed_panel.php b/old_code_ci3/views/IPD/Bed_panel.php
new file mode 100644
index 0000000..0c8ed1c
--- /dev/null
+++ b/old_code_ci3/views/IPD/Bed_panel.php
@@ -0,0 +1,127 @@
+
+
+
+
+
+
+ Room
+ BED
+ UHID ID
+ Patient Name
+ TPA
+
+
+
+
+
+ =$row->room_name?>
+ =$row->bed_no?>
+ =$row->ipd_code?> =$row->p_code?>
+ =$row->p_fname?> =$row->p_relative?> =$row->p_rname?>
+ =$row->admit_type?>
+
+
+
+
+
+ Room
+ BED
+ UHID/IPD ID
+ Patient Name
+ TPA
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Assign/Change Room
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/IPDList_V.php b/old_code_ci3/views/IPD/IPDList_V.php
new file mode 100644
index 0000000..b28e2ec
--- /dev/null
+++ b/old_code_ci3/views/IPD/IPDList_V.php
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Bed No.[Type]
+ Register Date
+ No. of Days
+ Dr. Name
+ Admit Type
+ Amount
+
+
+
+
+
+
+ =$data[$i]->ipd_code ?>
+ [=$data[$i]->p_code ?>] =$data[$i]->p_fname ?> =$data[$i]->p_rname ?>
+ =$data[$i]->Bed_Desc ?>
+ =$data[$i]->str_register_date ?>
+ =$data[$i]->no_days ?>
+ =$data[$i]->doc_name ?>
+ =$data[$i]->admit_type ?> =$data[$i]->Org_Status ?>
+ C:=$data[$i]->charge_amount ?>/M:=$data[$i]->med_amount ?>/P:=$data[$i]->paid_amount?>/B:=$data[$i]->balance?>
+ Got It....
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Register Date
+ Admit Type
+ Amount
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/IPD_Medical_Invoice_Panel.php b/old_code_ci3/views/IPD/IPD_Medical_Invoice_Panel.php
new file mode 100644
index 0000000..f559124
--- /dev/null
+++ b/old_code_ci3/views/IPD/IPD_Medical_Invoice_Panel.php
@@ -0,0 +1,87 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/IPD_View.php b/old_code_ci3/views/IPD/IPD_View.php
new file mode 100644
index 0000000..ff7c7c2
--- /dev/null
+++ b/old_code_ci3/views/IPD/IPD_View.php
@@ -0,0 +1,271 @@
+
+
+
+
+
+
+
+
Name
+
+
+ =$person_info[0]->p_fname?>
+
+ Phone Number : =$person_info[0]->mphone1?>
+
+
+
+
Relative Name
+
+
+ =$ipd_info[0]->contact_person_Name?>
+ Phone Number : =$ipd_info[0]->P_mobile1?> , =$ipd_info[0]->P_mobile2?>
+
+
+
+
Address
+
+
+ =$person_info[0]->add1?>,
+ =$person_info[0]->add2?>,
+ =$person_info[0]->city?>,
+ =$person_info[0]->state?>,
+
+
+
+
+
Admit Date
+
+ Admit Date : =MysqlDate_to_str($ipd_info[0]->register_date) ?> Time : =$ipd_info[0]->reg_time ?>
+
+ ipd_status>0) { ?>
+
+ Discharge Date : =MysqlDate_to_str($ipd_info[0]->discharge_date) ?> =$ipd_info[0]->discharge_time ?>
+
+
+
+
Associated Doctors
+
+ p_fname.' ';
+ if ($this->ion_auth->in_group('IPDAdmit')) {
+ echo ' Remove ';
+ }
+ echo ' ';
+ $srno=$srno+1;
+ }
+ ?>
+
+
+
Notes
+
+ =$ipd_info[0]->remark?>
+
+
+
+
+
+
+
+
+
+
+
+
Charges Bill : =$inv_total['total_charges']?>
+
Medical Bill :
+
Credit IPD : =$inv_total['total_med_credit']?>
+
Cash : =$inv_total['total_med_cash']?> / =$inv_total['total_med_cash_paid']?>
+
Paid Amount : =$inv_total['total_payment']?>
+
Discount Amount : =$inv_total['discount']?>
+
Charge Amount : =$inv_total['charge']?>
+
Balance Amount : =$inv_total['total_balance_amount']?>
+
+ Print Bill
+
+
+
+
+
+
+
+
+
+ #
+ Invoice ID.
+ Patient
+ Inv.Date
+ Amount
+ Inc.Invoice
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->inv_name.' ';
+ echo ''.$row->inv_date.' ';
+ echo ''.$row->net_amount.' ';
+ $check='Package';
+ if ($row->ipd_credit_type>0)
+ {
+ $check='Cash';
+ }
+ echo ''.$check.' ';
+ echo ' Print
+ ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+
+
+
+
+ ion_auth->in_group('IPDPayment')) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD/Ipd_Registration_V.php b/old_code_ci3/views/IPD/Ipd_Registration_V.php
new file mode 100644
index 0000000..675a98e
--- /dev/null
+++ b/old_code_ci3/views/IPD/Ipd_Registration_V.php
@@ -0,0 +1,244 @@
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+ Relative or Responsible Person Name
+
+
+
+
+
+
+
+
+
+ 0) { ?>
+
+ ';
+ } ?>
+
+
+
+
+ Doctor
+
+ ';
+ echo ' ';
+ echo $row->p_fname.' ['.$row->SpecName.' ]';
+ echo ' ';
+ }
+ ?>
+
+
+
+
+
+
+
+ Request Room Type
+
+ Select BED
+ id.'">'.$row->Bed_Desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ Reason of visit / Problem / Diagnosis
+
+
+
+
+
+
+
+
+
+ Confirm And Go for Admit
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/Ipd_invoice_V.php b/old_code_ci3/views/IPD/Ipd_invoice_V.php
new file mode 100644
index 0000000..6800590
--- /dev/null
+++ b/old_code_ci3/views/IPD/Ipd_invoice_V.php
@@ -0,0 +1,206 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ Charge_type)
+ {
+ echo '';
+ echo ' ';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+ echo ' ';
+
+ if($headdesc!=@$showinvoice[$i+1]->Charge_type)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ }
+ }
+
+ if(count($inv_med_list)>0)
+ {
+ echo ' ';
+ echo ' ';
+ echo 'Medicine ';
+ echo ' ';
+
+ $med_total=0.00;
+
+ foreach($inv_med_list as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Med. Total ';
+ echo ''.number_format($med_total,2).' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+ #
+
+
+
+ Gross Total
+ =$inv_total['total_charges']?>
+
+ Discount>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark ?>
+
+ Deduction
+ =$ipdmaster[0]->Discount ?>
+
+
+
+ Discount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark2 ?>
+
+ Deduction
+ =$ipdmaster[0]->Discount2 ?>
+
+
+
+ Discount3>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark3 ?>
+
+ Deduction
+ =$ipdmaster[0]->Discount3 ?>
+
+
+
+
+ #
+
+
+
+ Net Amount
+ =$inv_total['net_amount']?>
+
+
+ #
+
+
+ Payment Recd.
+ id.':'.$row->pay_mode.':'.$row->pay_date_str.':'.$row->amount.'] /';
+ if($i%3==0)
+ {
+ echo ' ';
+ }
+ }
+ ?>
+
+
+
+ =$ipd_payment_total[0]->t_ipd_pay?>
+
+
+ #
+
+
+
+ Balance
+ =$inv_total['balance']?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD/Ipd_invoice_print_V.php b/old_code_ci3/views/IPD/Ipd_invoice_print_V.php
new file mode 100644
index 0000000..26a29c8
--- /dev/null
+++ b/old_code_ci3/views/IPD/Ipd_invoice_print_V.php
@@ -0,0 +1,280 @@
+
+
+
+
+
+
=H_Name?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+
+
=H_address_1?>,=H_address_2?>
+ Phone: =H_phone_No?> / Email: =H_Email?>
+
+
+
+
+
+
+
+
+ ipd_status>0) { ?>
+ Bill No. : =$ipdmaster[0]->id ?>
+ Provisional Bill '; } ?>
+
+
+
+
+
+
+
+ case_id>0) { ?>
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Insurance Company Name : =$orgcase[0]->Org_insurance_comp?>
+ Card No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Service No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+
+
+
+
+ IPD ID : =$ipdmaster[0]->ipd_code ?>
+ Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?>
+ Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?>
+ No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?>
+ 0){ ?>
+ Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+ Doctor Name : =$ipd_list[0]->doc_name ?>
+
+
+
+ Patient Name : =$person_info[0]->p_fname ?>
+ =$person_info[0]->p_relative ?> : =$person_info[0]->p_rname ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+ Patient ID : =$person_info[0]->p_code ?>
+ Address :=$person_info[0]->add1 ?> , =$person_info[0]->add2 ?>
+ =$person_info[0]->city ?> ,=$person_info[0]->district ?> , =$person_info[0]->state ?> - =$person_info[0]->zip ?>
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ Charge_type)
+ {
+ echo '';
+ echo ' ';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+
+ echo ' ';
+
+ }
+
+ if(count($inv_med_list)>0)
+ {
+ echo '';
+ echo ' ';
+ echo 'Medicine ';
+ echo ' ';
+ $med_total=0.00;
+ foreach($inv_med_list as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ echo ' ';
+ }
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Med. Total ';
+ echo ''.number_format($med_total,2).' ';
+ echo ' ';
+ }
+ ?>
+
+
+ #
+
+
+ Gross Total
+ =$inv_total['total_charges']?>
+
+ chargeamount1>0) { ?>
+
+ #
+ Charge:=$ipdmaster[0]->charge1 ?>
+ ( + )
+
+ =$ipdmaster[0]->chargeamount1 ?>
+
+
+ chargeamount2>0) { ?>
+
+ #
+ Charge:=$ipdmaster[0]->charge2 ?>
+ ( + )
+
+ =$ipdmaster[0]->chargeamount2 ?>
+
+
+ Discount>0) { ?>
+
+ #
+ Deduction:=$ipdmaster[0]->Discount_Remark ?>
+ ( - )
+
+ =$ipdmaster[0]->Discount ?>
+
+
+ Discount2>0) { ?>
+
+ #
+ Deduction:=$ipdmaster[0]->Discount_Remark2 ?>
+ ( - )
+
+ =$ipdmaster[0]->Discount2 ?>
+
+
+ Discount3>0) { ?>
+
+ #
+ Deduction:=$ipdmaster[0]->Discount_Remark3 ?>
+ ( - )
+
+ =$ipdmaster[0]->Discount3 ?>
+
+
+
+ #
+
+
+ Net Amount
+ =$inv_total['net_amount']?>
+
+
+ #
+
+ Payment Recd.
+ pay_id.':'.$row->pay_mode.':'.$row->pay_date_str.':'.$row->amount.'] /';
+ if($i%3==0)
+ {
+ echo ' ';
+ }
+ }
+ ?>
+
+ =$ipd_payment_total[0]->t_ipd_pay?>
+
+
+ #
+
+
+ Balance
+
+ =$inv_total['balance']?>
+
+
+
+
+
+
+
+
+
+
+ Patient / Relative Signature
+ Authorized Signatory
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD/Ipd_invoice_short_all.php b/old_code_ci3/views/IPD/Ipd_invoice_short_all.php
new file mode 100644
index 0000000..cae2f39
--- /dev/null
+++ b/old_code_ci3/views/IPD/Ipd_invoice_short_all.php
@@ -0,0 +1,77 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+ #
+ Date
+ Charges Type
+ Description
+ Org. Code
+ Sub Invoice Code
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->str_date.' ';
+ echo ''.$row->Charge_type.' ';
+ echo ''.$row->Description.' ';
+ echo ''.$row->orgcode.' ';
+ echo ''.$row->Code.' ';
+ echo ''.$row->Amount.' ';
+ echo '';
+ }
+
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->GTotal?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD/Ipdpanel_V.php b/old_code_ci3/views/IPD/Ipdpanel_V.php
new file mode 100644
index 0000000..424c2c7
--- /dev/null
+++ b/old_code_ci3/views/IPD/Ipdpanel_V.php
@@ -0,0 +1,233 @@
+
+
+
+
+
+
Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+ / IPD Code : =$ipd_info[0]->ipd_code?>
+ / No of Days : =$ipd_list[0]->no_days?>
+
+
Admit Date : =$ipd_list[0]->str_register_date?>
+ / Discharge Date : =$ipd_list[0]->str_discharge_date?>
+
+
+
+
+
+
+
+
+
+
Charges Bill
+
Rs. =$inv_total['total_charges']?>
+
+
+
+
+
Medical Bill
+
Credit IPD : Rs. =$inv_total['total_med_credit']?>
+
Cash : Rs. =$inv_total['total_med_cash']?> / =$inv_total['total_med_cash_paid']?>
+
+
+
+
+
Paid Amount
+
Rs. =$inv_total['total_payment']?>
+
+
+
+
+
+
Discount Amount
+
Rs. =$inv_total['discount']?>
+
Charge Amount
+
Rs. =$inv_total['charge']?>
+
+
+
+
+
Balance Amount
+
Rs. =$inv_total['total_balance_amount']?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_account_panel.php b/old_code_ci3/views/IPD/ipd_account_panel.php
new file mode 100644
index 0000000..47746cc
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_account_panel.php
@@ -0,0 +1,48 @@
+
+
+
Charges Bill
+
Rs. =$inv_total['total_charges']?>
+
+
+
+
+
Medical Bill
+
Credit IPD : Rs. =$inv_total['total_med_credit']?>
+
Cash : Rs. =$inv_total['total_med_cash']?> / =$inv_total['total_med_cash_paid']?>
+
+
+
+
+
Paid Amount
+
Rs. =$inv_total['total_payment']?>
+
+
+
+
+
+
Discount Amount
+
Rs. =$inv_total['discount']?>
+
Extra Charge Amount
+
Rs. =$inv_total['charge']?>
+
+
+
+
+
Balance Amount
+
Rs. =$inv_total['total_balance_amount']?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_all_list.php b/old_code_ci3/views/IPD/ipd_all_list.php
new file mode 100644
index 0000000..ebe3389
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_all_list.php
@@ -0,0 +1,173 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_bed_assign.php b/old_code_ci3/views/IPD/ipd_bed_assign.php
new file mode 100644
index 0000000..5fd554e
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_bed_assign.php
@@ -0,0 +1,103 @@
+
+
+
+
+
+ Bed No.
+ Description
+ Date
+ Vacant Date
+
+
+
+
+
+ =$ipd_bed_assign[$i]->bed_no ?>
+ =$ipd_bed_assign[$i]->room_name ?>
+ =$ipd_bed_assign[$i]->Fdate ?>
+ =$ipd_bed_assign[$i]->TDate ?>
+
+
+
+
+
+
+ Bed Assign
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Assign/Change Room
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_bed_status.php b/old_code_ci3/views/IPD/ipd_bed_status.php
new file mode 100644
index 0000000..145f84a
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_bed_status.php
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+ #
+ Desc
+ No. of Bed
+ Free Bed
+ Room Rent
+
+
+
+
+
+ =$i+1 ?>
+ =$roomdata[$i]->room_name ?>
+ =$roomdata[$i]->Total_Bed ?>
+ =$roomdata[$i]->FreeBed ?>
+ =$roomdata[$i]->room_rent ?>
+
+ Total_Bed;
+ $total_free_bed=$total_free_bed+$roomdata[$i]->FreeBed;
+ } ?>
+
+
+
+ #
+ Total
+ =$total_bed?>
+ =$total_free_bed?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_dashboard.php b/old_code_ci3/views/IPD/ipd_dashboard.php
new file mode 100644
index 0000000..2e154e8
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_dashboard.php
@@ -0,0 +1,38 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_discharge.php b/old_code_ci3/views/IPD/ipd_discharge.php
new file mode 100644
index 0000000..217dd3e
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_discharge.php
@@ -0,0 +1,306 @@
+
+
+
Discharge Process
+
+
+
+
+
+
+ Deduction Remark 1
+
+
+
+
+
+ Deduction Amount 1
+
+
+
+
+
+ Update Deduction 1
+ Discount Update
+
+
+
+
+
+
+ Deduction Remark 2
+
+
+
+
+
+ Deduction Amount 2
+
+
+
+
+
+ Update Deduction 2
+ Discount Update
+
+
+
+
+
+
+ Deduction Remark 3
+
+
+
+
+
+ Deduction Amount 3
+
+
+
+
+
+ Update Deduction 3
+ Discount Update
+
+
+
+
+
+
+
+ Addition Charge Remark 1
+
+
+
+
+
+ Addition Charge Amount
+
+
+
+
+
+ Update Addition Charge
+ Charge Update
+
+
+
+
+
+
+
+ Addition Charge Remark 2
+
+
+
+
+
+ Addition Charge Amount
+
+
+
+
+
+ Update Addition Charge
+ Charge Update
+
+
+
+
+
+
+
+
+
+ Patient Status
+
+
+ id,$ipd_info[0]->discarge_patient_status)?> >=$row->status_desc?>
+
+
+
+
+
+
+
+
+
+ Balance Amount Approved By
+
+
+
+
+
+ Balance Amount Remark
+
+
+
+
+
+ Update Discharge Status
+ Update Discharge Request
+ ion_auth->in_group('IPDDischarge')){
+ if($ipd_info[0]->lock_medical==0) { ?>
+ Final Discharge
+
+ Discharge Button Not Enable due to medical bill pending. Please contact Medical Store
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_discharged_status.php b/old_code_ci3/views/IPD/ipd_discharged_status.php
new file mode 100644
index 0000000..87ba3ec
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_discharged_status.php
@@ -0,0 +1,90 @@
+
+
+
Discharge Process
+
+
+
+
+
+
+
+
+
+
+ =$ipd_info[0]->discharge_remark ?>
+
+
+
+
+
+
+
+ Balance Amount Approved By
+
+
+
+
+
+ Balance Amount Remark
+
+
+
+ ion_auth->in_group('IPDReAdmit')) { ?>
+
+
+ ReAdmit
+
+ ReAdmit
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_invoice_error_v.php b/old_code_ci3/views/IPD/ipd_invoice_error_v.php
new file mode 100644
index 0000000..59fb4c7
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_invoice_error_v.php
@@ -0,0 +1,3 @@
+
+Discount Should not be greater then 10%
+
Please Contact Admin Department
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_invoice_items.php b/old_code_ci3/views/IPD/ipd_invoice_items.php
new file mode 100644
index 0000000..a427b62
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_invoice_items.php
@@ -0,0 +1,696 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_invoice_print_wo_payment.php b/old_code_ci3/views/IPD/ipd_invoice_print_wo_payment.php
new file mode 100644
index 0000000..9c6b314
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_invoice_print_wo_payment.php
@@ -0,0 +1,260 @@
+
+
+
+
+
+
=H_Name?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+
+
=H_address_1?>,=H_address_2?>
+ Phone: =H_phone_No?> / Email: =H_Email?>
+
+
+
+
+
+
+
+ ipd_status>0) { ?>
+ Bill No. : =$ipdmaster[0]->id ?>
+ Provisional Bill '; } ?>
+
+
+
+
+
+
+
+ case_id>0) { ?>
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Insurance Company Name : =$orgcase[0]->Org_insurance_comp?>
+ Card No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Service No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+
+
+
+
+ IPD ID : =$ipdmaster[0]->ipd_code ?>
+ Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?>
+ Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?>
+ No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?>
+ 0){ ?>
+ Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+ Doctor Name : =$ipd_list[0]->doc_name ?>
+
+
+
+ Patient Name : =$person_info[0]->p_fname ?>
+ =$person_info[0]->p_relative ?> : =$person_info[0]->p_rname ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+ Patient ID : =$person_info[0]->p_code ?>
+ Address :=$person_info[0]->add1 ?> , =$person_info[0]->add2 ?>
+ =$person_info[0]->city ?> ,=$person_info[0]->district ?> , =$person_info[0]->state ?> - =$person_info[0]->zip ?>
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ Charge_type)
+ {
+ echo '';
+ echo ' ';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+
+ echo ' ';
+
+
+
+ }
+
+ if(count($inv_med_list)>0)
+ {
+ echo '';
+ echo ' ';
+ echo 'Medicine ';
+ echo ' ';
+ $med_total=0.00;
+ foreach($inv_med_list as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Med. Total ';
+ echo ''.number_format($med_total,2).' ';
+ echo ' ';
+
+
+
+ }
+ ?>
+
+
+ #
+
+
+ Gross Total
+ =$inv_total['total_charges']?>
+
+ chargeamount1>0) { ?>
+
+ #
+ Charge:=$ipdmaster[0]->charge1 ?>
+ ( + )
+
+ =$ipdmaster[0]->chargeamount1 ?>
+
+
+ chargeamount2>0) { ?>
+
+ #
+ Charge:=$ipdmaster[0]->charge2 ?>
+ ( + )
+
+ =$ipdmaster[0]->chargeamount2 ?>
+
+
+ Discount>0) { ?>
+
+ #
+ Deduction:=$ipdmaster[0]->Discount_Remark ?>
+ ( - )
+
+ =$ipdmaster[0]->Discount ?>
+
+
+ Discount2>0) { ?>
+
+ #
+ Deduction:=$ipdmaster[0]->Discount_Remark2 ?>
+ ( - )
+
+ =$ipdmaster[0]->Discount2 ?>
+
+
+ Discount3>0) { ?>
+
+ #
+ Deduction:=$ipdmaster[0]->Discount_Remark3 ?>
+ ( - )
+
+ =$ipdmaster[0]->Discount3 ?>
+
+
+
+ #
+
+
+ Net Amount
+ =$inv_total['net_amount']?>
+
+
+
+
+
+
+
+
+
+
+
+ Patient / Relative Signature
+ Authorized Signatory
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD/ipd_main_panel.php b/old_code_ci3/views/IPD/ipd_main_panel.php
new file mode 100644
index 0000000..dd82811
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_main_panel.php
@@ -0,0 +1,407 @@
+
+
+
+
+
+
+
Name
+
+
+ =$person_info[0]->p_fname?>
+
+ Phone Number : =$person_info[0]->mphone1?>
+
+
+
+
Relative Name
+
+
+ =$ipd_info[0]->contact_person_Name?>
+ Phone Number : =$ipd_info[0]->P_mobile1?> , =$ipd_info[0]->P_mobile2?>
+
+
+
+
Address
+
+
+ =$person_info[0]->add1?>,
+ =$person_info[0]->add2?>,
+ =$person_info[0]->city?>,
+ =$person_info[0]->state?>,
+
+
+
+
+
Admit Date
+
+
+
+
+ ion_auth->in_group('IPDAdmit')) { ?>
+
+
+
+
+
+ Admit Date : =MysqlDate_to_str($ipd_info[0]->register_date) ?> Time : =$ipd_info[0]->reg_time ?>
+
+
+
+
Associated Doctors
+
+ p_fname.' ';
+ if ($this->ion_auth->in_group('IPDAdmit')) {
+ echo ' Remove ';
+ }
+ echo ' ';
+ $srno=$srno+1;
+ }
+ ?>
+
+
+ ion_auth->in_group('IPDAdmit')) { ?>
+
+
+
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+
Notes
+
+ =$ipd_info[0]->remark?>
+
+
+
+
+
+
+
+
+
+
+
+ 0) { ?>
+
+
+
+
+
+ Org. Add Charge
+ Update Case Information
+
+
+
+
+ case_id<1) { ?>
+
Attach This IPD With Org.
+
+
+
+
+ doc_recd) ?> onchange="onChangeUpdate('=$case_master[0]->id?>','doc_recd',this)"> Document Received
+
+
+
+
+ preauth_send) ?> onchange="onChangeUpdate('=$case_master[0]->id?>','preauth_send',this)" > Pre-Auth Send
+
+
+
+
+
+
+
+ Org. Status
+
+ id.'" '.combo_checked($row->id,$case_master[0]->org_approved_status_id).' >'.$row->app_status.'';
+ }
+ ?>
+
+
+
+
+
+ Approved Amount
+
+
+
+
+
+
+
+
+
+ final_bill_send) ?> onchange="onChangeUpdate('=$case_master[0]->id?>','final_bill_send',this)"> Final Bill Send
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_medical_invoice_short.php b/old_code_ci3/views/IPD/ipd_medical_invoice_short.php
new file mode 100644
index 0000000..46d1d57
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_medical_invoice_short.php
@@ -0,0 +1,43 @@
+
+
+
+
+
+ #
+ Item Name
+ Qty.
+ Price
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.'['.$row->formulation.'] ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->tamount.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+ Total
+ =$inv_master_credit[0]->net_amount ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_model_payment_box.php b/old_code_ci3/views/IPD/ipd_model_payment_box.php
new file mode 100644
index 0000000..20b5090
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_model_payment_box.php
@@ -0,0 +1,307 @@
+
+
+
+
+
Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->str_age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+ / IPD Code : =$ipd_info[0]->ipd_code?>
+ / No of Days : =$ipd_info[0]->no_days?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_package.php b/old_code_ci3/views/IPD/ipd_package.php
new file mode 100644
index 0000000..40e9619
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_package.php
@@ -0,0 +1,194 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_panel_deduction_payment.php b/old_code_ci3/views/IPD/ipd_panel_deduction_payment.php
new file mode 100644
index 0000000..f40bbd4
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_panel_deduction_payment.php
@@ -0,0 +1,174 @@
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_panel_refund.php b/old_code_ci3/views/IPD/ipd_panel_refund.php
new file mode 100644
index 0000000..dc3094c
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_panel_refund.php
@@ -0,0 +1,131 @@
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_payment.php b/old_code_ci3/views/IPD/ipd_payment.php
new file mode 100644
index 0000000..0e2bdb6
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_payment.php
@@ -0,0 +1,169 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ ID.
+ Payment Date
+ Amount
+ Mode
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->id.' ';
+ echo ''.$row->pay_date.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->pay_mode.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Invoice ID.
+ Inv.Date
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->inv_date.' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/ipd_payment_receipt_print.php b/old_code_ci3/views/IPD/ipd_payment_receipt_print.php
new file mode 100644
index 0000000..4d3abc7
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_payment_receipt_print.php
@@ -0,0 +1,109 @@
+
+
+
+
+
+
=H_Name?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+
+
+
+
+ To
+
+ =$person_info[0]->p_fname ?>
+ Patient Code : =$person_info[0]->p_code ?>
+ Phone No : =$ipd_master[0]->P_mobile1 ?>
+ Payment Receipt No #=$ipd_payment[0]->payment_id ?>
+ Date : =$ipd_payment[0]->pay_date ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+
+
+
+
+
+
+
+
+
Payment Receipt No #=$ipd_payment[0]->payment_id ?>
+
+ Mode of Payment : =$ipd_payment[0]->payment_mode_desc ?>
+
+
+ IPD Payment Amount : =$ipd_payment[0]->amount ?> (In Words : =number_to_word($ipd_payment[0]->amount) ?> )
+
+
+ Remark :
+
+ =$ipd_payment[0]->remark ?>
+
+
+
+ Prepared By : =$ipd_payment[0]->prepared_by ?>
+
+
+
+
+
+ Signature
+
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD/ipd_room.php b/old_code_ci3/views/IPD/ipd_room.php
new file mode 100644
index 0000000..1202503
--- /dev/null
+++ b/old_code_ci3/views/IPD/ipd_room.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/print_ipd_form1.php b/old_code_ci3/views/IPD/print_ipd_form1.php
new file mode 100644
index 0000000..d3e7ac0
--- /dev/null
+++ b/old_code_ci3/views/IPD/print_ipd_form1.php
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Patient Info :
+ Patient Name : =$person_info[0]->p_fname?>
+ =$person_info[0]->p_relative?> =$person_info[0]->p_rname?>
+ Age : =$person_info[0]->age ?>
+ Gender : =$person_info[0]->xgender ?>
+
+
+
+
+Face Sheet
+
+
+
+ ';
+ $Insurance='';
+ if(count($case_master)>0){
+ $Insurance= 'Insurance : '.$case_master[0]->insurance_company_name;
+ }
+
+ echo 'Patient Information :
+ Patient Name : '.$person_info[0]->p_fname.'
+ '.$person_info[0]->p_relative.' '.$person_info[0]->p_rname.'
+ Age : '.$person_info[0]->age .'
+ Gender : '.$person_info[0]->xgender.'
+ UHID/Patient Code : '.$person_info[0]->p_code.'
+ IPD Code : '.$ipd_info[0]->ipd_code.'
+ Phone No : '.$person_info[0]->mphone1.$Insurance.'
+ ';
+
+ echo '
+ Contact Person Name : '.$ipd_info[0]->contact_person_Name.'
+ Relation : '.$ipd_info[0]->relation.'
+ Relative Phone No : '.$ipd_info[0]->P_mobile1.'
+ Patient Address
+ '.$person_info[0]->add1.' ,
+ '.$person_info[0]->add2.' ,
+ '.$person_info[0]->city.' ,
+ '.$person_info[0]->state.'
+ ';
+
+ $srno=1;
+ $ipd_doc_list_show='';;
+ foreach($ipd_doc_list as $row)
+ {
+ $ipd_doc_list_show.= ' Dr. '.$row->p_fname.' / ';
+ $srno=$srno+1;
+ }
+
+
+ echo '
+ Date of Admission : '.$ipd_info[0]->str_register_date.'
+ Admission Time : '.$ipd_info[0]->reg_time.'
+ Date of Discharge : '.$ipd_info[0]->discharge_date.'
+ Time of Discharge : '.$ipd_info[0]->discharge_time.'
+ Case Type : '.$ipd_info[0]->case_type_s.'
+ Doctors : : '.$ipd_doc_list_show.'
+ ';
+
+ echo '';
+ ?>
+
+
सहमति पत्र
+
+ मैं ईलाज कराने का/की इक्छुक हूँ | मैं =H_Name_Hindi?>(=H_Name?>) के चिकित्सक और उनके सहायको को अपना उपचार , परीक्षण, परामर्श, जाँच, औषधि देने , चिकित्सा दवा लगवाने की स्वीकृति देता हूँ |
+ मुझे मेरी /मेरे मरीज की बीमारी के बारे मे उसके खतरों से जटिलताओं (complications ) से अवगत करा दिया गया है | मुझे ईलाज मे होने वाले खर्च की जानकारी दे दी गई है | मैंने अपनी सभी शंकाओं का निवारण कर लिया है । इस स्वीक्रति पत्र को मैंने ठीक प्रकार से पड़कर स्वयं समझकर हस्ताक्षर के द्वारा अपनी सहमति प्रदान करता / करती हूँ ।
+
+
+
+
+
+
+
+
+
+
+
+
+ Prepared By : =$user->first_name.' '.$user->last_name.'['.$user->id.']' ?>
+
+
+
+
+ हस्ताक्षर / अंगूठा निशान
+
+
+
+ नाम : _______________________________________________
+
+
+
+ मरीज / मरीज से संबंध : _____________________________
+
+
+
+ पता : _______________________________________________
+
+
+
+
+ फ़ोन नंबर : _________________________________________
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/print_payment_receipt_ipd.php b/old_code_ci3/views/IPD/print_payment_receipt_ipd.php
new file mode 100644
index 0000000..ed31ce6
--- /dev/null
+++ b/old_code_ci3/views/IPD/print_payment_receipt_ipd.php
@@ -0,0 +1,73 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+
+
+
+
+
+ To
+
+ =$person_info[0]->p_fname ?>
+ Phone No : =$ipd_master[0]->P_mobile1 ?>
+ Payment Reciept No #=$ipd_payment[0]->payment_id ?>
+ Date : =$ipd_payment[0]->pay_date ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+
+
+
+
+
+
+ IPD Credit Amount : =$ipd_payment[0]->amount ?>
+
+ Remark :
+
+ =$ipd_payment[0]->remark ?>
+
+
+
+ Mode of Payment : =$ipd_payment[0]->payment_mode_desc ?>
+
+
+
+ Prepared By : =$ipd_payment[0]->prepared_by ?>
+
+
+
+ Signature
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD/test.php b/old_code_ci3/views/IPD/test.php
new file mode 100644
index 0000000..a6c75a3
--- /dev/null
+++ b/old_code_ci3/views/IPD/test.php
@@ -0,0 +1,173 @@
+@extends('app')
+
+@section('content')
+{!! header('Access-Control-Allow-Origin: *'); !!}
+{!! header("content-type: Access-Control-Allow-Methods: GET");!!}
+
+
+
+
+ Project - {!! $project_title !!}
+
+
+
Enter Flat/Room Booking Details
+
+ {!! Form::open(array('route' => 'client.store', 'method' => 'post', 'files' => 'true')) !!}
+ {!! Form::hidden('user_id', Auth::user()->id) !!}
+ {!! Form::hidden('flat_id', $flat_id )!!}
+ {!! Form::hidden('booking_status', $booking_status )!!}
+
Fields with * asteric sign are required
+
+
+
+
+
+
+ Franchise Name
+ {!! Form::text('franchise', Auth::user()->name, array('id'=>'franchise','class' => 'form-control', 'readonly'=>'true', 'placeholder'=> Auth::user()->name ,'value'=>Auth::user()->name)) !!}
+
+
+
+ Agent Name
+ {!! Form::text('agent', Input::old('agent'), array('id'=>'agent','class' => 'form-control')) !!}
+
+
+
+
+
+
+ Project Name
+ {!! Form::text('project_name', $project_title, array('id'=>'project_name','class' => 'form-control', 'placeholder' => $project_title, 'readonly'=>'true', )) !!}
+
+
+
+
+ * Flat / Room Area (only numbers)
+ {!! Form::text('area', Input::old('area'), array('id'=>'area','class' => 'form-control', 'placeholder' => 'Enter Area')) !!}
+ {!! $errors->first('area',':message ') !!}
+
+
+
+
+
+ Estimated Date
+ {!! Form::text('estimated_date', Input::old('estimated_date'), array('id'=>'estimated_date','class' => 'form-control', 'placeholder' => 'Select Date')) !!}
+
+
+
+
+
+
+
+ Customer Code
+ {!! Form::text('cust_code', Input::old('cust_code'), array('id'=>'cust_code','class' => 'form-control', 'placeholder' => 'Enter Customer Code')) !!}
+
+
+
+
+ Customer Status
+ {!! Form::text('cust_status', Input::old('cust_status'), array('id'=>'cust_status','class' => 'form-control', 'readonly')) !!}
+
+
+
+
+
+
+ * Customer Name
+ {!! Form::text('customers_name', Input::old('customers_name'), array('id'=>'customers_name','class' => 'form-control', 'placeholder' => 'Enter Customer Name')) !!}
+ {!! $errors->first('customers_name',':message ') !!}
+
+
+
+
+
+
+
+ * Phone Number
+ {!! Form::text('phone', Input::old('phone'), array('id'=>'phone','class' => 'form-control', 'placeholder' => 'Enter Phone Number')) !!}
+ {!! $errors->first('phone',':message ') !!}
+
+
+
+
+ * Email Address
+ {!! Form::text('email', Input::old('email'), array('id'=>'email','class' => 'form-control', 'placeholder' => 'Enter Email Address')) !!}
+ {!! $errors->first('email',':message ') !!}
+
+
+
+
+ * Address
+ {!! Form::textarea('address', Input::old('address'),array('id'=>'address','class' => 'form-control','rows'=>'5','placeholder'=>'Address')) !!}
+ {!! $errors->first('address',':message ') !!}
+
+
+
+
+
+
+
+ Remark
+ {!! Form::textarea('description', Input::old('description'),array('class' => 'form-control','rows'=>'5')) !!}
+
+
+
+
+
+
+ {!! Form::checkbox('terms_conditions', '1', Input::old('terms_conditions'), array()) !!} * I authorize Krishna Buildcon to contact me.
+
+ {!! $errors->first('terms_conditions',':message ') !!}
+
+
+
+ {!! Form::close() !!}
+
+
+
+
+
+
+
+
+@endsection
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/IPDList_V.php b/old_code_ci3/views/IPD2/IPDList_V.php
new file mode 100644
index 0000000..7b3a0b4
--- /dev/null
+++ b/old_code_ci3/views/IPD2/IPDList_V.php
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Bed No.[Type]
+ Register Date
+ No. of Days
+ Dr. Name
+ Admit Type
+ Amount
+
+
+
+
+
+
+ =$data[$i]->ipd_code ?>
+ [=$data[$i]->p_code ?>] =$data[$i]->p_fname ?> =$data[$i]->p_rname ?>
+ =$data[$i]->Bed_Desc ?>
+ =$data[$i]->str_register_date ?>
+ =$data[$i]->no_days ?>
+ =$data[$i]->doc_name ?>
+ =$data[$i]->admit_type ?> =$data[$i]->Org_Status ?> =$data[$i]->insurance_no_1 ?>
+ C:=$data[$i]->charge_amount ?>/M:=$data[$i]->med_amount ?>/P:=$data[$i]->paid_amount?>/B:=$data[$i]->balance?>
+ Got It....
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Register Date
+ Admit Type
+ Amount
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/IPD_Medical_Invoice_Panel.php b/old_code_ci3/views/IPD2/IPD_Medical_Invoice_Panel.php
new file mode 100644
index 0000000..8ac6875
--- /dev/null
+++ b/old_code_ci3/views/IPD2/IPD_Medical_Invoice_Panel.php
@@ -0,0 +1,90 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/IPD_View.php b/old_code_ci3/views/IPD2/IPD_View.php
new file mode 100644
index 0000000..b6461bd
--- /dev/null
+++ b/old_code_ci3/views/IPD2/IPD_View.php
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+
Name
+
+ =$person_info[0]->p_fname?>
+
+ Phone Number : =$person_info[0]->mphone1?>
+
+
Relative Name
+
+
+ =$ipd_info[0]->contact_person_Name?>
+ Phone Number : =$ipd_info[0]->P_mobile1?> , =$ipd_info[0]->P_mobile2?>
+
+
Address
+
+
+ =$person_info[0]->add1?>,
+ =$person_info[0]->add2?>,
+ =$person_info[0]->city?>,
+ =$person_info[0]->state?>,
+
+
Admit Date
+
+ Admit Date : =MysqlDate_to_str($ipd_info[0]->register_date) ?> Time : =$ipd_info[0]->reg_time ?>
+
+
+ ipd_status>0) { ?>
+
+ Discharge Date : =MysqlDate_to_str($ipd_info[0]->discharge_date) ?> =$ipd_info[0]->discharge_time ?>
+
+
+
Associated Doctors
+
+ p_fname.' ';
+ if ($this->ion_auth->in_group('IPDAdmit')) {
+ echo ' Remove ';
+ }
+ echo ' ';
+ $srno=$srno+1;
+ }
+ ?>
+
+
Notes
+
+
+
+
+
+
+
+
+
+
+
Charges : =$ipd_master[0]->charge_amount?>
+
Pharmacy Cr. IPD : =$ipd_master[0]->med_amount?>
+
Net Amount : =$ipd_master[0]->net_amount?>
+
Total Paid : =$ipd_master[0]->total_paid_amount?>
+
Balance : =$ipd_master[0]->balance_amount?>
+
Pharmacy Bill : =$ipd_master[0]->cash_med_amount?>
+
Paid Amount : =$ipd_master[0]->med_paid?>
+
+ Print Bill
+
+
+
+
+
+ ion_auth->in_group('IPDPayment')) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD2/Ipd_Registration_V.php b/old_code_ci3/views/IPD2/Ipd_Registration_V.php
new file mode 100644
index 0000000..f1bdce5
--- /dev/null
+++ b/old_code_ci3/views/IPD2/Ipd_Registration_V.php
@@ -0,0 +1,272 @@
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
+
+ Relative or Responsible Person Name
+
+
+
+
+
+
+
+
+ 0) { ?>
+
+ ';
+ } ?>
+
+
+
+ Department
+
+ Select Department
+ iId . '">' . $row->vName . '';
+ }
+ ?>
+
+
+
+
+
+
+
+
+ Doctor
+
+ ';
+ echo ' ';
+ echo $row->p_fname . ' [' . $row->SpecName . ' ]';
+ echo ' ';
+ }
+ ?>
+
+
+
+
+
+
+
+ Request Room Type
+
+ Select BED
+ id . '">' . $row->Bed_Desc . '';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ Refer By
+
+ Select Refer By
+ id . '">' . $row->title . '' . $row->f_name . '';
+ }
+ ?>
+
+
+
+
+
+
+
+
+ Reason of visit / Problem / Diagnosis
+
+
+
+
+
+
+
+
+
+
+ Confirm And Go for Admit
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/Ipd_invoice_V.php b/old_code_ci3/views/IPD2/Ipd_invoice_V.php
new file mode 100644
index 0000000..2416636
--- /dev/null
+++ b/old_code_ci3/views/IPD2/Ipd_invoice_V.php
@@ -0,0 +1,340 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ 0){
+ echo '';
+ echo 'Package ';
+ echo ' ';
+ $headdesc='Package';
+ $headTotal=0.00;
+
+ for($i=0;$i';
+ echo ''.$srno.' ';
+ echo ''.$ipd_package[$i]->package_name.' ';
+ echo ''.$ipd_package[$i]->org_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$ipd_package[$i]->package_Amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_package[$i]->package_Amount;
+ echo '';
+ }
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+
+ }
+
+
+ for($i=0;$igroup_desc)
+ {
+ echo '';
+ echo ''.$ipd_invoice_item[$i]->group_desc.' ';
+ echo ' ';
+ $headdesc=$ipd_invoice_item[$i]->group_desc;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$ipd_invoice_item[$i]->item_name.' '.$ipd_invoice_item[$i]->comment.' ';
+ echo ''.$ipd_invoice_item[$i]->org_code.' ';
+ echo ''.$ipd_invoice_item[$i]->item_qty.' ';
+ echo ''.$ipd_invoice_item[$i]->item_rate.' ';
+ echo ''.$ipd_invoice_item[$i]->item_amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_invoice_item[$i]->item_amount;
+ echo ' ';
+
+ if($headdesc!=@$ipd_invoice_item[$i+1]->group_desc)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+
+
+ for($i=0;$iCharge_type)
+ {
+ echo '';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+ echo ' ';
+
+ if($headdesc!=@$showinvoice[$i+1]->Charge_type)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+
+ if(count($inv_med_list)>0)
+ {
+ echo '';
+ echo 'Medicine ';
+ echo ' ';
+
+ $med_total=0.00;
+
+ foreach($inv_med_list as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Med. Total ';
+ echo ''.number_format($med_total,2).' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+ #
+
+
+
+ Gross Total
+ =$ipdmaster[0]->gross_amount?>
+
+ Discount>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark ?>
+
+ Deduction
+ =$ipdmaster[0]->Discount ?>
+
+
+
+ Discount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark2 ?>
+
+ Deduction
+ =$ipdmaster[0]->Discount2 ?>
+
+
+
+ Discount3>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark3 ?>
+
+ Deduction
+ =$ipdmaster[0]->Discount3 ?>
+
+
+ chargeamount1>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge1 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount1 ?>
+
+
+ chargeamount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge2 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount2 ?>
+
+
+
+ #
+
+
+
+ Net Amount
+ =$ipdmaster[0]->net_amount?>
+
+
+ #
+
+ Payment Recd.
+ id.':'.$row->pay_mode.':'.$row->pay_date_str.':'.$row->amount.'] /';
+ if($i%3==0)
+ {
+ echo ' ';
+ }
+ }
+ ?>
+
+
+
+ =$ipdmaster[0]->total_paid_amount?>
+
+
+ #
+
+
+
+ Balance
+ =$ipdmaster[0]->balance_amount?>
+
+ payable_by_tpa>0) { ?>
+
+ #
+ Payable By TPA
+
+
+ =$ipdmaster[0]->payable_by_tpa ?>
+
+
+
+ discount_for_tpa>0) { ?>
+
+ #
+ Discount For TPA
+
+
+ =$ipdmaster[0]->discount_for_tpa ?>
+
+
+
+ discount_by_hospital>0) { ?>
+
+ #
+ Discount By Hospital
+ =$ipdmaster[0]->discount_by_hospital_remark?>
+
+ =$ipdmaster[0]->discount_by_hospital ?>
+
+
+
+ discount_by_hospital_2>0) { ?>
+
+ #
+ Discount By Hospital/ Doctor
+ =$ipdmaster[0]->discount_by_hospital_2_remark?>
+
+ =$ipdmaster[0]->discount_by_hospital_2 ?>
+
+
+
+
+ #
+
+
+
+ Final Balance
+ =$ipdmaster[0]->balance_discount_after?>
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD2/Ipd_invoice_print_TPA_V.php b/old_code_ci3/views/IPD2/Ipd_invoice_print_TPA_V.php
new file mode 100644
index 0000000..92000f3
--- /dev/null
+++ b/old_code_ci3/views/IPD2/Ipd_invoice_print_TPA_V.php
@@ -0,0 +1,401 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+ p_code.':'.$ipdmaster[0]->ipd_code .':P-'.date('Y-m-d H:i:s');
+ ?>
+
+
+
+
+
+ipd_status>0) { ?>
+ Bill No. : =$ipdmaster[0]->id ?>
+Provisional Bill '; } ?>
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipdmaster[0]->ipd_code ?> / UHID:=$person_info[0]->p_code ?> /Name : =$person_info[0]->p_fname ?>
+
+
+
+
+
+
+ Patient Name : =$person_info[0]->p_fname ?>
+ =$person_info[0]->p_relative ?> : =$person_info[0]->p_rname ?>
+ Patient-ID/UHID : =$person_info[0]->p_code ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+ Address :=$person_info[0]->add1 ?> , =$person_info[0]->add2 ?>
+ =$person_info[0]->city ?> ,=$person_info[0]->district ?> , =$person_info[0]->state ?> - =$person_info[0]->zip ?>
+
+
+ IPD ID : =$ipdmaster[0]->ipd_code ?>
+ Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?>
+ Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?>
+ No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?>
+ 0){ ?>
+ Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+ Doctor Name : =$ipd_list[0]->doc_name ?>
+
+
+
+ case_id>0) { ?>
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Insurance Company Name : =$orgcase[0]->Org_insurance_comp?>
+ Card No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Service No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ 0){
+ echo '';
+ echo 'Package ';
+ echo ' ';
+ $headdesc='Package';
+ $headTotal=0.00;
+
+ for($i=0;$i';
+ echo ''.$srno.' ';
+ echo ''.$ipd_package[$i]->package_name.' ';
+ echo ''.$ipd_package[$i]->org_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$ipd_package[$i]->package_Amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_package[$i]->package_Amount;
+ echo '';
+ }
+
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ }
+
+
+ }
+ for($i=0;$igroup_desc)
+ {
+ echo '';
+ echo ''.$ipd_invoice_item[$i]->group_desc.' ';
+ echo ' ';
+ $headdesc=$ipd_invoice_item[$i]->group_desc;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$ipd_invoice_item[$i]->item_name.' '.$ipd_invoice_item[$i]->comment.' ';
+ echo ''.$ipd_invoice_item[$i]->org_code.' ';
+ echo ''.$ipd_invoice_item[$i]->item_qty.' ';
+ echo ''.$ipd_invoice_item[$i]->item_rate.' ';
+ echo ''.$ipd_invoice_item[$i]->item_amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_invoice_item[$i]->item_amount;
+ echo ' ';
+
+ if($headdesc!=@$ipd_invoice_item[$i+1]->group_desc)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+
+ for($i=0;$iCharge_type)
+ {
+ echo '';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+ echo ' ';
+
+ if($headdesc!=@$showinvoice[$i+1]->Charge_type)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+ if(count($inv_med_list)>0)
+ {
+ echo '';
+ echo 'Medicine ';
+ echo ' ';
+
+ $med_total=0.00;
+
+ foreach($inv_med_list as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Med. Total ';
+ echo ''.number_format(Round($med_total,0),2).' ';
+ echo ' ';
+ }
+ ?>
+
+ #
+
+
+
+ Gross Total
+ =$ipdmaster[0]->gross_amount?>
+
+
+
+ Discount>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark ?>
+
+ Deduction/Discount
+ =$ipdmaster[0]->Discount ?>
+
+
+
+ Discount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark2 ?>
+
+ Deduction/Discount
+ =$ipdmaster[0]->Discount2 ?>
+
+
+
+ Discount3>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark3 ?>
+
+ Deduction/Discount
+ =$ipdmaster[0]->Discount3 ?>
+
+
+ chargeamount1>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge1 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount1 ?>
+
+
+ chargeamount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge2 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount2 ?>
+
+
+
+ #
+
+
+
+ Net Amount
+ =$ipdmaster[0]->net_amount?>
+
+
+
+ #
+
+ Payment Recd.
+ id.':'.$row->pay_mode.':'.$row->pay_date_str.':'.$row->amount.'] /';
+ if($i%3==0)
+ {
+ echo ' ';
+ }
+ }
+ ?>
+
+
+
+ =$ipdmaster[0]->total_paid_amount?>
+
+
+ payable_by_tpa>0) { ?>
+
+ #
+ Payable By TPA :
+
+
+ =$ipdmaster[0]->payable_by_tpa ?>
+
+
+
+ discount_for_tpa>0) { ?>
+
+ #
+ Discount For TPA
+
+
+ =$ipdmaster[0]->discount_for_tpa ?>
+
+
+
+ discount_by_hospital>0) { ?>
+
+ #
+ Discount By Hospital
+ =$ipdmaster[0]->discount_by_hospital_remark?>
+
+ =$ipdmaster[0]->discount_by_hospital ?>
+
+
+
+ discount_by_hospital_2>0) { ?>
+
+ #
+ Discount By Hospital/ Doctor
+ =$ipdmaster[0]->discount_by_hospital_2_remark?>
+
+ =$ipdmaster[0]->discount_by_hospital_2 ?>
+
+
+
+
+ #
+
+
+
+ Final Balance
+ =$ipdmaster[0]->balance_discount_after?>
+
+
+
+
+
+
+
+ Patient / Relative Signature
+
+
+
+
+
+ Authorized Signatory
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/Ipd_invoice_print_V.php b/old_code_ci3/views/IPD2/Ipd_invoice_print_V.php
new file mode 100644
index 0000000..900bf36
--- /dev/null
+++ b/old_code_ci3/views/IPD2/Ipd_invoice_print_V.php
@@ -0,0 +1,362 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+ p_code.':'.$ipdmaster[0]->ipd_code .':P-'.date('Y-m-d H:i:s');
+ ?>
+
+
+
+
+
+ipd_status>0) { ?>
+ Bill No. : =$ipdmaster[0]->id ?>
+Provisional Bill '; } ?>
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipdmaster[0]->ipd_code ?> / UHID:=$person_info[0]->p_code ?> /Name : =$person_info[0]->p_fname ?>
+
+
+
+
+
+
+ Patient Name : =$person_info[0]->p_fname ?>
+ =$person_info[0]->p_relative ?> : =$person_info[0]->p_rname ?>
+ Patient-ID/UHID : =$person_info[0]->p_code ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+ Address :=$person_info[0]->add1 ?> , =$person_info[0]->add2 ?>
+ =$person_info[0]->city ?> ,=$person_info[0]->district ?> , =$person_info[0]->state ?> - =$person_info[0]->zip ?>
+
+
+ IPD ID : =$ipdmaster[0]->ipd_code ?>
+ Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?>
+ Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?>
+ No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?>
+ 0){ ?>
+ Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+ Doctor Name : =$ipd_list[0]->doc_name ?>
+ Status : =$ipd_list[0]->status_desc ?>
+
+
+
+ case_id>0) { ?>
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Insurance Company Name : =$orgcase[0]->Org_insurance_comp?>
+ Card No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Service No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ 0){
+ echo '';
+ echo 'Package ';
+ echo ' ';
+ $headdesc='Package';
+ $headTotal=0.00;
+
+ for($i=0;$i';
+ echo ''.$srno.' ';
+ echo ''.$ipd_package[$i]->package_name.' ';
+ echo ''.$ipd_package[$i]->org_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$ipd_package[$i]->package_Amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_package[$i]->package_Amount;
+ echo '';
+ }
+
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ }
+
+
+ }
+ for($i=0;$igroup_desc)
+ {
+ echo '';
+ echo ''.$ipd_invoice_item[$i]->group_desc.' ';
+ echo ' ';
+ $headdesc=$ipd_invoice_item[$i]->group_desc;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$ipd_invoice_item[$i]->item_name.' '.$ipd_invoice_item[$i]->comment.' ';
+ echo ''.$ipd_invoice_item[$i]->org_code.' ';
+ echo ''.$ipd_invoice_item[$i]->item_qty.' ';
+ echo ''.$ipd_invoice_item[$i]->item_rate.' ';
+ echo ''.$ipd_invoice_item[$i]->item_amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_invoice_item[$i]->item_amount;
+ echo ' ';
+
+ if($headdesc!=@$ipd_invoice_item[$i+1]->group_desc)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+
+ for($i=0;$iCharge_type)
+ {
+ echo '';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+ echo ' ';
+
+ if($headdesc!=@$showinvoice[$i+1]->Charge_type)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+ if(count($inv_med_list)>0)
+ {
+ echo '';
+ echo 'Medicine ';
+ echo ' ';
+
+ $med_total=0.00;
+
+ foreach($inv_med_list as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Med. Total ';
+ echo ''.number_format(Round($med_total,0),2).' ';
+ echo ' ';
+ }
+ ?>
+
+ #
+
+
+
+ Gross Total
+ =$ipdmaster[0]->gross_amount?>
+
+
+
+ Discount>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark ?>
+
+ Discount
+ =$ipdmaster[0]->Discount ?>
+
+
+
+ Discount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark2 ?>
+
+ Discount
+ =$ipdmaster[0]->Discount2 ?>
+
+
+
+ Discount3>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark3 ?>
+
+ Discount
+ =$ipdmaster[0]->Discount3 ?>
+
+
+ chargeamount1>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge1 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount1 ?>
+
+
+ chargeamount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge2 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount2 ?>
+
+
+
+ #
+
+
+
+ Net Amount
+ =$ipdmaster[0]->net_amount?>
+
+
+
+ #
+
+ Payment Recd.
+ id.':'.$row->pay_mode.':'.$row->pay_date_str.':'.$row->amount.'] /';
+ if($i%3==0)
+ {
+ echo ' ';
+ }
+ }
+ ?>
+
+
+
+ =$ipdmaster[0]->total_paid_amount?>
+
+
+ #
+
+
+
+ Balance
+ =$ipdmaster[0]->balance_amount?>
+
+
+
+
+
+
+
+ Patient / Relative Signature
+
+
+
+
+
+ Authorized Signatory
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/Ipd_invoice_short_all.php b/old_code_ci3/views/IPD2/Ipd_invoice_short_all.php
new file mode 100644
index 0000000..cae2f39
--- /dev/null
+++ b/old_code_ci3/views/IPD2/Ipd_invoice_short_all.php
@@ -0,0 +1,77 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+ #
+ Date
+ Charges Type
+ Description
+ Org. Code
+ Sub Invoice Code
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->str_date.' ';
+ echo ''.$row->Charge_type.' ';
+ echo ''.$row->Description.' ';
+ echo ''.$row->orgcode.' ';
+ echo ''.$row->Code.' ';
+ echo ''.$row->Amount.' ';
+ echo '';
+ }
+
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->GTotal?>
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD2/Ipdpanel_V.php b/old_code_ci3/views/IPD2/Ipdpanel_V.php
new file mode 100644
index 0000000..dac98a1
--- /dev/null
+++ b/old_code_ci3/views/IPD2/Ipdpanel_V.php
@@ -0,0 +1,249 @@
+
+
+
+
+
+
Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->age?>
+ / Gender : =$person_info[0]->xgender?>
+ / UHID : =$person_info[0]->p_code?>
+ / No of Days : =$ipd_info[0]->no_days?>
+
+
Admit Date : =$ipd_info[0]->str_register_date?>
+ / Discharge Date : =$ipd_info[0]->str_discharge_date?>
+
+
+
+
+
+ 0) {
+ $pdata=$case_master[0]->insurance_id;
+ }
+ ?>
+
+
+
+
+
+
+
+ Charges : =$ipd_master[0]->charge_amount?>
+ Pharmacy Cr. IPD : =$ipd_master[0]->med_amount?>
+ Net Amount : =$ipd_master[0]->net_amount?>
+
+
+
+
+ Total Paid : =$ipd_master[0]->total_paid_amount?>
+ Balance : =$ipd_master[0]->balance_amount?>
+
+
+
+
+ Pharmacy Bill : =$ipd_master[0]->cash_med_amount?>
+ Paid Amount : =$ipd_master[0]->med_paid?>
+
+
+
+
+
+
+
+ Payment Add
+ Payment Refund
+
+
+
+
+ Payment TPA And Others
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/TPA_Payment.php b/old_code_ci3/views/IPD2/TPA_Payment.php
new file mode 100644
index 0000000..dd85d0c
--- /dev/null
+++ b/old_code_ci3/views/IPD2/TPA_Payment.php
@@ -0,0 +1,79 @@
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+ Discount For TPA
+
+
+
+
+
+
+
+ Discount By Hospital
+
+
+
+
+
+
+
+
+ Discount By Doctor
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_account_panel.php b/old_code_ci3/views/IPD2/ipd_account_panel.php
new file mode 100644
index 0000000..fcfdd42
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_account_panel.php
@@ -0,0 +1,19 @@
+
+
+ Charges : =$ipd_master[0]->charge_amount?>
+ Pharmacy Cr. IPD : =$ipd_master[0]->med_amount?>
+ Net Amount : =$ipd_master[0]->net_amount?>
+
+
+
+
+ Total Paid : =$ipd_master[0]->total_paid_amount?>
+ Balance : =$ipd_master[0]->balance_amount?>
+
+
+
+
+ Pharmacy Bill : =$ipd_master[0]->cash_med_amount?>
+ Paid Amount : =$ipd_master[0]->med_paid?>
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_all_list.php b/old_code_ci3/views/IPD2/ipd_all_list.php
new file mode 100644
index 0000000..3d3ef99
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_all_list.php
@@ -0,0 +1,178 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_bed_assign.php b/old_code_ci3/views/IPD2/ipd_bed_assign.php
new file mode 100644
index 0000000..8f7639d
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_bed_assign.php
@@ -0,0 +1,106 @@
+
+
+
+
+
+ Bed No.
+ Description
+ Date
+ Vacant Date
+
+
+
+
+
+ =$ipd_bed_assign[$i]->bed_no ?>
+ =$ipd_bed_assign[$i]->room_name ?>
+ =$ipd_bed_assign[$i]->Fdate ?>
+ =$ipd_bed_assign[$i]->TDate ?>
+
+
+
+
+
+
+ Bed Assign
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Assign/Change Room
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_bed_list.php b/old_code_ci3/views/IPD2/ipd_bed_list.php
new file mode 100644
index 0000000..d1de6da
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_bed_list.php
@@ -0,0 +1,39 @@
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_bed_status.php b/old_code_ci3/views/IPD2/ipd_bed_status.php
new file mode 100644
index 0000000..145f84a
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_bed_status.php
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+ #
+ Desc
+ No. of Bed
+ Free Bed
+ Room Rent
+
+
+
+
+
+ =$i+1 ?>
+ =$roomdata[$i]->room_name ?>
+ =$roomdata[$i]->Total_Bed ?>
+ =$roomdata[$i]->FreeBed ?>
+ =$roomdata[$i]->room_rent ?>
+
+ Total_Bed;
+ $total_free_bed=$total_free_bed+$roomdata[$i]->FreeBed;
+ } ?>
+
+
+
+ #
+ Total
+ =$total_bed?>
+ =$total_free_bed?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_dashboard.php b/old_code_ci3/views/IPD2/ipd_dashboard.php
new file mode 100644
index 0000000..94e7121
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_dashboard.php
@@ -0,0 +1,38 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_diagnosis_charges.php b/old_code_ci3/views/IPD2/ipd_diagnosis_charges.php
new file mode 100644
index 0000000..a7285e4
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_diagnosis_charges.php
@@ -0,0 +1,75 @@
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_diagnosis_invoice_items.php b/old_code_ci3/views/IPD2/ipd_diagnosis_invoice_items.php
new file mode 100644
index 0000000..bb45fff
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_diagnosis_invoice_items.php
@@ -0,0 +1,93 @@
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ echo ' ';
+ echo '';
+ }
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal?>
+
+
+ discount_amount>0) {?>
+
+ #
+ Deduction
+ =$invoice_master[0]->discount_desc ?>
+
+
+ -=$invoice_master[0]->discount_amount ?>
+
+
+
+
+ #
+
+
+
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+ correction_amount>0) {?>
+
+ #
+ Correction
+ =$invoice_master[0]->correction_remark ?>
+
+
+ -=$invoice_master[0]->correction_amount ?>
+
+
+
+ #
+
+
+
+ Final Amount
+ =$invoice_master[0]->correction_net_amount?>
+
+
+
+
+
+
+
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+ Mode of Payment : =$invoice_master[0]->payment_mode_desc ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_discharge.php b/old_code_ci3/views/IPD2/ipd_discharge.php
new file mode 100644
index 0000000..7f4c41c
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_discharge.php
@@ -0,0 +1,308 @@
+'form','class'=>'form1')); ?>
+
+
+
Discharge Process
+
+
+
+
+
+
+ Deduction Remark 1
+
+
+
+
+
+ Deduction Amount 1
+
+
+
+
+
+ Update Deduction 1
+ Discount Update
+
+
+
+
+
+
+ Deduction Remark 2
+
+
+
+
+
+ Deduction Amount 2
+
+
+
+
+
+ Update Deduction 2
+ Discount Update
+
+
+
+
+
+
+ Deduction Remark 3
+
+
+
+
+
+ Deduction Amount 3
+
+
+
+
+
+ Update Deduction 3
+ Discount Update
+
+
+
+
+
+
+
+ Addition Charge Remark 1
+
+
+
+
+
+ Addition Charge Amount
+
+
+
+
+
+ Update Addition Charge
+ Charge Update
+
+
+
+
+
+
+
+ Addition Charge Remark 2
+
+
+
+
+
+ Addition Charge Amount
+
+
+
+
+
+ Update Addition Charge
+ Charge Update
+
+
+
+
+
+
+
+
+
+ Patient Status
+
+
+ id,$ipd_info[0]->discarge_patient_status)?> >=$row->status_desc?>
+
+
+
+
+
+
+
+
+
+ Balance Amount Approved By
+
+
+
+
+
+ Balance Amount Remark
+
+
+
+
+
+ Update Discharge Status
+ ion_auth->in_group('IPDDischarge')){
+ if($ipd_info[0]->lock_medical==0) { ?>
+ Update Discharge
+
+ Discharge Button Not Enable due to medical bill pending. Please contact Medical Store
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_discharged_status.php b/old_code_ci3/views/IPD2/ipd_discharged_status.php
new file mode 100644
index 0000000..8641a8b
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_discharged_status.php
@@ -0,0 +1,93 @@
+
+
+
Discharge Process
+
+
+
+
+
+
+
+
+
+
+ =$ipd_info[0]->discharge_remark ?>
+
+
+
+
+
+
+
+ Balance Amount Approved By
+
+
+
+
+
+ Balance Amount Remark
+
+
+
+ ion_auth->in_group('IPDReAdmit')) { ?>
+
+
+ ReAdmit
+
+ ReAdmit
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_dues_form.php b/old_code_ci3/views/IPD2/ipd_dues_form.php
new file mode 100644
index 0000000..fd05243
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_dues_form.php
@@ -0,0 +1,151 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+ p_code.':'.$ipd_info[0]->ipd_code .':P-'.date('Y-m-d H:i:s').':C-'.$person_info[0]->p_fname;
+ ?>
+
+
+
+
+Clearance Vheck List
+
+
+ ';
+ $Insurance='';
+ if(count($case_master)>0){
+ $Insurance= 'Insurance : '.$case_master[0]->insurance_company_name;
+ }
+
+ echo 'Patient Information :
+ Patient Name : '.$person_info[0]->p_fname.'
+ '.$person_info[0]->p_relative.' '.$person_info[0]->p_rname.'
+ Age : '.$person_info[0]->age .'
+ Gender : '.$person_info[0]->xgender.'
+ UHID/Patient Code : '.$person_info[0]->p_code.'
+ IPD Code : '.$ipd_info[0]->ipd_code.'
+ Phone No : '.$person_info[0]->mphone1.$Insurance.'
+
+ ';
+
+ echo '
+ Contact Person Name : '.$ipd_info[0]->contact_person_Name.'
+ Relation : '.$ipd_info[0]->relation.'
+ Relative Phone No : '.$ipd_info[0]->P_mobile1.'
+ Patient Address
+ '.$person_info[0]->add1.' ,
+ '.$person_info[0]->add2.' ,
+ '.$person_info[0]->city.' ,
+ '.$person_info[0]->state.'
+ ';
+
+ $srno=1;
+ $ipd_doc_list_show='';;
+ foreach($ipd_doc_list as $row)
+ {
+ $ipd_doc_list_show.= ' Dr. '.$row->p_fname.' / ';
+ $srno=$srno+1;
+ }
+
+
+ echo '
+ Date of Admission : '.$ipd_info[0]->str_register_date.'
+ Admission Time : '.$ipd_info[0]->reg_time.'
+ Date of Discharge : '.$ipd_info[0]->discharge_date.'
+ Time of Discharge : '.$ipd_info[0]->discharge_time.'
+ Case Type : '.$ipd_info[0]->case_type_s.'
+ Doctors : : '.$ipd_doc_list_show.'
+ ';
+
+ echo '';
+ ?>
+
+
+
+
+
+
+ Check Point
+
+
+ Checked By
+
+
+
+
+ Medical Store .
+
+
+ ____________________________________________ .
+
+
+
+
+ Pathology .
+
+
+ ____________________________________________ .
+
+
+
+
+ Radiology .
+
+
+ ____________________________________________ .
+
+
+
+
+ Physiotherapy .
+
+
+ ____________________________________________ .
+
+
+
+
+ Private ward .
+
+
+ ____________________________________________ .
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_invoice_doc_wise.php b/old_code_ci3/views/IPD2/ipd_invoice_doc_wise.php
new file mode 100644
index 0000000..83672e1
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_invoice_doc_wise.php
@@ -0,0 +1,221 @@
+
+
+
+
+ipd_status>0) { ?>
+ Bill No. : =$ipdmaster[0]->id ?>
+Item Wise Bill '; } ?>
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipdmaster[0]->ipd_code ?> / UHID:=$person_info[0]->p_code ?> /Name : =$person_info[0]->p_fname ?>
+
+
+
+Discount+$ipdmaster[0]->Discount2+$ipdmaster[0]->Discount3;
+$total_charge=$ipdmaster[0]->chargeamount1+$ipdmaster[0]->chargeamount2;
+$gross_amount=$ipdmaster[0]->gross_amount-$ipdmaster[0]->package_med_amount-$ipdmaster[0]->med_amount;
+
+$perdis=($total_discount*100)/$gross_amount;
+
+?>
+
+
+
+ Patient Name : =$person_info[0]->p_fname ?>
+ =$person_info[0]->p_relative ?> : =$person_info[0]->p_rname ?>
+ Patient-ID/UHID : =$person_info[0]->p_code ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+ Address :=$person_info[0]->add1 ?> , =$person_info[0]->add2 ?>
+ =$person_info[0]->city ?> ,=$person_info[0]->district ?> , =$person_info[0]->state ?> - =$person_info[0]->zip ?>
+
+
+ IPD ID : =$ipdmaster[0]->ipd_code ?>
+ Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?>
+ Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?>
+ No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?>
+ 0){ ?>
+ Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+ Doctor Name : =$ipd_list[0]->doc_name ?>
+
+
+
+ case_id>0) { ?>
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Insurance Company Name : =$orgcase[0]->Org_insurance_comp?>
+ Card No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Service No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+ Amt After Discount
+
+ 0){
+ echo '';
+ echo 'Package ';
+ echo ' ';
+ $headdesc='Package';
+ $headTotal=0.00;
+
+ for($i=0;$i';
+ echo ''.$srno.' ';
+ echo ''.$ipd_package[$i]->package_name.' ';
+ echo ''.$ipd_package[$i]->org_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$ipd_package[$i]->package_Amount.' ';
+ echo ''.($ipd_package[$i]->package_Amount-($ipd_package[$i]->package_Amount*$perdis/100)).' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_package[$i]->package_Amount;
+ echo '';
+ }
+
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ }
+
+
+ }
+ for($i=0;$igroup_desc)
+ {
+ echo '';
+ echo ''.$ipd_invoice_item[$i]->group_desc.' ';
+ echo ' ';
+ $headdesc=$ipd_invoice_item[$i]->group_desc;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$ipd_invoice_item[$i]->item_name.' '.$ipd_invoice_item[$i]->comment.' ';
+ echo ''.$ipd_invoice_item[$i]->org_code.' ';
+ echo ''.$ipd_invoice_item[$i]->item_qty.' ';
+ echo ''.$ipd_invoice_item[$i]->item_rate.' ';
+ echo ''.$ipd_invoice_item[$i]->item_amount.' ';
+ echo ''.($ipd_invoice_item[$i]->item_amount-Round($ipd_invoice_item[$i]->item_amount*$perdis/100)).' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_invoice_item[$i]->item_amount;
+ echo ' ';
+
+ if($headdesc!=@$ipd_invoice_item[$i+1]->group_desc)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+
+ for($i=0;$iCharge_type)
+ {
+ echo '';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ echo ''.($showinvoice[$i]->amount-Round($showinvoice[$i]->amount*$perdis/100)).' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+ echo ' ';
+
+ if($headdesc!=@$showinvoice[$i+1]->Charge_type)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+ ?>
+
+
+
+ #
+
+
+
+
+ Net Amount
+ =$ipdmaster[0]->net_amount?>
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_invoice_error_v.php b/old_code_ci3/views/IPD2/ipd_invoice_error_v.php
new file mode 100644
index 0000000..59fb4c7
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_invoice_error_v.php
@@ -0,0 +1,3 @@
+
+Discount Should not be greater then 10%
+
Please Contact Admin Department
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_invoice_items.php b/old_code_ci3/views/IPD2/ipd_invoice_items.php
new file mode 100644
index 0000000..a9fa355
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_invoice_items.php
@@ -0,0 +1,1167 @@
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ Registration Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+ Panel Doctor Name
+
+ id.' >'.$row->DocSpecName.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+ Doctor Name
+
+ NONE';
+ foreach($doclist as $row)
+ {
+ echo ''.$row->DocSpecName.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+ Add By Specialization
+
+
+
+
+
+
+
+
+ Panel Doctor Name
+
+ id.' >'.$row->DocSpecName.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Specility
+
+ id.' >'.$row->SpecName.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ Add By Specialization
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+ Comment / Batch No. /Invoice No.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+ Doctor Name
+
+ NONE';
+ foreach($doclist as $row)
+ {
+ echo ''.$row->DocSpecName.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+ Doctor Name
+
+ NONE';
+ foreach($doclist as $row)
+ {
+ echo ''.$row->DocSpecName.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Charge Type
+
+ itype_id.'>'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+ Panel Doctor Name
+
+ NONE';
+ foreach($doclist as $row)
+ {
+ echo ''.$row->DocSpecName.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_invoice_print_on_letterhead.php b/old_code_ci3/views/IPD2/ipd_invoice_print_on_letterhead.php
new file mode 100644
index 0000000..68fe5b7
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_invoice_print_on_letterhead.php
@@ -0,0 +1,299 @@
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipdmaster[0]->ipd_code ?> / UHID:=$person_info[0]->p_code ?> /Name : =$person_info[0]->p_fname ?>
+
+
+
+
+
+
+ Patient / Relative Signature
+ Authorized Signatory
+
+
+
+
+ipd_status>0) { ?>
+ Bill No. : =$ipdmaster[0]->id ?>
+Provisional Bill '; } ?>
+
+
+
+
+ Patient Name : =$person_info[0]->p_fname ?>
+ =$person_info[0]->p_relative ?> : =$person_info[0]->p_rname ?>
+ Patient-ID/UHID : =$person_info[0]->p_code ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+ Address :=$person_info[0]->add1 ?> , =$person_info[0]->add2 ?>
+ =$person_info[0]->city ?> ,=$person_info[0]->district ?> , =$person_info[0]->state ?> - =$person_info[0]->zip ?>
+
+
+ IPD ID : =$ipdmaster[0]->ipd_code ?>
+ Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?>
+ Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?>
+ No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?>
+ 0){ ?>
+ Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+ Doctor Name : =$ipd_list[0]->doc_name ?>
+
+
+
+ case_id>0) { ?>
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Insurance Company Name : =$orgcase[0]->Org_insurance_comp?>
+ Card No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Service No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ 0){
+ echo '';
+ echo 'Package ';
+ echo ' ';
+ $headdesc='Package';
+ $headTotal=0.00;
+
+ for($i=0;$i';
+ echo ''.$srno.' ';
+ echo ''.$ipd_package[$i]->package_name.' ';
+ echo ''.$ipd_package[$i]->org_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$ipd_package[$i]->package_Amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_package[$i]->package_Amount;
+ echo '';
+ }
+
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ }
+
+
+ }
+ for($i=0;$igroup_desc)
+ {
+ echo '';
+ echo ''.$ipd_invoice_item[$i]->group_desc.' ';
+ echo ' ';
+ $headdesc=$ipd_invoice_item[$i]->group_desc;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$ipd_invoice_item[$i]->item_name.''.$ipd_invoice_item[$i]->comment.' ';
+ echo ' ';
+ echo ''.$ipd_invoice_item[$i]->item_qty.' ';
+ echo ''.$ipd_invoice_item[$i]->item_rate.' ';
+ echo ''.$ipd_invoice_item[$i]->item_amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_invoice_item[$i]->item_amount;
+ echo ' ';
+
+ if($headdesc!=@$ipd_invoice_item[$i+1]->group_desc)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+
+ for($i=0;$iCharge_type)
+ {
+ echo '';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+ echo ' ';
+
+ if($headdesc!=@$showinvoice[$i+1]->Charge_type)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+
+ if(count($inv_med_list)>0)
+ {
+ echo '';
+ echo 'Medicine ';
+ echo ' ';
+
+ $med_total=0.00;
+ echo '';
+ echo ' ';
+ echo 'Pharmacy : '.M_store.' ';
+ echo ' ';
+
+ echo '';
+ echo ''.$srno.' ';
+ echo '';
+ foreach($inv_med_list as $row)
+ {
+ echo $row->inv_med_code.', ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ }
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.number_format(Round($med_total,0),2).' ';
+
+ }
+ ?>
+
+
+
+ #
+
+
+
+ Gross Total
+ =$ipdmaster[0]->gross_amount?>
+
+ Discount>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark ?>
+
+ Discount
+ =$ipdmaster[0]->Discount ?>
+
+
+
+ Discount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark2 ?>
+
+ Discount
+ =$ipdmaster[0]->Discount2 ?>
+
+
+
+ Discount3>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark3 ?>
+
+ Discount
+ =$ipdmaster[0]->Discount3 ?>
+
+
+ chargeamount1>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge1 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount1 ?>
+
+
+ chargeamount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge2 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount2 ?>
+
+
+
+ #
+
+
+
+ Net Amount
+ =$ipdmaster[0]->net_amount?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_invoice_print_on_letterhead_wo_payment.php b/old_code_ci3/views/IPD2/ipd_invoice_print_on_letterhead_wo_payment.php
new file mode 100644
index 0000000..08e6a04
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_invoice_print_on_letterhead_wo_payment.php
@@ -0,0 +1,331 @@
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipdmaster[0]->ipd_code ?> / UHID:=$person_info[0]->p_code ?> /Name : =$person_info[0]->p_fname ?>
+
+
+
+
+
+
+ Patient / Relative Signature
+ Authorized Signatory
+
+
+
+
+ipd_status>0) { ?>
+ Bill No. : =$ipdmaster[0]->id ?>
+Provisional Bill '; } ?>
+
+
+
+
+ Patient Name : =$person_info[0]->p_fname ?>
+ =$person_info[0]->p_relative ?> : =$person_info[0]->p_rname ?>
+ Patient-ID/UHID : =$person_info[0]->p_code ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+ Address :=$person_info[0]->add1 ?> , =$person_info[0]->add2 ?>
+ =$person_info[0]->city ?> ,=$person_info[0]->district ?> , =$person_info[0]->state ?> - =$person_info[0]->zip ?>
+
+
+ IPD ID : =$ipdmaster[0]->ipd_code ?>
+ Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?>
+ Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?>
+ No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?>
+ 0){ ?>
+ Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+ Doctor Name : =$ipd_list[0]->doc_name ?>
+ Status : =$ipd_list[0]->status_desc ?>
+
+
+
+ case_id>0) { ?>
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Insurance Company Name : =$orgcase[0]->Org_insurance_comp?>
+ Card No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Service No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ 0){
+ echo '';
+ echo 'Package ';
+ echo ' ';
+ $headdesc='Package';
+ $headTotal=0.00;
+
+ for($i=0;$i';
+ echo ''.$srno.' ';
+ echo ''.$ipd_package[$i]->package_name.' ';
+ echo ''.$ipd_package[$i]->org_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$ipd_package[$i]->package_Amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_package[$i]->package_Amount;
+ echo '';
+ }
+
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ }
+
+
+ }
+ for($i=0;$igroup_desc)
+ {
+ echo '';
+ echo ''.$ipd_invoice_item[$i]->group_desc.' ';
+ echo ' ';
+ $headdesc=$ipd_invoice_item[$i]->group_desc;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$ipd_invoice_item[$i]->item_name.' '.$ipd_invoice_item[$i]->comment.' ';
+ echo ''.$ipd_invoice_item[$i]->org_code.' ';
+ echo ''.$ipd_invoice_item[$i]->item_qty.' ';
+ echo ''.$ipd_invoice_item[$i]->item_rate.' ';
+ echo ''.$ipd_invoice_item[$i]->item_amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_invoice_item[$i]->item_amount;
+ echo ' ';
+
+ if($headdesc!=@$ipd_invoice_item[$i+1]->group_desc)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+
+ for($i=0;$iCharge_type)
+ {
+ echo '';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+ echo ' ';
+
+ if($headdesc!=@$showinvoice[$i+1]->Charge_type)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+ if(count($inv_med_list)>0)
+ {
+ echo '';
+ echo 'Medicine ';
+ echo ' ';
+
+ $med_total=0.00;
+
+ foreach($inv_med_list as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Med. Total ';
+ echo ''.number_format(Round($med_total,0),2).' ';
+ echo ' ';
+ }
+ ?>
+
+ #
+
+
+
+ Gross Total
+ =$ipdmaster[0]->gross_amount?>
+
+
+
+ Discount>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark ?>
+
+ Discount
+ =$ipdmaster[0]->Discount ?>
+
+
+
+ Discount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark2 ?>
+
+ Discount
+ =$ipdmaster[0]->Discount2 ?>
+
+
+
+ Discount3>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark3 ?>
+
+ Discount
+ =$ipdmaster[0]->Discount3 ?>
+
+
+ chargeamount1>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge1 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount1 ?>
+
+
+ chargeamount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge2 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount2 ?>
+
+
+
+ #
+
+
+
+ Net Amount
+ =$ipdmaster[0]->net_amount?>
+
+
+
+ #
+
+ Payment Recd.
+ id.':'.$row->pay_mode.':'.$row->pay_date_str.':'.$row->amount.'] /';
+ if($i%3==0)
+ {
+ echo ' ';
+ }
+ }
+ ?>
+
+
+
+ =$ipdmaster[0]->total_paid_amount?>
+
+
+ #
+
+
+
+ Balance
+ =$ipdmaster[0]->balance_amount?>
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_invoice_print_wo_payment.php b/old_code_ci3/views/IPD2/ipd_invoice_print_wo_payment.php
new file mode 100644
index 0000000..6e0ffc8
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_invoice_print_wo_payment.php
@@ -0,0 +1,325 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+ p_code.':'.$ipdmaster[0]->ipd_code .':P-'.date('Y-m-d H:i:s');
+ ?>
+
+
+
+
+
+ipd_status>0) { ?>
+ Bill No. : =$ipdmaster[0]->id ?>
+Provisional Bill '; } ?>
+
+
+
+
+
+ Patient / Relative Signature
+ Authorized Signatory
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipdmaster[0]->ipd_code ?> / UHID:=$person_info[0]->p_code ?> /Name : =$person_info[0]->p_fname ?>
+
+
+
+
+
+
+ Patient Name : =$person_info[0]->p_fname ?>
+ =$person_info[0]->p_relative ?> : =$person_info[0]->p_rname ?>
+ Patient-ID/UHID : =$person_info[0]->p_code ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+ Address :=$person_info[0]->add1 ?> , =$person_info[0]->add2 ?>
+ =$person_info[0]->city ?> ,=$person_info[0]->district ?> , =$person_info[0]->state ?> - =$person_info[0]->zip ?>
+
+
+ IPD ID : =$ipdmaster[0]->ipd_code ?>
+ Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?>
+ Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?>
+ No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?>
+ 0){ ?>
+ Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+ Doctor Name : =$ipd_list[0]->doc_name ?>
+ Status : =$ipd_list[0]->status_desc ?>
+
+
+
+ case_id>0) { ?>
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Insurance Company Name : =$orgcase[0]->Org_insurance_comp?>
+ Card No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Service No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+
+
+
+
+
+
+
+
+ #
+ Description
+ Org.Code
+ Unit
+ Rate
+ Amount
+
+ 0){
+ echo '';
+ echo 'Package ';
+ echo ' ';
+ $headdesc='Package';
+ $headTotal=0.00;
+
+ for($i=0;$i';
+ echo ''.$srno.' ';
+ echo ''.$ipd_package[$i]->package_name.' ';
+ echo ''.$ipd_package[$i]->org_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$ipd_package[$i]->package_Amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_package[$i]->package_Amount;
+ echo '';
+ }
+
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ }
+
+
+ }
+ for($i=0;$igroup_desc)
+ {
+ echo '';
+ echo ''.$ipd_invoice_item[$i]->group_desc.' ';
+ echo ' ';
+ $headdesc=$ipd_invoice_item[$i]->group_desc;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$ipd_invoice_item[$i]->item_name.' '.$ipd_invoice_item[$i]->comment.' ';
+ echo ' ';
+ echo ''.$ipd_invoice_item[$i]->item_qty.' ';
+ echo ''.$ipd_invoice_item[$i]->item_rate.' ';
+ echo ''.$ipd_invoice_item[$i]->item_amount.' ';
+ $srno=$srno+1;
+ $headTotal += $ipd_invoice_item[$i]->item_amount;
+ echo ' ';
+
+ if($headdesc!=@$ipd_invoice_item[$i+1]->group_desc)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+
+ for($i=0;$iCharge_type)
+ {
+ echo '';
+ echo ''.$showinvoice[$i]->Charge_type.' ';
+ echo ' ';
+ $headdesc=$showinvoice[$i]->Charge_type;
+ $headTotal=0.00;
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$showinvoice[$i]->idesc.' ';
+ echo ''.$showinvoice[$i]->orgcode.' ';
+ echo ''.$showinvoice[$i]->no_qty.' ';
+ echo ''.$showinvoice[$i]->item_rate.' ';
+ echo ''.$showinvoice[$i]->amount.' ';
+ $srno=$srno+1;
+ $headTotal += $showinvoice[$i]->amount;
+ echo ' ';
+
+ if($headdesc!=@$showinvoice[$i+1]->Charge_type)
+ {
+ if(false)
+ {
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Sub Total ';
+ echo ''.number_format($headTotal,2).' ';
+ echo ' ';
+ }
+ }
+ }
+
+
+ if(count($inv_med_list)>0)
+ {
+ echo '';
+ echo 'Medicine ';
+ echo ' ';
+
+ $med_total=0.00;
+
+ foreach($inv_med_list as $row)
+ {
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ $med_total +=$row->net_amount;
+ echo ' ';
+ }
+
+ echo '';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo 'Med. Total ';
+ echo ''.number_format(Round($med_total,0),2).' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+ #
+
+
+
+ Gross Total
+ =$ipdmaster[0]->gross_amount?>
+
+ Discount>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark ?>
+
+ Discount
+ =$ipdmaster[0]->Discount ?>
+
+
+
+ Discount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark2 ?>
+
+ Discount
+ =$ipdmaster[0]->Discount2 ?>
+
+
+
+ Discount3>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->Discount_Remark3 ?>
+
+ Discount
+ =$ipdmaster[0]->Discount3 ?>
+
+
+ chargeamount1>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge1 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount1 ?>
+
+
+ chargeamount2>0) { ?>
+
+ #
+ Remark :=$ipdmaster[0]->charge2 ?>
+
+ Charge
+ =$ipdmaster[0]->chargeamount2 ?>
+
+
+
+ #
+
+
+
+ Net Amount
+ =$ipdmaster[0]->net_amount?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_main_panel.php b/old_code_ci3/views/IPD2/ipd_main_panel.php
new file mode 100644
index 0000000..a4db372
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_main_panel.php
@@ -0,0 +1,602 @@
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
+
Name
+
+
+ = $person_info[0]->p_fname ?>
+
+ Phone Number : = $person_info[0]->mphone1 ?>
+
+
+
+
Relative Name
+
+
+
+ Phone Number :
+ ,
+
+
+
Save
+
+
+
+
Address
+
+
+ = $person_info[0]->add1 ?>,
+ = $person_info[0]->add2 ?>,
+ = $person_info[0]->city ?>,
+ = $person_info[0]->state ?>,
+
+
+
+
+
Admit Date
+
+
+
+
+ ion_auth->in_group('IPDAdmit')) { ?>
+
+
+
+
+
+ Admit Date : = MysqlDate_to_str($ipd_info[0]->register_date) ?> Time : = $ipd_info[0]->reg_time ?>
+
+
+ ion_auth->in_group('IPDDocUpdate')) { ?>
+
+
Department
+
+
+
+
+ iId . ' '.combo_checked($row->iId,$ipd_info[0]->dept_id).' >' . $row->vName . '';
+ }
+ ?>
+
+
+
+
+ Update Department
+
+
+
+
+
+
+
+
Associated Doctors
+
+ p_fname . ' ';
+ if ($this->ion_auth->in_group('IPDDocUpdate')) {
+ echo ' Remove ';
+ }
+ echo ' ';
+ $srno = $srno + 1;
+ }
+ ?>
+
+ ion_auth->in_group('IPDDocUpdate')) { ?>
+
+
+
+ id . ' >' . $row->p_fname . '';
+ }
+ ?>
+
+
+
+
+
+
+
Referred List
+
+ refer_name . ' ';
+ if ($this->ion_auth->in_group('IPDReferUpdate')) {
+ echo ' Remove ';
+ }
+ echo ' ';
+ $srno = $srno + 1;
+ }
+ ?>
+
+ ion_auth->in_group('IPDReferUpdate')) { ?>
+
+
+
+ id . ' >' . $row->refer_name . '';
+ }
+ ?>
+
+
+
+
+
+
+
+
Notes
+
+ = $ipd_info[0]->remark ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0) { ?>
+
+
+
+
+
+ Org. Add Charge
+ Update Case Information
+ CONTINGENT BILL
+ Edit Org Invoice
+
+
+
+
+
+
+ doc_recd) ?> onchange="onChangeUpdate('= $case_master[0]->id ?>','doc_recd',this)"> Document Received
+
+
+
+
+ preauth_send) ?> onchange="onChangeUpdate('= $case_master[0]->id ?>','preauth_send',this)"> Pre-Auth Send
+
+
+
+
+
+
+
+ Org. Status
+
+ id . '" ' . combo_checked($row->id, $case_master[0]->org_approved_status_id) . ' >' . $row->app_status . '';
+ }
+ ?>
+
+
+
+
+
+ Approved Amount
+
+
+
+
+
+
+
+
+
+ final_bill_send) ?> onchange="onChangeUpdate('= $case_master[0]->id ?>','final_bill_send',this)"> Final Bill Send
+
+
+
+
+
+
+
+
+
+
+
+
+ Attach This IPD With Org. = $row->case_id_code ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_medical_invoice_short.php b/old_code_ci3/views/IPD2/ipd_medical_invoice_short.php
new file mode 100644
index 0000000..b363275
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_medical_invoice_short.php
@@ -0,0 +1,43 @@
+
+
+
+
+
+ #
+ Item Name
+ Qty.
+ Price
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.'['.$row->formulation.'] ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->tamount.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+ Total
+ =$inv_master_credit[0]->net_amount ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_model_payment_box.php b/old_code_ci3/views/IPD2/ipd_model_payment_box.php
new file mode 100644
index 0000000..c2e9abe
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_model_payment_box.php
@@ -0,0 +1,219 @@
+'form','class'=>'form1')); ?>
+
+
+
+
+
Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->str_age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+ / IPD Code : =$ipd_info[0]->ipd_code?>
+ / No of Days : =$ipd_info[0]->no_days?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_package.php b/old_code_ci3/views/IPD2/ipd_package.php
new file mode 100644
index 0000000..40831ae
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_package.php
@@ -0,0 +1,201 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_panel_deduction_payment.php b/old_code_ci3/views/IPD2/ipd_panel_deduction_payment.php
new file mode 100644
index 0000000..2582f43
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_panel_deduction_payment.php
@@ -0,0 +1,180 @@
+'form','class'=>'form1')); ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_panel_refund.php b/old_code_ci3/views/IPD2/ipd_panel_refund.php
new file mode 100644
index 0000000..dc3094c
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_panel_refund.php
@@ -0,0 +1,131 @@
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_payment.php b/old_code_ci3/views/IPD2/ipd_payment.php
new file mode 100644
index 0000000..b51fc2c
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_payment.php
@@ -0,0 +1,85 @@
+
+
+
+
+
+
+
+
+ #
+ ID.
+ Payment Date
+ Amount
+ Mode
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->id.' ';
+ echo ''.$row->pay_date_str.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->pay_mode.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Invoice ID.
+ Inv.Date
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->inv_date.' ';
+ echo ''.$row->net_amount.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD2/ipd_payment_receipt_print.php b/old_code_ci3/views/IPD2/ipd_payment_receipt_print.php
new file mode 100644
index 0000000..91bcd9a
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_payment_receipt_print.php
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+amount.':PT'.date('dmYhis');
+?>
+
+
+
+
+IPD Payment =$ipd_payment[0]->Amount_str?> Receipt : =$payid?>
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD No.:=$ipd_master[0]->ipd_code?> / UHID:=$patient_master[0]->p_code?> /Name : =strtoupper($patient_master[0]->p_fname)?>
+
+
+
+
+
+ Patient Info.
+ UHID : =$patient_master[0]->p_code?>
+ Name : =$patient_master[0]->title?> =strtoupper($patient_master[0]->p_fname)?>
+ =$patient_master[0]->p_relative?> =strtoupper($patient_master[0]->p_rname)?>
+ Sex : =$patient_master[0]->xgender?> =$patient_master[0]->age?> P.No. :=$patient_master[0]->mphone1?>
+
+
+ IPD No. : =$ipd_master[0]->ipd_code?>
+ Date : =$ipd_payment[0]->payment_date_str?>
+
+
+
+
+
+ IPD =$ipd_payment[0]->Amount_str?> Amount : Rs. =$ipd_payment[0]->amount?>
+ Amount in Words : Rs.=number_to_word($ipd_payment[0]->amount)?>
+
+
+ Prepared By : =$ipd_payment[0]->update_by?>
+
+
+
+ Signature
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/ipd_room.php b/old_code_ci3/views/IPD2/ipd_room.php
new file mode 100644
index 0000000..1202503
--- /dev/null
+++ b/old_code_ci3/views/IPD2/ipd_room.php
@@ -0,0 +1,5 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/print_ipd_form1.php b/old_code_ci3/views/IPD2/print_ipd_form1.php
new file mode 100644
index 0000000..beb3a63
--- /dev/null
+++ b/old_code_ci3/views/IPD2/print_ipd_form1.php
@@ -0,0 +1,134 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ p_code.':'.$ipd_info[0]->ipd_code .':P-'.date('Y-m-d H:i:s').':C-'.$person_info[0]->p_fname;
+ ?>
+
+
+
+
+ BED HEAD TICKET
+
+
+
+ ';
+ $Insurance='';
+ if(count($case_master)>0){
+ $Insurance= 'Insurance : '.$case_master[0]->insurance_company_name;
+ }
+
+ echo 'Patient Information :
+ Patient Name : '.$person_info[0]->title.' '.$person_info[0]->p_fname.'
+ '.$person_info[0]->p_relative.' '.$person_info[0]->p_rname.'
+ Age : '.$person_info[0]->age .'
+ Gender : '.$person_info[0]->xgender.'
+
+ Phone No : '.$person_info[0]->mphone1.'
+ Contact Person Name : '.$ipd_info[0]->contact_person_Name.'
+ Relation : '.$ipd_info[0]->relation.'
+ Relative Phone No : '.$ipd_info[0]->P_mobile2.'
+
+ Patient Address
+ '.$person_info[0]->add1.'
+ '.$person_info[0]->city.'
+ '.$person_info[0]->state.'
+ ';
+
+
+ $srno=1;
+ $ipd_doc_list_show='';
+ foreach($ipd_doc_list as $row)
+ {
+ $ipd_doc_list_show.= ' Dr. '.$row->p_fname.' ';
+ $srno=$srno+1;
+ }
+
+
+ echo '
+ UHID : '.$person_info[0]->p_code.'
+ IPD Code : '.$ipd_info[0]->ipd_code.'
+ Bed Desc : '.$ipd_info_2[0]->Bed_Desc.' '.$Insurance.'
+ Date And Time of Admission : '.$ipd_info[0]->str_register_date.' '.$ipd_info[0]->reg_time.'
+ Case Type : '.$ipd_info[0]->case_type_s.'
+ Doctors : : '.$ipd_doc_list_show.'
+ ';
+
+ echo '';
+ ?>
+
+
सहमति पत्र
+
+ मैं ईलाज कराने का/की इक्छुक हूँ | मैं =H_Name_Hindi?> (=H_Name?>) के चिकित्सक और उनके सहायको को अपना उपचार , परीक्षण, परामर्श, जाँच, औषधि देने , चिकित्सा बेहोशी की दवा लगवाने की स्वीकृति देता हूँ |
+ मुझे मेरी /मेरे मरीज की बीमारी के बारे मे उसके खतरों से जटिलताओं (complications ) से अवगत करा दिया गया है | मुझे ईलाज मे होने वाले खर्च की जानकारी दे दी गई है एवं मै इलाज में आने वाले खर्चो के भुगतान को वहन करने की सहमति प्रदान करता हूँ
+| मैंने अपनी सभी शंकाओं का निवारण कर लिया है । इस स्वीक्रति पत्र को मैंने ठीक प्रकार से पड़कर स्वयं समझकर हस्ताक्षर के द्वारा अपनी सहमति प्रदान करता / करती हूँ ।
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ हस्ताक्षर / अंगूठा निशान
+
+
+
+
+
+ नाम : _______________________________________________
+
+
+
+ मरीज / मरीज से संबंध : _____________________________
+
+
+
+ पता : _______________________________________________
+
+
+
+
+ फ़ोन नंबर : _________________________________________
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/print_ipd_form2.php b/old_code_ci3/views/IPD2/print_ipd_form2.php
new file mode 100644
index 0000000..43bdfc2
--- /dev/null
+++ b/old_code_ci3/views/IPD2/print_ipd_form2.php
@@ -0,0 +1,140 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+ p_code.':'.$ipd_info[0]->ipd_code .':P-'.date('Y-m-d H:i:s').':C-'.$person_info[0]->p_fname;
+ ?>
+
+
+
+
+Face Sheet
+Admission to Covid Ward
+
+
+
+ ';
+ $Insurance='';
+ if(count($case_master)>0){
+ $Insurance= 'Insurance : '.$case_master[0]->insurance_company_name;
+ }
+
+ echo 'Patient Information :
+ Patient Name : '.$person_info[0]->p_fname.'
+ '.$person_info[0]->p_relative.' '.$person_info[0]->p_rname.'
+ Age : '.$person_info[0]->age .'
+ Gender : '.$person_info[0]->xgender.'
+ UHID/Patient Code : '.$person_info[0]->p_code.'
+ IPD Code : '.$ipd_info[0]->ipd_code.'
+ Phone No : '.$person_info[0]->mphone1.$Insurance.'
+
+ ';
+
+ echo '
+ Contact Person Name : '.$ipd_info[0]->contact_person_Name.'
+ Relation : '.$ipd_info[0]->relation.'
+ Relative Phone No : '.$ipd_info[0]->P_mobile1.'
+ Patient Address
+ '.$person_info[0]->add1.' ,
+ '.$person_info[0]->add2.' ,
+ '.$person_info[0]->city.' ,
+ '.$person_info[0]->state.'
+ ';
+
+ $srno=1;
+ $ipd_doc_list_show='';;
+ foreach($ipd_doc_list as $row)
+ {
+ $ipd_doc_list_show.= ' Dr. '.$row->p_fname.' / ';
+ $srno=$srno+1;
+ }
+
+
+ echo '
+ Date of Admission : '.$ipd_info[0]->str_register_date.'
+ Admission Time : '.$ipd_info[0]->reg_time.'
+ Date of Discharge : '.$ipd_info[0]->discharge_date.'
+ Time of Discharge : '.$ipd_info[0]->discharge_time.'
+ Case Type : '.$ipd_info[0]->case_type_s.'
+ Doctors : : '.$ipd_doc_list_show.'
+ ';
+
+ echo '';
+ ?>
+
+
सहमति पत्र
+
+ मैं ईलाज कराने का/की इक्छुक हूँ | मैं =H_Name_Hindi?>(=H_Name?>) के चिकित्सक और उनके सहायको को अपना उपचार , परीक्षण, परामर्श, जाँच, औषधि देने , चिकित्सा बेहोशी की दवा लगवाने की स्वीकृति देता हूँ |
+ मुझे मेरी /मेरे मरीज की बीमारी के बारे मे उसके खतरों से जटिलताओं (complications ) से अवगत करा दिया गया है | मुझे ईलाज मे होने वाले खर्च की जानकारी दे दी गई है | मैंने अपनी सभी शंकाओं का निवारण कर लिया है । इस स्वीक्रति पत्र को मैंने ठीक प्रकार से पड़कर स्वयं समझकर हस्ताक्षर के द्वारा अपनी सहमति प्रदान करता / करती हूँ ।
+
+
+ COVID वार्ड में भर्ती होने वाले मरीजों से विनर्म निवेदन है की दिए गए निर्देशों का पालन करे :
+
+ सभी मरीजों की देखभाल और भोजन अस्पताल द्वारा किया जाएगा।
+ COVID वार्ड में मरीजों को सलाह दी जाती है कि वार्ड में कोई फोन और कोई भी उपकरण न दिया जाए।
+ परिचारक आधिकारिक फोन के माध्यम से अपने मरीजों से शाम 4:00 बजे से 6:00 बजे के बीच बात कर सकेंगे।
+ यह सुनिश्चित करने के लिए कि भुगतान सुचारू तरीके से किया जाए, आपको 5 दिनों के लिए अग्रिम भुगतान Rs.80000(Rs.16000/दिन) करना होगा ।
+ अस्पताल से remdesivir, fabiflu, low molecular weight heparin, tocilizumab, steroids जैसे दवाइयां का का भुगतान अलग से करना होगा।
+ मरीज से संबंधित सभी प्रकार की जांचो का का भुगतान अलग से करना होगा।
+ किसी भी तरह के अस्थिरता के लिए कानूनी कार्रवाई की जाएगी ।
+
+
+
+
+
+
+ Prepared By : =$user->first_name.' '.$user->last_name.'['.$user->id.']' ?>
+
+
+
+
+
+ हस्ताक्षर / अंगूठा निशान
+
+ नाम : _______________________________________________
+
+
+
+ मरीज / मरीज से संबंध : _____________________________
+
+
+
+ पता : _______________________________________________
+
+
+
+
+ फ़ोन नंबर : _________________________________________
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/print_ipd_form2_khrc.php b/old_code_ci3/views/IPD2/print_ipd_form2_khrc.php
new file mode 100644
index 0000000..e40c3ab
--- /dev/null
+++ b/old_code_ci3/views/IPD2/print_ipd_form2_khrc.php
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+ p_code.':'.$ipd_info[0]->ipd_code .':P-'.date('Y-m-d H:i:s').':C-'.$person_info[0]->p_fname;
+ ?>
+
+
+
+
+Face Sheet
+Admission to Covid Ward
+
+
+
+ ';
+ $Insurance='';
+ if(count($case_master)>0){
+ $Insurance= 'Insurance : '.$case_master[0]->insurance_company_name;
+ }
+
+ echo 'Patient Information :
+ Patient Name : '.$person_info[0]->p_fname.'
+ '.$person_info[0]->p_relative.' '.$person_info[0]->p_rname.'
+ Age : '.$person_info[0]->age .'
+ Gender : '.$person_info[0]->xgender.'
+ UHID/Patient Code : '.$person_info[0]->p_code.'
+ IPD Code : '.$ipd_info[0]->ipd_code.'
+ Phone No : '.$person_info[0]->mphone1.$Insurance.'
+
+ ';
+
+ echo '
+ Contact Person Name : '.$ipd_info[0]->contact_person_Name.'
+ Relation : '.$ipd_info[0]->relation.'
+ Relative Phone No : '.$ipd_info[0]->P_mobile1.'
+ Patient Address
+ '.$person_info[0]->add1.' ,
+ '.$person_info[0]->add2.' ,
+ '.$person_info[0]->city.' ,
+ '.$person_info[0]->state.'
+ ';
+
+ $srno=1;
+ $ipd_doc_list_show='';;
+ foreach($ipd_doc_list as $row)
+ {
+ $ipd_doc_list_show.= ' Dr. '.$row->p_fname.' / ';
+ $srno=$srno+1;
+ }
+
+
+ echo '
+ Date of Admission : '.$ipd_info[0]->str_register_date.'
+ Admission Time : '.$ipd_info[0]->reg_time.'
+ Date of Discharge : '.$ipd_info[0]->discharge_date.'
+ Time of Discharge : '.$ipd_info[0]->discharge_time.'
+ Case Type : '.$ipd_info[0]->case_type_s.'
+ Doctors : : '.$ipd_doc_list_show.'
+ ';
+
+ echo '';
+ ?>
+
+
सहमति पत्र
+
+ मैं ईलाज कराने का/की इक्छुक हूँ | मैं =H_Name_Hindi?>(=H_Name?>) के चिकित्सक और उनके सहायको को अपना उपचार , परीक्षण, परामर्श, जाँच, औषधि देने , चिकित्सा बेहोशी की दवा लगवाने की स्वीकृति देता हूँ |
+ मुझे मेरी /मेरे मरीज की बीमारी के बारे मे उसके खतरों से जटिलताओं (complications ) से अवगत करा दिया गया है | मुझे ईलाज मे होने वाले खर्च की जानकारी दे दी गई है | मैंने अपनी सभी शंकाओं का निवारण कर लिया है । इस स्वीक्रति पत्र को मैंने ठीक प्रकार से पड़कर स्वयं समझकर हस्ताक्षर के द्वारा अपनी सहमति प्रदान करता / करती हूँ ।
+
+
+ COVID वार्ड में भर्ती होने वाले मरीजों से विनर्म निवेदन है की दिए गए निर्देशों का पालन करे :
+
+ सभी मरीजों की देखभाल और भोजन अस्पताल द्वारा किया जाएगा।
+ COVID वार्ड में मरीजों को सलाह दी जाती है कि वार्ड में कोई फोन और कोई भी उपकरण न दिया जाए।
+ परिचारक आधिकारिक फोन के माध्यम से अपने मरीजों से शाम 4:00 बजे से 6:00 बजे के बीच बात कर सकेंगे।
+ यह सुनिश्चित करने के लिए कि भुगतान सुचारू तरीके से किया जाए, आपको 5 दिनों के लिए अग्रिम भुगतान Rs.80000(Rs.16000/दिन) करना होगा ।
+ अस्पताल से remdesivir, fabiflu, low molecular weight heparin, tocilizumab, steroids जैसे दवाइयां का का भुगतान अलग से करना होगा।
+ मरीज से संबंधित सभी प्रकार की जांचो का का भुगतान अलग से करना होगा।
+ अपनी TPA/ स्वास्थ्य बीमा की जानकारी के लिए अस्पताल में श्रीमती अंजू मोंगिया (मुख्य व्यवसाय विकास अधिकारी) (कमरा नंबर 11) से संपर्क करें ।
+ किसी भी तरह के अस्थिरता के लिए कानूनी कार्रवाई की जाएगी ।
+ किसी भी प्रकार की अन्य जानकारी या सहायता के लिए निम्नलिखित नंबरों पर संपर्क कर सकते हैं ।
+ 7351212111, 9536006200, 9837003915, 7351111146, 9927024103
+
+
+
+
+
+
+
+ Prepared By : =$user->first_name.' '.$user->last_name.'['.$user->id.']' ?>
+
+
+
+
+
+ हस्ताक्षर / अंगूठा निशान
+
+ नाम : _______________________________________________
+
+
+
+ मरीज / मरीज से संबंध : _____________________________
+
+
+
+ पता : _______________________________________________
+
+
+
+
+ फ़ोन नंबर : _________________________________________
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/print_ipd_form3.php b/old_code_ci3/views/IPD2/print_ipd_form3.php
new file mode 100644
index 0000000..d8fbfdf
--- /dev/null
+++ b/old_code_ci3/views/IPD2/print_ipd_form3.php
@@ -0,0 +1,132 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+ p_code.':'.$ipd_info[0]->ipd_code .':P-'.date('Y-m-d H:i:s').':C-'.$person_info[0]->p_fname;
+ ?>
+
+
+
+
+SELF DECLARATOION FROM HEALTH INSURANCE CARD HOLDER
+
+
+
+ ';
+ $Insurance='';
+ $insurance_company_name='_____________________________';
+ if(count($case_master)>0){
+ $Insurance= 'Insurance : '.$case_master[0]->insurance_company_name.' '.$case_master[0]->insurance_no.' '.$case_master[0]->insurance_no_1;
+ $insurance_company_name=$case_master[0]->insurance_company_name;
+ }
+
+ echo 'Patient Information :
+ Patient Name : '.$person_info[0]->p_fname.'
+ '.$person_info[0]->p_relative.' '.$person_info[0]->p_rname.'
+ Age : '.$person_info[0]->age .'
+ Gender : '.$person_info[0]->xgender.'
+ UHID/Patient Code : '.$person_info[0]->p_code.'
+ IPD Code : '.$ipd_info[0]->ipd_code.'
+ Phone No : '.$person_info[0]->mphone1.$Insurance.'
+
+ ';
+
+ echo '
+ Contact Person Name : '.$ipd_info[0]->contact_person_Name.'
+ Relation : '.$ipd_info[0]->relation.'
+ Relative Phone No : '.$ipd_info[0]->P_mobile1.'
+ Patient Address
+ '.$person_info[0]->add1.' ,
+ '.$person_info[0]->add2.' ,
+ '.$person_info[0]->city.' ,
+ '.$person_info[0]->state.'
+ ';
+
+ $srno=1;
+ $ipd_doc_list_show='';;
+ foreach($ipd_doc_list as $row)
+ {
+ $ipd_doc_list_show.= ' Dr. '.$row->p_fname.' / ';
+ $srno=$srno+1;
+ }
+
+
+ echo '
+ Date of Admission : '.$ipd_info[0]->str_register_date.'
+ Admission Time : '.$ipd_info[0]->reg_time.'
+ Date of Discharge : '.$ipd_info[0]->discharge_date.'
+ Time of Discharge : '.$ipd_info[0]->discharge_time.'
+ Case Type : '.$ipd_info[0]->case_type_s.'
+ Doctors : : '.$ipd_doc_list_show.'
+ ';
+
+ echo '';
+ ?>
+
+
मेडिक्लेम बीमा कार्ड धारक द्वारा स्व:घोषणा
+
+ मैं _________________________________ यह घोषणा करता / करती हूँ कि मैं /मेरा/ मेरी/ मरीज =$person_info[0]->p_fname?> का
+ =$insurance_company_name?> द्वारा मेडिक्लैम इनश्योरेंस है
+ जो दिनांक =$ipd_info[0]->str_register_date?> को =H_Name_Hindi?> में इलाज हेतु भर्ती हुआ /किया गया है |
+ मैंने स्वयँ अपना/ अपने मरीज का इनश्योरेंस कार्ड, आधार कार्ड एवं पैन कार्ड की फोटो कॉपी टी0 पी0 ए0 ऑफिस में जमा कर रहा/ रही हूँ/ जमा कर दिया है!
+ हमारे मेडिक्लैम इनश्योरेंस की रूम लिमिट रु0 ____________________________ हैं |
+ यदि इनश्योरेंस कम्पनी से मरीज का क्लेम पास नहीं होता है अथवा क्लेम किया गया बिल पूरा पास नहीं होता है तो पूरा बिल अथवा कटी हुई धनराशि जो भी देय है का भुगतान मैं स्वयं करूँगा/ करुँगी!
+
+
+
+
+
+ Prepared By : =$user->first_name.' '.$user->last_name.'['.$user->id.']' ?>
+
+
+
+
+ हस्ताक्षर / अंगूठा निशान
+
+ नाम : _______________________________________________
+
+
+
+ मरीज / मरीज से संबंध : _____________________________
+
+
+
+ पता : _______________________________________________
+
+
+
+
+ फ़ोन नंबर : _________________________________________
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/print_ipd_form4.php b/old_code_ci3/views/IPD2/print_ipd_form4.php
new file mode 100644
index 0000000..7995c33
--- /dev/null
+++ b/old_code_ci3/views/IPD2/print_ipd_form4.php
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+ p_code.':'.$ipd_info[0]->ipd_code .':P-'.date('Y-m-d H:i:s').':C-'.$person_info[0]->p_fname;
+ ?>
+
+
+
+
+General Consent for Cashless Treatment कॅशलेस उपचार हेतु सामान्य सहमति पत्र
+
+
+ ';
+ echo 'Patient Name (मरीज का नाम): '.$person_info[0]->p_fname.'
+ '.$person_info[0]->p_relative.' '.$person_info[0]->p_rname.'
+ Age / Gender (आयु / लिंग): '.$person_info[0]->age .' / '.$person_info[0]->xgender.'
+ IPD / UHID No.(आईपीडी / यूएचआईडी नं.): '.$person_info[0]->p_code.' / '.$ipd_info[0]->ipd_code.'
+ Date of Admission (प्रवेश की तिथि): '.$ipd_info[0]->str_register_date.' / TIME (समय) : '.$ipd_info[0]->reg_time.'
+ Case Type : '.$ipd_info[0]->case_type_s.'
+ Phone No : '.$person_info[0]->mphone1.'
+ ';
+
+ echo '
+ Contact Person Name (परिचारक का नाम) : '.$ipd_info[0]->contact_person_Name.'
+ Relation (परिचारक से संबंध) : '.$ipd_info[0]->relation.'
+ Relative Phone No (परिचारक का फोन नंबर): '.$ipd_info[0]->P_mobile1.'
+ Patient Address (मरीज का पता)
+ '.$person_info[0]->add1.' ,
+ '.$person_info[0]->add2.' ,
+ '.$person_info[0]->city.' ,
+ '.$person_info[0]->state.'
+ ';
+
+ echo '';
+ ?>
+
+
(Declaration by the Patient / Attendant मरीज / परिचारक द्वारा घोषणा )
+
+ I, Mr. / Ms. / Mrs. ______________________________________________________, S/o / D/o / W/o ______________________________________,
+
+resident of ______________________________________, hereby declare and give my consent as follows:
+मैं, श्री / श्रीमती / कु. ______________________________________________________, पुत्र / पुत्री / पत्नी ______________________________________, निवासी
+
+______________________________________, निम्नलिखित घोषणा करता/करती हूँ और अपनी सहमति प्रदान करता/करती हूँ:
+
+
+
+ 1. My treatment is being carried out under the TPA/AYUSHMAN/GOLDEN CARD scheme on a cashless basis, and no money is being taken from me or my attendants by the hospital for treatment, medicines, investigations, or any other charges.
+मेरा उपचार टी.पी.ए./आयुष्मान/गोल्डन कार्ड योजना के अंतर्गत कॅशलेस आधार पर किया जा रहा है, और अस्पताल द्वारा मुझसे या मेरे परिचारक से उपचार, दवाइयाँ, जाँच या अन्य किसी शुल्क के लिए कोई धनराशि नहीं ली जा रही है।
+2. I have been informed that in case the pre-authorization is rejected or the claim is denied during the treatment period, I will be personally responsible for paying the treatment expenses to the hospital.
+मुझे सूचित किया गया है कि यदि प्री-ऑथराइजेशन अस्वीकृत हो जाता है या दावा अस्वीकृत कर दिया जाता है, तो उपचार का व्यय चुकाने की जिम्मेदारी मेरी व्यक्तिगत होगी।
+3. This consent is given voluntarily, after being explained about the benefits, process, and possible liabilities under the scheme, without any pressure or misrepresentation.
+यह सहमति मैं पूरी जानकारी प्राप्त करने के बाद स्वेच्छा से दे रहा/रही हूँ। मुझे योजना के लाभ, प्रक्रिया एवं संभावित दायित्व समझा दिए गए हैं और इस पर कोई दबाव या गलत जानकारी नहीं दी गई है।
+
+
+ Patient / Attendant Details (मरीज / परिचारक का विवरण)
+• Name (नाम): ___________________________________
+• Relation with Patient (मरीज से संबंध): ___________________________________
+• Signature / Thumb Impression (हस्ताक्षर / अंगूठे का निशान): ___________________________
+• Contact Number (संपर्क नंबर): ___________________________________
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/print_payment_receipt_ipd.php b/old_code_ci3/views/IPD2/print_payment_receipt_ipd.php
new file mode 100644
index 0000000..1ba570b
--- /dev/null
+++ b/old_code_ci3/views/IPD2/print_payment_receipt_ipd.php
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ =H_phone_No?>
+
+
+
+
+ To
+
+ =$person_info[0]->p_fname ?>
+ Phone No : =$ipd_master[0]->P_mobile1 ?>
+ Payment Reciept No #=$ipd_payment[0]->payment_id ?>
+ Date : =$ipd_payment[0]->pay_date ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+
+
+
+
+
+ IPD Credit Amount : =$ipd_payment[0]->amount ?>
+
+ Remark :
+
+ =$ipd_payment[0]->remark ?>
+
+
+
+ Mode of Payment : =$ipd_payment[0]->payment_mode_desc ?>
+
+
+
+ Prepared By : =$ipd_payment[0]->prepared_by ?>
+
+
+
+ Signature
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD2/test.php b/old_code_ci3/views/IPD2/test.php
new file mode 100644
index 0000000..a6c75a3
--- /dev/null
+++ b/old_code_ci3/views/IPD2/test.php
@@ -0,0 +1,173 @@
+@extends('app')
+
+@section('content')
+{!! header('Access-Control-Allow-Origin: *'); !!}
+{!! header("content-type: Access-Control-Allow-Methods: GET");!!}
+
+
+
+
+ Project - {!! $project_title !!}
+
+
+
Enter Flat/Room Booking Details
+
+ {!! Form::open(array('route' => 'client.store', 'method' => 'post', 'files' => 'true')) !!}
+ {!! Form::hidden('user_id', Auth::user()->id) !!}
+ {!! Form::hidden('flat_id', $flat_id )!!}
+ {!! Form::hidden('booking_status', $booking_status )!!}
+
Fields with * asteric sign are required
+
+
+
+
+
+
+ Franchise Name
+ {!! Form::text('franchise', Auth::user()->name, array('id'=>'franchise','class' => 'form-control', 'readonly'=>'true', 'placeholder'=> Auth::user()->name ,'value'=>Auth::user()->name)) !!}
+
+
+
+ Agent Name
+ {!! Form::text('agent', Input::old('agent'), array('id'=>'agent','class' => 'form-control')) !!}
+
+
+
+
+
+
+ Project Name
+ {!! Form::text('project_name', $project_title, array('id'=>'project_name','class' => 'form-control', 'placeholder' => $project_title, 'readonly'=>'true', )) !!}
+
+
+
+
+ * Flat / Room Area (only numbers)
+ {!! Form::text('area', Input::old('area'), array('id'=>'area','class' => 'form-control', 'placeholder' => 'Enter Area')) !!}
+ {!! $errors->first('area',':message ') !!}
+
+
+
+
+
+ Estimated Date
+ {!! Form::text('estimated_date', Input::old('estimated_date'), array('id'=>'estimated_date','class' => 'form-control', 'placeholder' => 'Select Date')) !!}
+
+
+
+
+
+
+
+ Customer Code
+ {!! Form::text('cust_code', Input::old('cust_code'), array('id'=>'cust_code','class' => 'form-control', 'placeholder' => 'Enter Customer Code')) !!}
+
+
+
+
+ Customer Status
+ {!! Form::text('cust_status', Input::old('cust_status'), array('id'=>'cust_status','class' => 'form-control', 'readonly')) !!}
+
+
+
+
+
+
+ * Customer Name
+ {!! Form::text('customers_name', Input::old('customers_name'), array('id'=>'customers_name','class' => 'form-control', 'placeholder' => 'Enter Customer Name')) !!}
+ {!! $errors->first('customers_name',':message ') !!}
+
+
+
+
+
+
+
+ * Phone Number
+ {!! Form::text('phone', Input::old('phone'), array('id'=>'phone','class' => 'form-control', 'placeholder' => 'Enter Phone Number')) !!}
+ {!! $errors->first('phone',':message ') !!}
+
+
+
+
+ * Email Address
+ {!! Form::text('email', Input::old('email'), array('id'=>'email','class' => 'form-control', 'placeholder' => 'Enter Email Address')) !!}
+ {!! $errors->first('email',':message ') !!}
+
+
+
+
+ * Address
+ {!! Form::textarea('address', Input::old('address'),array('id'=>'address','class' => 'form-control','rows'=>'5','placeholder'=>'Address')) !!}
+ {!! $errors->first('address',':message ') !!}
+
+
+
+
+
+
+
+ Remark
+ {!! Form::textarea('description', Input::old('description'),array('class' => 'form-control','rows'=>'5')) !!}
+
+
+
+
+
+
+ {!! Form::checkbox('terms_conditions', '1', Input::old('terms_conditions'), array()) !!} * I authorize Krishna Buildcon to contact me.
+
+ {!! $errors->first('terms_conditions',':message ') !!}
+
+
+
+ {!! Form::close() !!}
+
+
+
+
+
+
+
+
+@endsection
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/EJA_discharge_template.php b/old_code_ci3/views/IPD_Discharge/EJA_discharge_template.php
new file mode 100644
index 0000000..dde4976
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/EJA_discharge_template.php
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+ = H_Name ?>
+ Near Mukhani Chauraha, Haldwani -263139(Nainital) U.K.
+ Phone. No. 05946-252627 , 05946-282930 / E Mail : ejahospital22@gmail.com
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ = $report_foot ?>
+
+
+
+= $complete_report ?>
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/EJA_discharge_template_html.php b/old_code_ci3/views/IPD_Discharge/EJA_discharge_template_html.php
new file mode 100644
index 0000000..0a879ee
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/EJA_discharge_template_html.php
@@ -0,0 +1,158 @@
+
+
= $h1_head ?>
+
+
Department : = ucwords($depart_name) ?>
+
+
+
+ Patient Information
+
+
+
+
+
+ Name of Patient
+ = ucwords($ipd_master[0]->p_fname) ?>
+
+
+ Age & Gender
+ = $ipd_master[0]->str_age . ' / ' . $ipd_master[0]->xgender ?>
+
+
+ Guardian
+ = ucwords($ipd_master[0]->p_relative) . ' ' . ucwords($ipd_master[0]->p_rname) ?>
+
+
+ Phone No.
+ = $ipd_master[0]->mphone1 ?>
+
+
+ Address
+ = ucwords($ipd_master[0]->add1) . ' ' . ucwords($ipd_master[0]->add2) . ' ' . ucwords($ipd_master[0]->city).
+ ' ' . ucwords($ipd_master[0]->district) .' '. ucwords($ipd_master[0]->state) ?>
+
+
+
+
+
+
+ UHID
+ = $ipd_master[0]->p_code ?>
+
+
+ IPD No.
+ = $ipd_master[0]->ipd_code ?>
+
+
+ Admission
+ = $ipd_master[0]->str_register_date . ' ' . $Reg_time ?>
+
+
+ Discharge
+ = $ipd_master[0]->str_discharge_date . ' ' . $Discharge_time ?>
+
+
+ Org. Name
+ = $ipd_master[0]->admit_type ?>
+
+
+ Department
+ = ucwords($depart_name) ?>
+
+
+
+
+
+';
+ echo $doc_list_main_sign;
+}
+?>
+
+
+ = $FinalDiagnosis ?>
+
+
+ = $Surgery ?>
+
+
+ = $Procedure ?>
+
+
+ = $isdelivery ?>
+
+
+ = $personal_history ?>
+
+
+ = $discharge_complaint ?>
+
+
+ = $discharge_general_exam ?>
+
+
+ = $lab_test_content ?>
+
+
+ = $Course_in_the_hospital ?>
+
+
+ = $discharge_exam_on_discharge ?>
+
+
+ = $Discharge_Medications ?>
+
+
+
= $Dietary ?>
+
+
+
= $Discharge_Instructions ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/SVH_discharge_template.php b/old_code_ci3/views/IPD_Discharge/SVH_discharge_template.php
new file mode 100644
index 0000000..b412911
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/SVH_discharge_template.php
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+ = H_Name ?>
+ Near khatu Shyam Mandir Kathgodam Bypass Road Mukhani Haldwani (Nainital) U.K 263139
+ Phone. No. 05946-310459 , +91 89795 65771
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ = $report_foot ?>
+
+
+
+= $complete_report ?>
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/SVH_discharge_template_html.php b/old_code_ci3/views/IPD_Discharge/SVH_discharge_template_html.php
new file mode 100644
index 0000000..0a879ee
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/SVH_discharge_template_html.php
@@ -0,0 +1,158 @@
+
+
= $h1_head ?>
+
+
Department : = ucwords($depart_name) ?>
+
+
+
+ Patient Information
+
+
+
+
+
+ Name of Patient
+ = ucwords($ipd_master[0]->p_fname) ?>
+
+
+ Age & Gender
+ = $ipd_master[0]->str_age . ' / ' . $ipd_master[0]->xgender ?>
+
+
+ Guardian
+ = ucwords($ipd_master[0]->p_relative) . ' ' . ucwords($ipd_master[0]->p_rname) ?>
+
+
+ Phone No.
+ = $ipd_master[0]->mphone1 ?>
+
+
+ Address
+ = ucwords($ipd_master[0]->add1) . ' ' . ucwords($ipd_master[0]->add2) . ' ' . ucwords($ipd_master[0]->city).
+ ' ' . ucwords($ipd_master[0]->district) .' '. ucwords($ipd_master[0]->state) ?>
+
+
+
+
+
+
+ UHID
+ = $ipd_master[0]->p_code ?>
+
+
+ IPD No.
+ = $ipd_master[0]->ipd_code ?>
+
+
+ Admission
+ = $ipd_master[0]->str_register_date . ' ' . $Reg_time ?>
+
+
+ Discharge
+ = $ipd_master[0]->str_discharge_date . ' ' . $Discharge_time ?>
+
+
+ Org. Name
+ = $ipd_master[0]->admit_type ?>
+
+
+ Department
+ = ucwords($depart_name) ?>
+
+
+
+
+
+';
+ echo $doc_list_main_sign;
+}
+?>
+
+
+ = $FinalDiagnosis ?>
+
+
+ = $Surgery ?>
+
+
+ = $Procedure ?>
+
+
+ = $isdelivery ?>
+
+
+ = $personal_history ?>
+
+
+ = $discharge_complaint ?>
+
+
+ = $discharge_general_exam ?>
+
+
+ = $lab_test_content ?>
+
+
+ = $Course_in_the_hospital ?>
+
+
+ = $discharge_exam_on_discharge ?>
+
+
+ = $Discharge_Medications ?>
+
+
+
= $Dietary ?>
+
+
+
= $Discharge_Instructions ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/chamunda_discharge_template.php b/old_code_ci3/views/IPD_Discharge/chamunda_discharge_template.php
new file mode 100644
index 0000000..bffadf6
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/chamunda_discharge_template.php
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+
+
+ = H_Name ?>
+ An ISO Certified 9001 : 2015, NABH (Fully Accredited) Hospital
+ Ramnagar Road, KASHIPUR - 244713 (U.S.Nagar) Uttarakhand
+ Mob. No. 9411166999 / E Mail : chamunda_surgical@rediffmail.com
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ = $report_foot ?>
+
+
+
+= $complete_report ?>
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/chamunda_discharge_template_html.php b/old_code_ci3/views/IPD_Discharge/chamunda_discharge_template_html.php
new file mode 100644
index 0000000..b84366b
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/chamunda_discharge_template_html.php
@@ -0,0 +1,129 @@
+
+
= $h1_head ?>
+
+
+
+ Name
+ = ucwords($ipd_master[0]->p_fname) ?>
+ UHID
+ = $ipd_master[0]->p_code ?>
+
+
+ Age & Gender
+ = $ipd_master[0]->str_age . ' / ' . $ipd_master[0]->xgender ?>
+ IPD No.
+ = $ipd_master[0]->ipd_code ?>
+
+
+ Guardian
+ = ucwords($ipd_master[0]->p_relative) . ' ' . ucwords($ipd_master[0]->p_rname) ?>
+ Admission
+ = $ipd_master[0]->str_register_date . ' ' . $Reg_time ?>
+
+
+ Phone No.
+ = $ipd_master[0]->mphone1 ?>
+ Discharge
+ = $ipd_master[0]->str_discharge_date . ' ' . $Discharge_time ?>
+
+
+ Address
+ = ucwords($ipd_master[0]->add1).','.ucwords($ipd_master[0]->add2).','.ucwords($ipd_master[0]->city) ?>
+ Org. Name
+ = $ipd_master[0]->admit_type ?>
+
+
+ Department
+ = ucwords($depart_name) ?>
+
+
+
+
+
+
+=$FinalDiagnosis?>
+
+
+=$Surgery?>
+
+
+= $Procedure ?>
+
+
+= $isdelivery ?>
+
+
+= $personal_history ?>
+
+
+= $discharge_complaint ?>
+
+
+= $discharge_general_exam ?>
+
+
+= $lab_test_content ?>
+
+
+= $Course_in_the_hospital ?>
+
+
+= $discharge_exam_on_discharge ?>
+
+
+= $Discharge_Medications ?>
+
+
+
= $diet_advice ?>
+
+
+
= $Discharge_Instructions ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/ipd_discharge_edit.php b/old_code_ci3/views/IPD_Discharge/ipd_discharge_edit.php
new file mode 100644
index 0000000..3701138
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/ipd_discharge_edit.php
@@ -0,0 +1,2361 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Department
+
+
+ iId, $ipd_master[0]->dept_id) ?>>
+ = $row->vName ?>
+
+
+
+
+
+
+
+
+
+
+
+ Patient Status
+
+
+ id, $ipd_master[0]->discarge_patient_status) ?>>
+ = $row->status_desc ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ xgender == "Female") { ?>
+
+
+
+
+
+
+
+
+
+
+ Sex of baby 1:
+
+ delivery_sex_of_baby) ?>>None
+
+ delivery_sex_of_baby) ?>>Girl
+
+ delivery_sex_of_baby) ?>>Boy
+
+
+
+
+
+
+ Sex of baby 2:
+
+ delivery_sex_of_baby2) ?>>None
+
+ delivery_sex_of_baby2) ?>>
+ Girl
+ delivery_sex_of_baby2) ?>>Boy
+
+
+
+
+
+
+ Sex of baby 3:
+
+ delivery_sex_of_baby) ?>>None
+
+ delivery_sex_of_baby3) ?>>
+ Girl
+ delivery_sex_of_baby3) ?>>Boy
+
+
+
+
+
+
+ Save Data
+ Update Delivery Record
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
General Examination
+ 'form', 'class' => 'form2')); ?>
+
+
+
+ 'form', 'class' => 'form2')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ = $row->rdata ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create IPD Discharge
+ Edit
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/ipd_discharge_edit1.php b/old_code_ci3/views/IPD_Discharge/ipd_discharge_edit1.php
new file mode 100644
index 0000000..ba8d1c8
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/ipd_discharge_edit1.php
@@ -0,0 +1,1558 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Patient Status
+
+
+ id,$ipd_master[0]->discarge_patient_status)?> >=$row->status_desc?>
+
+
+
+
+
+
+ Update Discharge Status
+ Update Discharge Request
+
+
+
+
+
+
Surgery if any
+
+
+
+
+
+
+
+ Save Data
+ Update Surgery Record
+
+
+
+
+ xgender=="Female") { ?>
+
+
+
If Delivered, date and time of delivery
+
+
+
+
+
+
+
+ Sex of baby:
+
+ delivery_sex_of_baby)?> >None
+ delivery_sex_of_baby)?> >Girl
+ delivery_sex_of_baby)?> >Boy
+
+
+
+
+
+ Save Data
+ Update Delivery Record
+
+
+
+
+
+
+
+
+
+
+
+
General Examination
+ 'form','class'=>'form2')); ?>
+
+
+
+
Other Examination
+ 'form','class'=>'form2')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =$row->rdata?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Create IPD Discharge
+ Edit
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD_Discharge/ipd_discharge_preview.php b/old_code_ci3/views/IPD_Discharge/ipd_discharge_preview.php
new file mode 100644
index 0000000..2bf88df
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/ipd_discharge_preview.php
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+ 0){
+ //$content=$ipd_discharge[0]->content;
+ }
+ ?>
+ =$content?>
+
+
+
+
+
+
+
+ Recreate IPD
+ Make File and Print on Letter Head
+ Make File and Print On Plain Paper
+ New Print
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/ipd_discharge_print.php b/old_code_ci3/views/IPD_Discharge/ipd_discharge_print.php
new file mode 100644
index 0000000..60a8017
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/ipd_discharge_print.php
@@ -0,0 +1,342 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+ p_code.':'.$invoice_master[0]->invoice_code .':P-'.date('Y-m-d H:i:s').':C-'.$invoice_master[0]->confirm_invoice.':TAmt-'.$invoice_master[0]->net_amount;
+ ?>
+
+
+
+
+ Invoice No. :=$invoice_master[0]->invoice_code?>
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+ p_code.':'.$invoice_master[0]->invoice_code .':P-'.date('Y-m-d H:i:s').':C-'.$invoice_master[0]->confirm_invoice.':TAmt-'.$invoice_master[0]->net_amount;
+ ?>
+
+
+
+
+ Invoice No. :=$invoice_master[0]->invoice_code?> [LAB COPY]
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$invoice_master[0]->invoice_code?> / UHID:=$patient_master[0]->p_code?> /Name : =strtoupper($patient_master[0]->p_fname)?>
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$invoice_master[0]->invoice_code?> / UHID:=$patient_master[0]->p_code?> /Name : =strtoupper($patient_master[0]->p_fname)?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Bill To
+ UHID : =$patient_master[0]->p_code?>
+ Name : =$patient_master[0]->title?> =strtoupper($patient_master[0]->p_fname)?>
+ =$patient_master[0]->p_relative?> =strtoupper($patient_master[0]->p_rname)?>
+ Sex : =$patient_master[0]->xgender?> =$patient_master[0]->age?> P.No. :=$patient_master[0]->mphone1?>
+
+
+ Address : =$patient_master[0]->add1.','.$patient_master[0]->city?>
+ Date : =MysqlDate_to_str($invoice_master[0]->inv_date)?>
+ Refer By : Dr.=$invoice_master[0]->refer_by_other?>
+
+
+
+
+
+
+ #
+ Charge Name
+ Org.Code
+ Rate
+ Qty
+ Amt.
+
+ ';
+ $content.= ' '.$srno.' ';
+ $content.= ' '.$row->item_name.' ';
+ $content.= ' '.$row->org_code.' ';
+ $content.= ' '.$row->item_rate.' ';
+ $content.= ' '.$row->item_qty.' ';
+ $content.= ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ $content.= '';
+
+ }
+ echo $content;
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal?>
+
+ discount_amount>0) {
+ $content.='
+ #
+ Discount
+ '.$invoice_master[0]->discount_desc.'
+
+
+ -'.$invoice_master[0]->discount_amount.'
+
+ ';
+ }
+ echo $content;
+ ?>
+
+
+
+
+
+ ipd_id<1) {
+ $content='
+ Amount received : '.$invoice_master[0]->payment_part_received.'
+ / Balance Amount : '.$invoice_master[0]->payment_part_balance.'
+ / Net Amount : '.$invoice_master[0]->net_amount.
+ '
';
+ }
+ echo $content;
+ ?>
+
+
+
+
+ Amount in Words : Rs. =number_to_word($invoice_master[0]->net_amount)?>
+ Prepared By : =$invoice_master[0]->prepared_by?>
+
+
+
+
+ =$invoice_master[0]->Invoice_status_str?>
+ payment_mode>2) { ?>
+ Payment Details [=$invoice_master[0]->Payment_type_str ?>]
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+
+
+ Signature
+ Date : =$invoice_master[0]->confirm_invoice_datetime?>
+
+
+
+
+
+
+
+
+
+
+ Bill To
+ UHID : =$patient_master[0]->p_code?>
+ Name : =$patient_master[0]->title?> =strtoupper($patient_master[0]->p_fname)?>
+ =$patient_master[0]->p_relative?> =strtoupper($patient_master[0]->p_rname)?>
+ Sex : =$patient_master[0]->xgender?> =$patient_master[0]->age?> P.No. :=$patient_master[0]->mphone1?>
+
+
+ Address : =$patient_master[0]->add1.','.$patient_master[0]->city?>
+ Date : =MysqlDate_to_str($invoice_master[0]->inv_date)?>
+ Refer By : Dr.=$invoice_master[0]->refer_by_other?>
+
+
+
+
+
+
+ #
+ Charge Name
+ Org.Code
+ Rate
+ Qty
+ Amt.
+
+ ';
+ $content.= ' '.$srno.' ';
+ $content.= ' '.$row->item_name.' ';
+ $content.= ' '.$row->org_code.' ';
+ $content.= ' '.$row->item_rate.' ';
+ $content.= ' '.$row->item_qty.' ';
+ $content.= ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ $content.= '';
+
+
+ }
+ echo $content;
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal?>
+
+ discount_amount>0) {
+ $content.='
+ #
+ Deduction
+ '.$invoice_master[0]->discount_desc.'
+
+
+ -'.$invoice_master[0]->discount_amount.'
+
+ ';
+ }
+ echo $content;
+ ?>
+
+
+
+
+
+ ipd_id<1) {
+ $content='
+ Amount received : '.$invoice_master[0]->payment_part_received.'
+ / Balance Amount : '.$invoice_master[0]->payment_part_balance.'
+ / Net Amount : '.$invoice_master[0]->net_amount.
+ '
';
+ }
+ echo $content;
+ ?>
+
+
+
+
+ =$invoice_master[0]->Invoice_status_str?>
+ payment_mode>2) { ?>
+ Payment Details [=$invoice_master[0]->Payment_type_str ?>]
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+
+ Amount in Words : Rs. =number_to_word($invoice_master[0]->net_amount)?>
+ Prepared By : =$invoice_master[0]->prepared_by?>
+
+
+
+
+ Signature
+ Date : =$invoice_master[0]->confirm_invoice_datetime?>
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD_Discharge/ipd_discharge_print_format.php b/old_code_ci3/views/IPD_Discharge/ipd_discharge_print_format.php
new file mode 100644
index 0000000..f295643
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/ipd_discharge_print_format.php
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+ = H_Name ?>
+ = H_address_1 ?> = H_address_2 ?>
+ Phone: ' . H_phone_No;
+ }
+ ?>
+ Email: ' . H_Email;
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ = $report_foot ?>
+
+
+
+= $complete_report ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/ipd_prescription.php b/old_code_ci3/views/IPD_Discharge/ipd_prescription.php
new file mode 100644
index 0000000..e3c0944
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/ipd_prescription.php
@@ -0,0 +1,30 @@
+
+
+0) { ?>
+
+ Type
+ Prescribed
+ Dosage
+ Remarks
+
+
+
+
+
+
+ =$row->med_type?>
+ =$row->med_name?>
+ =$row->dose_shed?>
+ =$row->dose_when?>
+ =$row->dose_frequency?> =$row->dose_where?>
+ =$row->qty?>=$row->no_of_days?>=$row->remark?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/ipd_procedure.php b/old_code_ci3/views/IPD_Discharge/ipd_procedure.php
new file mode 100644
index 0000000..f6df92a
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/ipd_procedure.php
@@ -0,0 +1,42 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/ipd_surgery.php b/old_code_ci3/views/IPD_Discharge/ipd_surgery.php
new file mode 100644
index 0000000..0af25e5
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/ipd_surgery.php
@@ -0,0 +1,42 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/main.php b/old_code_ci3/views/IPD_Discharge/main.php
new file mode 100644
index 0000000..2806686
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/main.php
@@ -0,0 +1,25 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/radiant_discharge_template.php b/old_code_ci3/views/IPD_Discharge/radiant_discharge_template.php
new file mode 100644
index 0000000..3be330d
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/radiant_discharge_template.php
@@ -0,0 +1,43 @@
+
+
+
+
+
+
+
+
+
+
+ = H_Name ?>
+ = H_address_1 ?> = H_address_2 ?>
+ Phone. No. =H_phone_No?> / E Mail : =H_Email?>
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ = $report_foot ?>
+
+
+
+= $complete_report ?>
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/radiant_discharge_template_html.php b/old_code_ci3/views/IPD_Discharge/radiant_discharge_template_html.php
new file mode 100644
index 0000000..0a879ee
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/radiant_discharge_template_html.php
@@ -0,0 +1,158 @@
+
+
= $h1_head ?>
+
+
Department : = ucwords($depart_name) ?>
+
+
+
+ Patient Information
+
+
+
+
+
+ Name of Patient
+ = ucwords($ipd_master[0]->p_fname) ?>
+
+
+ Age & Gender
+ = $ipd_master[0]->str_age . ' / ' . $ipd_master[0]->xgender ?>
+
+
+ Guardian
+ = ucwords($ipd_master[0]->p_relative) . ' ' . ucwords($ipd_master[0]->p_rname) ?>
+
+
+ Phone No.
+ = $ipd_master[0]->mphone1 ?>
+
+
+ Address
+ = ucwords($ipd_master[0]->add1) . ' ' . ucwords($ipd_master[0]->add2) . ' ' . ucwords($ipd_master[0]->city).
+ ' ' . ucwords($ipd_master[0]->district) .' '. ucwords($ipd_master[0]->state) ?>
+
+
+
+
+
+
+ UHID
+ = $ipd_master[0]->p_code ?>
+
+
+ IPD No.
+ = $ipd_master[0]->ipd_code ?>
+
+
+ Admission
+ = $ipd_master[0]->str_register_date . ' ' . $Reg_time ?>
+
+
+ Discharge
+ = $ipd_master[0]->str_discharge_date . ' ' . $Discharge_time ?>
+
+
+ Org. Name
+ = $ipd_master[0]->admit_type ?>
+
+
+ Department
+ = ucwords($depart_name) ?>
+
+
+
+
+
+';
+ echo $doc_list_main_sign;
+}
+?>
+
+
+ = $FinalDiagnosis ?>
+
+
+ = $Surgery ?>
+
+
+ = $Procedure ?>
+
+
+ = $isdelivery ?>
+
+
+ = $personal_history ?>
+
+
+ = $discharge_complaint ?>
+
+
+ = $discharge_general_exam ?>
+
+
+ = $lab_test_content ?>
+
+
+ = $Course_in_the_hospital ?>
+
+
+ = $discharge_exam_on_discharge ?>
+
+
+ = $Discharge_Medications ?>
+
+
+
= $Dietary ?>
+
+
+
= $Discharge_Instructions ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Discharge/search_ipd_result.php b/old_code_ci3/views/IPD_Discharge/search_ipd_result.php
new file mode 100644
index 0000000..8cf7204
--- /dev/null
+++ b/old_code_ci3/views/IPD_Discharge/search_ipd_result.php
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+ IPD Code
+ Patient Code
+ Name {Relative Name}
+ Doctor Name
+ Insurance
+ Action
+
+
+
+
+
+ =$ipd_master[$i]->ipd_code ?>
+ =$ipd_master[$i]->p_code ?>
+ =$ipd_master[$i]->p_fname ?> {=$ipd_master[$i]->p_rname ?>}
+ =$ipd_master[$i]->doc_name ?>
+ =$ipd_master[$i]->admit_type ?>
+ Select
+
+
+
+
+
+ IPD Code
+ Patient Code
+ Name {Relative Name}
+ Doctor Name
+ Insurance
+ Action
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Format/form_admission_histroy_phusical_assessment.php b/old_code_ci3/views/IPD_Format/form_admission_histroy_phusical_assessment.php
new file mode 100644
index 0000000..0383c7b
--- /dev/null
+++ b/old_code_ci3/views/IPD_Format/form_admission_histroy_phusical_assessment.php
@@ -0,0 +1,343 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+ IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> /Name : =strtoupper($person_info[0]->p_fname)?>
+
+
+ ipd_code;
+ $bar_content=$ipd_info[0]->id;
+ ?>
+
+ Page : {PAGENO}/{nbpg}
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> /Name : =strtoupper($person_info[0]->p_fname)?>
+
+
+
+
ADMISSION HISTORY AND PHYSICAL ASSESSMENT FORM
+
Patient Name : =strtoupper($person_info[0]->p_fname)?> Age : =$person_info[0]->age?> Gender : =$person_info[0]->xgender?> [ ]MLC / [ ]Non MLC
+
+
UHID : =$person_info[0]->p_code?> IPD No. : =$ipd_info[0]->ipd_code?> Date of Admission : =$ipd_info[0]->str_register_date?>
+
+
Diagnosis :
+
+
Time of Patient Arrival : ______________________ Time of Doctor's Assessment : ________________________
+
+
Consciousness : [ ]Awake / [ ]Alert / [ ]In pain [ ]Response to verbalcommands / [ ]Unresponsive Pain
+
+
GCS : E___ V___ M___ Airway & Breathing : [ ]Clear / [ ]Noisy Breathing / [ ]Stridor / [ ]Obstruction
+
+
R R : _____________ Accessory Muscle: + / -
+
+
CPR / Code Blue : ________________ Attended by S/N : ______________________
+
+
Allergic To :
+
+Direct to Department : ____________________________ Consultant In charge : ____________________________
+
+
Present Complaints :
+
+
+
+
+
+
Last Urine Passed : ______________
+
+
Past Medical History :
+
+
+
+
+ Diabetes / Matabolic BS
+
+ Jaundice / CLD
+
+
+
+ Hypertension / IHD
+
+ Osteoarthritis
+
+
+
+ Asthma / COPD / PB
+
+ Tuberculosis
+
+
+
+ Others :
+
+
+
+
+
+
+
+
Drug History :
+
+
+
+
+
+
Past Surgical History :
+
+Current Treatment:
+
+
+
+
Personal History
+
+
+
+
+ Smoking
+ [ ]Yes / [ ]No
+ Since :
+ Per Day
+
+
+ Alcohol
+ [ ]Yes / [ ]No
+ Since :
+ (frequency)
+
+
+ Drugs
+ [ ]Yes / [ ]No
+ Since :
+ (frequency)
+
+
+ Chewing Tobacco
+ [ ]Yes / [ ]No
+ Since :
+ (frequency)
+
+
+ Diet
+ [ ]Veg / [ ]Non Veg
+ Sleep Pattern : [ ]Normal / [ ]Inadequate / [ ]Adequate
+
+
+ Bowel Habits
+ [ ]Regular / [ ]Irregular
+
+
+ Bladder Habits
+ [ ]Normal / [ ]Regular / [ ]Irregular
+
+
+ Occupation
+
+
+
+
+
+
For Female Patients :
+
+
Age of Menarchy ______________ Menopause : [ ]Yes/[ ]No Age of Menopause _____________________
+
+
Manstrual History [ ]Reuglar / [ ]Irregular / [ ]Dysmenorrhea / [ ]Vaginal discharge
+
+
Pregnancy [ ] Yes / [ ] No if yes Gravids ________________ LMP ______________________
+
+
[ ]Abortion [ ]Spontaneous Threatened [ ]Missed [ ]Other specify ______________
+
+
Others :
+
+
+
Family History
+
+
+
+
+
+ YES
+ NO
+
+
+ YES
+ NO
+
+
+ Hypertension / IHB / BYS Dyslipidema
+
+
+
+ Arthritis / Gout
+
+
+
+
+ Diabetes / Thyroid DS
+
+
+
+ Cancer
+
+
+
+
+ Tuberculosis / Asthma / COPD
+
+
+
+ Any Othe
+
+
+
+
+ Epilepsy / Mental illness
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Declaration by the Patient / Relatives Accompany person
+
+
I hereby declare that the facts recorded above are based on my own narration and accurate to the best of my knowledge.
+
+
Name of Patient / Relative / Accompanying Person ______________________________________________
+
+
+Relationship ____________________________ Singnature ______________________________
+
+
Date : _______________________ Time : ___________________
+
+
+General Examination
+
+Vital Sign
+
+RBS : ______ Temp.: ______ Pulse: ______ /min RR: ______ /min BP: ______ /mm hz SPO2: ______ %
+
+BP : Standing ___________ mm of Hg Sitting ___________mm of Hg Supine ___________mm of Hg
+
+P______R. Rythm _________ Chorecter__________ Palpabl/Non Palble
+
+
+Pain : [ ]Yes / [ ]No
+
+Score : [ ] (0-No Pain -----------------5 Moderate Pain --------------------- 10 Worst Pain )
+
+Location
+
+
+General Appearance : [ ]Normal / [ ]Pallor / [ ]Icterus / [ ]Cyanosis / [ ]Edema / [ ]Clubbing / [ ]J.V.P.
+
+General Condition : [ ]Poor / [ ]Fair / [ ]Semi Conscious / [ ]Delirious / [ ]Drowsy / [ ]Unconscious
+
+
+
+Systemic Examination
+
+1. ENT : [ ] NAD / [ ] Ear ache / [ ] Ear discharge / [ ] Tinnitus / [ ] Vertigo / [ ] Voice Change
+
+2. EYE : [ ] NAD / [ ] Redness / [ ] Discharge / [ ] Pain / [ ] Vision / [ ] Conjunctival hemorrhage
+
+Other : ________________________________________________________________________________
+
+3. CARDIOVASCULAR SYSTEM : [ ] NAD / [ ] Chest Pain / [ ] Hypertension / [ ] Syncope / [ ] Palpitation
+
+Apex beat : [ ] S1 / [ ] S2 / [ ] S3 / [ ] S4 / [ ] Gallop / [ ] Thrill / [ ] Bruits
+
+
+
+4. RESPIRATORY SYSTEM : [ ] NAD / [ ] Cough / [ ] Breathlessness / [ ] Hemoptysis
+
+Shape of Chest : [ ] Normal / [ ] Barrel / [ ] Pigeon / ______________________________
+
+Breath Sound : [ ] Rales / [ ] Crackles / [ ] Inspiratory Wheeze / [ ] Expiratory Wheeze / [ ] Crepts
+
+Specify other : ________________________________________________________________________
+
+
+
+5. ABDOMEN : [ ] NAD / [ ] Hematuria / [ ] Diarrhoea / [ ] Constipation / [ ] Vomiting / [ ] Bleeding P/R / [ ] Malena
+
+Others : ______________________________________________________________________________
+
+
+
+6. GENITOURINARY SYSTEM: [ ] NAD / [ ] Hematuria / [ ] Dysuria / [ ] Nocturiaa / [ ] Bladder distension / [ ] H/O Renal distance
+
+7. HEMATOLOGICAL SYSTEM: [ ] NAD / [ ] Anemia / [ ] Chemotherapy / [ ] Blood transfusice /[ ] Thalassaemia /[ ] Sickle cell disease
+
+Other ________________________________________________________________
+
+
+
+8. INTEGUMENTARY SYSTEM: [ ] NAD / [ ] Dry / [ ] Well hydrated / [ ] Rash / [ ] Itching / [ ] Discoloration /
+
+[ ] Breast Changes / [ ] Old surgical scars /
+
+[ ] Specify skin disorder present __________________________
+
+9. MUSCULOSKELETAL SYSTEM: [ ] NAD / [ ] Weakness / [ ] Numness / [ ] Burning Pain / [ ] Claudication / [ ] Rest pain in legs
+
+Upper Extrernities _________________________________ Lower Extremities__________________________________________
+
+Spine Scoliosis / Kyphosis / Lordosis Tenderness Others ____________________________
+
+
+
+10. NEUROLOGICAL ASSESSMENT: [ ] NAD / [ ] Alert / [ ] Oriented / [ ] Slurring of speech / [ ] Tremors / [ ] Confused
+
+Movement co ordinated [ ] YES / [ ] NO
+
+Gait ___________________ Reflexes ________________________ Tremors_________________________
+
+Other _____________________________________________________________________________________
+
+
+PROVISIONAL DIAGNOSIS
+
+
+
+
+
+PLAN OF CARE DURING HOSPITALIZATION
diff --git a/old_code_ci3/views/IPD_Format/form_fluid_in_out.php b/old_code_ci3/views/IPD_Format/form_fluid_in_out.php
new file mode 100644
index 0000000..6783f27
--- /dev/null
+++ b/old_code_ci3/views/IPD_Format/form_fluid_in_out.php
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+ ipd_code;
+ $bar_content=$ipd_info[0]->id;
+ ?>
+
+
+
+
+
+
+
+
+
+
+ IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> /Name : =strtoupper($person_info[0]->p_fname)?> / Gender : =$person_info[0]->xgender?> / Age : =$person_info[0]->age?>
+
+
+
+ORAL / Enteral Intake & Output Chart
+Name : =strtoupper($person_info[0]->p_fname)?> / IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> / Gender : =$person_info[0]->xgender?> / Age : =$person_info[0]->age?>
+
+
+
+
+ SR.No.
+ Date
+ Time
+ Description
+ Vol.
+ Total
+ Urine
+ Stool
+ Other
+ Total
+
+
+
+ =$i?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD_Format/form_progress_notes.php b/old_code_ci3/views/IPD_Format/form_progress_notes.php
new file mode 100644
index 0000000..3e1937d
--- /dev/null
+++ b/old_code_ci3/views/IPD_Format/form_progress_notes.php
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+ ipd_code;
+ $bar_content=$ipd_info[0]->id;
+ ?>
+
+
+
+
+
+
+
+
+
+
+ IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> /Name : =strtoupper($person_info[0]->p_fname)?> / Gender : =$person_info[0]->xgender?> / Age : =$person_info[0]->age?>
+
+
+
+PROGRESS NOTES AND DOCTOR'S ORDER
+Name : =strtoupper($person_info[0]->p_fname)?> / IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> / Gender : =$person_info[0]->xgender?> / Age : =$person_info[0]->age?>
+
+
+
+
+ DATE
+ PROGRESS NOTES AND DOCTOR'S ORDER
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD_Format/form_treatment_chart.php b/old_code_ci3/views/IPD_Format/form_treatment_chart.php
new file mode 100644
index 0000000..074b04a
--- /dev/null
+++ b/old_code_ci3/views/IPD_Format/form_treatment_chart.php
@@ -0,0 +1,281 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+ ipd_code;
+ $bar_content=$ipd_info[0]->id;
+ ?>
+
+
+
+
+
+
+
+
+
+
+ IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> /Name : =strtoupper($person_info[0]->p_fname)?> / Gender : =$person_info[0]->xgender?> / Age : =$person_info[0]->age?>
+
+
+
+TREATMENT CHART
+Name : =strtoupper($person_info[0]->p_fname)?> / IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> / Gender : =$person_info[0]->xgender?> / Age : =$person_info[0]->age?>
+
+
+
+
+ Date
+ Time
+ TREATMENT
+ DOSE
+ SIGN.
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD_Format/form_vitals_chart.php b/old_code_ci3/views/IPD_Format/form_vitals_chart.php
new file mode 100644
index 0000000..8ef31cf
--- /dev/null
+++ b/old_code_ci3/views/IPD_Format/form_vitals_chart.php
@@ -0,0 +1,80 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+ ipd_code;
+ $bar_content=$ipd_info[0]->id;
+ ?>
+
+
+
+
+
+
+
+
+
+
+ IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> /Name : =strtoupper($person_info[0]->p_fname)?> / Gender : =$person_info[0]->xgender?> / Age : =$person_info[0]->age?>
+
+
+
+VITALS CHART
+Name : =strtoupper($person_info[0]->p_fname)?> / IPD No.:=$ipd_info[0]->ipd_code?> / UHID:=$person_info[0]->p_code?> / Gender : =$person_info[0]->xgender?> / Age : =$person_info[0]->age?>
+
+
+
+
+ SR.No.
+ Date
+ Time
+ P. R.
+ B.P.
+ SPO2
+ TEMP.
+ RESP. RATE
+ R.B.S
+ SIGN.
+
+
+
+ =$i?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/IPD_Format/ipd_sticker_print.php b/old_code_ci3/views/IPD_Format/ipd_sticker_print.php
new file mode 100644
index 0000000..c3b2231
--- /dev/null
+++ b/old_code_ci3/views/IPD_Format/ipd_sticker_print.php
@@ -0,0 +1,273 @@
+
+ 0) {
+ $Insurance = 'Insurance : ' . $case_master[0]->insurance_company_name;
+} else {
+ $Insurance = 'Insurance : CASH / Direct';
+}
+
+$srno = 1;
+$ipd_doc_list_show = '';
+foreach ($ipd_doc_list as $row) {
+ $ipd_doc_list_show .= ' Dr. ' . $row->p_fname . ' ';
+ $srno = $srno + 1;
+}
+?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Format/ipd_sticker_print_2.php b/old_code_ci3/views/IPD_Format/ipd_sticker_print_2.php
new file mode 100644
index 0000000..21c4e43
--- /dev/null
+++ b/old_code_ci3/views/IPD_Format/ipd_sticker_print_2.php
@@ -0,0 +1,379 @@
+
+0){
+ $Insurance= 'Insurance : '.$case_master[0]->insurance_company_name;
+ }else{
+ $Insurance= 'Insurance : CASH / Direct';
+ }
+
+ $srno=1;
+ $ipd_doc_list_show='';
+ foreach($ipd_doc_list as $row)
+ {
+ $ipd_doc_list_show.= ' Dr. '.$row->p_fname.' ';
+ $srno=$srno+1;
+ }
+?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Format/ipd_sticker_print_3.php b/old_code_ci3/views/IPD_Format/ipd_sticker_print_3.php
new file mode 100644
index 0000000..05c093b
--- /dev/null
+++ b/old_code_ci3/views/IPD_Format/ipd_sticker_print_3.php
@@ -0,0 +1,52 @@
+
+
+ 0) {
+ $Insurance = 'Insurance : ' . $case_master[0]->insurance_company_name;
+ } else {
+ $Insurance = 'Insurance : CASH / Direct';
+ }
+
+ $ipd_doc_list_show = '';
+ foreach ($ipd_doc_list as $row) {
+ $ipd_doc_list_show .= ' Dr. ' . $row->p_fname . ' ';
+ }
+?>
+
+
+
+
+
+
+
+
+ Patient Name : = $person_info[0]->title . ' ' . $person_info[0]->p_fname ?>
+ Age : = $person_info[0]->age ?> / Gender : = $person_info[0]->xgender ?>
+ UHID / Patient ID : = $person_info[0]->p_code ?>
+ IPD Code : = $ipd_info[0]->ipd_code ?>
+ Dept./Doctor : = $ipd_doc_list_show ?>
+ Date of Admission : = $ipd_info[0]->str_register_date . $Insurance ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Nursing/IPDList_V.php b/old_code_ci3/views/IPD_Nursing/IPDList_V.php
new file mode 100644
index 0000000..d0d4a24
--- /dev/null
+++ b/old_code_ci3/views/IPD_Nursing/IPDList_V.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Bed No.[Type]
+ Register Date
+ No. of Days
+ Dr. Name
+ Admit Type
+
+
+
+
+
+
+ =$data[$i]->ipd_code ?>
+ [=$data[$i]->p_code ?>] =$data[$i]->p_fname ?> =$data[$i]->p_rname ?>
+ =$data[$i]->Bed_Desc ?>
+ =$data[$i]->str_register_date ?>
+ =$data[$i]->no_days ?>
+ =$data[$i]->doc_name ?>
+ =$data[$i]->admit_type ?> =$data[$i]->Org_Status ?>
+ Got It....
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Register Date
+ Admit Type
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Nursing/IPD_Panel.php b/old_code_ci3/views/IPD_Nursing/IPD_Panel.php
new file mode 100644
index 0000000..cd3ea56
--- /dev/null
+++ b/old_code_ci3/views/IPD_Nursing/IPD_Panel.php
@@ -0,0 +1,101 @@
+
+
+
+
+
+
Name : = $person_info[0]->p_fname ?> {= $person_info[0]->p_rname ?> }
+ / Age : = $person_info[0]->age ?>
+ / Gender : = $person_info[0]->xgender ?>
+ / UHID : = $person_info[0]->p_code ?>
+ / No of Days : = $ipd_info[0]->no_days ?>
+
+
Admit Date : = $ipd_info[0]->str_register_date ?>
+ / Discharge Date : = $ipd_info[0]->str_discharge_date ?>
+
+
+
+
+
+ 0) {
+ $pdata = $case_master[0]->insurance_id;
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Nursing/ipd_main_panel.php b/old_code_ci3/views/IPD_Nursing/ipd_main_panel.php
new file mode 100644
index 0000000..4ee3a01
--- /dev/null
+++ b/old_code_ci3/views/IPD_Nursing/ipd_main_panel.php
@@ -0,0 +1,175 @@
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
+
Name
+
+
+ = $person_info[0]->p_fname ?>
+
+ Phone Number : = $person_info[0]->mphone1 ?>
+
+
+
+
Relative Name
+
+
+ = $ipd_info[0]->contact_person_Name ?>
+ Phone Number : = $ipd_info[0]->P_mobile1 ?> , = $ipd_info[0]->P_mobile2 ?>
+
+
+
+
Address
+
+
+ = $person_info[0]->add1 ?>,
+ = $person_info[0]->add2 ?>,
+ = $person_info[0]->city ?>,
+ = $person_info[0]->state ?>,
+
+
+
+
+
Admit Date
+
+ Admit Date : = MysqlDate_to_str($ipd_info[0]->register_date) ?> Time : = $ipd_info[0]->reg_time ?>
+
+
+
+
+
Associated Doctors
+
+ p_fname . ' ';
+ echo ' ';
+ $srno = $srno + 1;
+ }
+ ?>
+
+
+
+
Notes
+
+ = $ipd_info[0]->remark ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0) { ?>
+
+
+
+
+
+ Org. Add Charge
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Nursing/ipd_treatment.php b/old_code_ci3/views/IPD_Nursing/ipd_treatment.php
new file mode 100644
index 0000000..1933b8a
--- /dev/null
+++ b/old_code_ci3/views/IPD_Nursing/ipd_treatment.php
@@ -0,0 +1,188 @@
+
+ 'form', 'class' => 'form2', 'autocomplete' => 'on')); ?>
+
+
+
+
+
+
+
+
+ 0) {
+ echo '
+ Type
+ Prescribed
+ Dosage
+ Remarks
+
+
+ ';
+ } ?>
+
+
+ = $row->med_type ?>
+ = $row->med_name ?>
+ = $row->dose_shed ?>
+ = $row->dose_when ?>
+ = $row->dose_frequency ?> = $row->dose_where ?>
+ = $row->qty ?> = $row->no_of_days ?> = $row->remark ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Package/item_create_V.php b/old_code_ci3/views/IPD_Package/item_create_V.php
new file mode 100644
index 0000000..73cb4f1
--- /dev/null
+++ b/old_code_ci3/views/IPD_Package/item_create_V.php
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+ Package Group
+
+ pak_id.'" >'.$row->pakage_group_name.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Package/item_item_list.php b/old_code_ci3/views/IPD_Package/item_item_list.php
new file mode 100644
index 0000000..2fe8893
--- /dev/null
+++ b/old_code_ci3/views/IPD_Package/item_item_list.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+
=H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Charge Details
+ Amount
+
+
+
+
+
+
+ =$data[$i]->isIPD_OPD ?>
+ =$data[$i]->group_desc ?>
+ =$data[$i]->idesc ?>
+ =$data[$i]->idesc_detail ?>
+ =$data[$i]->amount ?>
+
+
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Package/item_list_all.php b/old_code_ci3/views/IPD_Package/item_list_all.php
new file mode 100644
index 0000000..457a6fe
--- /dev/null
+++ b/old_code_ci3/views/IPD_Package/item_list_all.php
@@ -0,0 +1,71 @@
+
+
+
+
+
+
=H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Group/Charge Name
+ Charge Details
+ Amount
+
+
+
+ group_desc)
+ {
+ echo ''.$data[$i]->group_desc.' ';
+ $Head=$data[$i]->group_desc;
+ }
+ ?>
+
+ =$data[$i]->idesc ?>
+ =$data[$i]->idesc_detail ?>
+ =$data[$i]->amount ?>
+
+
+
+
+
+ Group/Charge Name
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Package/item_profile_V.php b/old_code_ci3/views/IPD_Package/item_profile_V.php
new file mode 100644
index 0000000..0135152
--- /dev/null
+++ b/old_code_ci3/views/IPD_Package/item_profile_V.php
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+ Description
+ =$data_item[0]->Pakage_description ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+
+
+
+ =$data_insurance_item[$i]->ins_company_name ?>
+ =$data_insurance_item[$i]->i_amount ?>
+ =$data_insurance_item[$i]->code ?>
+ Delete
+
+
+
+
+
+
+
+
+
+
+ Company Name
+
+ id.'">'.$row->ins_company_name.'';
+ }
+ ?>
+
+
+
+
+
+
+ Add
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Package/item_search_V.php b/old_code_ci3/views/IPD_Package/item_search_V.php
new file mode 100644
index 0000000..b3750ae
--- /dev/null
+++ b/old_code_ci3/views/IPD_Package/item_search_V.php
@@ -0,0 +1,127 @@
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+ Select Package Group
+
+ pak_id . '>' . $row->pakage_group_name . '';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
Print
+
Print ALL
+
+
+
+
+ Package Name
+ Charge Name
+ Amount
+
+
+
+
+
+
+ = $row->ipd_pakage_name ?>
+ = $row->Pakage_description ?>
+ = $row->Pakage_Min_Amount ?>
+ Edit It....
+
+
+
+
+
+ Package Name
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Package/item_type_create.php b/old_code_ci3/views/IPD_Package/item_type_create.php
new file mode 100644
index 0000000..8f1c00b
--- /dev/null
+++ b/old_code_ci3/views/IPD_Package/item_type_create.php
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Charges Group Name
+
+
+
+
+
+ Is IPD or OPD
+
+ Both OPD and IPD
+ Only OPD
+ Only IPD
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Package/item_type_profile.php b/old_code_ci3/views/IPD_Package/item_type_profile.php
new file mode 100644
index 0000000..e8c84f8
--- /dev/null
+++ b/old_code_ci3/views/IPD_Package/item_type_profile.php
@@ -0,0 +1,68 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Charges Group Name
+
+
+
+
+
+ Is IPD or OPD
+
+ is_ipd_opd)?> >Both OPD and IPD
+ is_ipd_opd)?> >Only OPD
+ is_ipd_opd)?> >Only IPD
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/IPD_Report/ipd_balance_report.php b/old_code_ci3/views/IPD_Report/ipd_balance_report.php
new file mode 100644
index 0000000..485f97b
--- /dev/null
+++ b/old_code_ci3/views/IPD_Report/ipd_balance_report.php
@@ -0,0 +1,85 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Case_Form_V.php b/old_code_ci3/views/Invoice/Case_Form_V.php
new file mode 100644
index 0000000..f2c8268
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Case_Form_V.php
@@ -0,0 +1,150 @@
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+ Insurance Company Name
+
+ All Doctors
+ id==$data_insurance[0]->id)?"Selected":"";
+
+ echo ''.$row->ins_company_name.' ';
+ }
+ ?>
+
+
+
+
+
+ Insurance No (like ECHS service No..)
+
+
+
+
+
+ Insurance Card Holder Name
+
+
+
+
+
+
+
+
+ Case No. or Clam No.
+
+
+
+
+
+ Other Ref. No.1
+
+
+
+
+
+ Other Ref. No.2
+
+
+
+
+
+ Create Case Record
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Invoice/Case_Form_profile_V.php b/old_code_ci3/views/Invoice/Case_Form_profile_V.php
new file mode 100644
index 0000000..19cdbda
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Case_Form_profile_V.php
@@ -0,0 +1,193 @@
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+ Insurance Company Name
+
+ All Doctors
+ id==$data_insurance[0]->id)?"Selected":"";
+
+ echo ''.$row->ins_company_name.' ';
+ }
+ ?>
+
+
+
+
+
+ Insurance No (like ECHS service No..)
+
+
+
+
+
+ Insurance Card Holder Name
+
+
+
+
+
+
+
+
+ Case No. or Clam No.
+
+
+
+
+
+ Other Ref. No.1
+
+
+
+
+
+ Other Ref. No.2
+
+
+
+
+
+
+
+
+ Update Case Record
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Case_List.php b/old_code_ci3/views/Invoice/Case_List.php
new file mode 100644
index 0000000..2b475ea
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Case_List.php
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+
+ Case No.
+ Patient Name
+ Case Date
+ Card Holder Name
+ Insurance
+ OPD Amount
+ Invoice Amount
+ Status
+
+
+
+
+
+
+ =$searchdata[$i]->case_id_code ?>
+ =$searchdata[$i]->p_name ?>
+ =$searchdata[$i]->date_registration ?>
+ =$searchdata[$i]->insurance_card_name ?>
+ =$searchdata[$i]->insurance_company_name ?>
+ =$searchdata[$i]->OPD_Amount ?>
+ =$searchdata[$i]->Invoice_Amount ?>
+ =$searchdata[$i]->str_status ?>
+ Show It....
+
+
+
+
+
+ Case No.
+ Patient Name
+ Case Date
+ Card Holder Name
+ Insurance
+ OPD Amount
+ Invoice Amount
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Invoice_Charges_correction.php b/old_code_ci3/views/Invoice/Invoice_Charges_correction.php
new file mode 100644
index 0000000..7156aa0
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Invoice_Charges_correction.php
@@ -0,0 +1,212 @@
+
+
+
+
+
+
+
+ From
+
+ Krishna Hospital & Research Centre
+ 3-136, Guru Nanakpura, Haldwani
+ Distt. Nainital, Uttarakhand
+ Phone: (05946) 222426,282623
+ Fax No.:(05946) 282624
+ Email: krishnahospitalhaldwani@gmail.com
+
+
+
+
+ To
+
+ =$patient_master[0]->p_fname ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+
+
+
+
+ Invoice #=$invoice_master[0]->invoice_code ?>
+
+ Date : =$invoice_master[0]->inv_date ?>
+ Patient ID : =$patient_master[0]->p_code ?>
+ Refer By : =$invoice_master[0]->refer_by_other ?>
+
+ payment_id>0 )
+ {
+ echo 'Payment No. : '.$invoice_master[0]->payment_id.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ payment_status>0) { ?>
+
+
+
+ Payment Method by : =$invoice_master[0]->payment_mode_desc ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Invoice_charges.php b/old_code_ci3/views/Invoice/Invoice_charges.php
new file mode 100644
index 0000000..0d9a98b
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Invoice_charges.php
@@ -0,0 +1,27 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Invoice_charges_list.php b/old_code_ci3/views/Invoice/Invoice_charges_list.php
new file mode 100644
index 0000000..0e142ec
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Invoice_charges_list.php
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+ Invoice Code
+ Name
+ Inv. Date
+ ref. Doc. Name
+ Type
+ PayMode
+ Inv. Amount
+ Pending
+ Action
+
+
+
+
+
+ =$charges_list[$i]->invoice_code ?>
+ =$charges_list[$i]->p_fname ?>
+ =$charges_list[$i]->Inv_Date ?>
+ Dr. =$charges_list[$i]->refer_by_other ?>
+ =$charges_list[$i]->Inv_Type ?>
+ =$charges_list[$i]->PaymentMode ?>
+ =$charges_list[$i]->net_amount ?>
+ =$charges_list[$i]->payment_part_balance ?>
+ invoice_status==1 ) { ?>
+ View
+ invoice_status==2){ ?>
+ Cancelled
+
+ Pending
+
+
+
+
+
+
+
+ Invoice Code
+ Name
+ Inv. Date
+ ref. Doc. Name
+ Type
+ PayMode
+ Inv. Amount
+ Pending
+ Action
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Invoice_opd.php b/old_code_ci3/views/Invoice/Invoice_opd.php
new file mode 100644
index 0000000..ca17e2d
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Invoice_opd.php
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Invoice_opd_correction.php b/old_code_ci3/views/Invoice/Invoice_opd_correction.php
new file mode 100644
index 0000000..51c6fc2
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Invoice_opd_correction.php
@@ -0,0 +1,155 @@
+
+
+
+
+
+ To
+
+ =$opd_master[0]->P_name ?>
+ OPD Book Date (y-m-d time) : =$opd_master[0]->opd_book_date ?>
+ Gender : =($patient_master[0]->gender==1)?'Male':'Female' ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+
+
+
+
+ OPD ID: =$opd_master[0]->opd_code ?>
+ Patient ID : =$patient_master[0]->p_code ?>
+
+ insurance_id>1)
+ {
+ echo ' Ins. Comp. : '.$insurance[0]->ins_company_name.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ payment_status==0) { ?>
+
Delete
+
+
+
+
+
+
+
+
+ Payment Method by : =$opd_master[0]->payment_mode_desc ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Invoice_opd_list.php b/old_code_ci3/views/Invoice/Invoice_opd_list.php
new file mode 100644
index 0000000..f420214
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Invoice_opd_list.php
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+ OPD Code
+ Name
+ OPD Date
+ Doc. Name
+ Type
+ PayMode
+ Fee
+
+
+
+
+
+ =$opd_list[$i]->opd_code ?>
+ =$opd_list[$i]->P_name ?>
+ =$opd_list[$i]->App_Date ?>
+ =$opd_list[$i]->doc_name ?>
+ =$opd_list[$i]->Inv_Type ?>
+ =$opd_list[$i]->PaymentMode ?>
+ Got It....
+
+
+
+
+
+ OPD Code
+ Name
+ OPD Date
+ Doc. Name
+ Type
+ PayMode
+ Fee
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Invoice_org_payment.php b/old_code_ci3/views/Invoice/Invoice_org_payment.php
new file mode 100644
index 0000000..dad47fe
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Invoice_org_payment.php
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+org_id.':'.$req_payment_order[0]->pay_id.':'.$req_payment_order[0]->payment_amount.':PT'.date('dmYhis');
+?>
+
+
+
+
+Org Payment Credit Receipt : =$req_payment_order[0]->pay_id?>
+
+
+
+
+ Patient Info.
+ UHID : =$patient_master[0]->p_code?>
+ Name : =$patient_master[0]->title?> =strtoupper($patient_master[0]->p_fname)?>
+ =$patient_master[0]->p_relative?> =strtoupper($patient_master[0]->p_rname)?>
+ Sex : =$patient_master[0]->xgender?> =$patient_master[0]->age?> P.No. :=$patient_master[0]->mphone1?>
+
+
+ Org. Case No. : =$req_payment_order[0]->org_code?>
+ Payment Date : =$req_payment_order[0]->payment_date_str?>
+
+
+
+
+
+ Org Case Payment Amount : Rs. =$req_payment_order[0]->payment_amount?>
+ Amount in Words : Rs.=number_to_word($req_payment_order[0]->payment_amount)?>
+
+
+ Prepared By : =$req_payment_order[0]->payment_accept_by?>
+
+
+ Signature
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Org_Contingent_bill.php b/old_code_ci3/views/Invoice/Org_Contingent_bill.php
new file mode 100644
index 0000000..e571076
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Org_Contingent_bill.php
@@ -0,0 +1,82 @@
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+ =$orgcase[0]->contingent_bill ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Invoice/Organization_Invoice_PathLab.php b/old_code_ci3/views/Invoice/Organization_Invoice_PathLab.php
new file mode 100644
index 0000000..baa8e0a
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Organization_Invoice_PathLab.php
@@ -0,0 +1,224 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+ Doctor Name
+
+ refer_by_id)?> >From Other Hospital
+ id.' '.combo_checked($row->id,$invoiceMaster[0]->refer_by_id).' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_type.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$row->item_amount.' ';
+ echo '-Remove ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal?>
+
+
+
+
+
+
+
+
+ Charges Group
+
+ itype_id.'>'.$row->desc.'';
+ }
+ ?>
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Organization_Invoice_PathLab_correction.php b/old_code_ci3/views/Invoice/Organization_Invoice_PathLab_correction.php
new file mode 100644
index 0000000..b3d75da
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Organization_Invoice_PathLab_correction.php
@@ -0,0 +1,204 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+ Doctor Name
+
+ refer_by_id)?> >From Other Hospital
+ id.' '.combo_checked($row->id,$invoiceMaster[0]->refer_by_id).' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_type.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$row->item_amount.' ';
+ echo '-Remove ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal?>
+
+
+
+
+
+
+
+
+ Charges Group
+
+ itype_id.'>'.$row->desc.'';
+ }
+ ?>
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Organization_Invoice_PathLab_final_V.php b/old_code_ci3/views/Invoice/Organization_Invoice_PathLab_final_V.php
new file mode 100644
index 0000000..d65f578
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Organization_Invoice_PathLab_final_V.php
@@ -0,0 +1,364 @@
+
+
+
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+
+
+
+ To
+
+ =$patient_master[0]->p_fname ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+
+
+
+
+ Invoice #=$invoice_master[0]->invoice_code ?>
+
+ insurance_id>1)
+ {
+ echo ' Ins. Comp. : '.$insurance[0]->ins_company_name.' ';
+ if($invoice_master[0]->insurance_case_id>0)
+ {
+ echo ' Org.Case No. : '.$case_master[0]->case_id_code.' ';
+ }
+ }
+ ?>
+ Date : =$invoice_master[0]->inv_date ?>
+ Patient ID : =$patient_master[0]->p_code ?>
+ payment_id>0 )
+ {
+ echo 'Payment No. : '.$invoice_master[0]->payment_id.' ';
+ }
+ ?>
+
+ Refer By : =$invoice_master[0]->refer_by_other ?>
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$row->item_amount.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ ?>
+
+
+ #
+ Amount received : =$invoice_master[0]->payment_part_received?>
+ Balance Amount : =$invoice_master[0]->payment_part_balance?>
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+
+
+
+
+
+ payment_status==0 || $invoice_master[0]->payment_part ==1 ) { ?>
+
+
+
+
+ Received Amount
+
+
+
+
+
+
+
+
+
+
+
+
+ Payment Method by : =$invoice_master[0]->payment_mode_desc ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/Organization_invoice_print_v.php b/old_code_ci3/views/Invoice/Organization_invoice_print_v.php
new file mode 100644
index 0000000..bb41072
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Organization_invoice_print_v.php
@@ -0,0 +1,181 @@
+
+
+
+
+
+
=H_Name?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Provisional Invoice #=$invoice_master[0]->invoice_code ?>
+ insurance_id>0)
+ {
+ echo '
Ins. Comp. : '.$insurance[0]->ins_company_name.'
';
+ if($invoice_master[0]->insurance_case_id>0)
+ {
+ echo '
Org.Case No. : '.$case_master[0]->case_id_code.'
';
+ if($invoice_master[0]->insurance_case_id==2)
+ {
+ echo '
Service No. : '.$case_master[0]->insurance_no_2.' ';
+ }
+ echo '
Claim ID/No : '.$case_master[0]->insurance_no_1.'
';
+ }
+ }
+ ?>
+
Date : =$invoice_master[0]->inv_date ?>
+
Patient ID : =$patient_master[0]->p_code ?>
+ payment_id>0 )
+ {
+ echo '
Payment No. : '.$invoice_master[0]->payment_id.'
';
+ }
+ ?>
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+
+
+
+ To
+
+ =$patient_master[0]->p_fname ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+ Refer By : =$invoice_master[0]->refer_by_other ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ ?>
+
+
+ #
+ Amount received : =$invoice_master[0]->payment_part_received?>
+ Balance Amount : =$invoice_master[0]->payment_part_balance?>
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+
+
+
+ Signature
+
+
+
+
+
+
+
+ This is computer generated Provisional invoice , Signature and stamp not required
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Invoice/Organization_invoice_show.php b/old_code_ci3/views/Invoice/Organization_invoice_show.php
new file mode 100644
index 0000000..5a09422
--- /dev/null
+++ b/old_code_ci3/views/Invoice/Organization_invoice_show.php
@@ -0,0 +1,137 @@
+
+
+
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+
+
+
+ To
+
+ =$opd_master[0]->P_name ?>
+ Date : =$opd_master[0]->apointment_date ?>
+ Gender : =($patient_master[0]->gender==1)?'Male':'Female' ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+
+
+
+
+ OPD ID: =$opd_master[0]->opd_code ?>
+ Patient ID : =$patient_master[0]->p_code ?>
+
+
+
+
+
+
+
+
+
+
+ ID
+ Type
+ Procedure / Investigation
+ Department
+ Amount
+ Final Amount
+
+
+
+
+ =$opd_master[0]->apointment_date ?>
+ Dr. =$opd_master[0]->doc_name ?>
+ =$opd_master[0]->doc_spec ?>
+ =$opd_master[0]->opd_fee_amount ?>
+ =$opd_master[0]->opd_fee_desc ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Amount Due 2/22/2014
+
+
+
+
+ Subtotal:
+ $250.30
+
+
+ Tax (9.3%)
+ $10.34
+
+
+ Shipping:
+ $5.80
+
+
+ Total:
+ $265.24
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/case_list_all.php b/old_code_ci3/views/Invoice/case_list_all.php
new file mode 100644
index 0000000..f367a35
--- /dev/null
+++ b/old_code_ci3/views/Invoice/case_list_all.php
@@ -0,0 +1,159 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/caseinvoice_V.php b/old_code_ci3/views/Invoice/caseinvoice_V.php
new file mode 100644
index 0000000..07204aa
--- /dev/null
+++ b/old_code_ci3/views/Invoice/caseinvoice_V.php
@@ -0,0 +1,422 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
Medical Bills
+
+
+
+
+ #
+ Invoice ID.
+ Inv.Date
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->inv_date.' ';
+ echo ''.$row->net_amount.' ';
+ echo ' Print ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/caseinvoice_ipd_V.php b/old_code_ci3/views/Invoice/caseinvoice_ipd_V.php
new file mode 100644
index 0000000..6f36979
--- /dev/null
+++ b/old_code_ci3/views/Invoice/caseinvoice_ipd_V.php
@@ -0,0 +1,146 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/caseinvoice_print_V.php b/old_code_ci3/views/Invoice/caseinvoice_print_V.php
new file mode 100644
index 0000000..b03c087
--- /dev/null
+++ b/old_code_ci3/views/Invoice/caseinvoice_print_V.php
@@ -0,0 +1,186 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+ p_code.':'.$orgcase[0]->id .':P-'.date('Y-m-d H:i:s');
+ ?>
+
+
+
+
+Bill No.# :=$orgcase[0]->id?>
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Bill No.:=$orgcase[0]->id?> / UHID:=$person_info[0]->p_code ?> /Name : =$person_info[0]->p_fname ?>
+
+
+
+
+
+
+ To
+ Patient ID : =$person_info[0]->p_code ?>
+ =$person_info[0]->p_fname ?>
+ Gender : =$person_info[0]->xgender ?>
+ Age : =$person_info[0]->age ?>
+ Phone No : =$person_info[0]->mphone1 ?>
+
+
+
+ Organisation Invoice # =$orgcase[0]->case_id_code?>
+ Organisation : =$insurance[0]->ins_company_name?>
+ Card / Insuranc No : =$orgcase[0]->insurance_no ?>
+ insurance_id==2)
+ {
+ echo ' Referral No. : '.$orgcase[0]->insurance_no_2.' ';
+ }
+ ?>
+ Claim ID/No : =$orgcase[0]->insurance_no_1 ?>
+ org_submit_date=='')
+ {
+ $Dateofsubmit=date('d/m/Y');
+ }else{
+ $Dateofsubmit=MysqlDate_to_str($orgcase[0]->org_submit_date);
+ }
+ ?>
+ Bill Submit Date : =$Dateofsubmit ?>
+
+
+
+
+
+
+ #
+ Date
+ Charges Type
+ Description
+ Org. Code
+ Qty
+ Rate
+ Sub Invoice Code
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->str_date.' ';
+ echo ''.$row->Charge_type.' ';
+ echo ''.$row->Description.' ';
+ echo ''.$row->orgcode.' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$row->Code.' ';
+ echo ''.$row->Amount.' ';
+ echo '';
+ $Inv_total=$Inv_total+$row->Amount;
+ }
+
+ foreach($showinvoice2 as $row)
+ {
+ $srno=$srno+1;
+ if($row->discount_amount>0){
+ $readonly = 'readonly';
+ $disabled = 'disabled';
+ $rate = $row->d_rate;
+ $discription = $row->Description.' (Discounted) Rate : '.$row->item_rate;
+ }else{
+ $readonly = '';
+ $disabled = '';
+ $rate = $row->item_rate;
+ $discription = $row->Description;
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->str_date.' ';
+ echo ''.$row->Charge_type.' ';
+ echo ''.$discription.' ';
+ echo ''.$row->orgcode.' ';
+ echo ''.$row->item_qty.' ';
+ echo ''.$rate.' ';
+ echo ''.$row->Code.' ';
+ echo ''.$row->Amount.' ';
+ echo ' ';
+ $Inv_total=$Inv_total+$row->Amount;
+ }
+
+ if(count($MedInvoice)>0 && $med_include==1)
+ {
+ $srno=$srno+1;
+ $Inv_total=Round($Inv_total,0)+Round($MedInvoice[0]->Med_Amount,0);
+ ?>
+
+ =$srno?>
+
+ Medicine Expense
+
+
+
+ =$MedInvoice[0]->Med_Amount?>
+
+
+
+
+ #
+ =number_to_word($Inv_total)?>
+ Gross Total
+ =number_format($Inv_total,2)?>
+
+
+
+
+
+
+
Authorized Signatory
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/invoice_print.php b/old_code_ci3/views/Invoice/invoice_print.php
new file mode 100644
index 0000000..8401f3e
--- /dev/null
+++ b/old_code_ci3/views/Invoice/invoice_print.php
@@ -0,0 +1,183 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+ p_code.':'.$invoice_master[0]->invoice_code .':P-'.date('Y-m-d H:i:s').':C-'.$invoice_master[0]->confirm_invoice.':TAmt-'.$invoice_master[0]->net_amount;
+ ?>
+
+
+
+
+Invoice No. :=$invoice_master[0]->invoice_code?>
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$invoice_master[0]->invoice_code?> / UHID:=$patient_master[0]->p_code?> /Name : =strtoupper($patient_master[0]->p_fname)?>
+
+
+
+0)
+ {
+ $org_case_info="
Org. Name : ".$case_master[0]->short_name;
+ $org_case_info.="
Org. ID : ".$case_master[0]->case_id_code;
+ }
+?>
+
+
+ Bill To
+ UHID : =$patient_master[0]->p_code?>
+ Name : =$patient_master[0]->title?> =strtoupper($patient_master[0]->p_fname)?>
+ =$patient_master[0]->p_relative?> =strtoupper($patient_master[0]->p_rname)?>
+ Sex : =$patient_master[0]->xgender?> =$patient_master[0]->age?> P.No. :=$patient_master[0]->mphone1?>
+
+
+ =$org_case_info?>
+ Address : =$patient_master[0]->add1.','.$patient_master[0]->city?>
+ Date : =MysqlDate_to_str($invoice_master[0]->inv_date)?>
+ Refer By : Dr.=$invoice_master[0]->refer_by_other?>
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Org.Code
+ Rate
+ Qty
+ Amount
+
+';
+$content.= ''.$srno.' ';
+$content.= ''.$row->group_desc.' ';
+$content.= ''.$row->item_name.' ';
+$content.= ''.$row->org_code.' ';
+$content.= ''.$row->item_rate.' ';
+$content.= ''.$row->item_qty.' ';
+$content.= ' '.$row->item_amount.' ';
+$srno=$srno+1;
+$content.= '';
+
+
+}
+echo $content;
+?>
+
+#
+
+
+
+
+Gross Total
+=$invoice_master[0]->total_amount?>
+
+
+discount_amount>0) {
+$content.='
+ #
+ Deduction
+ '.$invoice_master[0]->discount_desc.'
+
+
+
+ -'.$invoice_master[0]->discount_amount.'
+
+ ';
+}
+echo $content;
+?>
+
+#
+
+
+
+
+Net Amount
+=$invoice_master[0]->net_amount?>
+
+
+
+
+
+ipd_id<1) {
+ $content='Amount received : '.$invoice_master[0]->payment_part_received.'
+ / Balance Amount : '.$invoice_master[0]->payment_part_balance.'
+ / Net Amount : '.$invoice_master[0]->net_amount;
+ }
+
+ echo $content;
+
+?>
+
+payment_mode>2) { ?>
+
Payment Details [=$invoice_master[0]->Payment_type_str ?>]
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+ Amount in Words : Rs. =number_to_word($invoice_master[0]->net_amount)?>
+ Prepared By : =$invoice_master[0]->prepared_by?>
+
+
+
+
+Signature
+ Date : =$invoice_master[0]->confirm_invoice_datetime?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/invoice_print_a4_double.php b/old_code_ci3/views/Invoice/invoice_print_a4_double.php
new file mode 100644
index 0000000..5e1c309
--- /dev/null
+++ b/old_code_ci3/views/Invoice/invoice_print_a4_double.php
@@ -0,0 +1 @@
+Hello World
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/invoice_print_a5.php b/old_code_ci3/views/Invoice/invoice_print_a5.php
new file mode 100644
index 0000000..11a4ec2
--- /dev/null
+++ b/old_code_ci3/views/Invoice/invoice_print_a5.php
@@ -0,0 +1,379 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+ p_code.':'.$invoice_master[0]->invoice_code .':P-'.date('Y-m-d H:i:s').':C-'.$invoice_master[0]->confirm_invoice.':TAmt-'.$invoice_master[0]->net_amount;
+ ?>
+
+
+
+
+ Invoice No. :=$invoice_master[0]->invoice_code?>
+
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+ p_code.':'.$invoice_master[0]->invoice_code .':P-'.date('Y-m-d H:i:s').':C-'.$invoice_master[0]->confirm_invoice.':TAmt-'.$invoice_master[0]->net_amount;
+ ?>
+
+
+
+
+ Invoice No. :=$invoice_master[0]->invoice_code?> [LAB COPY]
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$invoice_master[0]->invoice_code?> / UHID:=$patient_master[0]->p_code?> /Name : =strtoupper($patient_master[0]->p_fname)?>
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$invoice_master[0]->invoice_code?> / UHID:=$patient_master[0]->p_code?> /Name : =strtoupper($patient_master[0]->p_fname)?>
+
+
+
+
+
+
+0)
+ {
+ $org_case_info="
Org. Name : ".$case_master[0]->short_name;
+ $org_case_info.="
Org. ID : ".$case_master[0]->case_id_code;
+ }
+?>
+
+
+
+
+
+
+ Bill To
+ UHID : =$patient_master[0]->p_code?>
+ Name : =$patient_master[0]->title?> =strtoupper($patient_master[0]->p_fname)?>
+ =$patient_master[0]->p_relative?> =strtoupper($patient_master[0]->p_rname)?>
+ Sex : =$patient_master[0]->xgender?> =$patient_master[0]->age?> P.No. :=$patient_master[0]->mphone1?>
+
+
+ =$org_case_info?>
+ Address : =$patient_master[0]->add1.','.$patient_master[0]->city?>
+ Date : =MysqlDate_to_str($invoice_master[0]->inv_date)?>
+ Refer By : Dr.=$invoice_master[0]->refer_by_other?>
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Org.Code
+ Rate
+ Qty
+ Amt.
+
+ ';
+ $content.= ' '.$srno.' ';
+ $content.= ' '.$row->group_desc.' ';
+ $content.= ' '.$row->item_name.' ';
+ $content.= ' '.$row->org_code.' ';
+ $content.= ' '.$row->item_rate.' ';
+ $content.= ' '.$row->item_qty.' ';
+ $content.= ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ $content.= '';
+
+ }
+ echo $content;
+ ?>
+
+
+ #
+
+
+
+
+ Gross Total
+ =$invoice_master[0]->total_amount?>
+
+ discount_amount>0) {
+ $content.='
+ #
+ Deduction
+
+ '.$invoice_master[0]->discount_desc.'
+
+
+ -'.$invoice_master[0]->discount_amount.'
+
+ ';
+ }
+ echo $content;
+ ?>
+
+ #
+
+
+
+
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+
+
+
+
+ ipd_id<1) {
+ $content='
+ Amount received : '.$invoice_master[0]->payment_part_received.'
+ / Balance Amount : '.$invoice_master[0]->payment_part_balance.'
+ / Net Amount : '.$invoice_master[0]->net_amount.
+ '
';
+ }
+ echo $content;
+ ?>
+
+
+
+
+ Amount in Words : Rs. =number_to_word($invoice_master[0]->net_amount)?>
+ Prepared By : =$invoice_master[0]->prepared_by?>
+
+
+
+
+ =$invoice_master[0]->Invoice_status_str?>
+ payment_mode>2) { ?>
+ Payment Details [=$invoice_master[0]->Payment_type_str ?>]
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+
+
+ Signature
+ Date : =$invoice_master[0]->confirm_invoice_datetime?>
+
+
+
+
+
+
+
+
+
+
+ Bill To
+ UHID : =$patient_master[0]->p_code?>
+ Name : =$patient_master[0]->title?> =strtoupper($patient_master[0]->p_fname)?>
+ =$patient_master[0]->p_relative?> =strtoupper($patient_master[0]->p_rname)?>
+ Sex : =$patient_master[0]->xgender?> =$patient_master[0]->age?> P.No. :=$patient_master[0]->mphone1?>
+
+
+ =$org_case_info?>
+ Address : =$patient_master[0]->add1.','.$patient_master[0]->city?>
+ Date : =MysqlDate_to_str($invoice_master[0]->inv_date)?>
+ Refer By : Dr.=$invoice_master[0]->refer_by_other?>
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Org.Code
+ Rate
+ Qty
+ Amt.
+
+ ';
+ $content.= ' '.$srno.' ';
+ $content.= ' '.$row->group_desc.' ';
+ $content.= ' '.$row->item_name.' ';
+ $content.= ' '.$row->org_code.' ';
+ $content.= ' '.$row->item_rate.' ';
+ $content.= ' '.$row->item_qty.' ';
+ $content.= ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ $content.= '';
+
+
+ }
+ echo $content;
+ ?>
+
+
+ #
+
+
+
+
+ Gross Total
+ =$invoice_master[0]->total_amount?>
+
+ discount_amount>0) {
+ $content.='
+ #
+ Deduction
+ '.$invoice_master[0]->discount_desc.'
+
+
+
+ -'.$invoice_master[0]->discount_amount.'
+
+ ';
+ }
+ echo $content;
+ ?>
+
+ #
+
+
+
+
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+
+
+
+
+ ipd_id<1) {
+ $content='
+ Amount received : '.$invoice_master[0]->payment_part_received.'
+ / Balance Amount : '.$invoice_master[0]->payment_part_balance.'
+ / Net Amount : '.$invoice_master[0]->net_amount.
+ '
';
+ }
+ echo $content;
+ ?>
+
+
+
+
+ =$invoice_master[0]->Invoice_status_str?>
+ payment_mode>2) { ?>
+ Payment Details [=$invoice_master[0]->Payment_type_str ?>]
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+
+ Amount in Words : Rs. =number_to_word($invoice_master[0]->net_amount)?>
+ Prepared By : =$invoice_master[0]->prepared_by?>
+
+
+
+
+ Signature
+ Date : =$invoice_master[0]->confirm_invoice_datetime?>
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Invoice/org_case_payment.php b/old_code_ci3/views/Invoice/org_case_payment.php
new file mode 100644
index 0000000..eef6854
--- /dev/null
+++ b/old_code_ci3/views/Invoice/org_case_payment.php
@@ -0,0 +1,142 @@
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+ Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->str_age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+
+
+
+
+
+
+
+ Org Code : =$org_info[0]->case_id_code?>
+ / Org. Name : =$org_info[0]->insurance_company_name?>
+ / Card No : =$org_info[0]->insurance_no?>
+ =$org_info[0]->insurance_no_1?>
+ =$org_info[0]->insurance_no_2?>
+
+
+
+
+ 0){ ?>
+
+
+
+ IPD Code : =$ipd_info[0]->ipd_code?>
+ / Admit Date : =$ipd_info[0]->str_register_date?>
+ / Dis. Date : =$ipd_info[0]->str_discharge_date?>
+ / Charge Amt : =$ipd_info[0]->charge_amount?>
+ / Medical Bill : =$ipd_info[0]->med_amount?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/payment_edit.php b/old_code_ci3/views/Invoice/payment_edit.php
new file mode 100644
index 0000000..2a0fe9e
--- /dev/null
+++ b/old_code_ci3/views/Invoice/payment_edit.php
@@ -0,0 +1,202 @@
+
+
+
+
+
+
+ payment_mode==1){ ?>
+
+
+ Payment By
+
+ id.'" > '.$row->pay_type.' ['.$row->bank_name.']'.'';
+ }
+ ?>
+
+
+
+
+
+ Change to BANK
+
+
+
+ Change to CASH
+
+
+
+
+
+
+
Change User
+
+
+ update_by_id) ? ' selected="selected"' : "";
+ echo ''.$user_list['username'].'['.$user_list['first_name'].' '.$user_list['last_name'].'] ';
+ }
+ ?>
+
+
+
+
+ Change User
+
+
+
+
+
+
+ Change/Correct Amount Value
+
+
+
+
+ Change Amount
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Invoice/payment_req_panel.php b/old_code_ci3/views/Invoice/payment_req_panel.php
new file mode 100644
index 0000000..b978b09
--- /dev/null
+++ b/old_code_ci3/views/Invoice/payment_req_panel.php
@@ -0,0 +1,203 @@
+
+
+
+
+
+
Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+ / ORG. Code : =$org_info[0]->case_id_code?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/payment_request_list.php b/old_code_ci3/views/Invoice/payment_request_list.php
new file mode 100644
index 0000000..1237b2e
--- /dev/null
+++ b/old_code_ci3/views/Invoice/payment_request_list.php
@@ -0,0 +1,103 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/payment_search.php b/old_code_ci3/views/Invoice/payment_search.php
new file mode 100644
index 0000000..f26b634
--- /dev/null
+++ b/old_code_ci3/views/Invoice/payment_search.php
@@ -0,0 +1,25 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/print_payment_receipt_org.php b/old_code_ci3/views/Invoice/print_payment_receipt_org.php
new file mode 100644
index 0000000..4afaf8f
--- /dev/null
+++ b/old_code_ci3/views/Invoice/print_payment_receipt_org.php
@@ -0,0 +1,71 @@
+
+
+
+
+
+
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+
+
+
+ To
+
+ =$person_info[0]->p_fname ?>
+ Phone No : =$ipd_master[0]->P_mobile1 ?>
+ Payment Reciept No #=$ipd_payment[0]->payment_id ?>
+ Date : =$ipd_payment[0]->pay_date ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+
+
+
+
+
+
+ IPD Credit Amount : =$ipd_payment[0]->amount ?>
+
+ Remark :
+
+ =$ipd_payment[0]->remark ?>
+
+
+
+ Mode of Payment : =$ipd_payment[0]->payment_mode_desc ?>
+
+
+
+ Prepared By : =$ipd_payment[0]->prepared_by ?>
+
+
+
+ Signature
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/refund_amount_panel.php b/old_code_ci3/views/Invoice/refund_amount_panel.php
new file mode 100644
index 0000000..44a8a4b
--- /dev/null
+++ b/old_code_ci3/views/Invoice/refund_amount_panel.php
@@ -0,0 +1,91 @@
+
+'form','class'=>'form1')); ?>
+
+
+
+
+ CODE : =$refund_order[0]->refund_type_code ?>
+ Patient Name : =$refund_order[0]->patient_name ?>
+
+
+ Refund Reason : =$refund_order[0]->refund_type_reason ?>
+ Refund Amount : Rs. =$refund_order[0]->refund_amount ?>
+
+
+ Approved By : =$refund_order[0]->approved_by ?>
+ Date Time : Rs. =$refund_order[0]->approved_datetime ?>
+
+
+
+refund_process==0) { ?>
+
+
+
+
+
+ Receiver Phone Number
+
+
+
+
+ Refund Amount
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice/refund_invoice.php b/old_code_ci3/views/Invoice/refund_invoice.php
new file mode 100644
index 0000000..8cee7df
--- /dev/null
+++ b/old_code_ci3/views/Invoice/refund_invoice.php
@@ -0,0 +1,106 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice_PathLab.php b/old_code_ci3/views/Invoice_PathLab.php
new file mode 100644
index 0000000..f29740b
--- /dev/null
+++ b/old_code_ci3/views/Invoice_PathLab.php
@@ -0,0 +1,306 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+ Doctor Name
+
+ refer_by_id)?> >From Other Hospital
+ id.' '.combo_checked($row->id,$invoiceMaster[0]->refer_by_id).' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+ Charge Type [D]
+
+ Select Type
+ itype_id.'>'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+ Charge Name
+
+ No Value
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice_PathLab_final_V.php b/old_code_ci3/views/Invoice_PathLab_final_V.php
new file mode 100644
index 0000000..68d481c
--- /dev/null
+++ b/old_code_ci3/views/Invoice_PathLab_final_V.php
@@ -0,0 +1,531 @@
+'form','class'=>'form1')); ?>
+
+
+
+
+
+ To
+
+ =$patient_master[0]->p_fname ?>
+ =$patient_master[0]->p_relative ?> : =$patient_master[0]->p_rname ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+
+
+
+
+ Invoice #=$invoice_master[0]->invoice_code ?>
+ insurance_id>1)
+ {
+ echo ' Ins. Comp. : '.$insurance[0]->ins_company_name.' ';
+ if($invoice_master[0]->insurance_case_id>0 && count($case_master)>0)
+ {
+ echo ' Org.Case No. : '.$case_master[0]->case_id_code.' ';
+ }
+ }
+ ?>
+ Date : =$invoice_master[0]->inv_date ?>
+ Patient ID : =$patient_master[0]->p_code ?>
+ Refer By : =$invoice_master[0]->refer_by_other ?>
+
+
+
+
+
+
+
+
+
+
+
+ Received Amount
+
+
+
+
+
+
+ invoice_status==1 ) { ?>
+ payment_status==1 ) { ?>
+
+
+ payment_mode==1 || $invoice_master[0]->payment_mode==2 || $invoice_master[0]->payment_mode==0 ) { ?>
+
+
+ payment_part_balance>0)
+ {
+ ?>
+
+
+
+
+ Confirm Cash Received and Print Receipt
+
+
+
+
+
+
+
+
+
+
+ Payment By
+
+ id.'" > '.$row->pay_type.' ['.$row->bank_name.']'.'';
+ }
+ ?>
+
+
+
+
+
+
+ Payment Confirm By Card/Online
+ Confirm Payment
+
+
+
+
+
+
+ payment_part_balance<0){
+ ?>
+
+
+
+
+ Confirm Cash Return Request
+
+
+
+ total_amount>0 && $invoice_master[0]->payment_mode==0){
+ ?>
+
+
+
+
+ Confirm Zero Amount Invoice
+
+
+
+
+
+
+
+
+ insurance_case_id==0 && $invoice_master[0]->ipd_id==0)
+ {
+ ?>
+
+ ipd_id==0) {
+ if(count($ipd_master)>0)
+ {
+ ?>
+
+
+ Credit To IPD [=$ipd_master[0]->ipd_code?>]
+
+ insurance_case_id==0) {
+ if(count($case_master)>0)
+ {
+ ?>
+
+
+ Credit To Org. [=$case_master[0]->case_id_code?>]
+
+
+
+ ion_auth->in_group('ChargeInvoiceUpdate')) { ?>
+
+
+
+ Edit Invoice Items
+
+
+ Cancel Invoice
+
+
+
+ payment_mode==1 || $invoice_master[0]->payment_mode==2 ) { ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Invoice_ipd_credit.php b/old_code_ci3/views/Invoice_ipd_credit.php
new file mode 100644
index 0000000..8887307
--- /dev/null
+++ b/old_code_ci3/views/Invoice_ipd_credit.php
@@ -0,0 +1,275 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+ Doctor Name
+
+ refer_by_id)?> >From Other Hospital
+ id.' '.combo_checked($row->id,$invoiceMaster[0]->refer_by_id).' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+ Charge Type
+
+ itype_id.'>'.$row->desc.'';
+ }
+ ?>
+
+
+
+
+
+
+ Charge Name
+
+ id.'>'.$row->sdesc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/lab_date_show.php b/old_code_ci3/views/Lab_Panel/lab_date_show.php
new file mode 100644
index 0000000..07015f4
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_date_show.php
@@ -0,0 +1,55 @@
+ 0) {
+ $datetimepicker1 = $lab_invoice_request[0]->collected_time;
+ $datetimepicker2 = $lab_invoice_request[0]->reported_time;
+} else {
+ $datetimepicker1 = "";
+ $datetimepicker2 = "";
+}
+?>
+
+
+
+
+
+
Collect Time:
+
+
+
+
+
+
+
+
+
+
Report Time:
+
+
+
+
+
+
+
+
+ U pdate Time
+
+
+
+
+
diff --git a/old_code_ci3/views/Lab_Panel/lab_invoice_main.php b/old_code_ci3/views/Lab_Panel/lab_invoice_main.php
new file mode 100644
index 0000000..18c16ee
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_invoice_main.php
@@ -0,0 +1,505 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
Full Name : =ucwords($data[0]->p_fname) ?>
+
+
+
Gender : =$data[0]->xgender?>
+ / Age : =$data[0]->str_age?>
+
+
+
+
+
Relation : =$data[0]->p_relative?>
+ Relative Name : =ucwords($data[0]->p_rname)?>
+
+
+
Aadhar No. : =$data[0]->udai?>
+
+
+
+
+
Phone Number : =$data[0]->mphone1?>
+
+
+
Email : =$data[0]->email1?>
+
+
+
+
+
Address : =$data[0]->add1?>
+ =$data[0]->city ?>
+ =$data[0]->district ?>
+ =$data[0]->state ?>
+ =$data[0]->zip ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ Compile for Combine
+
+
+
+
+
+ Report in LetterHead
+
+ Report In Plain Paper
+
+
+
+
+
+
+ Upload Complete Report(In PDF)
+
+
+ Scan Complete Report
+
+
+ Show Scan/Upload Reports
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/lab_invoice_main_test_list.php b/old_code_ci3/views/Lab_Panel/lab_invoice_main_test_list.php
new file mode 100644
index 0000000..82c5fa4
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_invoice_main_test_list.php
@@ -0,0 +1,93 @@
+0){
+ echo '
';
+ echo '
Sr.No.: '.$lab_invoice_request[0]->daily_sr_no;
+ echo '
';
+ echo '
';
+ echo '
';
+ echo ' ';
+ echo '
+
+ Update Lab Test No.
+
+
';
+ echo '
';
+ echo '
';
+ }
+
+ foreach($testlist as $row)
+ {
+ echo '
'.$row->item_name.' ';
+ if($row->check_sample<1)
+ {
+ echo '
';
+ echo 'Sample Collection ';
+ }else{
+ $check='';
+ if ($row->print_combine>0)
+ {
+ $check='Checked';
+ }
+ echo '
';
+
+ if($row->status>0)
+ {
+ if($row->status==2)
+ {
+ echo 'test_id.'" data-testname="'.$row->item_name.'" data-repoid="'.$row->req_id.'" data-etype="6">Print Single Report ';
+
+ echo ' Remove ';
+ }else{
+ echo 'req_id.'" data-testname="'.$row->item_name.'" data-etype="1">Data Update ';
+
+ echo 'test_id.'" data-testname="'.$row->item_name.'" data-repoid="'.$row->req_id.'" data-etype="7">Edit ';
+
+ echo ' Remove ';
+
+ }
+ }else{
+ echo 'req_id.'" data-testname="'.$row->item_name.'" data-etype="1">Data Pending ';
+ }
+
+ echo '
+ :::::
+ ';
+ echo ' ';
+ echo ' Print Combine ';
+ echo '
+
';
+ echo '';
+ echo '
';
+
+ echo 'test_id.'" data-testname="'.$row->item_name.'" data-repoid="'.$row->req_id.'" data-etype="3">Upload Files ';
+
+ echo 'test_id.'" data-testname="'.$row->item_name.'" data-repoid="'.$row->req_id.'" data-etype="2">Scan ';
+
+ echo 'test_id.'" data-testname="'.$row->item_name.'" data-repoid="'.$row->req_id.'" data-etype="4">Show Files ';
+
+
+ if($row->status==2)
+ {
+ echo 'test_id.'" data-testname="'.$row->item_name.'" data-repoid="'.$row->req_id.'" data-etype="8">Open for Edit ';
+ }
+
+ echo '
+
';
+
+ echo '';
+
+ }
+
+ echo '
';
+ }
+?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/lab_invoice_main_xray_test_list.php b/old_code_ci3/views/Lab_Panel/lab_invoice_main_xray_test_list.php
new file mode 100644
index 0000000..051aa89
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_invoice_main_xray_test_list.php
@@ -0,0 +1,59 @@
+ 0) {
+?>
+
+
+
Sr.No.: = $lab_invoice_request[0]->daily_sr_no ?>
+
+
+
+
+
+
+ Update Lab Test No.
+
+
+
+
+' . $row->item_name . '';
+ if ($row->check_sample < 1) {
+ echo '
';
+ echo 'Accept Request ';
+ } else {
+ echo '
';
+
+ if ($row->status > 0) {
+ if ($row->status == 2) {
+ echo 'test_id . '" data-testname="' . $row->item_name . '" data-repoid="' . $row->req_id . '" data-etype="6">Print Report ';
+
+ echo 'test_id . '" data-testname="' . $row->item_name . '" data-repoid="' . $row->req_id . '" data-etype="8">Open for Edit ';
+
+ } else {
+ echo 'req_id . '" data-testname="' . $row->item_name . '" data-etype="1">Report Create ';
+
+ echo 'test_id.'" data-testname="'.$row->item_name.'" data-repoid="'.$row->req_id.'" data-etype="7">Report Edit ';
+
+ echo ' Remove ';
+ }
+ } else {
+ echo 'req_id . '" data-testname="' . $row->item_name . '" data-etype="1">Report Pending ';
+ }
+
+ echo '
+
';
+
+ echo '';
+ }
+
+ echo ' ';
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/lab_invoice_xray.php b/old_code_ci3/views/Lab_Panel/lab_invoice_xray.php
new file mode 100644
index 0000000..c864743
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_invoice_xray.php
@@ -0,0 +1,394 @@
+
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
Full Name : = ucwords($data[0]->p_fname) ?>
+
+
+
Gender : = $data[0]->xgender ?>
+ / Age : = $data[0]->str_age ?>
+
+
+
+
+
+
Relation : = $data[0]->p_relative ?>
+ Relative Name : = ucwords($data[0]->p_rname) ?>
+
+
+
+
Aadhar No. : = $data[0]->udai ?>
+
+
+
+
+
Phone Number : = $data[0]->mphone1 ?>
+
+
+
Email : = $data[0]->email1 ?>
+
+
+
+
+
Address : = $data[0]->add1 ?>
+ = $data[0]->city ?>
+ = $data[0]->district ?>
+ = $data[0]->state ?>
+ = $data[0]->zip ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/lab_main.php b/old_code_ci3/views/Lab_Panel/lab_main.php
new file mode 100644
index 0000000..39c5641
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_main.php
@@ -0,0 +1,95 @@
+
+
+
+
+
+ ion_auth->in_group('Diagnosis-PathLab')) { ?>
+
+
+
+ ion_auth->in_group('DiagnosisMRI')) { ?>
+
+
+ ion_auth->in_group('DiagnosisX-Ray')) { ?>
+
+
+ ion_auth->in_group('DiagnosisCTScan')) { ?>
+
+
+ ion_auth->in_group('DiagnosisUltraSound')) { ?>
+
+
+ ion_auth->in_group('DiagnosisIVF')) { ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/lab_report_file_list.php b/old_code_ci3/views/Lab_Panel/lab_report_file_list.php
new file mode 100644
index 0000000..24b5b07
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_report_file_list.php
@@ -0,0 +1,20 @@
+
+
Created Report History
+
+full_path,'/hms_uploads/',1) ;
+
+ //$file_path=substr($row->full_path,$pos);
+
+ $file_path=str_replace('hms_uploads','uploads',$row->full_path);
+
+ echo '
';
+ echo ''.$row->file_desc.' ';
+ echo " [".$row->file_name." ]";
+ echo ' / Created :'.$row->insert_time.' ';
+ echo '
';
+ }
+?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/lab_report_tab_1.php b/old_code_ci3/views/Lab_Panel/lab_report_tab_1.php
new file mode 100644
index 0000000..69da658
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_report_tab_1.php
@@ -0,0 +1,112 @@
+
+
+
+
+
+
+
+
+
+
+ Invoice No.
+ Day Sr.No.
+ Lab Test No.
+ Person Name
+ Date
+ Tests Name
+ Action
+
+
+
+
+
+ =$labreport_preprocess[$i]->invoice_code ?>
+ =$labreport_preprocess[$i]->daily_sr_no ?>
+ =$labreport_preprocess[$i]->lab_test_no ?>
+ =$labreport_preprocess[$i]->inv_name ?> | =$labreport_preprocess[$i]->age ?>
+ =$labreport_preprocess[$i]->inv_date ?>
+
+ data_array);
+ echo ' ';
+ foreach ($data_array as $value) {
+ $value_array=explode(";",$value);
+
+ if($value_array[3]<1)
+ {
+ echo ''.$value_array[0].' ';
+ }else{
+ if($value_array[4]>0)
+ {
+ echo ''.$value_array[0].' ';
+ }else{
+ echo ''.$value_array[0].' ';
+ }
+ }
+ }
+ echo '
';
+ ?>
+
+
+ Select
+
+
+
+
+
+
+ Invoice No.
+ Person Name
+ Date
+ Tests Name
+ Action
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/lab_report_tab_path.php b/old_code_ci3/views/Lab_Panel/lab_report_tab_path.php
new file mode 100644
index 0000000..0f701e0
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/lab_report_tab_path.php
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+
+
+
+
+ Invoice No.
+ Day Sr.No.
+ Lab Test No.
+ Person Name
+ Date
+ Tests Name
+ Action
+
+
+
+
+
+ =$labreport_preprocess[$i]->invoice_code ?>
+ =$labreport_preprocess[$i]->daily_sr_no ?>
+ =$labreport_preprocess[$i]->lab_test_no ?>
+ =$labreport_preprocess[$i]->inv_name ?> | =$labreport_preprocess[$i]->age ?>
+ =$labreport_preprocess[$i]->inv_date ?>
+
+ data_array);
+ echo ' ';
+ foreach ($data_array as $value) {
+ $value_array=explode(";",$value);
+
+ if($value_array[3]<1)
+ {
+ echo ''.$value_array[0].' ';
+ }else{
+ if($value_array[4]>0)
+ {
+ echo ''.$value_array[0].' ';
+ }else{
+ echo ''.$value_array[0].' ';
+ }
+ }
+ }
+ echo '
';
+ ?>
+
+
+ Select
+
+
+
+
+
+
+ Invoice No.
+ Person Name
+ Date
+ Tests Name
+ Action
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/pathlab_request_list.php b/old_code_ci3/views/Lab_Panel/pathlab_request_list.php
new file mode 100644
index 0000000..58c0e4d
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/pathlab_request_list.php
@@ -0,0 +1,87 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_report.php b/old_code_ci3/views/Lab_Panel/patient_lab_report.php
new file mode 100644
index 0000000..118449e
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_report.php
@@ -0,0 +1,82 @@
+
+
+
+=$report_header?>
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ =$report_head?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =nl2br($tech_name)?>
+
+
+ =$docname?>
+ =$docedu?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+
+
+ =$report_head?>
+
+
+
+
+=$complete_report?>
+
+###################### END OF REPORT ######################
+
+
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_report_1.php b/old_code_ci3/views/Lab_Panel/patient_lab_report_1.php
new file mode 100644
index 0000000..5e92a3b
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_report_1.php
@@ -0,0 +1,89 @@
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ =$report_head?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =nl2br($tech_name)?>
+
+
+ =$docname?>
+ =$docedu?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+
+
+ =$report_head?>
+
+
+
+
+=$complete_report?>
+
+###################### END OF REPORT ######################
+
+
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_report_apollo.php b/old_code_ci3/views/Lab_Panel/patient_lab_report_apollo.php
new file mode 100644
index 0000000..26513c5
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_report_apollo.php
@@ -0,0 +1,147 @@
+
+
+
+
+
+
+
+
+
+
+ Registered Under Govt. Of India/Uttarakhand
+ REFERENCE LAB
+ APOLLO DIAGNOSTICS & PATH LAB
+ Clinical Establishment No.0506600263/2019
+ Patel Chowk,Shiv Pharmacy, Near S.S.Jeena
+ Base Hospital,Haldwani-263139
+ E-Mail: '. H_Email.'
+ Website : www.apollodiagnosticshld.com
+ Customer Care : +91-9690556555
+
+
+
+
+
+
+
+ =$report_head?>
+ Page : {PAGENO}/{nbpg}
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Registered Under Govt. Of India/Uttarakhand
+ REFERENCE LAB
+ APOLLO DIAGNOSTICS & PATH LAB
+ Clinical Establishment No.0506600263/2019
+ Patel Chowk,Shiv Pharmacy, Near S.S.Jeena
+ Base Hospital,Haldwani-263139
+ E-Mail: '. H_Email.'
+ Website : www.apollodiagnosticshld.com
+ Customer Care : +91-9690556555
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ =$report_head?>
+
+
+
+
+
+
+=$complete_report?>
+###################### END OF REPORT ######################
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =$docname?>
+ =$docedu?>
+
+
+ =nl2br($tech_name)?>
+
+
+
+
+
+
+
+ This report is not for medico legal purpose. If clinical correlation is not established,kindly repeat the test at no additional cost within seven days.
+
+
+
+
+ Facilities: Pathology,Bedside Sample Collection,Health Check-ups,Allergy Testing, Biopsy ,DNA Testing,Peternity DNA Testing. Maternity DNA Testing,Forensic Testing, Nutritional & Genetic Testing.Optical, Dental X-Ray, ECG , EEG.
+ Online Booking Facilities for Diagnostics / Online Report Viewing */ 365 Days Open / Opening Hours:12*7
+
+
+
+
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_report_bajaj.php b/old_code_ci3/views/Lab_Panel/patient_lab_report_bajaj.php
new file mode 100644
index 0000000..5c7575c
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_report_bajaj.php
@@ -0,0 +1,58 @@
+
+
+=$report_header?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =nl2br($tech_name)?>
+
+
+ =$docname?>
+ =nl2br($docedu)?>
+
+
+
+
+
+=$complete_report?>
+###################### END OF REPORT ######################
+
+
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_report_bajaj_plain.php b/old_code_ci3/views/Lab_Panel/patient_lab_report_bajaj_plain.php
new file mode 100644
index 0000000..7d55c88
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_report_bajaj_plain.php
@@ -0,0 +1,60 @@
+
+
+
+ = $report_header ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ = nl2br($tech_name) ?>
+
+
+ = $docname ?>
+ = $docedu ?>
+
+
+
+
+
+= $complete_report ?>
+
+###################### END OF REPORT ######################
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_report_svh.php b/old_code_ci3/views/Lab_Panel/patient_lab_report_svh.php
new file mode 100644
index 0000000..9801e3f
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_report_svh.php
@@ -0,0 +1,74 @@
+
+
+ =$report_header?>
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =nl2br($tech_name)?>
+
+
+ =$docname?>
+ =nl2br($docedu)?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+=$complete_report?>
+
+###################### END OF REPORT ######################
+
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_report_svh_plain.php b/old_code_ci3/views/Lab_Panel/patient_lab_report_svh_plain.php
new file mode 100644
index 0000000..631d61a
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_report_svh_plain.php
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+
+
+
+
+
+= $report_header ?>
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ =$report_head?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =nl2br($tech_name)?>
+
+
+ =$docname?>
+ =$docedu?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+
+
+ =$report_head?>
+
+
+
+
+=$complete_report?>
+
+###################### END OF REPORT ######################
+
+
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_xray_report copy.php b/old_code_ci3/views/Lab_Panel/patient_lab_xray_report copy.php
new file mode 100644
index 0000000..ff5a87e
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_xray_report copy.php
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ =$report_head?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =nl2br($tech_name)?>
+
+
+ =$docname?>
+ =$docedu?>
+
+
+
+
+
+
+
+
+
+
+
+
+Note : Impression is a professional opinion. All modern machines/ Procedures have their limitations. If there is variance clinically this examination may be repeated of re-evaluated by other investigations. Not valid for medico-legal purpose.
+Any typing & technical error should be corrected within seven days. No compensation liability stands.
+
+=$complete_report?>
+###################### END OF REPORT ######################
+
+
diff --git a/old_code_ci3/views/Lab_Panel/patient_lab_xray_report_amh.php b/old_code_ci3/views/Lab_Panel/patient_lab_xray_report_amh.php
new file mode 100644
index 0000000..d64d00b
--- /dev/null
+++ b/old_code_ci3/views/Lab_Panel/patient_lab_xray_report_amh.php
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+
+
+ = H_Name ?>
+ = H_address_1 ?>, Uttarakhand
+
+
+
+
+
+
+
+
+
+
+
+
+ ---- Page Continue.. ----
+
+
+ Page : {PAGENO}/{nbpg}
+ = $report_head ?>
+
+
+
+
+ Note : Impression is a professional opinion. All modern machines/ Procedures have their limitations. If there is variance clinically this examination may be repeated of re-evaluated by other investigations. Not valid for medico-legal purpose.
+ Any typing & technical error should be corrected within seven days. No compensation liability stands.
+
+ = $report_header ?>
+= $complete_report ?>
+###################### END OF REPORT ######################
+
+
+
+
+
+
+ .
+
+
+
+
+
+
+
+
+
+
+
+
+ = nl2br($tech_name) ?>
+
+
+ = $docname ?>
+ = $docedu ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/LeftSide.php b/old_code_ci3/views/LeftSide.php
new file mode 100644
index 0000000..403bee4
--- /dev/null
+++ b/old_code_ci3/views/LeftSide.php
@@ -0,0 +1,107 @@
+
+
diff --git a/old_code_ci3/views/MasterData/emp_master_add.php b/old_code_ci3/views/MasterData/emp_master_add.php
new file mode 100644
index 0000000..3fcc23f
--- /dev/null
+++ b/old_code_ci3/views/MasterData/emp_master_add.php
@@ -0,0 +1,75 @@
+
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/MasterData/emp_master_edit.php b/old_code_ci3/views/MasterData/emp_master_edit.php
new file mode 100644
index 0000000..5be676f
--- /dev/null
+++ b/old_code_ci3/views/MasterData/emp_master_edit.php
@@ -0,0 +1,77 @@
+
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/MasterData/employee_master_list.php b/old_code_ci3/views/MasterData/employee_master_list.php
new file mode 100644
index 0000000..da6dfe6
--- /dev/null
+++ b/old_code_ci3/views/MasterData/employee_master_list.php
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+ Emp ID
+
+
+ Employee Name
+
+
+ Employee Phone No.
+
+
+ Action
+
+
+
+
+
+
+
+ = $row->emp_code ?>
+
+
+ = $row->emp_name ?>
+
+
+ = $row->emp_phone_no ?>
+
+
+ Edit
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/MasterData/location_master_add.php b/old_code_ci3/views/MasterData/location_master_add.php
new file mode 100644
index 0000000..6f026a2
--- /dev/null
+++ b/old_code_ci3/views/MasterData/location_master_add.php
@@ -0,0 +1,56 @@
+
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/MasterData/location_master_edit.php b/old_code_ci3/views/MasterData/location_master_edit.php
new file mode 100644
index 0000000..de56d70
--- /dev/null
+++ b/old_code_ci3/views/MasterData/location_master_edit.php
@@ -0,0 +1,56 @@
+
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/MasterData/tag_master.php b/old_code_ci3/views/MasterData/tag_master.php
new file mode 100644
index 0000000..e69de29
diff --git a/old_code_ci3/views/MasterData/tag_master_add.php b/old_code_ci3/views/MasterData/tag_master_add.php
new file mode 100644
index 0000000..fb51551
--- /dev/null
+++ b/old_code_ci3/views/MasterData/tag_master_add.php
@@ -0,0 +1,55 @@
+
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/MasterData/tag_master_index.php b/old_code_ci3/views/MasterData/tag_master_index.php
new file mode 100644
index 0000000..a46c280
--- /dev/null
+++ b/old_code_ci3/views/MasterData/tag_master_index.php
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+
+
+
+ ID
+
+
+ Tag Name
+
+
+ Tag Description
+
+
+ Insert Date
+
+
+ Insert By
+
+
+
+
+
+
+
+ = $row->id ?>
+
+
+ = $row->tag_name ?>
+
+
+ = $row->tag_desc ?>
+
+
+ = $row->insert_dateimte ?>
+
+
+ = $row->insert_by ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Dashboard.php b/old_code_ci3/views/Medical/Dashboard.php
new file mode 100644
index 0000000..155ca84
--- /dev/null
+++ b/old_code_ci3/views/Medical/Dashboard.php
@@ -0,0 +1,64 @@
+
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Draft_Med_Invoice.php b/old_code_ci3/views/Medical/Draft_Med_Invoice.php
new file mode 100644
index 0000000..f370029
--- /dev/null
+++ b/old_code_ci3/views/Medical/Draft_Med_Invoice.php
@@ -0,0 +1,128 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Draft_Med_Return_Invoice.php b/old_code_ci3/views/Medical/Draft_Med_Return_Invoice.php
new file mode 100644
index 0000000..30e274a
--- /dev/null
+++ b/old_code_ci3/views/Medical/Draft_Med_Return_Invoice.php
@@ -0,0 +1,132 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Drug_Details.php b/old_code_ci3/views/Medical/Drug_Details.php
new file mode 100644
index 0000000..c28e439
--- /dev/null
+++ b/old_code_ci3/views/Medical/Drug_Details.php
@@ -0,0 +1,110 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Drug_Details_all.php b/old_code_ci3/views/Medical/Drug_Details_all.php
new file mode 100644
index 0000000..0580736
--- /dev/null
+++ b/old_code_ci3/views/Medical/Drug_Details_all.php
@@ -0,0 +1,46 @@
+
+
+
+
+
+
+
+ Item Code
+ Item Name
+ Dosage
+ Formulation
+ Therapeutic
+ subtherapeutic
+ MRF Name
+ MRP
+
+
+
+
+
+ =$drug_data[$i]->item_id ?>
+ =$drug_data[$i]->itemname ?>
+ =$drug_data[$i]->dosage ?>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Drug_Stock.php b/old_code_ci3/views/Medical/Drug_Stock.php
new file mode 100644
index 0000000..52319c4
--- /dev/null
+++ b/old_code_ci3/views/Medical/Drug_Stock.php
@@ -0,0 +1,123 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Drug_Stock_Add.php b/old_code_ci3/views/Medical/Drug_Stock_Add.php
new file mode 100644
index 0000000..4af98e9
--- /dev/null
+++ b/old_code_ci3/views/Medical/Drug_Stock_Add.php
@@ -0,0 +1,292 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ Quantity(Total Tables(s))
+
+
+
+
+
+
+
+
+
+
+ Supplier
+
+ sid.' '.combo_checked($row->sid,$drug_item[0]->supplier_id).' >'.$row->name_supplier.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Item Code
+ Item Name
+ Formulation
+ Storage/Shelf/Rack No.
+ Batch No.
+ Qty /Sale Qty
+ Expiry
+ MRP
+ Rate/Unit
+
+
+
+
+
+ =$drug_stock_item[$i]->item_code ?>
+ =$drug_stock_item[$i]->item_name ?>
+ =$drug_stock_item[$i]->formulation ?>
+ =$drug_stock_item[$i]->cold_storage ?>/=$drug_stock_item[$i]->shelf_no ?>/=$drug_stock_item[$i]->rack_no ?>
+ =$drug_stock_item[$i]->batch_no ?>
+ =$drug_stock_item[$i]->total_unit ?> / =$drug_stock_item[$i]->total_sale_unit ?>
+ =$drug_stock_item[$i]->expiry_date ?>
+ =$drug_stock_item[$i]->mrp ?>
+ =$drug_stock_item[$i]->unit_rate ?>
+
+
+
+
+
+ Item Code
+ Item Name
+ Formulation
+ Storage/Shelf/Rack No.
+ Batch No.
+ Qty /Sale Qty
+ Expiry
+ MRP
+ Rate/Unit
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/IPD_return_medicine.php b/old_code_ci3/views/Medical/IPD_return_medicine.php
new file mode 100644
index 0000000..41d0a49
--- /dev/null
+++ b/old_code_ci3/views/Medical/IPD_return_medicine.php
@@ -0,0 +1,207 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Invoice_OLD_Master.php b/old_code_ci3/views/Medical/Invoice_OLD_Master.php
new file mode 100644
index 0000000..d4250b4
--- /dev/null
+++ b/old_code_ci3/views/Medical/Invoice_OLD_Master.php
@@ -0,0 +1,200 @@
+
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ ipd_id > 0) { ?>
+
+
+
+ case_id > 0) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Invoice_med_list.php b/old_code_ci3/views/Medical/Invoice_med_list.php
new file mode 100644
index 0000000..2e4a36c
--- /dev/null
+++ b/old_code_ci3/views/Medical/Invoice_med_list.php
@@ -0,0 +1,117 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Med_Item_List.php b/old_code_ci3/views/Medical/Med_Item_List.php
new file mode 100644
index 0000000..bf8d1b2
--- /dev/null
+++ b/old_code_ci3/views/Medical/Med_Item_List.php
@@ -0,0 +1,112 @@
+item_code);
+ }
+
+
+?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Med_Item_old_list.php b/old_code_ci3/views/Medical/Med_Item_old_list.php
new file mode 100644
index 0000000..0367288
--- /dev/null
+++ b/old_code_ci3/views/Medical/Med_Item_old_list.php
@@ -0,0 +1,46 @@
+
diff --git a/old_code_ci3/views/Medical/Med_Model_Payment.php b/old_code_ci3/views/Medical/Med_Model_Payment.php
new file mode 100644
index 0000000..0c18aef
--- /dev/null
+++ b/old_code_ci3/views/Medical/Med_Model_Payment.php
@@ -0,0 +1,326 @@
+
+
+
+
+
+
+
+
Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+ / IPD Code :
+
+ =$ipd_info[0]->ipd_code ?>
+
+ / No of Days : =$ipd_info[0]->no_days?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Payment Details
+
+
+ Pay.No.
+ Mode
+ Date
+ Amount
+
+
+
+
+
+ =$row->id?>
+
+
+ =$row->Payment_type_str?>
+
+
+ =$row->str_payment_date?>
+
+
+ =$row->paid_amount?>
+
+
+
+
+
+
+ 0) { ?>
+
+ Pharmacy Bill Amount :
+ Rs. =$inv_med_group[0]->net_amount ?>
+ Total Amount Paid : Rs. =$inv_med_group[0]->payment_received ?>
+
+ Balance Amount :
+ Rs. =Round($inv_med_group[0]->payment_balance) ?>
+ Print Cash
+
+
+
+
+ >
+
+ Send SMS !
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Med_Payment.php b/old_code_ci3/views/Medical/Med_Payment.php
new file mode 100644
index 0000000..07d28f6
--- /dev/null
+++ b/old_code_ci3/views/Medical/Med_Payment.php
@@ -0,0 +1,308 @@
+
+
+
+
+
Name : =$person_info[0]->p_fname?> {=$person_info[0]->p_rname?> }
+ / Age : =$person_info[0]->age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+ / IPD Code : =$ipd_info[0]->ipd_code?>
+ / No of Days : =$ipd_info[0]->no_days?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Med_Payment_Receipt.php b/old_code_ci3/views/Medical/Med_Payment_Receipt.php
new file mode 100644
index 0000000..9002247
--- /dev/null
+++ b/old_code_ci3/views/Medical/Med_Payment_Receipt.php
@@ -0,0 +1,113 @@
+
+
+
+
+
+
+ =M_store?>
+ =M_address?>, Uttarakhand
+ ';
+
+ if(H_Med_GST!='')
+ {
+ echo 'GST: '.H_Med_GST .' ';
+ }
+
+ if(M_LIC!='')
+ {
+ echo ' L.No: '.M_LIC;
+ }
+ ?>
+
+
+ p_fname.':IPD-'.$ipd_master[0]->ipd_code .':P-'.date('Y-m-d H:i:s');
+ ?>
+
+
+
+
+
+Payment Receipt
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipd_master[0]->ipd_code ?> / UHID:=$ipd_master[0]->p_code ?> /Name : =$ipd_master[0]->p_fname ?>
+
+
+
+
+ To :
+ =$ipd_master[0]->p_fname ?>
+ Patient Info. as per Hospital Records
+ UHID ID : =$ipd_master[0]->p_code ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+ Phone No. : =$ipd_master[0]->mphone1 ?> , =$ipd_master[0]->P_mobile1 ?> , =$ipd_master[0]->P_mobile2 ?>
+ Address : =$ipd_master[0]->add1 ?> , =$ipd_master[0]->add2 ?> , =$ipd_master[0]->city ?> , =$ipd_master[0]->district ?> , =$ipd_master[0]->state ?>
+ Refer By : =$ipd_master[0]->doc_name ?>
+ org_id>0) { ?>
+ Org. Code : =$orgcase[0]->case_id_code ?>
+ Org. Name : =$orgcase[0]->insurance_company_name ?>
+
+
+
+
+ Pay.No.
+ Mode
+ Date
+ Amount
+
+ '.$row->id.' '.$row->Payment_type_str.' '.$row->str_payment_date.' '.$row->amount.' ';
+
+ }
+ ?>
+
+
+
+0) { ?>
+ Pharmacy Bill Amount at the Time of Print Receipt :
+ Rs. =$inv_med_group[0]->net_amount ?>
+ Total Amount Paid : Rs. =$inv_med_group[0]->payment_received ?>
+ net_amount-$inv_med_group[0]->payment_received;
+
+ ?>
+ Balance Amount : Rs. =Round($balance_amount)?>
+ Print Time : =date('d-m-Y H:i:s') ?>
+
+
+
+
+
+
+
+
+ For =M_store?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Med_Return_Invoice_search.php b/old_code_ci3/views/Medical/Med_Return_Invoice_search.php
new file mode 100644
index 0000000..5e10f8b
--- /dev/null
+++ b/old_code_ci3/views/Medical/Med_Return_Invoice_search.php
@@ -0,0 +1,67 @@
+
+Search By Phone No. (Complete 10 Digit Phone No.)
+
+
+
+ By Phone No
+
+
+
+Search By UHID (Type Last 5 to 6 Digit of UHID/Patient ID)
+
+
+
+ By UHID
+
+
+
+Search By Invoice Code (Type Last 5 to 6 Digit of invoice)
+
+
+
+ By Invoice No
+
+
+
+Search By Product
+
+
+
+ By Product
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Med_back_Panel.php b/old_code_ci3/views/Medical/Med_back_Panel.php
new file mode 100644
index 0000000..368273f
--- /dev/null
+++ b/old_code_ci3/views/Medical/Med_back_Panel.php
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Med_old_invoice_list.php b/old_code_ci3/views/Medical/Med_old_invoice_list.php
new file mode 100644
index 0000000..dafd864
--- /dev/null
+++ b/old_code_ci3/views/Medical/Med_old_invoice_list.php
@@ -0,0 +1,65 @@
+
diff --git a/old_code_ci3/views/Medical/Medical_Final_Invoice.php b/old_code_ci3/views/Medical/Medical_Final_Invoice.php
new file mode 100644
index 0000000..0d7e0a3
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_Final_Invoice.php
@@ -0,0 +1,471 @@
+
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ #
+ Item code
+ Item Name
+ Formulation
+ Batch No
+ Exp.
+ Rate
+ Qty.
+ Gross
+ Disc.
+ HSNCODE/C-SGST
+ CGST
+ SGST
+ Net Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_code.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->disc_whole.' ';
+ echo ''.$row->HSNCODE.' ';
+ echo ''.$row->CGST.' ';
+ echo ''.$row->SGST.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo ''.$row->update_by_remark.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+ Gross Total
+ =$invoiceMaster[0]->gross_amount ?>
+ =$invoiceMaster[0]->inv_disc_total?>
+
+ =$invoiceMaster[0]->CGST_Tamount?>
+ =$invoiceMaster[0]->SGST_Tamount?>
+ =$invoiceMaster[0]->net_amount?>
+
+
+
+ group_invoice_id==0) { ?>
+
+
+
+
+
+ #
+ Amount received : =$invoiceMaster[0]->payment_received?>
+ id.':'.$row->Payment_type_str.':'.$row->amount.':'.$row->payment_date.'] ';
+ }
+ ?>
+
+ Balance Amount : =$invoiceMaster[0]->payment_balance?>
+ Net Amount : =$invoiceMaster[0]->net_amount?>
+
+
+ payment_balance<>0 && $invoiceMaster[0]->payment_balance>0) { ?>
+ Balance Adjust Amt.: Rs =$invoiceMaster[0]->payment_balance?>
+
+
+
+
+
+
+
+ payment_balance<>0) { ?>
+
+
+
+
+
+ Received Amount
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_Invoice_Return.php b/old_code_ci3/views/Medical/Medical_Invoice_Return.php
new file mode 100644
index 0000000..3efdece
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_Invoice_Return.php
@@ -0,0 +1,212 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_Invoice_Return_V.php b/old_code_ci3/views/Medical/Medical_Invoice_Return_V.php
new file mode 100644
index 0000000..b02b1fc
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_Invoice_Return_V.php
@@ -0,0 +1,294 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_Invoice_Return_list.php b/old_code_ci3/views/Medical/Medical_Invoice_Return_list.php
new file mode 100644
index 0000000..feda1ba
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_Invoice_Return_list.php
@@ -0,0 +1,45 @@
+
+
+
+ #
+ Inv-Date
+ Item Name
+ Batch No
+ Exp.
+ Rate
+ Saved Qty.
+ Price
+ Disc.
+ Amount
+ Return Qty.
+ Update
+
+
+
+ item_id.'">';
+ echo ''.$srno.' ';
+ echo ''.$row->str_inv_date.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->disc_amount.' ';
+ echo ''.$row->tamount.' ';
+ echo ''.$row->r_qty.' ';
+ echo '
+
+
+ ';
+ echo '';
+ }
+ ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_Invoice_Return_pre.php b/old_code_ci3/views/Medical/Medical_Invoice_Return_pre.php
new file mode 100644
index 0000000..b2cd43c
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_Invoice_Return_pre.php
@@ -0,0 +1,148 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ #
+ Inv-Date
+ Item Name
+ Batch No
+ Exp.
+ Rate
+ Old Qty.
+ Return Qty.
+ Price
+ Disc.
+ Amount
+
+
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->str_inv_date.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->r_qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->disc_amount.' ';
+ echo ''.$row->tamount.' ';
+ echo '';
+
+ $tAmount=$tAmount+$row->amount;
+ }
+
+ echo '
+
+
+
+
+
+
+
+
+
+
+ Total
+ '.$tAmount.'
+
+
+ ';
+
+ ?>
+
+
+
+ ';
+ echo ' ';
+ ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_Invoice_Return_print.php b/old_code_ci3/views/Medical/Medical_Invoice_Return_print.php
new file mode 100644
index 0000000..74fea91
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_Invoice_Return_print.php
@@ -0,0 +1,142 @@
+
+
+
+
+
+ =M_store?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =M_store?>
+
+
=M_address?>
+ =M_Phone_Number?>
+ GST: =H_Med_GST?> / L.No: DEMO LIC
+
+
+
+
+
Return Medicine List
+
+
+
+ To
+
+ =$person_info[0]->p_fname ?>
+ Patient ID : =$person_info[0]->p_code ?>
+ Refer By : =$ipd_master[0]->doc_name ?>
+
+
+
+
+
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+
+
+
+
+
+
+
+
+
+ Sr.No.
+ Return Date
+ Inv.Code.
+ Item Name
+ Batch No.
+ Expiry
+ Rate
+ Old Qty.
+ Return Qty.
+ Amount
+ Update By
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->return_date_time.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->r_qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->update_remark.' ';
+ echo '';
+ $tAmount=$tAmount+$row->amount;
+ }
+
+ echo '
+
+
+
+
+
+
+
+
+ Total
+ '.$tAmount.'
+
+ ';
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ For Krishna Pharmacy
+
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Medical_Invoice_V copy.php b/old_code_ci3/views/Medical/Medical_Invoice_V copy.php
new file mode 100644
index 0000000..b7bfd32
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_Invoice_V copy.php
@@ -0,0 +1,567 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_Invoice_V.php b/old_code_ci3/views/Medical/Medical_Invoice_V.php
new file mode 100644
index 0000000..f690f50
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_Invoice_V.php
@@ -0,0 +1,627 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Disc %
+ ipd_id > 0){
+ $readonly="Readonly";
+ }else{
+ $readonly="Readonly";
+ }
+ ?>
+ />
+
+
+
+
+
+
+
+
+
+
+
+ ipd_id == 0){ ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_invoice_list.php b/old_code_ci3/views/Medical/Medical_invoice_list.php
new file mode 100644
index 0000000..67541b5
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_invoice_list.php
@@ -0,0 +1,353 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
IPD Code :
+
+ =$ipd_master[0]->ipd_code?>
+
+
Admit Date : =$ipd_list[0]->str_register_date ?> =$ipd_list[0]->reg_time ?> /
+
Discharge Date : =$ipd_list[0]->str_discharge_date ?> =$ipd_list[0]->discharge_time ?> /
+
No. of Days : no_days==0) {echo '1';} else {echo $ipd_list[0]->no_days; } ?> /
+ 0){ ?>
+
Bed No : =$bed_list[0]->bed_no ?> =$bed_list[0]->room_name ?>
+
+
/ Doctor : =$ipd_list[0]->doc_name?>
+
/ Status : =$ipd_list[0]->Disstatus?>
+
+
+
+ case_id>0) { ?>
+
+
+ Organisation Code # =$orgcase[0]->case_id_code?> /
+ Organisation : =$insurance[0]->ins_company_name?>
+
+
+
+
+
+
+
+
+ #
+ Invoice ID.
+ Inv.Date
+ Inv.Desc
+ Credit/Cash
+ Package
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->inv_date.' ';
+ echo ''.$row->remark_ipd.' ';
+ echo ''.$row->credit.' ';
+ echo ''.$row->Package.' ';
+ echo ''.$row->net_amount.' ';
+ echo '';
+ if($ipd_master[0]->ipd_status==0 || $this->ion_auth->in_group('admin'))
+ {
+ echo 'Edit ';
+ if($row->group_invoice_id==0 && $row->ipd_credit==0 )
+ {
+ echo 'Group ';
+ }
+ }
+
+ echo ' Print ';
+
+ echo ' ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+ Invoice ID.
+ Inv.Date
+ Inv.Desc
+ Credit/Cash
+ Package
+ Amount
+
+
+
+
+
+
+
+
+
+
+ Total Cash : =$inv_master_total[0]->cash_netAmount ?>
+
+
+
+
+
+ Total Credit : =$inv_master_total[0]->IPDCrAmount ?>
+
+
+
+
+
+ Total Package : =$inv_master_total[0]->PackageCrAmount ?>
+
+
+
+
+
+ Total Amount : =$inv_master_total[0]->t_net_amount ?>
+
+
+
+
+
+ Total Balance : =$inv_master_total[0]->t_payment_balance ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_invoice_print.php b/old_code_ci3/views/Medical/Medical_invoice_print.php
new file mode 100644
index 0000000..3d089c9
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_invoice_print.php
@@ -0,0 +1,174 @@
+
+
+
+
+
+ =M_store?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =M_store?>
+
+
=M_address?>
+ =M_Phone_Number?>
+ GST: =H_Med_GST?> / L.No: DEMO 1/USN/JAN/2008
+
CASH / Credit Memo
+
+
+
+
+
+
+
+
+
+
+ To
+
+ =$invoice_master[0]->inv_name ?>
+ Date : =$invoice_master[0]->inv_date ?>
+ Patient ID : =$invoice_master[0]->patient_code ?>
+
+
+
+
+
+ Refer By : =$invoice_master[0]->doc_name ?>
+ ipd_id>0) { ?>
+ IPD Code : =$invoice_master[0]->ipd_code ?>
+
+ case_id>0) { ?>
+ Org. Code : =$orgcase[0]->case_id_code ?>
+ Org. Name : =$orgcase[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ Rate
+ Qty.
+ Price
+ Disc.
+ HSNCODE/GST
+ GST
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' ['.$row->formulation.'] ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->disc_amount.' ';
+ echo ''.$row->HSNCODE.'/'.$row->gst_per.' ';
+ echo ''.$row->gst.' ';
+ echo ''.$row->tamount.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal ?>
+ =$invoiceGtotal[0]->t_dis_amt?>
+
+ =$invoiceGtotal[0]->TGST?>
+ =$invoiceGtotal[0]->tamt?>
+
+
+
+
+
+
+
+ #
+ Deduction :[=$invoice_master[0]->discount_remark ?>] =$invoice_master[0]->discount_amount?>
+ CGST : =$invoiceGtotal[0]->TCGST?>
+ SGST : =$invoiceGtotal[0]->TSGST?>
+ Net Amount : =$invoice_master[0]->net_amount?>
+ Amount received : =$invoice_master[0]->payment_received?>
+ Balance Amount : =$invoice_master[0]->payment_balance?>
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+
+
+ Signature
+
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Medical_invoice_print_1.php b/old_code_ci3/views/Medical/Medical_invoice_print_1.php
new file mode 100644
index 0000000..7724788
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_invoice_print_1.php
@@ -0,0 +1,176 @@
+
+
+
+
+
+
=M_store?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ From
+ =M_store?>
+ =M_address?>
+ =M_Phone_Number?>
+
+
Invoice ID #=$invoice_master[0]->inv_med_code ?>
+
GST : =H_Med_GST?>
+
+
+
+ To
+
+ =$invoice_master[0]->inv_name ?>
+ Date : =$invoice_master[0]->inv_date ?>
+ Patient ID : =$invoice_master[0]->patient_code ?>
+ Refer By : =$invoice_master[0]->doc_name ?>
+ ipd_id>0) { ?>
+ IPD Code : =$invoice_master[0]->ipd_code ?>
+
+ case_id>0) { ?>
+ Org. Code : =$orgcase[0]->case_id_code ?>
+ Org. Name : =$orgcase[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Formulation
+ Batch No
+ Exp.
+ Rate
+ Qty.
+ Price
+ Disc.
+ HSNCODE/C-SGST
+ CGST
+ SGST
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->disc_amount.' ';
+ echo ''.$row->HSNCODE.'/'.$row->CGST_per.'/'.$row->SGST_per.' ';
+ echo ''.$row->CGST.' ';
+ echo ''.$row->SGST.' ';
+ echo ''.$row->tamount.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal ?>
+ =$invoiceGtotal[0]->t_dis_amt?>
+
+ =$invoiceGtotal[0]->TCGST?>
+ =$invoiceGtotal[0]->TSGST?>
+ =$invoiceGtotal[0]->tamt?>
+
+
+ #
+ Deduction
+ =$invoice_master[0]->discount_remark ?>
+ =$invoice_master[0]->discount_amount ?>
+
+
+
+ #
+ Amount received : =$invoice_master[0]->payment_received?>
+ Balance Amount : =$invoice_master[0]->payment_balance?>
+ Net Amount : =$invoice_master[0]->net_amount?>
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+
+
+ Signature
+
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Medical_invoice_print_2.php b/old_code_ci3/views/Medical/Medical_invoice_print_2.php
new file mode 100644
index 0000000..034fc02
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_invoice_print_2.php
@@ -0,0 +1,172 @@
+
+
+
+
+
+
=M_store?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =M_store?>
+
+
=M_address?>
+ =M_Phone_Number?>
+ GST: =H_Med_GST?> / L.No: DEMO 1/USN/JUNE/2008
+
+
+
+
+
CASH / Credit Memo
+
+
+
+ To
+
+ =$invoice_master[0]->inv_name ?>
+ Patient ID : =$invoice_master[0]->patient_code ?>
+ Refer By : =$invoice_master[0]->doc_name ?>
+
+
+
+
+
+ Medical Invoice : =$invoice_master[0]->inv_med_code ?>
+ Invoice Date : =MysqlDate_to_str($invoice_master[0]->inv_date) ?>
+
+
+
+
+
+ ipd_id>0) { ?>
+ IPD Code : =$invoice_master[0]->ipd_code ?>
+
+ case_id>0) { ?>
+ Org. Code : =$orgcase[0]->case_id_code ?>
+ Org. Name : =$orgcase[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ Rate
+ Qty.
+ Price
+ Disc.
+ HSNCODE/GST
+ GST
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ echo ''.$row->HSNCODE.'/'.$row->gst_per.' ';
+ echo ''.$row->gst.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoice_master[0]->gross_amount ?>
+ =$invoice_master[0]->inv_disc_total?>
+
+ =$invoice_master[0]->TGST?>
+ =$invoice_master[0]->net_amount?>
+
+
+
+
+
+
+
+ #
+ Deduction :[=$invoice_master[0]->discount_remark ?>] =$invoice_master[0]->inv_disc_total?>
+ CGST : =$invoice_master[0]->CGST_Tamount?>
+ SGST : =$invoice_master[0]->SGST_Tamount?>
+ Taxable Amount : =$invoice_master[0]->TaxableAmount?>
+ Net Amount : =$invoice_master[0]->net_amount?>
+ Amount received : =$invoice_master[0]->payment_received?>
+ Balance Amount : =$invoice_master[0]->payment_balance?>
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+
+
+ Signature
+
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Medical_invoice_print_all.php b/old_code_ci3/views/Medical/Medical_invoice_print_all.php
new file mode 100644
index 0000000..46a1b60
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_invoice_print_all.php
@@ -0,0 +1,191 @@
+
+
+
+
+
+
=M_store?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =M_store?>
+
+
=M_address?>
+ =M_Phone_Number?>
+ GST: =H_Med_GST?> / L.No: DEMO 1/USN/JUNE/2008
+
+
+
+
+
+
CASH / Credit Memo
+
+
+
+ To
+
+ =$ipd_master[0]->p_fname ?>
+ Patient ID : =$ipd_master[0]->p_code ?>
+ Refer By : =$ipd_master[0]->doc_name ?>
+
+
+
+
+
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+ org_id>0) { ?>
+ Org. Code : =$orgcase[0]->case_id_code ?>
+ Org. Name : =$orgcase[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+
+ id=='' && $row->inv_med_id != '')
+ {
+ echo '';
+ echo '# ';
+ echo 'Invoice Total : '.$row->inv_med_code.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ echo ' ';
+ echo ''.$row->gst.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+
+ $head_start=0;
+ }
+ elseif($row->id=='' && $row->inv_med_id == ''){
+ echo ' ';
+ echo '';
+ echo '# ';
+ echo 'Grand Total ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ echo ' ';
+ echo ''.$row->gst.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+ }else{
+
+ if($head_start==0)
+ {
+ echo ' ';
+
+ echo 'Invoice ID : '.$row->inv_med_code.' [Dated : '.$row->str_inv_date.' ] ';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Price ';
+ echo 'Disc. ';
+ echo 'HSNCODE/GST ';
+ echo 'GST ';
+ echo 'Amount ';
+ echo ' ';
+ }
+
+ $srno=$srno+1;
+ $head_start=$head_start+1;
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ echo ''.$row->HSNCODE.'/'.$row->gst_per.' ';
+ echo ''.$row->gst.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+ }
+ }
+ ?>
+
+
+
+
+
+ 0) { ?>
+
+
+
+ #
+ Deduction : =$inv_med_group[0]->discount_group?>
+ CGST : =$inv_med_group[0]->CGST_Tamount?>
+ SGST : =$inv_med_group[0]->SGST_Tamount?>
+ Taxable Amount : =$inv_med_group[0]->TaxableAmount?>
+ Net Amount : =$inv_med_group[0]->net_amount?>
+ Amount received : =$inv_med_group[0]->payment_received?>
+ Balance Amount : =$inv_med_group[0]->payment_balance?>
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ For Krishna Pharmacy
+
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Medical_invoice_print_all_provisional.php b/old_code_ci3/views/Medical/Medical_invoice_print_all_provisional.php
new file mode 100644
index 0000000..507dc10
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_invoice_print_all_provisional.php
@@ -0,0 +1,173 @@
+
+
+
+
+
+
=M_store?> | Provisional Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =M_store?>
+
+
=M_address?>
+ =M_Phone_Number?>
+ GST: =H_Med_GST?> / L.No: OBR 1/NTL/AUG/2004 / BR 1/NTL/AUG/2004
+
+
+
+
+
+
Provisional CASH / Credit Memo
+
+
+
+ To
+
+ =$ipd_master[0]->p_fname ?>
+ Patient ID : =$ipd_master[0]->p_code ?>
+ Refer By : =$ipd_master[0]->doc_name ?>
+
+
+
+
+
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+ org_id>0) { ?>
+ Org. Code : =$orgcase[0]->case_id_code ?>
+ Org. Name : =$orgcase[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+
+ id=='' && $row->inv_med_id != '')
+ {
+ echo '';
+ echo '# ';
+ echo 'Invoice Total : '.$row->inv_med_code.' ';
+ echo ''.$row->amount.' ';
+ echo ' ';
+
+ $head_start=0;
+ }
+ elseif($row->id=='' && $row->inv_med_id == ''){
+ echo ' ';
+ echo '';
+ echo '# ';
+ echo 'Grand Total ';
+ echo ''.$row->amount.' ';
+ echo ' ';
+ }else{
+
+ if($head_start==0)
+ {
+ echo ' ';
+
+ echo '[Dated : '.$row->str_inv_date.' ] ';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Price ';
+ echo ' ';
+ }
+
+ $srno=$srno+1;
+ $head_start=$head_start+1;
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ' ';
+ }
+ }
+ ?>
+
+
+
+
+
+ 0) { ?>
+
+
+
+ #
+ Gross Amount : =$inv_med_group[0]->gross_amount?>
+ Deduction : =$inv_med_group[0]->discount_group?>
+ Net Amount : =$inv_med_group[0]->net_amount?>
+ Amount received : =$inv_med_group[0]->payment_received?>
+ Balance Amount : =$inv_med_group[0]->payment_balance?>
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ For Krishna Pharmacy
+
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Medical_ipd_org_list.php b/old_code_ci3/views/Medical/Medical_ipd_org_list.php
new file mode 100644
index 0000000..65d0f8a
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_ipd_org_list.php
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Bed No.[Type]
+ Register Date
+ No. of Days
+ Dr. Name
+ Admit Type
+ Amount
+
+
+
+
+
+
+
+ =$data[$i]->ipd_code ?>
+
+
+ [=$data[$i]->p_code ?>] =$data[$i]->p_fname ?> =$data[$i]->p_rname ?>
+ =$data[$i]->Bed_Desc ?>
+ =$data[$i]->str_register_date ?>
+ =$data[$i]->no_days ?>
+ =$data[$i]->doc_name ?>
+ =$data[$i]->admit_type ?> =$data[$i]->Org_Status ?>
+ M:=$data[$i]->med_amount ?>
+
+
+
+
+
+ IPD Code
+ Name/Patient Code
+ Register Date
+ Admit Type
+ Amount
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Medical_org_invoicelist.php b/old_code_ci3/views/Medical/Medical_org_invoicelist.php
new file mode 100644
index 0000000..2832d44
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_org_invoicelist.php
@@ -0,0 +1,97 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ #
+ Invoice ID.
+ Patient
+ Inv.Date
+ Inv.Desc
+ Credit/Cash
+ Amount
+ Balance
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->inv_name.' ';
+ echo ''.$row->inv_date.' ';
+ echo ''.$row->remark_ipd.' ';
+ echo ''.$row->credit.' ';
+ echo ''.$row->net_amount.' ';
+ echo ''.$row->payment_balance.' ';
+ echo '
+
+ Print
+ Edit ';
+ $srno=$srno+1;
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Medical_org_list.php b/old_code_ci3/views/Medical/Medical_org_list.php
new file mode 100644
index 0000000..22059a3
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_org_list.php
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+ ORG Code
+ Name/Patient Code
+ Register Date
+ Insurance Company
+
+
+
+
+
+
+
+
+ =$row->case_id_code ?>
+
+
+ [=$row->p_code ?>] =$row->p_fname ?> =$row->p_rname ?>
+ =$row->str_register_date ?>
+ =$row->insurance_company_name ?>
+
+
+
+
+
+ ORG Code
+ Name/Patient Code
+ Register Date
+ Insurance Company
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Medical_stock_drug.php b/old_code_ci3/views/Medical/Medical_stock_drug.php
new file mode 100644
index 0000000..3c8afae
--- /dev/null
+++ b/old_code_ci3/views/Medical/Medical_stock_drug.php
@@ -0,0 +1,116 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Patient_Search_Result.php b/old_code_ci3/views/Medical/Patient_Search_Result.php
new file mode 100644
index 0000000..e4617e2
--- /dev/null
+++ b/old_code_ci3/views/Medical/Patient_Search_Result.php
@@ -0,0 +1,48 @@
+
+
+
+
+
+
+
+
+ Sr.No.
+ Patient/UHID Code
+ Name {Relative Name}
+ Age
+ Last Visit
+ Phone No.
+ Insurance
+ Action
+
+
+
+
+
+ =$i+1?>
+ =$data[$i]->p_code ?>
+ =$data[$i]->p_fname ?> {=$data[$i]->p_rname ?>}
+ =$data[$i]->age ?>
+ =$data[$i]->Last_Visit ?>
+ =$data[$i]->mphone1 ?>
+ insurance_id==0 ? 'Self': 'Insuranced'); ?>
+ Sale
+
+
+
+
+
+ Patient Code
+ Name
+ Phone Number
+ EMail
+ Action
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Print/Medical_return_medicine.php b/old_code_ci3/views/Medical/Print/Medical_return_medicine.php
new file mode 100644
index 0000000..59f8404
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/Medical_return_medicine.php
@@ -0,0 +1,128 @@
+
+
+
+
+
+
+ =M_store?>
+ =M_address?>
+
+
+
+
+ =$person_info[0]->p_fname ?>
+ Patient ID : =$person_info[0]->p_code ?>
+
+
+
+
+
+Return Medicine
+
+
+
+
+ $row->str_ret_date)
+ {
+ if($date_str<>"")
+ {
+ echo '';
+ echo '# ';
+ echo 'Day Total : '.$date_str.' ';
+ echo ''.number_format(round($dAmount),2).' ';
+ echo '# ';
+ echo ' ';
+ echo '';
+ echo ' ';
+ echo ' ';
+ }
+
+ $dAmount=0;
+
+ echo '
+ Return Date : '.$row->str_ret_date.' ';
+ echo '';
+ echo 'Sr.No. ';
+ echo 'Invoice Date ';
+ echo 'Inv.Code. ';
+ echo 'Item Name ';
+ echo 'Rate ';
+ echo 'Old Qty. ';
+ echo 'Return Qty. ';
+ echo 'Amount ';
+ echo 'Update By ';
+ echo ' ';
+ }
+
+ $srno=$srno+1;
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->str_inv_date.' ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->r_qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->update_remark.' ';
+ echo ' ';
+ $tAmount=$tAmount+$row->amount;
+ $dAmount=$dAmount+$row->amount;
+ $date_str=$row->str_ret_date;
+
+ if($total_rec==$srno)
+ {
+ echo '';
+ echo '# ';
+ echo 'Day Total ';
+ echo ''.number_format(round($dAmount),2).' ';
+ echo '# ';
+ echo ' ';
+ echo '';
+ echo ' ';
+ echo ' ';
+ }
+ }
+
+ echo '';
+ echo '# ';
+ echo 'Grand Total ';
+ echo ''.number_format(round($tAmount),2).' ';
+ echo '# ';
+ echo ' ';
+
+ ?>
+
+
diff --git a/old_code_ci3/views/Medical/Print/Medicine_List.php b/old_code_ci3/views/Medical/Print/Medicine_List.php
new file mode 100644
index 0000000..89c52d0
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/Medicine_List.php
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipd_master[0]->ipd_code ?> / UHID:=$ipd_master[0]->p_code ?> /Name : =$ipd_master[0]->p_fname ?>
+
+
+
+
+
+
+ Medicine Prescription
+
+
+
+ Rx
+
+ Patient Info.
+ =$ipd_master[0]->p_fname ?>
+ UHID ID : =$ipd_master[0]->p_code ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+
+
+
+
+
+
+ str_inv_date<>$inv_date){
+ if(($srno % 2)==0 && $srno<>1){
+ echo ' ';
+ }
+ $srno=1;
+ echo '
+ ..
+ ';
+ echo 'Dated : '.$row->str_inv_date.' ';
+ }
+
+ if(($srno % 2)==1)
+ {
+ echo '';
+ }
+
+ echo ''.$srno.' : '
+ . $row->formulation . ' ' . $row->item_Name . ' (' . $row->genericname . ' ) /Qty :'
+ .$row->tot_qty.' ';
+
+ if(($srno % 2)==0){
+ echo ' ';
+ }
+
+ $inv_date=$row->str_inv_date;
+ }
+
+
+
+ ?>
+
+
+ =$doc_list_sign?>
+
diff --git a/old_code_ci3/views/Medical/Print/Medicine_consolidated_List.php b/old_code_ci3/views/Medical/Print/Medicine_consolidated_List.php
new file mode 100644
index 0000000..7970ccf
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/Medicine_consolidated_List.php
@@ -0,0 +1,101 @@
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:= $ipd_master[0]->ipd_code ?> / UHID:= $ipd_master[0]->p_code ?> /Name : = $ipd_master[0]->p_fname ?>
+
+
+
+
+
Consolidated Summary of Medicine, Disposal & Sundries Used
+
+
+
+
+ Patient Info.
+
+
+ Treating Consultant / Authorized Team Doctor
+
+
+
+
+ = $ipd_master[0]->p_fname ?> UHID ID : = $ipd_master[0]->p_code ?> IPD Code : = $ipd_master[0]->ipd_code ?>
+
+
+ =$doc_list?>
+
+
+
+
+
+
Medicine Name
+
+
+
+ Sr.No.
+ Medicine Name
+ Qty
+
+
+
+ ';
+ echo '' . $srno . ' ';
+ echo '' . $row->formulation . ' ' . $row->item_Name . ' (' . $row->genericname . ' ) ';
+ echo '', $row->i_qty_total, ' ';
+ echo '';
+ }
+ ?>
+
+
+
+
Disposal & Sundries
+
+
+
+
+ Sr.No.
+ Disposal & Sundries
+ Qty
+
+
+
+ ';
+ echo '' . $srno . ' ';
+ echo '' . $row->formulation . ' ' . $row->item_Name . ' ';
+ echo '', $row->i_qty_total, ' ';
+ echo '';
+ }
+ ?>
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Print/medical_bill_print_a5.php b/old_code_ci3/views/Medical/Print/medical_bill_print_a5.php
new file mode 100644
index 0000000..c0fcbef
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_bill_print_a5.php
@@ -0,0 +1,220 @@
+
+
+
+
+
+
+
+
+
+ = M_store ?>
+ = M_address ?>
+
+
+
+
+ Invoice To :
+ = $invoice_med_master[0]->inv_name ?>
+ customer_type == 0) { ?>
+ Phone No. : = $invoice_med_master[0]->inv_phone_number ?>
+ doc_name != '') { ?>
+ Refer By : = $invoice_med_master[0]->doc_name ?>
+
+
+ customer_type == 1 && count($patient_master) > 0) { ?>
+ Patient Info. as per Hospital Records
+ UHID ID : = $patient_master[0]->p_code ?>
+
+ ipd_id > 0) { ?>
+ IPD Code : = $ipd_master[0]->ipd_code ?>
+ Refer By : = $ipd_master[0]->doc_name ?>
+ case_id > 0 && $ipd_master[0]->case_id <> '') { ?>
+ Org. Code : = $org_master[0]->case_id_code ?>
+ Org. Name : = $org_master[0]->insurance_company_name ?>
+
+ case_credit == 1 && $invoice_med_master[0]->case_id > 0) { ?>
+ Org. Code : = $org_master[0]->case_id_code ?>
+ Org. Name : = $org_master[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:= $invoice_med_master[0]->inv_med_code ?> / Name : = $invoice_med_master[0]->inv_name ?>
+
+
+
+
+
+
+ GST: ' . H_Med_GST . '';
+ }
+
+ if (M_LIC != '') {
+ echo ' L.No: ' . M_LIC;
+ }
+ ?>
+
+
+ Invoice ID : = $invoice_med_master[0]->inv_med_code ?>
+ Date : = $invoice_med_master[0]->str_inv_date ?>
+
+
+
+
+
+ Bill of Supply
+
+ Invoice
+
+ (composition taxable person, not eligible to collect tax on supplies)
+
+
+
+
+ ';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Pack ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Qty. ';
+ echo 'Rate ';
+ echo 'Gross Amt ';
+ echo '';
+ }
+
+ $srno = $srno + 1;
+ $head_start = $head_start + 1;
+
+ if($row->sale_return==1){
+ echo '';
+ echo 'Sale Return ';
+ echo ' ';
+ }
+
+ echo '';
+ echo '' . $srno . ' ';
+ echo '' . $row->item_Name . ' ';
+ echo '' . $row->formulation . ' ';
+ echo '' . $row->batch_no . ' ';
+ echo '' . $row->expiry . ' ';
+ echo '' . $row->qty . ' ';
+ echo '' . $row->price . ' ';
+ echo '' . number_format(round($row->amount),2) . ' ';
+ echo ' ';
+ }
+
+ for($i=0;$i<$no_of_rec;$i++)
+ {
+ echo '';
+ echo '. ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ }
+
+ if (count($invoice_med_master) > 0) {
+ echo '';
+ echo '# ';
+ echo 'Total ';
+ echo ''.$invoice_med_master[0]->gross_amount.' ';
+ echo ' ';
+ }
+ ?>
+
+
+ 0) { ?>
+
+
+ #
+ Gross
+ Discount
+ Net Amount
+ payment_balance >= 0) { ?>
+ Amount received
+ Balance Amount
+
+
+
+ #
+ = number_format(round($invoice_med_master[0]->gross_amount),2) ?>
+ = number_format(round($invoice_med_master[0]->discount_amount + $invoice_med_master[0]->item_discount_amount),2) ?>
+ = number_format(round($invoice_med_master[0]->net_amount), 2) ?>
+ payment_balance >= 0) { ?>
+ = $invoice_med_master[0]->payment_received ?>
+ = $invoice_med_master[0]->payment_balance ?>
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount:Date] :
+ id . ':' . $row->Payment_type_str . ':' . $row->amount . ':' . $row->payment_date . ']/';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ For = M_store ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Print/medical_bill_print_a5_discount.php b/old_code_ci3/views/Medical/Print/medical_bill_print_a5_discount.php
new file mode 100644
index 0000000..c966395
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_bill_print_a5_discount.php
@@ -0,0 +1,228 @@
+
+
+
+
+
+
+
+
+
+ = M_store ?>
+ = M_address ?>
+
+
+
+
+ Invoice To :
+ = $invoice_med_master[0]->inv_name ?>
+ customer_type == 0) { ?>
+ Phone No. : = $invoice_med_master[0]->inv_phone_number ?>
+ doc_name != '') { ?>
+ Refer By : = $invoice_med_master[0]->doc_name ?>
+
+
+ customer_type == 1 && count($patient_master) > 0) { ?>
+ Patient Info. as per Hospital Records
+ UHID ID : = $patient_master[0]->p_code ?>
+
+ ipd_id > 0) { ?>
+ IPD Code : = $ipd_master[0]->ipd_code ?>
+ Refer By : = $ipd_master[0]->doc_name ?>
+ case_id > 0 && $ipd_master[0]->case_id <> '') { ?>
+ Org. Code : = $org_master[0]->case_id_code ?>
+ Org. Name : = $org_master[0]->insurance_company_name ?>
+
+ case_credit == 1 && $invoice_med_master[0]->case_id > 0) { ?>
+ Org. Code : = $org_master[0]->case_id_code ?>
+ Org. Name : = $org_master[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:= $invoice_med_master[0]->inv_med_code ?> / Name : = $invoice_med_master[0]->inv_name ?>
+
+
+
+
+
+
+ GST: ' . H_Med_GST . '';
+ }
+
+ if (M_LIC != '') {
+ echo ' L.No: ' . M_LIC;
+ }
+ ?>
+
+
+ Invoice ID : = $invoice_med_master[0]->inv_med_code ?>
+ Date : = $invoice_med_master[0]->str_inv_date ?>
+
+
+
+
+
+ Bill of Supply
+
+ Invoice
+
+ (composition taxable person, not eligible to collect tax on supplies)
+
+
+
+
+ ';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Pack ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Qty. ';
+ echo 'Rate ';
+ echo 'Gross Amt ';
+ echo 'Disc. ';
+ echo 'Net Amt ';
+ echo '';
+ }
+
+ $srno = $srno + 1;
+ $head_start = $head_start + 1;
+
+ if($row->sale_return==1){
+ echo '';
+ echo 'Sale Return ';
+ echo ' ';
+ }
+
+ echo '';
+ echo '' . $srno . ' ';
+ echo '' . $row->item_Name . ' ';
+ echo '' . $row->formulation . ' ';
+ echo '' . $row->batch_no . ' ';
+ echo '' . $row->expiry . ' ';
+ echo '' . $row->qty . ' ';
+ echo '' . $row->price . ' ';
+ echo '' . number_format(round($row->amount),2) . ' ';
+ echo '' . number_format(round($row->d_amt),2) . ' ';
+ echo '' . number_format(round($row->twdisc_amount),2) . ' ';
+ echo ' ';
+ }
+
+ for($i=0;$i<$no_of_rec;$i++)
+ {
+ echo '';
+ echo '. ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ }
+
+ if (count($invoice_med_master) > 0) {
+ echo '';
+ echo '# ';
+ echo 'Total ';
+ echo ''.number_format(round($invoice_med_master[0]->gross_amount),2).' ';
+ echo ''.number_format(round($invoice_med_master[0]->inv_disc_total),2).' ';
+ echo ''.number_format(round($invoice_med_master[0]->net_amount),2).' ';
+ echo ' ';
+ }
+ ?>
+
+
+ 0) { ?>
+
+
+ #
+ Gross
+ Discount
+ Net Amount
+ payment_balance >= 0) { ?>
+ Amount received
+ Balance Amount
+
+
+
+ #
+ = number_format(round($invoice_med_master[0]->gross_amount),2) ?>
+ = number_format(round($invoice_med_master[0]->discount_amount + $invoice_med_master[0]->item_discount_amount),2) ?>
+ = number_format(round($invoice_med_master[0]->net_amount), 2) ?>
+ payment_balance >= 0) { ?>
+ = $invoice_med_master[0]->payment_received ?>
+ = $invoice_med_master[0]->payment_balance ?>
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount:Date] :
+ id . ':' . $row->Payment_type_str . ':' . $row->amount . ':' . $row->payment_date . ']/';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ For = M_store ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Print/medical_bill_print_a5_old.php b/old_code_ci3/views/Medical/Print/medical_bill_print_a5_old.php
new file mode 100644
index 0000000..c0a0c7d
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_bill_print_a5_old.php
@@ -0,0 +1,209 @@
+
+
+
+
+
+
+
+
+
+ = M_store ?>
+ = M_address ?>
+
+
+
+
+ Invoice To :
+ = $invoice_med_master[0]->inv_name ?>
+ customer_type == 0) { ?>
+ Phone No. : = $invoice_med_master[0]->inv_phone_number ?>
+ doc_name != '') { ?>
+ Refer By : = $invoice_med_master[0]->doc_name ?>
+
+
+ customer_type == 1 && count($patient_master) > 0) { ?>
+ Patient Info. as per Hospital Records
+ UHID ID : = $patient_master[0]->p_code ?>
+
+ ipd_id > 0) { ?>
+ IPD Code : = $ipd_master[0]->ipd_code ?>
+ Refer By : = $ipd_master[0]->doc_name ?>
+ case_id > 0 && $ipd_master[0]->case_id <> '') { ?>
+ Org. Code : = $org_master[0]->case_id_code ?>
+ Org. Name : = $org_master[0]->insurance_company_name ?>
+
+ case_credit == 1 && $invoice_med_master[0]->case_id > 0) { ?>
+ Org. Code : = $org_master[0]->case_id_code ?>
+ Org. Name : = $org_master[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:= $invoice_med_master[0]->inv_med_code ?> / Name : = $invoice_med_master[0]->inv_name ?>
+
+
+
+
+
+
+ GST Invoice
+
+
+
+
+ GST: ' . H_Med_GST . '';
+ }
+
+ if (M_LIC != '') {
+ echo ' L.No: ' . M_LIC;
+ }
+ ?>
+
+
+ Invoice ID : = $invoice_med_master[0]->inv_med_code ?>
+ Date : = $invoice_med_master[0]->str_inv_date ?>
+
+
+
+
+ ';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Pack ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Gross Amt ';
+ echo 'Disc. ';
+ if (H_Med_GST != '') {
+ echo 'HSNCODE/GST ';
+ echo 'GST ';
+ }
+ echo 'Amt ';
+ echo '';
+ }
+
+ $srno = $srno + 1;
+ $head_start = $head_start + 1;
+ echo '';
+ echo '' . $srno . ' ';
+ echo '' . $row->item_Name . ' ';
+ echo '' . $row->formulation . ' ';
+ echo '' . $row->batch_no . ' ';
+ echo '' . $row->expiry . ' ';
+ echo '' . $row->price . ' ';
+ echo '' . $row->qty . ' ';
+ echo '' . $row->amount . ' ';
+ echo ''.$row->d_amt.' ';
+ if (H_Med_GST != '') {
+ echo ''.$row->HSNCODE.'/'.$row->gst_per.' ';
+ echo ''.$row->gst.' ';
+ }
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+ }
+
+ if (count($invoice_med_master) > 0) {
+ echo '';
+ echo '# ';
+ echo 'Total ';
+ echo ''.$invoice_med_master[0]->gross_amount.' ';
+ echo ''.$invoice_med_master[0]->inv_disc_total.' ';
+ if (H_Med_GST != '') {
+ echo ' ';
+ echo ''.$invoice_med_master[0]->TGST.' ';
+ }
+ echo ''.number_format(round($invoice_med_master[0]->net_amount),2).' ';
+ echo ' ';
+ }
+ ?>
+
+
+ 0) { ?>
+
+
+ #
+ Gross
+ Discount
+ Net Amount
+ payment_balance >= 0) { ?>
+ Amount received
+ Balance Amount
+
+
+
+ #
+ = $invoice_med_master[0]->gross_amount ?>
+ = ($invoice_med_master[0]->discount_amount + $invoice_med_master[0]->item_discount_amount) ?>
+ = number_format(round($invoice_med_master[0]->net_amount), 2) ?>
+ payment_balance >= 0) { ?>
+ = $invoice_med_master[0]->payment_received ?>
+ = $invoice_med_master[0]->payment_balance ?>
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount:Date] :
+ id . ':' . $row->Payment_type_str . ':' . $row->amount . ':' . $row->payment_date . ']/';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ For = M_store ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Print/medical_bill_print_a6.php b/old_code_ci3/views/Medical/Print/medical_bill_print_a6.php
new file mode 100644
index 0000000..aa83b74
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_bill_print_a6.php
@@ -0,0 +1,211 @@
+
+
+
+
+
+ =M_store?>
+
+
+
+ =M_address?>
+ ';
+
+ if(H_Med_GST!='')
+ {
+ echo 'GST: '.H_Med_GST .' ';
+ }
+
+ if(M_LIC!='')
+ {
+ echo ' L.No: '.M_LIC;
+ }
+ ?>
+
+
+
+ Invoice To :
+ =$invoice_med_master[0]->inv_name?>
+ customer_type==0) { ?>
+ Phone No. : =$invoice_med_master[0]->inv_phone_number?>
+ Refer By : =$Doc_name ?>
+
+ customer_type==1 && count($patient_master)>0) { ?>
+ Patient Info. as per Hospital Records
+ UHID ID : =$patient_master[0]->p_code ?>
+ Refer By : =$Doc_name ?>
+
+ ipd_id>0) { ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+ Refer By : =$ipd_master[0]->doc_name ?>
+ case_id>0 && $ipd_master[0]->case_id<>'') { ?>
+ Org. Code : =$org_master[0]->case_id_code ?>
+ Org. Name : =$org_master[0]->insurance_company_name ?>
+
+ case_credit==1 && $invoice_med_master[0]->case_id>0) { ?>
+ Org. Code : =$org_master[0]->case_id_code ?>
+ Org. Name : =$org_master[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+ GST Invoice
+
+ Invoice
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$invoice_med_master[0]->inv_med_code ?> / Name : =$invoice_med_master[0]->inv_name ?>
+
+
+
+
+
+ Invoice ID : '.$row->inv_med_code.' [ Dated : '.$row->str_inv_date.' ] ';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Gross Amt ';
+ echo 'Disc. ';
+ echo 'Net Amt ';
+ echo ' ';
+ }
+
+ $srno=$srno+1;
+ $head_start=$head_start+1;
+
+ if($row->sale_return==1){
+ echo '';
+ echo 'Sale Return ';
+ echo ' ';
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ if($row->sale_return==0){
+ echo ''.$row->twdisc_amount.' ';
+ }else{
+ echo '(-'.$row->twdisc_amount.') ';
+ }
+
+
+ echo ' ';
+ }
+
+ if(count($invoice_med_master)>0) {
+ echo '';
+ echo '# ';
+ echo 'Total ';
+ echo ' '.$invoice_med_master[0]->gross_amount.' ';
+ echo ' '.$invoice_med_master[0]->inv_disc_total.' ';
+ echo ' '.round($invoice_med_master[0]->net_amount).' ';
+ echo ' ';
+ }
+ ?>
+
+
+0) { ?>
+
+
+
+ #
+
+ CGST
+ SGST
+ Taxable Amount
+
+ Net Amount
+ payment_balance>=0 ){ ?>
+ Amount received
+ Balance Amount
+
+
+
+ #
+
+ =$invoice_med_master[0]->CGST_Tamount?>
+ =$invoice_med_master[0]->SGST_Tamount?>
+ =$invoice_med_master[0]->TaxableAmount?>
+
+ =number_format(round($invoice_med_master[0]->net_amount),2)?>
+ payment_balance>=0 ){ ?>
+ =$invoice_med_master[0]->payment_received?>
+ =$invoice_med_master[0]->payment_balance?>
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount:Date] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.':'.$row->payment_date.']/';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ For =M_store?>
+
+
+
diff --git a/old_code_ci3/views/Medical/Print/medical_bill_print_format.php b/old_code_ci3/views/Medical/Print/medical_bill_print_format.php
new file mode 100644
index 0000000..1ff9114
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_bill_print_format.php
@@ -0,0 +1,206 @@
+
+
+
+
+
+
+ = M_store ?>
+ = M_address ?>
+ ';
+
+ if (H_Med_GST != '') {
+ echo 'GST No.: ' . H_Med_GST . ' ';
+ }
+
+ if (M_LIC != '') {
+ echo ' DL.No: ' . M_LIC;
+ }
+ ?>
+
+
+
+ Invoice To :
+ = $ipd_master[0]->p_fname ?> = $ipd_master[0]->p_relative ?> = $ipd_master[0]->p_rname ?>
+ Patient Info. as per Hospital Records
+ UHID ID : = $ipd_master[0]->p_code ?>
+ IPD Code : = $ipd_master[0]->ipd_code ?>
+ Refer By : = $ipd_master[0]->doc_name ?>
+ org_id > 0) { ?>
+ Org. Code : = $orgcase[0]->case_id_code ?>
+ Org. Name : = $orgcase[0]->insurance_company_name ?>
+
+
+
+
+
+ TAX Invoice
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:= $ipd_master[0]->ipd_code ?> / UHID:= $ipd_master[0]->p_code ?> /Name : = $ipd_master[0]->p_fname ?>
+
+
+
+
+ id == '' && $row->inv_med_id != '') {
+ echo '';
+ echo '# ';
+ echo 'Invoice Total : ' . $row->inv_med_code . ' ';
+ echo '' . $row->amount . ' ';
+ echo '' . $row->d_amt . ' ';
+ echo ' ';
+ echo '' . $row->gst . ' ';
+ echo '' . $row->twdisc_amount . ' ';
+ echo ' ';
+
+ $head_start = 0;
+ } elseif ($row->id == '' && $row->inv_med_id == '') {
+ echo ' ';
+ echo '';
+ echo '# ';
+ echo 'Grand Total ';
+ echo '' . $row->amount . ' ';
+ echo '' . $row->d_amt . ' ';
+ echo ' ';
+ echo '' . $row->gst . ' ';
+ echo '' . $row->twdisc_amount . ' ';
+ echo ' ';
+ } else {
+
+ if ($head_start == 0) {
+ echo '
+ ';
+ echo 'Invoice ID : ' . $row->inv_med_code . ' [Dated : ' . $row->str_inv_date . ' ] ';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Price ';
+ echo 'Disc. ';
+ echo 'HSNCODE/GST ';
+ echo 'GST ';
+ echo 'Amount ';
+ echo ' ';
+ }
+
+ $srno = $srno + 1;
+ $head_start = $head_start + 1;
+ echo '';
+ echo '' . $srno . ' ';
+ echo '' . $row->item_Name . ' ' . $row->formulation . ' ';
+ echo '' . $row->batch_no . ' ';
+ echo '' . $row->expiry . ' ';
+ echo '' . $row->price . ' ';
+ echo '' . $row->qty . ' ';
+ echo '' . $row->amount . ' ';
+ echo '' . $row->d_amt . ' ';
+ echo '' . $row->HSNCODE . '/' . $row->gst_per . ' ';
+ echo '' . $row->gst . ' ';
+ echo '' . $row->twdisc_amount . ' ';
+ echo ' ';
+ }
+ }
+ ?>
+
+
+ 0) { ?>
+
+
+
+ #
+ Deduction
+ CGST
+ SGST
+ Taxable Amount
+ Net Amount
+ payment_balance >= 0) { ?>
+ Amount received
+ Balance Amount
+
+
+
+ #
+ = $inv_med_group[0]->discount_group+$inv_med_group[0]->item_discount_amount ?>
+ = $inv_med_group[0]->CGST_Tamount ?>
+ = $inv_med_group[0]->SGST_Tamount ?>
+ = $inv_med_group[0]->TaxableAmount ?>
+ = number_format(round($inv_med_group[0]->net_amount), 2) ?>
+ payment_balance>=0 ){
+ ?>
+ = $inv_med_group[0]->payment_received ?>
+ = $inv_med_group[0]->payment_balance ?>
+
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id . ':' . $row->Payment_type_str . ':' . $row->amount . ']/';
+ }
+ ?>
+
+
+ For = M_store ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Print/medical_bill_print_format_newpage.php b/old_code_ci3/views/Medical/Print/medical_bill_print_format_newpage.php
new file mode 100644
index 0000000..5f8b7e9
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_bill_print_format_newpage.php
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+ =M_store?>
+ =M_address?>
+ ';
+
+ if(H_Med_GST!='')
+ {
+ echo 'GST: '.H_Med_GST .' ';
+ }
+
+ if(M_LIC!='')
+ {
+ echo ' L.No: '.M_LIC;
+ }
+ ?>
+
+
+ Invoice To :
+ =$ipd_master[0]->p_fname ?>
+
+ Patient Info. as per KHRC Records
+ UHID ID : =$ipd_master[0]->p_code ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+ Refer By : =$ipd_master[0]->doc_name ?>
+ org_id>0) { ?>
+ Org. Code : =$orgcase[0]->case_id_code ?>
+ Org. Name : =$orgcase[0]->insurance_company_name ?>
+
+
+
+
+
+ CASH / Credit Memo
+
+
+
+
+
+ IPD-ID:=$ipd_master[0]->ipd_code ?> / UHID:=$ipd_master[0]->p_code ?> /Name : =$ipd_master[0]->p_fname ?>
+
+
+
+
+ id=='' && $row->inv_med_id != '')
+ {
+ echo '
';
+ echo '# ';
+ echo 'Invoice Total : '.$row->inv_med_code.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ echo ' ';
+ echo ''.$row->gst.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+ echo '';
+
+ echo '
';
+ echo '
For '.M_store.'
';
+ echo '
';
+
+ $srno=0;
+
+ $head_start=0;
+ }
+ elseif($row->id=='' && $row->inv_med_id == ''){
+ echo '
';
+ echo ' ';
+ echo '';
+ echo '# ';
+ echo 'Grand Total ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ echo ' ';
+ echo ''.$row->gst.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+ echo '
';
+ }else{
+
+ if($head_start==0)
+ {
+ echo '
Invoice No : '.$row->inv_med_code.' / Date : '.$row->str_inv_date.' ';
+ echo '
';
+ //echo 'Invoice ID : '.$row->inv_med_code.' [Dated : '.$row->str_inv_date.' ]
';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Price ';
+ echo 'Disc. ';
+ echo 'HSNCODE/GST ';
+ echo 'GST ';
+ echo 'Amount ';
+ echo ' ';
+ }
+
+ $srno=$srno+1;
+ $head_start=$head_start+1;
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ echo ''.$row->HSNCODE.'/'.$row->gst_per.' ';
+ echo ''.$row->gst.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+ }
+ }
+ ?>
+
diff --git a/old_code_ci3/views/Medical/Print/medical_bill_print_format_single.php b/old_code_ci3/views/Medical/Print/medical_bill_print_format_single.php
new file mode 100644
index 0000000..d557e39
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_bill_print_format_single.php
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+ =M_store?>
+ =M_address?>
+ GST: '.H_Med_GST .' ';
+ }
+
+ if(M_LIC!='')
+ {
+ echo 'L.No: '.M_LIC;
+ }
+ ?>
+
+
+
+ Invoice To :
+ =$invoice_med_master[0]->inv_name?>
+ customer_type==0) { ?>
+ Phone No. : =$invoice_med_master[0]->inv_phone_number?>
+ Refer By : =$Doc_name ?>
+
+ customer_type==1 && count($patient_master)>0) { ?>
+ Patient Info. as per Hospital Records
+ UHID ID : =$patient_master[0]->p_code ?>
+
+ customer_type==1 && $invoice_med_master[0]->ipd_id==0 ) { ?>
+ Refer By : =$Doc_name ?>
+
+ ipd_id>0) { ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+ Refer By : =$ipd_master[0]->doc_name ?>
+ case_id>0 && $ipd_master[0]->case_id<>'') { ?>
+ Org. Code : =$org_master[0]->case_id_code ?>
+ Org. Name : =$org_master[0]->insurance_company_name ?>
+
+ case_credit==1 && $invoice_med_master[0]->case_id>0) { ?>
+ Org. Code : =$org_master[0]->case_id_code ?>
+ Org. Name : =$org_master[0]->insurance_company_name ?>
+
+
+
+
+
+
+
+ GST Invoice
+
+ Invoice
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$invoice_med_master[0]->inv_med_code ?> / Name : =$invoice_med_master[0]->inv_name ?>
+
+
+
+
+ Invoice ID : '.$row->inv_med_code.' [Dated : '.$row->str_inv_date.' ] ';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Gross Amt ';
+ echo 'Disc. ';
+ if(H_Med_GST!=''){
+ echo 'TaxableAmt ';
+ echo 'HSNCODE/GST ';
+ echo 'GST ';
+ }
+ echo 'Net Amt ';
+ echo ' ';
+ }
+
+ $srno=$srno+1;
+ $head_start=$head_start+1;
+
+ if($row->sale_return==1){
+ echo '';
+ echo 'Sale Return ';
+ echo ' ';
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->d_amt.' ';
+ if(H_Med_GST!=''){
+ echo ''.$row->TaxableAmount.' ';
+ echo ''.$row->HSNCODE.'/'.$row->gst_per.' ';
+ echo ''.$row->gst.' ';
+ }
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+ }
+
+ if(count($invoice_med_master)>0) {
+ echo '';
+ echo '# ';
+ echo 'Total ';
+ echo ''.$invoice_med_master[0]->gross_amount.' ';
+ echo ''.$invoice_med_master[0]->inv_disc_total.' ';
+ if(H_Med_GST!=''){
+ echo ''.$invoice_med_master[0]->TaxableAmount.' ';
+ echo ' ';
+ echo ''.$invoice_med_master[0]->TGST.' ';
+ }
+ echo ''.number_format(round($invoice_med_master[0]->net_amount),2).' ';
+ echo ' ';
+ }
+ ?>
+
+
+0) { ?>
+
+
+
+ #
+ if(H_Med_GST!=''){
+ CGST
+ SGST
+ Taxable Amount
+ }
+ Net Amount
+ payment_balance>=0 ){ ?>
+ Amount received
+ Balance Amount
+
+
+
+ #
+ if(H_Med_GST!=''){
+ =$invoice_med_master[0]->CGST_Tamount?>
+ =$invoice_med_master[0]->SGST_Tamount?>
+ =$invoice_med_master[0]->TaxableAmount?>
+ }
+ =number_format(round($invoice_med_master[0]->net_amount),2)?>
+ payment_balance>=0 ){ ?>
+ =$invoice_med_master[0]->payment_received?>
+ =$invoice_med_master[0]->payment_balance?>
+
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount:Date] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.':'.$row->payment_date.']/';
+ }
+ ?>
+
+
+ For =M_store?>
+
+
+
diff --git a/old_code_ci3/views/Medical/Print/medical_bill_print_format_with_return.php b/old_code_ci3/views/Medical/Print/medical_bill_print_format_with_return.php
new file mode 100644
index 0000000..7076657
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_bill_print_format_with_return.php
@@ -0,0 +1,280 @@
+
+
+
+
+
+
+ =M_store?>
+ =M_address?>
+ ';
+
+ if(H_Med_GST!='')
+ {
+ echo 'GST: '.H_Med_GST .' ';
+ }
+
+ if(M_LIC!='')
+ {
+ echo ' L.No: '.M_LIC;
+ }
+ ?>
+
+
+
+ Invoice To :
+ =$ipd_master[0]->p_fname ?>
+ Patient Info. as per Hospital Records
+ UHID ID : =$ipd_master[0]->p_code ?>
+ IPD Code : =$ipd_master[0]->ipd_code ?>
+ Refer By : =$ipd_master[0]->doc_name ?>
+ org_id>0) { ?>
+ Org. Code : =$orgcase[0]->case_id_code ?>
+ Org. Name : =$orgcase[0]->insurance_company_name ?>
+
+
+
+
+
+TAX Invoice
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD-ID:=$ipd_master[0]->ipd_code ?> / UHID:=$ipd_master[0]->p_code ?> /Name : =$ipd_master[0]->p_fname ?>
+
+
+
+
+
+
+
+ id=='' && $row->inv_med_id != '')
+ {
+ echo '';
+ echo '# ';
+ echo 'Invoice Total : '.$row->inv_med_code.' ';
+ echo ''.$invoice_total.' ';
+ echo ' ';
+
+ $head_start=0;
+ }
+ elseif($row->id=='' && $row->inv_med_id == ''){
+ echo ' ';
+ echo '';
+ echo '# ';
+ echo 'Grand Sale Total ';
+ echo ''.$Grand_sale_total.' ';
+ echo ' ';
+
+ }else{
+
+ if($head_start==0)
+ {
+ echo '
+ ';
+ echo 'Invoice ID : '.$row->inv_med_code.' [Dated : '.$row->str_inv_date.' ] ';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Amount ';
+ echo ' ';
+
+ $invoice_total=0;
+ }
+
+ $srno=$srno+1;
+ $head_start=$head_start+1;
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ' ';
+
+ $Grand_sale_total+=$row->amount;
+ $invoice_total+=$row->amount;
+
+ }
+ }
+ ?>
+
+
+ Return Items
+
+ id=='' && $row->inv_med_id != '')
+ {
+ echo '';
+ echo '# ';
+ echo 'Invoice Total : '.$row->inv_med_code.' ';
+ echo ''.$invoice_total.' ';
+ echo ' ';
+
+ $head_start=0;
+ }
+ elseif($row->id=='' && $row->inv_med_id == ''){
+ echo ' ';
+ echo '';
+ echo '# ';
+ echo 'Grand Return Total ';
+ echo ''.$Grand_return_total.' ';
+ echo ' ';
+
+
+ }else{
+
+ if($head_start==0)
+ {
+ echo '
+ ';
+ echo 'Invoice ID : '.$row->inv_med_code.' [Dated : '.$row->str_inv_date.' ] ';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Amount ';
+ echo ' ';
+ $invoice_total=0;
+ }
+
+ $srno=$srno+1;
+ $head_start=$head_start+1;
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ' ';
+ $Grand_return_total+=$row->amount;
+ $invoice_total+=$row->amount;
+
+ }
+ }
+ ?>
+
+
+0) {
+ $Gross_amt=$Grand_sale_total-$Grand_return_total;
+
+
+ ?>
+
+
+
+ #
+ Sale [A]
+ Sale Return [B]
+ Gross Amt. [G] =([A] - [B])
+ Discount [D]
+ Net Amount [N] =([G]-[D])
+ payment_balance>=0 ){ ?>
+ Amount received
+ Balance Amount
+
+
+
+ #
+ =($Grand_sale_total)?>
+ =$Grand_return_total?>
+ =$Gross_amt?>
+ =$inv_med_group[0]->discount_group?>
+ =number_format(round($inv_med_group[0]->net_amount),2)?>
+ payment_balance>=0 ){ ?>
+ =$inv_med_group[0]->payment_received?>
+ =$inv_med_group[0]->payment_balance?>
+
+
+
+
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+ For =M_store?>
+
+
+
diff --git a/old_code_ci3/views/Medical/Print/medical_cash_received_bill.php b/old_code_ci3/views/Medical/Print/medical_cash_received_bill.php
new file mode 100644
index 0000000..c381d9b
--- /dev/null
+++ b/old_code_ci3/views/Medical/Print/medical_cash_received_bill.php
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+ = M_store ?>
+ = M_address ?>
+ ';
+
+ if (H_Med_GST != '') {
+ echo 'GST: ' . H_Med_GST . ' ';
+ }
+
+ if (M_LIC != '') {
+ echo ' L.No: ' . M_LIC;
+ }
+ ?>
+
+
+ amount . ':PT' . date('dmYhis');
+ ?>
+
+
+
+
+ Payment = $ipd_payment[0]->Amount_str ?> Receipt No.: = $payid ?>
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ IPD No.:= $ipd_master[0]->ipd_code ?> / UHID:= $patient_master[0]->p_code ?> /Name : = strtoupper($patient_master[0]->p_fname) ?>
+
+
+
+
+
+ Patient Info.
+ UHID : = $patient_master[0]->p_code ?>
+ Name : = $patient_master[0]->title ?> = strtoupper($patient_master[0]->p_fname) ?>
+ = $patient_master[0]->p_relative ?> = strtoupper($patient_master[0]->p_rname) ?>
+ Sex : = $patient_master[0]->xgender ?> = $patient_master[0]->age ?> P.No. := $patient_master[0]->mphone1 ?>
+
+
+ IPD No. : = $ipd_master[0]->ipd_code ?>
+ Date : = $ipd_payment[0]->payment_date_str ?>
+
+
+
+
+
+ Amount : Rs. = $ipd_payment[0]->amount ?>
+ Amount in Words : Rs.= number_to_word($ipd_payment[0]->amount) ?>
+
+
+ Prepared By : = $ipd_payment[0]->update_by ?>
+
+
+
+ Signature
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/company_Edit.php b/old_code_ci3/views/Medical/Purchase/company_Edit.php
new file mode 100644
index 0000000..89cdbf2
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/company_Edit.php
@@ -0,0 +1,76 @@
+
+
+
+ 'form','class'=>'form1')); ?>
+ 0)
+ {
+ $cid=$med_company[0]->id;
+ $company_name=$med_company[0]->company_name;
+ $contact_person_name=$med_company[0]->contact_person_name;
+ $contact_phone_no=$med_company[0]->contact_phone_no;
+ }
+
+ ?>
+
+
+
+
+
+ Contact Person Name
+
+
+
+
+
+
+
+ Contact Phone No
+
+
+
+
+
+
+
+
+ A dd & Update Company
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/company_list.php b/old_code_ci3/views/Medical/Purchase/company_list.php
new file mode 100644
index 0000000..877d442
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/company_list.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+ Company Name
+ Person/Phone
+ Action
+
+
+
+
+
+ =$med_company[$i]->company_name ?>
+ =$med_company[$i]->contact_person_name ?>/=$med_company[$i]->contact_phone_no ?>
+
+ Edit
+
+
+
+
+
+
+ Company Name
+ Person/Phone
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/company_list_sub.php b/old_code_ci3/views/Medical/Purchase/company_list_sub.php
new file mode 100644
index 0000000..1deb7e1
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/company_list_sub.php
@@ -0,0 +1,27 @@
+
+
+
+ Company Name
+ Person/Phone
+ Action
+
+
+
+
+
+ =$med_company[$i]->company_name ?>
+ =$med_company[$i]->contact_person_name ?>/=$med_company[$i]->contact_phone_no ?>
+
+ Edit
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/drug_master_list.php b/old_code_ci3/views/Medical/Purchase/drug_master_list.php
new file mode 100644
index 0000000..f5c2c85
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/drug_master_list.php
@@ -0,0 +1,30 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/indent_req_list.php b/old_code_ci3/views/Medical/Purchase/indent_req_list.php
new file mode 100644
index 0000000..5fefe5e
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/indent_req_list.php
@@ -0,0 +1,30 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/indent_req_list_search.php b/old_code_ci3/views/Medical/Purchase/indent_req_list_search.php
new file mode 100644
index 0000000..e970c0a
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/indent_req_list_search.php
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+ Indent ID
+ Req. Type
+ Date
+ Product List
+ Status
+
+
+
+
+
+
+ =$indent_req_list[$i]->indent_code ?>
+ =$indent_req_list[$i]->indent_request_type_str ?>
+ =$indent_req_list[$i]->created_date ?>
+ =$indent_req_list[$i]->product_list ?>
+ =$indent_req_list[$i]->request_status_str?>
+
+ request_status==0) { ?>
+ Edit
+ request_status==1) { ?>
+ View
+ request_status==4) { ?>
+ Items List
+
+ View
+
+
+
+
+
+
+
+
+ Indent ID
+ Store
+ Date
+ Status
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/indent_request_edit.php b/old_code_ci3/views/Medical/Purchase/indent_request_edit.php
new file mode 100644
index 0000000..0f64ee9
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/indent_request_edit.php
@@ -0,0 +1,203 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/indent_request_item_list.php b/old_code_ci3/views/Medical/Purchase/indent_request_item_list.php
new file mode 100644
index 0000000..4ee64b2
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/indent_request_item_list.php
@@ -0,0 +1,43 @@
+
+
+ #
+ Product Code
+ Item Name
+ Formulation
+ Generic Name
+ Qty.
+ Min Qty
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->formulation.' ';
+ echo ''.$row->genericname.' ';
+ echo ''.$row->request_qty.' ';
+ echo ''.$row->min_requirement.' ';
+ echo '
+
+ ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+ Product Code
+ Item Name
+ Formulation
+ Generic Name
+ Qty.
+ Min Qty
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/indent_request_view.php b/old_code_ci3/views/Medical/Purchase/indent_request_view.php
new file mode 100644
index 0000000..291e9b3
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/indent_request_view.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Formulation
+ Generic Name
+ Qty.
+ Min Qty
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->formulation.' ';
+ echo ''.$row->genericname.' ';
+ echo ''.$row->request_qty.' ';
+ echo ''.$row->min_requirement.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+ Item Name
+ Formulation
+ Generic Name
+ Qty.
+ Min Qty
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Purchase/ledger_add_entry.php b/old_code_ci3/views/Medical/Purchase/ledger_add_entry.php
new file mode 100644
index 0000000..8e3efe7
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/ledger_add_entry.php
@@ -0,0 +1,85 @@
+
+
+
+
+ 'myform_add_entry');
+ echo form_open('Medical_backpanel/add_entry/'.$s_id,$attributes); ?>
+
+
+
+
+
Cr/Dr
+
+
+ Credit
+ Debit
+
+
+
+
+
Mode
+
+
+ bank_id == $this->input->post('cr_type')) ? ' selected="selected"' : "";
+ echo ''.$row->bank_account_name.' '.$row->bank_name.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
Remark/Chq. No.
+
+ input->post('tran_desc'); ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/ledger_data.php b/old_code_ci3/views/Medical/Purchase/ledger_data.php
new file mode 100644
index 0000000..3121dd4
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/ledger_data.php
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+ ID
+ Date Tran
+ Description
+ Credit
+ Debit
+ Actions
+
+
+
+
+
+
+ tran_date); ?>
+ mode_desc.' '.$c->tran_desc; ?>
+ credit_debit==0?$c->amount:''); ?>
+ credit_debit==1?$c->amount:''); ?>
+
+ Open
+
+
+
+
+
+
+ ID
+ Date Tran
+ Description
+ Credit
+ Debit
+ Actions
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Purchase/ledger_data_print.php b/old_code_ci3/views/Medical/Purchase/ledger_data_print.php
new file mode 100644
index 0000000..8bc8d22
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/ledger_data_print.php
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+ = M_store ?>
+ = M_address ?>, Uttarakhand
+ ';
+
+ if (H_Med_GST != '') {
+ echo 'GST: ' . H_Med_GST . ' ';
+ }
+
+ if (M_LIC != '') {
+ echo ' L.No: ' . M_LIC;
+ }
+ ?>
+
+
+
+ Statement of Supplier :
+ = $med_supplier[0]->name_supplier ?>
+
+
+
+
+ Statement between = $Statement_between ?>
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Supplier:= $med_supplier[0]->name_supplier ?>
+
+
+
+Opening Balance : = $balance_till_date ?> / Total Cr. : = $cr_total ?> / Total Dr. : = $dr_total ?>
+ / Closing Balance : = $balance_till_date_close ?>
+
+
+
+ Sr.No
+ Date Tran
+ Description
+ Credit
+ Debit
+ Balance
+
+
+
+
+
+
+
+ Opening Balance : Last Date of Tran
+
+
+
+
+ credit_debit == 0 ? $c->amount : $c->amount * -1;
+ $balance += $amt;
+ ?>
+
+
+ tran_date); ?>
+ mode_desc . ' ' . $c->tran_desc; ?>
+ credit_debit == 0 ? $c->amount : ''); ?>
+ credit_debit == 1 ? $c->amount : ''); ?>
+
+
+
+
+
+
+ #
+
+
+ = $cr_total ?>
+ = $dr_total ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/ledger_edit_entry.php b/old_code_ci3/views/Medical/Purchase/ledger_edit_entry.php
new file mode 100644
index 0000000..98bd68b
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/ledger_edit_entry.php
@@ -0,0 +1,87 @@
+
+
+
+
+ 'myform_add_entry');
+ echo form_open('Medical_backpanel/edit_entry/'.$tran_id,$attributes); ?>
+
+
+
+
+
Cr/Dr
+
+
+ credit_debit == 0) ? ' selected="selected"' : "";?>>Credit
+ credit_debit == 1) ? ' selected="selected"' : "";?>>Debit
+
+
+
+
+
Mode
+
+
+ input->post('mode_type')?$this->input->post('mode_type'):$med_supplier_ledger[0]->bank_id);
+
+ $selected = ($row->bank_id == $bank_id) ? ' selected="selected"' : "";
+ echo ''.$row->bank_account_name.' '.$row->bank_name.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
Remark/Chq. No.
+
+ input->post('tran_desc') ? $this->input->post('tran_desc') : $med_supplier_ledger[0]->tran_desc); ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/ledger_payment_data_print.php b/old_code_ci3/views/Medical/Purchase/ledger_payment_data_print.php
new file mode 100644
index 0000000..74de1a8
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/ledger_payment_data_print.php
@@ -0,0 +1,103 @@
+
+
+
+= M_store ?>
+ = M_address ?>, Uttarakhand
+ ';
+
+ if (H_Med_GST != '') {
+ echo 'GST: ' . H_Med_GST . ' ';
+ }
+
+ if (M_LIC != '') {
+ echo ' L.No: ' . M_LIC;
+ }
+ ?>
+
Statement between = $Statement_between ?>
+
+
+ Page : {PAGENO}/{nbpg}
+
+Opening Balance : = $balance_till_date ?> / Total Cr. : = $cr_total ?> / Total Dr. : = $dr_total ?>
+ / Closing Balance : = $balance_till_date_close ?>
+
+
+
+ Sr.No
+ Date Tran
+ Description
+ Credit
+ Debit
+ Balance
+
+
+
+
+
+
+
+ Opening Balance
+
+
+
+
+ credit_debit == 0 ? $c->amount : $c->amount * -1;
+ $balance += $amt;
+ ?>
+
+
+ tran_date); ?>
+ name_supplier.' / '.$c->mode_desc . ' ' . $c->tran_desc; ?>
+ credit_debit == 0 ? $c->amount : ''); ?>
+ credit_debit == 1 ? $c->amount : ''); ?>
+
+
+
+
+
+
+ #
+
+
+ = $cr_total ?>
+ = $dr_total ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/ledger_payment_data_show.php b/old_code_ci3/views/Medical/Purchase/ledger_payment_data_show.php
new file mode 100644
index 0000000..31d5837
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/ledger_payment_data_show.php
@@ -0,0 +1,57 @@
+Opening Balance : = $balance_till_date ?> / Total Cr. : = $cr_total ?> / Total Dr. : = $dr_total ?>
+ / Closing Balance : = $balance_till_date_close ?>
+ Print Statement
+
+
+
+ Sr.No
+ Date Tran
+ Description
+ Credit
+ Debit
+ Balance
+
+
+
+
+
+
+
+ Opening Balance
+
+
+
+
+ credit_debit == 0 ? $c->amount : $c->amount * -1;
+ $balance += $amt;
+ ?>
+
+
+ tran_date); ?>
+ mode_desc . ' ' . $c->tran_desc; ?>
+ credit_debit == 0 ? $c->amount : ''); ?>
+ credit_debit == 1 ? $c->amount : ''); ?>
+
+
+
+
+
+
+ #
+
+
+ = $cr_total ?>
+ = $dr_total ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/med_product_cat_list.php b/old_code_ci3/views/Medical/Purchase/med_product_cat_list.php
new file mode 100644
index 0000000..10f6c4f
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/med_product_cat_list.php
@@ -0,0 +1,57 @@
+
+
+
+
+
+
+
+
+
+
+
+ Category Name
+ Action
+
+
+
+
+
+ =$med_product_cat_master[$i]->med_cat_desc ?>
+
+ Edit
+
+
+
+
+
+
+ Company Name
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/medicine_category_Sub.php b/old_code_ci3/views/Medical/Purchase/medicine_category_Sub.php
new file mode 100644
index 0000000..51263e7
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/medicine_category_Sub.php
@@ -0,0 +1,25 @@
+
+
+
+
+ Category Name
+ Action
+
+
+
+
+
+ =$med_product_cat_master[$i]->med_cat_desc ?>
+
+ Edit
+
+
+
+
+
+
+ Company Name
+ Action
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/medicine_category_edit.php b/old_code_ci3/views/Medical/Purchase/medicine_category_edit.php
new file mode 100644
index 0000000..a51f2e7
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/medicine_category_edit.php
@@ -0,0 +1,59 @@
+
+
+
+ 'form','class'=>'form1')); ?>
+ 0)
+ {
+ $cid=$med_product_cat_master[0]->id;
+ $med_cat_desc=$med_product_cat_master[0]->med_cat_desc;
+ }
+
+ ?>
+
+
+
+
+ Medicince Category Name
+
+
+
+
+
+
+
+
+ A dd & Update Company
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/new_indent_request.php b/old_code_ci3/views/Medical/Purchase/new_indent_request.php
new file mode 100644
index 0000000..e75aff1
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/new_indent_request.php
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Store
+
+ store_id.' >'.$row->store_name.'';
+ }
+ ?>
+
+
+
+
+ C reate
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/new_purchase_invoice.php b/old_code_ci3/views/Medical/Purchase/new_purchase_invoice.php
new file mode 100644
index 0000000..6bf9567
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/new_purchase_invoice.php
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Supplier
+
+ sid.' >'.$row->name_supplier.'';
+ }
+ ?>
+
+
+
+
+
+ Bill Type
+
+ Invoice
+ Challan
+
+
+
+
+
+ Invoice /Challan ID
+
+
+
+
+
+ C reate
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/product_edit.php b/old_code_ci3/views/Medical/Purchase/product_edit.php
new file mode 100644
index 0000000..5e0dc6b
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/product_edit.php
@@ -0,0 +1,388 @@
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
Formulation
+
+
+ formulation == $product_data[0]->formulation) ? ' selected="selected"' : "";
+
+ echo ''.$row->formulation_length.' ';
+ }
+ ?>
+
+
+
+
+
+
Medicine Catagory
+
+
+ cat_list);
+ print_r($cat_list);
+
+ foreach($med_product_cat_master as $row){
+
+ if(in_array($row->id,$cat_list))
+ {
+ $selected=" Selected";
+ }else{
+ $selected="";
+ }
+ ?>
+ >=$row->med_cat_desc?>
+
+
+
+
+
+
+ ban_flag_id;
+ if($chk_ban_flag_id==1)
+ {
+ $chk_ban_flag_id_checkbox_checked="checked";
+ }else{
+ $chk_ban_flag_id_checkbox_checked="";
+ }
+
+ $chk_is_continue=$product_data[0]->is_continue;
+ if($chk_is_continue==1)
+ {
+ $chk_is_continue_checkbox_checked="checked";
+ }else{
+ $chk_is_continue_checkbox_checked="";
+ }
+
+ $chk_batch_applicable=$product_data[0]->batch_applicable;
+ if($chk_batch_applicable==1)
+ {
+ $chk_batch_applicable_checkbox_checked="checked";
+ }else{
+ $chk_batch_applicable_checkbox_checked="";
+ }
+
+ $chk_exp_date_applicable=$product_data[0]->exp_date_applicable;
+ if($chk_exp_date_applicable==1)
+ {
+ $chk_exp_date_applicable="checked";
+ }else{
+ $chk_exp_date_applicable="";
+ }
+
+ $chk_schedule_h=$product_data[0]->schedule_h;
+ if($chk_schedule_h==1)
+ {
+ $chk_schedule_h_checkbox_checked="checked";
+ }else{
+ $chk_schedule_h_checkbox_checked="";
+ }
+
+ $chk_schedule_h1=$product_data[0]->schedule_h1;
+ if($chk_schedule_h1==1)
+ {
+ $chk_schedule_h1_checkbox_checked="checked";
+ }else{
+ $chk_schedule_h1_checkbox_checked="";
+ }
+
+ $chk_narcotic=$product_data[0]->narcotic;
+ if($chk_narcotic==1)
+ {
+ $chk_narcotic_checkbox_checked="checked";
+ }else{
+ $chk_narcotic_checkbox_checked="";
+ }
+
+ $chk_schedule_x=$product_data[0]->schedule_x;
+ if($chk_schedule_x==1)
+ {
+ $chk_schedule_x_checkbox_checked="checked";
+ }else{
+ $chk_schedule_x_checkbox_checked="";
+ }
+
+
+ $chk_schedule_g=$product_data[0]->schedule_g;
+ if($chk_schedule_g==1)
+ {
+ $chk_schedule_g_checkbox_checked="checked";
+ }else{
+ $chk_schedule_g_checkbox_checked="";
+ }
+
+ $chk_high_risk=$product_data[0]->high_risk;
+ if($chk_high_risk==1)
+ {
+ $chk_high_risk_checkbox_checked="checked";
+ }else{
+ $chk_high_risk_checkbox_checked="";
+ }
+
+ ?>
+
+
+ >Exp.Date Applicable
+
+
+
+
+
+
+
+
+
+
+
Company Master
+
+
+ id == $product_data[0]->company_id) ? ' selected="selected"' : "";
+
+ echo ''.$company_master->company_name.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/product_new.php b/old_code_ci3/views/Medical/Purchase/product_new.php
new file mode 100644
index 0000000..5f42aff
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/product_new.php
@@ -0,0 +1,247 @@
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
Medicine Catagory
+
+
+
+ =$row->med_cat_desc?>
+
+
+
+
+
+
Formulation
+
+
+ formulation.'" >'.$row->formulation_length.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Company Master
+
+
+ id.'" >'.$company_master->company_name.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/product_search_result.php b/old_code_ci3/views/Medical/Purchase/product_search_result.php
new file mode 100644
index 0000000..9612094
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/product_search_result.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ Prod. ID
+ Name
+ Formulation
+ Generic Name
+ Packing Type
+
+
+
+
+
+
+ =$product_list[$i]->id ?>
+ =$product_list[$i]->item_name ?>
+ =$product_list[$i]->formulation ?>
+ =$product_list[$i]->genericname ?>
+ =$product_list[$i]->packing ?>
+
+ Edit
+ Delete
+
+
+
+
+
+
+
+ Prod. ID
+ Name
+ Formulation
+ Generic Name
+ Packing Type
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/purchase_challan_list.php b/old_code_ci3/views/Medical/Purchase/purchase_challan_list.php
new file mode 100644
index 0000000..41b09dd
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/purchase_challan_list.php
@@ -0,0 +1,37 @@
+
+
+
+ $row->id)
+ {
+ echo '';
+ echo ' Challan No :'.$row->Invoice_no.' / Date : '.$row->str_date_of_invoice.' /Net Amount :'.$row->tamount.' ';
+ echo ' ';
+
+ echo '';
+ echo ' Item Name ';
+ echo ' Qty + Free ';
+ echo ' MRP ';
+ echo ' Add ';
+ echo ' ';
+ }
+
+ echo '';
+ echo ' '.$row->Item_name.' ';
+ echo ' '.$row->qty.' + '.$row->qty_free.' ';
+ echo ' '.$row->mrp.' ';
+ echo ' Add ';
+ echo ' ';
+
+ $purchase_id=$row->id;
+
+ }
+ ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/purchase_file_show.php b/old_code_ci3/views/Medical/Purchase/purchase_file_show.php
new file mode 100644
index 0000000..317cfd5
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/purchase_file_show.php
@@ -0,0 +1,70 @@
+
+
+
+
+
+ ';
+ }
+ ?>
+
+
+
+ full_path, '/medical_uploads/purchase_invoice/', 1);
+
+ $file_path = substr($purchase_file_rec[$i]->full_path, $pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$opd_file_list[$i]->full_path);
+
+ if ($i < 1) {
+ echo '
';
+ } else {
+ echo '
';
+ }
+
+ if ($purchase_file_rec[$i]->file_ext == '.pdf') {
+ echo '
';
+ } else {
+ echo '
';
+ }
+
+ echo '
';
+ }
+
+ for ($i = 0; $i < count($purchase_file_rec); ++$i) {
+ $pos = strpos($purchase_file_rec[$i]->full_path, '/medical_uploads/purchase_invoice/', 1);
+
+ $file_path = substr($purchase_file_rec[$i]->full_path, $pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$file_opd_rec[$i]->full_path);
+
+ echo '
';
+
+ echo '
+
+ Your browser does not support the video tag.
+ ';
+
+ echo '
';
+ }
+ ?>
+
+
+
+
+ Previous
+
+
+
+ Next
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/purchase_invoice_edit.php b/old_code_ci3/views/Medical/Purchase/purchase_invoice_edit.php
new file mode 100644
index 0000000..056dbec
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/purchase_invoice_edit.php
@@ -0,0 +1,533 @@
+
+
+
+
+
+
+ 'form', 'class' => 'form2')); ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/purchase_invoice_item.php b/old_code_ci3/views/Medical/Purchase/purchase_invoice_item.php
new file mode 100644
index 0000000..11f4f55
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/purchase_invoice_item.php
@@ -0,0 +1,79 @@
+
+
+ #
+ RecNo
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+
+ item_return==1)
+ {
+ $style='style="color:Red;"';
+ }else{
+ $style='';
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->id.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->exp_date_str.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->qty).'+'.floatval($row->qty_free).' ';
+ echo ''.$row->purchase_price.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->discount.' ';
+ echo ''.$row->taxable_amount.' ';
+ echo ''.$row->CGST_per.' ';
+ echo ''.$row->SGST_per.' ';
+ echo ''.$row->net_amount.' ';
+ echo '';
+ if($purchase_invoice[0]->inv_status==0)
+ {
+ echo '
+ ';
+ if($row->old_purchase_id>0)
+ {
+ echo ' ';
+ }
+ }
+ echo ' ';
+ echo ' ';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+ =$purchase_invoice[0]->Taxable_Amt ?>
+ =$purchase_invoice[0]->CGST_Amt ?>
+ =$purchase_invoice[0]->SGST_Amt ?>
+ =$purchase_invoice[0]->T_Net_Amount ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/purchase_invoice_master_edit.php b/old_code_ci3/views/Medical/Purchase/purchase_invoice_master_edit.php
new file mode 100644
index 0000000..bcc3768
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/purchase_invoice_master_edit.php
@@ -0,0 +1,286 @@
+
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+ item_return == 1) {
+ $style = 'style="color:Red;"';
+ } else {
+ $style = '';
+ }
+ echo '';
+ echo '' . $srno . ' ';
+ echo '' . $row->Item_name . ' ';
+ echo '' . $row->batch_no . ' ';
+ echo '' . $row->expiry_date . ' ';
+ echo '' . $row->mrp . ' ';
+ echo '' . floatval($row->qty) . '+' . floatval($row->qty_free) . ' ';
+ echo '' . $row->purchase_price . ' ';
+ echo '' . $row->amount . ' ';
+ echo '' . $row->discount . ' ';
+ echo '' . $row->taxable_amount . ' ';
+ echo '' . $row->CGST_per . ' ';
+ echo '' . $row->SGST_per . ' ';
+ echo '' . $row->net_amount . ' ';
+ echo ' ';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+ = $inv_master_data[0]->Taxable_Amt ?>
+ = $inv_master_data[0]->CGST_Amt ?>
+ = $inv_master_data[0]->SGST_Amt ?>
+ = $inv_master_data[0]->T_Net_Amount ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/purchase_invoice_scan.php b/old_code_ci3/views/Medical/Purchase/purchase_invoice_scan.php
new file mode 100644
index 0000000..b855675
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/purchase_invoice_scan.php
@@ -0,0 +1,112 @@
+
+
+
Inv ID : =$purchase_invoice[0]->id?>
+ / Inv Code : =$purchase_invoice[0]->Invoice_no?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/purchase_item_old.php b/old_code_ci3/views/Medical/Purchase/purchase_item_old.php
new file mode 100644
index 0000000..b95162a
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/purchase_item_old.php
@@ -0,0 +1,37 @@
+0){
+ $item_name=$purchase_item_old[0]->Item_name;
+ }
+?>
+
Item : =$item_name?> Last 5 Purchase Orders
+
+
+
+ Date
+ MRP
+ Qty
+ Rate
+ SCH/Disc
+ P.U.Rate
+ Supplier/Invoice
+
+ ';
+ echo ''.$row->date_of_invoice_str.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->qty).'+'.floatval($row->qty_free).' ';
+ echo ''.$row->purchase_price.' ';
+ echo ''.$row->sch_disc_per.' / '.$row->discount.' ';
+ echo ''.$row->purchase_unit_rate.' ';
+ echo ''.$row->name_supplier.'/'.$row->Invoice_no.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/purchase_supp_list.php b/old_code_ci3/views/Medical/Purchase/purchase_supp_list.php
new file mode 100644
index 0000000..35130ec
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/purchase_supp_list.php
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+ Amount
+
+
+
+
+ ischallan==0){
+ echo '';
+ }else{
+ echo ' ';
+ }
+ ?>
+
+ =$purchase_list[$i]->Invoice_no ?>
+ =$purchase_list[$i]->name_supplier ?>
+ =$purchase_list[$i]->date_of_invoice ?>
+ =$purchase_list[$i]->tamount ?>
+
+ View & Edit
+ Print
+ tamount==0){ ?>
+ Delete
+
+
+
+
+
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+ Amount
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/scan_purchase_list.php b/old_code_ci3/views/Medical/Purchase/scan_purchase_list.php
new file mode 100644
index 0000000..1c71cb9
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/scan_purchase_list.php
@@ -0,0 +1,31 @@
+
+
';
+ $pos=strpos($purchase_invoice_scan_file[$i]->full_path,'/medical_uploads/purchase_invoice',1) ;
+ $file_path=substr($purchase_invoice_scan_file[$i]->full_path,$pos);
+
+
+
+ //echo $file_path;
+ //$pos=strpos($file_path,'/uploads/',1) ;
+ //$file_path=str_replace('Hospital_DR_B_C_JOSHI/uploads','uploads',$purchase_invoice_scan_file[$i]->full_path);
+
+ if($purchase_invoice_scan_file[$i]->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ echo ' ';
+ echo '
+
'.$purchase_invoice_scan_file[$i]->file_name.'/'.$purchase_invoice_scan_file[$i]->insert_time.'
+
+
';
+ echo '
+
';
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/supplier_Edit.php b/old_code_ci3/views/Medical/Purchase/supplier_Edit.php
new file mode 100644
index 0000000..0bf2290
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/supplier_Edit.php
@@ -0,0 +1,139 @@
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+ 0)
+ {
+ $sid=$supplier_data[0]->sid;
+ $name_supplier=$supplier_data[0]->name_supplier;
+ $short_name=$supplier_data[0]->short_name;
+ $contact_no=$supplier_data[0]->contact_no;
+ $gst_no=$supplier_data[0]->gst_no;
+ $city=$supplier_data[0]->city;
+ $state=$supplier_data[0]->state;
+ $active=$supplier_data[0]->active;
+ }
+
+ ?>
+
+
+
+
+
+
+
State
+
+
+ state_name == $state) ? ' selected="selected"' : "";
+
+ echo ''.$row->state_name.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ A dd Supplier & Update
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/supplier_account.php b/old_code_ci3/views/Medical/Purchase/supplier_account.php
new file mode 100644
index 0000000..86cc95a
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/supplier_account.php
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ Balance
+ Last Inv. Date
+ Last Payment Date
+
+
+
+
+
+
+ =$supplier_data[$i]->name_supplier ?>
+ =$supplier_data[$i]->Tot_Balance ?>
+ =$supplier_data[$i]->Last_InvDate ?>
+ =$supplier_data[$i]->Last_Payment ?>
+
+ Open
+
+
+
+
+
+
+ Name
+ Balance
+ Last Inv. Date
+ Last Payment Date
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/supplier_account_detail.php b/old_code_ci3/views/Medical/Purchase/supplier_account_detail.php
new file mode 100644
index 0000000..6363639
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/supplier_account_detail.php
@@ -0,0 +1,91 @@
+
+
+
+
+
+ 'form_search');
+ echo form_open('/Medical_backpanel/search_result_tran/'.$supplier_data[0]->sid,$attributes); ?>
+
+
+
Statement Date Range
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/supplier_account_payment.php b/old_code_ci3/views/Medical/Purchase/supplier_account_payment.php
new file mode 100644
index 0000000..3ed8baa
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/supplier_account_payment.php
@@ -0,0 +1,89 @@
+
+
+
+
+
+ 'form_search');
+ echo form_open('/Medical_backpanel/payment_supplier_data',$attributes); ?>
+
+
+
Statement Date Range
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/supplier_list.php b/old_code_ci3/views/Medical/Purchase/supplier_list.php
new file mode 100644
index 0000000..2928a8d
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/supplier_list.php
@@ -0,0 +1,32 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/supplier_master.php b/old_code_ci3/views/Medical/Purchase/supplier_master.php
new file mode 100644
index 0000000..0816194
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/supplier_master.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+ =$supplier_data[$i]->name_supplier ?>
+ =$supplier_data[$i]->gst_no ?>
+
+ Edit
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase/supplier_master_sub.php b/old_code_ci3/views/Medical/Purchase/supplier_master_sub.php
new file mode 100644
index 0000000..a5551df
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase/supplier_master_sub.php
@@ -0,0 +1,30 @@
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+ =$supplier_data[$i]->name_supplier ?>
+ =$supplier_data[$i]->name_supplier ?>
+
+ Edit
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Purchase_Invoice_Edit.php b/old_code_ci3/views/Medical/Purchase_Invoice_Edit.php
new file mode 100644
index 0000000..5928ebd
--- /dev/null
+++ b/old_code_ci3/views/Medical/Purchase_Invoice_Edit.php
@@ -0,0 +1,386 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/IPD_Discharge_Report.php b/old_code_ci3/views/Medical/Report/IPD_Discharge_Report.php
new file mode 100644
index 0000000..35134dc
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/IPD_Discharge_Report.php
@@ -0,0 +1,79 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Payment_Recevie.php b/old_code_ci3/views/Medical/Report/Med_Payment_Recevie.php
new file mode 100644
index 0000000..af60099
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Payment_Recevie.php
@@ -0,0 +1,105 @@
+
+
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_1.php b/old_code_ci3/views/Medical/Report/Med_Report_1.php
new file mode 100644
index 0000000..5445f11
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_1.php
@@ -0,0 +1,80 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_2.php b/old_code_ci3/views/Medical/Report/Med_Report_2.php
new file mode 100644
index 0000000..3eae13d
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_2.php
@@ -0,0 +1,77 @@
+
+
+
+
+ Date Range
+
+
+
+ Bill Type
+
+ ALL
+ OPD CASH
+ IPD CASH
+ OPD Org.
+ IPD Cr
+ IPD Pkg Cr
+ Hospital Cr
+
+
+
+
+
+ Show
+ Excel
+ Short
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_2_Pending.php b/old_code_ci3/views/Medical/Report/Med_Report_2_Pending.php
new file mode 100644
index 0000000..c4bb772
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_2_Pending.php
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+ Show Pending Balance
+ Excel
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_2_Pending_paid.php b/old_code_ci3/views/Medical/Report/Med_Report_2_Pending_paid.php
new file mode 100644
index 0000000..7573e2c
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_2_Pending_paid.php
@@ -0,0 +1,51 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_3.php b/old_code_ci3/views/Medical/Report/Med_Report_3.php
new file mode 100644
index 0000000..25763de
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_3.php
@@ -0,0 +1,79 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_4.php b/old_code_ci3/views/Medical/Report/Med_Report_4.php
new file mode 100644
index 0000000..91fb7b4
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_4.php
@@ -0,0 +1,80 @@
+
+
+
+
+
Discharge Date Range
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_5.php b/old_code_ci3/views/Medical/Report/Med_Report_5.php
new file mode 100644
index 0000000..651079c
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_5.php
@@ -0,0 +1,101 @@
+
+
+
+
+
Discharge Date Range
+
+
+
+
+
+
+
+
+
+ Invoice Show
+ Invoice Excel
+
+
+
+
+
+ HSN Wise Show
+ HSN Wise Excel
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_7.php b/old_code_ci3/views/Medical/Report/Med_Report_7.php
new file mode 100644
index 0000000..bfc62a1
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_7.php
@@ -0,0 +1,106 @@
+
+
+
+
+
Discharge Date Range
+
+
+
+
+
+
+
+ Select Supplier
+
+ All
+ sid.' >'.$row->name_supplier.'';
+ }
+ ?>
+
+
+
+ Select Account
+
+ All
+ bank_id.' >'.$row->bank_account_name.'';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_Doc_med_sale.php b/old_code_ci3/views/Medical/Report/Med_Report_Doc_med_sale.php
new file mode 100644
index 0000000..8b13562
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_Doc_med_sale.php
@@ -0,0 +1,100 @@
+
+
+
+
+
+
Company Master
+
+
+ p_fname.'" >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+ Show Sale
+ Excel Sale
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_IPD_Credit.php b/old_code_ci3/views/Medical/Report/Med_Report_IPD_Credit.php
new file mode 100644
index 0000000..9e9e5ea
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_IPD_Credit.php
@@ -0,0 +1,91 @@
+
+
+
+
+
Discharge Date Range
+
+
+
+
+
+
+
+ Bill Type
+
+ ALL
+ CASH
+ Credit to Hospital
+ Package
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_company_med_sale.php b/old_code_ci3/views/Medical/Report/Med_Report_company_med_sale.php
new file mode 100644
index 0000000..e5ef06d
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_company_med_sale.php
@@ -0,0 +1,119 @@
+
+
+
+
+
+
Company Master
+
+
+ id.'" >'.$company_master->company_name.'';
+ }
+ ?>
+
+
+
+
+
+
+ Show Sale
+ Excel Sale
+
+
+
+
+
+ Show Purchase
+ Excel Purchase
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_daily_med_doc_sale.php b/old_code_ci3/views/Medical/Report/Med_Report_daily_med_doc_sale.php
new file mode 100644
index 0000000..551c897
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_daily_med_doc_sale.php
@@ -0,0 +1,110 @@
+
+
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+ Show IPD
+ Excel IPD
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_Report_daily_med_sale.php b/old_code_ci3/views/Medical/Report/Med_Report_daily_med_sale.php
new file mode 100644
index 0000000..d6b9cb6
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_Report_daily_med_sale.php
@@ -0,0 +1,79 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Med_high_pending.php b/old_code_ci3/views/Medical/Report/Med_high_pending.php
new file mode 100644
index 0000000..4c8fa82
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Med_high_pending.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+
+
+ Sr.
+
+
+ IPD No.
+
+
+ UHID No.
+
+
+ Patient Name
+
+
+ Phone No.
+
+
+ Total Bill
+
+
+ Paid Amount
+
+
+ Balance
+
+
+
+
+
+ =$sr_no?>
+
+
+ =$row->ipd_code?>
+
+
+ =$row->p_code?>
+
+
+ =$row->p_fname?>
+
+
+ =$row->mphone1?>
+
+
+ =$row->net_amount?>
+
+
+ =$row->payment_received?>
+
+
+ =$row->payment_balance?>
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Report/Purchase_Invoice.php b/old_code_ci3/views/Medical/Report/Purchase_Invoice.php
new file mode 100644
index 0000000..8aff4c0
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Purchase_Invoice.php
@@ -0,0 +1,120 @@
+
+
+
+
+
+ Supplier
+
+ ALL
+ sid.' >'.$row->name_supplier.'';
+ }
+ ?>
+
+
+
+
+
+
+ Show with GST Rate
+ Export with GST Rate
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Report_Med_patient.php b/old_code_ci3/views/Medical/Report/Report_Med_patient.php
new file mode 100644
index 0000000..cecbbc0
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Report_Med_patient.php
@@ -0,0 +1,127 @@
+
+
+'form','class'=>'form2')); ?>
+
+
+
+ Type of medicine
+
+ Schedule H
+ Schedule H1
+ Schedule X
+ Schedule G
+ Narcotic
+ High Risk
+
+
+
+ Drug Name
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Report_Med_patient_result.php b/old_code_ci3/views/Medical/Report/Report_Med_patient_result.php
new file mode 100644
index 0000000..30ebf36
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Report_Med_patient_result.php
@@ -0,0 +1,67 @@
+
+
+
+
+
+ Item Name
+ Sale Drug Report Customer Wise
+
+
+
+
+
+
+ =$row->item_Name ?>
+
+
+ p_list);
+ echo '
+
+ Inv.No.
+ Inv.Date
+ IPD No.
+ P Code/Name
+ Exp. Date
+ Batch
+ Qty
+ ';
+ foreach ($data_array as $value) {
+ $value_array=explode(";",$value);
+
+ if(count($value_array)<9)
+ {
+ echo '';
+ echo ' Too many Records, Select min Date Range ';
+ echo ' ';
+ }else{
+ echo '';
+ echo ' '.$value_array[0].' ';
+ echo ' '.$value_array[1].' ';
+ echo ' '.$value_array[7].' ';
+ echo ' '.$value_array[4].' / '.$value_array[5].' ';
+ echo ' '.$value_array[2].' ';
+ echo ' '.$value_array[8].' ';
+ echo ' '.$value_array[9].' ';
+ echo ' ';
+ }
+
+ }
+ echo '
';
+ ?>
+
+
+
+
+
+
+ Item Name
+ Stock Batch Invoice Status
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Report/Report_gst_1.php b/old_code_ci3/views/Medical/Report/Report_gst_1.php
new file mode 100644
index 0000000..03b7e43
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Report_gst_1.php
@@ -0,0 +1,79 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Report/Report_org_invoice_list.php b/old_code_ci3/views/Medical/Report/Report_org_invoice_list.php
new file mode 100644
index 0000000..c2ec7d6
--- /dev/null
+++ b/old_code_ci3/views/Medical/Report/Report_org_invoice_list.php
@@ -0,0 +1,96 @@
+
+
+
+
+
Discharge Date Range
+
+
+
+
+
+
+
+
+ Insurance
+
+ All Org.
+ id.'" '.combo_checked($ins_company_id,$row->id).' >'.$row->ins_company_name.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Search_Patient.php b/old_code_ci3/views/Medical/Search_Patient.php
new file mode 100644
index 0000000..8538815
--- /dev/null
+++ b/old_code_ci3/views/Medical/Search_Patient.php
@@ -0,0 +1,22 @@
+
+ 'form','class'=>'form2')); ?>
+
+
+
+ Go!
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/Lost_medicine.php b/old_code_ci3/views/Medical/Stock/Lost_medicine.php
new file mode 100644
index 0000000..706d40a
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/Lost_medicine.php
@@ -0,0 +1,80 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/Short_medicine.php b/old_code_ci3/views/Medical/Stock/Short_medicine.php
new file mode 100644
index 0000000..26fdf29
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/Short_medicine.php
@@ -0,0 +1,106 @@
+
+
+
+
+
+ Formulation
+
+
+ =$row->formulation_length ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/Stock_search_qty_result.php b/old_code_ci3/views/Medical/Stock/Stock_search_qty_result.php
new file mode 100644
index 0000000..3a3cbea
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/Stock_search_qty_result.php
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+ Item Name
+ Supplier
+ Sale Unit Qty
+ Current Unit Qty
+ Re-Order Qty
+ Alert Qty
+
+
+
+
+
+
+ =$row->Item_name ?>
+
+
+ =$row->supplier_names ?>
+
+
+ =$row->sal_qty ?>
+
+ T_unit - $row->sal_qty;
+ echo $C_Qty;
+ ?>
+
+
+
+ =$row->re_order_qty ?>
+
+
+ re_order_qty)
+ {
+ echo 'Qty Low
';
+ }
+
+ ?>
+
+
+
+
+
+
+
+ Item Name
+ Supplier
+ Sale Unit Qty
+ Current Unit Qty
+ Re-Order Qty
+ Alert Qty
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/Stock_search_result.php b/old_code_ci3/views/Medical/Stock/Stock_search_result.php
new file mode 100644
index 0000000..24ace19
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/Stock_search_result.php
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+ Item Name
+ Stock Batch Invoice Status
+
+
+
+
+
+
+ =$row->Item_name ?>
+ Supplier :=$row->name_supplier ?>
+ Current Total Stock : =$row->Current_Stock ?>
+
+
+ Qty_BatchWise);
+ echo '
+
+ Inv.No.
+ Bat.No.
+ Exp.Dt.
+ MRP/Purchase Price/Date
+ Qty
+ T.Unit Qty.
+ Cur.Unit Qty.
+ Sale Unit
+ Return Unit
+ Lost Unit
+ Update New Lost Units
+ Remove Unit
+ ';
+ foreach ($data_array as $value) {
+ $value_array=explode(";",$value);
+
+ if($value_array[8]==1)
+ {
+ $style='style="color:Red;"';
+ }else{
+ $style='';
+ }
+
+ echo '';
+ echo ' '.$value_array[1].' ';
+ echo ' '.$value_array[2].' ';
+ echo ' '.$value_array[3].' ';
+ echo ' '.$value_array[4].'/'.$value_array[12].'/'.$value_array[13].' ';
+ echo ' '.$value_array[5].' ';
+ echo ' '.$value_array[11].' ';
+ echo ' '.$value_array[6].'
';
+ echo ' '.$value_array[7].' ';
+ echo ' '.$value_array[9].' ';
+ echo ' '.$value_array[10].' ';
+ echo '
+ ';
+ echo ' ';
+ echo ' ';
+ }
+ echo '
';
+ ?>
+
+
+
+
+
+
+ Item Name
+ Stock Batch Invoice Status
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/expiry_stock_list.php b/old_code_ci3/views/Medical/Stock/expiry_stock_list.php
new file mode 100644
index 0000000..b2ab83d
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/expiry_stock_list.php
@@ -0,0 +1,51 @@
+
+
+
+ ';
+ echo '';
+ echo '# ';
+ echo 'Item ';
+ echo 'Supplier ';
+ echo 'Pur.Date ';
+ echo 'Bat. ';
+ echo 'Exp.Dt ';
+ echo 'Rate ';
+ echo 'Qty ';
+ echo 'C.Qty ';
+ echo ' ';
+ echo '';
+ $srno=0;
+
+ echo '';
+ foreach($purchase_list as $row)
+ {
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->name_supplier.' ';
+ echo ''.$row->str_date_of_invoice.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->exp_date.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.$row->tqty .' ';
+ echo ''.$row->cur_qty.' ';
+
+ echo ' ';
+
+ $inv_id=$row->pur_id;
+ }
+ echo ' ';
+ ?>
+
+
+
diff --git a/old_code_ci3/views/Medical/Stock/indent_accept_items_list.php b/old_code_ci3/views/Medical/Stock/indent_accept_items_list.php
new file mode 100644
index 0000000..3ade01a
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_accept_items_list.php
@@ -0,0 +1,86 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_counter_edit.php b/old_code_ci3/views/Medical/Stock/indent_counter_edit.php
new file mode 100644
index 0000000..43a4ab4
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_counter_edit.php
@@ -0,0 +1,213 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_counter_item_list.php b/old_code_ci3/views/Medical/Stock/indent_counter_item_list.php
new file mode 100644
index 0000000..ce4a324
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_counter_item_list.php
@@ -0,0 +1,36 @@
+
+
+ #
+ Item Name
+ Formulation
+ Generic Name
+ Qty.
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->formulation.' ';
+ echo ''.$row->genericname.' ';
+ echo ''.$row->request_qty.' ';
+ echo '
+ ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+ Item Name
+ Formulation
+ Generic Name
+ Qty.
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_counter_list.php b/old_code_ci3/views/Medical/Stock/indent_counter_list.php
new file mode 100644
index 0000000..3487b50
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_counter_list.php
@@ -0,0 +1,41 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_counter_search_result.php b/old_code_ci3/views/Medical/Stock/indent_counter_search_result.php
new file mode 100644
index 0000000..ae59701
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_counter_search_result.php
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+ Indent ID
+ Store/Type
+ Date
+ Product List
+ Status
+
+
+
+
+
+
+ =$indent_req_list[$i]->indent_code ?>
+ =$indent_req_list[$i]->store_name.'/'.$indent_req_list[$i]->indent_request_type_str ?>
+ =$indent_req_list[$i]->created_date ?>
+ =$indent_req_list[$i]->product_list ?>
+ =$indent_req_list[$i]->request_status_str ?>
+
+ request_status==0 ) { ?>
+ Accept For Process
+ request_status==1 ) { ?>
+ Accept For Process
+ request_status==2){ ?>
+ Indent Item Process
+ request_status==3){ ?>
+ Store Verification
+
+
+
+
+
+
+
+
+
+ Indent ID
+ Store
+ Date
+ Status
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_issue.php b/old_code_ci3/views/Medical/Stock/indent_issue.php
new file mode 100644
index 0000000..e69de29
diff --git a/old_code_ci3/views/Medical/Stock/indent_issue_item_view.php b/old_code_ci3/views/Medical/Stock/indent_issue_item_view.php
new file mode 100644
index 0000000..9978455
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_issue_item_view.php
@@ -0,0 +1,38 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_issue_items.php b/old_code_ci3/views/Medical/Stock/indent_issue_items.php
new file mode 100644
index 0000000..937dae0
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_issue_items.php
@@ -0,0 +1,78 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_req_view_with_store.php b/old_code_ci3/views/Medical/Stock/indent_req_view_with_store.php
new file mode 100644
index 0000000..5e83dd4
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_req_view_with_store.php
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Formulation
+ Generic Name
+ Qty.
+ Min Qty
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->formulation.' ';
+ echo ''.$row->genericname.' ';
+ echo ''.$row->request_qty.' ';
+ echo ''.$row->min_requirement.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+ Item Name
+ Formulation
+ Generic Name
+ Qty.
+ Min Qty
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Stock/indent_request.php b/old_code_ci3/views/Medical/Stock/indent_request.php
new file mode 100644
index 0000000..1f30b32
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_request.php
@@ -0,0 +1,30 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_request_search_result.php b/old_code_ci3/views/Medical/Stock/indent_request_search_result.php
new file mode 100644
index 0000000..ab8562c
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_request_search_result.php
@@ -0,0 +1,56 @@
+
+
+
+
+
+
+
+ Indent ID
+ Store/Type
+ Date
+ Product List
+ Status
+
+
+
+
+
+
+ =$indent_req_list[$i]->indent_code ?>
+ =$indent_req_list[$i]->store_name.'/'.$indent_req_list[$i]->indent_request_type_str ?>
+ =$indent_req_list[$i]->created_date ?>
+ =$indent_req_list[$i]->product_list ?>
+ =$indent_req_list[$i]->request_status_str ?>
+
+ request_status==1 ) { ?>
+ Accept For Process
+ request_status==2){ ?>
+ Indent Item Process
+ request_status==3){ ?>
+ Store Verification
+
+
+
+
+
+
+
+
+
+ Indent ID
+ Store
+ Date
+ Status
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/indent_stock_list.php b/old_code_ci3/views/Medical/Stock/indent_stock_list.php
new file mode 100644
index 0000000..846f15c
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/indent_stock_list.php
@@ -0,0 +1,61 @@
+'form','class'=>'form1')); ?>
+
+
+
+
+
+ #
+ Item Name
+ Batch No.
+ Expiry Date
+ Qty.
+ Issued Qty.
+ Action
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry_date.' ';
+ echo ''.$row->tqty.' ';
+ echo ''.$row->issue_item.' ';
+ if($row->store_stock_id==0)
+ {
+ echo '
+ ';
+ }else{
+ echo ' ' ;
+ }
+
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+ Item Name
+ Batch No.
+ Expiry Date
+ Qty.
+ Issued Qty.
+ Action
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/invoice_item_log.php b/old_code_ci3/views/Medical/Stock/invoice_item_log.php
new file mode 100644
index 0000000..ba0da1e
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/invoice_item_log.php
@@ -0,0 +1,80 @@
+
+
+ 'form_payment_log','role'=>'form')); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/invoice_item_log_data.php b/old_code_ci3/views/Medical/Stock/invoice_item_log_data.php
new file mode 100644
index 0000000..4f41b26
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/invoice_item_log_data.php
@@ -0,0 +1,123 @@
+
+
+
+ #
+ Invoice Code
+ Invoice Date
+ Name
+ Item Deleted
+ Payment Log
+ Update Log
+
+
+
+
+
+
+ inv_med_code; ?>
+ inv_date; ?>
+ inv_name; ?>
+
+ del_item_list);
+ //print_r($item_removed_log);
+ if(count($item_removed_log)>0) {
+ echo "";
+ echo "";
+ echo "Item Name ";
+ echo "Qty ";
+ echo "Price ";
+ echo "Amount ";
+ echo "Delete By ";
+ echo " ";
+ $item_amount_total = 0;
+ foreach($item_removed_log as $row_item) {
+
+ $item = explode("#",$row_item);
+
+ echo "";
+ echo "".$item[0]." ";
+ echo "".$item[1]." ";
+ echo "".$item[2]." ";
+ echo "".$item[3]." ";
+ echo "".$item[5]." ";
+ echo " ";
+ $item_amount_total += $item[3];
+ }
+ echo "Total Amount : ".$item_amount_total." ";
+ echo "
";
+ } else {
+ echo "No Item Deleted";
+ }
+
+ ?>
+
+
+ payment_log);
+ //print_r($item_removed_log);
+ if(count($payment_log_list)>0) {
+ echo "";
+ echo "";
+ echo "Payment Type ";
+ echo "Amount ";
+ echo "Payment By ";
+ echo " ";
+ foreach($payment_log_list as $row_item) {
+
+ $item = explode("#",$row_item);
+
+ echo "";
+ echo "";
+ if(isset($item[0])) {
+ if($item[0]==0) {
+ echo "Credit";
+ }else if($item[0]==1) {
+ echo "Return";
+ }
+ }
+ echo " ";
+
+ echo "";
+ if(isset($item[1])) echo $item[1];
+ echo " ";
+
+ echo "";
+ if(isset($item[2])) echo $item[2];
+ echo " ";
+
+ echo " ";
+ }
+
+ echo "
";
+ } else {
+ echo "No Payment Log";
+ }
+ ?>
+
+ log; ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/main_store_dashboard.php b/old_code_ci3/views/Medical/Stock/main_store_dashboard.php
new file mode 100644
index 0000000..54b6371
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/main_store_dashboard.php
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Stock/merge_product.php b/old_code_ci3/views/Medical/Stock/merge_product.php
new file mode 100644
index 0000000..d7eff00
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/merge_product.php
@@ -0,0 +1,109 @@
+
+
+
+
+
+
+
+
+ From Product ID (Master Product)
+
+
+
+
+
+
+
+
+
+
+
+ To Product ID
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/new_purchase_return_invoice.php b/old_code_ci3/views/Medical/Stock/new_purchase_return_invoice.php
new file mode 100644
index 0000000..b776a49
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/new_purchase_return_invoice.php
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Supplier
+
+ sid.' >'.$row->name_supplier.'';
+ }
+ ?>
+
+
+
+
+
+ C reate
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/purchase_invoice_item_print.php b/old_code_ci3/views/Medical/Stock/purchase_invoice_item_print.php
new file mode 100644
index 0000000..3cbd9b6
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/purchase_invoice_item_print.php
@@ -0,0 +1,131 @@
+
+
+
+
+
+=M_store?>
+
+
+
+ =M_address?>, Uttarakhand
+ ';
+
+ if(H_Med_GST!='')
+ {
+ echo 'GST: '.H_Med_GST .' ';
+ }
+
+ if(M_LIC!='')
+ {
+ echo ' L.No: '.M_LIC;
+ }
+ ?>
+
+
+
+ Invoice From :
+ Supplier : =$inv_master_data[0]->name_supplier?>
+ Purchase Invoice No.: =$inv_master_data[0]->Invoice_no?>
+ Invoice Date : =MysqlDate_to_str($inv_master_data[0]->date_of_invoice)?>
+
+
+
+
+Purchase Invoice
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$inv_master_data[0]->Invoice_no?> / Name : =$inv_master_data[0]->name_supplier?>
+
+
+
+
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+ item_return==1)
+ {
+ $style='style="color:Red;"';
+ }else{
+ $style='';
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry_date.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->qty).'+'.floatval($row->qty_free).' ';
+ echo ''.$row->purchase_price.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->discount.' ';
+ echo ''.$row->taxable_amount.' ';
+ echo ''.$row->CGST_per.' ';
+ echo ''.$row->SGST_per.' ';
+ echo ''.$row->net_amount.' ';
+ echo ' ';
+ }
+ ?>
+
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+ =$inv_master_data[0]->Taxable_Amt ?>
+ =$inv_master_data[0]->CGST_Amt ?>
+ =$inv_master_data[0]->SGST_Amt ?>
+ =$inv_master_data[0]->T_Net_Amount ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/purchase_invoice_list.php b/old_code_ci3/views/Medical/Stock/purchase_invoice_list.php
new file mode 100644
index 0000000..8482dcf
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/purchase_invoice_list.php
@@ -0,0 +1,68 @@
+
+
diff --git a/old_code_ci3/views/Medical/Stock/purchase_product_search.php b/old_code_ci3/views/Medical/Stock/purchase_product_search.php
new file mode 100644
index 0000000..eca0352
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/purchase_product_search.php
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/purchase_return.php b/old_code_ci3/views/Medical/Stock/purchase_return.php
new file mode 100644
index 0000000..6ba648b
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/purchase_return.php
@@ -0,0 +1,29 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/purchase_return_invoice_edit.php b/old_code_ci3/views/Medical/Stock/purchase_return_invoice_edit.php
new file mode 100644
index 0000000..fd14d9b
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/purchase_return_invoice_edit.php
@@ -0,0 +1,161 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/purchase_return_invoice_item.php b/old_code_ci3/views/Medical/Stock/purchase_return_invoice_item.php
new file mode 100644
index 0000000..3b33071
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/purchase_return_invoice_item.php
@@ -0,0 +1,50 @@
+
+
+ #
+ RecNo
+ Item Name
+ Batch No
+ Exp.
+ MRP / P. Rate/Unit
+ Qty.(Unit / Pack)
+ Rate
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->r_id.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no_r_s.' ';
+ echo ''.$row->exp_date_str.' ';
+ echo ''.$row->mrp.' / '.$row->purchase_unit_rate.' ';
+ echo ''.floatval($row->r_qty).' / '.floatval($row->qty_pak).' ';
+ echo ''.$row->r_amount.' ';
+ echo '';
+ if(1==1)
+ {
+ echo ' ';
+ }
+ echo ' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/purchase_return_invoice_item_print.php b/old_code_ci3/views/Medical/Stock/purchase_return_invoice_item_print.php
new file mode 100644
index 0000000..550b6b2
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/purchase_return_invoice_item_print.php
@@ -0,0 +1,114 @@
+
+
+
+
+
+=M_store?>
+
+
+
+ =M_address?>, Uttarakhand
+ ';
+
+ if(H_Med_GST!='')
+ {
+ echo 'GST: '.H_Med_GST .' ';
+ }
+
+ if(M_LIC!='')
+ {
+ echo ' L.No: '.M_LIC;
+ }
+ ?>
+
+
+
+ Invoice To :
+ Supplier : =$purchase_return_invoice[0]->name_supplier?>
+ Purchase Return Invoice No.: =$purchase_return_invoice[0]->Invoice_no?>
+ Invoice Date : =$purchase_return_invoice[0]->str_date_of_invoice ?>
+
+
+
+
+Purchase Return
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$purchase_return_invoice[0]->Invoice_no ?> / Name : =$purchase_return_invoice[0]->name_supplier ?>
+
+
+
+
+
+
+ #
+ RecNo
+ Item Name
+ Batch No
+ Exp.
+ MRP of Pack
+ Return Unit Qty/ Pack.
+ Rate Unit
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->r_id.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ' '.$row->exp_date_str.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->r_qty).' / '.floatval($row->qty_pak).' ';
+ echo ''.$row->purchase_price.' / '.$row->purchase_unit_rate.' ';
+ echo ''.Round($row->r_qty*$row->purchase_unit_rate,2).' ';
+ echo '';
+ $total_amt+=Round($row->r_qty*$row->purchase_unit_rate,2);
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+ Total
+ =$total_amt?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/purchase_supp_list.php b/old_code_ci3/views/Medical/Stock/purchase_supp_list.php
new file mode 100644
index 0000000..a5d55d7
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/purchase_supp_list.php
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+
+
+
+
+
+
+ =$purchase_return_invoice[$i]->p_r_invoice_no ?>
+ =$purchase_return_invoice[$i]->name_supplier ?>
+ =$purchase_return_invoice[$i]->date_of_invoice ?>
+
+ View & Edit
+ Print
+
+
+
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/stock_search.php b/old_code_ci3/views/Medical/Stock/stock_search.php
new file mode 100644
index 0000000..de502b8
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/stock_search.php
@@ -0,0 +1,58 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock/stock_transfer.php b/old_code_ci3/views/Medical/Stock/stock_transfer.php
new file mode 100644
index 0000000..54ca9eb
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock/stock_transfer.php
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
+
+ From Purchase SSNO
+
+
+
+
+
+
+
+
+
+
+
+
+
+ To Purchase SSNO
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Qty of Product in unit
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Stock_Update.php b/old_code_ci3/views/Medical/Stock_Update.php
new file mode 100644
index 0000000..f1bd0a9
--- /dev/null
+++ b/old_code_ci3/views/Medical/Stock_Update.php
@@ -0,0 +1,211 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+ Quantity(Total Tables(s))
+
+
+
+
+
+
+
+
+
+
+ Supplier
+
+ sid.' '.combo_checked($row->sid,$stock_item[0]->supplier_id).' >'.$row->name_supplier.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Store/Stock_Item_history.php b/old_code_ci3/views/Medical/Store/Stock_Item_history.php
new file mode 100644
index 0000000..2b165ba
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store/Stock_Item_history.php
@@ -0,0 +1,58 @@
+
+
+ Pur. ID
+ Supplier
+ Inv.No / Date
+ Bat.No.
+ Exp.Dt.
+ MRP
+ Purchase
+ Qty / Packing
+ Unit Qty
+ Sale U.Qty
+ Return Unit
+ Curr.U.Qty
+ Update Lost Unit
+ Remove
+
+
+
+ =$row->id?>
+ =$row->name_supplier?>
+ =$row->Invoice_no?> =$row->date_of_invoice?>
+ =$row->batch_no?>
+ =$row->expiry_date?>
+ =$row->mrp?>
+ =$row->purchase_price?>
+ =$row->tqty?> / =$row->packing?>
+ =$row->total_unit?>
+ =$row->total_sale_unit?>
+ =$row->total_return_unit?>
+ =$row->cur_unit?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Store/Stock_Item_history_removed.php b/old_code_ci3/views/Medical/Store/Stock_Item_history_removed.php
new file mode 100644
index 0000000..0e3a61b
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store/Stock_Item_history_removed.php
@@ -0,0 +1,60 @@
+
+
+ Pur. ID
+ Supplier
+ Inv.No / Date
+ Bat.No.
+ Exp.Dt.
+ MRP
+ Purchase
+ Qty
+ Unit Qty
+ Sale U.Qty
+ Lost Unit
+ Curr.U.Qty
+ Update Lost Unit
+ Remove
+
+
+
+ =$row->id?>
+ =$row->name_supplier?>
+ =$row->Invoice_no?> =$row->date_of_invoice?>
+ =$row->batch_no?>
+ =$row->expiry_date?>
+ =$row->mrp?>
+ =$row->purchase_price?>
+ =$row->tqty?>
+ =$row->total_unit?>
+ =$row->total_sale_unit?>
+ =$row->total_lost_unit?>
+ =$row->cur_unit?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Store/Stock_Item_history_return.php b/old_code_ci3/views/Medical/Store/Stock_Item_history_return.php
new file mode 100644
index 0000000..8fec641
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store/Stock_Item_history_return.php
@@ -0,0 +1,96 @@
+
+
+
+
+
+
+
+
+ Invoice No
+ Supplier Name
+ Date
+ Item Name
+ Unit Qty
+
+
+
+ qty;
+ ?>
+
+ p_r_invoice_no; ?>
+ name_supplier; ?>
+ date_of_invoice; ?>
+ Item_name; ?>
+ qty; ?>
+
+
+
+
+ Total Return Qty
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Invoice No
+ Supplier Name
+ Date
+ Item Name
+ Qty
+ Packing
+ Unit Qty
+
+
+
+ qty;
+ $total_unit_invoice_qty += ($row->packing*$row->qty);
+ ?>
+
+ Invoice_no; ?>
+ name_supplier; ?>
+ date_of_invoice; ?>
+ Item_name; ?>
+ qty; ?>
+ packing; ?>
+ packing*$row->qty; ?>
+
+
+
+
+ Total Invoice Qty
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/Store/Stock_search_result.php b/old_code_ci3/views/Medical/Store/Stock_search_result.php
new file mode 100644
index 0000000..fe3539d
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store/Stock_search_result.php
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+
+ Item Name
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Lost Unit
+ Package/Re-Order Qty
+ Removed Qty
+
+
+
+
+
+
+
+ =$row->item_name ?>
+ genericname)>0){
+ echo ''.$row->genericname.' ';
+ }
+ ?>
+
+
+ =$row->C_Pak_Qty?>
+
+
+ =Round($row->C_Unit_Stock_Qty,2) ?>
+
+
+ =Round($row->C_Pak_Sale_Qty,2) ?>
+
+
+ =Round($row->sale_unit,2) ?>
+
+
+ =Round($row->total_lost_unit,2) ?>
+
+
+ =$row->packing ?>/=$row->re_order_qty ?>
+
+
+ Return Info
+
+
+
+
+
+
+ Item Name
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Lost Unit
+ Package/Re-Order Qty
+ Removed Qty
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Store/stock_store_statement.php b/old_code_ci3/views/Medical/Store/stock_store_statement.php
new file mode 100644
index 0000000..0c00f71
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store/stock_store_statement.php
@@ -0,0 +1,147 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Store/stock_store_statement_data.php b/old_code_ci3/views/Medical/Store/stock_store_statement_data.php
new file mode 100644
index 0000000..ba7a32c
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store/stock_store_statement_data.php
@@ -0,0 +1,197 @@
+
+
+
+
+
+
+
+ Item Name
+ Pur Pak.
+ Pur Cost
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Lost Unit
+ Package/Re-Order Qty
+ Removed Qty
+
+
+
+
+
+
+
+ =$row->item_name ?>
+
+
+ =Round($row->total_pak_qty,2) ?>
+
+
+ =Round($row->purchase_cost,2) ?>
+
+
+ =Round($row->C_Pak_Qty,2) ?>
+
+
+ =Round($row->C_Unit_Stock_Qty,2) ?>
+
+
+ =Round($row->C_Pak_Sale_Qty,2) ?>
+
+
+ =Round($row->sale_unit,2) ?>
+
+
+ =Round($row->total_lost_unit,2) ?>
+
+
+ =$row->packing ?>/=$row->re_order_qty ?>
+
+
+ Show
+
+
+
+
+
+
+ Item Name
+ Pur Pak.
+ Pur Cost
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Lost Unit
+ Package/Re-Order Qty
+ Removed Qty
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Store/stock_store_statement_data_excel.php b/old_code_ci3/views/Medical/Store/stock_store_statement_data_excel.php
new file mode 100644
index 0000000..c43d837
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store/stock_store_statement_data_excel.php
@@ -0,0 +1,43 @@
+
+
+
+
+ Item Name
+ Pur Pak.
+ Pur Cost
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Stock Cost
+
+
+
+
+
+
+ = $row->item_name ?>
+
+
+ = Round($row->total_pak_qty, 2) ?>
+
+
+ = Round($row->purchase_cost, 2) ?>
+
+
+ = Round($row->C_Pak_Qty, 2) ?>
+
+
+ = Round($row->C_Unit_Stock_Qty, 2) ?>
+
+
+ = Round($row->C_Pak_Sale_Qty, 2) ?>
+
+
+ = Round($row->sale_unit, 2) ?>
+
+
+ = Round($row->total_lost_unit, 2) ?>
+
+
+ = $row->packing ?>/= $row->re_order_qty ?>
diff --git a/old_code_ci3/views/Medical/Store/store_stock_search.php b/old_code_ci3/views/Medical/Store/store_stock_search.php
new file mode 100644
index 0000000..4bffa71
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store/store_stock_search.php
@@ -0,0 +1,143 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Store_Dashboard.php b/old_code_ci3/views/Medical/Store_Dashboard.php
new file mode 100644
index 0000000..42b94f4
--- /dev/null
+++ b/old_code_ci3/views/Medical/Store_Dashboard.php
@@ -0,0 +1,45 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Storestock/drug_master_list.php b/old_code_ci3/views/Medical/Storestock/drug_master_list.php
new file mode 100644
index 0000000..718dff1
--- /dev/null
+++ b/old_code_ci3/views/Medical/Storestock/drug_master_list.php
@@ -0,0 +1,30 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Storestock/product_edit.php b/old_code_ci3/views/Medical/Storestock/product_edit.php
new file mode 100644
index 0000000..d9008ea
--- /dev/null
+++ b/old_code_ci3/views/Medical/Storestock/product_edit.php
@@ -0,0 +1,255 @@
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+ Category
+
+
+
+
+
+
+ ban_flag_id;
+ if($chk_ban_flag_id==1)
+ {
+ $chk_ban_flag_id_checkbox_checked="checked";
+ }else{
+ $chk_ban_flag_id_checkbox_checked="";
+ }
+
+ $chk_is_continue=$product_data[0]->is_continue;
+ if($chk_is_continue==1)
+ {
+ $chk_is_continue_checkbox_checked="checked";
+ }else{
+ $chk_is_continue_checkbox_checked="";
+ }
+
+ $chk_batch_applicable=$product_data[0]->batch_applicable;
+ if($chk_batch_applicable==1)
+ {
+ $chk_batch_applicable_checkbox_checked="checked";
+ }else{
+ $chk_batch_applicable_checkbox_checked="";
+ }
+
+ $chk_exp_date_applicable=$product_data[0]->exp_date_applicable;
+ if($chk_exp_date_applicable==1)
+ {
+ $chk_exp_date_applicable="checked";
+ }else{
+ $chk_exp_date_applicable="";
+ }
+
+
+
+ ?>
+
+
+ >Exp.Date Applicable
+
+
+
+
+
+
+
+
+
+
+ Company Master
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Storestock/product_new.php b/old_code_ci3/views/Medical/Storestock/product_new.php
new file mode 100644
index 0000000..d21a7a1
--- /dev/null
+++ b/old_code_ci3/views/Medical/Storestock/product_new.php
@@ -0,0 +1,167 @@
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Company Master
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Storestock/product_search_result.php b/old_code_ci3/views/Medical/Storestock/product_search_result.php
new file mode 100644
index 0000000..4dfcc62
--- /dev/null
+++ b/old_code_ci3/views/Medical/Storestock/product_search_result.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+ Prod. ID
+ Name
+ Formulation
+ Generic Name
+ Packing Type
+
+
+
+
+
+
+ =$product_list[$i]->id ?>
+ =$product_list[$i]->item_name ?>
+ =$product_list[$i]->formulation ?>
+ =$product_list[$i]->genericname ?>
+ =$product_list[$i]->packing ?>
+
+ Edit
+ Delete
+
+
+
+
+
+
+
+ Prod. ID
+ Name
+ Formulation
+ Generic Name
+ Packing Type
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Supplier_Edit.php b/old_code_ci3/views/Medical/Supplier_Edit.php
new file mode 100644
index 0000000..39592ea
--- /dev/null
+++ b/old_code_ci3/views/Medical/Supplier_Edit.php
@@ -0,0 +1,111 @@
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+ 0)
+ {
+ $sid=$supplier_data[0]->sid;
+ $name_supplier=$supplier_data[0]->name_supplier;
+ $short_name=$supplier_data[0]->short_name;
+ $contact_no=$supplier_data[0]->contact_no;
+ $gst_no=$supplier_data[0]->gst_no;
+ $city=$supplier_data[0]->city;
+ $state=$supplier_data[0]->state;
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+ A dd Supplier & Update
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Supplier_master.php b/old_code_ci3/views/Medical/Supplier_master.php
new file mode 100644
index 0000000..db90a1f
--- /dev/null
+++ b/old_code_ci3/views/Medical/Supplier_master.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+ =$supplier_data[$i]->name_supplier ?>
+ =$supplier_data[$i]->name_supplier ?>
+
+ Edit
+ Purchase
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/Supplier_master_sub.php b/old_code_ci3/views/Medical/Supplier_master_sub.php
new file mode 100644
index 0000000..a5551df
--- /dev/null
+++ b/old_code_ci3/views/Medical/Supplier_master_sub.php
@@ -0,0 +1,30 @@
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+ =$supplier_data[$i]->name_supplier ?>
+ =$supplier_data[$i]->name_supplier ?>
+
+ Edit
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/check_med_invoice.php b/old_code_ci3/views/Medical/check_med_invoice.php
new file mode 100644
index 0000000..d17470e
--- /dev/null
+++ b/old_code_ci3/views/Medical/check_med_invoice.php
@@ -0,0 +1,104 @@
+
+
+'form','class'=>'form1')); ?>
+
+
+
diff --git a/old_code_ci3/views/Medical/invoice_master_edit.php b/old_code_ci3/views/Medical/invoice_master_edit.php
new file mode 100644
index 0000000..42ca3e6
--- /dev/null
+++ b/old_code_ci3/views/Medical/invoice_master_edit.php
@@ -0,0 +1,408 @@
+
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+ Update Invoice Date
+
+
+
+
+ ipd_id > 0) { ?>
+
+ payment_received ==0) { ?>
+
+
+
+
+
+
+
+
+ Update Credit Type
+
+
+ case_id > 0){ ?>
+
+ payment_received ==0) { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Patient Phone No.
+ Patient Name
+
+
+
+
+
+
+
+
+
+
+
+ UHID /Patient Code
+
+
+
+
+
+
+
+
+ Update UHID Record
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Update IPD NO. Record
+
+
+
+
+
+
+
+
+
+
+ Org.Case No./Code
+
+
+
+
+
+
+
+
+ Update Org NO. Record
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/mini_invoice.php b/old_code_ci3/views/Medical/mini_invoice.php
new file mode 100644
index 0000000..c52be4f
--- /dev/null
+++ b/old_code_ci3/views/Medical/mini_invoice.php
@@ -0,0 +1,62 @@
+
+
+
+
+
+ $row->inv_id)
+ {
+ $srno=0;
+
+ echo '';
+ echo ' ';
+ echo ' ';
+
+ echo '';
+ echo '# ';
+ echo ''.$row->inv_med_code.' ';
+ echo ''.$row->inv_date.' ';
+ echo ''.$row->net_amount.' ';
+ echo 'Edit ';
+ echo ' ';
+
+ echo '';
+ echo '# ';
+ echo 'Item ';
+ echo 'Bat./Exp.Dt ';
+ echo 'Rate ';
+ echo 'Qty ';
+ echo 'N.Amt. ';
+ echo ' ';
+ }
+
+ $srno=$srno+1;
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->batch_no.' '.$row->exp_date.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->twdisc_amount.' ';
+ echo ' ';
+
+ $inv_id=$row->inv_id;
+ }
+ ?>
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/new_purchase_invoice.php b/old_code_ci3/views/Medical/new_purchase_invoice.php
new file mode 100644
index 0000000..3e430d2
--- /dev/null
+++ b/old_code_ci3/views/Medical/new_purchase_invoice.php
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Supplier
+
+ sid.' >'.$row->name_supplier.'';
+ }
+ ?>
+
+
+
+
+
+
+ C reate
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/payment_edit.php b/old_code_ci3/views/Medical/payment_edit.php
new file mode 100644
index 0000000..36db8a5
--- /dev/null
+++ b/old_code_ci3/views/Medical/payment_edit.php
@@ -0,0 +1,208 @@
+
+
+
+
+
+
+ payment_mode==1){ ?>
+
+
+ Card Swipe Machine
+
+
+
+
+
+ Customer Bank Name
+
+
+
+
+
+ Last Four Digit of Card
+
+
+
+
+
+ Change to BANK
+
+
+
+ Change to CASH
+
+
+
+
+
+
+
Change User
+
+
+ update_by_id) ? ' selected="selected"' : "";
+ echo ''.$user_list['username'].'['.$user_list['first_name'].' '.$user_list['last_name'].'] ';
+ }
+ ?>
+
+
+
+
+ Change User
+
+
+
+
+
+
+ Change/Correct Amount Value
+
+
+
+
+ Change Amount
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical/payment_log.php b/old_code_ci3/views/Medical/payment_log.php
new file mode 100644
index 0000000..917abf1
--- /dev/null
+++ b/old_code_ci3/views/Medical/payment_log.php
@@ -0,0 +1,80 @@
+
+
+ 'form_payment_log','role'=>'form')); ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/payment_log_data.php b/old_code_ci3/views/Medical/payment_log_data.php
new file mode 100644
index 0000000..86bc98f
--- /dev/null
+++ b/old_code_ci3/views/Medical/payment_log_data.php
@@ -0,0 +1,53 @@
+
+
+
+ #
+ Bill No
+ Invoice Code
+ Bill Type
+ Insert Date Time
+ Log Insert
+ Update Log
+ Amount / New Amount
+ Log Type
+ Update By
+
+
+
+
+
+
+ id; ?>
+ Inv_code; ?>
+ Bill_type; ?>
+ insert_time; ?>
+ log_insert; ?>
+ update_log; ?>
+ amount; ?>
+ LOG_type; ?>
+ update_by; ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/payment_search.php b/old_code_ci3/views/Medical/payment_search.php
new file mode 100644
index 0000000..b7d4adb
--- /dev/null
+++ b/old_code_ci3/views/Medical/payment_search.php
@@ -0,0 +1,25 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/print_bill_on_uhid.php b/old_code_ci3/views/Medical/print_bill_on_uhid.php
new file mode 100644
index 0000000..1ee4388
--- /dev/null
+++ b/old_code_ci3/views/Medical/print_bill_on_uhid.php
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+ UHID / Patient ID
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/purchase_invoice_item.php b/old_code_ci3/views/Medical/purchase_invoice_item.php
new file mode 100644
index 0000000..468b73f
--- /dev/null
+++ b/old_code_ci3/views/Medical/purchase_invoice_item.php
@@ -0,0 +1,62 @@
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry_date.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->qty).'+'.floatval($row->qty_free).' ';
+ echo ''.$row->purchase_price.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->discount.' ';
+ echo ''.$row->taxable_amount.' ';
+ echo ''.$row->CGST_per.' ';
+ echo ''.$row->SGST_per.' ';
+ echo ''.$row->net_amount.' ';
+ echo '
+
+ ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+ =$purchase_invoice[0]->Taxable_Amt ?>
+ =$purchase_invoice[0]->CGST_Amt ?>
+ =$purchase_invoice[0]->SGST_Amt ?>
+ =$purchase_invoice[0]->T_Net_Amount ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/purchase_supp_list.php b/old_code_ci3/views/Medical/purchase_supp_list.php
new file mode 100644
index 0000000..ce4b75d
--- /dev/null
+++ b/old_code_ci3/views/Medical/purchase_supp_list.php
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+ Amount
+
+
+
+
+
+
+ =$purchase_list[$i]->Invoice_no ?>
+ =$purchase_list[$i]->name_supplier ?>
+ =$purchase_list[$i]->date_of_invoice ?>
+ =$purchase_list[$i]->tamount ?>
+
+ Edit
+
+
+
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+ Amount
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/sale_item_list_for_add.php b/old_code_ci3/views/Medical/sale_item_list_for_add.php
new file mode 100644
index 0000000..dc1a5c7
--- /dev/null
+++ b/old_code_ci3/views/Medical/sale_item_list_for_add.php
@@ -0,0 +1,30 @@
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical/supplier_list.php b/old_code_ci3/views/Medical/supplier_list.php
new file mode 100644
index 0000000..734a017
--- /dev/null
+++ b/old_code_ci3/views/Medical/supplier_list.php
@@ -0,0 +1,30 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical_app/dash_main.php b/old_code_ci3/views/Medical_app/dash_main.php
new file mode 100644
index 0000000..7e261d6
--- /dev/null
+++ b/old_code_ci3/views/Medical_app/dash_main.php
@@ -0,0 +1,41 @@
+session->userdata();
+?>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical_app/index.php b/old_code_ci3/views/Medical_app/index.php
new file mode 100644
index 0000000..2d2c005
--- /dev/null
+++ b/old_code_ci3/views/Medical_app/index.php
@@ -0,0 +1,378 @@
+session->all_userdata();
+
+if (isset($session_set_value['remember_me']) && $session_set_value['remember_me'] == "1") {
+ $session_data = $this->session->userdata('logged_in');
+ $login_status=1;
+}else{
+ $login_status=0;
+}
+?>
+
+
+
+
+
=H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+load->view('Medical_app/dash_main');
+ } else { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Medical_app/ipd_panel.php b/old_code_ci3/views/Medical_app/ipd_panel.php
new file mode 100644
index 0000000..40db403
--- /dev/null
+++ b/old_code_ci3/views/Medical_app/ipd_panel.php
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+
+
+ IPD No. Info
+ Admit /Discharge Dt
+
+
+
+
+
+
+ =$c->ipd_code?>
+ =$c->p_fname?>
+ =$c->str_age?> / =$c->xgender?>
+ =$c->pay_type?>
+ discount_group_2>0){ ?>
+ Open
+
+ Get Purchase Rate
+
+
+ Admit Dt :=$c->admit_dt?>
+ Discharge Dt :=$c->discharge_dt?>
+ Net Amount : =$c->net_amount?>
+ Paid Amt. : =$c->payment_received?>
+ Balance. : =$c->payment_balance?>
+
+
+
+
+
+
+ IPD No. Info
+ Admit /Discharge Dt
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical_app/ipd_panel_search.php b/old_code_ci3/views/Medical_app/ipd_panel_search.php
new file mode 100644
index 0000000..69ffced
--- /dev/null
+++ b/old_code_ci3/views/Medical_app/ipd_panel_search.php
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+
+ 'myform');
+ echo form_open('Medical_app/ipd_search_data', $attributes); ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical_app/ipd_panel_sub.php b/old_code_ci3/views/Medical_app/ipd_panel_sub.php
new file mode 100644
index 0000000..323137d
--- /dev/null
+++ b/old_code_ci3/views/Medical_app/ipd_panel_sub.php
@@ -0,0 +1,53 @@
+
+
+
+ IPD No. Info
+ Admit /Discharge Dt
+
+
+
+
+
+
+ =$c->ipd_code?>
+ =$c->p_fname?>
+ =$c->str_age?> / =$c->xgender?>
+ =$c->pay_type?>
+ discount_group_2>0){ ?>
+ Open
+
+ Get Purchase Rate
+
+
+ Admit Dt :=$c->admit_dt?>
+ Discharge Dt :=$c->discharge_dt?>
+ Net Amount : =$c->net_amount?>
+ Paid Amt. : =$c->payment_received?>
+ Balance. : =$c->payment_balance?>
+
+
+
+
+
+
+ IPD No. Info
+ Admit /Discharge Dt
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical_app/login.php b/old_code_ci3/views/Medical_app/login.php
new file mode 100644
index 0000000..f14b1d4
--- /dev/null
+++ b/old_code_ci3/views/Medical_app/login.php
@@ -0,0 +1,76 @@
+";
+ echo $logout_message;
+ echo "
";
+ }
+?>
+
+";
+ echo $message_display;
+ echo "
";
+ }
+
+?>
+
+ 'myform');
+ echo form_open('Medical_app/login/'.$user_id,$attributes); ?>
+
+
Welcome
+
+ User : first_name); ?> last_name); ?>
+
+
+ username; ?>
+
+
+
+
+
+
+
+
+
+
+ Enter Your 4 Digit PIN No.
+
+
+
+
+ Remember Me
+
+
+
+
+
+ ";
+ if (isset($error_message)) {
+ echo $error_message;
+ }
+ echo validation_errors();
+ echo "
";
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Medical_app/select_doctor.php b/old_code_ci3/views/Medical_app/select_doctor.php
new file mode 100644
index 0000000..b15dc55
--- /dev/null
+++ b/old_code_ci3/views/Medical_app/select_doctor.php
@@ -0,0 +1,20 @@
+ 'myform');
+ echo form_open('Medical_app/login_pin',$attributes); ?>
+
+
Select Your Self for Login
+
+
+
diff --git a/old_code_ci3/views/Mobile_app/dash_main.php b/old_code_ci3/views/Mobile_app/dash_main.php
new file mode 100644
index 0000000..270135c
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/dash_main.php
@@ -0,0 +1,76 @@
+session->userdata('logged_in');
+?>
+
+
+ Dr.
+
+
+
+ All Patient
+
+
+
+
+
+
+sub(new DateInterval($date_interval_str));
+ $show_date_str = $show_date->format('D d-m-Y');
+?>
+
+ OPD : =$show_date_str?>
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Mobile_app/index.php b/old_code_ci3/views/Mobile_app/index.php
new file mode 100644
index 0000000..759db16
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/index.php
@@ -0,0 +1,365 @@
+session->all_userdata();
+
+if (isset($session_set_value['remember_me']) && $session_set_value['remember_me'] == "1") {
+ $session_data = $this->session->userdata('logged_in');
+ $login_status=1;
+}else{
+ $login_status=0;
+}
+?>
+
+
+
+
+ =H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+load->view('Mobile_app/dash_main');
+ } else { ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Mobile_app/ipd_panel.php b/old_code_ci3/views/Mobile_app/ipd_panel.php
new file mode 100644
index 0000000..3f4673f
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/ipd_panel.php
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
+
+
+ profile_picture,'/uploads/',1) ;
+ $profile_file_path=substr($c->profile_picture,$pos);
+ ?>
+
'
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Mobile_app/login.php b/old_code_ci3/views/Mobile_app/login.php
new file mode 100644
index 0000000..8e8c5b9
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/login.php
@@ -0,0 +1,76 @@
+";
+ echo $logout_message;
+ echo "";
+ }
+?>
+
+";
+ echo $message_display;
+ echo "";
+ }
+
+?>
+
+ 'myform');
+ echo form_open('Mobile_app/login/'.$doc_id,$attributes); ?>
+
+
Welcome
+
+ Dr. p_fname); ?>
+
+
+ SpecName; ?>
+
+
+
+
+
+
+
+
+
+
+ Enter Your 4 Digit PIN No.
+
+
+
+
+ Remember Me
+
+
+
+
+
+ ";
+ if (isset($error_message)) {
+ echo $error_message;
+ }
+ echo validation_errors();
+ echo "
";
+ ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Mobile_app/opd_scan.php b/old_code_ci3/views/Mobile_app/opd_scan.php
new file mode 100644
index 0000000..9aaaae7
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/opd_scan.php
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+ profile_picture,'/uploads/',1) ;
+ $profile_file_path=substr($c->profile_picture,$pos);
+ ?>
+
'
+
+ 'opd_form');
+ echo form_open_multipart('/Opd/save_image_mobile/'.$opd_id,$attributes );
+ ?>
+
+
+
+ Capture or Upload Photo
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Mobile_app/opd_scan1.php b/old_code_ci3/views/Mobile_app/opd_scan1.php
new file mode 100644
index 0000000..021242b
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/opd_scan1.php
@@ -0,0 +1,160 @@
+
+
+
+
+
+
+
+
+ profile_picture,'/uploads/',1) ;
+ $profile_file_path=substr($c->profile_picture,$pos);
+ ?>
+
'
+
+ 'opd_form');
+ echo form_open_multipart('/Opd/save_image_mobile/'.$opd_id,$attributes );
+ ?>
+
+
+
+ Capture or Upload Photo
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Mobile_app/patient_opd_profile.php b/old_code_ci3/views/Mobile_app/patient_opd_profile.php
new file mode 100644
index 0000000..8d9e60d
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/patient_opd_profile.php
@@ -0,0 +1,138 @@
+0)
+{
+ $c=$data[0];
+?>
+
+
+
+
+
+
+
+ profile_picture,'/uploads/',1) ;
+ $profile_file_path=substr($c->profile_picture,$pos);
+ ?>
+
'
+
+
+
+
+
+
+
+
+
+
+ 10 Feb. 2014
+
+
+
+
+
+
+
+
+
12:05
+
+
+
+
+ Etsy doostang zoodles disqus groupon greplin oooj voxy zoodles,
+ weebly ning heekya handango imeem plugg dopplr jibjab, movity
+ jajah plickers sifteo edmodo ifttt zimbra. Babblely odeo kaboodle
+ quora plaxo ideeli hulu weebly balihoo...
+
+
+
+
+
+
+
+
+
+
+ 5 mins ago
+
+
+
+
+
+
+
+
+
+
+
27 mins ago
+
+
+
+
+ Take me to your leader!
+ Switzerland is small and neutral!
+ We are more like Germany, ambitious and misunderstood!
+
+
+
+
+
+
+
+
+ 3 Jan. 2014
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Mobile_app/patient_page.php b/old_code_ci3/views/Mobile_app/patient_page.php
new file mode 100644
index 0000000..e4d9fed
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/patient_page.php
@@ -0,0 +1,70 @@
+
+
+ 'myform');
+ echo form_open('Mobile_app/patient_search',$attributes); ?>
+
+
+
+
+
+
+
+
+
+ load->view($_view);
+ ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Mobile_app/patient_search_v.php b/old_code_ci3/views/Mobile_app/patient_search_v.php
new file mode 100644
index 0000000..c1273ee
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/patient_search_v.php
@@ -0,0 +1,49 @@
+
+
+
+
+
+
+
+
+
Last Visit last_date_visit; ?>
+ profile_picture,'/uploads/',1) ;
+ $profile_file_path=substr($c->profile_picture,$pos);
+ ?>
+
'
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Mobile_app/person_file_show.php b/old_code_ci3/views/Mobile_app/person_file_show.php
new file mode 100644
index 0000000..e6bfc25
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/person_file_show.php
@@ -0,0 +1,206 @@
+
+ 0)
+ {
+ $opd_current=$opd_master_current[0]->opd_id;
+ }
+ ?>
+
+
+
+
+
+
+ profile_picture,'/uploads/',1) ;
+ $profile_file_path=substr($c->profile_picture,$pos);
+ ?>
+
'
+
+
+
+
+ opd_id";
+ $query = $this->db->query($sql);
+ $opd_data= $query->result();
+
+ $sql="select * from file_upload_data where show_type=0 and opd_id=$row->opd_id order by id";
+ $query = $this->db->query($sql);
+ $opd_file_list= $query->result();
+
+ $sql="select * from file_opd_rec where opd_id=$row->opd_id order by id";
+ $query = $this->db->query($sql);
+ $file_opd_rec= $query->result();
+
+ if(count($opd_data)>0)
+ {
+ echo '';
+ echo '
+
';
+
+ echo '
OPD ID : '.$opd_data[0]->opd_code.' /
Doctor Name : Dr. '.$opd_data[0]->doc_name;
+ echo '/
OPD Date : '.$opd_data[0]->str_date_opd_visit.' /
Queue No.: '.$opd_data[0]->queue_no.'
';
+
+ if($opd_data[0]->bp!='')
+ {
+ echo '
BP : '.$opd_data[0]->bp.' ';
+ }
+
+ if($opd_data[0]->diastolic!='')
+ {
+ echo '
Diastolic : '.$opd_data[0]->diastolic.' ';
+ }
+
+ if($opd_data[0]->pulse!='')
+ {
+ echo '
Pulse : '.$opd_data[0]->pulse.' ';
+ }
+
+ if($opd_data[0]->temp!='')
+ {
+ echo '
Temp. : '.$opd_data[0]->temp.' ';
+ }
+
+ echo '
+ Scan ['.$opd_data[0]->str_date_opd_visit.'] ';
+
+ echo '
+
';
+
+
+
+ }
+
+ $i=0;
+ //Files Show
+ foreach($opd_file_list as $opd_file_row)
+ {
+ $i=$i+1;
+ echo '
+
';
+ $pos=strpos($opd_file_row->full_path,'/uploads/',1) ;
+ $file_path=substr($opd_file_row->full_path,$pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$opd_file_row->full_path);
+
+ if($opd_file_row->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ }
+
+ echo '
+
';
+ }
+
+ //OPD Movies Show
+ foreach($file_opd_rec as $file_opd_rec_row)
+ {
+ echo '
+
';
+
+ $pos=strpos($file_opd_rec_row->full_path,'uploads/',1) ;
+ $file_path=substr($file_opd_rec_row->full_path,$pos);
+
+
+ //$file_path=str_replace('hms_uploads','uploads',$file_opd_rec_row->full_path);
+
+ echo '
+
+ Your browser does not support the video tag.
+ ';
+
+ echo '
+
';
+ }
+
+
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Mobile_app/select_doctor.php b/old_code_ci3/views/Mobile_app/select_doctor.php
new file mode 100644
index 0000000..eaadb1f
--- /dev/null
+++ b/old_code_ci3/views/Mobile_app/select_doctor.php
@@ -0,0 +1,20 @@
+ 'myform');
+ echo form_open('Mobile_app/login_pin',$attributes); ?>
+
+
Select Your Self for Login
+
+
+
diff --git a/old_code_ci3/views/OPD/opd_medicince.php b/old_code_ci3/views/OPD/opd_medicince.php
new file mode 100644
index 0000000..20eea3f
--- /dev/null
+++ b/old_code_ci3/views/OPD/opd_medicince.php
@@ -0,0 +1,83 @@
+
+
+
+
+
+
+
+
+
+
+
+ Med ID
+ Name
+ Generic Name
+ Company Name
+ Edit
+ Remove
+
+
+
+
+
+ = $row->id ?>
+ = $row->formulation . ' ' . $row->item_name ?>
+ = $row->genericname ?>
+ = $row->company_name ?>
+ Edit
+ Remove
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/OPD/opd_medicince_add.php b/old_code_ci3/views/OPD/opd_medicince_add.php
new file mode 100644
index 0000000..b24d367
--- /dev/null
+++ b/old_code_ci3/views/OPD/opd_medicince_add.php
@@ -0,0 +1,69 @@
+
+
+
+
+ 'formtfnedit');
+ echo form_open('OPD_prescription/opd_medicince_add', $attributes); ?>
+
+
+
+ Medicine Name
+
+
+
+ Formulation
+
+ No Assign
+
+
+ = $row->formulation_length ?> [= $row->formulation ?>]
+
+
+
+
+ Generic Name
+
+
+
+ Company Name
+
+ No Assign
+
+
+ = $row->company_name ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/OPD/opd_medicince_edit.php b/old_code_ci3/views/OPD/opd_medicince_edit.php
new file mode 100644
index 0000000..d11e579
--- /dev/null
+++ b/old_code_ci3/views/OPD/opd_medicince_edit.php
@@ -0,0 +1,66 @@
+
+
+
+
+ 'formtfnedit');
+ echo form_open('OPD_prescription/opd_medicince_edit/' . $opd_med_master[0]->id, $attributes); ?>
+
+
+
+ TFN Name
+
+
+
+ Formulation
+
+ No Assign
+
+ formulation, $opd_med_master[0]->formulation) ?>>
+ = $row->formulation_length ?> [= $row->formulation ?>]
+
+
+
+
+ Generic Name
+
+
+
+ Company Name
+
+ No Assign
+
+ id, $opd_med_master[0]->company_id) ?>>
+ = $row->company_name ?>
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Org/Org_item_Edit.php b/old_code_ci3/views/Org/Org_item_Edit.php
new file mode 100644
index 0000000..9e423ca
--- /dev/null
+++ b/old_code_ci3/views/Org/Org_item_Edit.php
@@ -0,0 +1,121 @@
+
+
+
+
+
+
+ 'form','class'=>'form2')); ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Org/Org_packing.php b/old_code_ci3/views/Org/Org_packing.php
new file mode 100644
index 0000000..073aafd
--- /dev/null
+++ b/old_code_ci3/views/Org/Org_packing.php
@@ -0,0 +1,32 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Org/Search_result.php b/old_code_ci3/views/Org/Search_result.php
new file mode 100644
index 0000000..eca5a0f
--- /dev/null
+++ b/old_code_ci3/views/Org/Search_result.php
@@ -0,0 +1,53 @@
+
+
+
+
+
+
+
+ Packing Label
+ Date
+ Type
+ No. of Case
+ Status
+
+
+
+
+ ';
+ ?>
+
+ =$packing_list[$i]->label_no ?>
+ =$packing_list[$i]->d_o_c ?>
+ =$packing_list[$i]->list_type ?>
+ =$packing_list[$i]->No_Rec ?>
+ =$packing_list[$i]->files_status ?>
+
+ View & Edit
+
+
+
+
+
+
+
+ Packing Label
+ Date
+ Type
+ No. of Case
+ Status
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Org/edit_Org_Packing.php b/old_code_ci3/views/Org/edit_Org_Packing.php
new file mode 100644
index 0000000..bb4edff
--- /dev/null
+++ b/old_code_ci3/views/Org/edit_Org_Packing.php
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Bill Type
+
+ org_type)?> >OPD Org.
+ org_type)?> >IPD Org.
+
+
+
+
+
+ Packing Batch Number
+
+
+
+
+
+ U pdate
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Org/new_Org_Packing.php b/old_code_ci3/views/Org/new_Org_Packing.php
new file mode 100644
index 0000000..1cdd970
--- /dev/null
+++ b/old_code_ci3/views/Org/new_Org_Packing.php
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Bill Type
+
+ OPD Org.
+ IPD Org.
+
+
+
+
+
+ Packing Batch Number
+
+
+
+
+
+ C reate
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Org/org_list.php b/old_code_ci3/views/Org/org_list.php
new file mode 100644
index 0000000..f86e662
--- /dev/null
+++ b/old_code_ci3/views/Org/org_list.php
@@ -0,0 +1,53 @@
+
+
+
+ Org. Code
+ Patient Name
+ Claim No.
+ IPD/OPD
+ Action
+
+
+
+ ';
+ ?>
+ =$org_list[$i]->case_id_code ?>
+ =$org_list[$i]->p_fname ?>
+ =$org_list[$i]->insurance_no_1 ?>
+ =$org_list[$i]->IPD_OPD ?>
+
+ packing_id>0 )
+ {
+ echo 'Already Added';
+ }else{
+ if($org_list[$i]->case_type==$list_type)
+ {
+ ?>
+ Add in List
+
+
+
+
+
+
+
+ Org. Code
+ Patient Name
+ Claim No.
+ IPD/OPD
+ Action
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Org/org_packing_list.php b/old_code_ci3/views/Org/org_packing_list.php
new file mode 100644
index 0000000..1eb602b
--- /dev/null
+++ b/old_code_ci3/views/Org/org_packing_list.php
@@ -0,0 +1,38 @@
+
+
+
+ Sr.No
+ Org. Code
+ Patient Name
+ Claim No.
+ IPD/OPD
+ Action
+
+
+
+ ';
+ ?>
+ =$i+1 ?>
+ =$org_packing_list[$i]->case_id_code ?>
+ =$org_packing_list[$i]->p_fname ?>
+ =$org_packing_list[$i]->insurance_no_1 ?>
+ =$org_packing_list[$i]->IPD_OPD ?>
+
+ Remove
+
+
+
+
+
+
+ Sr.No
+ Org. Code
+ Patient Name
+ Claim No.
+ IPD/OPD
+ Action
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_file_scan.php b/old_code_ci3/views/PathLab_Report/lab_file_scan.php
new file mode 100644
index 0000000..bcac921
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_file_scan.php
@@ -0,0 +1,73 @@
+
+
+
+
+
Your captured image will appear here...
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_file_scan_whole.php b/old_code_ci3/views/PathLab_Report/lab_file_scan_whole.php
new file mode 100644
index 0000000..198b711
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_file_scan_whole.php
@@ -0,0 +1,73 @@
+
+
+
+
+
Your captured image will appear here...
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_file_show.php b/old_code_ci3/views/PathLab_Report/lab_file_show.php
new file mode 100644
index 0000000..3a24598
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_file_show.php
@@ -0,0 +1,20 @@
+
+file_ext=='.pdf')
+ {
+ $pos=strpos($lab_file_details[0]->full_path,'/uploads/',1) ;
+
+ $file_path=substr($lab_file_details[0]->full_path,$pos);
+
+ echo '
';
+ }else
+ {
+ $pos=strpos($lab_file_details[0]->full_path,'/uploads/',1) ;
+
+ $file_path=substr($lab_file_details[0]->full_path,$pos);
+
+ echo '
image_size_str.' >';
+ }
+?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_file_upload.php b/old_code_ci3/views/PathLab_Report/lab_file_upload.php
new file mode 100644
index 0000000..44e7164
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_file_upload.php
@@ -0,0 +1,26 @@
+
+
+
+
diff --git a/old_code_ci3/views/PathLab_Report/lab_file_upload_complete.php b/old_code_ci3/views/PathLab_Report/lab_file_upload_complete.php
new file mode 100644
index 0000000..6100dac
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_file_upload_complete.php
@@ -0,0 +1,26 @@
+
+
+
+
diff --git a/old_code_ci3/views/PathLab_Report/lab_final_print.php b/old_code_ci3/views/PathLab_Report/lab_final_print.php
new file mode 100644
index 0000000..b3da068
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_final_print.php
@@ -0,0 +1,38 @@
+
+
+
+
+ Report
+
+ =$lab_invoice_request[0]->report_data ?>
+
+
+
+
+ Save
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_final_report_show.php b/old_code_ci3/views/PathLab_Report/lab_final_report_show.php
new file mode 100644
index 0000000..5e33d0b
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_final_report_show.php
@@ -0,0 +1,56 @@
+
+
+
+
+ Report
+
+ =$report_format[0]->Report_Data ?>
+
+
+
+
+
+
+
+ Save
+ Verified
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_final_report_show_xray.php b/old_code_ci3/views/PathLab_Report/lab_final_report_show_xray.php
new file mode 100644
index 0000000..e0908fe
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_final_report_show_xray.php
@@ -0,0 +1,125 @@
+
+
+
+
+
+
+ Report
+
+ =$report_format[0]->Report_Data ?>
+
+
+
+
+ Impression
+ =$report_format[0]->report_data_Impression ?>
+
+
+
+ Save
+ Verified
+
+
+
+
+
+
Templates
+
+
+
+
+
+
+
No templates found
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_main.php b/old_code_ci3/views/PathLab_Report/lab_main.php
new file mode 100644
index 0000000..7c2abad
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_main.php
@@ -0,0 +1,73 @@
+
+
+
+
+
+ ion_auth->in_group('Diagnosis-PathLab')) { ?>
+
+
+ ion_auth->in_group('DiagnosisMRI')) { ?>
+
+
+ ion_auth->in_group('DiagnosisX-Ray')) { ?>
+
+
+ ion_auth->in_group('DiagnosisCTScan')) { ?>
+
+
+ ion_auth->in_group('DiagnosisUltraSound')) { ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_edit.php b/old_code_ci3/views/PathLab_Report/lab_report_edit.php
new file mode 100644
index 0000000..5ce17a8
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_edit.php
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+ Report Name
+ 0)
+ {
+ $repo_name=$labReport_master[0]->Title;
+ $repo_id=$labReport_master[0]->mstRepoKey;
+ $HTMLData=$labReport_master[0]->HTMLData;
+ }
+ ?>
+
+
+
+
+
+
+ Attach Charge Name
+
+ 0)
+ {
+ $sel_value=$labReport_master[0]->charge_id;
+ }else
+ {
+ $sel_value=0;
+ }
+
+ echo 'No Attach ';
+
+ foreach($hc_items as $row)
+ {
+ echo 'id,$sel_value).' >'.$row->idesc.' ';
+ }
+ ?>
+
+
+
+
+
+ Group
+
+ 0)
+ {
+ $sel_value=$labReport_master[0]->GrpKey;
+ }else
+ {
+ $sel_value=0;
+ }
+
+ foreach($lab_rgroups as $row)
+ {
+ echo 'mstRGrpKey,$sel_value).' >'.$row->RepoGrp.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+ =$HTMLData ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ id)%50]->code_code_2.';">'.$lab_Rep_Item_List[$i]->Test.' ['.$lab_Rep_Item_List[$i]->TestID.']
';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_edit_request.php b/old_code_ci3/views/PathLab_Report/lab_report_edit_request.php
new file mode 100644
index 0000000..8c17563
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_edit_request.php
@@ -0,0 +1,49 @@
+'form','class'=>'form_reason')); ?>
+
+
+
+ Analytical Faults
+
+ ".$lab_log_type['log_type']."";
+ echo $select_content;
+ }
+ ?>
+
+
+
+
+
+ Comment/Answer:
+
+
+
+
+ Open Report for EDIT
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_file_show.php b/old_code_ci3/views/PathLab_Report/lab_report_file_show.php
new file mode 100644
index 0000000..cf5ce36
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_file_show.php
@@ -0,0 +1,59 @@
+
+
+
+
+
+ ';
+ }
+ ?>
+
+
+
+ full_path,'/uploads/',1) ;
+
+ $file_path=substr($lab_file_list[$i]->full_path,$pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$lab_file_list[$i]->full_path);
+
+ if($i<1){
+ echo '
';
+ }else{
+ echo '
';
+ }
+
+ if($lab_file_list[$i]->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ }
+
+ echo '
';
+ }
+ ?>
+
+
+
+
+ Previous
+
+
+
+ Next
+
+
+
+
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_item_edit.php b/old_code_ci3/views/PathLab_Report/lab_report_item_edit.php
new file mode 100644
index 0000000..17f1ae3
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_item_edit.php
@@ -0,0 +1,376 @@
+0)
+ {
+ $mstTestKey=$lab_test_parameter[0]->mstTestKey;
+ $Test=$lab_test_parameter[0]->Test;
+ $TestID=$lab_test_parameter[0]->TestID;
+ $Result=$lab_test_parameter[0]->Result;
+ $Formula=$lab_test_parameter[0]->Formula;
+ $VRule=$lab_test_parameter[0]->VRule;
+ $VMsg=$lab_test_parameter[0]->VMsg;
+ $Unit=$lab_test_parameter[0]->Unit;
+ $FixedNormals=$lab_test_parameter[0]->FixedNormals;
+ $isGenderSpecific=$lab_test_parameter[0]->isGenderSpecific;
+ $FixedNormalsWomen=$lab_test_parameter[0]->FixedNormalsWomen;
+
+ if($isGenderSpecific==1)
+ {
+ $checkbox_checked="checked";
+ }
+
+
+ }
+?>
+
+
+
+
+
+
+
+
+ Name of Test
+
+
+
+
+
+
+
+
+
+
+
+ Validation Rule
+
+
+
+
+
+
+
+
+
+ >
+ Is Gender Specific
+
+
+
+
+ Fixed Normals For Women
+
+
+
+
+
+
+
+
+
+
+ #
+ Code
+ Bold
+ Action
+
+
+
+
+
+ =$lab_test_option[$i]->sort_id ?>
+ =$lab_test_option[$i]->option_value ?>
+ =$lab_test_option[$i]->option_bold_str ?>
+
+
+
+
+ id;
+ $sort_current=$lab_test_option[$i]->sort_id;
+
+ if($i+1 < count($lab_test_option))
+ {
+ $option_next=$lab_test_option[$i+1]->id;
+ $sort_next=$lab_test_option[$i+1]->sort_id;
+
+ echo '
+ ';
+ }
+ if($i>0)
+ {
+ $option_prev=$lab_test_option[$i-1]->id;
+ $sort_prev=$lab_test_option[$i-1]->sort_id;
+
+ echo '
+ ';
+
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_list.php b/old_code_ci3/views/PathLab_Report/lab_report_list.php
new file mode 100644
index 0000000..eb4a31c
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_list.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+ =$labReport_master[$i]->Title ?>
+ =$labReport_master[$i]->RepoGrp ?>
+
+ Test List
+ Edit
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_print.php b/old_code_ci3/views/PathLab_Report/lab_report_print.php
new file mode 100644
index 0000000..1b92aa8
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_print.php
@@ -0,0 +1,105 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_show.php b/old_code_ci3/views/PathLab_Report/lab_report_show.php
new file mode 100644
index 0000000..a112cc4
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_show.php
@@ -0,0 +1,55 @@
+
+
+
+
+ ';
+ }
+ ?>
+
+
+
+ full_path,'/uploads/',1) ;
+
+ $file_path=substr($lab_file_list[$i]->full_path,$pos);
+
+ if($i<1){
+ echo '
';
+ }else{
+ echo '
';
+ }
+
+ if($lab_file_list[$i]->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ }
+
+ echo '
';
+ }
+ ?>
+
+
+
+
+ Previous
+
+
+
+ Next
+
+
+
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_tab_1.php b/old_code_ci3/views/PathLab_Report/lab_report_tab_1.php
new file mode 100644
index 0000000..e35791b
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_tab_1.php
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+
+
+ Invoice No.
+ Person Name
+ Date
+ Tests Name
+
+
+
+
+
+ =$labreport_preprocess[$i]->invoice_code ?>
+ =$labreport_preprocess[$i]->inv_name ?> / =$labreport_preprocess[$i]->age ?>
+ =$labreport_preprocess[$i]->inv_date ?>
+
+ data_array);
+ echo '';
+ foreach ($data_array as $value) {
+ echo '';
+ $value_array=explode(";",$value);
+
+ echo ''.$value_array[0].' ';
+
+ echo ' ';
+ }
+ echo '
';
+ ?>
+
+
+
+
+
+
+ Invoice No.
+ Person Name
+ Date
+ Tests Name
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_tab_1_1.php b/old_code_ci3/views/PathLab_Report/lab_report_tab_1_1.php
new file mode 100644
index 0000000..6b659a5
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_tab_1_1.php
@@ -0,0 +1,142 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_tab_2.php b/old_code_ci3/views/PathLab_Report/lab_report_tab_2.php
new file mode 100644
index 0000000..892086a
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_tab_2.php
@@ -0,0 +1,170 @@
+
+
+
+
+
+
+
+
+
+ Invoice No./Date
+ Person Name
+ Test Name
+
+
+
+
+
+ =$labreport_preprocess[$i]->invoice_code ?>
+
+ =$labreport_preprocess[$i]->inv_date ?>
+
+ =$labreport_preprocess[$i]->inv_name ?>
+
+ data_array);
+ echo '';
+ foreach ($data_array as $value) {
+ echo '';
+ $value_array=explode(";",$value);
+ echo ''.$value_array[0].' ';
+ echo 'Entry ';
+
+ echo 'Scan
+ ';
+
+ echo 'Upload Files
+ ';
+
+
+ echo 'Show Files
+ ';
+ echo ' ';
+ }
+ echo '
';
+ ?>
+
+
+
+
+
+
+ Invoice No./Date
+ Person Name
+ Test Name
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_tab_2_1.php b/old_code_ci3/views/PathLab_Report/lab_report_tab_2_1.php
new file mode 100644
index 0000000..a98388e
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_tab_2_1.php
@@ -0,0 +1,209 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_tab_3.php b/old_code_ci3/views/PathLab_Report/lab_report_tab_3.php
new file mode 100644
index 0000000..f748a26
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_tab_3.php
@@ -0,0 +1,126 @@
+
+
+
+
+
+
+
+
+
+ Invoice No./Date
+ Person Name
+ Test Name
+
+
+
+
+
+
+ =$labreport_preprocess[$i]->invoice_code ?>
+
+ =$labreport_preprocess[$i]->inv_date ?>
+
+ =$labreport_preprocess[$i]->inv_name ?>
+
+ data_array);
+ echo '';
+ foreach ($data_array as $value) {
+ echo '';
+ $value_array=explode(";",$value);
+ echo ''.$value_array[0].' ';
+ echo 'Report Edit ';
+ echo 'Show Files
+ ';
+ echo ' ';
+ }
+ echo '
';
+
+ ?>
+
+
+
+
+
+
+ Invoice No./Date
+ Person Name
+ Test Name
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_tab_4.php b/old_code_ci3/views/PathLab_Report/lab_report_tab_4.php
new file mode 100644
index 0000000..a273549
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_tab_4.php
@@ -0,0 +1,129 @@
+
+
+
+
+
+
+
+
+
+ Invoice No./Date
+ Person Name
+ Test Name
+ Test Type
+
+
+
+
+
+
+ =$labreport_preprocess[$i]->invoice_code ?>
+
+ =$labreport_preprocess[$i]->inv_date ?>
+
+ =$labreport_preprocess[$i]->inv_name ?>
+ =$labreport_preprocess[$i]->Test_List ?>
+ =$labreport_preprocess[$i]->item_type_desc ?>
+
+ Compile
+ Edit
+ Report Show
+ Remove from List
+
+
+
+
+
+
+ Invoice No./Date
+ Person Name
+ Test Name
+ Charge Type
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_tab_4_1.php b/old_code_ci3/views/PathLab_Report/lab_report_tab_4_1.php
new file mode 100644
index 0000000..8227b7d
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_tab_4_1.php
@@ -0,0 +1,182 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_tab_4_2.php b/old_code_ci3/views/PathLab_Report/lab_report_tab_4_2.php
new file mode 100644
index 0000000..8d72b64
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_tab_4_2.php
@@ -0,0 +1,28 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_report_test_list.php b/old_code_ci3/views/PathLab_Report/lab_report_test_list.php
new file mode 100644
index 0000000..006830f
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_report_test_list.php
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+
+
+ #
+ Test Name
+ Test Code
+ Action
+
+
+
+
+
+ =$i+1 ?>
+ =$lab_Rep_Item_List[$i]->Test ?>
+ =$lab_Rep_Item_List[$i]->TestID ?>
+
+
+
+
+
+
+ id;
+ $sort_current=$lab_Rep_Item_List[$i]->EOrder;
+
+ if($i+1 < count($lab_Rep_Item_List))
+ {
+ $option_next=$lab_Rep_Item_List[$i+1]->id;
+ $sort_next=$lab_Rep_Item_List[$i+1]->EOrder;
+
+ echo '
+ ';
+ }
+ if($i>0)
+ {
+ $option_prev=$lab_Rep_Item_List[$i-1]->id;
+ $sort_prev=$lab_Rep_Item_List[$i-1]->EOrder;
+
+ echo '
+ ';
+
+ }
+ ?>
+
+
+
+
+
+
+
+ #
+ Test Name
+ Test Code
+ Action
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_test_entry.php b/old_code_ci3/views/PathLab_Report/lab_test_entry.php
new file mode 100644
index 0000000..1d76657
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_test_entry.php
@@ -0,0 +1,131 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/lab_test_search.php b/old_code_ci3/views/PathLab_Report/lab_test_search.php
new file mode 100644
index 0000000..ef65d29
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/lab_test_search.php
@@ -0,0 +1,70 @@
+
+
+
+
diff --git a/old_code_ci3/views/PathLab_Report/pathlab_request_list.php b/old_code_ci3/views/PathLab_Report/pathlab_request_list.php
new file mode 100644
index 0000000..93d349a
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/pathlab_request_list.php
@@ -0,0 +1,45 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/ultrasound_report_edit.php b/old_code_ci3/views/PathLab_Report/ultrasound_report_edit.php
new file mode 100644
index 0000000..33c82a8
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/ultrasound_report_edit.php
@@ -0,0 +1,146 @@
+
+
+
+
+
+
+
+
+ Report Name
+ 0)
+ {
+ $repo_id=$labReport_master[0]->id;
+ $repo_name=$labReport_master[0]->template_name;
+ $repo_title=$labReport_master[0]->title;
+ $HTMLData=$labReport_master[0]->Findings;
+ $Impression=$labReport_master[0]->Impression;
+ $impression_cat=$labReport_master[0]->impression_cat;
+ }
+ ?>
+
+
+
+
+
+
+ Attach Charge Name
+
+ 0)
+ {
+ $sel_value=$labReport_master[0]->charge_id;
+ }else
+ {
+ $sel_value=0;
+ }
+
+ echo 'No Attach ';
+
+ foreach($hc_items as $row)
+ {
+ echo 'id,$sel_value).' >'.$row->idesc.' ';
+ }
+ ?>
+
+
+
+
+
+ Print Report Name
+
+
+
+
+
+
+
+ Findings
+
+ =$HTMLData ?>
+
+
+
+
+
+
+
+ Impression
+ =$Impression ?>
+
+
+
+
+
+
+ Press Here to Save Data
+ Update
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/PathLab_Report/ultrasound_template_list.php b/old_code_ci3/views/PathLab_Report/ultrasound_template_list.php
new file mode 100644
index 0000000..93c8e21
--- /dev/null
+++ b/old_code_ci3/views/PathLab_Report/ultrasound_template_list.php
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+ =$labReport_master[$i]->template_name ?>
+ =$labReport_master[$i]->title ?>
+
+ Edit
+
+
+
+
+
+
+ Report Title
+ Group
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Patient_Search_V.php b/old_code_ci3/views/Patient_Search_V.php
new file mode 100644
index 0000000..92aef55
--- /dev/null
+++ b/old_code_ci3/views/Patient_Search_V.php
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+ Sr.No.
+ Patient/UHID Code
+ Name {Relative Name}
+ Age
+ Last Visit
+ Insurance
+
+
+
+
+
+ =$i+1?>
+ =$data[$i]->p_code ?>
+ =$data[$i]->p_fname ?> {=$data[$i]->p_rname ?>}
+ =$data[$i]->age ?>
+ =$data[$i]->Last_Visit ?>
+ insurance_id==0 ? 'Self': 'Insuranced'); ?>
+
+
+
+
+
+ Sr.No.
+ Patient/UHID Code
+ Name {Relative Name}
+ Age
+ Last Visit
+ Insurance
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Patient_Search_opd.php b/old_code_ci3/views/Patient_Search_opd.php
new file mode 100644
index 0000000..c050da8
--- /dev/null
+++ b/old_code_ci3/views/Patient_Search_opd.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+ OPD No.
+ Patient/UHID Code
+ Name {Relative Name}
+ Age
+ Doctor
+ OPD Date
+ Insurance
+
+
+
+
+
+ =$data[$i]->opd_code?>
+ =$data[$i]->p_code ?>
+ =$data[$i]->p_fname ?> {=$data[$i]->p_rname ?>}
+ =$data[$i]->age ?>
+ =$data[$i]->doc_name ?>
+ =$data[$i]->opd_Visit ?>
+ insurance_id==0 ? 'Self': $data[$i]->short_name); ?>
+
+
+
+
+
+ Sr.No.
+ Patient/UHID Code
+ Name {Relative Name}
+ Age
+ Doctor
+ OPD Date
+ Insurance
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Patient_V.php b/old_code_ci3/views/Patient_V.php
new file mode 100644
index 0000000..157bdb2
--- /dev/null
+++ b/old_code_ci3/views/Patient_V.php
@@ -0,0 +1,458 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Title
+
+ Mr.
+ Mrs.
+ Ms.
+ Master
+ Baby
+ Baby Girl
+ Baby Boy
+ Mohd.
+
+
+
+
+
+
+
+
+
+
+
+
+ Relation
+
+ W/o
+ S/o
+ D/o
+ C/o
+ M/o
+
+
+
+
+
+
+ Blood Group
+
+
+ =$row->blood_group?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Register Patient
+
+
+
+
+
+
+
+
+
+
+ 'form','class'=>'form2')); ?>
+
+
+
+ Go!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Person/OPD_file_upload.php b/old_code_ci3/views/Person/OPD_file_upload.php
new file mode 100644
index 0000000..7f79d60
--- /dev/null
+++ b/old_code_ci3/views/Person/OPD_file_upload.php
@@ -0,0 +1,114 @@
+
+
+
Name : =$person_info[0]->p_fname?>
+ / Age : =$person_info[0]->age?>
+ / Gender : =$person_info[0]->xgender?>
+ / P Code : =$person_info[0]->p_code?>
+ / OPD : =$opd_master[0]->opd_code?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Person/Person_Profile.php b/old_code_ci3/views/Person/Person_Profile.php
new file mode 100644
index 0000000..1d0d34a
--- /dev/null
+++ b/old_code_ci3/views/Person/Person_Profile.php
@@ -0,0 +1,177 @@
+0)
+ {
+ $opd_current=$opd_master_current[0]->opd_id;
+ }
+ ?>
+
+
+
+
+
+
+
+ profile_picture,'/uploads/',1) ;
+ $profile_file_path=substr($c->profile_picture,$pos);
+ ?>
+
+
title.' '.$c->p_fname ; ?>
+
=$c->p_relative?> =$c->p_rname?>
+
+
+
+
+
+
+
+
+
+
+
Address
+
+ p_address ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ opd_id";
+ $query = $this->db->query($sql);
+ $opd_data= $query->result();
+
+ $sql="select * from file_upload_data where show_type=0 and opd_id=$row->opd_id order by id";
+ $query = $this->db->query($sql);
+ $opd_file_list= $query->result();
+
+ $sql="select * from file_opd_rec where opd_id=$row->opd_id order by id";
+ $query = $this->db->query($sql);
+ $file_opd_rec= $query->result();
+ ?>
+
+
+ 0)
+ {
+ $opd_details_str.= '
OPD ID : '.$opd_data[0]->opd_code;
+ $opd_details_str.= '/
OPD Date : '.MysqlDate_to_str($opd_data[0]->date_opd_visit).' /
Queue No.: '.$opd_data[0]->queue_no.'
';
+
+ if($opd_data[0]->bp!='')
+ {
+ $opd_details_str.= '
BP : '.$opd_data[0]->bp.' ';
+ }
+
+ if($opd_data[0]->diastolic!='')
+ {
+ $opd_details_str.= '
Diastolic : '.$opd_data[0]->diastolic.' ';
+ }
+
+ if($opd_data[0]->pulse!='')
+ {
+ $opd_details_str.= '
Pulse : '.$opd_data[0]->pulse.' ';
+ }
+
+ if($opd_data[0]->temp!='')
+ {
+ $opd_details_str.= '
Temp. : '.$opd_data[0]->temp.' ';
+ }
+ }
+ ?>
+
+
+
+
+ ';
+ $pos=strpos($opd_file_row->full_path,'/uploads/',1) ;
+ $file_path=substr($opd_file_row->full_path,$pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$opd_file_row->full_path);
+
+ if($opd_file_row->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ }
+
+ echo '
';
+ }
+
+
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Person/opd_file_show.php b/old_code_ci3/views/Person/opd_file_show.php
new file mode 100644
index 0000000..12821f3
--- /dev/null
+++ b/old_code_ci3/views/Person/opd_file_show.php
@@ -0,0 +1,76 @@
+
+
+
+
+
+ ';
+ }
+ ?>
+
+
+
+ full_path,'/uploads/',1) ;
+
+ $file_path=substr($opd_file_list[$i]->full_path,$pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$opd_file_list[$i]->full_path);
+
+ if($i<1){
+ echo '
';
+ }else{
+ echo '
';
+ }
+
+ if($opd_file_list[$i]->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ }
+
+ echo '
';
+ }
+
+ for($i=0;$i
full_path,'/uploads/',1) ;
+
+ $file_path=substr($file_opd_rec[$i]->full_path,$pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$file_opd_rec[$i]->full_path);
+
+ echo '';
+
+ echo '
+
+ Your browser does not support the video tag.
+ ';
+
+ echo '
';
+ }
+ ?>
+
+
+
+
+ Previous
+
+
+
+ Next
+
+
+
+
diff --git a/old_code_ci3/views/Person/opd_scan_desktop.php b/old_code_ci3/views/Person/opd_scan_desktop.php
new file mode 100644
index 0000000..e85064e
--- /dev/null
+++ b/old_code_ci3/views/Person/opd_scan_desktop.php
@@ -0,0 +1,149 @@
+
+
+
+
+
+
+ 'form','class'=>'form2')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Your captured image will appear here...
+
+
+
+
+
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Person/opd_scan_search.php b/old_code_ci3/views/Person/opd_scan_search.php
new file mode 100644
index 0000000..bdbbbfb
--- /dev/null
+++ b/old_code_ci3/views/Person/opd_scan_search.php
@@ -0,0 +1,40 @@
+
+
+
+
+ OPD Code
+ Name
+ Doctor Name
+ Phone Number
+ Action
+
+
+
+
+
+ =$opd_list[$i]->opd_code ?>[ =$opd_list[$i]->App_Date ?> ]
+ =$opd_list[$i]->p_fname ?> {=$opd_list[$i]->p_code ?>}
+ =$opd_list[$i]->doc_name ?>
+ =$opd_list[$i]->mphone1 ?>
+ Select
+
+
+
+
+
+ OPD Code
+ Name
+ Doctor Name
+ Phone Number
+ Action
+
+
+
+
+
diff --git a/old_code_ci3/views/Person/opd_scanfile_upload.php b/old_code_ci3/views/Person/opd_scanfile_upload.php
new file mode 100644
index 0000000..95192bd
--- /dev/null
+++ b/old_code_ci3/views/Person/opd_scanfile_upload.php
@@ -0,0 +1,27 @@
+
+
diff --git a/old_code_ci3/views/Person/person_file_show.php b/old_code_ci3/views/Person/person_file_show.php
new file mode 100644
index 0000000..173ab6a
--- /dev/null
+++ b/old_code_ci3/views/Person/person_file_show.php
@@ -0,0 +1,181 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ profile_picture,'/uploads/',1) ;
+ $profile_file_path=substr($c->profile_picture,$pos);
+ ?>
+
'
+
+
+
+
+ opd_id;
+
+ if($opd_id!=$opd_id_new)
+ {
+ $sql="select p.*,o.opd_code,o.doc_name from opd_prescription p
+ join opd_master o on o.opd_id=p.opd_id
+ where p.opd_id=$opd_id_new";
+ $query = $this->db->query($sql);
+ $opd_data= $query->result();
+
+ if(count($opd_data)>0)
+ {
+ echo '';
+
+ echo '
+
';
+
+ echo 'OPD ID : '.$opd_data[0]->opd_code.' /Doctor Name : Dr. '.$opd_data[0]->doc_name;
+ echo '/OPD Date : '.$opd_data[0]->date_opd_visit.' /Queue No.: '.$opd_data[0]->queue_no.' ';
+
+ if($opd_data[0]->bp!='')
+ {
+ echo 'BP : '.$opd_data[0]->bp.' ';
+ }
+
+ if($opd_data[0]->diastolic!='')
+ {
+ echo 'Diastolic : '.$opd_data[0]->diastolic.' ';
+ }
+
+ if($opd_data[0]->pulse!='')
+ {
+ echo 'Pulse : '.$opd_data[0]->pulse.' ';
+ }
+
+ if($opd_data[0]->temp!='')
+ {
+ echo 'Temp. : '.$opd_data[0]->temp.' ';
+ }
+
+ echo '
+
';
+ }
+ }
+
+ $opd_id=$opd_id_new;
+
+ echo '
+
';
+
+ $pos=strpos($opd_file_list[$i]->full_path,'/uploads/',1) ;
+
+ $file_path=substr($opd_file_list[$i]->full_path,$pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$opd_file_list[$i]->full_path);
+
+ if($opd_file_list[$i]->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ }
+
+ echo '
+
';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Person/person_profile_photo.php b/old_code_ci3/views/Person/person_profile_photo.php
new file mode 100644
index 0000000..c2ddf1a
--- /dev/null
+++ b/old_code_ci3/views/Person/person_profile_photo.php
@@ -0,0 +1,100 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
Your captured image will appear here...
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Person/scan_opd_list.php b/old_code_ci3/views/Person/scan_opd_list.php
new file mode 100644
index 0000000..ee40782
--- /dev/null
+++ b/old_code_ci3/views/Person/scan_opd_list.php
@@ -0,0 +1,29 @@
+
+
';
+ $pos=strpos($opd_file_list[$i]->full_path,'/uploads',1) ;
+ $file_path=substr($opd_file_list[$i]->full_path,$pos);
+
+ //echo $file_path;
+ //$pos=strpos($file_path,'/uploads/',1) ;
+ //$file_path=str_replace('Hospital_DR_B_C_JOSHI/uploads','uploads',$opd_file_list[$i]->full_path);
+
+ if($opd_file_list[$i]->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ echo ' ';
+ echo '
+
'.$opd_file_list[$i]->p_fname.'/'.$opd_file_list[$i]->strinsert_date.'
+
+
';
+ echo '
+
';
+
+ }
+}
+?>
\ No newline at end of file
diff --git a/old_code_ci3/views/Person_Edit_V.php b/old_code_ci3/views/Person_Edit_V.php
new file mode 100644
index 0000000..b401a70
--- /dev/null
+++ b/old_code_ci3/views/Person_Edit_V.php
@@ -0,0 +1,349 @@
+
+p_edit==1 || $this->ion_auth->in_group('admin')){
+ $readonly="";
+}else{
+ $readonly="readonly";
+}
+?>
+
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Title
+
+ title)?>>Mr.
+ title)?>>Mrs.
+ title)?>>Ms.
+ title)?>>Master
+ title)?>>Baby
+ title)?>>Baby Girl
+
+ title)?>>Baby Boy
+
+ title)?>>Mohd.
+
+
+
+
+
+
+
+
+
+
+ estimate_dob;
+ if($chk_age==1)
+ {
+ $checkbox_checked="checked";
+ $age_input_2='style="display: none;"';
+ $age_input_1='';
+ $DateofBirth='';
+ }else{
+ $checkbox_checked="";
+ $age_input_1='style="display: none;"';
+ $age_input_2='';
+ $DateofBirth=MysqlDate_to_str($data[0]->dob);
+ }
+ ?>
+
+
+
+
+
+
+
+ Relation
+
+ p_relative)?>>W/o
+
+ p_relative)?>>S/o
+
+ p_relative)?>>
+ D/o
+ p_relative)?>>C/o
+
+ p_relative)?>>M/o
+
+
+
+
+
+
+
+
+ Blood Group
+
+
+ blood_group,$data[0]->blood_group)?>>=$row->blood_group?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Person_profile_V.php b/old_code_ci3/views/Person_profile_V.php
new file mode 100644
index 0000000..37edce3
--- /dev/null
+++ b/old_code_ci3/views/Person_profile_V.php
@@ -0,0 +1,359 @@
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
Full Name : =ucwords($data[0]->p_fname) ?>
+
+
+
Gender : =$data[0]->xgender?>
+ / Age : =$data[0]->str_age?>
+
+
+
+
+
+
Relation : =$data[0]->p_relative?>
+ Relative Name : =ucwords($data[0]->p_rname)?>
+
+
+
+
Aadhar No. : =$data[0]->udai?>
+
+
+
+
+
+
Phone Number : =$data[0]->mphone1?>
+
+
+
Email : =$data[0]->email1?>
+
+
+
Blood Group : =$data[0]->blood_group?>
+
+
+
+
+
Address : =$data[0]->add1?>
+ =$data[0]->city ?>
+ =$data[0]->district ?>
+ =$data[0]->state ?>
+ =$data[0]->zip ?>
+
+
+
+
+
+
+
+
+
+
+
+ Update
+ Aadhar No.
+
+
+
+
+
+
+
+
+
+
+
+ insurance_id>0) { ?>
+
+
+
Company Name : =$data_insurance_card[0]->ins_company_name?>
+
Card Holder Name : =$data[0]->card_holder_name?>
+
Relation : =$data[0]->relation_patient_cardholder?>
+
Insurance ID : =$data[0]->insurance_no?>
+
+
+
+ 0){ ?>
+
Case Code : =$case_master_opd[0]->case_id_code?>
+
Visit Date Start : =$case_master_opd[0]->str_date_registration?>
+
Clam or Case No.: =$case_master_opd[0]->insurance_no_1?>
+
Any Other IDs : =$case_master_opd[0]->insurance_no_2?>
+
+ Update Case
+ Information
+
+
+
+ 0){ ?>
+
+
Case Code : =$case_master_ipd[0]->case_id_code?>
+
Org. Date Start : =$case_master_ipd[0]->str_date_registration?>
+
Clam or Case No.: =$case_master_ipd[0]->insurance_no_1?>
+
Any Other IDs : =$case_master_ipd[0]->insurance_no_2?>
+
IPD No : =$case_master_ipd[0]->ipd_code?>
+
IPD Admit Date : =$case_master_ipd[0]->str_date_registration?>
+
+ Update
+ Case Information
+
+
+
+
Create Case for Credit IPD
+ Bill
+
+
Create Case for Credit
+ OPD Bill
+
+
+
+
+
+ opd_allowed==1) { ?>
+
+ OPD Insurance Rates /
+ CASH
+
+
+ charge_cash==1) { ?>
+
+ Charge with Ins. Rate
+ / CASH
+
+
+
+
+
+
+
+
+ A ppointment For
+ OPD
+ Add Charge without OPD
+ IPD
+ Document
+
+
+
+
+ 0) { ?>
+
+
+
+
+
+ '.$row->opd_code.'';
+ echo '
';
+ echo 'Dr.'.$row->doc_name.' ';
+ echo ' D:'.$row->str_apointment_date.' ';
+ echo ' P:'.$row->p_fname.' ';
+
+ if($this->ion_auth->in_group('OPDEdit') || $row->new_opd==1){
+ echo 'Edit OPD ';
+ echo 'Print Day Care ';
+ }
+ echo '
';
+ echo '
';
+ }
+ ?>
+
+
+
+
+
+ 0) { ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Person_profile_V_backup.php b/old_code_ci3/views/Person_profile_V_backup.php
new file mode 100644
index 0000000..37edce3
--- /dev/null
+++ b/old_code_ci3/views/Person_profile_V_backup.php
@@ -0,0 +1,359 @@
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
Full Name : =ucwords($data[0]->p_fname) ?>
+
+
+
Gender : =$data[0]->xgender?>
+ / Age : =$data[0]->str_age?>
+
+
+
+
+
+
Relation : =$data[0]->p_relative?>
+ Relative Name : =ucwords($data[0]->p_rname)?>
+
+
+
+
Aadhar No. : =$data[0]->udai?>
+
+
+
+
+
+
Phone Number : =$data[0]->mphone1?>
+
+
+
Email : =$data[0]->email1?>
+
+
+
Blood Group : =$data[0]->blood_group?>
+
+
+
+
+
Address : =$data[0]->add1?>
+ =$data[0]->city ?>
+ =$data[0]->district ?>
+ =$data[0]->state ?>
+ =$data[0]->zip ?>
+
+
+
+
+
+
+
+
+
+
+
+ Update
+ Aadhar No.
+
+
+
+
+
+
+
+
+
+
+
+ insurance_id>0) { ?>
+
+
+
Company Name : =$data_insurance_card[0]->ins_company_name?>
+
Card Holder Name : =$data[0]->card_holder_name?>
+
Relation : =$data[0]->relation_patient_cardholder?>
+
Insurance ID : =$data[0]->insurance_no?>
+
+
+
+ 0){ ?>
+
Case Code : =$case_master_opd[0]->case_id_code?>
+
Visit Date Start : =$case_master_opd[0]->str_date_registration?>
+
Clam or Case No.: =$case_master_opd[0]->insurance_no_1?>
+
Any Other IDs : =$case_master_opd[0]->insurance_no_2?>
+
+ Update Case
+ Information
+
+
+
+ 0){ ?>
+
+
Case Code : =$case_master_ipd[0]->case_id_code?>
+
Org. Date Start : =$case_master_ipd[0]->str_date_registration?>
+
Clam or Case No.: =$case_master_ipd[0]->insurance_no_1?>
+
Any Other IDs : =$case_master_ipd[0]->insurance_no_2?>
+
IPD No : =$case_master_ipd[0]->ipd_code?>
+
IPD Admit Date : =$case_master_ipd[0]->str_date_registration?>
+
+ Update
+ Case Information
+
+
+
+
Create Case for Credit IPD
+ Bill
+
+
Create Case for Credit
+ OPD Bill
+
+
+
+
+
+ opd_allowed==1) { ?>
+
+ OPD Insurance Rates /
+ CASH
+
+
+ charge_cash==1) { ?>
+
+ Charge with Ins. Rate
+ / CASH
+
+
+
+
+
+
+
+
+ A ppointment For
+ OPD
+ Add Charge without OPD
+ IPD
+ Document
+
+
+
+
+ 0) { ?>
+
+
+
+
+
+ '.$row->opd_code.'';
+ echo '
';
+ echo 'Dr.'.$row->doc_name.' ';
+ echo ' D:'.$row->str_apointment_date.' ';
+ echo ' P:'.$row->p_fname.' ';
+
+ if($this->ion_auth->in_group('OPDEdit') || $row->new_opd==1){
+ echo 'Edit OPD ';
+ echo 'Print Day Care ';
+ }
+ echo '
';
+ echo '
';
+ }
+ ?>
+
+
+
+
+
+ 0) { ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Person_profile_V_test.php b/old_code_ci3/views/Person_profile_V_test.php
new file mode 100644
index 0000000..a4aa9b3
--- /dev/null
+++ b/old_code_ci3/views/Person_profile_V_test.php
@@ -0,0 +1,683 @@
+
+ */
+
+// Data validation and sanitization helper
+function safe_output($data, $default = '') {
+ return !empty($data) ? htmlspecialchars($data, ENT_QUOTES, 'UTF-8') : $default;
+}
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'form','class'=>'form1', 'id'=>'person-profile-form')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Full Name
+
+ = safe_output(ucwords($data[0]->p_fname ?? ''), 'Not provided'); ?>
+
+
+
+
+
+
+
+
+
+ Gender
+
+ = safe_output($data[0]->xgender ?? '', 'Not specified'); ?>
+
+
+
+
+
+
+
+
+
+ Age
+
+ = safe_output($data[0]->str_age ?? '', 'Unknown'); ?>
+
+
+
+
+
+
+
+
+
+
+ Phone Number:
+
+ = safe_output($data[0]->mphone1 ?? '', 'Not provided'); ?>
+
+
+
+
+
+ Email:
+
+ = safe_output($data[0]->email1 ?? '', 'Not provided'); ?>
+
+
+
+
+
+
+
+
+
+ Relation:
+
+ = safe_output($data[0]->p_relative ?? '', 'Not specified'); ?>
+
+ p_rname)): ?>
+ | Relative Name:
+
+ = safe_output(ucwords($data[0]->p_rname)); ?>
+
+
+
+
+
+
+ Blood Group:
+
+ = safe_output($data[0]->blood_group ?? '', 'Not specified'); ?>
+
+
+
+
+
+
+
+
+
+ Address:
+
+ add1 ?? '',
+ $data[0]->city ?? '',
+ $data[0]->district ?? '',
+ $data[0]->state ?? '',
+ $data[0]->zip ?? ''
+ ]);
+ echo !empty($address_parts) ? safe_output(implode(', ', $address_parts)) : 'Not provided';
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ insurance_id) && $data[0]->insurance_id > 0): ?>
+
+
+
+
+ Company Name:
+
+ = safe_output($data_insurance_card[0]->ins_company_name ?? '', 'Not specified'); ?>
+
+
+
+ Card Holder Name:
+
+ = safe_output($data[0]->card_holder_name ?? '', 'Not specified'); ?>
+
+
+
+ Relation:
+
+ = safe_output($data[0]->relation_patient_cardholder ?? '', 'Not specified'); ?>
+
+
+
+ Insurance ID:
+
+ = safe_output($data[0]->insurance_no ?? '', 'Not specified'); ?>
+
+
+
+
+
+
+ 0): ?>
+
+
OPD Case Active
+
Case Code: = safe_output($case_master_opd[0]->case_id_code ?? ''); ?>
+
Visit Date: = safe_output($case_master_opd[0]->str_date_registration ?? ''); ?>
+
+ Update Case
+
+
+ 0): ?>
+
+
+
IPD Case Active
+
Case Code: = safe_output($case_master_ipd[0]->case_id_code ?? ''); ?>
+
IPD No: = safe_output($case_master_ipd[0]->ipd_code ?? ''); ?>
+
+ Update Case
+
+
+
+
+
Create New Case
+
+ Create IPD Case
+
+
+ Create OPD Case
+
+
+
+
+
+
+
+
+
+ opd_allowed) && $data_insurance_card[0]->opd_allowed == 1): ?>
+
+ OPD Insurance Rates / CASH
+
+
+
+ charge_cash) && $data_insurance_card[0]->charge_cash == 1): ?>
+
+ Charge with Ins. Rate / CASH
+
+
+
+
+
+
+
+
No Insurance Information
+
No insurance details found for this patient.
+
+ Add Insurance
+
+
+
+
+
+
+
+
+
+
+
+
+ A ppointment OPD
+
+
+
+
+ Add Charge
+
+
+
+
+ IPD
+
+
+
+
+ Documents
+
+
+
+
+
+
+
+
+
+
+ 0): ?>
+
+
+
+
+
+
= safe_output($row->opd_code ?? ''); ?>
+
+ Dr. = safe_output($row->doc_name ?? ''); ?>
+ = safe_output($row->str_apointment_date ?? ''); ?>
+ = safe_output($row->p_fname ?? ''); ?>
+
+ ion_auth->in_group('OPDEdit') || ($row->new_opd ?? 0) == 1): ?>
+
+
+
+
+
+
+
+
+
+ 0): ?>
+
+
+
+
+
+
= safe_output($row->invoice_code ?? ''); ?>
+
+ = safe_output($row->str_inv_date ?? ''); ?>
+ = safe_output($row->inv_name ?? ''); ?>
+ = safe_output($row->Item_List ?? ''); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/IPD_Current_List.php b/old_code_ci3/views/Report/IPD_Current_List.php
new file mode 100644
index 0000000..24890f6
--- /dev/null
+++ b/old_code_ci3/views/Report/IPD_Current_List.php
@@ -0,0 +1,111 @@
+
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ Type
+
+ All
+ id.' >'.$row->tpa_group.'';
+ }
+ echo '-------------------- ';
+ foreach($hc_insurance as $row)
+ {
+ echo ''.$row->short_name.' ';
+ }
+
+ ?>
+
+
+
+ Order By
+
+ ID
+ Date
+ Name
+ Bed No.
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/OPD_Report_Doctor.php b/old_code_ci3/views/Report/OPD_Report_Doctor.php
new file mode 100644
index 0000000..033c6c1
--- /dev/null
+++ b/old_code_ci3/views/Report/OPD_Report_Doctor.php
@@ -0,0 +1,97 @@
+
+
+
+
+
OPD Date Range
+
+
+
+
+
+
+
+ Doctor Name
+
+
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+ Show Short
+ Export
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/ReportMain.php b/old_code_ci3/views/Report/ReportMain.php
new file mode 100644
index 0000000..a9ebe67
--- /dev/null
+++ b/old_code_ci3/views/Report/ReportMain.php
@@ -0,0 +1,201 @@
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Report/Report_IPD.php b/old_code_ci3/views/Report/Report_IPD.php
new file mode 100644
index 0000000..5c12cae
--- /dev/null
+++ b/old_code_ci3/views/Report/Report_IPD.php
@@ -0,0 +1,200 @@
+
+
+
+
+ Search By Date
+
+ Admit
+ Discharge
+
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ IPD Status
+
+ ALL
+ Admit
+ Discharge
+
+
+
+ Type
+
+ ALL
+ id.' >'.$row->tpa_group.'';
+ }
+ echo '-------------------- ';
+ foreach($hc_insurance as $row)
+ {
+ echo ''.$row->short_name.' ';
+ }
+
+ ?>
+
+
+
+
+
+ Show
+ Export
+ IPD Cr. Medical Amt Show
+ Invoice List Print
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/Report_medical.php b/old_code_ci3/views/Report/Report_medical.php
new file mode 100644
index 0000000..4a8dd08
--- /dev/null
+++ b/old_code_ci3/views/Report/Report_medical.php
@@ -0,0 +1,153 @@
+
+
+
+
+
IPD Admit Date Range
+
+
+
+
+
+
+
+ Diagnosis Head
+
+ All
+ itype_id.' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+ Doctors
+
+ All
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ IPD Status
+
+ ALL
+ Admit
+ Discharge
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/Report_medical_template.php b/old_code_ci3/views/Report/Report_medical_template.php
new file mode 100644
index 0000000..cbf362a
--- /dev/null
+++ b/old_code_ci3/views/Report/Report_medical_template.php
@@ -0,0 +1,41 @@
+
+
+
+
+
+ IPD Code
+ Patient Name
+ IPD Doc.
+ Admit Discharge Date
+ Item Name
+ Rate
+ Qty
+ Amt.
+ After Bill Amt.
+ Doc. Name
+
+
+
+
+
+ =$row->ipd_code?>
+ =$row->p_fname?>
+ =$row->ipd_doc_name?>
+ =$row->register_date_str?> =$row->discharge_date_str?>
+ =$row->item_name?>
+ =$row->item_rate?>
+ =$row->item_qty?>
+ =$row->item_amount?>
+ =$row->Aft_Amt?>
+ =$row->doc_name?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/Report_refer_ipd.php b/old_code_ci3/views/Report/Report_refer_ipd.php
new file mode 100644
index 0000000..664f213
--- /dev/null
+++ b/old_code_ci3/views/Report/Report_refer_ipd.php
@@ -0,0 +1,126 @@
+
+
+
+
+
IPD Admit Date Range
+
+
+
+
+
+
+
+ Refer
+
+ All
+ id.' >'.$row->f_name.'';
+ }
+ ?>
+
+
+
+ IPD Status
+
+ ALL
+ Admit
+ Discharge
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/Report_refer_template.php b/old_code_ci3/views/Report/Report_refer_template.php
new file mode 100644
index 0000000..9ffee0f
--- /dev/null
+++ b/old_code_ci3/views/Report/Report_refer_template.php
@@ -0,0 +1,35 @@
+
+
+
+
+
+ IPD Code
+ Patient Name
+ IPD Doc.
+ Admit Discharge Date
+ Refer Name
+ Net Amount
+ Balance
+
+
+
+
+
+ =$row->ipd_code?>
+ =$row->p_fname?>
+ =$row->ipd_doc_name?>
+ =$row->register_date_str?> =$row->discharge_date_str?>
+ =$row->title?> =$row->f_name?> [=$row->type_desc?>]
+ =$row->net_amount?>
+ =$row->balance_amount?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/ipd_payment_report.php b/old_code_ci3/views/Report/ipd_payment_report.php
new file mode 100644
index 0000000..ca59dba
--- /dev/null
+++ b/old_code_ci3/views/Report/ipd_payment_report.php
@@ -0,0 +1,158 @@
+
+
+
+
+
Charges Invoice Date Range
+
+
+
+
+
+
+
+ Refer Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ Payment Mode
+
+ All Type
+ id.' >'.$row->mode_desc.'';
+ }
+ ?>
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+
+
+ Order First
+
+ Doctor
+ Employees
+ Paymode
+
+
+
+ Order Second
+
+ Doctor
+ Employees
+ Paymode
+
+
+
+ Group By
+
+ Not Grouping
+ Date
+ Doctor
+ Employees
+ Paymode
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/new 1.php b/old_code_ci3/views/Report/new 1.php
new file mode 100644
index 0000000..7a3eb2b
--- /dev/null
+++ b/old_code_ci3/views/Report/new 1.php
@@ -0,0 +1,60 @@
+// storing request (ie, get/post) global array to a variable
+$requestData= $_REQUEST;
+
+$columns = array(
+// datatable column index => database column name
+ 0 =>'employee_name',
+ 1 => 'employee_salary',
+ 2=> 'employee_age'
+);
+// getting total number records without any search
+$sql = "SELECT employee_name, employee_salary, employee_age ";
+$sql.=" FROM employee";
+$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get employees");
+$totalData = mysqli_num_rows($query);
+$totalFiltered = $totalData; // when there is no search parameter then total number rows = total number filtered rows.
+ = '".$minRange."' AND employee_age <= '".$maxRange."' ) ";
+}
+$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get employees");
+$totalFiltered = mysqli_num_rows($query); // when there is a search parameter then we have to modify total number filtered rows as per search result.
+
+$sql.=" ORDER BY ". $columns[$requestData['order'][0]['column']]." ".$requestData['order'][0]['dir']." LIMIT ".$requestData['start']." ,".$requestData['length']." "; // adding length
+
+$query=mysqli_query($conn, $sql) or die("employee-grid-data.php: get employees");
+
+$data = array();
+while( $row=mysqli_fetch_array($query) ) { // preparing an array
+ $nestedData=array();
+
+ $nestedData[] = $row["employee_name"];
+ $nestedData[] = $row["employee_salary"];
+ $nestedData[] = $row["employee_age"];
+
+ $data[] = $nestedData;
+}
+
+$json_data = array(
+ "draw" => intval( $requestData['draw'] ), // for every request/draw by clientside , they send a number as a parameter, when they recieve a response/data they first check the draw number, so we are sending same number in draw.
+ "recordsTotal" => intval( $totalData ), // total number of records
+ "recordsFiltered" => intval( $totalFiltered ), // total number of records after searching, if there is no searching then totalFiltered = totalData
+ "data" => $data // total data array
+ );
+
+echo json_encode($json_data); // send data as json format
+
+?>
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/new 1.txt b/old_code_ci3/views/Report/new 1.txt
new file mode 100644
index 0000000..262c9bf
--- /dev/null
+++ b/old_code_ci3/views/Report/new 1.txt
@@ -0,0 +1,143 @@
+
+
+
+
+
OPD Date Range
+
+
+
+
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+ Payment Mode
+
+ All Type
+ id.' >'.$row->mode_desc.'';
+ }
+ ?>
+
+
+
+
+
+ Order First
+
+ Doctor
+ Employees
+ Paymode
+
+
+
+ Order Second
+
+ Doctor
+ Employees
+ Paymode
+
+
+
+ Group By
+
+ Date
+ Doctor
+ Employees
+ Paymode
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/opd_report_total.php b/old_code_ci3/views/Report/opd_report_total.php
new file mode 100644
index 0000000..6e34049
--- /dev/null
+++ b/old_code_ci3/views/Report/opd_report_total.php
@@ -0,0 +1,128 @@
+
+
+
+
+
OPD Date Range
+
+
+
+
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+ Payment Mode
+
+ All Type
+ id.' >'.$row->mode_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/opd_report_v.php b/old_code_ci3/views/Report/opd_report_v.php
new file mode 100644
index 0000000..a0de4f7
--- /dev/null
+++ b/old_code_ci3/views/Report/opd_report_v.php
@@ -0,0 +1,160 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_collocation_emp.php b/old_code_ci3/views/Report/rep_collocation_emp.php
new file mode 100644
index 0000000..ba760ff
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_collocation_emp.php
@@ -0,0 +1,156 @@
+
+
+
+
+
Charges Invoice Date Range
+
+
+
+
+
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+
+
+ Payment Mode
+
+ Cash & Bank
+ id.' >'.$row->mode_desc.'';
+ }
+ ?>
+
+
+
+ Order First
+
+ Employees
+ Paymode
+
+
+
+
+
+ Show
+ Show Day Wise
+ Export
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_diagnosis.php b/old_code_ci3/views/Report/rep_diagnosis.php
new file mode 100644
index 0000000..e39a8de
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_diagnosis.php
@@ -0,0 +1,129 @@
+
+
+
+
+
+ Group
+
+ Yes
+ No
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ Diagnosis Head
+
+ No Doctor
+ itype_id.' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_diagnosis_cash.php b/old_code_ci3/views/Report/rep_diagnosis_cash.php
new file mode 100644
index 0000000..6b9d631
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_diagnosis_cash.php
@@ -0,0 +1,153 @@
+
+
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ Diagnosis Head
+
+ No Doctor
+ itype_id.' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_diagnosis_empwise.php b/old_code_ci3/views/Report/rep_diagnosis_empwise.php
new file mode 100644
index 0000000..07a823d
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_diagnosis_empwise.php
@@ -0,0 +1,121 @@
+
+
+
+
+
+ Diagnosis Head
+
+ All
+ itype_id.' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_diagnosis_empwise_2.php b/old_code_ci3/views/Report/rep_diagnosis_empwise_2.php
new file mode 100644
index 0000000..4c2601d
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_diagnosis_empwise_2.php
@@ -0,0 +1,121 @@
+
+
+
+
+
+ Diagnosis Head
+
+ All
+ itype_id.' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_lab_item.php b/old_code_ci3/views/Report/rep_lab_item.php
new file mode 100644
index 0000000..4c2601d
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_lab_item.php
@@ -0,0 +1,121 @@
+
+
+
+
+
+ Diagnosis Head
+
+ All
+ itype_id.' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_opd_p.php b/old_code_ci3/views/Report/rep_opd_p.php
new file mode 100644
index 0000000..75dbb89
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_opd_p.php
@@ -0,0 +1,160 @@
+
+
+
+
+
OPD Date Range
+
+
+
+
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+ Payment Mode
+
+ All Type
+ id.' >'.$row->mode_desc.'';
+ }
+ ?>
+
+
+
+
+
+ Order First
+
+ OPD ID
+ Doctor
+ Employees
+ Paymode
+
+
+
+ Order Second
+
+ OPD ID
+ Doctor
+ Employees
+ Paymode
+
+
+
+ Group By
+
+ OPD Date
+ Doctor
+ Employees
+ Paymode
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_other_charge.php b/old_code_ci3/views/Report/rep_other_charge.php
new file mode 100644
index 0000000..de8fd18
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_other_charge.php
@@ -0,0 +1,161 @@
+
+
+
+
+
Charges Invoice Date Range
+
+
+
+
+
+
+
+ Refer Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+ Payment Mode
+
+ All Type
+ id.' >'.$row->mode_desc.'';
+ }
+ ?>
+
+
+
+
+
+ Order First
+
+ Doctor
+ Employees
+ Paymode
+
+
+
+ Order Second
+
+ Doctor
+ Employees
+ Paymode
+
+
+
+ Group By
+
+ Date
+ Doctor
+ Employees
+ Paymode
+
+
+
+
+
+ Show
+ Export
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_total_bank_payment.php b/old_code_ci3/views/Report/rep_total_bank_payment.php
new file mode 100644
index 0000000..d94f59f
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_total_bank_payment.php
@@ -0,0 +1,118 @@
+
+
+
+
+
Charges Invoice Date Range
+
+
+
+
+
+
+
+ Employee Name
+
+ All Employees
+ id . ' >' . $row->first_name . ' ' . $row->last_name . '';
+ }
+ ?>
+
+
+
+ Bank
+
+ All
+ ac_id . ' >' . $row->bank_name . ' : ' . $row->pay_type . '';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/rep_total_payment.php b/old_code_ci3/views/Report/rep_total_payment.php
new file mode 100644
index 0000000..19deeb4
--- /dev/null
+++ b/old_code_ci3/views/Report/rep_total_payment.php
@@ -0,0 +1,135 @@
+
+
+
+
+
Charges Invoice Date Range
+
+
+
+
+
+
+
+
+ Employee Name
+
+ All Employees
+ id.' >'.$row->first_name.' '.$row->last_name.'';
+ }
+ ?>
+
+
+
+
+
+ Payment Mode
+
+ Cash & Bank
+ id.' >'.$row->mode_desc.'';
+ }
+ ?>
+
+
+
+ Order First
+
+ Employees
+ Paymode
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report/report_Diagnosis_Emp_total_3.php b/old_code_ci3/views/Report/report_Diagnosis_Emp_total_3.php
new file mode 100644
index 0000000..37be24a
--- /dev/null
+++ b/old_code_ci3/views/Report/report_Diagnosis_Emp_total_3.php
@@ -0,0 +1,11 @@
+
+
+ #
+ Test Name
+ Patient Name
+ UHID
+ Age
+ Phone No.
+
+
+
+
+ Report Insurance Case IPD
+ Panel
+
+
+
+
+
+
+ Company Name
+
+ id.' >'.$row->tpa_group.'';
+ }
+ echo '-------------------- ';
+ foreach($hc_insurance as $row)
+ {
+ echo ''.$row->short_name.' ';
+ }
+
+ ?>
+
+
+
+ ORG Status
+
+ All
+ Pending
+ Bill Complete
+ Org. Case Submit
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report3/ECHS_OPD.php b/old_code_ci3/views/Report3/ECHS_OPD.php
new file mode 100644
index 0000000..1ed168b
--- /dev/null
+++ b/old_code_ci3/views/Report3/ECHS_OPD.php
@@ -0,0 +1,137 @@
+
+
+
+
+
+ Company Name
+
+ All
+ id.' >'.$row->tpa_group.'';
+ }
+ echo '-------------------- ';
+ foreach($hc_insurance as $row)
+ {
+ echo ''.$row->short_name.' ';
+ }
+
+ ?>
+
+
+
+ ORG Status
+
+ All
+ Pending
+ Bill Complete
+ Org. Case Submit
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report3/diagnosis_qty.php b/old_code_ci3/views/Report3/diagnosis_qty.php
new file mode 100644
index 0000000..6e3f377
--- /dev/null
+++ b/old_code_ci3/views/Report3/diagnosis_qty.php
@@ -0,0 +1,116 @@
+
+
+
+
+
+ Diagnosis Head
+
+ All
+ itype_id.' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report4/Report_echs_opd.php b/old_code_ci3/views/Report4/Report_echs_opd.php
new file mode 100644
index 0000000..3195a14
--- /dev/null
+++ b/old_code_ci3/views/Report4/Report_echs_opd.php
@@ -0,0 +1,128 @@
+
+
+
+
+
+ ORG Status
+
+ Pending
+ Bill Complete
+ Org. Case Submit
+
+
+
+
+
+ Show
+ Export
+ Invoice List Print
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report5/Report_Document.php b/old_code_ci3/views/Report5/Report_Document.php
new file mode 100644
index 0000000..0f3f14a
--- /dev/null
+++ b/old_code_ci3/views/Report5/Report_Document.php
@@ -0,0 +1,109 @@
+
+
+
+
+
+ Doctor Name
+
+ All Doctors
+ id.' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report5/Report_XRay_chest.php b/old_code_ci3/views/Report5/Report_XRay_chest.php
new file mode 100644
index 0000000..65a5455
--- /dev/null
+++ b/old_code_ci3/views/Report5/Report_XRay_chest.php
@@ -0,0 +1,79 @@
+
+
+
diff --git a/old_code_ci3/views/Report5/Report_corona_suspected.php b/old_code_ci3/views/Report5/Report_corona_suspected.php
new file mode 100644
index 0000000..ac9ed5a
--- /dev/null
+++ b/old_code_ci3/views/Report5/Report_corona_suspected.php
@@ -0,0 +1,79 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report5/Report_dengue.php b/old_code_ci3/views/Report5/Report_dengue.php
new file mode 100644
index 0000000..d8c21ed
--- /dev/null
+++ b/old_code_ci3/views/Report5/Report_dengue.php
@@ -0,0 +1,79 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report5/Report_pregnancy_suspected.php b/old_code_ci3/views/Report5/Report_pregnancy_suspected.php
new file mode 100644
index 0000000..253c800
--- /dev/null
+++ b/old_code_ci3/views/Report5/Report_pregnancy_suspected.php
@@ -0,0 +1,79 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Report6/Report_Lab_Log.php b/old_code_ci3/views/Report6/Report_Lab_Log.php
new file mode 100644
index 0000000..6b59060
--- /dev/null
+++ b/old_code_ci3/views/Report6/Report_Lab_Log.php
@@ -0,0 +1,109 @@
+
+
+
+
+
+ Lab Name
+
+ All Labs
+ $value)
+ {
+ echo ''.$value.' ';
+ }
+ ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/ReportMain.php b/old_code_ci3/views/ReportMain.php
new file mode 100644
index 0000000..0fc5af3
--- /dev/null
+++ b/old_code_ci3/views/ReportMain.php
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Storestock/Dashboard.php b/old_code_ci3/views/Storestock/Dashboard.php
new file mode 100644
index 0000000..5d1a815
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Dashboard.php
@@ -0,0 +1,37 @@
+
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Draft_indent.php b/old_code_ci3/views/Storestock/Draft_indent.php
new file mode 100644
index 0000000..c5a59fc
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Draft_indent.php
@@ -0,0 +1,117 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Medical_stock_drug.php b/old_code_ci3/views/Storestock/Medical_stock_drug.php
new file mode 100644
index 0000000..3c8afae
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Medical_stock_drug.php
@@ -0,0 +1,116 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/new_purchase_invoice.php b/old_code_ci3/views/Storestock/Purchase/new_purchase_invoice.php
new file mode 100644
index 0000000..7dc48d6
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/new_purchase_invoice.php
@@ -0,0 +1,78 @@
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Supplier
+
+ sid.' >'.$row->name_supplier.'';
+ }
+ ?>
+
+
+
+
+
+ Bill Type
+
+ Invoice
+ Challan
+
+
+
+
+
+ Invoice /Challan ID
+
+
+
+
+
+ C reate
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/purchase_challan_list.php b/old_code_ci3/views/Storestock/Purchase/purchase_challan_list.php
new file mode 100644
index 0000000..b96c12e
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/purchase_challan_list.php
@@ -0,0 +1,37 @@
+
+
+
+ $row->id)
+ {
+ echo '';
+ echo ' Challan No :'.$row->Invoice_no.' / Date : '.$row->str_date_of_invoice.' /Net Amount :'.$row->tamount.' ';
+ echo ' ';
+
+ echo '';
+ echo ' Item Name ';
+ echo ' Qty + Free ';
+ echo ' MRP ';
+ echo ' Add ';
+ echo ' ';
+ }
+
+ echo '';
+ echo ' '.$row->Item_name.' ';
+ echo ' '.$row->qty.' + '.$row->qty_free.' ';
+ echo ' '.$row->mrp.' ';
+ echo ' Add ';
+ echo ' ';
+
+ $purchase_id=$row->id;
+
+ }
+ ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/purchase_invoice_edit.php b/old_code_ci3/views/Storestock/Purchase/purchase_invoice_edit.php
new file mode 100644
index 0000000..35566e1
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/purchase_invoice_edit.php
@@ -0,0 +1,531 @@
+
+
+
+
+
+
+ 'form', 'class' => 'form2')); ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/purchase_invoice_item.php b/old_code_ci3/views/Storestock/Purchase/purchase_invoice_item.php
new file mode 100644
index 0000000..11f4f55
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/purchase_invoice_item.php
@@ -0,0 +1,79 @@
+
+
+ #
+ RecNo
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+
+ item_return==1)
+ {
+ $style='style="color:Red;"';
+ }else{
+ $style='';
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->id.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->exp_date_str.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->qty).'+'.floatval($row->qty_free).' ';
+ echo ''.$row->purchase_price.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->discount.' ';
+ echo ''.$row->taxable_amount.' ';
+ echo ''.$row->CGST_per.' ';
+ echo ''.$row->SGST_per.' ';
+ echo ''.$row->net_amount.' ';
+ echo '';
+ if($purchase_invoice[0]->inv_status==0)
+ {
+ echo '
+ ';
+ if($row->old_purchase_id>0)
+ {
+ echo ' ';
+ }
+ }
+ echo ' ';
+ echo ' ';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+
+ =$purchase_invoice[0]->Taxable_Amt ?>
+ =$purchase_invoice[0]->CGST_Amt ?>
+ =$purchase_invoice[0]->SGST_Amt ?>
+ =$purchase_invoice[0]->T_Net_Amount ?>
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/purchase_invoice_item_print.php b/old_code_ci3/views/Storestock/Purchase/purchase_invoice_item_print.php
new file mode 100644
index 0000000..67947ce
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/purchase_invoice_item_print.php
@@ -0,0 +1,130 @@
+
+
+
+
+
+=M_store?>
+
+
+
+ =M_address?>, Uttarakhand
+ ';
+
+ if(H_Med_GST!='')
+ {
+ echo 'GST: '.H_Med_GST .' ';
+ }
+
+ if(M_LIC!='')
+ {
+ echo ' L.No: '.M_LIC;
+ }
+ ?>
+
+
+
+ Invoice From :
+ Supplier : =$inv_master_data[0]->name_supplier?>
+ Purchase Invoice No.: =$inv_master_data[0]->Invoice_no?>
+ Invoice Date : =MysqlDate_to_str($inv_master_data[0]->date_of_invoice)?>
+
+
+
+
+Purchase Invoice
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$inv_master_data[0]->Invoice_no?> / Name : =$inv_master_data[0]->name_supplier?>
+
+
+
+
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+ item_return==1)
+ {
+ $style='style="color:Red;"';
+ }else{
+ $style='';
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry_date.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->qty).'+'.floatval($row->qty_free).' ';
+ echo ''.$row->purchase_price.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->discount.' ';
+ echo ''.$row->taxable_amount.' ';
+ echo ''.$row->CGST_per.' ';
+ echo ''.$row->SGST_per.' ';
+ echo ''.$row->net_amount.' ';
+ echo ' ';
+ }
+ ?>
+
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+ =$inv_master_data[0]->Taxable_Amt ?>
+ =$inv_master_data[0]->CGST_Amt ?>
+ =$inv_master_data[0]->SGST_Amt ?>
+ =$inv_master_data[0]->T_Net_Amount ?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/purchase_invoice_master_edit.php b/old_code_ci3/views/Storestock/Purchase/purchase_invoice_master_edit.php
new file mode 100644
index 0000000..d4eb5f5
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/purchase_invoice_master_edit.php
@@ -0,0 +1,231 @@
+
+
+
+
+
+
+
+
+
+ #
+ Item Name
+ Batch No
+ Exp.
+ MRP
+ Qty.
+ Rate
+ Amount
+ Disc.
+ Tax Amount
+ CGST
+ SGST
+ Net Amount
+
+ item_return==1)
+ {
+ $style='style="color:Red;"';
+ }else{
+ $style='';
+ }
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry_date.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->qty).'+'.floatval($row->qty_free).' ';
+ echo ''.$row->purchase_price.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->discount.' ';
+ echo ''.$row->taxable_amount.' ';
+ echo ''.$row->CGST_per.' ';
+ echo ''.$row->SGST_per.' ';
+ echo ''.$row->net_amount.' ';
+ echo ' ';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+
+
+ =$inv_master_data[0]->Taxable_Amt ?>
+ =$inv_master_data[0]->CGST_Amt ?>
+ =$inv_master_data[0]->SGST_Amt ?>
+ =$inv_master_data[0]->T_Net_Amount ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/purchase_item_old.php b/old_code_ci3/views/Storestock/Purchase/purchase_item_old.php
new file mode 100644
index 0000000..2fcb615
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/purchase_item_old.php
@@ -0,0 +1,31 @@
+
Last 5 Purchase Orders
+
+
+ #
+ Item Name
+ Date
+ MRP
+ Qty
+ Rate
+ Supplier
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->Item_name.' ';
+ echo ''.$row->date_of_invoice_str.' ';
+ echo ''.$row->mrp.' ';
+ echo ''.floatval($row->qty).'+'.floatval($row->qty_free).' ';
+ echo ''.$row->purchase_price.' ';
+ echo ''.$row->name_supplier.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/purchase_supp_list.php b/old_code_ci3/views/Storestock/Purchase/purchase_supp_list.php
new file mode 100644
index 0000000..5216fb7
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/purchase_supp_list.php
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+ Amount
+
+
+
+
+ ischallan==0){
+ echo '';
+ }else{
+ echo ' ';
+ }
+ ?>
+
+ =$purchase_list[$i]->Invoice_no ?>
+ =$purchase_list[$i]->name_supplier ?>
+ =$purchase_list[$i]->date_of_invoice ?>
+ =$purchase_list[$i]->tamount ?>
+
+ View & Edit
+ Print
+ tamount==0){ ?>
+ Delete
+
+
+
+
+
+
+
+
+
+ Invoice ID
+ Supplier
+ Date
+ Amount
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/supplier_Edit.php b/old_code_ci3/views/Storestock/Purchase/supplier_Edit.php
new file mode 100644
index 0000000..2aedfd9
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/supplier_Edit.php
@@ -0,0 +1,120 @@
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+ 0)
+ {
+ $sid=$supplier_data[0]->sid;
+ $name_supplier=$supplier_data[0]->name_supplier;
+ $short_name=$supplier_data[0]->short_name;
+ $contact_no=$supplier_data[0]->contact_no;
+ $gst_no=$supplier_data[0]->gst_no;
+ $city=$supplier_data[0]->city;
+ $state=$supplier_data[0]->state;
+ }
+
+ ?>
+
+
+
+
+
+
+
State
+
+
+ state_name == $state) ? ' selected="selected"' : "";
+
+ echo ''.$row->state_name.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+ A dd Supplier & Update
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/supplier_list.php b/old_code_ci3/views/Storestock/Purchase/supplier_list.php
new file mode 100644
index 0000000..e0a5567
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/supplier_list.php
@@ -0,0 +1,32 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/supplier_master.php b/old_code_ci3/views/Storestock/Purchase/supplier_master.php
new file mode 100644
index 0000000..327b85b
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/supplier_master.php
@@ -0,0 +1,60 @@
+
+
+
+
+
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+ =$supplier_data[$i]->name_supplier ?>
+ =$supplier_data[$i]->gst_no ?>
+
+ Edit
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Purchase/supplier_master_sub.php b/old_code_ci3/views/Storestock/Purchase/supplier_master_sub.php
new file mode 100644
index 0000000..651aa18
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Purchase/supplier_master_sub.php
@@ -0,0 +1,30 @@
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
+
+ =$supplier_data[$i]->name_supplier ?>
+ =$supplier_data[$i]->name_supplier ?>
+
+ Edit
+
+
+
+
+
+
+ Name
+ GST
+ Action
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Stock/location_master_list.php b/old_code_ci3/views/Storestock/Stock/location_master_list.php
new file mode 100644
index 0000000..5c90f8b
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Stock/location_master_list.php
@@ -0,0 +1,52 @@
+
+
+
+
+
+
+
+
+
+
+ ID
+
+
+ Location Name
+
+
+ Location Description
+
+
+ Action
+
+
+
+
+
+
+
+ = $row->l_id ?>
+
+
+ = $row->loc_name ?>
+
+
+ = $row->loc_desc ?>
+
+
+ Edit
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Stock/main_store_dashboard.php b/old_code_ci3/views/Storestock/Stock/main_store_dashboard.php
new file mode 100644
index 0000000..c28a01c
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Stock/main_store_dashboard.php
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/Storestock/Stock_Item_history.php b/old_code_ci3/views/Storestock/Stock_Item_history.php
new file mode 100644
index 0000000..5d0f09c
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Stock_Item_history.php
@@ -0,0 +1,58 @@
+
+
+ Pur. ID
+ Supplier
+ Inv.No / Date
+ Bat.No.
+ Exp.Dt.
+ MRP
+ Purchase
+ Qty / Packing
+ Unit Qty
+ Sale U.Qty
+ Lost Unit
+ Curr.U.Qty
+ Update Lost Unit
+ Remove
+
+
+
+ =$row->id?>
+ =$row->name_supplier?>
+ =$row->Invoice_no?> =$row->date_of_invoice?>
+ =$row->batch_no?>
+ =$row->expiry_date?>
+ =$row->mrp?>
+ =$row->purchase_price?>
+ =$row->tqty?> / =$row->packing?>
+ =$row->total_unit?>
+ =$row->total_sale_unit?>
+ =$row->total_lost_unit?>
+ =$row->cur_unit?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Stock_search_qty_result.php b/old_code_ci3/views/Storestock/Stock_search_qty_result.php
new file mode 100644
index 0000000..2c34dc8
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Stock_search_qty_result.php
@@ -0,0 +1,190 @@
+
+
+
+
+
+
+
+ Item Name
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Lost Unit
+ Package/Re-Order Qty
+ Removed Qty
+
+
+
+
+
+
+
+ =$row->item_name ?>
+
+
+ =$row->C_Pak_Qty?>
+
+
+ =Round($row->C_Unit_Stock_Qty,2) ?>
+
+
+ =Round($row->C_Pak_Sale_Qty,2) ?>
+
+
+ =Round($row->sale_unit,2) ?>
+
+
+ =Round($row->total_lost_unit,2) ?>
+
+
+ =$row->packing ?>/=$row->re_order_qty ?>
+
+
+ Show
+
+
+
+
+
+
+ Item Name
+ Current Pak.
+ Current Unit Qty
+ Total Sale Pak.
+ Total Sale Unit Qty
+ Lost Unit
+ Package/Re-Order Qty
+ Removed Qty
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Store_Final_Invoice.php b/old_code_ci3/views/Storestock/Store_Final_Invoice.php
new file mode 100644
index 0000000..dc36a3b
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Store_Final_Invoice.php
@@ -0,0 +1,308 @@
+
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ #
+ Item code
+ Item Name
+ Formulation
+ Batch No
+ Exp.
+ Rate
+ Qty.
+ Price
+ Disc.
+ HSNCODE/C-SGST
+ CGST
+ SGST
+ Amount
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_code.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->disc_amount.' ';
+ echo ''.$row->HSNCODE.' ';
+ echo ''.$row->CGST.' ';
+ echo ''.$row->SGST.' ';
+ echo ''.$row->tamount.' ';
+ echo '';
+ }
+ echo ' ';
+ ?>
+
+
+ #
+
+
+
+
+
+
+ Gross Total
+
+
+
+ =$invoiceGtotal[0]->Gtotal ?>
+ =$invoiceGtotal[0]->tamt?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/Store_Print.php b/old_code_ci3/views/Storestock/Store_Print.php
new file mode 100644
index 0000000..b64c445
--- /dev/null
+++ b/old_code_ci3/views/Storestock/Store_Print.php
@@ -0,0 +1,103 @@
+
+
+
+
+
+
+ =H_Name?>
+ =M_address?>, =H_address_2?>
+
+
+
+
Location Name :
+ =$invoice_stock_master[0]->issued_name?>
+ Indent No. : =$invoice_stock_master[0]->indent_code?>
+ Date : =MysqlDate_to_str($invoice_stock_master[0]->indent_date)?>
+
+
+
+
+
+ Indent
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+ Invoice No.:=$invoice_stock_master[0]->indent_code ?> / Location : =$invoice_stock_master[0]->issued_name ?>
+
+
+
+
+ Invoice ID : '.$row->indent_code.' [Dated : '.$row->str_inv_date.' ] ';
+ echo '';
+ echo '# ';
+ echo 'Item Name ';
+ echo 'Batch No ';
+ echo 'Exp. ';
+ echo 'Rate ';
+ echo 'Qty. ';
+ echo 'Gross Amt ';
+ echo ' ';
+ }
+
+ $srno=$srno+1;
+ $head_start=$head_start+1;
+
+ if($row->sale_return==1){
+ echo '';
+ echo 'Sale Return ';
+ echo ' ';
+ }
+
+ echo '';
+ echo ''.$srno.' ';
+ echo ''.$row->item_Name.' '.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ' ';
+ }
+
+ if(count($invoice_stock_master)>0) {
+ echo '';
+ echo '# ';
+ echo 'Total ';
+ echo ''.$invoice_stock_master[0]->gross_amount.' ';
+ echo ' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ For =H_Name?>
+
+
+
diff --git a/old_code_ci3/views/Storestock/indent_edit.php b/old_code_ci3/views/Storestock/indent_edit.php
new file mode 100644
index 0000000..3acedfd
--- /dev/null
+++ b/old_code_ci3/views/Storestock/indent_edit.php
@@ -0,0 +1,444 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/indent_item_list.php b/old_code_ci3/views/Storestock/indent_item_list.php
new file mode 100644
index 0000000..5ec0772
--- /dev/null
+++ b/old_code_ci3/views/Storestock/indent_item_list.php
@@ -0,0 +1,108 @@
+item_code);
+ }
+
+?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/new_indent.php b/old_code_ci3/views/Storestock/new_indent.php
new file mode 100644
index 0000000..d8bb9e6
--- /dev/null
+++ b/old_code_ci3/views/Storestock/new_indent.php
@@ -0,0 +1,88 @@
+
+
+
+
+
+
+
+
+ Select Location
+
+
+ =$row->loc_name?>
+
+
+
+
+
+
+
+
+
+
+ Select Employee
+
+
+ =$row->emp_code?> [=$row->emp_name?>]
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Storestock/store_stock_search.php b/old_code_ci3/views/Storestock/store_stock_search.php
new file mode 100644
index 0000000..c467693
--- /dev/null
+++ b/old_code_ci3/views/Storestock/store_stock_search.php
@@ -0,0 +1,143 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/TestForm.php b/old_code_ci3/views/TestForm.php
new file mode 100644
index 0000000..93c820e
--- /dev/null
+++ b/old_code_ci3/views/TestForm.php
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+
+
+
+
+ This is my textarea to be replaced with CKEditor.
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/TestForm2.php b/old_code_ci3/views/TestForm2.php
new file mode 100644
index 0000000..568e1d3
--- /dev/null
+++ b/old_code_ci3/views/TestForm2.php
@@ -0,0 +1,405 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Minimal
+
+ Alabama
+ Alaska
+ California
+ Delaware
+ Tennessee
+ Texas
+ Washington
+
+
+
+
+ Disabled
+
+ Alabama
+ Alaska
+ California
+ Delaware
+ Tennessee
+ Texas
+ Washington
+
+
+
+
+
+
+
+ Multiple
+
+ Alabama
+ Alaska
+ California
+ Delaware
+ Tennessee
+ Texas
+ Washington
+
+
+
+
+ Disabled Result
+
+ Alabama
+ Alaska
+ California (disabled)
+ Delaware
+ Tennessee
+ Texas
+ Washington
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Color picker:
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Website.php b/old_code_ci3/views/Website.php
new file mode 100644
index 0000000..ce7152a
--- /dev/null
+++ b/old_code_ci3/views/Website.php
@@ -0,0 +1,42 @@
+load->view('form');
+ }
+
+ public function submission()
+ {
+
+ if (!$this->input->is_ajax_request()) { exit('no valid req.'); }
+
+ $FormRules = array(
+ array(
+ 'field' => 'website',
+ 'label' => 'Website Address',
+ 'rules' => 'required|min_length[5]|max_length[30]'
+ )
+ );
+
+ $this->form_validation->set_rules($FormRules);
+
+ if ($this->form_validation->run() == TRUE)
+ {
+ echo '
Your website is submitted
';
+ }
+ else
+ {
+ echo '
'.validation_errors().'
';
+ }
+ }
+
+ }
diff --git a/old_code_ci3/views/auth_dst/create_group.php b/old_code_ci3/views/auth_dst/create_group.php
new file mode 100644
index 0000000..e8c6f25
--- /dev/null
+++ b/old_code_ci3/views/auth_dst/create_group.php
@@ -0,0 +1,43 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/auth_dst/create_user.php b/old_code_ci3/views/auth_dst/create_user.php
new file mode 100644
index 0000000..5c0d2e5
--- /dev/null
+++ b/old_code_ci3/views/auth_dst/create_user.php
@@ -0,0 +1,95 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/auth_dst/edit_group.php b/old_code_ci3/views/auth_dst/edit_group.php
new file mode 100644
index 0000000..080dad7
--- /dev/null
+++ b/old_code_ci3/views/auth_dst/edit_group.php
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/auth_dst/edit_user.php b/old_code_ci3/views/auth_dst/edit_user.php
new file mode 100644
index 0000000..d4a59da
--- /dev/null
+++ b/old_code_ci3/views/auth_dst/edit_user.php
@@ -0,0 +1,119 @@
+
+
+
+
+'form','class'=>'form1'));?>
+
+
+
+ ';
+ echo '
';
+ echo lang('edit_user_identity_label', 'identity');
+ echo form_input($identity);
+ echo '
+
';
+ }
+ ?>
+
+
+
+
+
+
+
+ ion_auth->is_admin()): ?>
+ module_name):
+ if($module_head_name!=""){
+ echo '
';
+ echo '
';
+ }
+ echo '
';
+ echo '
';
+ echo '
'.$group->module_name.' ';
+ $module_head_name=$group->module_name;
+ endif
+ ?>
+
+ id;
+ $checked = null;
+ $item = null;
+ foreach($currentGroups as $grp) {
+ if ($gID == $grp->id) {
+ $checked= ' checked="checked"';
+ break;
+ }
+ }
+ ?>
+ >
+ name,ENT_QUOTES,'UTF-8');?>
+
+
+ ';?>
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/auth_dst/index.php b/old_code_ci3/views/auth_dst/index.php
new file mode 100644
index 0000000..f2aa6a7
--- /dev/null
+++ b/old_code_ci3/views/auth_dst/index.php
@@ -0,0 +1,52 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/auth_dst/login.php b/old_code_ci3/views/auth_dst/login.php
new file mode 100644
index 0000000..60c0a51
--- /dev/null
+++ b/old_code_ci3/views/auth_dst/login.php
@@ -0,0 +1,100 @@
+
+
+
+
+
+ Log in
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Sign in to start your session
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/auth_dst/profile_update.php b/old_code_ci3/views/auth_dst/profile_update.php
new file mode 100644
index 0000000..b6199ae
--- /dev/null
+++ b/old_code_ci3/views/auth_dst/profile_update.php
@@ -0,0 +1,64 @@
+
+
+
+
+'form','class'=>'form1'));?>
+
+ ';
+ echo '
';
+ echo lang('edit_user_identity_label', 'identity');
+ echo form_input($identity);
+ echo '
+
';
+ }
+ ?>
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/center_room/center_room.php b/old_code_ci3/views/center_room/center_room.php
new file mode 100644
index 0000000..e8f8e26
--- /dev/null
+++ b/old_code_ci3/views/center_room/center_room.php
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Start
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/Investigation_history.php b/old_code_ci3/views/dashboard/Investigation_history.php
new file mode 100644
index 0000000..b38d138
--- /dev/null
+++ b/old_code_ci3/views/dashboard/Investigation_history.php
@@ -0,0 +1,69 @@
+
+id;
+ $query = $this->db->query($sql);
+ $lab_request= $query->result();
+
+ $sql="select * from file_upload_data
+ where show_type=0 and pid=$row->attach_id and charge_id=$row->id order by id";
+ $query = $this->db->query($sql);
+ $opd_file_list= $query->result();
+
+ ?>
+
+
+
+
+ ';
+ echo $lab_request_row->Report_Data;
+ echo '
';
+ }
+ ?>
+
+
+
+ ';
+ $pos=strpos($opd_file_row->full_path,'/uploads/',1) ;
+ $file_path=substr($opd_file_row->full_path,$pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$opd_file_row->full_path);
+
+ if($opd_file_row->file_ext=='.pdf')
+ {
+ echo '
';
+ }else
+ {
+ echo '
';
+ }
+
+ echo '
';
+ }
+
+ ?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/OPDPrescription.php b/old_code_ci3/views/dashboard/OPDPrescription.php
new file mode 100644
index 0000000..316d72e
--- /dev/null
+++ b/old_code_ci3/views/dashboard/OPDPrescription.php
@@ -0,0 +1,1203 @@
+
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Co-Morbidities
+
+
+
+ p_id == '') ? '' : 'Checked'; ?> >
+ = $row_morbidities->morbidities ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/OPD_old_prescription.php b/old_code_ci3/views/dashboard/OPD_old_prescription.php
new file mode 100644
index 0000000..bf9b6da
--- /dev/null
+++ b/old_code_ci3/views/dashboard/OPD_old_prescription.php
@@ -0,0 +1,195 @@
+
+
+
+
+
+ opd_id";
+ $query = $this->db->query($sql);
+ $opd_data = $query->result();
+
+ $sql = "select * from file_upload_data where show_type=0 and opd_id=$row->opd_id order by id";
+ $query = $this->db->query($sql);
+ $opd_file_list = $query->result();
+
+ $sql = "select * from file_opd_rec where opd_id=$row->opd_id order by id";
+ $query = $this->db->query($sql);
+ $file_opd_rec = $query->result();
+ ?>
+
+ OPD ID :' . $row->opd_code;
+ $opd_details_str .= '/
OPD Date : ' . MysqlDate_to_str($row->apointment_date);
+
+ if (count($opd_data) > 0) {
+
+ $sql = "SELECT * ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.opd_pre_id=" . $opd_data[0]->id;
+ $query = $this->db->query($sql);
+ $opd_prescribed = $query->result();
+
+ $opd_details_str .= ' /
Queue No.: ' . $opd_data[0]->queue_no . '
';
+
+ if ($opd_data[0]->bp != '') {
+ $opd_details_str .= '
BP : ' . $opd_data[0]->bp . ' ';
+ }
+
+ if ($opd_data[0]->diastolic != '') {
+ $opd_details_str .= '
Diastolic : ' . $opd_data[0]->diastolic . ' ';
+ }
+
+ if ($opd_data[0]->pulse != '') {
+ $opd_details_str .= '
Pulse : ' . $opd_data[0]->pulse . ' ';
+ }
+
+ if ($opd_data[0]->temp != '') {
+ $opd_details_str .= '
Temp. : ' . $opd_data[0]->temp . ' ';
+ }
+
+ $Complaint = "";
+
+ if ($opd_data[0]->complaints != '') {
+ $Complaint = "
Complaint : ";
+ $Complaint .= '' . $opd_data[0]->complaints . '';
+ }
+
+ $diagnosis = "";
+
+ if ($opd_data[0]->diagnosis != '') {
+ $diagnosis = "
Diagnosis : ";
+ $diagnosis .= ' ' . $opd_data[0]->diagnosis . '';
+ }
+
+ $investigation = "";
+ if ($opd_data[0]->investigation != '') {
+ $investigation = "
Investigation Advised : ";
+ $investigation .= ' ' . $opd_data[0]->investigation . '';
+ }
+
+ $opd_details_str .= $Complaint . $diagnosis . $investigation;
+
+
+ //New Start
+
+ if (count($opd_prescribed) > 0) {
+ $medical = "
Rx : ";
+ $sr_no = 1;
+ $medical .= '
+
+
+ Prescribed
+ Dose
+ Timing - Freq. - Duration
+ Qty
+ ';
+
+ foreach ($opd_prescribed as $row_prescribed) {
+ $medical_extend = "";
+
+ $medical .= '
+ ' . $sr_no . ' - ' . $row_prescribed->med_type . ' ' . $row_prescribed->med_name . '
+ ' . $row_prescribed->dose_shed . '
+ ' . $row_prescribed->dose_when . ' - ' . $row_prescribed->dose_frequency . ' - ' . $row_prescribed->dose_where . ' - ' . $row_prescribed->no_of_days . '
+ ' . $row_prescribed->qty . '
+ ';
+ if (strlen($row_prescribed->remark) > 0) {
+ $medical_extend = '
+ ' . $row_prescribed->remark . '
+ ';
+ }
+ $sr_no = $sr_no + 1;
+ }
+ $medical .= "
";
+ $opd_details_str .= $medical;
+ }
+
+ $advice = "";
+
+ if ($opd_data[0]->advice != '') {
+ $advice = "
Advice : ";
+ $advice .= '' . $opd_data[0]->advice . '';
+ }
+
+ $opd_details_str .= $advice;
+
+ $next_visit = "";
+
+ if ($opd_data[0]->next_visit != '') {
+ $next_visit = "
Next Visit : ";
+ $next_visit .= '' . $opd_data[0]->next_visit . '';
+ }
+
+ $opd_details_str .= $next_visit;
+
+ $refer_to = "";
+
+ if ($opd_data[0]->refer_to != '') {
+ $refer_to = "
Refer To : ";
+ $refer_to .= '' . $opd_data[0]->refer_to . '';
+ }
+
+ $opd_details_str .= $refer_to;
+
+ //New End
+ }
+ ?>
+
+
+
+
+ ';
+ $pos = strpos($opd_file_row->full_path, '/uploads/', 1);
+ $file_path = substr($opd_file_row->full_path, $pos);
+
+ //$file_path=str_replace('hms_uploads','uploads',$opd_file_row->full_path);
+
+ if (strtoupper($opd_file_row->file_ext) == '.PDF') {
+ echo '
';
+ } else {
+ echo '
';
+ }
+
+ echo '
';
+ }
+
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/appointment.php b/old_code_ci3/views/dashboard/appointment.php
new file mode 100644
index 0000000..014b9d7
--- /dev/null
+++ b/old_code_ci3/views/dashboard/appointment.php
@@ -0,0 +1,48 @@
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/dash1.php b/old_code_ci3/views/dashboard/dash1.php
new file mode 100644
index 0000000..1c55c59
--- /dev/null
+++ b/old_code_ci3/views/dashboard/dash1.php
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
+ OPD
+ =$opd_count_total[0]->T_opd ?>
+
+
+
+
+
+
+
+
+
+ Admit & Discharge Status
+ Discharge Today : =$no_admit_ipd_discharge ?>
+ Admit Today : =$no_admit_ipd_admit ?>
+
+
+
+
+
+
+
+ Current IPD Status
+ Total Admit : =$no_admit_ipd ?>
+ Org. Admit : =$no_admit_ipd_org ?>
+
+
+
+
+
+
+
+
+
+ CPU & Memory Load
+ =date('Y-m-d H:i:s') ?>
+ CPU =$load ?>%
+ Memory =$mem ?>%
+ Free Disk =$bytesPer ?>%
+ Total Disk =$dsizetot?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Organization
+ No of OPD
+
+
+
+ =$row->Ins_name ?>
+ =$row->No_OPD ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ Doctor Name
+ No of OPD
+ Direct
+ Org.
+
+
+
+ =$row->p_fname ?>
+ =$row->No_opd ?>
+ =$row->Direct_OPD ?>
+ =$row->Org_OPD ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Doctor Name
+ No of IPD
+
+
+
+ =$row->doc_name ?>
+ =$row->No_patient ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ Organization
+ No of IPD
+
+
+
+ =$row->ins_company_name ?>
+ =$row->No_IPD ?>
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/day_care_format.php b/old_code_ci3/views/dashboard/day_care_format.php
new file mode 100644
index 0000000..0c1871b
--- /dev/null
+++ b/old_code_ci3/views/dashboard/day_care_format.php
@@ -0,0 +1,65 @@
+
+
+
+DAY CARE DISCHARGE
+
+
+
+
+udai<>"")
+ {
+ $old_uhid= ' /'.$patient_master[0]->udai;
+ }
+?>
+
+
+
+
+ UHID : =$patient_master[0]->p_code?> =$old_uhid?>
+ Name : =$patient_master[0]->title?> =strtoupper($patient_master[0]->p_fname)?>
+ =$patient_master[0]->p_relative?> =strtoupper($patient_master[0]->p_rname)?>
+ Sex : =$patient_master[0]->xgender?> =$patient_master[0]->age?>
+
+
+ Date: =$opd_master[0]->str_apointment_date ?>
+ Admit Time: ____________________
+ Discharge Time: ___________________
+
+
+
+
+
+Hospital Course
+
+
+
+
+
+
+
+
+
+
+Treatment Advice
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/invoice_print_a4_double.php b/old_code_ci3/views/dashboard/invoice_print_a4_double.php
new file mode 100644
index 0000000..5e1c309
--- /dev/null
+++ b/old_code_ci3/views/dashboard/invoice_print_a4_double.php
@@ -0,0 +1 @@
+Hello World
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/jkhospital.php b/old_code_ci3/views/dashboard/jkhospital.php
new file mode 100644
index 0000000..023254d
--- /dev/null
+++ b/old_code_ci3/views/dashboard/jkhospital.php
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/khrc_opd_parcha.php b/old_code_ci3/views/dashboard/khrc_opd_parcha.php
new file mode 100644
index 0000000..b11697a
--- /dev/null
+++ b/old_code_ci3/views/dashboard/khrc_opd_parcha.php
@@ -0,0 +1,82 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+ =$opd_no?>
+
+
+ =$opd_date?>
+
+
+ =$short_info?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/khrc_opd_parcha_drManmeet.php b/old_code_ci3/views/dashboard/khrc_opd_parcha_drManmeet.php
new file mode 100644
index 0000000..f88d88f
--- /dev/null
+++ b/old_code_ci3/views/dashboard/khrc_opd_parcha_drManmeet.php
@@ -0,0 +1,82 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+ =$opd_no?>
+
+
+ =$opd_date?>
+
+
+ =$short_info?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/khrc_opd_parcha_drRahul.php b/old_code_ci3/views/dashboard/khrc_opd_parcha_drRahul.php
new file mode 100644
index 0000000..14ea3d5
--- /dev/null
+++ b/old_code_ci3/views/dashboard/khrc_opd_parcha_drRahul.php
@@ -0,0 +1,82 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+ =$opd_no?>
+
+
+ =$opd_date?>
+
+
+ =$short_info?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_appointment_panel.php b/old_code_ci3/views/dashboard/opd_appointment_panel.php
new file mode 100644
index 0000000..87fa952
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_appointment_panel.php
@@ -0,0 +1,36 @@
+
+
+
+
+
';
+ }
+ } ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_blank_print_ssc.php b/old_code_ci3/views/dashboard/opd_blank_print_ssc.php
new file mode 100644
index 0000000..6f66125
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_blank_print_ssc.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?> =H_address_2?>
+
+ Email : '.H_Email;
+ }
+ ?>
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+
+=$content?>
+
diff --git a/old_code_ci3/views/dashboard/opd_display.php b/old_code_ci3/views/dashboard/opd_display.php
new file mode 100644
index 0000000..0e76d59
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_display.php
@@ -0,0 +1,166 @@
+
+
+
+
+
+
+
+
=H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =$row->queue_no?>
+ =$row->p_code?>
+ =$row->P_name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =$row->queue_no?>
+ =$row->p_code?>
+ =$row->P_name?>
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_invoice_print.php b/old_code_ci3/views/dashboard/opd_invoice_print.php
new file mode 100644
index 0000000..4457972
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_invoice_print.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+ ';
+ ?>
+
+
+
+
+
+
+
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print.php b/old_code_ci3/views/dashboard/opd_letter_head_print.php
new file mode 100644
index 0000000..684e442
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print.php
@@ -0,0 +1,45 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_agarwal_hospital.php b/old_code_ci3/views/dashboard/opd_letter_head_print_agarwal_hospital.php
new file mode 100644
index 0000000..2ea9073
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_agarwal_hospital.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_bajaj_neuro.php b/old_code_ci3/views/dashboard/opd_letter_head_print_bajaj_neuro.php
new file mode 100644
index 0000000..976546f
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_bajaj_neuro.php
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Name : =$pName?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob. : =$phoneno?>
+ Add. : =$p_address?>
+
+
+ Sr No : =$opd_sr_no?>
+ UHID : =$uhid_no?>
+ OPD No. : =$opd_no?>
+ Date : =$opd_date?>
+ =$exp_date?>
+ OPD Fee : =$opd_fee?>
+
+
+ Dr. Ajay Bajaj / Dr Vibhu Shankar
+ MBBS,MS,MCh.(Neuro Surgery)
+ Senior Consultant Neuro Surgery
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_chamunda_hospital.php b/old_code_ci3/views/dashboard/opd_letter_head_print_chamunda_hospital.php
new file mode 100644
index 0000000..6109d11
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_chamunda_hospital.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_khrc.php b/old_code_ci3/views/dashboard/opd_letter_head_print_khrc.php
new file mode 100644
index 0000000..c354f39
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_khrc.php
@@ -0,0 +1,51 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?> =H_address_2?>
+
+ Email : '.H_Email;
+ }
+ ?>
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Not Valid for Medico legal Purpose / Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
+
BP : __________ Pulse Rate : __________ SPO2 : __________ Ht : __________ Wt.: __________ RBS : __________
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_mehrotra_hospital.php b/old_code_ci3/views/dashboard/opd_letter_head_print_mehrotra_hospital.php
new file mode 100644
index 0000000..6109d11
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_mehrotra_hospital.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_radiant.php b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant.php
new file mode 100644
index 0000000..43f4459
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant.php
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?> =H_address_2?>
+
+ Email : '.H_Email;
+ }
+ ?>
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+ Appointment Number : 8171010848
+
+
+
+
+
+
+Review after _______________ days
+
+Appointment Number : 8171010848 / Not Valid for Medico legal Purpose / Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
+
BP : __________ Pulse Rate : __________ SPO2 : __________ Ht : __________ Wt.: __________ RBS : __________
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam.php b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam.php
new file mode 100644
index 0000000..9e8d642
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam.php
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+ =strtoupper(H_Name)?>
+ OBSTETRICS, GYNECOLOGY AND FERTILITY CENTRE
+
+
+
+
+
+
+
+
+
+ Address : Near KVM School,
+ Mukhani Road, Haldwani, Uttarakhand
+
+ Phone No. : 05946-365929
+ Email : radianthospitalhaldwani@gmail.com
+
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+
+
+ OPD Timing : Morning 11.30am to 3.00pm | Evening 4.30pm to 7.00pm | Sunday:By Appointment only | Phone No.:05946-365929, 9760644918 | Valid for 7 days
+
+
+
+
+
+=$content?>
+
+
+
+
+
+
+
+
+ BP :
+
+
+ PR :
+
+
+ Weight :
+
+
+ LMP :
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam_1.php b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam_1.php
new file mode 100644
index 0000000..f0d809b
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam_1.php
@@ -0,0 +1,22 @@
+
+
+
+
+
+Not Valid for Medico legal Purpose / Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam_21052025.php b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam_21052025.php
new file mode 100644
index 0000000..574bd93
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpoonam_21052025.php
@@ -0,0 +1,168 @@
+
+
+
+
+
+
+
+
+
+ RADIANT FERTILITY AND IVF CENTRE
+ A Unit of Radiant Hospital
+
+
+
+
+
+
+
+
+
+ Address : Near KVM School,
+ Mukhani Road,
+ Haldwani, Uttarakhand
+
+ Phone No. : +91 8979565771
+ Email : radianthospitalhaldwani@gmail.com
+
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+
+
+ OPD Timing : 11am to 05pm | Sunday : By Appointment only | Phone No. : 8171010848 | Valid for 7 days
+
+
+ Not Valid for Medico legal Purpose
+
+
+
+
+=$content?>
+
+
+
+
+
+
+
+
+ BP :
+
+
+ PR :
+
+
+ Weight :
+
+
+ LMP :
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpuneet.php b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpuneet.php
new file mode 100644
index 0000000..f118265
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drpuneet.php
@@ -0,0 +1,164 @@
+
+
+
+
+
+
+
+
+
+ =strtoupper(H_Name)?>
+ NEURO-BRAIN & SPINE CENTRE
+
+
+
+
+
+
+
+
+
+ Address : Near KVM School,
+ Mukhani Road, Haldwani
+
+
+ Phone No. : 7817844055, 9068429666, 05946-365929
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+
+
+ OPD Timing : 10AM to 5PM | Sunday OPD by Appointment only
+
+
+ Not Valid for Medico legal Purpose
+
+
+
+
+=$content_2?>
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drvk blank.php b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drvk blank.php
new file mode 100644
index 0000000..fc607ca
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drvk blank.php
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+=$content?>
+
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drvk.php b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drvk.php
new file mode 100644
index 0000000..7505c08
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_radiant_drvk.php
@@ -0,0 +1,54 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?> =H_address_2?>
+
+ Email : '.H_Email;
+ }
+ ?>
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+ FOR APPOINTMENT MOB - 7466985557
+
+
+
+
+
+
+Not Valid for Medico legal Purpose / Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
+
BP : __________ Pulse Rate : __________ SPO2 : __________ Ht : __________ Wt.: __________ RBS : __________
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_ssc.php b/old_code_ci3/views/dashboard/opd_letter_head_print_ssc.php
new file mode 100644
index 0000000..60d7d9a
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_ssc.php
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+=$content_4?>
+
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_print_vedanta_hospital.php b/old_code_ci3/views/dashboard/opd_letter_head_print_vedanta_hospital.php
new file mode 100644
index 0000000..6109d11
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_print_vedanta_hospital.php
@@ -0,0 +1,44 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_singhal_drparul.php b/old_code_ci3/views/dashboard/opd_letter_head_singhal_drparul.php
new file mode 100644
index 0000000..2b7e06c
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_singhal_drparul.php
@@ -0,0 +1,59 @@
+
+
+
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+ SINGHAL CLINIC
+ ENDO-NEURO CENTER
+
+
+
+
+ Formerly at:
+ MAMC & LNJP Hospital, Delhi
+ UCMS & GTB Hospital, Delhi
+ AIIMS New Delhi
+ AIIMS Jodhpur
+
+
+
+
+
+
+
+ Singhal Clinic & Endo-Neuro Center
+ Cheema Chauraha, Behind Spectrum Mall, Ramnagar Road, Kashipur - 244713
+ Contact : 9045424198,05947-274865, 7017369216
+ Monday to Friday : 11 A.M. - 3 P.M. And 6 P.M. - 8 P.M.
+ Saturday : 11 A.M. - 3 P.M.
+ Saturday evening & Sunday closed
+ website : www.singhalclinickashipur.in
+
+
+=$content?>
diff --git a/old_code_ci3/views/dashboard/opd_letter_head_singhal_drrahul.php b/old_code_ci3/views/dashboard/opd_letter_head_singhal_drrahul.php
new file mode 100644
index 0000000..4686a72
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_letter_head_singhal_drrahul.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+ SINGHAL CLINIC
+ ENDO-NEURO CENTER
+
+
+
+
+ Formerly at:
+ GB Pant Hospital, Delhi
+ IHBAS Hospital, Delhi
+ AIIMS, New Delhi
+
+
+
+
+
+
+
+ Singhal Clinic & Endo-Neuro Center
+ Cheema Chauraha, Behind Spectrum Mall, Ramnagar Road, Kashipur - 244713
+ Contact : 05947-274865, 7017369216 / Time : 6 P.M. - 8 P.M. Monday to Friday
+ website : www.singhalclinickashipur.in
+
+
+=$content?>
diff --git a/old_code_ci3/views/dashboard/opd_line_list.php b/old_code_ci3/views/dashboard/opd_line_list.php
new file mode 100644
index 0000000..b697d04
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_line_list.php
@@ -0,0 +1,48 @@
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+
+ =$row_item->p_code?>
+
+
+ =$row_item->p_fname?>
+
+
+ =$row_item->opd_code?>
+
+
+ =$row_item->opd_book_date?>
+
+
+ =$row_item->apointment_date?>
+
+
+ Dr. =$row_item->doc_name?>
+
+
+ =$row_item->doc_spec?>
+
+
+ Print OPD
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_list_doc.php b/old_code_ci3/views/dashboard/opd_list_doc.php
new file mode 100644
index 0000000..4294774
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_list_doc.php
@@ -0,0 +1,194 @@
+ 'form', 'class' => 'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+ = $tab0 ?>
+
+
+ = $tab1 ?>
+
+
+ = $tab2 ?>
+
+
+ = $tab3 ?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_medical_bill.php b/old_code_ci3/views/dashboard/opd_medical_bill.php
new file mode 100644
index 0000000..3e4108e
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_medical_bill.php
@@ -0,0 +1,40 @@
+
+id
+ ORDER BY t.id ";
+ $query = $this->db->query($sql);
+ $medical_store_item= $query->result();
+?>
+
+
+
+
+
+
+
+
+ =$row_item->item_Name?>
+
+
+ =$row_item->formulation?>
+
+
+ =$row_item->qty?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_parcha_ent_care.php b/old_code_ci3/views/dashboard/opd_parcha_ent_care.php
new file mode 100644
index 0000000..917425d
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_parcha_ent_care.php
@@ -0,0 +1,85 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+ =$opd_date?>
+
+
+ PID: =$uhid_no?>
+ Ph.: =$phoneno?>
+ FEE: =$opd_fee?>
+ Visit: =$total_no_visit?>
+ =$exp_date?>
+ Pr.T: =date('d-m-Y H:i')?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_parcha_radiant.php b/old_code_ci3/views/dashboard/opd_parcha_radiant.php
new file mode 100644
index 0000000..00ca00a
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_parcha_radiant.php
@@ -0,0 +1,85 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+ =$opd_date?>
+
+
+ PID: =$uhid_no?>
+ Ph.: =$phoneno?>
+ FEE: =$opd_fee?>
+ Visit: =$total_no_visit?>
+ =$exp_date?>
+ Pr.T: =date('d-m-Y H:i')?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_prescribed_advice.php b/old_code_ci3/views/dashboard/opd_prescribed_advice.php
new file mode 100644
index 0000000..ce3183d
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescribed_advice.php
@@ -0,0 +1,13 @@
+0){
+ echo '
';
+ foreach($opd_patient_advice as $row)
+ {
+ echo '';
+ echo ''.$row->advice_txt.' '.$row->advice_txt_hindi.' Del ';
+ echo ' ';
+ }
+
+ echo '
';
+ }
+?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescribed_dose.php b/old_code_ci3/views/dashboard/opd_prescribed_dose.php
new file mode 100644
index 0000000..b958eb8
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescribed_dose.php
@@ -0,0 +1,563 @@
+'form','class'=>'form2','autocomplete'=>'on')); ?>
+
+
+
+
+
+
+
+ 0)
+ { echo '
+ Type
+ Prescribed
+ Dosage
+ Remarks
+
+
+ '; } ?>
+
+
+ =$row->med_type?>
+ =$row->med_name?>
+ =$row->dose_shed?>
+ =$row->dose_when?>
+ =$row->dose_frequency?> =$row->dose_where?>
+ =$row->qty?> =$row->no_of_days?> =$row->remark?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ =$advice_given?>
+
+
+
+
+
+
+ = $row->next_visit_day ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0){
+ echo '
';
+ foreach($opd_advise as $row)
+ {
+ echo '';
+ echo ''.$row->advice.' +Add ';
+ echo ' ';
+ }
+ echo '
';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_med_list.php b/old_code_ci3/views/dashboard/opd_prescription_med_list.php
new file mode 100644
index 0000000..f7a58f2
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_med_list.php
@@ -0,0 +1,29 @@
+
+
+0)
+ { echo '
+ Type
+ Prescribed
+ Dosage
+ Remarks
+
+
+ '; } ?>
+
+
+ =$row->med_type?>
+ =$row->med_name?>
+ =$row->dose_shed?>
+ =$row->dose_when?>
+ =$row->dose_frequency?> =$row->dose_where?>
+ =$row->qty?>=$row->no_of_days?>=$row->remark?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_print.php b/old_code_ci3/views/dashboard/opd_prescription_print.php
new file mode 100644
index 0000000..20543ca
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_print.php
@@ -0,0 +1,87 @@
+
+
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, Uttarakhand
+ ';
+ ?>
+
+
+
+
+
+
+
+
+ Page : {PAGENO}/{nbpg}
+
+
+
+
+
+
+
+
+ Rx
+ ';
+ echo $Complaint;
+ echo ' ';
+ echo $diagnosis;
+ echo ' ';
+ echo $investigation;
+ echo ' ';
+ echo $medical;
+ echo ' ';
+ echo $doctor;
+ echo ' ';
+
+ ?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/opd_medicine_edit.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/opd_medicine_edit.php
new file mode 100644
index 0000000..3034950
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/opd_medicine_edit.php
@@ -0,0 +1,127 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/opd_medicine_panel.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/opd_medicine_panel.php
new file mode 100644
index 0000000..f6d84c6
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/opd_medicine_panel.php
@@ -0,0 +1,175 @@
+ 'form', 'class' => 'form2')); ?>
+
+
+
+
+
+
+
+ 0) {
+ echo '
+ Type
+ Prescribed
+ Dosage
+ Remarks
+
+ ';
+ } ?>
+
+
+ = $row->formulation ?>
+ = $row->item_name ?>
+ = $row->dose_shed ?>
+ = $row->dose_when ?>
+ = $row->dose_frequency ?> = $row->dose_where ?>
+ = $row->qty ?> = $row->no_of_days ?> = $row->remark ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_list.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_list.php
new file mode 100644
index 0000000..026e5ea
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_list.php
@@ -0,0 +1,31 @@
+
+id % count($Color)) ;
+ ?>
+
+
+ =$row->rx_group_name?>
+
+
+
+ Toggle Dropdown
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_medicine.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_medicine.php
new file mode 100644
index 0000000..3d2ca5e
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_medicine.php
@@ -0,0 +1,303 @@
+'form','class'=>'form2')); ?>
+
+
+
+
+
+
+ 0)
+ { echo '
+ Type
+ Prescribed
+ Dosage
+ Remarks
+
+ '; } ?>
+
+
+
+ =$row->med_type?>
+ =$row->med_name?>
+ =$row->dose_shed?>
+ =$row->dose_when?>
+ =$row->dose_frequency?> =$row->dose_where?>
+ =$row->qty?> =$row->no_of_days?> =$row->remark?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_medicine_list.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_medicine_list.php
new file mode 100644
index 0000000..5c6cae8
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_medicine_list.php
@@ -0,0 +1,26 @@
+
+
+ 0)
+ { echo '
+ Type
+ Prescribed
+ Dosage
+ Remarks
+
+ '; } ?>
+
+
+ =$row->med_type?>
+ =$row->med_name?>
+ =$row->dose_shed?>
+ =$row->dose_when?>
+ =$row->dose_frequency?> =$row->dose_where?>
+ =$row->qty?> =$row->no_of_days?> =$row->remark?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_new.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_new.php
new file mode 100644
index 0000000..ba16e88
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_new.php
@@ -0,0 +1,60 @@
+'form','class'=>'form2')); ?>
+
+
+
+
+
+
+
+ Finding Examinations
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_patient.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_patient.php
new file mode 100644
index 0000000..8a0a2f5
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_patient.php
@@ -0,0 +1,12 @@
+id % count($Color)) ;
+ ?>
+
+ =$row->rx_group_name?>
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_save.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_save.php
new file mode 100644
index 0000000..f160c84
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_save.php
@@ -0,0 +1,34 @@
+
+
+
+ New Rx-Group Name
+
+
+
+
+
+
+ Save New Rx-Group
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_show.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_show.php
new file mode 100644
index 0000000..27f8f17
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_group_show.php
@@ -0,0 +1,80 @@
+'form','class'=>'form2')); ?>
+
+
+
+
+
+
+
+ Finding Examinations
+
+
+
+
+
+
+ Save Rx-Group
+ Save AS New Rx-Group
+ Add & Edit Medicine
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_patient_old_medicine.php b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_patient_old_medicine.php
new file mode 100644
index 0000000..48d7542
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prescription_suggest_panel/rx_patient_old_medicine.php
@@ -0,0 +1,163 @@
+opd_id";
+ $query = $this->db->query($sql);
+ $opd_data= $query->result();
+
+ ?>
+
+ OPD Date :'.MysqlDate_to_str($row->apointment_date).'
';
+
+ if(count($opd_data)>0)
+ {
+
+ $sql="SELECT pt.* ,d.dose_show_sign AS dose_shed,dw.dose_sign_desc AS dose_when,
+ df.dose_sign_desc AS dose_frequency,d_on.dose_sign_desc AS dose_where
+ FROM (((opd_prescrption_prescribed pt
+ LEFT JOIN opd_dose_shed d ON pt.dosage=d.dose_shed_id)
+ LEFT JOIN opd_dose_when dw ON pt.dosage_when=dw.dose_when_id)
+ LEFT JOIN opd_dose_frequency df ON pt.dosage_freq=df.dose_freq_id)
+ LEFT JOIN opd_dose_where d_on ON pt.dosage_where=d_on.dose_where_id
+ where pt.opd_pre_id=".$opd_data[0]->id;
+ $query = $this->db->query($sql);
+ $opd_prescribed= $query->result();
+
+
+ if($opd_data[0]->bp!='')
+ {
+ $opd_details_str.= '
BP : '.$opd_data[0]->bp.' ';
+ }
+
+ if($opd_data[0]->diastolic!='')
+ {
+ $opd_details_str.= '
Diastolic : '.$opd_data[0]->diastolic.' ';
+ }
+
+ if($opd_data[0]->pulse!='')
+ {
+ $opd_details_str.= '
Pulse : '.$opd_data[0]->pulse.' ';
+ }
+
+ if($opd_data[0]->temp!='')
+ {
+ $opd_details_str.= '
Temp. : '.$opd_data[0]->temp.' ';
+ }
+
+ $Complaint="";
+
+ if($opd_data[0]->complaints!='')
+ {
+ $Complaint="
Complaint : ";
+ $Complaint.=''.$opd_data[0]->complaints.'';
+ }
+
+ $diagnosis="";
+
+ if($opd_data[0]->diagnosis!='')
+ {
+ $diagnosis="
Diagnosis : ";
+ $diagnosis.=' '.$opd_data[0]->diagnosis.'';
+
+ }
+
+ $investigation="";
+ if($opd_data[0]->investigation!='')
+ {
+ $investigation="
Investigation Advised : ";
+ $investigation.=' '.$opd_data[0]->investigation.'';
+ }
+
+ $opd_details_str.=$Complaint.$diagnosis.$investigation;
+
+ //New Start
+
+ if(count($opd_prescribed)>0)
+ {
+ $medical="";
+ $sr_no=1;
+ $medical.= '
+
";
+ $opd_details_str.=$medical;
+ }
+
+ $advice="";
+
+ if($opd_data[0]->advice!='')
+ {
+ $advice="
Advice : ";
+ $advice.=''.$opd_data[0]->advice.'';
+ }
+
+ $opd_details_str.=$advice;
+
+ $next_visit="";
+
+ if($opd_data[0]->next_visit!='')
+ {
+ $next_visit="
Next Visit : ";
+ $next_visit.=''.$opd_data[0]->next_visit.'';
+ }
+
+ $opd_details_str.=$next_visit;
+
+ $refer_to="";
+
+ if($opd_data[0]->refer_to!='')
+ {
+ $refer_to="
Refer To : ";
+ $refer_to.=''.$opd_data[0]->refer_to.'';
+ }
+
+ $opd_details_str.=$refer_to;
+ //New End
+ }
+ ?>
+
+
+
=$opd_details_str?>
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_prev.php b/old_code_ci3/views/dashboard/opd_prev.php
new file mode 100644
index 0000000..048ca2b
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_prev.php
@@ -0,0 +1,93 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ =$investigation?>
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha.php b/old_code_ci3/views/dashboard/opd_print_parcha.php
new file mode 100644
index 0000000..258cc7b
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha.php
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_2 copy.php b/old_code_ci3/views/dashboard/opd_print_parcha_2 copy.php
new file mode 100644
index 0000000..4e90ce4
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_2 copy.php
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?> P.T.O.
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_2.php b/old_code_ci3/views/dashboard/opd_print_parcha_2.php
new file mode 100644
index 0000000..4e90ce4
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_2.php
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?> P.T.O.
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_3.php b/old_code_ci3/views/dashboard/opd_print_parcha_3.php
new file mode 100644
index 0000000..375c3b3
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_3.php
@@ -0,0 +1,21 @@
+
+
+
+CIN No. U74999UR2018PTC008810 [Chaumu Healthcare Private Limited]
+
+
+Print Time : =date('d-m-Y H:i:s')?> P.T.O.
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_4.php b/old_code_ci3/views/dashboard/opd_print_parcha_4.php
new file mode 100644
index 0000000..44c92ae
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_4.php
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_Mehrotra_DrAseemMehrotra.php b/old_code_ci3/views/dashboard/opd_print_parcha_Mehrotra_DrAseemMehrotra.php
new file mode 100644
index 0000000..8fca07d
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_Mehrotra_DrAseemMehrotra.php
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_Mehrotra_hospital.php b/old_code_ci3/views/dashboard/opd_print_parcha_Mehrotra_hospital.php
new file mode 100644
index 0000000..b746f0f
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_Mehrotra_hospital.php
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp.php b/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp.php
new file mode 100644
index 0000000..c9acdbd
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp.php
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp_new.php b/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp_new.php
new file mode 100644
index 0000000..6caa127
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp_new.php
@@ -0,0 +1,93 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+
+ =$opd_date?>
+
+
+ Sr.No. : =$opd_sr_no?> OPD Fee : =$opd_fee?> =$exp_date?>
+ OPD ID : =$opd_no?> UHID : =$uhid_no?>
+
+
+ =$p_address?>
+
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp_ss.php b/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp_ss.php
new file mode 100644
index 0000000..c4e8ec2
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_agarwal_hospital_ksp_ss.php
@@ -0,0 +1,97 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+
+ =$opd_date?>
+
+
+ Sr.No. : =$opd_sr_no?> OPD Fee : =$opd_fee?> =$exp_date?>
+ OPD ID : =$opd_no?> UHID : =$uhid_no?>
+ =$doc_info?>
+
+
+ =$p_address?>
+
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_ah.php b/old_code_ci3/views/dashboard/opd_print_parcha_ah.php
new file mode 100644
index 0000000..34da663
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_ah.php
@@ -0,0 +1,20 @@
+
+
+
+
+
+
+=$content_4?>
+
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_bajaj.php b/old_code_ci3/views/dashboard/opd_print_parcha_bajaj.php
new file mode 100644
index 0000000..85dc78f
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_bajaj.php
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+ =$content_3?>
+
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_bajaj_blank.php b/old_code_ci3/views/dashboard/opd_print_parcha_bajaj_blank.php
new file mode 100644
index 0000000..6733d88
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_bajaj_blank.php
@@ -0,0 +1,35 @@
+
+
+
+
+
+
+
+
+
+ =$content?>
+
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_chamunda_hospital_ksp.php b/old_code_ci3/views/dashboard/opd_print_parcha_chamunda_hospital_ksp.php
new file mode 100644
index 0000000..2cfdf9e
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_chamunda_hospital_ksp.php
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_drAnkurChauhan.php b/old_code_ci3/views/dashboard/opd_print_parcha_drAnkurChauhan.php
new file mode 100644
index 0000000..45af032
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_drAnkurChauhan.php
@@ -0,0 +1,97 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+ OPD ID : =$opd_no?> / UHID : =$uhid_no?>
+
+
+ =$opd_date?>
+
+
+ Sr.No. : =$opd_sr_no?> OPD Fee : =$opd_fee?> =$exp_date?>
+
+
+ =$p_address?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_radiant.php b/old_code_ci3/views/dashboard/opd_print_parcha_radiant.php
new file mode 100644
index 0000000..0538295
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_radiant.php
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+Review after _______________ days / Appointment Number : 8171010848
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_radiant_drpoonam.php b/old_code_ci3/views/dashboard/opd_print_parcha_radiant_drpoonam.php
new file mode 100644
index 0000000..8514eb3
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_radiant_drpoonam.php
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_singhal.php b/old_code_ci3/views/dashboard/opd_print_parcha_singhal.php
new file mode 100644
index 0000000..2532c6e
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_singhal.php
@@ -0,0 +1,21 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_print_parcha_vedanta_hospital_ksp.php b/old_code_ci3/views/dashboard/opd_print_parcha_vedanta_hospital_ksp.php
new file mode 100644
index 0000000..2cfdf9e
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_print_parcha_vedanta_hospital_ksp.php
@@ -0,0 +1,47 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_queue_status.php b/old_code_ci3/views/dashboard/opd_queue_status.php
new file mode 100644
index 0000000..1ac0112
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_queue_status.php
@@ -0,0 +1,41 @@
+
+
+
+
+
+
+
Dr. =$doc_master[0]->p_fname?>
+
=$doc_master[0]->Spec?>
+
+
Refresh
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/opd_queue_status_tab_0.php b/old_code_ci3/views/dashboard/opd_queue_status_tab_0.php
new file mode 100644
index 0000000..834c2d0
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_queue_status_tab_0.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+
+ Patient Name
+ OPD No.
+ Booking No.
+ UHID
+ OPD ID.
+ OPD Type
+ Action
+
+
+
+
+
+ =$row->P_name?>
+ =$row->opd_id?>
+ =$row->opd_no?>
+ =$row->p_code?>
+ =$row->opd_code?>
+ =$row->Paymode?>
+
+ payment_status==1) { ?>
+ Queue
+ Cancel OPD
+
+ Go For Payment
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_queue_status_tab_1.php b/old_code_ci3/views/dashboard/opd_queue_status_tab_1.php
new file mode 100644
index 0000000..1dc0445
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_queue_status_tab_1.php
@@ -0,0 +1,71 @@
+
+
diff --git a/old_code_ci3/views/dashboard/opd_queue_status_tab_2.php b/old_code_ci3/views/dashboard/opd_queue_status_tab_2.php
new file mode 100644
index 0000000..3368e0c
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_queue_status_tab_2.php
@@ -0,0 +1,38 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_queue_status_tab_3.php b/old_code_ci3/views/dashboard/opd_queue_status_tab_3.php
new file mode 100644
index 0000000..6c03a43
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_queue_status_tab_3.php
@@ -0,0 +1,37 @@
+
+
+
+
+
+
+
+ =$row->opd_id?>
+ =$row->opd_code?>
+ =$row->P_name?> { =$row->p_rname?> }
+ =$row->queue_no?>
+ =$row->p_code?>
+ =$row->opd_fee_desc?>/ Amt.:=$row->opd_fee_amount?>
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_queue_status_total.php b/old_code_ci3/views/dashboard/opd_queue_status_total.php
new file mode 100644
index 0000000..ede6ad8
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_queue_status_total.php
@@ -0,0 +1,5 @@
+
On Waiting :=$doc_master[0]->count_wait?>
+
No. of Visited :=$doc_master[0]->count_visit?>
+
Canceled :=$doc_master[0]->count_cancel?>
+
Total : =$doc_master[0]->No_opd?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/opd_scan.php b/old_code_ci3/views/dashboard/opd_scan.php
new file mode 100644
index 0000000..1d70208
--- /dev/null
+++ b/old_code_ci3/views/dashboard/opd_scan.php
@@ -0,0 +1,26 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/patient_glucose_data.php b/old_code_ci3/views/dashboard/patient_glucose_data.php
new file mode 100644
index 0000000..9c0e555
--- /dev/null
+++ b/old_code_ci3/views/dashboard/patient_glucose_data.php
@@ -0,0 +1,222 @@
+
+
+
+
+
+
+
+
+ 'form','class'=>'form_g')); ?>
+
+
+
+
+ Glucose Test
+
+ Fasting
+ After Food
+ Random
+
+
+
+
+
+ Add Data
+
+
+
+
+
+
+ Date
+ Fast Glucose
+ After Food Glucose
+ Random Glucose
+ Remove
+
+
+
+ =$row->test_date?>
+ =$row->r_sugar?>
+ =$row->f_sugar?>
+ =$row->a_sugar?>
+ Delete
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/patient_investigation.php b/old_code_ci3/views/dashboard/patient_investigation.php
new file mode 100644
index 0000000..53651b9
--- /dev/null
+++ b/old_code_ci3/views/dashboard/patient_investigation.php
@@ -0,0 +1,122 @@
+
+
+
+
+
+
+ 'form','class'=>'form_investigation')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Date
+ Investigation
+ Value
+ Normal Range
+ Result
+ Remove
+
+
+
+ =$row->date_investigation?>
+ =$row->investigation_name?>
+ =$row->result?>
+ =$row->normal_range?>
+ =$row->result_text?>
+ Delete
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/patient_remark.php b/old_code_ci3/views/dashboard/patient_remark.php
new file mode 100644
index 0000000..0aa4e78
--- /dev/null
+++ b/old_code_ci3/views/dashboard/patient_remark.php
@@ -0,0 +1,158 @@
+
+
+
+
+
+
+
+
+
+
Write By =$row->insert_by?>
+ Date : : =$row->ins_time?>
+
=nl2br($row->remark) ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Patient Personal Remark
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/dashboard/person_profile_photo_from_doctor.php b/old_code_ci3/views/dashboard/person_profile_photo_from_doctor.php
new file mode 100644
index 0000000..2ce3058
--- /dev/null
+++ b/old_code_ci3/views/dashboard/person_profile_photo_from_doctor.php
@@ -0,0 +1,99 @@
+
+
+
+
+
+
+
+
+
+
+
+
Your captured image will appear here...
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_group.php b/old_code_ci3/views/dashboard/rx_group.php
new file mode 100644
index 0000000..c1fff91
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_group.php
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+ Rx-Group Name
+ Action
+
+
+
+
+
+ = $row->rx_group_name ?>
+
+ Edit
+
+
+
+
+
+
+ Rx-Group Name
+ Action
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_group_list.php b/old_code_ci3/views/dashboard/rx_group_list.php
new file mode 100644
index 0000000..3a04733
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_group_list.php
@@ -0,0 +1,27 @@
+
+
+
+ Rx-Group Name
+ Action
+
+
+
+
+
+ =$row->rx_group_name ?>
+
+ Edit
+
+
+
+
+
+
+ Rx-Group Name
+ Action
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_chamunda_plain_paper.php b/old_code_ci3/views/dashboard/rx_print_chamunda_plain_paper.php
new file mode 100644
index 0000000..4228b70
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_chamunda_plain_paper.php
@@ -0,0 +1,172 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ An ISO Certified 9001 : 2015
+ NABH (Fully Accredited) Hospital
+
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+ ';
+ if(strlen($vital_content)>0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($painscale)>0){
+ echo $painscale;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ if(strlen($morbidities)>0){
+ echo 'Co-Morbidities : '.$morbidities;
+ echo ' ';
+ }
+
+ if(strlen($Addiction)>0){
+ echo 'Addiction : '.$Addiction;
+ echo ' ';
+ }
+
+ if(strlen($Complication)>0){
+ echo 'Complication : '.$Complication;
+ echo ' ';
+ }
+
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_chamunda_pre_print_letter_head_format.php b/old_code_ci3/views/dashboard/rx_print_chamunda_pre_print_letter_head_format.php
new file mode 100644
index 0000000..ea2b366
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_chamunda_pre_print_letter_head_format.php
@@ -0,0 +1,120 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+ ';
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($painscale)>0){
+ echo $painscale;
+ echo ' ';
+ }
+
+ if(strlen($vital_content)>0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ if(strlen($morbidities)>0){
+ echo 'Co-Morbidities : '.$morbidities;
+ echo ' ';
+ }
+
+ if(strlen($Addiction)>0){
+ echo 'Addiction : '.$Addiction;
+ echo ' ';
+ }
+
+ if(strlen($Complication)>0){
+ echo 'Complication : '.$Complication;
+ echo ' ';
+ }
+
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_chamunda_rx_blank_letter_head.php b/old_code_ci3/views/dashboard/rx_print_chamunda_rx_blank_letter_head.php
new file mode 100644
index 0000000..ae5bac8
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_chamunda_rx_blank_letter_head.php
@@ -0,0 +1,150 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+
+
+
+ ';
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($vital_content)>0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($painscale)>0){
+ echo $painscale;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ if(strlen($morbidities)>0){
+ echo 'Co-Morbidities : '.$morbidities;
+ echo ' ';
+ }
+
+ if(strlen($Addiction)>0){
+ echo 'Addiction : '.$Addiction;
+ echo ' ';
+ }
+
+ if(strlen($Complication)>0){
+ echo 'Complication : '.$Complication;
+ echo ' ';
+ }
+
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_devbhumi_plain.php b/old_code_ci3/views/dashboard/rx_print_devbhumi_plain.php
new file mode 100644
index 0000000..7a9cd00
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_devbhumi_plain.php
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_drJoshiclinic_letterhead - Copy.php b/old_code_ci3/views/dashboard/rx_print_drJoshiclinic_letterhead - Copy.php
new file mode 100644
index 0000000..a9da963
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_drJoshiclinic_letterhead - Copy.php
@@ -0,0 +1,65 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+ ';
+ echo $Complaint;
+ echo ' ';
+ echo $Provisional_diagnosis;
+ echo ' ';
+ echo $diagnosis;
+ echo ' ';
+ echo $medical;
+ echo ' ';
+ echo $investigation;
+ echo ' ';
+ echo $advice;
+ echo ' ';
+ echo $next_visit;
+ echo ' ';
+ echo $refer_to;
+ echo ' ';
+ echo $doctor;
+ echo ' ';
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_drJoshiclinic_letterhead.php b/old_code_ci3/views/dashboard/rx_print_drJoshiclinic_letterhead.php
new file mode 100644
index 0000000..61a3ab6
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_drJoshiclinic_letterhead.php
@@ -0,0 +1,75 @@
+
+
+
+
+
+
+
+
+
+ ';
+ echo $Complaint;
+ echo '
';
+ echo $Finding_Examinations;
+ echo '
';
+ echo $Provisional_diagnosis;
+ echo '
';
+ echo $diagnosis;
+ echo '
';
+ echo $medical;
+ echo '
';
+ echo $investigation;
+ echo '
';
+ echo $advice;
+ echo '
';
+ echo $next_visit;
+ echo '
';
+ echo $refer_to;
+ echo '
';
+ echo '
';
+
+ echo '
';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$doc_name.' ';
+ echo ' ';
+ echo $doc_sign;
+ echo '
';
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_plain_paper.php b/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_plain_paper.php
new file mode 100644
index 0000000..8d3d290
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_plain_paper.php
@@ -0,0 +1,162 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo '
';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo '
';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo '
';
+ }
+
+ if(strlen($Provisional_diagnosis)>0){
+ echo $Provisional_diagnosis;
+ echo '
';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo '
';
+ }
+
+ echo $medical;
+ echo '
';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo '
';
+ }
+
+
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo '
';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo '
';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo '
';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo '
';
+ }
+ echo '
';
+
+ //echo $doctor;
+
+ echo '
';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$doc_name.' ';
+ echo ' ';
+ echo $doc_sign;
+ echo '
';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_pre_print_letter_head_format.php b/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_pre_print_letter_head_format.php
new file mode 100644
index 0000000..c327d2e
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_pre_print_letter_head_format.php
@@ -0,0 +1,114 @@
+
+
+
+
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo '
';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo '
';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo '
';
+ }
+
+ if(strlen($Provisional_diagnosis)>0){
+ echo $Provisional_diagnosis;
+ echo '
';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo '
';
+ }
+
+ echo $medical;
+ echo '
';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo '
';
+ }
+
+
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo '
';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo '
';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo '
';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo '
';
+ }
+ echo '
';
+
+ //echo $doctor;
+echo '
';
+
+ echo '
';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$doc_name.' ';
+ echo ' ';
+ echo $doc_sign;
+ echo '
';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_rx_blank_letter_head.php b/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_rx_blank_letter_head.php
new file mode 100644
index 0000000..77e606b
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_drjoshiclinic_rx_blank_letter_head.php
@@ -0,0 +1,143 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ Name : = strtoupper($pName) ?>
+ = $pRelative ?>
+ Gender/Age : = $age_sex ?>
+ Mob := $phoneno ?>'
+ Address := $p_address ?>'
+
+
+ UHID : = $uhid_no ?>
+ Sr No.: = $opd_sr_no ?>
+ OPD No.: = $opd_no ?>
+ Date: = $opd_date ?> = $exp_date ?>
+
+
+ DEPARTMENT :
+ = $SpecName ?>
+
+ = $opd_fee_desc ?>
+ No. of Visit : = $total_no_visit ?>
+ = $last_opdvisit_date ?>
+ Book Time : = $str_opd_book_date ?>
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo '
';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo '
';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo '
';
+ }
+
+ if(strlen($Provisional_diagnosis)>0){
+ echo $Provisional_diagnosis;
+ echo '
';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo '
';
+ }
+
+ echo $medical;
+ echo '
';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo '
';
+ }
+
+
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo '
';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo '
';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo '
';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo '
';
+ }
+ echo '
';
+
+ //echo $doctor;
+echo '
';
+
+ echo '
';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$doc_name.' ';
+ echo ' ';
+ echo $doc_sign;
+ echo '
';
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_letterhead_drbcjoshi.php b/old_code_ci3/views/dashboard/rx_print_letterhead_drbcjoshi.php
new file mode 100644
index 0000000..1278fa5
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_letterhead_drbcjoshi.php
@@ -0,0 +1,102 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($Provisional_diagnosis)>0){
+ echo $Provisional_diagnosis;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+ echo $doctor;
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_letterhead_singhal.php b/old_code_ci3/views/dashboard/rx_print_letterhead_singhal.php
new file mode 100644
index 0000000..65038bc
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_letterhead_singhal.php
@@ -0,0 +1,64 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+=$content?>
+
+ ';
+ echo $Complaint;
+ echo $diagnosis;
+ echo ' ';
+ echo $medical;
+ echo ' ';
+ echo $investigation;
+ echo ' ';
+ echo $advice;
+ echo ' ';
+ echo $next_visit;
+ echo ' ';
+ echo $refer_to;
+ echo ' ';
+ echo $doctor;
+ echo ' ';
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_mehrotra_aseem_blank_letter_head.php b/old_code_ci3/views/dashboard/rx_print_mehrotra_aseem_blank_letter_head.php
new file mode 100644
index 0000000..44480e0
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_mehrotra_aseem_blank_letter_head.php
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_mehrotra_aseem_pre_print_letter_head_format.php b/old_code_ci3/views/dashboard/rx_print_mehrotra_aseem_pre_print_letter_head_format.php
new file mode 100644
index 0000000..034d74b
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_mehrotra_aseem_pre_print_letter_head_format.php
@@ -0,0 +1,98 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_mehrotra_plain_paper.php b/old_code_ci3/views/dashboard/rx_print_mehrotra_plain_paper.php
new file mode 100644
index 0000000..7a9cd00
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_mehrotra_plain_paper.php
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_mehrotra_pre_print_letter_head_format.php b/old_code_ci3/views/dashboard/rx_print_mehrotra_pre_print_letter_head_format.php
new file mode 100644
index 0000000..eb9a851
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_mehrotra_pre_print_letter_head_format.php
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_mehrotra_rx_blank_letter_head..php b/old_code_ci3/views/dashboard/rx_print_mehrotra_rx_blank_letter_head..php
new file mode 100644
index 0000000..3f803d0
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_mehrotra_rx_blank_letter_head..php
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_sahara_plain_paper.php b/old_code_ci3/views/dashboard/rx_print_sahara_plain_paper.php
new file mode 100644
index 0000000..d4bca80
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_sahara_plain_paper.php
@@ -0,0 +1,90 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/rx_print_singhal_plain_paper.php b/old_code_ci3/views/dashboard/rx_print_singhal_plain_paper.php
new file mode 100644
index 0000000..bcb0941
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_singhal_plain_paper.php
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+ echo $doctor;
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_singhal_pre_print_letter_head_format.php b/old_code_ci3/views/dashboard/rx_print_singhal_pre_print_letter_head_format.php
new file mode 100644
index 0000000..370f9cd
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_singhal_pre_print_letter_head_format.php
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+ echo $doctor;
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_singhal_rx_blank_letter_head.php b/old_code_ci3/views/dashboard/rx_print_singhal_rx_blank_letter_head.php
new file mode 100644
index 0000000..d6dc329
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_singhal_rx_blank_letter_head.php
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+ echo $doctor;
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_svh_plain_paper.php b/old_code_ci3/views/dashboard/rx_print_svh_plain_paper.php
new file mode 100644
index 0000000..6eb400d
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_svh_plain_paper.php
@@ -0,0 +1,152 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+ ';
+ if(strlen($vital_content)>0){
+ echo $vital_content;
+ echo '
';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo '
';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo '
';
+ }
+
+ echo $medical;
+ echo '
';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo '
';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo '
';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo '
';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo '
';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo '
';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo '
';
+ }
+
+ echo '
';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$doc_name.' ';
+ echo ' ';
+ echo $doc_sign;
+ echo '
';
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_svh_pre_print_letter_head_format.php b/old_code_ci3/views/dashboard/rx_print_svh_pre_print_letter_head_format.php
new file mode 100644
index 0000000..3409f87
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_svh_pre_print_letter_head_format.php
@@ -0,0 +1,104 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+ 0){
+ echo $Complaint;
+ echo '
';
+ }
+
+ if(strlen($vital_content)>0){
+ echo $vital_content;
+ echo '
';
+ }
+
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo '
';
+ }
+
+ echo $medical;
+ echo '
';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo '
';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo '
';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo '
';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo '
';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo '
';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo '
';
+ }
+ echo '
';
+
+
+ echo '
';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$doc_name.' ';
+ echo ' ';
+ echo $doc_sign;
+ echo '
';
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_svh_rx_blank_letter_head.php b/old_code_ci3/views/dashboard/rx_print_svh_rx_blank_letter_head.php
new file mode 100644
index 0000000..d5c6051
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_svh_rx_blank_letter_head.php
@@ -0,0 +1,131 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+
+ 0){
+ echo $Complaint;
+ echo '
';
+ }
+
+ if(strlen($vital_content)>0){
+ echo $vital_content;
+ echo '
';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo '
';
+ }
+
+ echo $medical;
+ echo '
';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo '
';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo '
';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo '
';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo '
';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo '
';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo '
';
+ }
+ echo '
';
+
+ echo '
';
+ echo ' ';
+ echo ' ';
+ echo ' ';
+ echo ''.$doc_name.' ';
+ echo ' ';
+ echo $doc_sign;
+ echo '
';
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_vedanta_plain_paper.php b/old_code_ci3/views/dashboard/rx_print_vedanta_plain_paper.php
new file mode 100644
index 0000000..7a9cd00
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_vedanta_plain_paper.php
@@ -0,0 +1,144 @@
+
+
+
+
+
+
+
+
+
+ =H_Name?>
+ =H_address_1?>, =H_address_2?>
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+
+ =nl2br($opd_master[0]->doc_sign)?>
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_vedanta_pre_print_letter_head_format.php b/old_code_ci3/views/dashboard/rx_print_vedanta_pre_print_letter_head_format.php
new file mode 100644
index 0000000..eb9a851
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_vedanta_pre_print_letter_head_format.php
@@ -0,0 +1,94 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/rx_print_vedanta_rx_blank_letter_head.php b/old_code_ci3/views/dashboard/rx_print_vedanta_rx_blank_letter_head.php
new file mode 100644
index 0000000..3f803d0
--- /dev/null
+++ b/old_code_ci3/views/dashboard/rx_print_vedanta_rx_blank_letter_head.php
@@ -0,0 +1,124 @@
+
+
+
+
+
+
+Print Time : =date('d-m-Y H:i:s')?>
+
+
+
+
+
+ Name : =strtoupper($pName)?>
+ =$pRelative?>
+ Gender/Age : =$age_sex?>
+ Mob :=$phoneno?>'
+ Address :=$p_address?>'
+
+
+ UHID : =$uhid_no?>
+ Sr No.: =$opd_sr_no ?>
+ OPD No.: =$opd_no?>
+ Date: =$opd_date?> =$exp_date?>
+
+
+ DEPARTMENT :
+ =$SpecName?>
+
+ =$opd_fee_desc?>
+ No. of Visit : =$total_no_visit?>
+ =$last_opdvisit_date?>
+ Book Time : =$str_opd_book_date?>
+
+
+
+
+
+
+
+ 0){
+ echo $vital_content;
+ echo ' ';
+ }
+
+ if(strlen($Complaint)>0){
+ echo $Complaint;
+ echo ' ';
+ }
+
+ if(strlen($diagnosis)>0){
+ echo $diagnosis;
+ echo ' ';
+ }
+
+ echo $medical;
+ echo ' ';
+
+ if(strlen($investigation)>0){
+ echo $investigation;
+ echo ' ';
+ }
+
+ if(strlen($Finding_Examinations)>0){
+ echo $Finding_Examinations;
+ echo ' ';
+ }
+
+ if(strlen($Prescriber_Remarks)>0){
+ echo $Prescriber_Remarks;
+ echo ' ';
+ }
+
+
+ if(strlen($advice)>0){
+ echo $advice;
+ echo ' ';
+ }
+
+ if(strlen($next_visit)>0){
+ echo $next_visit;
+ echo ' ';
+ }
+
+ if(strlen($refer_to)>0){
+ echo $refer_to;
+ echo ' ';
+ }
+ echo ' ';
+
+
+ ?>
+
\ No newline at end of file
diff --git a/old_code_ci3/views/dashboard/samarpit_opd_parcha.php b/old_code_ci3/views/dashboard/samarpit_opd_parcha.php
new file mode 100644
index 0000000..459d14d
--- /dev/null
+++ b/old_code_ci3/views/dashboard/samarpit_opd_parcha.php
@@ -0,0 +1,98 @@
+
+
+
+ =$pName?>
+
+
+ =$age_sex?>
+
+
+ OPD No : =$opd_no?> / UHID : =$uhid_no?> / OPD Fee : =$opd_fee?>
+
+
+ =$opd_date?>
+
+
+ =$p_address?>
+
+
+
diff --git a/old_code_ci3/views/dashboard/shri_ram_hospital.php b/old_code_ci3/views/dashboard/shri_ram_hospital.php
new file mode 100644
index 0000000..64c5257
--- /dev/null
+++ b/old_code_ci3/views/dashboard/shri_ram_hospital.php
@@ -0,0 +1,57 @@
+
+
+
+ Shri Ram Hospital श्री राम अस्पताल
+
+
+
+
+ Dr. Krishna Sah
+
+ M.B.B.S, M.S. (Obstetrics & Gynaecology),
+ Consultant
+ Regd. No. UK-1261
+
+
+
+
+
+
+ Dr. Sana Anshari
+
+ M.B.B.S, D.G.O.
+ Regd. No. UK-6583
+
+
+
+
+
+
+ Civil Lines, Tikonia, Haldwani (Nainital) U.K.
+ Contact : 9756389281 (M), 05946-282751,224422, Hospital - 7088020108
+ Morning Time : 10 A.M. - 2 P.M. And Evening Time : 5 P.M. - 8 P.M. (Sunday evening closed)
+
+ A3 Reception No. +91 8755904991
+ Not For Medico-legal Purpose
+
+
+
+=$content?>
diff --git a/old_code_ci3/views/doctor_conf_room/doctor_room.php b/old_code_ci3/views/doctor_conf_room/doctor_room.php
new file mode 100644
index 0000000..e69de29
diff --git a/old_code_ci3/views/echs_profile_V.php b/old_code_ci3/views/echs_profile_V.php
new file mode 100644
index 0000000..eab4c95
--- /dev/null
+++ b/old_code_ci3/views/echs_profile_V.php
@@ -0,0 +1,247 @@
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+ Update ECHS Record
+
+
+
+
+
+
+
+ mem_gender==1)
+ $mem_gender_str='Male';
+ else
+ $mem_gender_str='FeMale';
+
+ echo '
';
+ echo '
';
+ echo '
';
+ echo ' Member Name ';
+ echo ' ';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo ' Gender ';
+ echo ' ';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo ' Date of Birth ';
+ echo ' ';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo ' Relation ';
+ echo ' ';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo '
';
+ echo ' Select It.... ';
+ echo '
';
+ echo '
';
+ echo '
';
+ }
+ ?>
+
+
+ 'form','class'=>'form2')); ?>
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/echs_register_V.php b/old_code_ci3/views/echs_register_V.php
new file mode 100644
index 0000000..0562758
--- /dev/null
+++ b/old_code_ci3/views/echs_register_V.php
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+ Register ECHS Card
+
+
+
+
+
+
+
+ 'form','class'=>'form2')); ?>
+
+
+
+ Go!
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/echs_search_V.php b/old_code_ci3/views/echs_search_V.php
new file mode 100644
index 0000000..81d29a0
--- /dev/null
+++ b/old_code_ci3/views/echs_search_V.php
@@ -0,0 +1,42 @@
+
+
+
+
+
+
+
+
+ ECHS Code
+ Name
+ Phone Number
+ Date of Birth
+ Action
+
+
+
+
+
+ =$data[$i]->service_no ?>/=$data[$i]->reg_no ?>
+ =$data[$i]->name ?>
+ =$data[$i]->mphone1 ?>
+ =$data[$i]->dob ?>
+ Got It....
+
+
+
+
+
+ Patient Code
+ Name
+ Phone Number
+ EMail
+ Action
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/errors/cli/error_404.php b/old_code_ci3/views/errors/cli/error_404.php
new file mode 100644
index 0000000..6984b61
--- /dev/null
+++ b/old_code_ci3/views/errors/cli/error_404.php
@@ -0,0 +1,8 @@
+
+
+An uncaught Exception was encountered
+
+Type:
+Message:
+Filename: getFile(), "\n"; ?>
+Line Number: getLine(); ?>
+
+
+
+Backtrace:
+getTrace() as $error): ?>
+
+ File:
+ Line:
+ Function:
+
+
+
+
diff --git a/old_code_ci3/views/errors/cli/error_general.php b/old_code_ci3/views/errors/cli/error_general.php
new file mode 100644
index 0000000..6984b61
--- /dev/null
+++ b/old_code_ci3/views/errors/cli/error_general.php
@@ -0,0 +1,8 @@
+
+
+A PHP Error was encountered
+
+Severity:
+Message:
+Filename:
+Line Number:
+
+
+
+Backtrace:
+
+
+ File:
+ Line:
+ Function:
+
+
+
+
diff --git a/old_code_ci3/views/errors/cli/index.html b/old_code_ci3/views/errors/cli/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/old_code_ci3/views/errors/cli/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/old_code_ci3/views/errors/html/error_404.php b/old_code_ci3/views/errors/html/error_404.php
new file mode 100644
index 0000000..756ea9d
--- /dev/null
+++ b/old_code_ci3/views/errors/html/error_404.php
@@ -0,0 +1,64 @@
+
+
+
+
+404 Page Not Found
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/errors/html/error_db.php b/old_code_ci3/views/errors/html/error_db.php
new file mode 100644
index 0000000..f5a43f6
--- /dev/null
+++ b/old_code_ci3/views/errors/html/error_db.php
@@ -0,0 +1,64 @@
+
+
+
+
+Database Error
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/errors/html/error_exception.php b/old_code_ci3/views/errors/html/error_exception.php
new file mode 100644
index 0000000..8784886
--- /dev/null
+++ b/old_code_ci3/views/errors/html/error_exception.php
@@ -0,0 +1,32 @@
+
+
+
+
+
An uncaught Exception was encountered
+
+
Type:
+
Message:
+
Filename: getFile(); ?>
+
Line Number: getLine(); ?>
+
+
+
+
Backtrace:
+ getTrace() as $error): ?>
+
+
+
+
+ File:
+ Line:
+ Function:
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/errors/html/error_general.php b/old_code_ci3/views/errors/html/error_general.php
new file mode 100644
index 0000000..fc3b2eb
--- /dev/null
+++ b/old_code_ci3/views/errors/html/error_general.php
@@ -0,0 +1,64 @@
+
+
+
+
+Error
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/errors/html/error_php.php b/old_code_ci3/views/errors/html/error_php.php
new file mode 100644
index 0000000..b146f9c
--- /dev/null
+++ b/old_code_ci3/views/errors/html/error_php.php
@@ -0,0 +1,33 @@
+
+
+
+
+
A PHP Error was encountered
+
+
Severity:
+
Message:
+
Filename:
+
Line Number:
+
+
+
+
Backtrace:
+
+
+
+
+
+ File:
+ Line:
+ Function:
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/errors/html/index.html b/old_code_ci3/views/errors/html/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/old_code_ci3/views/errors/html/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/old_code_ci3/views/errors/index.html b/old_code_ci3/views/errors/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/old_code_ci3/views/errors/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/old_code_ci3/views/form.php b/old_code_ci3/views/form.php
new file mode 100644
index 0000000..2b91ab1
--- /dev/null
+++ b/old_code_ci3/views/form.php
@@ -0,0 +1,66 @@
+
+
+
+
+
+
+
+ 'form-horizontal')); ?>
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/hospital_refer/reffer_add.php b/old_code_ci3/views/hospital_refer/reffer_add.php
new file mode 100644
index 0000000..2351380
--- /dev/null
+++ b/old_code_ci3/views/hospital_refer/reffer_add.php
@@ -0,0 +1,78 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/hospital_refer/reffer_edit.php b/old_code_ci3/views/hospital_refer/reffer_edit.php
new file mode 100644
index 0000000..5107de5
--- /dev/null
+++ b/old_code_ci3/views/hospital_refer/reffer_edit.php
@@ -0,0 +1,78 @@
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/hospital_refer/reffer_index.php b/old_code_ci3/views/hospital_refer/reffer_index.php
new file mode 100644
index 0000000..375a2a1
--- /dev/null
+++ b/old_code_ci3/views/hospital_refer/reffer_index.php
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+ Name
+ Type
+ Register Date
+ Status
+ Edit
+
+
+
+
+
+ =$row->title.' '.$row->f_name?>
+ refer_type==0){
+ echo 'Person';
+ } elseif($row->refer_type==1){
+ echo 'Doctor';
+ }elseif($row->refer_type==2){
+ echo 'Staff';
+ }elseif($row->refer_type==3){
+ echo 'Hospital/Clinic';
+ }else{
+ echo 'Others';
+ }
+
+ ?>
+ =$row->str_dateadd?>
+
+ active){
+ echo "".lang('index_active_link')." ";
+ }else{
+ echo "".lang('index_inactive_link')." ";
+ }
+ ?>
+
+ Edit
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/index.html b/old_code_ci3/views/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/old_code_ci3/views/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/old_code_ci3/views/insurance/insurance_card.php b/old_code_ci3/views/insurance/insurance_card.php
new file mode 100644
index 0000000..ceb9bc5
--- /dev/null
+++ b/old_code_ci3/views/insurance/insurance_card.php
@@ -0,0 +1,135 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+ 0)
+ {
+ $ins_card_id=$data_insurance_card[0]->id;
+ $ins_company_id=$data_insurance_card[0]->insurance_id;
+ $ins_insurance_no=$data_insurance_card[0]->insurance_no;
+ $card_holder_name=$data_insurance_card[0]->card_holder_name;
+ $relation_patient_cardholder=$data_insurance_card[0]->relation_patient_cardholder;
+ $issue_date=MysqlDate_to_str($data_insurance_card[0]->issue_date);
+ $expiry_date=MysqlDate_to_str($data_insurance_card[0]->expiry_date);
+ }
+ ?>
+
+
+
+
+ Insurance
+
+ id.'" '.combo_checked($ins_company_id,$row->id).' >'.$row->ins_company_name.'';
+ }
+ ?>
+
+
+
+
+
+ Insurance ID / No.
+
+
+
+
+
+ Insurance Card Holder Name
+
+
+
+
+
+
+
+ Add or Update Record
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/insurance/insurance_create_V.php b/old_code_ci3/views/insurance/insurance_create_V.php
new file mode 100644
index 0000000..2c33b54
--- /dev/null
+++ b/old_code_ci3/views/insurance/insurance_create_V.php
@@ -0,0 +1,74 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+ Contact Person Name
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/insurance/insurance_profile_V.php b/old_code_ci3/views/insurance/insurance_profile_V.php
new file mode 100644
index 0000000..837e9c0
--- /dev/null
+++ b/old_code_ci3/views/insurance/insurance_profile_V.php
@@ -0,0 +1,207 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+ Contact Person Name
+
+
+
+
+
+
+
+
+ active)?> > Active
+
+
+
+
+
+
+
+
+
+
+
+
+
+ opd_allowed)?> > OPD Allow
+
+
+
+
+
+
+
+
+ OPD Fee Description
+
+
+
+
+
+
+ opd_cash)?> > Direct Allowed
+
+
+
+
+
+
+ opd_credit)?>> Credit Allowed
+
+
+
+
+
+
+
+ {if Direct Customer Rate } Discount
+
+
+
+
+
+ {if Rate Specific Insurance Company } OPD Fee
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ {if Direct Customer Rate } Discount
+
+
+
+
+
+
+ charge_credit)?>> Charge Credit
+
+
+
+
+
+
+ med_credit)?>> Medicine Credit
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/insurance/insurance_search_v.php b/old_code_ci3/views/insurance/insurance_search_v.php
new file mode 100644
index 0000000..13c8d29
--- /dev/null
+++ b/old_code_ci3/views/insurance/insurance_search_v.php
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+
+
+
+
+
+ Company Name
+ Contact Number
+ OPD Fee
+ Active
+
+
+
+
+
+
+ =$data[$i]->ins_company_name ?>
+ =$data[$i]->ins_contact_number ?>
+ =$data[$i]->opd_fee?>
+ =$data[$i]->activestatus ?>
+ Edit It....
+
+
+
+
+
+ Company Name
+ Contact Number
+ Contact Person Name
+ E-Mail
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/insurance_V.php b/old_code_ci3/views/insurance_V.php
new file mode 100644
index 0000000..dce0180
--- /dev/null
+++ b/old_code_ci3/views/insurance_V.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/invoice_pathlab_print_V.php b/old_code_ci3/views/invoice_pathlab_print_V.php
new file mode 100644
index 0000000..71033c5
--- /dev/null
+++ b/old_code_ci3/views/invoice_pathlab_print_V.php
@@ -0,0 +1,223 @@
+
+
+
+
+
+ =H_Name?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Invoice #=$invoice_master[0]->invoice_code ?>
+
Date : =$invoice_master[0]->inv_date ?>
+
Patient ID : =$patient_master[0]->p_code ?>
+ insurance_id>1)
+ {
+ echo '
Ins. Comp. : '.$insurance[0]->ins_company_name.'
';
+ if($invoice_master[0]->insurance_case_id>0)
+ {
+ echo '
Org.Case No. : '.$case_master[0]->case_id_code.'
';
+ }
+ }
+ ?>
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+
+
+
+ To
+
+ =strtoupper($patient_master[0]->p_fname) ?>
+ =$patient_master[0]->p_relative ?> : =strtoupper($patient_master[0]->p_rname) ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+ Refer By : =$invoice_master[0]->refer_by_other ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Org.Code
+ Rate
+ Qty
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->group_desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->org_code.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ echo ' ';
+ echo '';
+ }
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal?>
+
+
+ discount_amount>0) {?>
+
+ #
+ Deduction
+ =$invoice_master[0]->discount_desc ?>
+
+
+ -=$invoice_master[0]->discount_amount ?>
+
+
+
+ ipd_id<1) {?>
+
+ #
+ Amount received : =$invoice_master[0]->payment_part_received?>
+ Balance Amount : =$invoice_master[0]->payment_part_balance?>
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+
+
+ correction_amount>0) {?>
+
+ #
+ Cancel Invoice
+ =$invoice_master[0]->correction_remark ?>
+
+
+ -=$invoice_master[0]->correction_amount ?>
+
+
+
+ #
+
+
+
+ Final Amount
+ =$invoice_master[0]->correction_net_amount?>
+
+
+
+
+
+
+
+ =$invoice_master[0]->Invoice_status_str?>
+
+ payment_mode>2) { ?>
+
+
+ Payment Details [=$invoice_master[0]->Payment_type_str ?>]
+
+
+
+
+
+ Payment Details [Payment No.:Mode of Payment:Amount] :
+ id.':'.$row->Payment_type_str.':'.$row->amount.']/';
+ }
+ ?>
+
+
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+
+
+
+ Signature
+
+
+
+
+
+
+
+ This is computer generated provisional invoice , Signature and stamp not required
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/invoice_print_v.php b/old_code_ci3/views/invoice_print_v.php
new file mode 100644
index 0000000..48772d2
--- /dev/null
+++ b/old_code_ci3/views/invoice_print_v.php
@@ -0,0 +1,183 @@
+
+
+
+
+
+
=H_Name?> | Invoice
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'-'.$user->id.'';
+?>
+
+
+
+
+
+
+
+
+
+
+
+
+
OPD Invoice ID: =$opd_master[0]->opd_code ?>
+
Patient ID : =$patient_master[0]->p_code ?>
+
+ insurance_id>1)
+ {
+ echo '
Ins. Comp. : '.$insurance[0]->ins_company_name.'
';
+ if($opd_master[0]->insurance_case_id>0)
+ {
+ echo '
Org.Case No. : '.$case_master[0]->case_id_code.'
';
+ }
+ }
+ ?>
+
+ payment_id>0 )
+ {
+ echo '
Payment No. : '.$opd_master[0]->payment_id.'
';
+ }
+ ?>
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+ opd_no=='' || $opd_master[0]->opd_no==0)) { ?>
+
Sr.No.=$opd_master[0]->opd_no ?>
+
+
+
+
+ To
+
+ =$patient_master[0]->title ?> =strtoupper($patient_master[0]->p_fname) ?>
+ Date : =$opd_master[0]->str_apointment_date ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+ No. of Times Visit : =$opd_master[0]->no_visit ?>
+
+
+
+
+
+
+
+
+
+
+
+ Date
+ Doctor
+ Department
+ Desc
+ OPD Fee
+
+
+
+
+ =$opd_master[0]->apointment_date ?>
+ Dr. =$opd_master[0]->doc_name ?>
+ =$opd_master[0]->doc_spec ?>
+ =$opd_master[0]->opd_fee_desc ?>
+ =$opd_master[0]->opd_fee_gross_amount ?>
+
+ opd_discount>0 )
+ {
+ ?>
+
+ Deduction
+ =$opd_master[0]->opd_disc_remark ?>
+ -=$opd_master[0]->opd_discount ?>
+
+
+
+
+
+
+ Net Amount
+ =$opd_master[0]->opd_fee_amount ?>
+
+
+
+
+
+
+
+
+
+
+ opd_status==3) {
+ echo '
OPD cancelled ';
+ echo '
'.$opd_master[0]->opd_status_remark.'
';
+ }else{
+ ?>
+
+
Mode of Payment : =$opd_master[0]->payment_mode_desc ?>
+
+
+
+
+
+ Prepared By : =$opd_master[0]->prepared_by ?>
+
+
+
+
+
+ Signature
+
+
+
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/invoice_show.php b/old_code_ci3/views/invoice_show.php
new file mode 100644
index 0000000..cc00450
--- /dev/null
+++ b/old_code_ci3/views/invoice_show.php
@@ -0,0 +1,145 @@
+
+
+
+
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+
+
+
+ To
+
+ =$opd_master[0]->P_name ?>
+ Date : =MysqlDate_to_str($opd_master[0]->apointment_date) ?>
+ Gender : =($patient_master[0]->gender==1)?'Male':'Female' ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+
+
+
+
+ OPD ID: =$opd_master[0]->opd_code ?>
+ Patient ID : =$patient_master[0]->p_code ?>
+
+ insurance_id>1)
+ {
+ echo ' Ins. Comp. : '.$insurance[0]->ins_company_name.' ';
+ }
+
+ if($opd_master[0]->payment_id>0 )
+ {
+ echo 'Payment No. : '.$opd_master[0]->payment_id.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+ Type
+ Doctor Name
+ Fee Amount
+ Description
+
+
+
+
+ Dr. =$opd_master[0]->doc_name ?>
+ =$opd_master[0]->doc_spec ?>
+ =$opd_master[0]->opd_fee_amount ?>
+ =$opd_master[0]->opd_fee_desc ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
Amount Due 2/22/2014
+
+
+
+
+ Subtotal:
+ $250.30
+
+
+ Tax (9.3%)
+ $10.34
+
+
+ Shipping:
+ $5.80
+
+
+ Total:
+ $265.24
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/invoiceshow/invoice_charges.php b/old_code_ci3/views/invoiceshow/invoice_charges.php
new file mode 100644
index 0000000..d9593d9
--- /dev/null
+++ b/old_code_ci3/views/invoiceshow/invoice_charges.php
@@ -0,0 +1,161 @@
+
+
+
+
+
+
+
+
+
+
Invoice #=$invoice_master[0]->invoice_code ?>
+
Date : =$invoice_master[0]->inv_date ?>
+
Patient ID : =$patient_master[0]->p_code ?>
+
+
+ payment_id>0 )
+ {
+ echo '
Payment No. : '.$invoice_master[0]->payment_id.'
';
+ }
+ ?>
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+
+
+
+ To
+
+ =$patient_master[0]->p_fname ?>
+ Gender : =$patient_master[0]->xgender ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+ Refer By : =$invoice_master[0]->refer_by_other ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Charges Group
+ Charge Name
+ Rate
+ Qty
+ Amount
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->desc.' ';
+ echo ''.$row->item_name.' ';
+ echo ''.$row->item_rate.' ';
+ echo ''.$row->item_qty.' ';
+ echo ' '.$row->item_amount.' ';
+ $srno=$srno+1;
+ echo ' ';
+ echo '';
+ }
+ ?>
+
+
+ #
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->Gtotal?>
+
+
+ discount_amount>0) {?>
+
+ #
+ Deduction
+ =$invoice_master[0]->discount_desc ?>
+
+
+ -=$invoice_master[0]->discount_amount ?>
+
+
+
+
+ #
+
+
+
+ Net Amount
+ =$invoice_master[0]->net_amount?>
+
+
+ correction_amount>0) {?>
+
+ #
+ Correction
+ =$invoice_master[0]->correction_remark ?>
+
+
+ -=$invoice_master[0]->correction_amount ?>
+
+
+
+ #
+
+
+
+ Final Amount
+ =$invoice_master[0]->correction_net_amount?>
+
+
+
+
+
+
+
+
+
+
+ Mode of Payment : =$invoice_master[0]->payment_mode_desc ?>
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+
+
+
+ Signature
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/invoiceshow/invoice_medical.php b/old_code_ci3/views/invoiceshow/invoice_medical.php
new file mode 100644
index 0000000..5212239
--- /dev/null
+++ b/old_code_ci3/views/invoiceshow/invoice_medical.php
@@ -0,0 +1,138 @@
+
+
+
+
+
+
+
+
+
+
+
Invoice #=$invoice_master[0]->inv_med_code ?>
+
Date : =$invoice_master[0]->inv_date ?>
+
Patient ID : =$invoice_master[0]->patient_code ?>
+ payment_id>0 )
+ {
+ echo '
Payment No. : '.$invoice_master[0]->payment_id.'
';
+ }
+ ?>
+
+
+
+ From
+
+ =H_Name?>
+ =H_address_1?>
+ =H_address_2?>
+ Phone: =H_phone_No?>
+ Email: =H_Email?>
+
+
+
+
+ To
+
+ =$invoice_master[0]->inv_name ?>
+ Refer By : =$invoice_master[0]->doc_name ?>
+
+
+
+
+
+
+
+
+
+
+
+
+ #
+ Item code
+ Item Name
+ Formulation
+ Batch No
+ Exp.
+ Rate
+ Qty.
+ Price
+ Disc.
+ Vat
+ Tax Amount
+ Amount
+
+
+
+ ';
+ echo ''.$srno.' ';
+ echo ''.$row->item_code.' ';
+ echo ''.$row->item_Name.' ';
+ echo ''.$row->formulation.' ';
+ echo ''.$row->batch_no.' ';
+ echo ''.$row->expiry.' ';
+ echo ''.$row->price.' ';
+ echo ''.$row->qty.' ';
+ echo ''.$row->amount.' ';
+ echo ''.$row->disc_amount.' ';
+ echo ''.$row->vat.' ';
+ echo ''.$row->vamount.' ';
+ echo ''.$row->tamount.' ';
+ echo '';
+ }
+ ?>
+
+
+ #
+
+
+
+
+
+
+ Gross Total
+ =$invoiceGtotal[0]->amt ?>
+
+
+ =$invoiceGtotal[0]->vamt ?>
+ =$invoiceGtotal[0]->Gtotal?>
+
+
+
+
+
+
+
+
+
+
+ Mode of Payment : =$invoice_master[0]->payment_mode_desc ?>
+
+
+
+ Prepared By : =$invoice_master[0]->prepared_by ?>
+
+
+
+
+
+ Signature
+
+
+
+
+ This is computer generated invoice , Signature and stamp not required
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item/item_create_V.php b/old_code_ci3/views/item/item_create_V.php
new file mode 100644
index 0000000..d28b8d4
--- /dev/null
+++ b/old_code_ci3/views/item/item_create_V.php
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+ Charges Group
+
+ itype_id.'" >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item/item_item_list.php b/old_code_ci3/views/item/item_item_list.php
new file mode 100644
index 0000000..2fe8893
--- /dev/null
+++ b/old_code_ci3/views/item/item_item_list.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+ =H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Charge Details
+ Amount
+
+
+
+
+
+
+ =$data[$i]->isIPD_OPD ?>
+ =$data[$i]->group_desc ?>
+ =$data[$i]->idesc ?>
+ =$data[$i]->idesc_detail ?>
+ =$data[$i]->amount ?>
+
+
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item/item_list_all.php b/old_code_ci3/views/item/item_list_all.php
new file mode 100644
index 0000000..457a6fe
--- /dev/null
+++ b/old_code_ci3/views/item/item_list_all.php
@@ -0,0 +1,71 @@
+
+
+
+
+
+ =H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Group/Charge Name
+ Charge Details
+ Amount
+
+
+
+ group_desc)
+ {
+ echo ''.$data[$i]->group_desc.' ';
+ $Head=$data[$i]->group_desc;
+ }
+ ?>
+
+ =$data[$i]->idesc ?>
+ =$data[$i]->idesc_detail ?>
+ =$data[$i]->amount ?>
+
+
+
+
+
+ Group/Charge Name
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item/item_profile_V.php b/old_code_ci3/views/item/item_profile_V.php
new file mode 100644
index 0000000..0030259
--- /dev/null
+++ b/old_code_ci3/views/item/item_profile_V.php
@@ -0,0 +1,181 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+ Charges Group
+
+ itype_id.'" '.combo_checked($data_item[0]->itype_id,$row->itype_id).' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ Description
+ =$data_item[0]->idesc_detail ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+
+
+
+ =$data_insurance_item[$i]->ins_company_name ?>
+ =$data_insurance_item[$i]->i_amount ?>
+ =$data_insurance_item[$i]->code ?>
+ Delete
+
+
+
+
+
+
+
+
+
+
+ Company Name
+
+ id.'">'.$row->ins_company_name.'';
+ }
+ ?>
+
+
+
+
+
+
+ Add
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item/item_search_V.php b/old_code_ci3/views/item/item_search_V.php
new file mode 100644
index 0000000..8d55edf
--- /dev/null
+++ b/old_code_ci3/views/item/item_search_V.php
@@ -0,0 +1,135 @@
+
+'form','class'=>'form1')); ?>
+
+
+
+
+ Select Charge Type
+
+ itype_id.'>'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
Print
+
Print ALL
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+ =$row->isIPD_OPD ?>
+ =$row->group_desc ?>
+ =$row->idesc ?>
+ =$row->amount ?>
+ Edit It....
+
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item/item_type_create.php b/old_code_ci3/views/item/item_type_create.php
new file mode 100644
index 0000000..de6af24
--- /dev/null
+++ b/old_code_ci3/views/item/item_type_create.php
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Charges Group Name
+
+
+
+
+
+ Is IPD or OPD
+
+ Both OPD and IPD
+ Only OPD
+ Only IPD
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item/item_type_profile.php b/old_code_ci3/views/item/item_type_profile.php
new file mode 100644
index 0000000..1b81f3a
--- /dev/null
+++ b/old_code_ci3/views/item/item_type_profile.php
@@ -0,0 +1,62 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Charges Group Name
+
+
+
+
+
+ Is IPD or OPD
+
+ is_ipd_opd)?> >Both OPD and IPD
+ is_ipd_opd)?> >Only OPD
+ is_ipd_opd)?> >Only IPD
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item_ipd/item_create_V.php b/old_code_ci3/views/item_ipd/item_create_V.php
new file mode 100644
index 0000000..eb709c8
--- /dev/null
+++ b/old_code_ci3/views/item_ipd/item_create_V.php
@@ -0,0 +1,77 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+ Charges Group
+
+ itype_id.'" >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item_ipd/item_item_list.php b/old_code_ci3/views/item_ipd/item_item_list.php
new file mode 100644
index 0000000..2fe8893
--- /dev/null
+++ b/old_code_ci3/views/item_ipd/item_item_list.php
@@ -0,0 +1,69 @@
+
+
+
+
+
+ =H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Charge Details
+ Amount
+
+
+
+
+
+
+ =$data[$i]->isIPD_OPD ?>
+ =$data[$i]->group_desc ?>
+ =$data[$i]->idesc ?>
+ =$data[$i]->idesc_detail ?>
+ =$data[$i]->amount ?>
+
+
+
+
+
+
+ OPD or IPD
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item_ipd/item_list_all.php b/old_code_ci3/views/item_ipd/item_list_all.php
new file mode 100644
index 0000000..457a6fe
--- /dev/null
+++ b/old_code_ci3/views/item_ipd/item_list_all.php
@@ -0,0 +1,71 @@
+
+
+
+
+
+ =H_Name?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ Group/Charge Name
+ Charge Details
+ Amount
+
+
+
+ group_desc)
+ {
+ echo ''.$data[$i]->group_desc.' ';
+ $Head=$data[$i]->group_desc;
+ }
+ ?>
+
+ =$data[$i]->idesc ?>
+ =$data[$i]->idesc_detail ?>
+ =$data[$i]->amount ?>
+
+
+
+
+
+ Group/Charge Name
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item_ipd/item_profile_V.php b/old_code_ci3/views/item_ipd/item_profile_V.php
new file mode 100644
index 0000000..30cff7c
--- /dev/null
+++ b/old_code_ci3/views/item_ipd/item_profile_V.php
@@ -0,0 +1,177 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+
+ Charges Group
+
+ itype_id.'" '.combo_checked($data_item[0]->itype,$row->itype_id).' >'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+ Description
+ =$data_item[0]->idesc_detail ?>
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Company Name
+ Amount
+ Code
+ Action
+
+
+
+
+
+ =$data_insurance_item[$i]->ins_company_name ?>
+ =$data_insurance_item[$i]->i_amount ?>
+ =$data_insurance_item[$i]->code ?>
+ Delete
+
+
+
+
+
+
+
+
+
+
+ Company Name
+
+ id.'">'.$row->ins_company_name.'';
+ }
+ ?>
+
+
+
+
+
+
+ Add
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item_ipd/item_search_V.php b/old_code_ci3/views/item_ipd/item_search_V.php
new file mode 100644
index 0000000..bb9f403
--- /dev/null
+++ b/old_code_ci3/views/item_ipd/item_search_V.php
@@ -0,0 +1,131 @@
+
+'form','class'=>'form1')); ?>
+
+
+
+
+ Select Charge Type
+
+ itype_id.'>'.$row->group_desc.'';
+ }
+ ?>
+
+
+
+
+
+
+
+
+
+
+
+
Print
+
Print ALL
+
+
+
+
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+ =$data[$i]->group_desc ?>
+ =$data[$i]->idesc ?>
+ =$data[$i]->amount ?>
+ Edit It....
+
+
+
+
+
+ Group
+ Charge Name
+ Amount
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item_ipd/item_type_create.php b/old_code_ci3/views/item_ipd/item_type_create.php
new file mode 100644
index 0000000..7ea689e
--- /dev/null
+++ b/old_code_ci3/views/item_ipd/item_type_create.php
@@ -0,0 +1,50 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ Charges Group Name
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/item_ipd/item_type_profile.php b/old_code_ci3/views/item_ipd/item_type_profile.php
new file mode 100644
index 0000000..bb28a17
--- /dev/null
+++ b/old_code_ci3/views/item_ipd/item_type_profile.php
@@ -0,0 +1,58 @@
+
+
+
+
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+
+ Charges Group Name
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/opd_app_insurance_V.php b/old_code_ci3/views/opd_app_insurance_V.php
new file mode 100644
index 0000000..e3310b9
--- /dev/null
+++ b/old_code_ci3/views/opd_app_insurance_V.php
@@ -0,0 +1,151 @@
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+ Back to Select Doctor
+ Confirm And Go for Payment
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/opd_appointment_V.php b/old_code_ci3/views/opd_appointment_V.php
new file mode 100644
index 0000000..88279b1
--- /dev/null
+++ b/old_code_ci3/views/opd_appointment_V.php
@@ -0,0 +1,156 @@
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
+
+
+
+
+
+ Back to Select Doctor
+ Confirm And Go for Payment
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/opd_invoice_V.php b/old_code_ci3/views/opd_invoice_V.php
new file mode 100644
index 0000000..ac06980
--- /dev/null
+++ b/old_code_ci3/views/opd_invoice_V.php
@@ -0,0 +1,516 @@
+
+
+ 'form','class'=>'form1')); ?>
+
+
+
+ To
+
+ =strtoupper($opd_master[0]->P_name) ?>
+ =$patient_master[0]->p_relative ?> : =$patient_master[0]->p_rname ?>
+ OPD Book Date (y-m-d time) : =$opd_master[0]->opd_book_date ?>
+ Gender : =($patient_master[0]->gender==1)?'Male':'Female' ?>
+ Age : =$patient_master[0]->age ?>
+ Phone No : =$patient_master[0]->mphone1 ?>
+
+
+
+
+ OPD ID: =$opd_master[0]->opd_code ?>
+ Date of Appointment: =$opd_master[0]->str_apointment_date ?>
+ Patient ID : =$patient_master[0]->p_code ?>
+ insurance_id>1)
+ {
+ echo ' Ins. Comp. : '.$insurance[0]->ins_company_name.' ';
+ }
+ ?>
+
+ payment_id>0 )
+ {
+ echo 'Payment No. : '.$opd_master[0]->payment_id.' ';
+ }
+ ?>
+
+
+
+
+
+
+
+
+ payment_status==0 && $refund_status==0) { ?>
+
+
+
+
+
+ opd_status==3){
+ echo '
Status is Cancelled ' ;
+ }else{?>
+ Payment Method by : =$opd_master[0]->payment_mode_desc ?>
+
+
+
+
+
+ ion_auth->in_group('OPDEdit') && ($opd_master[0]->opd_status==1 || $opd_master[0]->opd_status==2)) { ?>
+
+
+ opd_status==1) { ?>
+
+
+
+
+ Cancel OPD
+
+
+
+ opd_status==1 || $opd_master[0]->opd_status==2 ) {
+ if(count($case_master)>0)
+ {
+ ?>
+ Credit To Org.
+ [=$case_master[0]->case_id_code?>]
+
+
+
+
+
+ Change Doctor
+
+ id.' '.combo_checked($row->id,$opd_master[0]->doc_id).' >'.$row->p_fname.'';
+ }
+ ?>
+
+
+
+
+
+ OPD Fee =$opd_master[0]->opd_fee_gross_amount?> /
+ =$opd_master[0]->opd_fee_amount?>
+
+
+
+
+
+ U pdate
+ Doctor and Date
+
+
+
+
+
+ opd_status==1 or $opd_master[0]->opd_status==2) AND ($opd_master[0]->payment_mode==4)){ ?>
+
+ Reverse to
+ Cash
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/opd_letter_head.php b/old_code_ci3/views/opd_letter_head.php
new file mode 100644
index 0000000..58c70c3
--- /dev/null
+++ b/old_code_ci3/views/opd_letter_head.php
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ion_auth->user()->row();
+ $user_id = $user->id;
+ $user_name = $user->first_name.''. $user->last_name.'-'.$user->id.'';
+?>
+
+
+
+
+
+
+
+
+
+ UHID : =$patient_master[0]->p_code ?>
+ udai<>"")
+ {
+ echo ' /'.$patient_master[0]->udai;
+ }
+ ?>
+ Name : =$patient_master[0]->title ?> =strtoupper($patient_master[0]->p_fname) ?>
+ =$patient_master[0]->p_relative ?> =strtoupper($patient_master[0]->p_rname) ?>
+ Sex : =$patient_master[0]->xgender ?> =$patient_master[0]->age ?>
+
+
+ OPD No.: =$opd_master[0]->opd_code ?>/ =$opd_master[0]->opd_id?>
+ OPD Fee: =$opd_master[0]->opd_fee_amount ?> [=$opd_master[0]->opd_fee_desc ?>]
+ Date: =$opd_master[0]->str_apointment_date ?>
+ opd_fee_type=='3'){
+ if(count($old_opd)>0){
+ echo 'Valid Upto :'.$opd_master[0]->opd_Exp_Date.' ';
+ }
+ }else{ ?>
+ Valid Upto : =$opd_master[0]->opd_Exp_Date ?>
+
+
+
+
+ Sr No.:=$opd_master[0]->opd_no ?>
+ P.No. : =$patient_master[0]->mphone1 ?>
+ Address : =$patient_master[0]->add1.','.$patient_master[0]->city?>
+
+
+
+
+
+
+
diff --git a/old_code_ci3/views/print_format/opd_print_letter_head.php b/old_code_ci3/views/print_format/opd_print_letter_head.php
new file mode 100644
index 0000000..cbea32d
--- /dev/null
+++ b/old_code_ci3/views/print_format/opd_print_letter_head.php
@@ -0,0 +1,35 @@
+
+
+
+
+
+ UHID : '.$patient_master[0]->p_code.' '.$old_uhid.'
+ Name : '.$patient_master[0]->title .' '.strtoupper($patient_master[0]->p_fname).'
+ '.$patient_master[0]->p_relative.' '.strtoupper($patient_master[0]->p_rname).'
+ Gender/Age : '.$patient_master[0]->xgender.' / '.$patient_master[0]->age.'
+
+
+ OPD No.: '.$opd_master[0]->opd_code.'
+ OPD Fee: '.$opd_master[0]->opd_fee_amount .' ['.$opd_master[0]->opd_fee_desc .']
+ Date: '.$opd_master[0]->str_apointment_date .' '.$exp_date.'
+
+
+ Sr No.: '.$opd_master[0]->opd_no .'
+ P.No. :'.$patient_master[0]->mphone1 .'
+ Address :'.$patient_master[0]->add1.','.$patient_master[0]->add2.
+ ' '.$patient_master[0]->city.' '.$patient_master[0]->district.
+ ' '.$patient_master[0]->state.'
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/search_adv_data.php b/old_code_ci3/views/search_adv_data.php
new file mode 100644
index 0000000..e5c390e
--- /dev/null
+++ b/old_code_ci3/views/search_adv_data.php
@@ -0,0 +1,11 @@
+0) { ?>
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/setting/setting_main.php b/old_code_ci3/views/setting/setting_main.php
new file mode 100644
index 0000000..0b15cff
--- /dev/null
+++ b/old_code_ci3/views/setting/setting_main.php
@@ -0,0 +1,64 @@
+
+
+
+'form','class'=>'form1')); ?>
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/temp_edit.php b/old_code_ci3/views/temp_edit.php
new file mode 100644
index 0000000..d811a91
--- /dev/null
+++ b/old_code_ci3/views/temp_edit.php
@@ -0,0 +1,22 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/test.html b/old_code_ci3/views/test.html
new file mode 100644
index 0000000..53ff075
--- /dev/null
+++ b/old_code_ci3/views/test.html
@@ -0,0 +1,146 @@
+
+
+
+
+
+
+
+
+
+
+ Attach Charge Name
+
+ No Attach Absolute Eosinophil count ACE LEVEL ACID PHOSPHATASE TOTAL ACTH Adhesiolysis ALDOSTERONE ALDOSTONE/RENIN Alhpa Fetoprotein ALLERGY PROFILE AMH ANA ANTI CCP ANTIBODY ANTIPHOSPHOLIPID ANTIBODY IgG, IgM B N P biochemical Biopsy (Uterus) Biopsy Charge Biopsy from Thigh BIOPSY- HARNIYA BLEEDING TIME (ivys) BLOOD CROSS MATCHING BLOOD CULTURE Blood Sugar by Glucometer Stick BNP Bone biopsy Bone Marrow smear exmination C1 FUNCTION INHIBITOR C1 QUTATITON C3 and C4 Compliment C4 CA-125 CARDIOLIPIN IgA,IgM CARDIOLIPIN IgG CBC RE- MICROSCOPY CEA CHIKUNGUNYA PCR Cholesterol CLOTTING TIME (Lee & White) Cortisol Evening Cortisol Morning Covid 19 - Antigen Test CSF& S.PRO.ELEC./OLIGO. BAND CULTURE Cytology of Breast fluid Cytology of Pleural fluid CYTOPATHOLOGY ( FLUID) D-DIMER DHEA DHEA SULPHATE DIGOXIN DUAL MARKER EAR SWAB RT CULTURE EBV IgM Test ESR Estradiol (E2) FACTOR IX FACTOR VIII Fasting Insulin Ferritin FO/C LEVEL Folic Acid Free Testosteron FT3FT4 FT4 Fungal Stain Fungus Culture Glucose Tolerance Test (GTT) GROWTH HORMONE H HAV IGM HB ELECTROPHORESIS HDL CHOLESTEROL HEPATITIS E ANTIBODY (IgM) HEPATITIS E BOTH(IgG+IgM) HEPATITIS E IgG HISTOPATHOLOGY (APPENDIX) HISTOPATHOLOGY (BILATERAL OVARY) HISTOPATHOLOGY (CYST FROM ABDOMEN) HISTOPATHOLOGY (FROM GLUTEAL REGION) HISTOPATHOLOGY (PANHYSTERECTOMY) HISTOPATHOLOGY (PUNCH BIOPSY FROM SIGMOID GROWTH) Histopathology (T.O Mass) HISTOPATHOLOGY (THYROID) Histopathology(Biopsy from Finger) Histopathology(Biopsy from Gluteal growth) Histopathology(Biopsy from hand) Histopathology(Breast lump) Histopathology(Cervical growth) Histopathology(Cyst from back) Histopathology(Endometrial Biopsy) Histopathology(Fibroid) Histopathology(Gall Bladder) Histopathology(Left & Right Fellopian tube ) Histopathology(Non healing ulcer from leg) Histopathology(Ovarian tissue) Histopathology(Panhysterectomy) Histopathology(Parotid tissue) Histopathology(Prostate) Histopathology(Punch biopsy from retro sigmoid growth) Histopathology(Right Ovarian Cyst) Histopathology(Soft tissue from right hip joint) Histopathology(Soft Tissue mass) Histopathology(Speciman of Skin) Histopathology(Uterus , cervix both side tube & ovary) Histopathology(Uterus with cervix) Histopathology(Uterus, cervix with one sided tube & ovaries) Histopathology(vulval growth) Histopathology(with tube & ovary Uterus, cervix) Histopathology*(Spine vertebrae T7- T8) HLAB 27 HOMOCYSTEINE QUAN.SERUM HPLC FOR B. THALASEMIA Iron Profile Karyotyping KETONE KFT 1 LAPTOSPIRA LDL CHOLESTROL LITHIUM LUPUS ANTICOAGULANT MAGNESIUM Megnisium Mono Test Montex test NASAL SWAB CUTURE NCC NEONATAL BILIRUBIN No Item O occult blood OGTT OLIGOCLONAL BANDS (O C B S) ORBIT OSMOLARITY OT OY P PAP Smear PATHOLOGY PBS PCOS PROFILE ADVANSED PCOS PROFILE ADVANSED PCOS. PROFILE PERCUTANEOUS KIDNEY BIOPSY PLASMA RENIN Post Bronchoscopy AFB Stain POST COITAL PROCALCITONIN PROTEIN ELECTROPHORESIS PT Pus Culture Pus Culture & Senstivity PUS CYTOLOGY PUS FOR AFB STAIN R A FACTOR (ABC) RANDAM URINE SUGAR RH Antibody titre Rota Virus S. IRON PROFILE S.AMH S.B. HCG S.B12 level SEMEN CULTURE Serum E2 Serum electrophoresis Serum IGE Leval Serum iron SERUM LACTATE SERUM LH SERUM MYOGLOBIN SERUM TOP SERUM TPO serum urea Skin Test SPOT URINE SPOT Urine albumin for Creatinine SPUTUM AFB STAIN sputum for afb stain 2 SPUTUM FOR AFB STAIN 3 SPUTUM GRAM STAIN Stone Anaylasis STOOL CULTURE SWAB CULTURE & SENSITIVITY Synovial Fluid Examination TESTOSTERON THROAT SWAB CULTURE TIBC TORCH IGG TORCH IgG & IgM TORCH IgM TOTAL THYROID PANEL TOTAL/HDL CHOLESTEROL RATIO Tpo TRECHEAL ASPIRATE TRIPLE MARKER Umblical Hernia Repair, S No - 425 URINARY CREATININE URINARY POTASSIUM URINARY SODIUM Urine Cotinine URINE CULTURE & SENSITIVITY urine for albumin Urine for Microalbumin urine microscopy Urine Protien to Creatinine Ratio URINE SUGAR FASTING URINE SUGAR PP uterus uterus V B12 level V L D L CHOLESTROL Vaginal smear Examination VAGINAL SWAB CULTURE VALPROIC ACID,VLAPROATE VDRL Velparic Acid Vitamin D Vitamin D3 WEEL FELIX TEST YU
+
+
+
+
+ Group
+
+ BIO CHEMISTRY Biopsy CLINICAL PATHOLOGY MICRO BIOLOGY General HAEMATOLOGY Urine Fluid Examination CYTO-PATHOLOGY HISTOPATHOLOGY IMMUNOLOGY-SEROLOGY ENDOCRINOLOGY
+
+
+
+
+
+
+
+
+
+ Test Name
+ Result
+ Unit
+ Bio.Ref. Interval
+ Method
+
+
+ Absolute Eosinophil Count
+ {AEOSIN}
+ per cu mm
+ 40-440
+ MICROSCOPIC EXAMINATION
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/testcode/test2.html b/old_code_ci3/views/testcode/test2.html
new file mode 100644
index 0000000..9160503
--- /dev/null
+++ b/old_code_ci3/views/testcode/test2.html
@@ -0,0 +1,68 @@
+
+
+
+ #
+ Date
+ No. Patients
+ No. Inv.
+ Net Amt.
+ Payment
+ Cash Pending
+ IPD_Credit_Amount
+ Org_Credit_Amount
+
+
+
+
+ 1
+ 01-10-2017
+ 38
+ 61
+ 93349.86
+ 4314.95
+ 5673.77
+ 28786.41
+ 207.70
+
+ 2
+ 02-10-2017
+ 39
+ 89
+ 199379.64
+ 33671.18
+ 41470.73
+ 41116.15
+ 1061.90
+
+ 3
+ 03-10-2017
+ 28
+ 64
+ 211654.96
+ 29988.33
+ 11862.76
+ 48344.53
+ 476.77
+
+ 4
+ 04-10-2017
+ 21
+ 44
+ 69002.45
+ 16697.83
+ 13006.64
+ 15528.50
+ 0.00
+
+ #
+ Total
+ 72
+ 258
+ 573386.91
+ 84672.29
+ 72013.90
+ 133775.59
+ 1746.37
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/testcode/test_1.php b/old_code_ci3/views/testcode/test_1.php
new file mode 100644
index 0000000..0f25b52
--- /dev/null
+++ b/old_code_ci3/views/testcode/test_1.php
@@ -0,0 +1,52 @@
+
+
+
+
+
+ Your captured image will appear here...
+
\ No newline at end of file
diff --git a/old_code_ci3/views/testcode/test_2 b/old_code_ci3/views/testcode/test_2
new file mode 100644
index 0000000..203f9f7
--- /dev/null
+++ b/old_code_ci3/views/testcode/test_2
@@ -0,0 +1 @@
+test_2
\ No newline at end of file
diff --git a/old_code_ci3/views/testphp.php b/old_code_ci3/views/testphp.php
new file mode 100644
index 0000000..415f0bb
--- /dev/null
+++ b/old_code_ci3/views/testphp.php
@@ -0,0 +1,33 @@
+
+
+
+
+
+ Click here to Show
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/welcome_message.php b/old_code_ci3/views/welcome_message.php
new file mode 100644
index 0000000..2f73093
--- /dev/null
+++ b/old_code_ci3/views/welcome_message.php
@@ -0,0 +1,89 @@
+
+
+
+
+ Welcome to CodeIgniter Custom Hello
+
+
+
+
+
+
+
Welcome to CodeIgniter Hospital
+
+
+
The page you are looking at is being generated dynamically by CodeIgniter.
+
+
If you would like to edit this page you'll find it located at:
+
application/views/welcome_message.php
+
+
The corresponding controller for this page is found at:
+
application/controllers/Welcome.php
+
+
If you are exploring CodeIgniter for the very first time, you should start by reading the User Guide .
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/welcome_message.txt b/old_code_ci3/views/welcome_message.txt
new file mode 100644
index 0000000..abd69c6
--- /dev/null
+++ b/old_code_ci3/views/welcome_message.txt
@@ -0,0 +1,10 @@
+
\ No newline at end of file
diff --git a/old_code_ci3/views/workplace/Adminpanel.php b/old_code_ci3/views/workplace/Adminpanel.php
new file mode 100644
index 0000000..e69de29
diff --git a/old_code_ci3/views/workplace/workpanel.php b/old_code_ci3/views/workplace/workpanel.php
new file mode 100644
index 0000000..c476f8e
--- /dev/null
+++ b/old_code_ci3/views/workplace/workpanel.php
@@ -0,0 +1,46 @@
+
+
diff --git a/phpunit.xml.dist b/phpunit.xml.dist
new file mode 100644
index 0000000..b408a99
--- /dev/null
+++ b/phpunit.xml.dist
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+ ./tests
+
+
+
+
+
+
+
+
+
+ ./app
+
+
+ ./app/Views
+ ./app/Config/Routes.php
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/preload.php b/preload.php
new file mode 100644
index 0000000..288b30b
--- /dev/null
+++ b/preload.php
@@ -0,0 +1,112 @@
+
+ *
+ * For the full copyright and license information, please view
+ * the LICENSE file that was distributed with this source code.
+ */
+
+use CodeIgniter\Boot;
+use Config\Paths;
+
+/*
+ *---------------------------------------------------------------
+ * Sample file for Preloading
+ *---------------------------------------------------------------
+ * See https://www.php.net/manual/en/opcache.preloading.php
+ *
+ * How to Use:
+ * 0. Copy this file to your project root folder.
+ * 1. Set the $paths property of the preload class below.
+ * 2. Set opcache.preload in php.ini.
+ * php.ini:
+ * opcache.preload=/path/to/preload.php
+ */
+
+// Load the paths config file
+require __DIR__ . '/app/Config/Paths.php';
+
+// Path to the front controller
+define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
+
+class preload
+{
+ /**
+ * @var array Paths to preload.
+ */
+ private array $paths = [
+ [
+ 'include' => __DIR__ . '/vendor/codeigniter4/framework/system', // Change this path if using manual installation
+ 'exclude' => [
+ // Not needed if you don't use them.
+ '/system/Database/OCI8/',
+ '/system/Database/Postgre/',
+ '/system/Database/SQLite3/',
+ '/system/Database/SQLSRV/',
+ // Not needed for web apps.
+ '/system/Database/Seeder.php',
+ '/system/Test/',
+ '/system/CLI/',
+ '/system/Commands/',
+ '/system/Publisher/',
+ '/system/ComposerScripts.php',
+ // Not Class/Function files.
+ '/system/Config/Routes.php',
+ '/system/Language/',
+ '/system/bootstrap.php',
+ '/system/util_bootstrap.php',
+ '/system/rewrite.php',
+ '/Views/',
+ // Errors occur.
+ '/system/ThirdParty/',
+ ],
+ ],
+ ];
+
+ public function __construct()
+ {
+ $this->loadAutoloader();
+ }
+
+ private function loadAutoloader(): void
+ {
+ $paths = new Paths();
+ require rtrim($paths->systemDirectory, '\\/ ') . DIRECTORY_SEPARATOR . 'Boot.php';
+
+ Boot::preload($paths);
+ }
+
+ /**
+ * Load PHP files.
+ */
+ public function load(): void
+ {
+ foreach ($this->paths as $path) {
+ $directory = new RecursiveDirectoryIterator($path['include']);
+ $fullTree = new RecursiveIteratorIterator($directory);
+ $phpFiles = new RegexIterator(
+ $fullTree,
+ '/.+((? $file) {
+ foreach ($path['exclude'] as $exclude) {
+ if (str_contains($file[0], $exclude)) {
+ continue 2;
+ }
+ }
+
+ require_once $file[0];
+ // Uncomment only for debugging (to inspect which files are included).
+ // Never use this in production - preload scripts must not generate output.
+ // echo 'Loaded: ' . $file[0] . "\n";
+ }
+ }
+ }
+}
+
+(new preload())->load();
diff --git a/public/.htaccess b/public/.htaccess
new file mode 100644
index 0000000..abac3cb
--- /dev/null
+++ b/public/.htaccess
@@ -0,0 +1,49 @@
+# Disable directory browsing
+Options -Indexes
+
+# ----------------------------------------------------------------------
+# Rewrite engine
+# ----------------------------------------------------------------------
+
+# Turning on the rewrite engine is necessary for the following rules and features.
+# FollowSymLinks must be enabled for this to work.
+
+ Options +FollowSymlinks
+ RewriteEngine On
+
+ # If you installed CodeIgniter in a subfolder, you will need to
+ # change the following line to match the subfolder you need.
+ # http://httpd.apache.org/docs/current/mod/mod_rewrite.html#rewritebase
+ # RewriteBase /
+
+ # Redirect Trailing Slashes...
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteCond %{REQUEST_URI} (.+)/$
+ RewriteRule ^ %1 [L,R=301]
+
+ # Rewrite "www.example.com -> example.com"
+ RewriteCond %{HTTPS} !=on
+ RewriteCond %{HTTP_HOST} ^www\.(.+)$ [NC]
+ RewriteRule ^ http://%1%{REQUEST_URI} [R=301,L]
+
+ # Checks to see if the user is attempting to access a valid file,
+ # such as an image or css document, if this isn't true it sends the
+ # request to the front controller, index.php
+ RewriteCond %{REQUEST_FILENAME} !-f
+ RewriteCond %{REQUEST_FILENAME} !-d
+ RewriteRule ^([\s\S]*)$ index.php/$1 [L,NC,QSA]
+
+ # Ensure Authorization header is passed along
+ RewriteCond %{HTTP:Authorization} .
+ RewriteRule .* - [E=HTTP_AUTHORIZATION:%{HTTP:Authorization}]
+
+
+
+ # If we don't have mod_rewrite installed, all 404's
+ # can be sent to index.php, and everything works as normal.
+ ErrorDocument 404 index.php
+
+
+# Disable server signature start
+ServerSignature Off
+# Disable server signature end
diff --git a/public/assets/css/style.css b/public/assets/css/style.css
new file mode 100644
index 0000000..69ff1c2
--- /dev/null
+++ b/public/assets/css/style.css
@@ -0,0 +1,1233 @@
+/**
+* Template Name: NiceAdmin
+* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/
+* Updated: Apr 20 2024 with Bootstrap v5.3.3
+* Author: BootstrapMade.com
+* License: https://bootstrapmade.com/license/
+*/
+
+/*--------------------------------------------------------------
+# General
+--------------------------------------------------------------*/
+:root {
+ scroll-behavior: smooth;
+}
+
+body {
+ font-family: "Open Sans", sans-serif;
+ background: #f6f9ff;
+ color: #444444;
+}
+
+a {
+ color: #4154f1;
+ text-decoration: none;
+}
+
+a:hover {
+ color: #717ff5;
+ text-decoration: none;
+}
+
+h1,
+h2,
+h3,
+h4,
+h5,
+h6 {
+ font-family: "Nunito", sans-serif;
+}
+
+/*--------------------------------------------------------------
+# Main
+--------------------------------------------------------------*/
+#main {
+ margin-top: 60px;
+ padding: 20px 30px;
+ transition: all 0.3s;
+}
+
+@media (max-width: 1199px) {
+ #main {
+ padding: 20px;
+ }
+}
+
+/*--------------------------------------------------------------
+# Page Title
+--------------------------------------------------------------*/
+.pagetitle {
+ margin-bottom: 10px;
+}
+
+.pagetitle h1 {
+ font-size: 24px;
+ margin-bottom: 0;
+ font-weight: 600;
+ color: #012970;
+}
+
+/*--------------------------------------------------------------
+# Back to top button
+--------------------------------------------------------------*/
+.back-to-top {
+ position: fixed;
+ visibility: hidden;
+ opacity: 0;
+ right: 15px;
+ bottom: 15px;
+ z-index: 99999;
+ background: #4154f1;
+ width: 40px;
+ height: 40px;
+ border-radius: 4px;
+ transition: all 0.4s;
+}
+
+.back-to-top i {
+ font-size: 24px;
+ color: #fff;
+ line-height: 0;
+}
+
+.back-to-top:hover {
+ background: #6776f4;
+ color: #fff;
+}
+
+.back-to-top.active {
+ visibility: visible;
+ opacity: 1;
+}
+
+/*--------------------------------------------------------------
+# Override some default Bootstrap stylings
+--------------------------------------------------------------*/
+/* Dropdown menus */
+.dropdown-menu {
+ border-radius: 4px;
+ padding: 10px 0;
+ animation-name: dropdown-animate;
+ animation-duration: 0.2s;
+ animation-fill-mode: both;
+ border: 0;
+ box-shadow: 0 5px 30px 0 rgba(82, 63, 105, 0.2);
+}
+
+.dropdown-menu .dropdown-header,
+.dropdown-menu .dropdown-footer {
+ text-align: center;
+ font-size: 15px;
+ padding: 10px 25px;
+}
+
+.dropdown-menu .dropdown-footer a {
+ color: #444444;
+ text-decoration: underline;
+}
+
+.dropdown-menu .dropdown-footer a:hover {
+ text-decoration: none;
+}
+
+.dropdown-menu .dropdown-divider {
+ color: #a5c5fe;
+ margin: 0;
+}
+
+.dropdown-menu .dropdown-item {
+ font-size: 14px;
+ padding: 10px 15px;
+ transition: 0.3s;
+}
+
+.dropdown-menu .dropdown-item i {
+ margin-right: 10px;
+ font-size: 18px;
+ line-height: 0;
+}
+
+.dropdown-menu .dropdown-item:hover {
+ background-color: #f6f9ff;
+}
+
+@media (min-width: 768px) {
+ .dropdown-menu-arrow::before {
+ content: "";
+ width: 13px;
+ height: 13px;
+ background: #fff;
+ position: absolute;
+ top: -7px;
+ right: 20px;
+ transform: rotate(45deg);
+ border-top: 1px solid #eaedf1;
+ border-left: 1px solid #eaedf1;
+ }
+}
+
+@keyframes dropdown-animate {
+ 0% {
+ opacity: 0;
+ }
+
+ 100% {
+ opacity: 1;
+ }
+
+ 0% {
+ opacity: 0;
+ }
+}
+
+/* Light Backgrounds */
+.bg-primary-light {
+ background-color: #cfe2ff;
+ border-color: #cfe2ff;
+}
+
+.bg-secondary-light {
+ background-color: #e2e3e5;
+ border-color: #e2e3e5;
+}
+
+.bg-success-light {
+ background-color: #d1e7dd;
+ border-color: #d1e7dd;
+}
+
+.bg-danger-light {
+ background-color: #f8d7da;
+ border-color: #f8d7da;
+}
+
+.bg-warning-light {
+ background-color: #fff3cd;
+ border-color: #fff3cd;
+}
+
+.bg-info-light {
+ background-color: #cff4fc;
+ border-color: #cff4fc;
+}
+
+.bg-dark-light {
+ background-color: #d3d3d4;
+ border-color: #d3d3d4;
+}
+
+/* Card */
+.card {
+ margin-bottom: 30px;
+ border: none;
+ border-radius: 5px;
+ box-shadow: 0px 0 30px rgba(1, 41, 112, 0.1);
+}
+
+.card-header,
+.card-footer {
+ border-color: #ebeef4;
+ background-color: #fff;
+ color: #798eb3;
+ padding: 15px;
+}
+
+.card-title {
+ padding: 20px 0 15px 0;
+ font-size: 18px;
+ font-weight: 500;
+ color: #012970;
+ font-family: "Poppins", sans-serif;
+}
+
+.card-title span {
+ color: #899bbd;
+ font-size: 14px;
+ font-weight: 400;
+}
+
+.card-body {
+ padding: 0 20px 20px 20px;
+}
+
+.card-img-overlay {
+ background-color: rgba(255, 255, 255, 0.6);
+}
+
+/* Alerts */
+.alert-heading {
+ font-weight: 500;
+ font-family: "Poppins", sans-serif;
+ font-size: 20px;
+}
+
+/* Close Button */
+.btn-close {
+ background-size: 25%;
+}
+
+.btn-close:focus {
+ outline: 0;
+ box-shadow: none;
+}
+
+/* Accordion */
+.accordion-item {
+ border: 1px solid #ebeef4;
+}
+
+.accordion-button:focus {
+ outline: 0;
+ box-shadow: none;
+}
+
+.accordion-button:not(.collapsed) {
+ color: #012970;
+ background-color: #f6f9ff;
+}
+
+.accordion-flush .accordion-button {
+ padding: 15px 0;
+ background: none;
+ border: 0;
+}
+
+.accordion-flush .accordion-button:not(.collapsed) {
+ box-shadow: none;
+ color: #4154f1;
+}
+
+.accordion-flush .accordion-body {
+ padding: 0 0 15px 0;
+ color: #3e4f6f;
+ font-size: 15px;
+}
+
+/* Breadcrumbs */
+.breadcrumb {
+ font-size: 14px;
+ font-family: "Nunito", sans-serif;
+ color: #899bbd;
+ font-weight: 600;
+}
+
+.breadcrumb a {
+ color: #899bbd;
+ transition: 0.3s;
+}
+
+.breadcrumb a:hover {
+ color: #51678f;
+}
+
+.breadcrumb .breadcrumb-item::before {
+ color: #899bbd;
+}
+
+.breadcrumb .active {
+ color: #51678f;
+ font-weight: 600;
+}
+
+/* Bordered Tabs */
+.nav-tabs-bordered {
+ border-bottom: 2px solid #ebeef4;
+}
+
+.nav-tabs-bordered .nav-link {
+ margin-bottom: -2px;
+ border: none;
+ color: #2c384e;
+}
+
+.nav-tabs-bordered .nav-link:hover,
+.nav-tabs-bordered .nav-link:focus {
+ color: #4154f1;
+}
+
+.nav-tabs-bordered .nav-link.active {
+ background-color: #fff;
+ color: #4154f1;
+ border-bottom: 2px solid #4154f1;
+}
+
+/*--------------------------------------------------------------
+# Header
+--------------------------------------------------------------*/
+.logo {
+ line-height: 1;
+}
+
+@media (min-width: 1200px) {
+ .logo {
+ width: 280px;
+ }
+}
+
+.logo img {
+ max-height: 26px;
+ margin-right: 6px;
+}
+
+.logo span {
+ font-size: 26px;
+ font-weight: 700;
+ color: #012970;
+ font-family: "Nunito", sans-serif;
+}
+
+.header {
+ transition: all 0.5s;
+ z-index: 997;
+ height: 60px;
+ box-shadow: 0px 2px 20px rgba(1, 41, 112, 0.1);
+ background-color: #fff;
+ padding-left: 20px;
+ /* Toggle Sidebar Button */
+ /* Search Bar */
+}
+
+.header .toggle-sidebar-btn {
+ font-size: 32px;
+ padding-left: 10px;
+ cursor: pointer;
+ color: #012970;
+}
+
+.header .search-bar {
+ min-width: 360px;
+ padding: 0 20px;
+}
+
+@media (max-width: 1199px) {
+ .header .search-bar {
+ position: fixed;
+ top: 50px;
+ left: 0;
+ right: 0;
+ padding: 20px;
+ box-shadow: 0px 0px 15px 0px rgba(1, 41, 112, 0.1);
+ background: white;
+ z-index: 9999;
+ transition: 0.3s;
+ visibility: hidden;
+ opacity: 0;
+ }
+
+ .header .search-bar-show {
+ top: 60px;
+ visibility: visible;
+ opacity: 1;
+ }
+}
+
+.header .search-form {
+ width: 100%;
+}
+
+.header .search-form input {
+ border: 0;
+ font-size: 14px;
+ color: #012970;
+ border: 1px solid rgba(1, 41, 112, 0.2);
+ padding: 7px 38px 7px 8px;
+ border-radius: 3px;
+ transition: 0.3s;
+ width: 100%;
+}
+
+.header .search-form input:focus,
+.header .search-form input:hover {
+ outline: none;
+ box-shadow: 0 0 10px 0 rgba(1, 41, 112, 0.15);
+ border: 1px solid rgba(1, 41, 112, 0.3);
+}
+
+.header .search-form button {
+ border: 0;
+ padding: 0;
+ margin-left: -30px;
+ background: none;
+}
+
+.header .search-form button i {
+ color: #012970;
+}
+
+/*--------------------------------------------------------------
+# Header Nav
+--------------------------------------------------------------*/
+.header-nav ul {
+ list-style: none;
+}
+
+.header-nav>ul {
+ margin: 0;
+ padding: 0;
+}
+
+.header-nav .nav-icon {
+ font-size: 22px;
+ color: #012970;
+ margin-right: 25px;
+ position: relative;
+}
+
+.header-nav .nav-profile {
+ color: #012970;
+}
+
+.header-nav .nav-profile img {
+ max-height: 36px;
+}
+
+.header-nav .nav-profile span {
+ font-size: 14px;
+ font-weight: 600;
+}
+
+.header-nav .badge-number {
+ position: absolute;
+ inset: -2px -5px auto auto;
+ font-weight: normal;
+ font-size: 12px;
+ padding: 3px 6px;
+}
+
+.header-nav .notifications {
+ inset: 8px -15px auto auto !important;
+}
+
+.header-nav .notifications .notification-item {
+ display: flex;
+ align-items: center;
+ padding: 15px 10px;
+ transition: 0.3s;
+}
+
+.header-nav .notifications .notification-item i {
+ margin: 0 20px 0 10px;
+ font-size: 24px;
+}
+
+.header-nav .notifications .notification-item h4 {
+ font-size: 16px;
+ font-weight: 600;
+ margin-bottom: 5px;
+}
+
+.header-nav .notifications .notification-item p {
+ font-size: 13px;
+ margin-bottom: 3px;
+ color: #919191;
+}
+
+.header-nav .notifications .notification-item:hover {
+ background-color: #f6f9ff;
+}
+
+.header-nav .messages {
+ inset: 8px -15px auto auto !important;
+}
+
+.header-nav .messages .message-item {
+ padding: 15px 10px;
+ transition: 0.3s;
+}
+
+.header-nav .messages .message-item a {
+ display: flex;
+}
+
+.header-nav .messages .message-item img {
+ margin: 0 20px 0 10px;
+ max-height: 40px;
+}
+
+.header-nav .messages .message-item h4 {
+ font-size: 16px;
+ font-weight: 600;
+ margin-bottom: 5px;
+ color: #444444;
+}
+
+.header-nav .messages .message-item p {
+ font-size: 13px;
+ margin-bottom: 3px;
+ color: #919191;
+}
+
+.header-nav .messages .message-item:hover {
+ background-color: #f6f9ff;
+}
+
+.header-nav .profile {
+ min-width: 240px;
+ padding-bottom: 0;
+ top: 8px !important;
+}
+
+.header-nav .profile .dropdown-header h6 {
+ font-size: 18px;
+ margin-bottom: 0;
+ font-weight: 600;
+ color: #444444;
+}
+
+.header-nav .profile .dropdown-header span {
+ font-size: 14px;
+}
+
+.header-nav .profile .dropdown-item {
+ font-size: 14px;
+ padding: 10px 15px;
+ transition: 0.3s;
+}
+
+.header-nav .profile .dropdown-item i {
+ margin-right: 10px;
+ font-size: 18px;
+ line-height: 0;
+}
+
+.header-nav .profile .dropdown-item:hover {
+ background-color: #f6f9ff;
+}
+
+/*--------------------------------------------------------------
+# Sidebar
+--------------------------------------------------------------*/
+.sidebar {
+ position: fixed;
+ top: 60px;
+ left: 0;
+ bottom: 0;
+ width: 300px;
+ z-index: 996;
+ transition: all 0.3s;
+ padding: 20px;
+ overflow-y: auto;
+ scrollbar-width: thin;
+ scrollbar-color: #aab7cf transparent;
+ box-shadow: 0px 0px 20px rgba(1, 41, 112, 0.1);
+ background-color: #fff;
+}
+
+@media (max-width: 1199px) {
+ .sidebar {
+ left: -300px;
+ }
+}
+
+.sidebar::-webkit-scrollbar {
+ width: 5px;
+ height: 8px;
+ background-color: #fff;
+}
+
+.sidebar::-webkit-scrollbar-thumb {
+ background-color: #aab7cf;
+}
+
+@media (min-width: 1200px) {
+
+ #main,
+ #footer {
+ margin-left: 300px;
+ }
+}
+
+@media (max-width: 1199px) {
+ .toggle-sidebar .sidebar {
+ left: 0;
+ }
+}
+
+@media (min-width: 1200px) {
+
+ .toggle-sidebar #main,
+ .toggle-sidebar #footer {
+ margin-left: 0;
+ }
+
+ .toggle-sidebar .sidebar {
+ left: -300px;
+ }
+}
+
+.sidebar-nav {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+}
+
+.sidebar-nav li {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+}
+
+.sidebar-nav .nav-item {
+ margin-bottom: 5px;
+}
+
+.sidebar-nav .nav-heading {
+ font-size: 11px;
+ text-transform: uppercase;
+ color: #899bbd;
+ font-weight: 600;
+ margin: 10px 0 5px 15px;
+}
+
+.sidebar-nav .nav-link {
+ display: flex;
+ align-items: center;
+ font-size: 15px;
+ font-weight: 600;
+ color: #4154f1;
+ transition: 0.3;
+ background: #f6f9ff;
+ padding: 10px 15px;
+ border-radius: 4px;
+}
+
+.sidebar-nav .nav-link i {
+ font-size: 16px;
+ margin-right: 10px;
+ color: #4154f1;
+}
+
+.sidebar-nav .nav-link.collapsed {
+ color: #012970;
+ background: #fff;
+}
+
+.sidebar-nav .nav-link.collapsed i {
+ color: #899bbd;
+}
+
+.sidebar-nav .nav-link:hover {
+ color: #4154f1;
+ background: #f6f9ff;
+}
+
+.sidebar-nav .nav-link:hover i {
+ color: #4154f1;
+}
+
+.sidebar-nav .nav-link .bi-chevron-down {
+ margin-right: 0;
+ transition: transform 0.2s ease-in-out;
+}
+
+.sidebar-nav .nav-link:not(.collapsed) .bi-chevron-down {
+ transform: rotate(180deg);
+}
+
+.sidebar-nav .nav-content {
+ padding: 5px 0 0 0;
+ margin: 0;
+ list-style: none;
+}
+
+.sidebar-nav .nav-content a {
+ display: flex;
+ align-items: center;
+ font-size: 14px;
+ font-weight: 600;
+ color: #012970;
+ transition: 0.3;
+ padding: 10px 0 10px 40px;
+ transition: 0.3s;
+}
+
+.sidebar-nav .nav-content a i {
+ font-size: 6px;
+ margin-right: 8px;
+ line-height: 0;
+ border-radius: 50%;
+}
+
+.sidebar-nav .nav-content a:hover,
+.sidebar-nav .nav-content a.active {
+ color: #4154f1;
+}
+
+.sidebar-nav .nav-content a.active i {
+ background-color: #4154f1;
+}
+
+/*--------------------------------------------------------------
+# Dashboard
+--------------------------------------------------------------*/
+/* Filter dropdown */
+.dashboard .filter {
+ position: absolute;
+ right: 0px;
+ top: 15px;
+}
+
+.dashboard .filter .icon {
+ color: #aab7cf;
+ padding-right: 20px;
+ padding-bottom: 5px;
+ transition: 0.3s;
+ font-size: 16px;
+}
+
+.dashboard .filter .icon:hover,
+.dashboard .filter .icon:focus {
+ color: #4154f1;
+}
+
+.dashboard .filter .dropdown-header {
+ padding: 8px 15px;
+}
+
+.dashboard .filter .dropdown-header h6 {
+ text-transform: uppercase;
+ font-size: 14px;
+ font-weight: 600;
+ letter-spacing: 1px;
+ color: #aab7cf;
+ margin-bottom: 0;
+ padding: 0;
+}
+
+.dashboard .filter .dropdown-item {
+ padding: 8px 15px;
+}
+
+/* Info Cards */
+.dashboard .info-card {
+ padding-bottom: 10px;
+}
+
+.dashboard .info-card h6 {
+ font-size: 28px;
+ color: #012970;
+ font-weight: 700;
+ margin: 0;
+ padding: 0;
+}
+
+.dashboard .card-icon {
+ font-size: 32px;
+ line-height: 0;
+ width: 64px;
+ height: 64px;
+ flex-shrink: 0;
+ flex-grow: 0;
+}
+
+.dashboard .sales-card .card-icon {
+ color: #4154f1;
+ background: #f6f6fe;
+}
+
+.dashboard .revenue-card .card-icon {
+ color: #2eca6a;
+ background: #e0f8e9;
+}
+
+.dashboard .customers-card .card-icon {
+ color: #ff771d;
+ background: #ffecdf;
+}
+
+/* Activity */
+.dashboard .activity {
+ font-size: 14px;
+}
+
+.dashboard .activity .activity-item .activite-label {
+ color: #888;
+ position: relative;
+ flex-shrink: 0;
+ flex-grow: 0;
+ min-width: 64px;
+}
+
+.dashboard .activity .activity-item .activite-label::before {
+ content: "";
+ position: absolute;
+ right: -11px;
+ width: 4px;
+ top: 0;
+ bottom: 0;
+ background-color: #eceefe;
+}
+
+.dashboard .activity .activity-item .activity-badge {
+ margin-top: 3px;
+ z-index: 1;
+ font-size: 11px;
+ line-height: 0;
+ border-radius: 50%;
+ flex-shrink: 0;
+ border: 3px solid #fff;
+ flex-grow: 0;
+}
+
+.dashboard .activity .activity-item .activity-content {
+ padding-left: 10px;
+ padding-bottom: 20px;
+}
+
+.dashboard .activity .activity-item:first-child .activite-label::before {
+ top: 5px;
+}
+
+.dashboard .activity .activity-item:last-child .activity-content {
+ padding-bottom: 0;
+}
+
+/* News & Updates */
+.dashboard .news .post-item+.post-item {
+ margin-top: 15px;
+}
+
+.dashboard .news img {
+ width: 80px;
+ float: left;
+ border-radius: 5px;
+}
+
+.dashboard .news h4 {
+ font-size: 15px;
+ margin-left: 95px;
+ font-weight: bold;
+ margin-bottom: 5px;
+}
+
+.dashboard .news h4 a {
+ color: #012970;
+ transition: 0.3s;
+}
+
+.dashboard .news h4 a:hover {
+ color: #4154f1;
+}
+
+.dashboard .news p {
+ font-size: 14px;
+ color: #777777;
+ margin-left: 95px;
+}
+
+/* Recent Sales */
+.dashboard .recent-sales {
+ font-size: 14px;
+}
+
+.dashboard .recent-sales .table thead {
+ background: #f6f6fe;
+}
+
+.dashboard .recent-sales .table thead th {
+ border: 0;
+}
+
+.dashboard .recent-sales .dataTable-top {
+ padding: 0 0 10px 0;
+}
+
+.dashboard .recent-sales .dataTable-bottom {
+ padding: 10px 0 0 0;
+}
+
+/* Top Selling */
+.dashboard .top-selling {
+ font-size: 14px;
+}
+
+.dashboard .top-selling .table thead {
+ background: #f6f6fe;
+}
+
+.dashboard .top-selling .table thead th {
+ border: 0;
+}
+
+.dashboard .top-selling .table tbody td {
+ vertical-align: middle;
+}
+
+.dashboard .top-selling img {
+ border-radius: 5px;
+ max-width: 60px;
+}
+
+/*--------------------------------------------------------------
+# Icons list page
+--------------------------------------------------------------*/
+.iconslist {
+ display: grid;
+ max-width: 100%;
+ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
+ gap: 1.25rem;
+ padding-top: 15px;
+}
+
+.iconslist .icon {
+ background-color: #fff;
+ border-radius: 0.25rem;
+ text-align: center;
+ color: #012970;
+ padding: 15px 0;
+}
+
+.iconslist i {
+ margin: 0.25rem;
+ font-size: 2.5rem;
+}
+
+.iconslist .label {
+ font-family: var(--bs-font-monospace);
+ display: inline-block;
+ width: 100%;
+ overflow: hidden;
+ padding: 0.25rem;
+ font-size: 12px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: #666;
+}
+
+/*--------------------------------------------------------------
+# Profie Page
+--------------------------------------------------------------*/
+.profile .profile-card img {
+ max-width: 120px;
+}
+
+.profile .profile-card h2 {
+ font-size: 24px;
+ font-weight: 700;
+ color: #2c384e;
+ margin: 10px 0 0 0;
+}
+
+.profile .profile-card h3 {
+ font-size: 18px;
+}
+
+.profile .profile-card .social-links a {
+ font-size: 20px;
+ display: inline-block;
+ color: rgba(1, 41, 112, 0.5);
+ line-height: 0;
+ margin-right: 10px;
+ transition: 0.3s;
+}
+
+.profile .profile-card .social-links a:hover {
+ color: #012970;
+}
+
+.profile .profile-overview .row {
+ margin-bottom: 20px;
+ font-size: 15px;
+}
+
+.profile .profile-overview .card-title {
+ color: #012970;
+}
+
+.profile .profile-overview .label {
+ font-weight: 600;
+ color: rgba(1, 41, 112, 0.6);
+}
+
+.profile .profile-edit label {
+ font-weight: 600;
+ color: rgba(1, 41, 112, 0.6);
+}
+
+.profile .profile-edit img {
+ max-width: 120px;
+}
+
+/*--------------------------------------------------------------
+# F.A.Q Page
+--------------------------------------------------------------*/
+.faq .basic h6 {
+ font-size: 18px;
+ font-weight: 600;
+ color: #4154f1;
+}
+
+.faq .basic p {
+ color: #6980aa;
+}
+
+/*--------------------------------------------------------------
+# Contact
+--------------------------------------------------------------*/
+.contact .info-box {
+ padding: 28px 30px;
+}
+
+.contact .info-box i {
+ font-size: 38px;
+ line-height: 0;
+ color: #4154f1;
+}
+
+.contact .info-box h3 {
+ font-size: 20px;
+ color: #012970;
+ font-weight: 700;
+ margin: 20px 0 10px 0;
+}
+
+.contact .info-box p {
+ padding: 0;
+ line-height: 24px;
+ font-size: 14px;
+ margin-bottom: 0;
+}
+
+.contact .php-email-form .error-message {
+ display: none;
+ color: #fff;
+ background: #ed3c0d;
+ text-align: left;
+ padding: 15px;
+ margin-bottom: 24px;
+ font-weight: 600;
+}
+
+.contact .php-email-form .sent-message {
+ display: none;
+ color: #fff;
+ background: #18d26e;
+ text-align: center;
+ padding: 15px;
+ margin-bottom: 24px;
+ font-weight: 600;
+}
+
+.contact .php-email-form .loading {
+ display: none;
+ background: #fff;
+ text-align: center;
+ padding: 15px;
+ margin-bottom: 24px;
+}
+
+.contact .php-email-form .loading:before {
+ content: "";
+ display: inline-block;
+ border-radius: 50%;
+ width: 24px;
+ height: 24px;
+ margin: 0 10px -6px 0;
+ border: 3px solid #18d26e;
+ border-top-color: #eee;
+ animation: animate-loading 1s linear infinite;
+}
+
+.contact .php-email-form input,
+.contact .php-email-form textarea {
+ border-radius: 0;
+ box-shadow: none;
+ font-size: 14px;
+ border-radius: 0;
+}
+
+.contact .php-email-form input:focus,
+.contact .php-email-form textarea:focus {
+ border-color: #4154f1;
+}
+
+.contact .php-email-form input {
+ padding: 10px 15px;
+}
+
+.contact .php-email-form textarea {
+ padding: 12px 15px;
+}
+
+.contact .php-email-form button[type=submit] {
+ background: #4154f1;
+ border: 0;
+ padding: 10px 30px;
+ color: #fff;
+ transition: 0.4s;
+ border-radius: 4px;
+}
+
+.contact .php-email-form button[type=submit]:hover {
+ background: #5969f3;
+}
+
+@keyframes animate-loading {
+ 0% {
+ transform: rotate(0deg);
+ }
+
+ 100% {
+ transform: rotate(360deg);
+ }
+}
+
+/*--------------------------------------------------------------
+# Error 404
+--------------------------------------------------------------*/
+.error-404 {
+ padding: 30px;
+}
+
+.error-404 h1 {
+ font-size: 180px;
+ font-weight: 700;
+ color: #4154f1;
+ margin-bottom: 0;
+ line-height: 150px;
+}
+
+.error-404 h2 {
+ font-size: 24px;
+ font-weight: 700;
+ color: #012970;
+ margin-bottom: 30px;
+}
+
+.error-404 .btn {
+ background: #51678f;
+ color: #fff;
+ padding: 8px 30px;
+}
+
+.error-404 .btn:hover {
+ background: #3e4f6f;
+}
+
+@media (min-width: 992px) {
+ .error-404 img {
+ max-width: 50%;
+ }
+}
+
+/*--------------------------------------------------------------
+# Footer
+--------------------------------------------------------------*/
+.footer {
+ padding: 20px 0;
+ font-size: 14px;
+ transition: all 0.3s;
+ border-top: 1px solid #cddfff;
+}
+
+.footer .copyright {
+ text-align: center;
+ color: #012970;
+}
+
+.footer .credits {
+ padding-top: 5px;
+ text-align: center;
+ font-size: 13px;
+ color: #012970;
+}
\ No newline at end of file
diff --git a/public/assets/images/no_image.svg b/public/assets/images/no_image.svg
new file mode 100644
index 0000000..0b3518c
--- /dev/null
+++ b/public/assets/images/no_image.svg
@@ -0,0 +1,5 @@
+
+
+
+ No Image
+
diff --git a/public/assets/img/apple-touch-icon.png b/public/assets/img/apple-touch-icon.png
new file mode 100644
index 0000000..78b2586
Binary files /dev/null and b/public/assets/img/apple-touch-icon.png differ
diff --git a/public/assets/img/card.jpg b/public/assets/img/card.jpg
new file mode 100644
index 0000000..3ee97ef
Binary files /dev/null and b/public/assets/img/card.jpg differ
diff --git a/public/assets/img/favicon.png b/public/assets/img/favicon.png
new file mode 100644
index 0000000..f9bc174
Binary files /dev/null and b/public/assets/img/favicon.png differ
diff --git a/public/assets/img/logo.png b/public/assets/img/logo.png
new file mode 100644
index 0000000..9cfbaf2
Binary files /dev/null and b/public/assets/img/logo.png differ
diff --git a/public/assets/img/messages-1.jpg b/public/assets/img/messages-1.jpg
new file mode 100644
index 0000000..a337d97
Binary files /dev/null and b/public/assets/img/messages-1.jpg differ
diff --git a/public/assets/img/messages-2.jpg b/public/assets/img/messages-2.jpg
new file mode 100644
index 0000000..1d75b4e
Binary files /dev/null and b/public/assets/img/messages-2.jpg differ
diff --git a/public/assets/img/messages-3.jpg b/public/assets/img/messages-3.jpg
new file mode 100644
index 0000000..390712b
Binary files /dev/null and b/public/assets/img/messages-3.jpg differ
diff --git a/public/assets/img/news-1.jpg b/public/assets/img/news-1.jpg
new file mode 100644
index 0000000..a2c77f1
Binary files /dev/null and b/public/assets/img/news-1.jpg differ
diff --git a/public/assets/img/news-2.jpg b/public/assets/img/news-2.jpg
new file mode 100644
index 0000000..8a39581
Binary files /dev/null and b/public/assets/img/news-2.jpg differ
diff --git a/public/assets/img/news-3.jpg b/public/assets/img/news-3.jpg
new file mode 100644
index 0000000..710ec0a
Binary files /dev/null and b/public/assets/img/news-3.jpg differ
diff --git a/public/assets/img/news-4.jpg b/public/assets/img/news-4.jpg
new file mode 100644
index 0000000..81caaf3
Binary files /dev/null and b/public/assets/img/news-4.jpg differ
diff --git a/public/assets/img/news-5.jpg b/public/assets/img/news-5.jpg
new file mode 100644
index 0000000..779068f
Binary files /dev/null and b/public/assets/img/news-5.jpg differ
diff --git a/public/assets/img/not-found.svg b/public/assets/img/not-found.svg
new file mode 100644
index 0000000..3822279
--- /dev/null
+++ b/public/assets/img/not-found.svg
@@ -0,0 +1 @@
+not found
\ No newline at end of file
diff --git a/public/assets/img/product-1.jpg b/public/assets/img/product-1.jpg
new file mode 100644
index 0000000..10ea6ea
Binary files /dev/null and b/public/assets/img/product-1.jpg differ
diff --git a/public/assets/img/product-2.jpg b/public/assets/img/product-2.jpg
new file mode 100644
index 0000000..1b879f6
Binary files /dev/null and b/public/assets/img/product-2.jpg differ
diff --git a/public/assets/img/product-3.jpg b/public/assets/img/product-3.jpg
new file mode 100644
index 0000000..595f121
Binary files /dev/null and b/public/assets/img/product-3.jpg differ
diff --git a/public/assets/img/product-4.jpg b/public/assets/img/product-4.jpg
new file mode 100644
index 0000000..44c5bf3
Binary files /dev/null and b/public/assets/img/product-4.jpg differ
diff --git a/public/assets/img/product-5.jpg b/public/assets/img/product-5.jpg
new file mode 100644
index 0000000..f3fbb0e
Binary files /dev/null and b/public/assets/img/product-5.jpg differ
diff --git a/public/assets/img/profile-img.jpg b/public/assets/img/profile-img.jpg
new file mode 100644
index 0000000..16ac229
Binary files /dev/null and b/public/assets/img/profile-img.jpg differ
diff --git a/public/assets/img/slides-1.jpg b/public/assets/img/slides-1.jpg
new file mode 100644
index 0000000..a37af6c
Binary files /dev/null and b/public/assets/img/slides-1.jpg differ
diff --git a/public/assets/img/slides-2.jpg b/public/assets/img/slides-2.jpg
new file mode 100644
index 0000000..e859463
Binary files /dev/null and b/public/assets/img/slides-2.jpg differ
diff --git a/public/assets/img/slides-3.jpg b/public/assets/img/slides-3.jpg
new file mode 100644
index 0000000..66c6868
Binary files /dev/null and b/public/assets/img/slides-3.jpg differ
diff --git a/public/assets/js/main.js b/public/assets/js/main.js
new file mode 100644
index 0000000..b390c6c
--- /dev/null
+++ b/public/assets/js/main.js
@@ -0,0 +1,319 @@
+/**
+* Template Name: NiceAdmin
+* Template URL: https://bootstrapmade.com/nice-admin-bootstrap-admin-html-template/
+* Updated: Apr 20 2024 with Bootstrap v5.3.3
+* Author: BootstrapMade.com
+* License: https://bootstrapmade.com/license/
+*/
+
+(function() {
+ "use strict";
+
+ /**
+ * Easy selector helper function
+ */
+ const select = (el, all = false) => {
+ el = el.trim()
+ if (all) {
+ return [...document.querySelectorAll(el)]
+ } else {
+ return document.querySelector(el)
+ }
+ }
+
+ /**
+ * Easy event listener function
+ */
+ const on = (type, el, listener, all = false) => {
+ if (all) {
+ select(el, all).forEach(e => e.addEventListener(type, listener))
+ } else {
+ select(el, all).addEventListener(type, listener)
+ }
+ }
+
+ /**
+ * Easy on scroll event listener
+ */
+ const onscroll = (el, listener) => {
+ el.addEventListener('scroll', listener)
+ }
+
+ /**
+ * Sidebar toggle
+ */
+ if (select('.toggle-sidebar-btn')) {
+ on('click', '.toggle-sidebar-btn', function(e) {
+ select('body').classList.toggle('toggle-sidebar')
+ })
+ }
+
+ /**
+ * Search bar toggle
+ */
+ if (select('.search-bar-toggle')) {
+ on('click', '.search-bar-toggle', function(e) {
+ select('.search-bar').classList.toggle('search-bar-show')
+ })
+ }
+
+ /**
+ * Navbar links active state on scroll
+ */
+ let navbarlinks = select('#navbar .scrollto', true)
+ const navbarlinksActive = () => {
+ let position = window.scrollY + 200
+ navbarlinks.forEach(navbarlink => {
+ if (!navbarlink.hash) return
+ let section = select(navbarlink.hash)
+ if (!section) return
+ if (position >= section.offsetTop && position <= (section.offsetTop + section.offsetHeight)) {
+ navbarlink.classList.add('active')
+ } else {
+ navbarlink.classList.remove('active')
+ }
+ })
+ }
+ window.addEventListener('load', navbarlinksActive)
+ onscroll(document, navbarlinksActive)
+
+ /**
+ * Toggle .header-scrolled class to #header when page is scrolled
+ */
+ let selectHeader = select('#header')
+ if (selectHeader) {
+ const headerScrolled = () => {
+ if (window.scrollY > 100) {
+ selectHeader.classList.add('header-scrolled')
+ } else {
+ selectHeader.classList.remove('header-scrolled')
+ }
+ }
+ window.addEventListener('load', headerScrolled)
+ onscroll(document, headerScrolled)
+ }
+
+ /**
+ * Back to top button
+ */
+ let backtotop = select('.back-to-top')
+ if (backtotop) {
+ const toggleBacktotop = () => {
+ if (window.scrollY > 100) {
+ backtotop.classList.add('active')
+ } else {
+ backtotop.classList.remove('active')
+ }
+ }
+ window.addEventListener('load', toggleBacktotop)
+ onscroll(document, toggleBacktotop)
+ }
+
+ /**
+ * Initiate tooltips
+ */
+ var tooltipTriggerList = [].slice.call(document.querySelectorAll('[data-bs-toggle="tooltip"]'))
+ var tooltipList = tooltipTriggerList.map(function(tooltipTriggerEl) {
+ return new bootstrap.Tooltip(tooltipTriggerEl)
+ })
+
+ /**
+ * Initiate quill editors
+ */
+ if (select('.quill-editor-default')) {
+ new Quill('.quill-editor-default', {
+ theme: 'snow'
+ });
+ }
+
+ if (select('.quill-editor-bubble')) {
+ new Quill('.quill-editor-bubble', {
+ theme: 'bubble'
+ });
+ }
+
+ if (select('.quill-editor-full')) {
+ new Quill(".quill-editor-full", {
+ modules: {
+ toolbar: [
+ [{
+ font: []
+ }, {
+ size: []
+ }],
+ ["bold", "italic", "underline", "strike"],
+ [{
+ color: []
+ },
+ {
+ background: []
+ }
+ ],
+ [{
+ script: "super"
+ },
+ {
+ script: "sub"
+ }
+ ],
+ [{
+ list: "ordered"
+ },
+ {
+ list: "bullet"
+ },
+ {
+ indent: "-1"
+ },
+ {
+ indent: "+1"
+ }
+ ],
+ ["direction", {
+ align: []
+ }],
+ ["link", "image", "video"],
+ ["clean"]
+ ]
+ },
+ theme: "snow"
+ });
+ }
+
+ /**
+ * Initiate TinyMCE Editor
+ */
+
+ const useDarkMode = window.matchMedia('(prefers-color-scheme: dark)').matches;
+ const isSmallScreen = window.matchMedia('(max-width: 1023.5px)').matches;
+
+ tinymce.init({
+ selector: 'textarea.tinymce-editor',
+ plugins: 'preview importcss searchreplace autolink autosave save directionality code visualblocks visualchars fullscreen image link media codesample table charmap pagebreak nonbreaking anchor insertdatetime advlist lists wordcount help charmap quickbars emoticons accordion',
+ editimage_cors_hosts: ['picsum.photos'],
+ menubar: 'file edit view insert format tools table help',
+ toolbar: "undo redo | accordion accordionremove | blocks fontfamily fontsize | bold italic underline strikethrough | align numlist bullist | link image | table media | lineheight outdent indent| forecolor backcolor removeformat | charmap emoticons | code fullscreen preview | save print | pagebreak anchor codesample | ltr rtl",
+ autosave_ask_before_unload: true,
+ autosave_interval: '30s',
+ autosave_prefix: '{path}{query}-{id}-',
+ autosave_restore_when_empty: false,
+ autosave_retention: '2m',
+ image_advtab: true,
+ link_list: [{
+ title: 'My page 1',
+ value: 'https://www.tiny.cloud'
+ },
+ {
+ title: 'My page 2',
+ value: 'http://www.moxiecode.com'
+ }
+ ],
+ image_list: [{
+ title: 'My page 1',
+ value: 'https://www.tiny.cloud'
+ },
+ {
+ title: 'My page 2',
+ value: 'http://www.moxiecode.com'
+ }
+ ],
+ image_class_list: [{
+ title: 'None',
+ value: ''
+ },
+ {
+ title: 'Some class',
+ value: 'class-name'
+ }
+ ],
+ importcss_append: true,
+ file_picker_callback: (callback, value, meta) => {
+ /* Provide file and text for the link dialog */
+ if (meta.filetype === 'file') {
+ callback('https://www.google.com/logos/google.jpg', {
+ text: 'My text'
+ });
+ }
+
+ /* Provide image and alt text for the image dialog */
+ if (meta.filetype === 'image') {
+ callback('https://www.google.com/logos/google.jpg', {
+ alt: 'My alt text'
+ });
+ }
+
+ /* Provide alternative source and posted for the media dialog */
+ if (meta.filetype === 'media') {
+ callback('movie.mp4', {
+ source2: 'alt.ogg',
+ poster: 'https://www.google.com/logos/google.jpg'
+ });
+ }
+ },
+ height: 600,
+ image_caption: true,
+ quickbars_selection_toolbar: 'bold italic | quicklink h2 h3 blockquote quickimage quicktable',
+ noneditable_class: 'mceNonEditable',
+ toolbar_mode: 'sliding',
+ contextmenu: 'link image table',
+ skin: useDarkMode ? 'oxide-dark' : 'oxide',
+ content_css: useDarkMode ? 'dark' : 'default',
+ content_style: 'body { font-family:Helvetica,Arial,sans-serif; font-size:16px }'
+ });
+
+ /**
+ * Initiate Bootstrap validation check
+ */
+ var needsValidation = document.querySelectorAll('.needs-validation')
+
+ Array.prototype.slice.call(needsValidation)
+ .forEach(function(form) {
+ form.addEventListener('submit', function(event) {
+ if (!form.checkValidity()) {
+ event.preventDefault()
+ event.stopPropagation()
+ }
+
+ form.classList.add('was-validated')
+ }, false)
+ })
+
+ /**
+ * Initiate Datatables
+ */
+ const datatables = select('.datatable', true)
+ datatables.forEach(datatable => {
+ new simpleDatatables.DataTable(datatable, {
+ perPageSelect: [5, 10, 15, ["All", -1]],
+ columns: [{
+ select: 2,
+ sortSequence: ["desc", "asc"]
+ },
+ {
+ select: 3,
+ sortSequence: ["desc"]
+ },
+ {
+ select: 4,
+ cellClass: "green",
+ headerClass: "red"
+ }
+ ]
+ });
+ })
+
+ /**
+ * Autoresize echart charts
+ */
+ const mainContainer = select('#main');
+ if (mainContainer) {
+ setTimeout(() => {
+ new ResizeObserver(function() {
+ select('.echart', true).forEach(getEchart => {
+ echarts.getInstanceByDom(getEchart).resize();
+ })
+ }).observe(mainContainer);
+ }, 200);
+ }
+
+})();
\ No newline at end of file
diff --git a/public/assets/scss/_dashboard.scss b/public/assets/scss/_dashboard.scss
new file mode 100644
index 0000000..810f6d5
--- /dev/null
+++ b/public/assets/scss/_dashboard.scss
@@ -0,0 +1,226 @@
+/*--------------------------------------------------------------
+# Dashboard
+--------------------------------------------------------------*/
+/* Filter dropdown */
+.dashboard {
+
+ .filter {
+ position: absolute;
+ right: 0px;
+ top: 15px;
+
+ .icon {
+ color: lighten($tertiary, 50);
+ padding-right: 20px;
+ padding-bottom: 5px;
+ transition: 0.3s;
+ font-size: 16px;
+ &:hover, &:focus {
+ color: $primary;
+ }
+ }
+
+ .dropdown-header {
+ padding: 8px 15px;
+ }
+
+ .dropdown-header h6 {
+ text-transform: uppercase;
+ font-size: 14px;
+ font-weight: 600;
+ letter-spacing: 1px;
+ color: lighten($tertiary, 50);
+ margin-bottom: 0;
+ padding: 0;
+ }
+
+ .dropdown-item {
+ padding: 8px 15px;
+ }
+ }
+}
+
+/* Info Cards */
+.dashboard {
+ .info-card {
+ padding-bottom: 10px;
+ h6 {
+ font-size: 28px;
+ color: $secondary;
+ font-weight: 700;
+ margin: 0;
+ padding: 0;
+ }
+ }
+
+ .card-icon {
+ font-size: 32px;
+ line-height: 0;
+ width: 64px;
+ height: 64px;
+ flex-shrink: 0;
+ flex-grow: 0;
+ }
+
+ .sales-card {
+ .card-icon {
+ color: $primary;
+ background: lighten($primary, 38);
+ }
+ }
+
+ .revenue-card {
+ .card-icon {
+ color: #2eca6a;
+ background: lighten(#2eca6a, 44);
+ }
+ }
+
+ .customers-card {
+ .card-icon {
+ color: #ff771d;
+ background: lighten(#ff771d, 38);
+ }
+ }
+}
+
+/* Activity */
+.dashboard {
+ .activity {
+ font-size: 14px;
+
+ .activity-item {
+
+ .activite-label {
+ color: #888;
+ position: relative;
+ flex-shrink: 0;
+ flex-grow: 0;
+ min-width: 64px;
+
+ &::before {
+ content: "";
+ position: absolute;
+ right: -11px;
+ width: 4px;
+ top: 0;
+ bottom: 0;
+ background-color: lighten($primary, 36);
+ }
+ }
+
+ .activity-badge {
+ margin-top: 3px;
+ z-index: 1;
+ font-size: 11px;
+ line-height: 0;
+ border-radius: 50%;
+ flex-shrink: 0;
+ border: 3px solid #fff;
+ flex-grow: 0;
+ }
+
+ .activity-content {
+ padding-left: 10px;
+ padding-bottom: 20px;
+ }
+
+ &:first-child .activite-label::before {
+ top: 5px;
+ }
+
+ &:last-child .activity-content {
+ padding-bottom: 0;
+ }
+
+ }
+
+ }
+
+}
+
+/* News & Updates */
+.dashboard {
+ .news {
+ .post-item + .post-item {
+ margin-top: 15px;
+ }
+
+ img {
+ width: 80px;
+ float: left;
+ border-radius: 5px;
+ }
+
+ h4 {
+ font-size: 15px;
+ margin-left: 95px;
+ font-weight: bold;
+ margin-bottom: 5px;
+ a {
+ color: $secondary;
+ transition: 0.3s;
+ &:hover {
+ color: $primary;
+ }
+ }
+ }
+
+ p {
+ font-size: 14px;
+ color: lighten($default, 20);
+ margin-left: 95px;
+ }
+
+ }
+}
+
+/* Recent Sales */
+.dashboard {
+ .recent-sales {
+ font-size: 14px;
+ .table thead {
+ background: lighten($primary, 38);
+ th {
+ border: 0;
+ }
+ }
+
+ .dataTable-top {
+ padding: 0 0 10px 0;
+ }
+
+ .dataTable-bottom {
+ padding: 10px 0 0 0;
+ }
+
+ }
+}
+
+/* Top Selling */
+.dashboard {
+
+ .top-selling {
+ font-size: 14px;
+ .table {
+ thead {
+ background: lighten($primary, 38);
+ th {
+ border: 0;
+ }
+ }
+
+ tbody td {
+ vertical-align: middle;
+ }
+
+ }
+
+ img {
+ border-radius: 5px;
+ max-width: 60px;
+ }
+
+
+ }
+}
diff --git a/public/assets/scss/_footer.scss b/public/assets/scss/_footer.scss
new file mode 100644
index 0000000..b1b811e
--- /dev/null
+++ b/public/assets/scss/_footer.scss
@@ -0,0 +1,21 @@
+/*--------------------------------------------------------------
+# Footer
+--------------------------------------------------------------*/
+.footer {
+ padding: 20px 0;
+ font-size: 14px;
+ transition: all 0.3s;
+ border-top: 1px solid lighten($secondary, 68);
+
+ .copyright {
+ text-align: center;
+ color: $secondary;
+ }
+
+ .credits {
+ padding-top: 5px;
+ text-align: center;
+ font-size: 13px;
+ color: $secondary;
+ }
+}
diff --git a/public/assets/scss/_general.scss b/public/assets/scss/_general.scss
new file mode 100644
index 0000000..ae21ba2
--- /dev/null
+++ b/public/assets/scss/_general.scss
@@ -0,0 +1,85 @@
+/*--------------------------------------------------------------
+# General
+--------------------------------------------------------------*/
+:root {
+ scroll-behavior: smooth;
+}
+
+body {
+ font-family: $font-default;
+ background: lighten($secondary, 76);
+ color: $default;
+}
+
+a {
+ color: $primary;
+ text-decoration: none;
+}
+
+a:hover {
+ color: lighten($primary, 10);
+ text-decoration: none;
+}
+
+h1, h2, h3, h4, h5, h6 {
+ font-family: $font-primary;
+}
+
+/*--------------------------------------------------------------
+# Main
+--------------------------------------------------------------*/
+#main {
+ margin-top: 60px;
+ padding: 20px 30px;
+ transition: all 0.3s;
+ @media (max-width: 1199px) {
+ padding: 20px;
+ }
+}
+
+/*--------------------------------------------------------------
+# Page Title
+--------------------------------------------------------------*/
+.pagetitle {
+ margin-bottom: 10px;
+ h1 {
+ font-size: 24px;
+ margin-bottom: 0;
+ font-weight: 600;
+ color: $secondary;
+ }
+}
+
+/*--------------------------------------------------------------
+# Back to top button
+--------------------------------------------------------------*/
+.back-to-top {
+ position: fixed;
+ visibility: hidden;
+ opacity: 0;
+ right:15px;
+ bottom: 15px;
+ z-index: 99999;
+ background: $primary;
+ width: 40px;
+ height: 40px;
+ border-radius: 4px;
+ transition: all 0.4s;
+
+ i {
+ font-size: 24px;
+ color: #fff;
+ line-height: 0;
+ }
+
+ &:hover {
+ background: lighten($primary, 8);
+ color: #fff;
+ }
+
+ &.active {
+ visibility: visible;
+ opacity: 1;
+ }
+
+}
diff --git a/public/assets/scss/_header.scss b/public/assets/scss/_header.scss
new file mode 100644
index 0000000..31d6b4d
--- /dev/null
+++ b/public/assets/scss/_header.scss
@@ -0,0 +1,238 @@
+/*--------------------------------------------------------------
+# Header
+--------------------------------------------------------------*/
+.logo {
+ line-height: 1;
+ @media (min-width: 1200px) {
+ width: 280px;
+ }
+
+ img {
+ max-height: 26px;
+ margin-right: 6px;
+ }
+
+ span {
+ font-size: 26px;
+ font-weight: 700;
+ color: $secondary;
+ font-family: $font-primary;
+ }
+
+}
+
+.header {
+ transition: all 0.5s;
+ z-index: 997;
+ height: 60px;
+ box-shadow: 0px 2px 20px rgba($secondary, 0.10);
+ background-color: #fff;
+ padding-left: 20px;
+
+ /* Toggle Sidebar Button */
+ .toggle-sidebar-btn {
+ font-size: 32px;
+ padding-left: 10px;
+ cursor: pointer;
+ color: $secondary;
+ }
+
+ /* Search Bar */
+
+ .search-bar {
+ min-width: 360px;
+ padding: 0 20px;
+ }
+
+ @media (max-width: 1199px) {
+ .search-bar {
+ position: fixed;
+ top: 50px;
+ left: 0;
+ right: 0;
+ padding: 20px;
+ box-shadow: 0px 0px 15px 0px rgba($secondary, 0.1);
+ background: lighten($primary, 58);
+ z-index: 9999;
+ transition: 0.3s;
+ visibility: hidden;
+ opacity: 0;
+ }
+
+ .search-bar-show {
+ top: 60px;
+ visibility: visible;
+ opacity: 1;
+ }
+ }
+
+ .search-form {
+ width: 100%;
+ input {
+ border: 0;
+ font-size: 14px;
+ color: $secondary;
+ border: 1px solid rgba($secondary, .2);
+ padding: 7px 38px 7px 8px;
+ border-radius: 3px;
+ transition: 0.3s;
+ width: 100%;
+ &:focus, &:hover {
+ outline: none;
+ box-shadow: 0 0 10px 0 rgba($secondary, 0.15);
+ border: 1px solid rgba($secondary, .3);
+ }
+ }
+
+ button {
+ border: 0;
+ padding: 0;
+ margin-left: -30px;
+ background: none;
+ i {
+ color: $secondary;
+ }
+ }
+ }
+
+}
+
+/*--------------------------------------------------------------
+# Header Nav
+--------------------------------------------------------------*/
+.header-nav {
+ ul {
+ list-style: none;
+ }
+
+ > ul {
+ margin: 0;
+ padding: 0;
+ }
+
+ .nav-icon {
+ font-size: 22px;
+ color: $secondary;
+ margin-right: 25px;
+ position: relative;
+ }
+
+ .nav-profile {
+ color: $secondary;
+ img {
+ max-height: 36px;
+ }
+ span {
+ font-size: 14px;
+ font-weight: 600;
+ }
+ }
+
+ .badge-number {
+ position: absolute;
+ inset: -2px -5px auto auto;
+ font-weight: normal;
+ font-size: 12px;
+ padding: 3px 6px;
+ }
+
+ .notifications {
+ inset: 8px -15px auto auto !important;
+ .notification-item {
+ display: flex;
+ align-items: center;
+ padding: 15px 10px;
+ transition: 0.3s;
+
+ i {
+ margin: 0 20px 0 10px;
+ font-size: 24px;
+ }
+
+ h4 {
+ font-size: 16px;
+ font-weight: 600;
+ margin-bottom: 5px;
+ }
+
+ p {
+ font-size: 13px;
+ margin-bottom: 3px;
+ color: lighten($default, 30);
+ }
+
+ &:hover {
+ background-color: lighten($secondary, 76);
+ }
+ }
+
+ }
+
+ .messages {
+ inset: 8px -15px auto auto !important;
+ .message-item {
+ padding: 15px 10px;
+ transition: 0.3s;
+
+ a {
+ display: flex;
+ }
+
+ img {
+ margin: 0 20px 0 10px;
+ max-height: 40px;
+ }
+
+ h4 {
+ font-size: 16px;
+ font-weight: 600;
+ margin-bottom: 5px;
+ color: $default;
+ }
+
+ p {
+ font-size: 13px;
+ margin-bottom: 3px;
+ color: lighten($default, 30);
+ }
+
+ &:hover {
+ background-color: lighten($secondary, 76);
+ }
+ }
+ }
+
+ .profile {
+ min-width: 240px;
+ padding-bottom: 0;
+ top: 8px !important;
+
+ .dropdown-header {
+ h6 {
+ font-size: 18px;
+ margin-bottom: 0;
+ font-weight: 600;
+ color: $default;
+ }
+ span {
+ font-size: 14px;
+ }
+ }
+
+ .dropdown-item {
+ font-size: 14px;
+ padding: 10px 15px;
+ transition: 0.3s;
+ i {
+ margin-right: 10px;
+ font-size: 18px;
+ line-height: 0;
+ }
+ &:hover {
+ background-color: lighten($secondary, 76);
+ }
+ }
+
+ }
+
+}
diff --git a/public/assets/scss/_override.scss b/public/assets/scss/_override.scss
new file mode 100644
index 0000000..d24c75d
--- /dev/null
+++ b/public/assets/scss/_override.scss
@@ -0,0 +1,252 @@
+/*--------------------------------------------------------------
+# Override some default Bootstrap stylings
+--------------------------------------------------------------*/
+
+/* Dropdown menus */
+.dropdown-menu {
+ border-radius: 4px;
+ padding: 10px 0;
+ animation-name: dropdown-animate;
+ animation-duration: 0.2s;
+ animation-fill-mode: both;
+ border: 0;
+ box-shadow: 0 5px 30px 0 rgba(82,63,105,.20);
+
+ .dropdown-header, .dropdown-footer {
+ text-align: center;
+ font-size: 15px;
+ padding: 10px 25px;
+ }
+
+ .dropdown-footer {
+ a {
+ color: $default;
+ text-decoration: underline;
+ &:hover {
+ text-decoration: none;
+ }
+ }
+ }
+
+ .dropdown-divider {
+ color: lighten($secondary, 60);
+ margin: 0;
+ }
+
+ .dropdown-item {
+ font-size: 14px;
+ padding: 10px 15px;
+ transition: 0.3s;
+ i {
+ margin-right: 10px;
+ font-size: 18px;
+ line-height: 0;
+ }
+ &:hover {
+ background-color: lighten($secondary, 76);
+ }
+ }
+
+}
+
+@media (min-width: 768px) {
+ .dropdown-menu-arrow::before {
+ content: "";
+ width: 13px;
+ height: 13px;
+ background: #fff;
+ position: absolute;
+ top: -7px;
+ right: 20px;
+ transform: rotate(45deg);
+ border-top: 1px solid #eaedf1;
+ border-left: 1px solid #eaedf1;
+ }
+}
+
+@keyframes dropdown-animate {
+ 0% {
+ opacity: 0;
+ }
+ 100% {
+ opacity: 1;
+ }
+ 0% {
+ opacity: 0;
+ }
+}
+
+
+/* Light Backgrounds */
+.bg-primary-light {
+ background-color: #cfe2ff;
+ border-color: #cfe2ff;
+}
+
+.bg-secondary-light {
+ background-color: #e2e3e5;
+ border-color: #e2e3e5;
+}
+
+.bg-success-light {
+ background-color: #d1e7dd;
+ border-color: #d1e7dd;
+}
+
+.bg-danger-light {
+ background-color: #f8d7da;
+ border-color: #f8d7da;
+}
+
+.bg-warning-light {
+ background-color: #fff3cd;
+ border-color: #fff3cd;
+}
+
+.bg-info-light {
+ background-color: #cff4fc;
+ border-color: #cff4fc;
+}
+
+.bg-dark-light {
+ background-color: #d3d3d4;
+ border-color: #d3d3d4;
+}
+
+/* Card */
+.card {
+ margin-bottom: 30px;
+ border: none;
+ border-radius: 5px;
+ box-shadow: 0px 0 30px rgba($secondary, 0.1);
+}
+
+.card-header, .card-footer {
+ border-color: lighten($tertiary, 70);
+ background-color: #fff;
+ color: lighten($tertiary, 35);
+ padding: 15px;
+}
+
+.card-title {
+ padding: 20px 0 15px 0;
+ font-size: 18px;
+ font-weight: 500;
+ color: $secondary;
+ font-family: $font-secondary;
+ span {
+ color: lighten($tertiary, 40);
+ font-size: 14px;
+ font-weight: 400;
+ }
+ @media (max-width: px) {
+
+ }
+}
+
+.card-body {
+ padding: 0 20px 20px 20px;
+}
+
+.card-img-overlay {
+ background-color: rgba(#fff, .6);
+}
+
+/* Alerts */
+.alert-heading {
+ font-weight: 500;
+ font-family: $font-secondary;
+ font-size: 20px;
+}
+
+/* Close Button */
+.btn-close {
+ background-size: 25%;
+ &:focus {
+ outline: 0;
+ box-shadow: none;
+ }
+}
+
+/* Accordion */
+.accordion-item {
+ border: 1px solid lighten($tertiary, 70);
+}
+.accordion-button {
+ &:focus {
+ outline: 0;
+ box-shadow: none;
+ }
+ &:not(.collapsed) {
+ color: $secondary;
+ background-color: lighten($secondary, 76);
+ }
+}
+
+.accordion-flush {
+ .accordion-button {
+ padding: 15px 0;
+ background: none;
+ border: 0;
+ &:not(.collapsed) {
+ box-shadow: none;
+ color: $primary;
+ }
+ }
+
+ .accordion-body {
+ padding: 0 0 15px 0;
+ color: lighten($tertiary, 10);
+ font-size: 15px;
+ }
+}
+
+/* Breadcrumbs */
+.breadcrumb {
+ font-size: 14px;
+ font-family: $font-primary;
+ color: lighten($tertiary, 40);
+ font-weight: 600;
+
+ a {
+ color: lighten($tertiary, 40);
+ transition: 0.3s;
+
+ &:hover {
+ color: lighten($tertiary, 20);
+ }
+ }
+
+ .breadcrumb-item::before {
+ color: lighten($tertiary, 40);
+ }
+
+ .active {
+ color: lighten($tertiary, 20);
+ font-weight: 600;
+ }
+}
+
+
+/* Bordered Tabs */
+.nav-tabs-bordered {
+ border-bottom: 2px solid lighten($tertiary, 70);
+
+ .nav-link {
+ margin-bottom: -2px;
+ border: none;
+ color: $tertiary;
+
+ &:hover, &:focus {
+ color: $primary;
+ }
+
+ &.active {
+ background-color: #fff;
+ color: $primary;
+ border-bottom: 2px solid $primary;
+ }
+
+ }
+
+}
diff --git a/public/assets/scss/_pages.scss b/public/assets/scss/_pages.scss
new file mode 100644
index 0000000..aac0426
--- /dev/null
+++ b/public/assets/scss/_pages.scss
@@ -0,0 +1,270 @@
+/*--------------------------------------------------------------
+# Icons list page
+--------------------------------------------------------------*/
+.iconslist {
+ display: grid;
+ max-width: 100%;
+ grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
+ gap: 1.25rem;
+ padding-top: 15px;
+
+ .icon {
+ background-color: #fff;
+ border-radius: .25rem;
+ text-align: center;
+ color: #012970;
+ padding: 15px 0;
+ }
+
+ i {
+ margin: .25rem;
+ font-size: 2.5rem;
+ }
+
+ .label {
+ font-family: var(--bs-font-monospace);
+ display: inline-block;
+ width: 100%;
+ overflow: hidden;
+ padding: .25rem;
+ font-size: 12px;
+ text-overflow: ellipsis;
+ white-space: nowrap;
+ color: #666;
+ }
+
+}
+
+/*--------------------------------------------------------------
+# Profie Page
+--------------------------------------------------------------*/
+.profile {
+
+ .profile-card {
+ img {
+ max-width: 120px;
+ }
+
+ h2 {
+ font-size: 24px;
+ font-weight: 700;
+ color: $tertiary;
+ margin: 10px 0 0 0;
+ }
+
+ h3 {
+ font-size: 18px;
+ }
+
+ .social-links {
+ a {
+ font-size: 20px;
+ display: inline-block;
+ color: rgba($secondary, .5);
+ line-height: 0;
+ margin-right: 10px;
+ transition: 0.3s;
+ &:hover {
+ color: rgba($secondary, 1);
+ }
+ }
+ }
+ }
+
+ .profile-overview {
+ .row {
+ margin-bottom: 20px;
+ font-size: 15px;
+ }
+
+ .card-title {
+ color: $secondary;
+ }
+
+ .label {
+ font-weight: 600;
+ color: rgba($secondary, .6);
+ }
+ }
+
+ .profile-edit {
+
+ label {
+ font-weight: 600;
+ color: rgba($secondary, .6);
+ }
+
+ img {
+ max-width: 120px;
+ }
+ }
+
+}
+
+/*--------------------------------------------------------------
+# F.A.Q Page
+--------------------------------------------------------------*/
+.faq {
+
+ .basic {
+ h6 {
+ font-size: 18px;
+ font-weight: 600;
+ color: $primary;
+ }
+
+ p {
+ color: lighten($tertiary, 30);
+ }
+ }
+
+}
+
+
+/*--------------------------------------------------------------
+# Contact
+--------------------------------------------------------------*/
+.contact {
+
+ .info-box {
+ padding: 28px 30px;
+ i {
+ font-size: 38px;
+ line-height: 0;
+ color: $primary;
+ }
+
+ h3 {
+ font-size: 20px;
+ color: $secondary;
+ font-weight: 700;
+ margin: 20px 0 10px 0;
+ }
+
+ p {
+ padding: 0;
+ line-height: 24px;
+ font-size: 14px;
+ margin-bottom: 0;
+ }
+
+ }
+
+ .php-email-form {
+
+ .error-message {
+ display: none;
+ color: #fff;
+ background: #ed3c0d;
+ text-align: left;
+ padding: 15px;
+ margin-bottom: 24px;
+ font-weight: 600;
+ }
+
+ .sent-message {
+ display: none;
+ color: #fff;
+ background: #18d26e;
+ text-align: center;
+ padding: 15px;
+ margin-bottom: 24px;
+ font-weight: 600;
+ }
+
+ .loading {
+ display: none;
+ background: #fff;
+ text-align: center;
+ padding: 15px;
+ margin-bottom: 24px;
+
+ &:before {
+ content: "";
+ display: inline-block;
+ border-radius: 50%;
+ width: 24px;
+ height: 24px;
+ margin: 0 10px -6px 0;
+ border: 3px solid #18d26e;
+ border-top-color: #eee;
+ animation: animate-loading 1s linear infinite;
+ }
+
+ }
+
+ input, textarea {
+ border-radius: 0;
+ box-shadow: none;
+ font-size: 14px;
+ border-radius: 0;
+ &:focus {
+ border-color: $primary;
+ }
+ }
+
+ input {
+ padding: 10px 15px;
+ }
+
+ textarea {
+ padding: 12px 15px;
+ }
+
+ button[type="submit"] {
+ background: $primary;
+ border: 0;
+ padding: 10px 30px;
+ color: #fff;
+ transition: 0.4s;
+ border-radius: 4px;
+ &:hover {
+ background: lighten($primary, 5);
+ }
+ }
+
+ }
+
+ @keyframes animate-loading {
+ 0% { transform: rotate(0deg); }
+ 100% { transform: rotate(360deg); }
+ }
+}
+
+/*--------------------------------------------------------------
+# Error 404
+--------------------------------------------------------------*/
+.error-404 {
+ padding: 30px;
+
+ h1 {
+ font-size: 180px;
+ font-weight: 700;
+ color: $primary;
+ margin-bottom: 0;
+ line-height: 150px;
+ }
+
+ h2 {
+ font-size: 24px;
+ font-weight: 700;
+ color: $secondary;
+ margin-bottom: 30px;
+ }
+
+ .btn {
+ background: lighten($tertiary, 20);
+ color: #fff;
+ padding: 8px 30px;
+ &:hover {
+ background: lighten($tertiary, 10);
+ }
+ }
+
+ @media (min-width: 992px) {
+ img {
+ max-width: 50%;
+ }
+ }
+
+}
diff --git a/public/assets/scss/_sidebar.scss b/public/assets/scss/_sidebar.scss
new file mode 100644
index 0000000..7cb46ba
--- /dev/null
+++ b/public/assets/scss/_sidebar.scss
@@ -0,0 +1,156 @@
+/*--------------------------------------------------------------
+# Sidebar
+--------------------------------------------------------------*/
+.sidebar {
+ position: fixed;
+ top: 60px;
+ left: 0;
+ bottom: 0;
+ width: 300px;
+ z-index: 996;
+ transition: all 0.3s;
+ padding: 20px;
+ overflow-y: auto;
+ scrollbar-width: thin;
+ scrollbar-color: lighten($tertiary, 50) transparent;
+ box-shadow: 0px 0px 20px rgba($secondary, 0.10);
+ background-color: #fff;
+ @media (max-width: 1199px) {
+ left: -300px;
+ }
+
+ &::-webkit-scrollbar {
+ width: 5px;
+ height: 8px;
+ background-color: #fff;
+ }
+ &::-webkit-scrollbar-thumb {
+ background-color: lighten($tertiary, 50);
+ }
+}
+
+@media (min-width: 1200px) {
+ #main, #footer {
+ margin-left: 300px;
+ }
+}
+
+.toggle-sidebar {
+
+ @media (max-width: 1199px) {
+ .sidebar {
+ left: 0;
+ }
+ }
+
+
+ @media (min-width: 1200px) {
+ #main, #footer {
+ margin-left: 0;
+ }
+ .sidebar {
+ left: -300px;
+ }
+ }
+}
+
+.sidebar-nav {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+
+ li {
+ padding: 0;
+ margin: 0;
+ list-style: none;
+ }
+
+ .nav-item {
+ margin-bottom: 5px;
+ }
+
+ .nav-heading {
+ font-size: 11px;
+ text-transform: uppercase;
+ color: lighten($tertiary, 40);
+ font-weight: 600;
+ margin: 10px 0 5px 15px;
+ }
+
+ .nav-link {
+ display: flex;
+ align-items: center;
+ font-size: 15px;
+ font-weight: 600;
+ color: $primary;
+ transition: 0.3;
+ background: lighten($secondary, 76);
+ padding: 10px 15px;
+ border-radius: 4px;
+
+ i {
+ font-size: 16px;
+ margin-right: 10px;
+ color: $primary
+ }
+
+ &.collapsed {
+ color: $secondary;
+ background: #fff;
+ i {
+ color: lighten($tertiary, 40);
+ }
+ }
+
+ &:hover {
+ color: $primary;
+ background: lighten($secondary, 76);
+ i {
+ color: $primary
+ }
+ }
+
+ .bi-chevron-down {
+ margin-right: 0;
+ transition: transform .2s ease-in-out;
+ }
+
+ &:not(.collapsed) .bi-chevron-down {
+ transform: rotate(180deg);
+ }
+
+ }
+
+ .nav-content {
+ padding: 5px 0 0 0;
+ margin: 0;
+ list-style: none;
+
+ a {
+ display: flex;
+ align-items: center;
+ font-size: 14px;
+ font-weight: 600;
+ color: $secondary;
+ transition: 0.3;
+ padding: 10px 0 10px 40px;
+ transition: 0.3s;
+ i {
+ font-size: 6px;
+ margin-right: 8px;
+ line-height: 0;
+ border-radius: 50%;
+ }
+
+ &:hover, &.active {
+ color: $primary;
+ }
+ &.active {
+ i {
+ background-color:$primary;
+ }
+ }
+ }
+
+ }
+}
diff --git a/public/assets/scss/_variables.scss b/public/assets/scss/_variables.scss
new file mode 100644
index 0000000..245bfbb
--- /dev/null
+++ b/public/assets/scss/_variables.scss
@@ -0,0 +1,25 @@
+// Fonts
+$font-default: 'Open Sans', sans-serif;
+$font-primary: 'Nunito', sans-serif;
+$font-secondary: 'Poppins', sans-serif;
+
+// Colors
+$default: #444444;
+$primary: #4154f1;
+$secondary: #012970;
+$tertiary: #2c384e;
+
+// General Colors
+$red: #dc3545;
+$green: #28a745;
+$blue: #007bff;
+$yellow: #ffc107;
+$orange: #fd7e14;
+$brown: #7b4f2c;
+$purple: #6f42c1;
+$pink: #e83e8c;
+$white: #fff;
+$gray: #6c757d;
+$black: #343a40;
+$teal: #20c997;
+$cyan: #17a2b8;
diff --git a/public/assets/scss/style.scss b/public/assets/scss/style.scss
new file mode 100644
index 0000000..fc52f18
--- /dev/null
+++ b/public/assets/scss/style.scss
@@ -0,0 +1,12 @@
+@import 'variables';
+
+@import 'general';
+@import 'override';
+
+@import 'header';
+@import 'sidebar';
+@import 'dashboard';
+
+@import 'pages';
+
+@import 'footer';
diff --git a/public/favicon.ico b/public/favicon.ico
new file mode 100644
index 0000000..7ecfce2
Binary files /dev/null and b/public/favicon.ico differ
diff --git a/public/index.php b/public/index.php
new file mode 100644
index 0000000..8e834f2
--- /dev/null
+++ b/public/index.php
@@ -0,0 +1,59 @@
+systemDirectory . '/Boot.php';
+
+exit(Boot::bootWeb($paths));
diff --git a/public/robots.txt b/public/robots.txt
new file mode 100644
index 0000000..9e60f97
--- /dev/null
+++ b/public/robots.txt
@@ -0,0 +1,2 @@
+User-agent: *
+Disallow:
diff --git a/public/uploads/20260224/OPD-2039655-1771950192.jpg b/public/uploads/20260224/OPD-2039655-1771950192.jpg
new file mode 100644
index 0000000..d879605
Binary files /dev/null and b/public/uploads/20260224/OPD-2039655-1771950192.jpg differ
diff --git a/public/uploads/20260224/OPD-2039655-1771960747.jpg b/public/uploads/20260224/OPD-2039655-1771960747.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039655-1771960747.jpg differ
diff --git a/public/uploads/20260224/OPD-2039656-1771950821.jpg b/public/uploads/20260224/OPD-2039656-1771950821.jpg
new file mode 100644
index 0000000..d879605
Binary files /dev/null and b/public/uploads/20260224/OPD-2039656-1771950821.jpg differ
diff --git a/public/uploads/20260224/OPD-2039657-1771951558.jpg b/public/uploads/20260224/OPD-2039657-1771951558.jpg
new file mode 100644
index 0000000..d879605
Binary files /dev/null and b/public/uploads/20260224/OPD-2039657-1771951558.jpg differ
diff --git a/public/uploads/20260224/OPD-2039658-1771952012.jpg b/public/uploads/20260224/OPD-2039658-1771952012.jpg
new file mode 100644
index 0000000..d879605
Binary files /dev/null and b/public/uploads/20260224/OPD-2039658-1771952012.jpg differ
diff --git a/public/uploads/20260224/OPD-2039658-1771952047.jpg b/public/uploads/20260224/OPD-2039658-1771952047.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039658-1771952047.jpg differ
diff --git a/public/uploads/20260224/OPD-2039659-1771952773.jpg b/public/uploads/20260224/OPD-2039659-1771952773.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039659-1771952773.jpg differ
diff --git a/public/uploads/20260224/OPD-2039659-1771953025.jpg b/public/uploads/20260224/OPD-2039659-1771953025.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039659-1771953025.jpg differ
diff --git a/public/uploads/20260224/OPD-2039660-1771953326.jpg b/public/uploads/20260224/OPD-2039660-1771953326.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039660-1771953326.jpg differ
diff --git a/public/uploads/20260224/OPD-2039660-1771953522.jpg b/public/uploads/20260224/OPD-2039660-1771953522.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039660-1771953522.jpg differ
diff --git a/public/uploads/20260224/OPD-2039660-1771953704.jpg b/public/uploads/20260224/OPD-2039660-1771953704.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039660-1771953704.jpg differ
diff --git a/public/uploads/20260224/OPD-2039661-1771953846.jpg b/public/uploads/20260224/OPD-2039661-1771953846.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039661-1771953846.jpg differ
diff --git a/public/uploads/20260224/OPD-2039661-1771960355.jpg b/public/uploads/20260224/OPD-2039661-1771960355.jpg
new file mode 100644
index 0000000..3efb861
Binary files /dev/null and b/public/uploads/20260224/OPD-2039661-1771960355.jpg differ
diff --git a/public/uploads/20260224/OPD-2039662-1771954055.jpg b/public/uploads/20260224/OPD-2039662-1771954055.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039662-1771954055.jpg differ
diff --git a/public/uploads/20260224/OPD-2039662-1771955886.jpg b/public/uploads/20260224/OPD-2039662-1771955886.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039662-1771955886.jpg differ
diff --git a/public/uploads/20260224/OPD-2039662-1771960420.jpg b/public/uploads/20260224/OPD-2039662-1771960420.jpg
new file mode 100644
index 0000000..c2f7eb1
Binary files /dev/null and b/public/uploads/20260224/OPD-2039662-1771960420.jpg differ
diff --git a/public/uploads/20260224/OPD-2039663-1771956114.jpg b/public/uploads/20260224/OPD-2039663-1771956114.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039663-1771956114.jpg differ
diff --git a/public/uploads/20260224/OPD-2039664-1771956306.jpg b/public/uploads/20260224/OPD-2039664-1771956306.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039664-1771956306.jpg differ
diff --git a/public/uploads/20260224/OPD-2039664-1771959964.jpg b/public/uploads/20260224/OPD-2039664-1771959964.jpg
new file mode 100644
index 0000000..83be915
Binary files /dev/null and b/public/uploads/20260224/OPD-2039664-1771959964.jpg differ
diff --git a/public/uploads/20260224/OPD-2039665-1771957663.jpg b/public/uploads/20260224/OPD-2039665-1771957663.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039665-1771957663.jpg differ
diff --git a/public/uploads/20260224/OPD-2039665-1771958057.jpg b/public/uploads/20260224/OPD-2039665-1771958057.jpg
new file mode 100644
index 0000000..b6d7005
Binary files /dev/null and b/public/uploads/20260224/OPD-2039665-1771958057.jpg differ
diff --git a/public/uploads/patient/profile_284688_1770403396.jpg b/public/uploads/patient/profile_284688_1770403396.jpg
new file mode 100644
index 0000000..055108d
Binary files /dev/null and b/public/uploads/patient/profile_284688_1770403396.jpg differ
diff --git a/public/uploads/patient/profile_284688_1770403403.jpg b/public/uploads/patient/profile_284688_1770403403.jpg
new file mode 100644
index 0000000..bcec9e0
Binary files /dev/null and b/public/uploads/patient/profile_284688_1770403403.jpg differ
diff --git a/public/uploads/patient/profile_284688_1770403428.jpg b/public/uploads/patient/profile_284688_1770403428.jpg
new file mode 100644
index 0000000..73d3b3f
Binary files /dev/null and b/public/uploads/patient/profile_284688_1770403428.jpg differ
diff --git a/public/uploads/patient/profile_284688_1770469356.jpg b/public/uploads/patient/profile_284688_1770469356.jpg
new file mode 100644
index 0000000..897b2cb
Binary files /dev/null and b/public/uploads/patient/profile_284688_1770469356.jpg differ
diff --git a/public/uploads/patient/profile_295041_1770404193.jpg b/public/uploads/patient/profile_295041_1770404193.jpg
new file mode 100644
index 0000000..c950d77
Binary files /dev/null and b/public/uploads/patient/profile_295041_1770404193.jpg differ
diff --git a/spark b/spark
new file mode 100644
index 0000000..61bc572
--- /dev/null
+++ b/spark
@@ -0,0 +1,87 @@
+#!/usr/bin/env php
+
+ *
+ * For the full copyright and license information, please view
+ * the LICENSE file that was distributed with this source code.
+ */
+
+use CodeIgniter\Boot;
+use Config\Paths;
+
+/*
+ * --------------------------------------------------------------------
+ * CODEIGNITER COMMAND-LINE TOOLS
+ * --------------------------------------------------------------------
+ * The main entry point into the CLI system and allows you to run
+ * commands and perform maintenance on your application.
+ */
+
+/*
+ *---------------------------------------------------------------
+ * CHECK SERVER API
+ *---------------------------------------------------------------
+ */
+
+// Refuse to run when called from php-cgi
+if (str_starts_with(PHP_SAPI, 'cgi')) {
+ exit("The cli tool is not supported when running php-cgi. It needs php-cli to function!\n\n");
+}
+
+/*
+ *---------------------------------------------------------------
+ * CHECK PHP VERSION
+ *---------------------------------------------------------------
+ */
+
+$minPhpVersion = '8.2'; // If you update this, don't forget to update `public/index.php`.
+if (version_compare(PHP_VERSION, $minPhpVersion, '<')) {
+ $message = sprintf(
+ 'Your PHP version must be %s or higher to run CodeIgniter. Current version: %s',
+ $minPhpVersion,
+ PHP_VERSION,
+ );
+
+ exit($message);
+}
+
+// We want errors to be shown when using it from the CLI.
+error_reporting(E_ALL);
+ini_set('display_errors', '1');
+
+/*
+ *---------------------------------------------------------------
+ * SET THE CURRENT DIRECTORY
+ *---------------------------------------------------------------
+ */
+
+// Path to the front controller
+define('FCPATH', __DIR__ . DIRECTORY_SEPARATOR . 'public' . DIRECTORY_SEPARATOR);
+
+// Ensure the current directory is pointing to the front controller's directory
+chdir(FCPATH);
+
+/*
+ *---------------------------------------------------------------
+ * BOOTSTRAP THE APPLICATION
+ *---------------------------------------------------------------
+ * This process sets up the path constants, loads and registers
+ * our autoloader, along with Composer's, loads our constants
+ * and fires up an environment-specific bootstrapping.
+ */
+
+// LOAD OUR PATHS CONFIG FILE
+// This is the line that might need to be changed, depending on your folder structure.
+require FCPATH . '../app/Config/Paths.php';
+// ^^^ Change this line if you move your application folder
+
+$paths = new Paths();
+
+// LOAD THE FRAMEWORK BOOTSTRAP FILE
+require $paths->systemDirectory . '/Boot.php';
+
+exit(Boot::bootSpark($paths));
diff --git a/tests/.htaccess b/tests/.htaccess
new file mode 100644
index 0000000..3462048
--- /dev/null
+++ b/tests/.htaccess
@@ -0,0 +1,6 @@
+
+ Require all denied
+
+
+ Deny from all
+
diff --git a/tests/README.md b/tests/README.md
new file mode 100644
index 0000000..fc40e44
--- /dev/null
+++ b/tests/README.md
@@ -0,0 +1,118 @@
+# Running Application Tests
+
+This is the quick-start to CodeIgniter testing. Its intent is to describe what
+it takes to set up your application and get it ready to run unit tests.
+It is not intended to be a full description of the test features that you can
+use to test your application. Those details can be found in the documentation.
+
+## Resources
+
+* [CodeIgniter 4 User Guide on Testing](https://codeigniter.com/user_guide/testing/index.html)
+* [PHPUnit docs](https://phpunit.de/documentation.html)
+* [Any tutorials on Unit testing in CI4?](https://forum.codeigniter.com/showthread.php?tid=81830)
+
+## Requirements
+
+It is recommended to use the latest version of PHPUnit. At the time of this
+writing, we are running version 9.x. Support for this has been built into the
+**composer.json** file that ships with CodeIgniter and can easily be installed
+via [Composer](https://getcomposer.org/) if you don't already have it installed globally.
+
+```console
+> composer install
+```
+
+If running under macOS or Linux, you can create a symbolic link to make running tests a touch nicer.
+
+```console
+> ln -s ./vendor/bin/phpunit ./phpunit
+```
+
+You also need to install [XDebug](https://xdebug.org/docs/install) in order
+for code coverage to be calculated successfully. After installing `XDebug`, you must add `xdebug.mode=coverage` in the **php.ini** file to enable code coverage.
+
+## Setting Up
+
+A number of the tests use a running database.
+In order to set up the database edit the details for the `tests` group in
+**app/Config/Database.php** or **.env**.
+Make sure that you provide a database engine that is currently running on your machine.
+More details on a test database setup are in the
+[Testing Your Database](https://codeigniter.com/user_guide/testing/database.html) section of the documentation.
+
+## Running the tests
+
+The entire test suite can be run by simply typing one command-line command from the main directory.
+
+```console
+> ./phpunit
+```
+
+If you are using Windows, use the following command.
+
+```console
+> vendor\bin\phpunit
+```
+
+You can limit tests to those within a single test directory by specifying the
+directory name after phpunit.
+
+```console
+> ./phpunit app/Models
+```
+
+## Generating Code Coverage
+
+To generate coverage information, including HTML reports you can view in your browser,
+you can use the following command:
+
+```console
+> ./phpunit --colors --coverage-text=tests/coverage.txt --coverage-html=tests/coverage/ -d memory_limit=1024m
+```
+
+This runs all of the tests again collecting information about how many lines,
+functions, and files are tested. It also reports the percentage of the code that is covered by tests.
+It is collected in two formats: a simple text file that provides an overview as well
+as a comprehensive collection of HTML files that show the status of every line of code in the project.
+
+The text file can be found at **tests/coverage.txt**.
+The HTML files can be viewed by opening **tests/coverage/index.html** in your favorite browser.
+
+## PHPUnit XML Configuration
+
+The repository has a ``phpunit.xml.dist`` file in the project root that's used for
+PHPUnit configuration. This is used to provide a default configuration if you
+do not have your own configuration file in the project root.
+
+The normal practice would be to copy ``phpunit.xml.dist`` to ``phpunit.xml``
+(which is git ignored), and to tailor it as you see fit.
+For instance, you might wish to exclude database tests, or automatically generate
+HTML code coverage reports.
+
+## Test Cases
+
+Every test needs a *test case*, or class that your tests extend. CodeIgniter 4
+provides one class that you may use directly:
+* `CodeIgniter\Test\CIUnitTestCase`
+
+Most of the time you will want to write your own test cases that extend `CIUnitTestCase`
+to hold functions and services common to your test suites.
+
+## Creating Tests
+
+All tests go in the **tests/** directory. Each test file is a class that extends a
+**Test Case** (see above) and contains methods for the individual tests. These method
+names must start with the word "test" and should have descriptive names for precisely what
+they are testing:
+`testUserCanModifyFile()` `testOutputColorMatchesInput()` `testIsLoggedInFailsWithInvalidUser()`
+
+Writing tests is an art, and there are many resources available to help learn how.
+Review the links above and always pay attention to your code coverage.
+
+### Database Tests
+
+Tests can include migrating, seeding, and testing against a mock or live database.
+Be sure to modify the test case (or create your own) to point to your seed and migrations
+and include any additional steps to be run before tests in the `setUp()` method.
+See [Testing Your Database](https://codeigniter.com/user_guide/testing/database.html)
+for details.
diff --git a/tests/_support/Database/Migrations/2020-02-22-222222_example_migration.php b/tests/_support/Database/Migrations/2020-02-22-222222_example_migration.php
new file mode 100644
index 0000000..a73356d
--- /dev/null
+++ b/tests/_support/Database/Migrations/2020-02-22-222222_example_migration.php
@@ -0,0 +1,37 @@
+forge->addField('id');
+ $this->forge->addField([
+ 'name' => ['type' => 'varchar', 'constraint' => 31],
+ 'uid' => ['type' => 'varchar', 'constraint' => 31],
+ 'class' => ['type' => 'varchar', 'constraint' => 63],
+ 'icon' => ['type' => 'varchar', 'constraint' => 31],
+ 'summary' => ['type' => 'varchar', 'constraint' => 255],
+ 'created_at' => ['type' => 'datetime', 'null' => true],
+ 'updated_at' => ['type' => 'datetime', 'null' => true],
+ 'deleted_at' => ['type' => 'datetime', 'null' => true],
+ ]);
+
+ $this->forge->addKey('name');
+ $this->forge->addKey('uid');
+ $this->forge->addKey(['deleted_at', 'id']);
+ $this->forge->addKey('created_at');
+
+ $this->forge->createTable('factories');
+ }
+
+ public function down(): void
+ {
+ $this->forge->dropTable('factories');
+ }
+}
diff --git a/tests/_support/Database/Seeds/ExampleSeeder.php b/tests/_support/Database/Seeds/ExampleSeeder.php
new file mode 100644
index 0000000..619fc27
--- /dev/null
+++ b/tests/_support/Database/Seeds/ExampleSeeder.php
@@ -0,0 +1,41 @@
+ 'Test Factory',
+ 'uid' => 'test001',
+ 'class' => 'Factories\Tests\NewFactory',
+ 'icon' => 'fas fa-puzzle-piece',
+ 'summary' => 'Longer sample text for testing',
+ ],
+ [
+ 'name' => 'Widget Factory',
+ 'uid' => 'widget',
+ 'class' => 'Factories\Tests\WidgetPlant',
+ 'icon' => 'fas fa-puzzle-piece',
+ 'summary' => 'Create widgets in your factory',
+ ],
+ [
+ 'name' => 'Evil Factory',
+ 'uid' => 'evil-maker',
+ 'class' => 'Factories\Evil\MyFactory',
+ 'icon' => 'fas fa-book-dead',
+ 'summary' => 'Abandon all hope, ye who enter here',
+ ],
+ ];
+
+ $builder = $this->db->table('factories');
+
+ foreach ($factories as $factory) {
+ $builder->insert($factory);
+ }
+ }
+}
diff --git a/tests/_support/Libraries/ConfigReader.php b/tests/_support/Libraries/ConfigReader.php
new file mode 100644
index 0000000..0bb4a8f
--- /dev/null
+++ b/tests/_support/Libraries/ConfigReader.php
@@ -0,0 +1,19 @@
+findAll();
+
+ // Make sure the count is as expected
+ $this->assertCount(3, $objects);
+ }
+
+ public function testSoftDeleteLeavesRow(): void
+ {
+ $model = new ExampleModel();
+ $this->setPrivateProperty($model, 'useSoftDeletes', true);
+ $this->setPrivateProperty($model, 'tempUseSoftDeletes', true);
+
+ /** @var stdClass $object */
+ $object = $model->first();
+ $model->delete($object->id);
+
+ // The model should no longer find it
+ $this->assertNull($model->find($object->id));
+
+ // ... but it should still be in the database
+ $result = $model->builder()->where('id', $object->id)->get()->getResult();
+
+ $this->assertCount(1, $result);
+ }
+}
diff --git a/tests/index.html b/tests/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/tests/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/tests/session/ExampleSessionTest.php b/tests/session/ExampleSessionTest.php
new file mode 100644
index 0000000..33242a4
--- /dev/null
+++ b/tests/session/ExampleSessionTest.php
@@ -0,0 +1,17 @@
+set('logged_in', 123);
+ $this->assertSame(123, $session->get('logged_in'));
+ }
+}
diff --git a/tests/unit/HealthTest.php b/tests/unit/HealthTest.php
new file mode 100644
index 0000000..b3e480f
--- /dev/null
+++ b/tests/unit/HealthTest.php
@@ -0,0 +1,49 @@
+assertTrue(defined('APPPATH'));
+ }
+
+ public function testBaseUrlHasBeenSet(): void
+ {
+ $validation = service('validation');
+
+ $env = false;
+
+ // Check the baseURL in .env
+ if (is_file(HOMEPATH . '.env')) {
+ $env = preg_grep('/^app\.baseURL = ./', file(HOMEPATH . '.env')) !== false;
+ }
+
+ if ($env) {
+ // BaseURL in .env is a valid URL?
+ // phpunit.xml.dist sets app.baseURL in $_SERVER
+ // So if you set app.baseURL in .env, it takes precedence
+ $config = new App();
+ $this->assertTrue(
+ $validation->check($config->baseURL, 'valid_url'),
+ 'baseURL "' . $config->baseURL . '" in .env is not valid URL',
+ );
+ }
+
+ // Get the baseURL in app/Config/App.php
+ // You can't use Config\App, because phpunit.xml.dist sets app.baseURL
+ $reader = new ConfigReader();
+
+ // BaseURL in app/Config/App.php is a valid URL?
+ $this->assertTrue(
+ $validation->check($reader->baseURL, 'valid_url'),
+ 'baseURL "' . $reader->baseURL . '" in app/Config/App.php is not valid URL',
+ );
+ }
+}
diff --git a/writable/.htaccess b/writable/.htaccess
new file mode 100644
index 0000000..3462048
--- /dev/null
+++ b/writable/.htaccess
@@ -0,0 +1,6 @@
+
+ Require all denied
+
+
+ Deny from all
+
diff --git a/writable/cache/index.html b/writable/cache/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/writable/cache/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/writable/debugbar/index.html b/writable/debugbar/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/writable/debugbar/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/writable/index.html b/writable/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/writable/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/writable/logs/index.html b/writable/logs/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/writable/logs/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/writable/session/index.html b/writable/session/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/writable/session/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
diff --git a/writable/tmp_check_ai_settings.php b/writable/tmp_check_ai_settings.php
new file mode 100644
index 0000000..1e3d83a
--- /dev/null
+++ b/writable/tmp_check_ai_settings.php
@@ -0,0 +1,36 @@
+table('hospital_setting')
+ ->select('s_name, s_value')
+ ->whereIn('s_name', $keys)
+ ->get()
+ ->getResultArray();
+
+$map = [];
+foreach ($rows as $row) {
+ $map[$row['s_name']] = trim((string) ($row['s_value'] ?? ''));
+}
+
+foreach ($keys as $key) {
+ $value = $map[$key] ?? '';
+ $len = strlen($value);
+ if ($len === 0) {
+ $show = '';
+ } elseif ($len <= 8) {
+ $show = str_repeat('*', $len);
+ } else {
+ $show = substr($value, 0, 4) . str_repeat('*', $len - 8) . substr($value, -4);
+ }
+
+ echo $key . '=' . $show . PHP_EOL;
+}
diff --git a/writable/uploads/index.html b/writable/uploads/index.html
new file mode 100644
index 0000000..b702fbc
--- /dev/null
+++ b/writable/uploads/index.html
@@ -0,0 +1,11 @@
+
+
+
+ 403 Forbidden
+
+
+
+Directory access is forbidden.
+
+
+
\ No newline at end of file
diff --git a/old_code_ci3/views/Header.php b/old_code_ci3/views/Header.php
new file mode 100644
index 0000000..1cc6509
--- /dev/null
+++ b/old_code_ci3/views/Header.php
@@ -0,0 +1,219 @@
+
+
+