mirror of
https://gitlab.com/signalytic/client-external/streamline/streamline-emr.git
synced 2026-09-11 10:41:32 +00:00
resolved conflicts
This commit is contained in:
+4
-8
@@ -1,17 +1,13 @@
|
||||
{
|
||||
"name": "streamline-emr",
|
||||
"org": "streamline",
|
||||
"version": "1.0",
|
||||
"version": "2.1",
|
||||
"platforms": [
|
||||
"linux/arm64",
|
||||
"linux/amd64"
|
||||
"linux/arm64"
|
||||
],
|
||||
"images": {
|
||||
"linux/arm64": {
|
||||
"registry.gitlab.com/signalytic/client-external/streamline/streamline-emr/streamline-emr/arm64:latest": "streamline-emr:latest"
|
||||
},
|
||||
"linux/amd64": {
|
||||
"registry.gitlab.com/signalytic/client-external/streamline/streamline-emr/streamline-emr/amd64:latest": "streamline-emr:latest"
|
||||
"registry.gitlab.com/signalytic/client-external/streamline/streamline-emr/arm64:v2.1": "streamline-emr:latest"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Executable
+5
@@ -0,0 +1,5 @@
|
||||
* text=auto
|
||||
*.css linguist-vendored
|
||||
*.scss linguist-vendored
|
||||
*.js linguist-vendored
|
||||
CHANGELOG.md export-ignore
|
||||
@@ -0,0 +1,70 @@
|
||||
[submodule "Modules/WardManagement"]
|
||||
path = Modules/WardManagement
|
||||
url = https://bitbucket.org/dcsammi/streamline_ward_management.git
|
||||
git clone git@bitbucket.org:dcsammi/streamline_hiv.git
|
||||
[submodule "Modules/Reports"]
|
||||
path = Modules/Reports
|
||||
url = https://bitbucket.org/dcsammi/streamline_reports.git
|
||||
[submodule "Modules/Theatre"]
|
||||
path = Modules/Theatre
|
||||
url = https://bitbucket.org/dcsammi/streamline_theatre.git
|
||||
[submodule "Modules/Stores"]
|
||||
path = Modules/Stores
|
||||
url = https://bitbucket.org/dcsammi/streamline_stores.git
|
||||
[submodule "Modules/Antenatal"]
|
||||
path = Modules/Antenatal
|
||||
url = https://bitbucket.org/dcsammi/streamline_ante_natal.git
|
||||
[submodule "Modules/Banking"]
|
||||
path = Modules/Banking
|
||||
url = https://bitbucket.org/dcsammi/streamline_banking.git
|
||||
[submodule "Modules/Budgets"]
|
||||
path = Modules/Budgets
|
||||
url = https://bitbucket.org/dcsammi/streamline_budgets.git
|
||||
[submodule "Modules/Diabetes"]
|
||||
path = Modules/Diabetes
|
||||
url = https://bitbucket.org/dcsammi/streamline_diabetes.git
|
||||
[submodule "Modules/Expenses"]
|
||||
path = Modules/Expenses
|
||||
url = https://bitbucket.org/dcsammi/streamline_expenses.git
|
||||
[submodule "Modules/EyeClinic"]
|
||||
path = Modules/EyeClinic
|
||||
url = https://bitbucket.org/dcsammi/streamline_eye_clinic.git
|
||||
[submodule "Modules/Finance"]
|
||||
path = Modules/Finance
|
||||
url = https://bitbucket.org/dcsammi/streamline_finance.git
|
||||
[submodule "Modules/FinanceReports"]
|
||||
path = Modules/FinanceReports
|
||||
url = https://bitbucket.org/dcsammi/streamline_finance_reports.git
|
||||
[submodule "Modules/Hiv"]
|
||||
path = Modules/Hiv
|
||||
url = https://bitbucket.org/dcsammi/streamline_hiv.git
|
||||
[submodule "Modules/Insurance"]
|
||||
path = Modules/Insurance
|
||||
url = https://bitbucket.org/dcsammi/streamline_insurance.git
|
||||
[submodule "Modules/Investigations"]
|
||||
path = Modules/Investigations
|
||||
url = https://bitbucket.org/dcsammi/streamline_investigations.git
|
||||
[submodule "Modules/Invoices"]
|
||||
path = Modules/Invoices
|
||||
url = https://bitbucket.org/dcsammi/streamline_invoices.git
|
||||
[submodule "Modules/Journals"]
|
||||
path = Modules/Journals
|
||||
url = https://bitbucket.org/dcsammi/streamline_journals.git
|
||||
[submodule "Modules/Maternity"]
|
||||
path = Modules/Maternity
|
||||
url = https://bitbucket.org/dcsammi/streamline_maternity.git
|
||||
[submodule "Modules/PatientDiscounts"]
|
||||
path = Modules/PatientDiscounts
|
||||
url = https://bitbucket.org/dcsammi/streamline_patient_discounts.git
|
||||
[submodule "Modules/PatientFinance"]
|
||||
path = Modules/PatientFinance
|
||||
url = https://bitbucket.org/dcsammi/streamline_patient_finance.git
|
||||
[submodule "Modules/Payroll"]
|
||||
path = Modules/Payroll
|
||||
url = https://bitbucket.org/dcsammi/streamline_payroll.git
|
||||
[submodule "Modules/Pharmacy"]
|
||||
path = Modules/Pharmacy
|
||||
url = https://bitbucket.org/dcsammi/streamline_pharmacy.git
|
||||
[submodule "Modules/Cancer"]
|
||||
path = Modules/Cancer
|
||||
url = https://bitbucket.org/dcsammi/streamline_cancer.git
|
||||
@@ -0,0 +1,70 @@
|
||||
.PHONY: hello_world
|
||||
|
||||
container=app
|
||||
|
||||
hello_world:
|
||||
@echo "Hello World, this is the makefile for Streamline"
|
||||
|
||||
# make initialize_project
|
||||
initialize_project:
|
||||
bash ./scripts/add_submodules.sh
|
||||
if ! [ -f .env ];then cp .env.example .env;fi
|
||||
@echo "Please fill in the environmental variables in the .env file"
|
||||
|
||||
# make remove_submodules
|
||||
remove_submodules:
|
||||
bash ./scripts/remove_submodules.sh
|
||||
bash ./scripts/add_submodules.sh
|
||||
|
||||
add_submodules:
|
||||
bash ./scripts/add_submodules.sh
|
||||
|
||||
add_submodules_local:
|
||||
bash ./scripts/add_submodules_local.sh
|
||||
|
||||
# make checkout_to_branch branch='the branch you want'
|
||||
checkout_to_branch:
|
||||
bash ./scripts/checkout_to_branch.sh
|
||||
|
||||
# make update_instance
|
||||
update_instance:
|
||||
bash ./scripts/update_instance.sh
|
||||
|
||||
# make update_instance_all_branches
|
||||
update_instance_all_branches:
|
||||
bash ./scripts/update_instance_all_branches.sh
|
||||
|
||||
# make build_local_app for instances not using docker
|
||||
build_local_app:
|
||||
composer install
|
||||
php artisan key:generate
|
||||
php artisan storage:link
|
||||
php artisan migrate --seed
|
||||
sudo chmod 777 -R storage
|
||||
sudo chmod 777 -R bootstrap/cache
|
||||
sudo chmod 777 -R public/uploads
|
||||
sudo chown -R www-data:www-data storage
|
||||
sudo chown -R www-data:www-data bootstrap/cache
|
||||
sudo chown -R www-data:www-data public/uploads
|
||||
|
||||
# make build_docker_app
|
||||
build_docker_app:
|
||||
docker-compose build ${container}
|
||||
docker-compose up -d
|
||||
docker-compose run --rm ${container} composer install
|
||||
docker-compose run --rm ${container} php artisan key:generate
|
||||
docker-compose run --rm ${container} php artisan storage:link
|
||||
docker-compose run --rm ${container} php artisan migrate --seed
|
||||
docker-compose run --rm ${container} chmod 777 -R /var/www/storage
|
||||
docker-compose run --rm ${container} chmod 777 -R /var/www/bootstrap/cache
|
||||
docker-compose run --rm ${container} chmod 777 -R /var/www/public/uploads
|
||||
docker-compose run --rm ${container} chown -R www-data:www-data /var/www/storage
|
||||
docker-compose run --rm ${container} chown -R www-data:www-data /var/www/bootstrap/cache
|
||||
docker-compose run --rm ${container} chown -R www-data:www-data /var/www/public/uploads
|
||||
|
||||
# make clean_project
|
||||
clean_project:
|
||||
docker-compose run --rm ${container} php artisan cache:clear
|
||||
docker-compose run --rm ${container} php artisan view:clear
|
||||
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Antenatal'
|
||||
];
|
||||
+1746
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Antenatal\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Antenatal\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Antenatal\Providers\RouteServiceProvider;
|
||||
|
||||
class AntenatalServiceProvider extends ServiceProvider {
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'Antenatal';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'antenatal';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Antenatal\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'Modules\Antenatal\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(module_path('Antenatal', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(module_path('Antenatal', '/Routes/api.php'));
|
||||
}
|
||||
}
|
||||
+719
@@ -0,0 +1,719 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Streamline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('elite/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<!-- Custom CSS -->
|
||||
<link href="{{ asset('elite/css/style.css') }}" rel="stylesheet">
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style>
|
||||
thead {
|
||||
display: table-header-group;
|
||||
background-color: rgba(0, 0, 0, 0.075) !important;
|
||||
}
|
||||
thead>tr>th[colspan]{
|
||||
text-align: center !important;
|
||||
font-weight: bold !important;
|
||||
|
||||
}
|
||||
.heading {
|
||||
background-color: rgba(0, 0, 0, 0.075) !important;
|
||||
font-weight: bold !important;
|
||||
text-align: center !important;
|
||||
}
|
||||
tfoot {
|
||||
display: table-row-group;
|
||||
}
|
||||
tr {
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid !important;
|
||||
}
|
||||
.table {
|
||||
border-collapse: collapse;
|
||||
box-shadow: 0 0 20px rgba(0, 0, 0, 0.15);
|
||||
border-radius: 3px !important;
|
||||
}
|
||||
</style>
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="white-box">
|
||||
<img style="max-width: 300px; max-height: 100px;" src="{{ asset('uploads/streamline_images/coat_of_arms.png') }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
<p class="h6 text-center mt-0 font-weight-bold">Ministry of Health</p>
|
||||
<h3 class="heading" style="text-align: center; text-decoration: underline;">{{ __('antenatal.ant_card') }}</h3>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<td colspan="2">Health Unit: {{ $hospitalInfo->name }}</td>
|
||||
<td colspan="2"> Reg no: {{ $hospitalInfo->code }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name: {{ $patient->first_name }} {{ $patient->last_name }}</td>
|
||||
<td>NIN: {{ strtoupper($patient->national_id) }}</td>
|
||||
<td>Phone No: {{ $patient->phone }}</td>
|
||||
<td>Age: {{ get_patients_age($patient->date_of_birth) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Village: {{ $patient->village }}</td>
|
||||
<td>Parish: {{ $patient->parish }}</td>
|
||||
<td>Sub-county: {{ $patient->subcounty }}</td>
|
||||
<td>District: {{ $patient->district }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Occupation: {{ $patient->occupation }}</td>
|
||||
<td>Religion: {{ $patient->religion }}</td>
|
||||
<td>Education level: ________</td>
|
||||
<td>Tribe: __________</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="4">Marital Status: {{ $patient->marital_status }}</td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
<td colspan="4">Next of Kin</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Name: {{ $patient->next_of_kin }}</td>
|
||||
<td>Phone No: {{ $patient->phone_of_next_of_kin }}</td>
|
||||
<td>Relationship: {{ $patient->family_relation }}</td>
|
||||
<td>Address: __________</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
Gravida: {{ $anc_registration_details->gravida }}
|
||||
</div>
|
||||
<div class="col">
|
||||
Para: {{ $anc_registration_details->para }}
|
||||
</div>
|
||||
<div class="col">
|
||||
Abortions: {{ $anc_registration_details->abortion }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col"><br>
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="5">PRESENT PREGNANCY</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Complaints</th>
|
||||
<th>LNMP</th>
|
||||
<th>EDD</th>
|
||||
<th>Weeks of Amenorrhea</th>
|
||||
<th>Complications</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>{{ streamline_date($anc_registration_details->lmp) }}</td>
|
||||
<td>{{ streamline_date($anc_registration_details->edd) }}</td>
|
||||
<td>{!! $anc_registration_details->woa_weeks !!}</td>
|
||||
<td>
|
||||
@php
|
||||
$complications = explode(',', $anc_registration_details->complications);
|
||||
$menses = ['1' => __('antenatal.heavy'), '2' => __('antenatal.normal')];
|
||||
@endphp
|
||||
@if (!empty($complications))
|
||||
@if (in_array(1,$complications)) <li> {{ __('antenatal.bleeding') }} </li> @endif
|
||||
@if (in_array(2,$complications)) <li> {{ __('antenatal.excessive_vomiting') }} </li> @endif
|
||||
@if (in_array(3,$complications)) <li> {{ __('antenatal.others') }} : {{ $anc_registration_details->other_complications }} </li> @endif
|
||||
@else
|
||||
None
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col"><br>
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3">MENSTRUAL AND CONTRACEPTIVE HISTORY</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Length of menses</th>
|
||||
<th>Amount</th>
|
||||
<th>Family Planning Method</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ $mother_history->menses_length?? '' }}</td>
|
||||
<td>{{ !empty($mother_history->menses_amount)? $menses[$mother_history->menses_amount]: '' }}</td>
|
||||
<td>{{ !empty($mother_history->family_planning)? $family_planning_methods[$mother_history->family_planning]: '' }} <br> Date Discontinued: {{ !empty($mother_history->date_discontinued)? streamline_date(Carbon\Carbon::createFromFormat('d/m/Y', $mother_history->date_discontinued)->toDateString()):'' }} <br> Reason: {{ $mother_history->why_stop_family_planning?? '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3">PREVIOUS ILLNESS</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Presentations for over 2 weeks</th>
|
||||
<th>Medical</th>
|
||||
<th>Medications</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
@php
|
||||
$medical_presentations = !empty($mother_history->medical_presentations)? explode(',', $mother_history->medical_presentations):[];
|
||||
$any_medications = !empty($mother_history->any_medications)? explode(',', $mother_history->any_medications):[];
|
||||
$surgical_history =!empty($mother_history->surgical_history)? explode(',', $mother_history->surgical_history):[];
|
||||
$obs_gyn =!empty($mother_history->obs_gyn)? explode(',', $mother_history->obs_gyn):[];
|
||||
$family_history =!empty($mother_history->family_history)? explode(',', $mother_history->family_history):[];
|
||||
$fractures =!empty($mother_history->fractures)? explode(',', $mother_history->fractures):[];
|
||||
$fracture_details = !empty($mother_history->fracture_details)? json_decode($mother_history->fracture_details, true):[];
|
||||
$uterine_surgeries = !empty($mother_history->uterine_surgeries)? json_decode($mother_history->uterine_surgeries, true):[];
|
||||
$other_surgeries = !empty($mother_history->other_surgeries)? json_decode($mother_history->other_surgeries, true):[];
|
||||
$condition_names = [
|
||||
1=> __('antenatal.sti'), 2=> __('antenatal.cardiac_disease'), 3=> __('antenatal.asthma'), 4=> __('antenatal.sickel_cell'), 5=> __('antenatal.kidney_disease'),
|
||||
6=> __('antenatal.diabetes'), 7=> __('antenatal.hypertension'), 8=> __('antenatal.ted'), 9=> __('antenatal.epilepsy'), 10=> __('antenatal.tb'),11=> __('antenatal.polio'),
|
||||
12=> __('antenatal.anaemia'), 13=> __('antenatal.herpes'), 14=> __('antenatal.hiv'), 15=> __('antenatal.oral_thrush'), 16=> __('antenatal.l_glands'),
|
||||
17=> __('antenatal.herpes_simplex'), 18=> __('antenatal.dermatitis'), 19=> __('antenatal.others')
|
||||
];
|
||||
@endphp
|
||||
<td></td>
|
||||
<td>
|
||||
<ul>
|
||||
@forelse ($medical_presentations as $previous_medical_condition)
|
||||
@if ($previous_medical_condition == 19)
|
||||
<li>{{ $condition_names[$previous_medical_condition]?? '' }}: {{ $mother_history->medical_presentations_others_input }}</li>
|
||||
@else
|
||||
<li>{{ $condition_names[$previous_medical_condition]?? '' }}</li>
|
||||
@endif
|
||||
@empty
|
||||
None
|
||||
@endforelse
|
||||
</ul>
|
||||
</td>
|
||||
<td>
|
||||
@if (!empty($any_medications))
|
||||
@if (in_array(1,$any_medications)) <li> {{ __('antenatal.arv') }} </li> @endif
|
||||
@if (in_array(2,$any_medications)) <li> {{ __('antenatal.others') }} : {{ $mother_history->other_any_medications }} </li> @endif
|
||||
@else
|
||||
None
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col">
|
||||
<table class="table table-sm color-table table-bordered">
|
||||
<tbody>
|
||||
<tr class="heading">
|
||||
<td colspan="3">Surgical</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td colspan="3">
|
||||
@if (!empty($surgical_history))
|
||||
@if (in_array(1,$surgical_history)) <li> {{ __('antenatal.operations') }} : {{ $mother_history->surgical_history_operations }} </li> @endif
|
||||
@if (in_array(2,$surgical_history)) <li> {{ __('antenatal.blood_transfusion') }} had : {{ $mother_history->surgical_history_blood_transfusion }} </li> @endif
|
||||
@else
|
||||
None
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
<td>{{ __('antenatal.fractures') }}</td>
|
||||
<td>{{ __('antenatal.date') }}</td>
|
||||
<td>{{ __('antenatal.details') }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@forelse ($fractures as $fracture)
|
||||
<tr>
|
||||
@php
|
||||
if (!empty($fracture_details[$fracture-1]['date'])) {
|
||||
$date = Carbon\Carbon::createFromFormat('d/m/Y', $fracture_details[$fracture-1]['date'])->toDateString();
|
||||
}
|
||||
@endphp
|
||||
<td>
|
||||
@if ($fracture == 1)
|
||||
{{ __('antenatal.pelvis') }}
|
||||
@elseif ($fracture == 2)
|
||||
{{ __('antenatal.spine') }}
|
||||
@elseif ($fracture == 3)
|
||||
{{ __('antenatal.femur') }}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ streamline_date($date)?? '' }}</td>
|
||||
<td>{{ $fracture_details[$fracture-1]['details']?? '' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="3"><code>No {{ __('antenatal.fractures') }} Recorded</code></td></tr>
|
||||
@endforelse
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>OBS/GYN</th>
|
||||
<th>Social History</th>
|
||||
<th>Risk of S/GBV</th>
|
||||
<th>Family History</th>
|
||||
<th>Health of the Husband/partner</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td></td>
|
||||
<td>
|
||||
@php
|
||||
$observations = !empty($triage)? explode(",", $triage->observations):[];
|
||||
@endphp
|
||||
@if (in_array('Alcohol use=High', $observations) || in_array('Alcohol use=Moderate', $observations) || in_array('Alcohol use=Low', $observations))
|
||||
Alcohol <br>
|
||||
@endif
|
||||
@if (in_array('Tobacco use=High', $observations) || in_array('Tobacco use=Moderate', $observations) || in_array('Tobacco use=Low', $observations))
|
||||
Smoking
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (!empty($mother_history->sgbv) && $mother_history->sgbv == 1)
|
||||
@php
|
||||
$risks =!empty($mother_history->sgbv_risk)? explode(',', $mother_history->sgbv_risk):[];
|
||||
@endphp
|
||||
@foreach ($risks as $risk)
|
||||
<li>{{ $gender_based_violence[$risk] }}</li>
|
||||
@endforeach
|
||||
@else
|
||||
<li>No</li>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (!empty($family_history))
|
||||
@if (in_array(1,$family_history)) <li> {{ __('antenatal.diabetes') }} </li> @endif
|
||||
@if (in_array(2,$family_history)) <li> {{ __('antenatal.sickel_cell') }} </li> @endif
|
||||
@if (in_array(3,$family_history)) <li> {{ __('antenatal.hypertension') }} </li> @endif
|
||||
@if (in_array(4,$family_history)) <li> {{ __('antenatal.twins') }} </li> @endif
|
||||
@if (in_array(5,$family_history)) <li> {{ __('antenatal.others') }} </li> @endif
|
||||
@else
|
||||
None
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $mother_history->husband_health?? '' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<th colspan="2">PHYSICAL EXAMINATION</th>
|
||||
</thead>
|
||||
@php
|
||||
$physical_exam = !empty($latest_anc_visit)? json_decode($latest_anc_visit->physical_exam, true):[];
|
||||
$height = '';
|
||||
if(!empty($physical_exam['height'])) $height = ($physical_exam['height'] < 4)? $physical_exam['height'] * 100 .'cm': $physical_exam['height'].'cm';
|
||||
$temp = !empty($physical_exam['temperature'])? $physical_exam['temperature'].'<sup>o</sup>C':'Unknown';
|
||||
$pregnancy_comments = [];
|
||||
@endphp
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Gait: {{ $physical_exam['gait']?? 'Unknown' }} </td>
|
||||
<td>Height: {{ $height?? 'Unknown' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Weight: {{ !empty($physical_exam['weight'])? $physical_exam['weight'].'kg':'Unknown' }}</td>
|
||||
<td>BP: {{ !empty($physical_exam['bp'])? $physical_exam['bp'].'mmHg':'Unknown' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Pulse: {{ $physical_exam['pulse']?? 'Unknown' }}</td>
|
||||
<td>Temperature: {!! $temp !!}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>MUAC: {{ $physical_exam['muac']?? 'Unknown' }}</td>
|
||||
<td>Nutritional status: {{ $physical_exam['nut_status']?? 'Unknown' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<tbody>
|
||||
<tr class="heading">
|
||||
<td colspan="4">Examine and Comment on the following</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Oral thrush: {{ $physical_exam['oral']?? 'Unknown' }}</td>
|
||||
<td>Anaemia: {{ $physical_exam['anaemia']?? 'Unknown' }}</td>
|
||||
<td>Teeth: {{ $physical_exam['teeth']?? 'Unknown' }}</td>
|
||||
<td>Eyes: {{ $physical_exam['eyes']?? 'Unknown' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Neck: {{ $physical_exam['neck']?? 'Unknown' }}</td>
|
||||
<td>Nails: {{ $physical_exam['nails']?? 'Unknown' }}</td>
|
||||
<td>Breasts: {{ $physical_exam['breasts']?? 'Unknown' }}</td>
|
||||
<td>Palms: {{ $physical_exam['palms']?? 'Unknown' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Legs: {{ $physical_exam['legs']?? 'Unknown' }}</td>
|
||||
<td>Jaundice: {{ $physical_exam['jaundice']?? 'Unknown' }}</td>
|
||||
<td>Deformities: {{ $physical_exam['deformities']?? 'Unknown' }}</td>
|
||||
<td>Heart: {{ $physical_exam['heart']?? 'Unknown' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Lymph Nodes: {{ $physical_exam['lymph']?? 'Unknown' }}</td>
|
||||
<td>Lungs: {{ $physical_exam['lungs']?? 'Unknown' }}</td>
|
||||
<td colspan="2">Herpes zooster: {{ $physical_exam['herpes']?? 'Unknown' }}</td>
|
||||
</tr>
|
||||
<tr class="heading">
|
||||
<td colspan="4">Pelvic Examination</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Vulva: {{ $physical_exam['vulva']?? 'Unknown' }}</td>
|
||||
<td>Cervix: {{ $physical_exam['cervix']?? 'Unknown' }}</td>
|
||||
<td>Vagina: {{ $physical_exam['vagina']?? 'Unknown' }}</td>
|
||||
<td>Abnormal vaginal discharge: {{ $physical_exam['vaginal_discharge']?? 'Unknown' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="15">PREVIOUS OBSTETRIC HISTORY</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th colspan="2"></th>
|
||||
<th colspan="2">ABORTIONS</th>
|
||||
<th colspan="6">DETAILS OF DELIVERIES</th>
|
||||
<th colspan="5">CHILD</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Pregnancy</th>
|
||||
<th>Year</th>
|
||||
<th>Below 12 wks</th>
|
||||
<th>Above 12 wks</th>
|
||||
<th>Pre-mature</th>
|
||||
<th>Full-term</th>
|
||||
<th>Type of Delivery</th>
|
||||
<th>Place of Delivery</th>
|
||||
<th>Third Stage</th>
|
||||
<th>Puerperium</th>
|
||||
<th>Alive SB/NN</th>
|
||||
<th>Sex</th>
|
||||
<th>Birth Weight</th>
|
||||
<th>{{ __('antenatal.child_immunisation_status') }}</th>
|
||||
<th>{{ __('antenatal.health_condition') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($obstetric_history_details as $key => $obstetric_history)
|
||||
@php
|
||||
$children =[];
|
||||
if(!empty($obstetric_history->children)) $children = json_decode($obstetric_history->children);
|
||||
$full_term = [37,38,39, 40,41,42];
|
||||
$delivery_types = ['1' => __('antenatal.vaginal_delivery'), '2' => __('antenatal.vacuum_delivery'), '3' => __('antenatal.forceps_delivery'), '4' => __('antenatal.c_section'),'5' => __('antenatal.vbac')];
|
||||
$imunisation = ['1' => __('antenatal.not_started'), '2' => __('antenatal.ongoing'), '3' => __('antenatal.completed')];
|
||||
if(!empty($obstetric_history->comments)) $pregnancy_comments[] = $obstetric_history->comments;
|
||||
@endphp
|
||||
<tr>
|
||||
<td rowspan="{{ count($children) + 1 }}">{{ $key + 1 }}</td>
|
||||
<td rowspan="{{ count($children) + 1 }}">{{ streamline_date($obstetric_history->obstetric_date) }}</td>
|
||||
<td rowspan="{{ count($children) + 1 }}">
|
||||
@if ($obstetric_history->gestation < 12 && $obstetric_history->outcome == 5)
|
||||
Yes
|
||||
@else
|
||||
N/A
|
||||
@endif
|
||||
</td>
|
||||
<td rowspan="{{ count($children) + 1 }}">
|
||||
@if ($obstetric_history->gestation > 12 && $obstetric_history->outcome == 5)
|
||||
Yes
|
||||
@else
|
||||
N/A
|
||||
@endif
|
||||
</td>
|
||||
<td rowspan="{{ count($children) + 1 }}">
|
||||
@if ($obstetric_history->gestation < 37 && ($obstetric_history->outcome == 1 || $obstetric_history->outcome == 2))
|
||||
Yes
|
||||
@else
|
||||
No
|
||||
@endif
|
||||
</td>
|
||||
<td rowspan="{{ count($children) + 1 }}">
|
||||
@if (in_array($obstetric_history->gestation, $full_term) && ($obstetric_history->outcome == 1 || $obstetric_history->outcome == 2))
|
||||
Yes
|
||||
@else
|
||||
No
|
||||
@endif
|
||||
</td>
|
||||
<td rowspan="{{ count($children) + 1 }}">{{ !empty($delivery_types[$obstetric_history->delivery_type])? $delivery_types[$obstetric_history->delivery_type]:'' }}</td>
|
||||
<td rowspan="{{ count($children) + 1 }}"></td>
|
||||
<td rowspan="{{ count($children) + 1 }}"></td>
|
||||
<td rowspan="{{ count($children) + 1 }}">{{ $obstetric_history->puerperium?? '' }}</td>
|
||||
@if (empty($children))
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
@endif
|
||||
</tr>
|
||||
@forelse ($children as $child)
|
||||
<tr>
|
||||
<td>Alive</td>
|
||||
<td>{{ ($child->gender == '1')? 'Male':'Female' }}</td>
|
||||
<td>{{ $child->birth_weight.'kg' }}</td>
|
||||
<td>{{ !empty($child->immunisation_status)? $imunisation[$child->immunisation_status]:'' }}</td>
|
||||
<td>{{ $child->health_condition?? '' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
@endforelse
|
||||
@empty
|
||||
<tr><td colspan="15"><code>No {{ __('antenatal.past_obstetric_history') }} Recorded</code></td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
<p>Comment(s) about previous pregnancies:
|
||||
<ul>
|
||||
@forelse ($pregnancy_comments as $pregnancy_comment)
|
||||
<li>{{ $pregnancy_comment }}</li>
|
||||
@empty
|
||||
None
|
||||
@endforelse
|
||||
</ul>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="18">ANTENATAL PROGRESS EXAMINATION</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>WOA</th>
|
||||
<th>Fundal Height</th>
|
||||
<th>Presentation</th>
|
||||
<th>Position / Lie</th>
|
||||
<th>Relation (PP/Brim)</th>
|
||||
<th>Foetal Heart rate</th>
|
||||
<th>Weight (kg)</th>
|
||||
<th>BP (mmHg)</th>
|
||||
<th>Varicose (V) / Oedema (O)</th>
|
||||
<th>Urine test (Glucose, Protein, gram stain)</th>
|
||||
<th>HB</th>
|
||||
<th>Iron / Folic Acid (No. of Pills)</th>
|
||||
<th>IPT</th>
|
||||
<th>Net Use</th>
|
||||
<th>Complaints and Remarks</th>
|
||||
<th>Return Date</th>
|
||||
<th>Name of Examiner and Cadre</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($anc_visits as $anc_visit)
|
||||
@php
|
||||
$physical_exam = json_decode($anc_visit->physical_exam);
|
||||
$checklist = [];
|
||||
if (!empty($anc_visit->checklist)) {
|
||||
$checklist = json_decode($anc_visit->checklist, true);
|
||||
if(empty($checklist)) $checklist = @unserialize($anc_visit->checklist);
|
||||
if(!is_array($checklist)) $checklist = [];
|
||||
}
|
||||
$other_physicals = explode(',', $anc_visit->other_physicals);
|
||||
$pp_brim = ['1' => '1/5', '2' => '2/5', '3' => '3/5', '4' => '4/5', '5' => '5/5'];
|
||||
$lmp_date = Carbon\Carbon::parse($anc_registration_details->lmp);
|
||||
$visit_date = Carbon\Carbon::parse($anc_visit->ante_natal_clinic_date);
|
||||
$days = $lmp_date->diffInDays($visit_date);
|
||||
$weeks = floor($days / 7);
|
||||
$dayRemainder = $days % 7;
|
||||
$woa_weeks = $weeks.'<sup>'.$dayRemainder.'</sup>';
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ streamline_date($anc_visit->ante_natal_clinic_date) }}</td>
|
||||
<td>{!! $woa_weeks !!}</td>
|
||||
<td>{{ $anc_visit->fundal_height }}</td>
|
||||
<td>{{ $anc_presentations[$anc_visit->presentation] ?? '' }}</td>
|
||||
<td>{{ $anc_positions[$anc_visit->position] ?? '' }} / {{ $anc_lies[$anc_visit->lie] ?? '' }}</td>
|
||||
<td>{{ $pp_brim[$anc_visit->pp_brim] ?? '' }}</td>
|
||||
<td>{{ $anc_visit->foetal_heart_rate }}</td>
|
||||
<td>{{ $physical_exam->weight?? '' }}</td>
|
||||
<td>{{ $physical_exam->bp }}</td>
|
||||
<td>
|
||||
@if (in_array(1, $other_physicals) || in_array(3, $other_physicals))
|
||||
V and O
|
||||
@elseif (in_array(1, $other_physicals))
|
||||
O
|
||||
@elseif (in_array(3, $other_physicals))
|
||||
V
|
||||
@else
|
||||
N/A
|
||||
@endif
|
||||
</td>
|
||||
<td>Urine</td>
|
||||
<td>HB</td>
|
||||
<td>
|
||||
@if (in_array("Iron/Folic", $checklist))
|
||||
Yes
|
||||
@else
|
||||
Unknown
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (in_array("First Dose IPT", $checklist))
|
||||
{{ __('antenatal.first_dose_ipt') }} <br>
|
||||
@endif
|
||||
@if (in_array("Second Dose IPT", $checklist))
|
||||
{{ __('antenatal.second_dose_ipt') }} <br>
|
||||
@endif
|
||||
@if (in_array("Third Dose IPT", $checklist))
|
||||
{{ __('antenatal.third_dose_ipt') }} <br>
|
||||
@endif
|
||||
@if (in_array("Fourth Dose IPT", $checklist))
|
||||
{{ __('antenatal.fourth_dose_ipt') }}
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
@if (in_array("Bednet", $checklist))
|
||||
Yes
|
||||
@else
|
||||
Unknown
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $anc_visit->history_comments?? '' }} <hr> {{ $anc_visit->clinic_examination_comments?? '' }}</td>
|
||||
<td>{{ !empty($anc_visit->followup_when)? streamline_date($anc_visit->followup_when):'' }}</td>
|
||||
<td>{{ $users[$anc_visit->created_by]?? '' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="18"><code>Antenatal Progress is not recorded.</code></td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr><th colspan="6">INVESTIGATIONS</th></tr>
|
||||
<tr>
|
||||
<th>Blood Test</th>
|
||||
<th>Hep-B</th>
|
||||
<th>Sickle Cell Screening Report</th>
|
||||
<th>Random Blood Sugar</th>
|
||||
<th>Syphilis Test Results</th>
|
||||
<th>B/S for MPs / RDT for Malaria</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>Group: <br>Rh: </td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td></td>
|
||||
<td>{{ ucwords($malaria_inv_result) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<table class="table table-sm table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="6">ULTRASOUND REPORTS</th>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Date</th>
|
||||
<th>Gestational Age</th>
|
||||
<th>Placenta (site and Maturity)</th>
|
||||
<th>Amniotic Fluid</th>
|
||||
<th>Complication / Abnormality</th>
|
||||
<th>Comments</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@forelse ($obs_scan_results as $obs_scan_result)
|
||||
<tr>
|
||||
<td>{{ streamline_date($obs_scan_result->scan_date) }}</td>
|
||||
<td>{{ $obs_scan_result->average_gestational_age?? '' }}</td>
|
||||
<td>{{ $obs_scan_result->placental_site?? '' }}</td>
|
||||
<td>{{ $obs_scan_result->liquor_volume?? '' }}</td>
|
||||
<td>Complication</td>
|
||||
<td>{{ $obs_scan_result->comments?? '' }}</td>
|
||||
</tr>
|
||||
@empty
|
||||
<tr><td colspan="6"><code>No {{ __('investigations.obstetric_ultrasound_results') }} recorded.</code></td></tr>
|
||||
@endforelse
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<h4>Notes / {{ __('consultations.treatment_given') }}</h4>
|
||||
{{ $anc_registration_details->other_comments }}
|
||||
@php
|
||||
$all_treatments = [];
|
||||
@endphp
|
||||
@foreach ($treatments as $treatment)
|
||||
@php
|
||||
$drugs_array = explode(",", $treatment->drugs);
|
||||
$dosage_array = explode(",", $treatment->doses);
|
||||
$frequencies_array = explode(",", $treatment->frequencies);
|
||||
$duration_array = explode(",", $treatment->durations);
|
||||
@endphp
|
||||
@foreach ($drugs_array as $key => $drug)
|
||||
@php
|
||||
$all_treatments[] = $drugs[$drug].' to be taken '. $dosage_frequencies[$frequencies_array[$key]].' for '.$duration_array[$key];
|
||||
@endphp
|
||||
@endforeach
|
||||
@endforeach
|
||||
<ul>
|
||||
@forelse ($all_treatments as $treatment_given)
|
||||
<li>{{ $treatment_given }}</li>
|
||||
@empty
|
||||
<code>{{ __('consultations.no_prescription_made_yet') }}</code>
|
||||
@endforelse
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
|
||||
Executable
+2455
File diff suppressed because it is too large
Load Diff
+423
@@ -0,0 +1,423 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-md-7">
|
||||
<h4 class="page-title">{{ __('antenatal.view_anc_visit_details') }}</h4>
|
||||
</div>
|
||||
<div class="col-md-5">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">{{ __('home.dashboard') }}</a></li>
|
||||
<li><a href="{{ url('/ante_natal_clinic_menu') }}">{{ __('antenatal.anc_menu') }}</a></li>
|
||||
<li class="active">{{ __('antenatal.view_details') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('patients::allergies.header')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="white-box">
|
||||
<h4 class="text-center"><b>{{ __('antenatal.details_of_anc_visit_of_episode') }}</b> <font color="blue">{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}.</font></h4><br>
|
||||
<div class="row">
|
||||
<div class="col">
|
||||
<div class="table-responsive">
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.visit_date') }}</th>
|
||||
<td>{{ streamline_date($visit_record_details->ante_natal_clinic_date) }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.visit_number') }}</th>
|
||||
<td>{{ $visit_record_details->ante_natal_clinic_visit_number }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.anc_registration_id') }}</th>
|
||||
<td>{{ $visit_record_details->ante_natal_clinic_registration_id }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.fundal_height') }}</th>
|
||||
<td>{{ $visit_record_details->fundal_height }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.scan_edd') }}</th>
|
||||
<td>{{ $visit_record_details->scan_edd }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.gestation_from_edd') }}</th>
|
||||
<td>
|
||||
<div class="input-group form-control border-0">{!! $visit_record_details->gestation_from_edd !!}</div>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.gestation_from_scan') }}</th>
|
||||
<td>{{ $visit_record_details->gestation_from_scan }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.gestation_from_fundal_height') }}</th>
|
||||
<td>{{ $visit_record_details->gestation_from_fundal }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.lie') }}</th>
|
||||
<td>{{ $anc_lies[$visit_record_details->lie] ?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.presentation') }}</th>
|
||||
<td>{{ $anc_presentations[$visit_record_details->presentation] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="table-responsive">
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.position') }}</th>
|
||||
<td>{{ $anc_positions[$visit_record_details->position] ?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.engagement') }}</th>
|
||||
<td>{{ $anc_engagements[$visit_record_details->engagement] ?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.foetal_heart_rate') }}</th>
|
||||
<td>{{ $visit_record_details->foetal_heart_rate }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.foetal_heart_regularity') }}</th>
|
||||
<td>{{ $visit_record_details->foetal_heart_regularity }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.completion_status') }}</th>
|
||||
<td>{{ $visit_record_details->completion_status }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.aph') }}</th>
|
||||
<td>{{ ($visit_record_details->aph== '1')? 'Yes':'No' }}</td>
|
||||
</tr>
|
||||
@if (!empty($visit_record_details->aph))
|
||||
<tr>
|
||||
<th>{{ __('antenatal.aph_details') }}</th>
|
||||
<td>{{ $visit_record_details->aph_details }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<th>{{ __('antenatal.fits') }}</th>
|
||||
<td>{{ ($visit_record_details->fits == '1')? 'Yes':'No' }}</td>
|
||||
</tr>
|
||||
@if (!empty($visit_record_details->fits))
|
||||
<tr>
|
||||
<th>{{ __('antenatal.fits_details') }}</th>
|
||||
<td>{{ $visit_record_details->fits_details }}</td>
|
||||
</tr>
|
||||
@endif
|
||||
<tr>
|
||||
<th>{{ __('patients.primary_diagnosis') }}</th>
|
||||
<td>{{ isset($diagnoses[$visit_record_details->primary_diagnosis]) ? $diagnoses[$visit_record_details->primary_diagnosis] : "" }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('hmis_reports.other_diagnoses') }}</th>
|
||||
<td>
|
||||
@php
|
||||
$list = [];
|
||||
$other_diagnoses_array = !empty($visit_record_details->other_diagnoses)? explode(',',$visit_record_details->other_diagnoses):[];
|
||||
foreach($other_diagnoses_array as $diagnosis) if(!empty($diagnosis)) $list[]=$diagnoses[$diagnosis];
|
||||
$other_diagnoses = !empty($list)? implode(', ', $list):'';
|
||||
echo $other_diagnoses;
|
||||
@endphp
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="table-responsive">
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th>{{ __('inpatient.history') }}</th>
|
||||
<td>{{ $visit_record_details->history_comments }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('consultations.clinical_examination') }}</th>
|
||||
<td>{{ $visit_record_details->clinic_examination_comments }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('consultations.investigation_and_mgt_plan') }}</th>
|
||||
<td>{{ $visit_record_details->investigation_and_management_plan_comments }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.bp') }}</th>
|
||||
<td>{{ $visit_record_details->bp }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.scan') }}</th>
|
||||
<td>{{ $visit_record_details->scan }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.checklist') }}</th>
|
||||
<td>
|
||||
<ul>
|
||||
@php
|
||||
$checklist_array = json_decode($visit_record_details->checklist, true);
|
||||
if (is_array($checklist_array)) {
|
||||
for($i=0; $i < count($checklist_array) ; $i++){
|
||||
if($checklist_array[$i] != ""){
|
||||
echo "<li>". $checklist_array[$i] ."</li>";
|
||||
}
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</ul>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>{{ __('antenatal.outcome') }}</th>
|
||||
<td>{{ isset($outcomes[$visit_record_details->outcome_id]) ? $outcomes[$visit_record_details->outcome_id] : "" }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col">
|
||||
<div class="table-responsive">
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" class="text-center">Delivery Plan</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ __('antenatal.live_in_support') }}</td>
|
||||
<td>{{ $delivery_plan->live_in_support?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('antenatal.emergency_support') }}</td>
|
||||
<td>{{ $delivery_plan->emergency_support?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('antenatal.facility_stay') }}</td>
|
||||
<td>{{ $delivery_plan->facility_stay?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
$means = ['1' => __('antenatal.foot'), '2' => __('antenatal.car'), '3' => __('antenatal.bike'), '4' => __('antenatal.public_means')];
|
||||
$health_screening = !empty($delivery_plan->health_screening)? explode(',',$delivery_plan->health_screening):[];
|
||||
$health_screening_options = ['1' => __('antenatal.syphillis'), '2' => __('antenatal.sickel_cell'), '3' => __('antenatal.hiv'), '4' => __('antenatal.hepatitis')];
|
||||
foreach ($health_screening as $value) $health_checks[] = $health_screening_options[$value];
|
||||
@endphp
|
||||
<td>{{ __('antenatal.transport_means') }}</td>
|
||||
<td>{{ !empty($delivery_plan->transport_means)? $means[$delivery_plan->transport_means]: '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('antenatal.home_keeper') }}</td>
|
||||
<td>{{ $delivery_plan->home_keeper?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('antenatal.delivery_method') }}</td>
|
||||
<td>{{ $delivery_plan->delivery_method?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('antenatal.family_planning_method_before_next_pregnancy') }}</td>
|
||||
<td>{{ $delivery_plan->family_planning_method?? '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>{{ __('antenatal.health_screening') }}</td>
|
||||
<td>{{ !empty($health_checks)? implode(', ', $health_checks):'' }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- physical examination --}}
|
||||
@php
|
||||
$physical_exam = json_decode($visit_record_details->physical_exam, true);
|
||||
// isset($physical_exam['oral']) ? ''
|
||||
@endphp
|
||||
|
||||
|
||||
|
||||
{{-- Physical examination --}}
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" class="text-center">Physical Examination Details </th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
</table>
|
||||
<div class="row">
|
||||
<div class="col-12 col-md">
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>Oral thrush</th>
|
||||
<td> {{ isset($physical_exam['oral']) ? $physical_exam['oral'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Breasts</th>
|
||||
<td> {{ isset($physical_exam['breasts']) ? $physical_exam['breasts'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Lymph nodes</th>
|
||||
<td>{{ isset($physical_exam['lymph']) ? $physical_exam['lymph'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Eyes</th>
|
||||
<td>{{ isset($physical_exam['eyes']) ? $physical_exam['eyes'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Jaundice</th>
|
||||
<td>{{ isset($physical_exam['jaundice']) ? $physical_exam['jaundice'] : '' }}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-12 col-md">
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>Teeth</th>
|
||||
<td>{{ isset($physical_exam['teeth']) ? $physical_exam['teeth'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Legs</th>
|
||||
<td>{{ isset($physical_exam['legs']) ? $physical_exam['legs'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Herpes zoster</th>
|
||||
<td>{{ isset($physical_exam['herpes']) ? $physical_exam['herpes'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Nails</th>
|
||||
<td>{{ isset($physical_exam['nails']) ? $physical_exam['nails'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Heart</th>
|
||||
<td>{{ isset($physical_exam['heart']) ? $physical_exam['heart'] : '' }}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
<div class="col-12 col-md">
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th>Neck</th>
|
||||
<td>{{ isset($physical_exam['neck']) ? $physical_exam['neck'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Deformities</th>
|
||||
<td>{{ isset($physical_exam['deformities']) ? $physical_exam['deformities'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Anaemia</th>
|
||||
<td>{{ isset($physical_exam['anaemia']) ? $physical_exam['anaemia'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Palms</th>
|
||||
<td>{{ isset($physical_exam['palms']) ? $physical_exam['palms'] : '' }}</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th>Lungs</th>
|
||||
<td>{{ isset($physical_exam['lungs']) ? $physical_exam['lungs'] : '' }}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
|
||||
{{-- pelvic examination --}}
|
||||
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="3" class="text-center">Pelvic Examination </th>
|
||||
</tr>
|
||||
</thead>
|
||||
</table>
|
||||
|
||||
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
|
||||
<tbody>
|
||||
|
||||
<tr>
|
||||
<th style="width:30%">Vulva </th>
|
||||
<td> {{ isset($physical_exam['vulva']) ? $physical_exam['vulva'] : '' }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="width:30%">Vagina </th>
|
||||
<td> {{ isset($physical_exam['vagina']) ? $physical_exam['vagina'] : '' }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="width:30%">Cervix </th>
|
||||
<td> {{ isset($physical_exam['cervix']) ? $physical_exam['cervix'] : '' }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<th style="width:30%">Abnormal Vaginal Discharge </th>
|
||||
<td> {{ isset($physical_exam['vaginal_discharge']) ? $physical_exam['vaginal_discharge'] : '' }}</td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
<h4>{{ __('patient_episode.started_by') }}</h4>
|
||||
<span style="color: #009933; display: inline">
|
||||
{!! "<b>".get_name($visit_record_details->created_by, 'id', 'first_name', 'users')."</b>" !!} {!! "<b>".get_name($visit_record_details->created_by, "id", 'last_name', "users")."</b>" !!} on {{ streamline_date_time($visit_record_details->created_at) }}
|
||||
</span>
|
||||
@if(!empty($visit_record_details->updated_by))
|
||||
<br><br>
|
||||
<h4>{{ __('antenatal.updated_by') }}</h4>
|
||||
<span style="color: #009933; display: inline">
|
||||
{!! "<b>".get_name($visit_record_details->updated_by, 'id', 'first_name', 'users')."</b>" !!} {!! "<b>".get_name($visit_record_details->updated_by, "id", 'last_name', "users")."</b>" !!} on {{ streamline_date_time($visit_record_details->updated_at) }}
|
||||
</span>
|
||||
@endif
|
||||
@if(Auth::user()->can('edit-patient-consultation'))
|
||||
<br><br>
|
||||
<a href="/anc_visits/{{ $visit_record_details->id }}/edit" class="btn btn-inverse" style="border-radius: 5px;"><span class="glyphicon glyphicon-edit"></span> {{ __('antenatal.edit_anc_visit') }}</a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
@endpush
|
||||
docker/statistics/Modules/Antenatal/Resources/views/ante_natal_clinic/antenatal_visit_edit.blade.php
Executable
+2412
File diff suppressed because it is too large
Load Diff
+2505
File diff suppressed because it is too large
Load Diff
+2776
File diff suppressed because it is too large
Load Diff
+100
@@ -0,0 +1,100 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Ante Natal Clinic</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">Dashboard</a></li>
|
||||
<li><a href="{{ url('/ante_natal_clinic_menu') }}">Ante Natal Menu</a></li>
|
||||
<li class="active">Pregnancy registrations</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('patients::allergies.header')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('flash::message')
|
||||
<div class="white-box">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Pregnancy registered on</th>
|
||||
<th>Number of Visits</th>
|
||||
<th>LMP Date</th>
|
||||
<th>E.D.D</th>
|
||||
<th>Status</th>
|
||||
<th>Registered By</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php $count = 1; @endphp
|
||||
@if(count($anc_registrations) > 0)
|
||||
@foreach($anc_registrations as $pregnancy)
|
||||
<tr>
|
||||
<td>{{ $count }}</td>
|
||||
<td>{{ streamline_date_time_short($pregnancy->created_at) }}</td>
|
||||
<td>
|
||||
@php
|
||||
$visits = \Streamline\Models\AnteNatalClinicFollowup::where(['patient_id' => $pregnancy->patient_id, 'episode_id' => $pregnancy->episode_id])->pluck('id');
|
||||
foreach ($visits as $key => $visit) {
|
||||
$visit_ids[] = $visit;
|
||||
}
|
||||
@endphp
|
||||
@if ($visits->count() > 0)
|
||||
{{ Form::open(['method' => 'POST', 'route' => 'anc_visits.previous_visits', 'target' => "_blank", 'id'=>'previous_visits' ]) }}
|
||||
<input type="hidden" name="visits" id="visits" value='{{ serialize($visit_ids) }}' />
|
||||
<a href="javascript:void(0)" onclick="drill_down()" >{{ commas($visits->count()) }}</a>
|
||||
{{ Form::close() }}
|
||||
@else
|
||||
0
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ streamline_date_time_short($pregnancy->lmp) }}</td>
|
||||
<td>{{ streamline_date_time_short($pregnancy->edd) }}</td>
|
||||
<td>{{ !empty($pregnancy->completed)? 'Completed':'Unknown' }}</td>
|
||||
<td>{{ get_name($pregnancy->created_by, 'id', 'first_name', 'users') }} {{ get_name($pregnancy->created_by, 'id', 'last_name', 'users') }}</td>
|
||||
<td>
|
||||
<a href="/ante_natal_clinic/{{ $pregnancy->id }}" class="btn btn-success btn-sm btn-rounded">Details</a>
|
||||
<a href="/ante_natal_clinic/{{ $pregnancy->id }}/edit" class="btn btn-outline-info btn-sm btn-rounded">Edit</a>
|
||||
</td>
|
||||
</tr>
|
||||
@php $count++; @endphp
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{ $anc_registrations->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ Form::close() }}
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('js/streamline_plugins/jquery.session.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function drill_down() {
|
||||
$("#previous_visits").submit();
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
Executable
+76
@@ -0,0 +1,76 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Ante Natal Clinic</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">Dashboard</a></li>
|
||||
<li><a href="{{ url('/ante_natal_clinic_menu') }}">Ante Natal Menu</a></li>
|
||||
<li class="active">Ante natal visits</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('patients::allergies.header')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('flash::message')
|
||||
<div class="white-box">
|
||||
<div class="table-responsive">
|
||||
<table class="table color-bordered-table success-bordered-table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Pregnancy Reg. Date</th>
|
||||
<th>Visit date</th>
|
||||
<th>Visit no.</th>
|
||||
<th>Fundal height</th>
|
||||
<th>Gestation from EDD</th>
|
||||
<th>Gestation from scan</th>
|
||||
<th>Gestation from fundal</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(count($anc_followup_records) > 0)
|
||||
@foreach($anc_followup_records as $key => $anc_visits)
|
||||
<tr>
|
||||
<td rowspan={{ count($anc_followup_records[$key])+1 }}>{{ streamline_date_time_short(get_name($key, 'id', 'created_at', 'ante_natal_clinic_registrations')) }}</td>
|
||||
</tr>
|
||||
@foreach ($anc_visits as $anc_visit)
|
||||
<tr>
|
||||
<td>{{ streamline_date($anc_visit->ante_natal_clinic_date) }}</td>
|
||||
<td>{{ $anc_visit->ante_natal_clinic_visit_number }}</td>
|
||||
<td>{{ $anc_visit->fundal_height }} cm</td>
|
||||
<td>{{ $anc_visit->gestation_from_edd }} weeks</td>
|
||||
<td>{{ $anc_visit->gestation_from_scan }} weeks</td>
|
||||
<td>{{ $anc_visit->gestation_from_fundal }} weeks</td>
|
||||
<td style='white-space: nowrap'>
|
||||
<a href="{{ url('anc_visits/view_history/') }}/{{ $anc_visit->id }}" class="btn btn-outline-success btn-rounded btn-sm">Details</a>
|
||||
<a class="btn btn-outline-primary btn-sm btn-rounded" href="/anc_visits/{{ $anc_visit->id }}/edit">{{ __('antenatal.edit_details') }}</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('js/streamline_plugins/jquery.session.js') }}"></script>
|
||||
|
||||
@endpush
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Ante Natal Clinic</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">Dashboard</a></li>
|
||||
<li><a href="{{ url('/ante_natal_clinic_menu') }}">Ante Natal Menu</a></li>
|
||||
<li class="active">Ante natal visits</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('patients::allergies.header')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('flash::message')
|
||||
<div class="white-box">
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped color-bordered-table success-bordered-table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th></th>
|
||||
<th>Visit date</th>
|
||||
<th>Visit no.</th>
|
||||
<th>Fundal height</th>
|
||||
<th>Gestation from EDD</th>
|
||||
<th>Gestation from scan</th>
|
||||
<th>Gestation from fundal</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php $count = 1; @endphp
|
||||
@if(count($anc_followup_records) > 0)
|
||||
@foreach($anc_followup_records as $anc_visit)
|
||||
<tr>
|
||||
<td>{{ $count }}</td>
|
||||
<td>{{ streamline_date_time_short($anc_visit->ante_natal_clinic_date) }}</td>
|
||||
<td>{{ $anc_visit->ante_natal_clinic_visit_number }}</td>
|
||||
<td>{{ $anc_visit->fundal_height }} cm</td>
|
||||
<td>{{ $anc_visit->gestation_from_edd }} weeks</td>
|
||||
<td>{{ $anc_visit->gestation_from_scan }} weeks</td>
|
||||
<td>{{ $anc_visit->gestation_from_fundal }} weeks</td>
|
||||
<td>
|
||||
<a href="{{ url('ante_natal_clinic_follow_up') }}/{{ $anc_visit->episode_id }}" class="btn btn-success btn-sm">Details</a>
|
||||
</td>
|
||||
</tr>
|
||||
@php $count++; @endphp
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
{{ $anc_followup_records->links() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ Form::close() }}
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('js/streamline_plugins/jquery.session.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$('#datepicker-autoclose1,#datepicker-autoclose2,#datepicker-autoclose3,#datepicker-autoclose4,#datepicker-autoclose5,#datepicker-autoclose6').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd/mm/yyyy',
|
||||
});
|
||||
|
||||
$("#show_scar_no_div").click(function () {
|
||||
$("#scar_no_div").show();
|
||||
});
|
||||
$("#hide_scar_no_div").click(function () {
|
||||
$("#scar_no_div").hide();
|
||||
});
|
||||
|
||||
$("#show_pph_details_div").click(function () {
|
||||
$("#pph_details_div").show();
|
||||
});
|
||||
$("#hide_pph_details_div").click(function () {
|
||||
$("#pph_details_div").hide();
|
||||
});
|
||||
|
||||
$("#hiv_result").change(function () {
|
||||
var hiv_result = $(this).val();
|
||||
console.log(hiv_result);
|
||||
if (hiv_result == 1) {
|
||||
$("#hiv_positive_div").show();
|
||||
} else {
|
||||
$("#hiv_positive_div").hide();
|
||||
}
|
||||
});
|
||||
|
||||
$("#height,#weight").on("change focus blur", function () {
|
||||
var weight = $("#weight").val();
|
||||
var height = $("#height").val();
|
||||
var bmi = calculate_bmi(height, weight);
|
||||
$("#bmi").val(bmi);
|
||||
});
|
||||
|
||||
//For the adding of a dynamic row
|
||||
var max_fields = 8; //maximum input boxes allowed
|
||||
var max_fields2 = 8; //maximum input boxes allowed
|
||||
var wrapper = $("#table_1"); //Fields wrapper
|
||||
var wrapper2 = $("#table_2"); //Fields wrapper
|
||||
var add_button = $(".add_field_button_1"); //Add button ID
|
||||
var add_button2 = $(".add_field_button_2"); //Add button ID
|
||||
|
||||
var x = 1; //initlal text box count
|
||||
add_button.click(function (e) { //on add input button click
|
||||
e.preventDefault();
|
||||
if (x < max_fields) { //max input box allowed
|
||||
x++; //text box increment
|
||||
|
||||
$(wrapper).append('<tr>\n\
|
||||
<td><div class="row"><div class="col-sm-1"><a href="#" class="remove_field" style="color: maroon;">x</a></div><div class="col-sm-11"> <div class="input-group"><input class="form-control datepicker-autoclose" readonly="" name="obstetric_date[]" type="text" value=""><span class="input-group-addon"><i class="icon-calender"></i></span></div></div></div></td>\n\
|
||||
<td><input type="number" class="form-control col-sm-12" name="gestation[]" placeholder="weeks">\n\
|
||||
<td><select class="form-control col-sm-12" name="obstetric_outcome[]"><option value="">-- select --</option></select></td>\n\
|
||||
<td><input type="text" class="form-control col-sm-12" name="outcome_name[]"></td>\n\
|
||||
<td><input type="number" class="form-control col-sm-12" name="outcome_id[]"></td>\n\
|
||||
<td><input type="text" class="form-control col-sm-12" name="obstetric_comment[]"></td></tr>'); //add input box
|
||||
}
|
||||
});
|
||||
|
||||
$(wrapper).on("click", ".remove_field", function (e) { //user click on remove text
|
||||
e.preventDefault();
|
||||
$(this).parent().parent('tr').remove();
|
||||
x--;
|
||||
});
|
||||
|
||||
var y = 1; //initlal text box count
|
||||
add_button2.click(function (e) { //on add input button click
|
||||
e.preventDefault();
|
||||
if (y < max_fields2) { //max input box allowed
|
||||
y++; //text box increment
|
||||
|
||||
$(wrapper2).append('<tr>\n\
|
||||
<td><div class="input-group"><input class="form-control datepicker-autoclose" readonly="" name="transfusion_date_date[]" type="text" value=""><span class="input-group-addon"><i class="icon-calender"></i></span></div></td>\n\
|
||||
<td><input type="number" class="form-control col-sm-12" name="no_of_units[]"></td>\n\
|
||||
<td><input type="text" class="form-control col-sm-12" name="transfusion_comment[]"></td></tr>'); //add input box
|
||||
}
|
||||
});
|
||||
|
||||
/* call datepicker on dynamic rows */
|
||||
$(wrapper,wrapper2).on( 'click', '.datepicker-autoclose', function () {
|
||||
$('.datepicker-autoclose').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd/mm/yyyy',
|
||||
});
|
||||
});
|
||||
|
||||
$(wrapper,wrapper2).on("click", ".remove_field", function (e) { //user click on remove text
|
||||
e.preventDefault();
|
||||
$(this).parent().parent().parent().parent().remove();
|
||||
x--;
|
||||
});
|
||||
|
||||
function submitReferral(){
|
||||
var name = $("#referral_name").val();
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/triage/add_referral',
|
||||
data: {'name' : name},
|
||||
success: function(response){
|
||||
if(!isNaN(response)){
|
||||
//response = last inserted id
|
||||
$('#referral').append($('<option>', {
|
||||
value: response,
|
||||
text: name
|
||||
}));
|
||||
$('#referral').val(response);//preselect the newly added referral
|
||||
$('#modal-referral').modal('hide'); //manually hide the modal
|
||||
} else {
|
||||
alert("Adding referral failed");
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
alert(JSON.stringify(jqXHR));
|
||||
console.log(JSON.stringify(jqXHR));
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
|
||||
@endpush
|
||||
+97
@@ -0,0 +1,97 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<style type="text/css">
|
||||
.buttonStyle {
|
||||
margin-bottom: 10px;
|
||||
border: none;
|
||||
cursor: pointer;
|
||||
font-size: 20px;
|
||||
border-radius: 5px;
|
||||
width: 300px;
|
||||
height: 50px;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('antenatal.antanatal_clinic') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">{{ __('home.dashboard') }}</a></li>
|
||||
<li><a href="{{ route('patients.index') }}">{{ __('antenatal.patients') }}</a></li>
|
||||
<li class="active">{{ __('antenatal.antanatal_clinic') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('patients::allergies.header')
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
@include('flash::message')
|
||||
<div class="white-box">
|
||||
<div class="row">
|
||||
<div class="col text-center">
|
||||
<a class="btn btn-success btn-lg buttonStyle" href="{{ url('ante_natal_clinic/route') }}"> {{ __('antenatal.new_pregnancy') }}</a>
|
||||
<a class="btn btn-info btn-lg buttonStyle" id="anc_visit" href="#"> {{ __('antenatal.antenatal_visit') }} </a>
|
||||
<a class="btn btn-primary btn-lg buttonStyle" href="{{ url('antenatal_card') }}">{{ __('antenatal.ant_card') }} </a>
|
||||
<br><br>
|
||||
<a class="btn btn-default btn-lg buttonStyle" href="{{ url('ante_natal_clinic') }}"> {{ __('antenatal.view_pregnancies') }}</a>
|
||||
<a class="btn btn-default btn-lg buttonStyle" href="{{ url('ante_natal_clinic_follow_up') }}"> {{ __('antenatal.view_antenatal_visits') }}</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
|
||||
<div class="modal fade" id="fillNewPregnancyWarning" tabindex="-1" role="dialog">
|
||||
<div class="modal-dialog modal-dialog-centered" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header">
|
||||
<button type="button" class="close" data-dismiss="modal" aria-label="Close"><span aria-hidden="true">×</span></button>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
{{ __('antenatal.please_make_sure_you_fill_new_pregnancy_details') }}
|
||||
</div>
|
||||
<div class="modal-footer">
|
||||
<button type="button" class="btn btn-success" data-dismiss="modal">OK</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('js/streamline_plugins/jquery.session.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
$('#anc_visit').click(function(e){
|
||||
$.ajax({
|
||||
method: 'GET',
|
||||
url: '/check_if_pregnancy_is_registered',
|
||||
success: function(response){
|
||||
console.log(response);
|
||||
if (response === "true") {
|
||||
window.location.href = "/ante_natal_clinic_follow_up/create";
|
||||
} else {
|
||||
$('#fillNewPregnancyWarning').modal('show');
|
||||
e.preventDefault();
|
||||
}
|
||||
},
|
||||
error: function(jqXHR, textStatus, errorThrown) {
|
||||
alert(JSON.stringify(jqXHR));
|
||||
console.log(JSON.stringify(jqXHR));
|
||||
e.preventDefault();
|
||||
}
|
||||
});
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
Executable
+1340
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:api')->get('/antenatal', function () {
|
||||
return "Antenatal";
|
||||
});
|
||||
@@ -0,0 +1,29 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['middleware' => ['auth', 'disablebackbutton', 'user-locale','subscription-tracking', 'password-expiry']], function () {
|
||||
/* Ante Natal Clinic Controller */
|
||||
Route::get('ante_natal_clinic/route', 'AnteNatalClinicController@route');
|
||||
Route::resource('ante_natal_clinic', 'AnteNatalClinicController');
|
||||
Route::get('ante_natal_clinic_menu', 'AnteNatalClinicController@menu');
|
||||
Route::get('ante_natal_clinic_follow_up/create', 'AnteNatalClinicController@antenatal_visit');
|
||||
Route::post('store_anc_template', 'AnteNatalClinicController@store_anc_template')->name('ante_natal_clinic.store_template');
|
||||
Route::get('ante_natal_clinic_follow_up/{id}', 'AnteNatalClinicController@view_antenatal_visit');
|
||||
Route::get('check_if_pregnancy_is_registered', 'AnteNatalClinicController@check_anc_registration');
|
||||
Route::get('ante_natal_clinic_follow_up', 'AnteNatalClinicController@index_visits');
|
||||
Route::any('update_anc_template/{id}', 'AnteNatalClinicController@update_anc_template')->name('ante_natal_clinic.update_anc_template');
|
||||
Route::any('/anc_visits/view_history/{id}', 'AnteNatalClinicController@view_anc_visit_details')->name('anc_visits.view_anc_details');
|
||||
Route::any('anc_visits/{id}/edit', 'AnteNatalClinicController@edit_anc_visit')->name('anc_visit.edit');
|
||||
Route::post('previously_registered_pregnancy_anc_visits', 'AnteNatalClinicController@previously_registered_pregnancy_anc_visits')->name('anc_visits.previous_visits');
|
||||
|
||||
Route::post('calculate_edd_from_lmp', 'AnteNatalClinicController@calculate_edd_from_lmp')->name('ante_natal_clinic.calculate_edd_from_lmp');
|
||||
Route::post('calculate_woa_weeks_from_lmp', 'AnteNatalClinicController@calculate_woa_weeks_from_lmp')->name('ante_natal_clinic.calculate_woa_weeks_from_lmp');
|
||||
Route::get('antenatal_card', 'AnteNatalClinicController@antenatal_card')->name('ante_natal_clinic.antenatal_card');
|
||||
|
||||
Route::any('anc_visit_for_existing_pregnancy', 'AnteNatalClinicController@anc_visit_for_existing_pregnancy')->name('anc.anc_visit_for_existing_pregnancy');
|
||||
Route::any('/ante_natal_clinic/add_uterus_operation', 'AnteNatalClinicController@add_uterus_operation')->name('ante_natal_clinic.add_uterus_operation');
|
||||
Route::any('/ante_natal_clinic/add_gender_based_violence', 'AnteNatalClinicController@add_gender_based_violence')->name('ante_natal_clinic.add_gender_based_violence');
|
||||
Route::any('/ante_natal_clinic/add_caesarian_section', 'AnteNatalClinicController@add_caesarian_section')->name('ante_natal_clinic.add_caesarian_section');
|
||||
Route::post('/ante_natal_clinic/add_family_planning_method', 'AnteNatalClinicController@add_family_planning_method')->name('ante_natal_clinic.add_family_planning_method');
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
image: alpine/git:latest
|
||||
|
||||
pipelines:
|
||||
branches:
|
||||
main:
|
||||
- step:
|
||||
name: Merge To Beta
|
||||
script:
|
||||
- git remote set-url origin https://Kabricks:${APP_SECRET}@bitbucket.org/dcsammi/${BITBUCKET_REPO_SLUG}
|
||||
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
- git fetch
|
||||
- git checkout beta
|
||||
- git merge main
|
||||
- git commit --amend -m "[skip ci] Merge changes from main"
|
||||
- git push
|
||||
- step:
|
||||
name: Deploy To Test
|
||||
script:
|
||||
- echo "Ready to deploy to demo or production!"
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Antenatal",
|
||||
"alias": "antenatal",
|
||||
"description": "Antenatal Clinic",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Antenatal\\Providers\\AntenatalServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Banking'
|
||||
];
|
||||
File diff suppressed because it is too large
Load Diff
+240
@@ -0,0 +1,240 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banking\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Streamline\Models\BankDeposit;
|
||||
use Streamline\Models\BankingRecord;
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\BankTransfer;
|
||||
use Streamline\Models\ChartOfAccount;
|
||||
use Streamline\Models\Payment;
|
||||
use Streamline\Models\User;
|
||||
|
||||
class BankingRecordController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$records = [];
|
||||
$bank = $request->bank;
|
||||
$staff_members = User::get();
|
||||
$display = bank_register_label_setter($request);
|
||||
$today = Carbon::today()->toDateString();
|
||||
$banks = ChartOfAccount::where('type', 4)->where('id', '!=', 10)->get();
|
||||
$yesterday = Carbon::yesterday()->toDateString();
|
||||
$end = Carbon::parse($request->end_date)->endOfDay()->toDateTimeString();
|
||||
$start = Carbon::parse($request->start_date)->startOfDay()->toDateTimeString();
|
||||
|
||||
if($request->staff_member == "ALL STAFF"){
|
||||
switch ($request->dates){
|
||||
case 'today':
|
||||
$records = BankingRecord::whereDate('record_date', $today)->where('bank', $request->bank)
|
||||
->get();
|
||||
break;
|
||||
case 'yesterday':
|
||||
$records = BankingRecord::whereDate('record_date', $yesterday)->where('bank', $request->bank)
|
||||
->get();
|
||||
break;
|
||||
case 'custom_date':
|
||||
$records = BankingRecord::whereDate('record_date', $start)->where('bank', $request->bank)
|
||||
->get();
|
||||
break;
|
||||
case 'custom_date_range':
|
||||
$records = BankingRecord::whereBetween('record_date', [$start, $end])->where('bank', $request->bank)
|
||||
->get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
else{
|
||||
switch ($request->dates){
|
||||
case 'today':
|
||||
$records = BankingRecord::where('created_by', $request->staff_member)->whereDate('record_date', $today)
|
||||
->where('bank', $request->bank)->get();
|
||||
break;
|
||||
case 'yesterday':
|
||||
$records = BankingRecord::where('created_by', $request->staff_member)->whereDate('record_date', $yesterday)
|
||||
->where('bank', $request->bank)->get();
|
||||
break;
|
||||
case 'custom_date':
|
||||
$records = BankingRecord::where('created_by', $request->staff_member)->whereDate('record_date', $start)
|
||||
->where('bank', $request->bank)->get();
|
||||
break;
|
||||
case 'custom_date_range':
|
||||
$records = BankingRecord::where('created_by', $request->staff_member)->whereBetween('record_date', [$start, $end])
|
||||
->where('bank', $request->bank)->get();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
return view('banking::banking_records.index', compact('records', 'display', 'staff_members', 'banks', 'bank'));
|
||||
}
|
||||
|
||||
public function reverse($trans_id){
|
||||
// update account balances on banking records
|
||||
|
||||
$deposits = BankDeposit::where('trans_id', $trans_id)->get();
|
||||
$transfers = BankTransfer::where('trans_id', $trans_id)->get();
|
||||
$payments = Payment::where('transaction_id', $trans_id)->get();
|
||||
$records = BankingRecord::where('trans_id', $trans_id)->get();
|
||||
|
||||
if(count($deposits) > 0){
|
||||
foreach ($deposits as $deposit){
|
||||
|
||||
$deposit_amount = (int)$deposit->amount;
|
||||
$current_deposit_to_balance = ChartOfAccount::where('id', $deposit->deposit_to)->pluck('balance')->first();
|
||||
$current_deposit_from_balance = ChartOfAccount::where('id', $deposit->from_account)->pluck('balance')->first();
|
||||
|
||||
ChartOfAccount::where('id', $deposit->deposit_to)->update(['balance' => ((int)$current_deposit_to_balance) - (int)$deposit_amount]);
|
||||
ChartOfAccount::where('id', $deposit->from_account)->update(['balance' => ((int)$current_deposit_from_balance) + (int)$deposit_amount]);
|
||||
|
||||
$proceeding_deposits = BankDeposit::where('created_at', '>', $deposit->created_at)->get();
|
||||
foreach ($proceeding_deposits as $proceeding_deposit){
|
||||
BankDeposit::where('id', $proceeding_deposit->id)->update(['previous_from_account_balance' => ((int)$proceeding_deposit->previous_from_account_balance + (int)$deposit_amount)]);
|
||||
BankDeposit::where('id', $proceeding_deposit->id)->update(['previous_to_account_balance' => ((int)$proceeding_deposit->previous_to_account_balance - (int)$deposit_amount)]);
|
||||
}
|
||||
|
||||
$deposit->delete();
|
||||
|
||||
foreach ($records as $record){
|
||||
$proceeding_records = BankingRecord::where('created_at', '>', $record->created_at)->get();
|
||||
foreach ($proceeding_records as $proceeding_record){
|
||||
BankingRecord::where('id', $proceeding_record->id)->update(['account_balance' => ((int)$proceeding_record->account_balance - (int)$deposit_amount)]);
|
||||
}
|
||||
$record->delete();
|
||||
}
|
||||
|
||||
// update chart of account balances
|
||||
flash('Bank Transaction successfully reversed.')->success();
|
||||
return redirect('/banking/register');
|
||||
}
|
||||
}elseif(count($transfers) > 0){
|
||||
|
||||
foreach ($transfers as $transfer){
|
||||
|
||||
$transfer_amount = (int)$transfer->balance;
|
||||
$current_transfer_to_balance = ChartOfAccount::where('id', $transfer->to_account)->pluck('balance')->first();
|
||||
$current_transfer_from_balance = ChartOfAccount::where('id', $transfer->from_account)->pluck('balance')->first();
|
||||
|
||||
ChartOfAccount::where('id', $transfer->to_account)->update(['balance' => ((int)$current_transfer_to_balance) - (int)$transfer_amount]);
|
||||
ChartOfAccount::where('id', $transfer->from_account)->update(['balance' => ((int)$current_transfer_from_balance) + (int)$transfer_amount]);
|
||||
|
||||
$proceeding_transfers = BankDeposit::where('created_at', '>', $transfer->created_at)->get();
|
||||
foreach ($proceeding_transfers as $proceeding_transfer){
|
||||
BankTransfer::where('id', $proceeding_transfer->id)->update(['previous_from_account_balance' => ((int)$proceeding_transfer->previous_from_account_balance + (int)$transfer_amount)]);
|
||||
BankTransfer::where('id', $proceeding_transfer->id)->update(['previous_to_account_balance' => ((int)$proceeding_transfer->previous_to_account_balance - (int)$transfer_amount)]);
|
||||
}
|
||||
$transfer->delete();
|
||||
|
||||
foreach ($records as $record){
|
||||
$proceeding_records = BankingRecord::where('created_at', '>', $record->created_at)->get();
|
||||
foreach ($proceeding_records as $proceeding_record){
|
||||
BankingRecord::where('id', $proceeding_record->id)->update(['account_balance' => ((int)$proceeding_record->account_balance - (int)$transfer_amount)]);
|
||||
}
|
||||
$record->delete();
|
||||
}
|
||||
// update chart of account balances
|
||||
flash('Bank Transaction successfully reversed.')->success();
|
||||
return redirect('/banking/register');
|
||||
}
|
||||
|
||||
}elseif(count($payments) > 0){
|
||||
|
||||
foreach ($payments as $payment){
|
||||
|
||||
$bank_account = $payment->account_id;
|
||||
$payment_item_account = get_name($payment->item_id, 'id', 'account_id', 'payment_items');
|
||||
|
||||
$payment_amount = (int)$payment->amount;
|
||||
$current_transfer_to_balance = ChartOfAccount::where('id', $payment_item_account)->pluck('balance')->first();
|
||||
$current_transfer_from_balance = ChartOfAccount::where('id', $bank_account)->pluck('balance')->first();
|
||||
|
||||
ChartOfAccount::where('id', $payment_item_account)->update(['balance' => ((int)$current_transfer_to_balance) - (int)$payment_amount]);
|
||||
ChartOfAccount::where('id', $bank_account)->update(['balance' => ((int)$current_transfer_from_balance) + (int)$payment_amount]);
|
||||
|
||||
$proceeding_payments = Payment::where('created_at', '>', $payment->created_at)->get();
|
||||
foreach ($proceeding_payments as $proceeding_payment){
|
||||
Payment::where('id', $proceeding_payment->id)->update(['account_balance' => ((int)$proceeding_payment->account_balance + (int)$payment_amount)]);
|
||||
}
|
||||
$payment->delete();
|
||||
|
||||
foreach ($records as $record){
|
||||
$proceeding_records = BankingRecord::where('created_at', '>', $record->created_at)->get();
|
||||
foreach ($proceeding_records as $proceeding_record){
|
||||
BankingRecord::where('id', $proceeding_record->id)->update(['account_balance' => ((int)$proceeding_record->account_balance + (int)$payment_amount)]);
|
||||
}
|
||||
$record->delete();
|
||||
}
|
||||
|
||||
// update chart of account balances
|
||||
flash('Bank Transaction successfully reversed.')->success();
|
||||
return redirect('/banking/register');
|
||||
}
|
||||
}
|
||||
// update chart of account balances
|
||||
flash('Bank Transaction Reversal Failed.')->error();
|
||||
return redirect('/banking/register');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
*/
|
||||
public function show(BankingRecord $bankingRecord)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
*/
|
||||
public function edit(BankingRecord $bankingRecord)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
*/
|
||||
public function update(Request $request, BankingRecord $bankingRecord)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
*/
|
||||
public function destroy(BankingRecord $bankingRecord)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banking\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banking\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Banking\Providers\RouteServiceProvider;
|
||||
|
||||
class BankingServiceProvider extends ServiceProvider {
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'Banking';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'banking';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Banking\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'Modules\Banking\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(module_path('Banking', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(module_path('Banking', '/Routes/api.php'));
|
||||
}
|
||||
}
|
||||
+132
@@ -0,0 +1,132 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/typeahead.js-master/dist/typehead-min.css') }}" rel="stylesheet">
|
||||
|
||||
<style type="text/css">
|
||||
#divToPrint{
|
||||
font-size: 13px;
|
||||
color: #7c7c7c;
|
||||
}
|
||||
|
||||
#receipt_table{
|
||||
font-size: 1em;
|
||||
font-weight: normal;
|
||||
font-family: monospace
|
||||
}
|
||||
|
||||
#receipt_table th{
|
||||
border: 1px solid #dddddd;
|
||||
}
|
||||
|
||||
#receipt_table td{
|
||||
border: 1px solid #dddddd;
|
||||
}
|
||||
|
||||
.receipt-label{
|
||||
margin-top: 10px;
|
||||
padding: 10px;
|
||||
}
|
||||
|
||||
.receipt-title{
|
||||
font-weight: bolder;
|
||||
text-decoration: underline;
|
||||
display: block; font-family:
|
||||
monospace
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Bank Slip</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="/finance">Finance</a></li>
|
||||
<li><a href="/banking/deposit">Bank Deposits</a></li>
|
||||
<li class="active">Bank Slip</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@include('flash::message')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="white-box">
|
||||
<div class="row" style="float:right;"><button class="btn btn-success glyphicon glyphicon-print" onclick="print_receipt()"> Print</button></div>
|
||||
<div class="row" id="divToPrint">
|
||||
<div class="col-sm-3"></div>
|
||||
<div class="col-sm-6" style="text-align: center;">
|
||||
<img style="max-width: 300px; max-height: 140px;" src="{{ asset(isset($hospital_information->logo) ? $hospital_information->logo : 'uploads/logo/logo-sm.png') }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
<p class="h6 text-center mt-0 font-weight-bold">
|
||||
<?php echo $hospital_information->name . ' | ' . $hospital_information->phone_number . ' | ' . $hospital_information->email . ' | ' . $hospital_information->address . ' ' . $hospital_information->country ?>
|
||||
</p><br>
|
||||
<p class="h5 text-center mt-0 font-weight-bold">Bank Slip</p>
|
||||
<div>
|
||||
<table class="table" id="receipt_table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th style="width: 60%"><b>#</b></th>
|
||||
<th style="width: 20%"><b>Amount</b></th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@php $total_banked = 0; @endphp
|
||||
@for ($x = 0; $x < count($banks_array); $x++)
|
||||
<tr>
|
||||
<td>{{ get_name($banks_array[$x], "id", "name", "chart_of_accounts") }}</td>
|
||||
<td>{{ ugandan_shillings($amounts_array[$x]) }}</td>
|
||||
</tr>
|
||||
@php $total_banked += is_numeric($amounts_array[$x]) ? $amounts_array[$x] : 0; @endphp
|
||||
@endfor
|
||||
|
||||
<tr>
|
||||
<td>Memo</td>
|
||||
<td>{{ $deposit_memo }}</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong> Total Banked</strong></td>
|
||||
<td><strong> {{ ugandan_shillings($total_banked) }}</strong></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong> Deposite Date</strong></td>
|
||||
<td><strong> {{ streamline_date($deposit_date) }}</strong></td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td><strong> Banked By</strong></td>
|
||||
<td><strong> {{ get_full_name($banked_by, 'id', 'first_name', 'last_name', 'users') }}</strong></td>
|
||||
</tr>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-sm-3"></div>
|
||||
<i style="font-size: 0.8em; margin-left: 50%;">{{ __('family_accounts.streamline') }}</i>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('styles')
|
||||
<script type="text/javascript">
|
||||
function print_receipt() {
|
||||
let myDiv = document.getElementById('divToPrint');
|
||||
let newWindow = window.open('', 'SecondWindow', 'toolbar=0,stat=0');
|
||||
|
||||
newWindow.document.write("<html><body " +
|
||||
"class='' " +
|
||||
" onload='window.print()'>" +
|
||||
myDiv.innerHTML +
|
||||
"</body></html>");
|
||||
newWindow.document.close();
|
||||
return false;
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
+426
@@ -0,0 +1,426 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('banking.bank_deposits') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('banking.home') }}</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('banking.finance_home') }}</a></li>
|
||||
<li class="active"><i class="fa fa-bank"></i> {{ __('banking.new_bank_deposit') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
$balance = 0;
|
||||
@endphp
|
||||
|
||||
@include('flash::message')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel full-wrapper">
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="pull-left">
|
||||
<a href="javascript:void(0)" class="text-center db">
|
||||
@php $hospital_information = \Streamline\Models\HospitalInformation::first(); @endphp
|
||||
<img src="{{ asset($hospital_information->logo) }}" style="max-height: 160px; margin: auto; max-width: 260px;" alt="Home" /><br />
|
||||
</a>
|
||||
<address>
|
||||
<h3> <b class="text-danger">{{ $hospital_information->name }}</b></h3>
|
||||
<p class="text-muted m-l-5">{{ $hospital_information->phone_number }}, {{ $hospital_information->email }},
|
||||
<br /> {{ get_name($hospital_information->sub_county,'id', 'name', 'subcounties') }}, {{ get_name($hospital_information->district,'id', 'name', 'districts') }},
|
||||
<br /> {{ $hospital_information->country }}.
|
||||
</p>
|
||||
</address>
|
||||
</div>
|
||||
<div class="pull-right text-right">
|
||||
<address>
|
||||
<p class="m-t-30"><b>{{ __('banking.deposit_date') }}</b> <i class="fa fa-calendar"></i> {{ streamline_date_time(\Carbon\Carbon::now()->toDateTimeString()) }}</p>
|
||||
</address>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br />
|
||||
{{ Form::open(['route' => 'banking.process_deposit', 'data-toggle' => 'validator']) }}
|
||||
<h2><strong>{{ __('banking.details') }}</strong></h2>
|
||||
<h5>{{ __('banking.deposit_to_account') }}</h5>
|
||||
<br />
|
||||
|
||||
<table class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('banking.select_account') }}</th>
|
||||
<th>{{ __('banking.deposit_date') }}</th>
|
||||
<th>{{ __('banking.current_balance') }}</th>
|
||||
<th>{{ __('banking.memo') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<select class="form-control compulsory required" name="deposit_to" id="deposit_to" required>
|
||||
<option value="">-select-</option>
|
||||
@foreach($bank_accounts as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
{{ Form::text('deposit_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'deposit_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
<td>
|
||||
<input class="form-control" id="current_balance" readonly name="current_account_balance" type="text">
|
||||
</td>
|
||||
<td>
|
||||
<div class="form-group">
|
||||
<div class="input-group">
|
||||
{{ Form::text('deposit_memo', '', ['class'=>'form-control required compulsory', 'id'=>'memo']) }}
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<hr />
|
||||
|
||||
<h2><strong>{{ __('banking.deposit_details') }}</strong></h2>
|
||||
<h5>{{ __('banking.deposit_from_account') }}</h5>
|
||||
<br />
|
||||
|
||||
@php
|
||||
$options = "<option value=''>--select--</option>";
|
||||
foreach ($income_accounts as $item){
|
||||
$options .= "<option value='$item->id'>$item->name</option>";
|
||||
}
|
||||
@endphp
|
||||
|
||||
|
||||
<div class="input_fields_wrap">
|
||||
<div class="row">
|
||||
<div class="span1"></div>
|
||||
<div class="col-3">
|
||||
<div class=" control-group">
|
||||
<label class="control-label" for="item">{{ __('banking.from_account') }}</label>
|
||||
<div class="form-group">
|
||||
<select name='account[]' id='account_0' class="form-control select">
|
||||
<option value=''>-Select An Income Account-</option>
|
||||
@foreach($income_accounts as $item)
|
||||
<option style='color: orange;' value='{{ $item->id }}'>{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- From Account -->
|
||||
|
||||
@php
|
||||
$options = "<option value=''>-Select An Income Account-</option>";
|
||||
foreach ($income_accounts as $item){
|
||||
$options .= "<option value='$item->id'>$item->name</option>";
|
||||
}
|
||||
|
||||
$payment_method_options = "<select class='form-control' name='payment_method[]'>";
|
||||
$payment_method_options .= "<option value=''>-Select-</option>";
|
||||
foreach ($payment_methods as $key => $method):
|
||||
$payment_method_options .= "<option value='$method->id'>$method->name</option>";
|
||||
endforeach;
|
||||
$payment_method_options .= "</select>";
|
||||
@endphp
|
||||
|
||||
<div class='col-2'>
|
||||
<div class="form-group">
|
||||
<label class='control-label' class=''>Amount to Deposit</label>
|
||||
<div class=''>
|
||||
<input type='number' value='0' name='amount[]' id='amount_0' class='form-control compulsory'>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- <div class='col-2'>
|
||||
<div class="form-group">
|
||||
<label class='control-label' class=''>{{ __('banking.balance') }}</label>
|
||||
<div class=''>
|
||||
<input type='number' name='balance[]' id='balance_0' class='form-control compulsory' readonly>
|
||||
</div>
|
||||
</div>
|
||||
</div> -->
|
||||
|
||||
<div class="col-2">
|
||||
<div class="form-group">
|
||||
<label class="control-label">{{ __('banking.payment_method') }}</label>
|
||||
<div class=''>
|
||||
@php echo $payment_method_options; @endphp
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- Payment Method -->
|
||||
|
||||
<div class='col-4'>
|
||||
<div class="form-group">
|
||||
<label class='control-label' class=''>{{ __('banking.memo') }}</label>
|
||||
<div class=''>
|
||||
<textarea name='memo[]' id='memo_0' class='form-control' rows="3" cols="4"></textarea>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- Memo -->
|
||||
|
||||
<div class="col-1">
|
||||
<div class="form-group" style="margin-top: 22px; margin-left: 3px;">
|
||||
<a class="btn btn-success add_item" style="color: white"><i class="fa fa-plus"></i></a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class='col-7'></div>
|
||||
<div class='col-5'>
|
||||
<div class="form-group-group">
|
||||
<label class="control-label" for="tot">{{ __('banking.total') }}</label>
|
||||
<div class="controls">
|
||||
<input type="number" name="total_amount" value="0" id="total_amount" class="form-control compulsory" readonly />
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- Total -->
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class='col-9'></div>
|
||||
<div class='col-3'>
|
||||
<div style="display: block">
|
||||
<button type="submit" id="make_deposit" class="btn btn-block btn-success float-right">{{ __('banking.deposit') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
</div><!-- Total -->
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
|
||||
<script src="{{ asset('elite/js/validator.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ asset('elite/bower_components/html5-editor/wysihtml5-0.3.0.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ asset('elite/bower_components/html5-editor/bootstrap-wysihtml5.js') }}"></script>
|
||||
<script type="text/javascript" src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
function numberWithCommas(x) {
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
|
||||
$('#register_donation_btn').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('.register_donation').modal('show');
|
||||
});
|
||||
|
||||
$('#save_new_donation').click(function(e) {
|
||||
e.preventDefault();
|
||||
let income_account = $('#income_account').val();
|
||||
let donation_date = $('#new_donation_date').val();
|
||||
let donation_amount = $('#new_donation_amount').val();
|
||||
let donation_memo = $('#new_donation_memo').val();
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/store_other_income_deposit',
|
||||
data: {
|
||||
'income_account': income_account,
|
||||
'donation_date' : donation_date,
|
||||
'donation_amount' : donation_amount,
|
||||
'donation_memo' : donation_memo,
|
||||
},
|
||||
success: function(response) {
|
||||
$('.register_donation').modal('hide');
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
$('#deposit_date').change(function (){
|
||||
let bank = $('#deposit_to').val();
|
||||
let date = this.value;
|
||||
if(bank === ""){
|
||||
alert('Please select a bank account.')
|
||||
}
|
||||
else{
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/get_current_account_balance_per_date',
|
||||
data: {
|
||||
'bank': bank,
|
||||
'date' : date
|
||||
},
|
||||
success: function(response) {
|
||||
var acc_bal = 0;
|
||||
if (response != "null") {
|
||||
var bank_record = JSON.parse(response);
|
||||
acc_bal = bank_record.account_balance;
|
||||
}
|
||||
$('#current_balance').val(numberWithCommas(acc_bal));
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
</script>
|
||||
<script type="text/javascript">
|
||||
jQuery('#deposit_date, #new_donation_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
|
||||
$(".input_fields_wrap").on('change', '.select', function() {
|
||||
|
||||
var i = parseInt(this.id.substr(this.id.indexOf("_") + 1));
|
||||
var income_account = $("#account_" + i).val();
|
||||
var total_field = $("#total_amount");
|
||||
if (income_account === "") {
|
||||
alert("Please select an account please...!");
|
||||
return false;
|
||||
}
|
||||
var final_total = 0;
|
||||
$("[id^='amount_']").each(function() {
|
||||
final_total += Number($(this).val());
|
||||
});
|
||||
$('#total_amount').val(final_total);
|
||||
// $.ajax({
|
||||
// method: 'POST',
|
||||
// url: '/banking/get_other_income_account_balance',
|
||||
// data: {
|
||||
// 'date': date,
|
||||
// 'income_account': income_account
|
||||
// },
|
||||
//
|
||||
// success: function(response) {
|
||||
//
|
||||
// if(response != "null"){ // if response is not null
|
||||
// let data = JSON.parse(response);
|
||||
// balance.val(data['account_balance'])
|
||||
// }else{
|
||||
// balance.val(0)
|
||||
// $('#amount_'+ i).val(0)
|
||||
// $('#amount_'+ i).prop('disabled', true)
|
||||
// $('#account_'+ i).prop('disabled', true)
|
||||
// $('#memo_'+ i).prop('disabled', true)
|
||||
// }
|
||||
// var final_total = 0;
|
||||
// $("[id^='amount_']").each(function() {
|
||||
// final_total += Number($(this).val());
|
||||
// });
|
||||
// total_field.val(final_total);
|
||||
// },
|
||||
// error: function(error) {
|
||||
// console.log(error);
|
||||
// }
|
||||
// });
|
||||
});
|
||||
|
||||
$(".full-wrapper").on('click', function () {
|
||||
var total_field = $("#total_amount");
|
||||
var final_total = 0;
|
||||
$("[id^='amount_']").each(function() {
|
||||
final_total += Number($(this).val());
|
||||
});
|
||||
$('#total_amount').val(final_total);
|
||||
});
|
||||
|
||||
var max_fields = 20; //maximum input boxes allowed
|
||||
var wrapper = $(".input_fields_wrap"); //Fields wrapper
|
||||
var add_button = $(".add_item"); //Add button ID
|
||||
|
||||
var x = 1; //initlal text box count
|
||||
|
||||
$(add_button).click(function(e) { //on add input button click
|
||||
e.preventDefault();
|
||||
if (x < max_fields) { //max input box allowed
|
||||
x++; //text box increment
|
||||
$(wrapper).append("\
|
||||
<div class='row'>\n\
|
||||
<div class='span1'></div>\n\
|
||||
\n\
|
||||
<div class='col-3'>\n\
|
||||
<div class='form-group'>\n\
|
||||
<div class='form-group'>\n\
|
||||
<select name='account[]' id='account_" + x + "' class='form-control select'>\n\
|
||||
<?php echo $options; ?>\n\
|
||||
</select>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
\n\
|
||||
<div class='col-2'>\n\
|
||||
<div class='form-group'>\n\
|
||||
<input type='number' min=0 value=0 name='amount[]' id='amount_" + x + "' class='form-control compulsory'>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
\n\
|
||||
<div class='col-2'>\n\
|
||||
<div class='form-group'>\n\
|
||||
<div class='form-group'>\n\
|
||||
<?php echo $payment_method_options; ?>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
\n\
|
||||
<div class='col-4'>\n\
|
||||
<div>\n\
|
||||
<div class='form-group'>\n\
|
||||
<textarea name='memo[]'" + x + "' class='form-control' rows='3' cols='4'></textarea>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
\n\
|
||||
<div class='col-1'>\n\
|
||||
<div class=''>\n\
|
||||
<div class='form-group' style='margin-top: 5 px;'>\n\
|
||||
<a href='# ' class='remove_field btn btn-danger' style='margin-top: 5 px;'><i class='fa fa-times'></i></a>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
</div>\n\
|
||||
"); //add input box
|
||||
}
|
||||
});
|
||||
|
||||
$(wrapper).on("click", ".remove_field", function(e) { //user click on remove text
|
||||
e.preventDefault();
|
||||
$(this).parent('div').parent('div').parent('div').parent('div').remove();
|
||||
|
||||
var final_total = 0;
|
||||
var total_field = $("#total_amount");
|
||||
|
||||
$("[id^='amount_']").each(function() {
|
||||
final_total += Number($(this).val());
|
||||
});
|
||||
total_field.val(final_total);
|
||||
x--;
|
||||
});
|
||||
</script>
|
||||
|
||||
|
||||
@endpush
|
||||
+280
@@ -0,0 +1,280 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('banking.bank_deposit_history') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('banking.home') }}</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('banking.finance_home') }}</a></li>
|
||||
<li class="active"><i class="fa fa-bank"></i> {{ __('banking.bank_deposit_history') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
{{ Form::open(['method'=>'post','route' => 'banking.deposit_history']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.deposit_by') }}</label>
|
||||
<select class="form-control compulsory required" name="staff_member" id="staff_member" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="ALL STAFF">{{ __('banking.all_staff') }}</option>
|
||||
@foreach($staff_members as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->username }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.select_date') }}</label>
|
||||
<select class="form-control compulsory required" name="dates" id="dates" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="today">{{ __('banking.today') }}</option>
|
||||
<option value="yesterday">{{ __('banking.yesterday') }}</option>
|
||||
<option value="custom_date">{{ __('banking.custom_date') }}</option>
|
||||
<option value="custom_date_range">{{ __('banking.date_range') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div id="sDate" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.date_on') }}</label>
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'start_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div id="eDate" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.end_date') }}</label>
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'end_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group" style="margin-top: 25px;">
|
||||
{{ Form::submit('Submit', ['class'=>'btn btn-success btn-rounded btn-block pull-right']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
<hr style="height: 2px"/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<h2><strong>{{ __('banking.deposit_history') }}</strong></h2>
|
||||
<br/>
|
||||
@if(isset($display))
|
||||
<h3 class="label label-info"> {!! isset($display) ? $display : '' !!}</h3>
|
||||
@endif
|
||||
<br/>
|
||||
<br/>
|
||||
@php
|
||||
$amount_total = 0;
|
||||
$account_balance_total = 0;
|
||||
@endphp
|
||||
<div class="table-responsive">
|
||||
<table id="table" class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('banking.staff_in_charge') }}</th>
|
||||
<th>{{ __('banking.deposit_from') }}</th>
|
||||
<th>{{ __('banking.deposit_to') }}</th>
|
||||
<th>{{ __('banking.date') }}</th>
|
||||
<th>{{ __('banking.amount') }}</th>
|
||||
<th>{{ __('banking.account_balance') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(count($deposits) > 0)
|
||||
@foreach($deposits as $item)
|
||||
<tr>
|
||||
<td>{{ get_full_name($item->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
||||
<td>{{ isset($chart_of_accounts[$item->other_accounts]) ? $chart_of_accounts[$item->other_accounts] : ("N/A") }}</td>
|
||||
<td>{{ get_name($item->bank, 'id', 'name', 'chart_of_accounts') }}</td>
|
||||
<td>{{ streamline_date($item->trans_date) }}</td>
|
||||
<td>{{ ugandan_shillings($item->credit) }}</td>
|
||||
<td>{{ ugandan_shillings($item->account_balance) }}</td>
|
||||
</tr>
|
||||
@php
|
||||
$amount_total += $item->credit;
|
||||
$account_balance_total += $item->account_balance;
|
||||
@endphp
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</tbody>
|
||||
@if(count($deposits) > 0)
|
||||
<tr>
|
||||
<td colspan="3"></td>
|
||||
<td>
|
||||
<strong>{{ __('banking.total') }}</strong>
|
||||
</td>
|
||||
<td>
|
||||
{{ ugandan_shillings($amount_total) }}
|
||||
</td>
|
||||
<td>
|
||||
{{ ugandan_shillings($account_balance_total) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- Date Picker Plugin JavaScript -->
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
|
||||
$('#dates').change(function (e) {
|
||||
|
||||
if($(this).val() === "custom_date"){
|
||||
|
||||
$("#eDate").hide();
|
||||
$("#sDate").show();
|
||||
|
||||
}else if($(this).val() === "custom_date_range"){
|
||||
|
||||
$("#sDate").show();
|
||||
$("#eDate").show();
|
||||
}else{
|
||||
|
||||
$("#eDate").hide();
|
||||
$("#sDate").hide();
|
||||
}
|
||||
});
|
||||
|
||||
function bank_deposit(cashier_income_id, amount) {
|
||||
$('#deposit_amount').val(amount);
|
||||
$('#cashier_income_id').val(cashier_income_id);
|
||||
$('#banking_modal').modal('show');
|
||||
}
|
||||
|
||||
$('#confirm_deposit').click(function () {
|
||||
|
||||
var cashier_income_id = $('#cashier_income_id').val();
|
||||
var deposit_amount = $('#deposit_amount').val();
|
||||
var deposit_account = $('#deposit_account').val();
|
||||
var deposit_date = $('#deposit_date').val();
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/quick_bank_deposit',
|
||||
data: {
|
||||
'cashier_income_id' : cashier_income_id,
|
||||
'deposit_amount' : deposit_amount,
|
||||
'deposit_account' : deposit_account,
|
||||
'deposit_date' : deposit_date,
|
||||
},
|
||||
|
||||
success: function(response){
|
||||
console.log(response);
|
||||
$('#banking_modal').modal('hide');
|
||||
$('#bank_' + cashier_income_id).hide();
|
||||
$('#div_' + cashier_income_id).append("<label class='label label-success'>BANKED</label>");
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function get_acc_bal(bank_id) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/get_current_account_balance',
|
||||
data: {'bank_id' : bank_id},
|
||||
|
||||
success: function(response){
|
||||
var acc_bal = response[0].balance;
|
||||
var amount = $('#deposit_amount').val();
|
||||
$('#current_account_balance').val(acc_bal);
|
||||
$('#new_account_balance').val(acc_bal + parseInt(amount));
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery('#end_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery('#start_date ,#deposit_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
pageLength: 100,
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
"aoColumnDefs": [{
|
||||
"aTargets": [2,3],
|
||||
"defaultContent": "",
|
||||
}]
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#staff_member').select2({
|
||||
placeholder: "-- select --"
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
+573
@@ -0,0 +1,573 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
|
||||
<style>
|
||||
.row_color {
|
||||
background: gold;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Bank Reconciliation</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-bank"></i> Bank Reconciliation</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
$balance = 0;
|
||||
@endphp
|
||||
|
||||
<br />
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
{{ Form::open(['route' => 'banking.reconcile', 'data-toggle' => 'validator']) }}
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Bank Account :</label>
|
||||
<select class="form-control compulsory required" name="bank" id="bank" required>
|
||||
<option value="">-select-</option>
|
||||
@foreach($banks as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Reconciliation Date :</label>
|
||||
<div class="input-group">
|
||||
<input class="center form-control" id="reconciliation_date" readonly style="padding: 2px;border: 1px solid #ddd;" name="reconciliation_date">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Opening Bank Balance (Stre@mline):</label>
|
||||
<div class="input-group">
|
||||
<input class="center form-control compulsory" required id="opening_balance" type="number" style="padding: 2px;border: 1px solid #ddd;" readonly name="opening_balance">
|
||||
<span class="input-group-addon">.UGX</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Ending Balance (Bank Statement):</label>
|
||||
<div class="input-group">
|
||||
<input class="center form-control compulsory" required id="ending_balance_input" type="number" style="padding: 2px;border: 1px solid #ddd;" name="ending_balance_input">
|
||||
<span class="input-group-addon">.UGX</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<button class="btn btn-success btn-block" style="margin-top: 25px;">Submit</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ Form::close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<hr />
|
||||
<br />
|
||||
|
||||
@if(!empty($request->all()))
|
||||
{{ Form::open(['route' => 'banking.finish_reconciling', 'data-toggle' => 'validator', 'id'=>'finish_reconciliation_form']) }}
|
||||
@if(isset($display))
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
<h3 class="label label-megna label-rounded"> {!! isset($display) ? $display : '' !!}</h3>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<br />
|
||||
<div class="row">
|
||||
<div class="table-bordered col-md-8">
|
||||
<div class="row">
|
||||
<div class="col-md-5 text-center">
|
||||
<h3>Ending Bank Statement Balance: </h3><span id="ending_balance" style="font-size: 3vw; display: none;">{{ $request->ending_balance_input }}</span>
|
||||
<span id="ending_balance_display" style="font-size: 3vw;">{{ ugandan_shillings($request->ending_balance_input) }}</span>
|
||||
</div>
|
||||
<div class="col-md-2 text-center">
|
||||
<b><span style="font-size: 4vw;"> - </span></b>
|
||||
</div>
|
||||
<div class="col-md-5 text-center">
|
||||
<h3>Opening Stre@mline Bank Balance: </h3> <b style="display: none;"><span id="balance" style="font-size: 3vw;">{{ is_null($request->opening_balance) ? 0 : $request->opening_balance }}</span></b>
|
||||
<b><span id="balance_display" style="font-size: 3vw;">{{ is_null($request->opening_balance) ? 0 : ugandan_shillings($request->opening_balance) }}</span></b>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-4 text-center">
|
||||
<h3>Difference: </h3><b>
|
||||
<span id="difference" style="font-size: 3vw; display: none">{{ (int)$request->ending_balance_input - (int)$request->opening_balance }}</span>
|
||||
<span id="difference_display" style="font-size: 3vw;">{{ ugandan_shillings((int)$request->ending_balance_input - (int)$request->opening_balance) }}</span>
|
||||
</b>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<input type="hidden" value="{{ is_null($request->opening_balance) ? 0 : $request->opening_balance }}" id="old_balance">
|
||||
<input type="hidden" value="{{ (int)$request->ending_balance_input - (int)$request->opening_balance }}" id="old_difference">
|
||||
|
||||
<input type="hidden" name="ending_bank_statement_balance" value="{{ $request->ending_balance_input }}">
|
||||
<input type="hidden" name="opening_streamline_balance" value="{{ $request->opening_balance }}">
|
||||
<input type="hidden" name="reconciliation_period" value="{{ $reconciliation_end_date }}">
|
||||
<input type="hidden" name="bank" value="{{ $request->bank }}">
|
||||
|
||||
<br />
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-9 b-r">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
@php
|
||||
$sum_balance = 0;
|
||||
$sum_credit = 0;
|
||||
$sum_debit = 0;
|
||||
@endphp
|
||||
<div class="table-responsive">
|
||||
<table id="table" class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>#</th>
|
||||
<th>Transaction Date :</th>
|
||||
<th>Record Date :</th>
|
||||
<th>Staff In-Charge :</th>
|
||||
<th>Type</th>
|
||||
<th>Account</th>
|
||||
<th>Memo</th>
|
||||
<th>Debit</th>
|
||||
<th>Credit</th>
|
||||
<th>Balance</th>
|
||||
<th class="text-center">Action</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@php
|
||||
$counter = 1;
|
||||
@endphp
|
||||
@if(count($banking_records) > 0)
|
||||
@foreach($banking_records as $record)
|
||||
@php
|
||||
$sum_credit += $record->credit;
|
||||
$sum_debit += $record->debit;
|
||||
@endphp
|
||||
<tr id="record_row_{{ $record->id }}">
|
||||
<td>{{ $counter }}.</td>
|
||||
<td>{{ streamline_date($record->trans_date) }}</td>
|
||||
<td>{{ streamline_date($record->created_at) }}</td>
|
||||
<td>{{ get_full_name($record->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
||||
<td>{{ $record->trans_type }}</td>
|
||||
@php
|
||||
$banks = explode(',',$record->bank);
|
||||
$other_accounts = explode(',',$record->other_accounts);
|
||||
@endphp
|
||||
|
||||
<td>
|
||||
@for($x = 0; $x
|
||||
< count($other_accounts); $x++) {{ get_name($other_accounts[$x], 'id', 'name', 'chart_of_accounts') }} <br />
|
||||
@endfor
|
||||
</td>
|
||||
<td>{{ $record->memo }}</td>
|
||||
@if($record->debit != 0)
|
||||
<td>{{ ugandan_shillings($record->debit) }}</td>
|
||||
<input id="debit_amount_{{ $record->id }}" value="{{ $record->debit }}" type="hidden">
|
||||
@else
|
||||
<td>{{ ugandan_shillings(0) }}</td>
|
||||
<input id="debit_amount_{{ $record->id }}" value="{{ 0 }}" type="hidden">
|
||||
@endif
|
||||
@if($record->credit != 0)
|
||||
<td>{{ ugandan_shillings($record->credit) }}</td>
|
||||
<input id="credit_amount_{{ $record->id }}" value="{{ $record->credit }}" type="hidden">
|
||||
@else
|
||||
<td>{{ ugandan_shillings(0) }}</td>
|
||||
<input id="credit_amount_{{ $record->id }}" value="{{ 0 }}" type="hidden">
|
||||
@endif
|
||||
<td>{{ ugandan_shillings($record->account_balance) }}</td>
|
||||
|
||||
@if($loop->last)
|
||||
@php $sum_balance = $record->account_balance; @endphp
|
||||
@endif
|
||||
|
||||
<td class="text-center">
|
||||
@if($record->debit != 0)
|
||||
<input type="checkbox" name="reconciled_trans_ids[]" value="{{ $record->id }}" id="debit_checkbox_{{ $record->id }}">
|
||||
@elseif($record->credit != 0)
|
||||
<input type="checkbox" name="reconciled_trans_ids[]" value="{{ $record->id }}" id="credit_checkbox_{{ $record->id }}">
|
||||
@elseif($record->debit == 0 && $record->credit == 0)
|
||||
<input type="checkbox" name="reconciled_trans_ids[]" value="{{ $record->id }}" id="debit_checkbox_{{ $record->id }}">
|
||||
@endif
|
||||
|
||||
<input type="hidden" name="unreconciled_trans_ids[]" value="{{ $record->id }}" id="unreconciled_checkbox_{{ $record->id }}" checked>
|
||||
</td>
|
||||
</tr>
|
||||
@php $counter++; @endphp
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12">
|
||||
<hr>
|
||||
<div class="form-group">
|
||||
{{ Form::label('memo', 'Reconciliation Memo / Comment (Optional)', ['style' => 'font-size: 18px; font-weight: 400'])}}
|
||||
{{ Form::textarea('memo','',['class' => 'form-control'])}}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-12 pull-right text-right">
|
||||
<button class="btn btn-primary btn-rounded" id="finish_reconciliation">Finish Reconciliation</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<br>
|
||||
<div class="col-md-3">
|
||||
<br />
|
||||
<h3><strong>Previous Reconciliation Reports</strong></h3>
|
||||
<ul>
|
||||
@foreach($reconciliation_reports as $report)
|
||||
<li>
|
||||
<a target="_blank" href="{{ route('bank.reconciliation.report', $report->id) }}">
|
||||
{{ streamline_date_time($report->reconciliation_period) }} by {{ get_full_name($report->created_by, "id", "first_name", "last_name", "users") }}
|
||||
</a>
|
||||
</li>
|
||||
<br />
|
||||
@endforeach
|
||||
</ul>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ Form::close() }}
|
||||
@else
|
||||
<div class="row">
|
||||
<div class="col-md-12 text-center">
|
||||
<h3 class="label label-warning label-rounded"> Please Be Sure To Fill In All The Necessary Fields And Then Submit. </h3>
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('banking::banking.reconcile.modals.finish_with_discrepancy')
|
||||
@include('banking::banking.reconcile.modals.finish_reconciliation')
|
||||
@include('banking::banking.reconcile.modals.perform_adjustment')
|
||||
|
||||
<div class="modal" id="complete_reconciliation" tabindex="-1" role="dialog" aria-labelledby="complete_reconciliation_label" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header text-center">
|
||||
<h5 class="modal-title" id="complete_reconciliation_label"><b>Confirm</b></h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8 b-r">
|
||||
<h3>
|
||||
Are you sure you want to complete this reconciliation
|
||||
</h3>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<a class="btn-block btn btn-warning" id="cancel_the_reconciliation">Cancel</a>
|
||||
<a class="btn-block btn btn-success" id="complete_the_reconciliation">Complete Reconciliation</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- Date Picker Plugin JavaScript -->
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#finish_reconciliation').click(function(e) {
|
||||
e.preventDefault();
|
||||
var unreconciled_array = [];
|
||||
var difference = $('#difference').text();
|
||||
$("[id^=unreconciled_checkbox_]").each(function() {
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
var unreconciled = $('#unreconciled_checkbox_' + id).val();
|
||||
if (unreconciled !== '') {
|
||||
unreconciled_array.push(id[0]);
|
||||
}
|
||||
});
|
||||
|
||||
if (unreconciled_array.length === 0) {
|
||||
if (parseInt(difference) === 0) {
|
||||
$('#complete_reconciliation').modal('show');
|
||||
//$('#finish_reconciliation_form').submit();
|
||||
} else {
|
||||
alert('It Appears There Is A Discrepancy Of ' + difference)
|
||||
$('#finish_reconciliation_modal').modal('show');
|
||||
}
|
||||
} else {
|
||||
var _confirm = confirm('You have a difference of ' + difference + ". There are some unreconciled (unticked) transactions. Do you want to continue ?");
|
||||
if (_confirm) {
|
||||
if (parseInt(difference) === 0) {
|
||||
$('#complete_reconciliation').modal('show');
|
||||
//$('#finish_reconciliation_form').submit();
|
||||
} else {
|
||||
$('#finish_reconciliation_modal').modal('show');
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
$('#complete_the_reconciliation').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#finish_reconciliation_form').submit();
|
||||
});
|
||||
|
||||
$('#cancel_the_reconciliation').click(function(e) {
|
||||
e.preventDefault();
|
||||
$('#complete_reconciliation').modal('hide');
|
||||
});
|
||||
|
||||
$('#finish_with_balance_btn').click(function(e) {
|
||||
e.preventDefault();
|
||||
var adjustment_balance = $('#difference').text();
|
||||
var ending_balance = $('#ending_balance').text();
|
||||
|
||||
$('#__adjustment_difference_balance').val(parseInt(adjustment_balance));
|
||||
$('#__ending_balance').val(parseInt(ending_balance));
|
||||
console.log(adjustment_balance)
|
||||
|
||||
$('#finish_reconciliation_modal').modal('hide');
|
||||
$('#finish_with_discrepancy_modal').modal('show');
|
||||
});
|
||||
|
||||
$('#perform_adjustment').click(function(e) {
|
||||
e.preventDefault();
|
||||
|
||||
var adjustment_balance = $('#difference').text();
|
||||
|
||||
$('#adjustment_difference_balance').val(parseInt(adjustment_balance));
|
||||
|
||||
$('#finish_reconciliation_modal').modal('hide');
|
||||
$('#perform_adjustment_modal').modal('show');
|
||||
})
|
||||
|
||||
function finish_adjustment() {
|
||||
$('#performAdjustmentBtn').prop('disabled', true);//disable button to avoid double submission
|
||||
var bank = $('#bank_id').val();
|
||||
var account = $('#account').val();
|
||||
var accountText = $('#account option:selected').text();
|
||||
var amount = $('#adjustment_difference_balance').val();
|
||||
var ending_balance = $('#ending_balance').text();//$('#_ending_balance').val();
|
||||
var reconciliation_period = $('#_reconciliation_period').val();
|
||||
|
||||
if ((amount < 0 && accountText.indexOf("(Expense)") > 0) || (amount > 0 && accountText.indexOf("(Income)") > 0)) {
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '/banking/finish_adjustment',
|
||||
data: {
|
||||
'account': account,
|
||||
'bank': bank,
|
||||
'amount': amount,
|
||||
'ending_balance': ending_balance,
|
||||
'reconciliation_period': reconciliation_period,
|
||||
},
|
||||
success: function(response) {
|
||||
if (response == 'success') {
|
||||
$('#difference').text(0);
|
||||
$('#finish_reconciliation_form').submit();
|
||||
} else {
|
||||
alert("Action failed!")
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
alert(error);
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
alert("If the 'Amount To Be Adjusted' is Negative, select an Expense account!\nIf the 'Amount To Be Adjusted' is Positive, select an Income account!");
|
||||
}
|
||||
}
|
||||
|
||||
function finish_with_discrepancy() {
|
||||
var bank = $('#__bank_id').val();
|
||||
var memo = $('#__memo').val();
|
||||
var amount = $('#__adjustment_difference_balance').val();
|
||||
var ending_balance = $('#__ending_balance').val();
|
||||
var reconciliation_period = $('#__reconciliation_period').val();
|
||||
|
||||
$.ajax({
|
||||
method: 'post',
|
||||
url: '/banking/finish_with_balance',
|
||||
data: {
|
||||
'bank': bank,
|
||||
'memo': memo,
|
||||
'amount': amount,
|
||||
'ending_balance': ending_balance,
|
||||
'reconciliation_period': reconciliation_period,
|
||||
},
|
||||
success: function(response) {
|
||||
if (response == 'success') {
|
||||
$('#finish_reconciliation_form').submit();
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error)
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// when a row:
|
||||
// - is checked
|
||||
// - if it has a debit value, opening balance reduces by the debit amount
|
||||
// - is then unchecked (if was previously checked)
|
||||
// - if it has a debit value, opening balance increases by the debit amount
|
||||
$("[id^='debit_checkbox_']").on("change", function() {
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
|
||||
var amount = $('#debit_amount_' + id).val();
|
||||
var balance = $('#balance').text();
|
||||
var new_balance = parseInt(balance);
|
||||
|
||||
if (this.checked) {
|
||||
new_balance = parseInt(balance) - parseInt(amount);
|
||||
$('#record_row_' + id).children('td, th').css('background-color', 'gold');
|
||||
$('#unreconciled_checkbox_' + id).checked = false;
|
||||
$('#unreconciled_checkbox_' + id).val('');
|
||||
} else {
|
||||
new_balance = parseInt(balance) + parseInt(amount);
|
||||
$('#record_row_' + id).children('td, th').css('background-color', 'white');
|
||||
$('#unreconciled_checkbox_' + id).checked = true;
|
||||
$('#unreconciled_checkbox_' + id).val(id);
|
||||
}
|
||||
|
||||
var new_difference = parseInt(<?php echo json_encode((int)$request->ending_balance_input); ?>) - new_balance;
|
||||
$('#balance').text(new_balance);
|
||||
$('#difference').text(new_difference);
|
||||
//display
|
||||
$('#balance_display').text(numberWithCommas(new_balance));
|
||||
$('#difference_display').text(numberWithCommas(new_difference));
|
||||
});
|
||||
|
||||
// when a row:
|
||||
// - is checked
|
||||
// - if it has a credit value, opening balance increases by the credit amount
|
||||
// - is then unchecked (if was previously checked)
|
||||
// - if it has a credit value, opening balance reduces by the credit amount
|
||||
$("[id^='credit_checkbox_']").on("change", function() {
|
||||
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
|
||||
|
||||
var amount = $('#credit_amount_' + id).val();
|
||||
var balance = $('#balance').text();
|
||||
var new_balance = parseInt(balance);
|
||||
|
||||
if (this.checked) {
|
||||
new_balance = parseInt(balance) + parseInt(amount);
|
||||
$('#record_row_' + id).children('td, th').css('background-color', 'gold');
|
||||
$('#unreconciled_checkbox_' + id).checked = false;
|
||||
$('#unreconciled_checkbox_' + id).val('');
|
||||
} else {
|
||||
new_balance = parseInt(balance) - parseInt(amount);
|
||||
$('#record_row_' + id).children('td, th').css('background-color', 'white');
|
||||
$('#unreconciled_checkbox_' + id).checked = true;
|
||||
$('#unreconciled_checkbox_' + id).val(id);
|
||||
}
|
||||
|
||||
let new_difference = parseInt(<?php echo json_encode((int)$request->ending_balance_input); ?>) - new_balance;
|
||||
|
||||
$('#balance').text(new_balance);
|
||||
$('#difference').text(new_difference);
|
||||
//display
|
||||
$('#balance_display').text(numberWithCommas(new_balance));
|
||||
$('#difference_display').text(numberWithCommas(new_difference));
|
||||
});
|
||||
|
||||
$('#reconciliation_date, #bank').change(function() {
|
||||
let bank = $('#bank').val();
|
||||
let reconciliation_date = $('#reconciliation_date').val();
|
||||
let [dd, mm, yyyy] = reconciliation_date.split("-");
|
||||
let formatted_reconciliation_date = `${yyyy}-${mm}-${dd}`;
|
||||
|
||||
if (bank !== '' && reconciliation_date !== '') {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/get_last_reconciliation_balance',
|
||||
data: {
|
||||
'bank': bank,
|
||||
'reconciliation_date': formatted_reconciliation_date
|
||||
},
|
||||
success: function(response) {
|
||||
var record = JSON.parse(response);
|
||||
if (record != null) {
|
||||
$('#opening_balance').val(record);
|
||||
// opening_balance
|
||||
// if they had a reconciliation the previous month, opening_balance should pick that latest reconciliation balance
|
||||
// else opening_balance must be the balance as of the end of the previous month
|
||||
} else {
|
||||
alert('No Opening Balance Registered As Of The Provided Date, Please Select Another Date.')
|
||||
$('#reconciliation_date').val('');
|
||||
}
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
});
|
||||
|
||||
function numberWithCommas(x) {
|
||||
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
|
||||
}
|
||||
|
||||
$('#reconciliation_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
|
||||
$('#staff_member_cashier').select2({
|
||||
placeholder: "-- select --"
|
||||
});
|
||||
|
||||
$('#staff_member_accountant').select2({
|
||||
placeholder: "-- select --"
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
+55
@@ -0,0 +1,55 @@
|
||||
<div class="modal" id="finish_reconciliation_modal" tabindex="-1" role="dialog" aria-labelledby="finish_reconciliation_modal_label" aria-hidden="true">
|
||||
<div class="modal-dialog modal-lg" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header text-center">
|
||||
<h5 class="modal-title" id="finish_reconciliation_modal_label"><b>Reconciliation</b></h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-8 b-r">
|
||||
<p>
|
||||
Leave reconciliation process and perform other finance tasks.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<a class="btn-block btn btn-danger" href="{{ route('finance') }}">Leave Reconciliation</a>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-8 b-r">
|
||||
<p>
|
||||
Return to reconciliation page and double check with the transactions and confirm checked transactions.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button class="btn-block btn btn-warning" data-dismiss="modal">Return To Reconciliation</button>
|
||||
</div>
|
||||
</div>
|
||||
<hr>
|
||||
<div class="row">
|
||||
<div class="col-md-8 b-r">
|
||||
<p>
|
||||
{{-- Perform adjustment by transferring the pending balance to an expense account and then finish the reconciliation process. --}}
|
||||
If the 'Amount To Be Adjusted' is Negative, select an Expense account!<br>If the 'Amount To Be Adjusted' is Positive, select an Income account
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button class="btn-block btn btn-primary" id="perform_adjustment">Adjustment</button>
|
||||
</div>
|
||||
</div>
|
||||
{{-- <hr/>
|
||||
<div class="row">
|
||||
<div class="col-md-8 b-r">
|
||||
<p>
|
||||
Finish reconciliation process with the difference and explain reason for the discrepancy.
|
||||
</p>
|
||||
</div>
|
||||
<div class="col-md-4">
|
||||
<button class="btn-block btn btn-success" id="finish_with_balance_btn">Finish With Discrepancy</button>
|
||||
</div>
|
||||
</div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+38
@@ -0,0 +1,38 @@
|
||||
<div class="modal" id="finish_with_discrepancy_modal" tabindex="-1" role="dialog" aria-labelledby="finish_with_discrepancy_modal_label" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header text-center">
|
||||
<h5 class="modal-title" id="finish_with_discrepancy_modal_label"><b>Finish With Discrepancy</b></h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label>Discrepancy</label>
|
||||
<input id="__adjustment_difference_balance" type="number" class="form-control">
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Bank Account</label>
|
||||
{{ Form::text('bank_name', get_name($bank, 'id', 'name', 'chart_of_accounts'), ['class'=>'form-control compulsory', 'id'=>'expense_account_name', 'readonly']) }}
|
||||
{{ Form::hidden('bank_id', $bank, ['id'=>'__bank_id']) }}
|
||||
{{ Form::hidden('reconciliation_period', $reconciliation_end_date, ['id'=>'__reconciliation_period']) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Memo :</label>
|
||||
{{ Form::textarea('memo', '', ['class'=>'form-control', 'compulsory', 'rows'=>'5', 'id'=>'__memo']) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Enter Closing Balance :</label>
|
||||
<input name="ending_balance" id="__ending_balance" type="number" class="form-control compulsory">
|
||||
</div>
|
||||
|
||||
<button class="btn btn-rounded btn-block btn-success" onclick="finish_with_discrepancy()">Proceed</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+36
@@ -0,0 +1,36 @@
|
||||
<div class="modal" id="perform_adjustment_modal" tabindex="-1" role="dialog" aria-labelledby="perform_adjustment_modal_label" aria-hidden="true">
|
||||
<div class="modal-dialog" role="document">
|
||||
<div class="modal-content">
|
||||
<div class="modal-header text-center">
|
||||
<h5 class="modal-title" id="perform_adjustment_modal_label"><b>Perform Adjustment</b></h5>
|
||||
</div>
|
||||
<div class="modal-body">
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="form-group">
|
||||
<label>Amount To Be Adjusted</label>
|
||||
<input id="adjustment_difference_balance" type="number" class="form-control" readonly>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Bank Account</label>
|
||||
{{ Form::text('bank_name', get_name($bank, 'id', 'name', 'chart_of_accounts'), ['class'=>'form-control compulsory', 'id'=>'expense_account_name', 'readonly']) }}
|
||||
{{ Form::hidden('bank_id', $bank, ['id'=>'bank_id']) }}
|
||||
{{ Form::hidden('_reconciliation_period', $reconciliation_end_date, ['id'=>'_reconciliation_period']) }}
|
||||
{{ Form::hidden('_ending_balance', $request->ending_balance, ['id'=>'_ending_balance']) }}
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>Adjustment Expense/Income Account</label>
|
||||
<select name='account' id='account' class='form-control compulsory required' required>
|
||||
@php echo $option_accounts; @endphp
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<button class="btn btn-rounded btn-block btn-success" onclick="finish_adjustment()" id="performAdjustmentBtn">Perform Adjustment</button>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
+403
@@ -0,0 +1,403 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
|
||||
<style style="text-css">
|
||||
body{
|
||||
/*font-size: 1.2em;*/
|
||||
}
|
||||
|
||||
thead {
|
||||
/*display: table-header-group;*/
|
||||
}
|
||||
|
||||
tfoot {
|
||||
/*display: table-row-group;*/
|
||||
}
|
||||
|
||||
tr {
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
|
||||
td{
|
||||
padding: 2px;
|
||||
}
|
||||
th{
|
||||
padding: 2px;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
@php
|
||||
$reconciled_transactions = explode(',',$report->reconciled_trans_ids);
|
||||
$unreconciled_transactions = explode(',',$report->unreconciled_trans_ids);
|
||||
$total_cleared_credit = $total_cleared_debit = 0;
|
||||
$total_uncleared_credit = $total_uncleared_debit = 0;
|
||||
$total_uncleared = $total_cleared = 0;
|
||||
@endphp
|
||||
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
@include('layouts.header_pdf_print')
|
||||
<h6 class="heading" style="text-align: center;"><b><u>BANK RECONCILIATION REPORT</u></b></h6>
|
||||
<h6 class="heading" style="text-align: center;"><b>{{ $chart_of_accounts[$report->bank] }} as at {{ streamline_date($report->reconciliation_period) }}</b></h6>
|
||||
<h6 class="heading" style="text-align: center;"><b>{{-- RECONCILED BY: {{ get_full_name($report->created_by, "id", "first_name", "last_name", "users")}} <br> --}}Date: {{ streamline_date($report->created_at) }}</b></h6>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-12">
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-body" style="font-size: 12px;">
|
||||
<div class="row">
|
||||
<div class="col-12 text-left">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center; padding: 3px;">
|
||||
Reconciliation Summary
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@php
|
||||
$beginning_of_month = \Carbon\Carbon::parse($report->reconciliation_period)->startOfMonth()->toDateTimeString();
|
||||
@endphp
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 5px;">
|
||||
Stre@mline Opening Balance As Of {{ streamline_date($beginning_of_month) }}:
|
||||
</td>
|
||||
<td style="padding: 5px;">
|
||||
<b>{{ ugandan_shillings($report->opening_streamline_balance) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 5px;">
|
||||
Bank Statement Ending Balance As Of {{ streamline_date($report->reconciliation_period) }}:
|
||||
</td>
|
||||
<td style="padding: 5px;">
|
||||
<b>{{ ugandan_shillings($report->ending_bank_statement_balance) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td style="padding: 5px;">
|
||||
@php
|
||||
$banking_record = get_latest_banking_record($report->bank, $report->reconciliation_period);
|
||||
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
|
||||
|
||||
$orderByCreatedAtIfTransDateIsTheSame = "created_at DESC";
|
||||
$orderByIdIfTransDateIsTheSame = "id DESC";
|
||||
|
||||
$last_record_that_month = DB::table('banking')
|
||||
->whereNull('deleted_at')
|
||||
->where('bank', '=', $report->bank)
|
||||
->where('memo', '!=', 'bank reconciliation adjustment')
|
||||
->whereDate('trans_date', '<=', \Carbon\Carbon::parse($report->reconciliation_period)->toDateString())
|
||||
->orderBy('trans_date', 'desc')
|
||||
->orderByRaw($orderByCreatedAtIfTransDateIsTheSame)
|
||||
->orderByRaw($orderByIdIfTransDateIsTheSame)
|
||||
->first();
|
||||
$last_running_balance_of_month = ($last_record_that_month != null) ? (int)$last_record_that_month->account_balance : 0;
|
||||
@endphp
|
||||
Bank Register Closing Balance As Of {{ streamline_date($report->reconciliation_period) }}:
|
||||
</td>
|
||||
<td style="padding: 5px;">
|
||||
<b>{{ ugandan_shillings($last_running_balance_of_month) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
$last_banking_record = \Streamline\Models\Banking::where('reconciled',$report->id)->orderBy('id', 'desc')->first();
|
||||
@endphp
|
||||
@if ($last_banking_record->memo == "bank reconciliation adjustment")
|
||||
<td style="padding: 5px;"> Reconciliation Discrepancy Balance : </td>
|
||||
<td style="padding: 5px;">
|
||||
<b>{{ $last_banking_record->credit ? ugandan_shillings($last_banking_record->credit) : "-".ugandan_shillings(abs($last_banking_record->debit)) }}</b>
|
||||
</td>
|
||||
@else
|
||||
<td style="padding: 5px;"> Reconciliation Discrepancy Balance :</td>
|
||||
<td style="padding: 5px;">
|
||||
<b>{{ ugandan_shillings(0) }}</b>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
@if ($report->memo)
|
||||
<tr>
|
||||
<td style="padding: 5px;">Memo :</td>
|
||||
<td style="padding: 5px;">
|
||||
{{ $report->memo }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h6><b>Cleared Transactions</b></h6>
|
||||
<strong><b>Checks and Payments</b></strong>
|
||||
|
||||
|
||||
@if(count($reconciled_transactions) > 0)
|
||||
<div>
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>To</th>
|
||||
<th>Memo</th>
|
||||
<th style="width: 10%">Date</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach($reconciled_transactions as $trans_id)
|
||||
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
|
||||
@if(!is_null($transaction))
|
||||
@if($transaction->trans_type == 'PAYMENT' || $transaction->trans_type == 'TRANSFER')
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 2px;">{{ $chart_of_accounts[$transaction->bank] }}</td>
|
||||
|
||||
@php
|
||||
$other_accounts_array = explode(',',$transaction->other_accounts);
|
||||
@endphp
|
||||
|
||||
<td style="padding: 2px;">
|
||||
@for($x = 0; $x < count($other_accounts_array); $x ++)
|
||||
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
|
||||
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
|
||||
@else
|
||||
@php
|
||||
$item = isset($payment_items[$other_accounts_array[$x]]) ? $payment_items[$other_accounts_array[$x]] : "";
|
||||
@endphp
|
||||
{{ $item }}
|
||||
@endif
|
||||
@endfor
|
||||
</td>
|
||||
|
||||
<td style="padding: 2px;">{{ $transaction->memo }}</td>
|
||||
|
||||
<td style="padding: 2px;">{{ streamline_date($transaction->trans_date) }}</td>
|
||||
@php $total_cleared_debit += (int)$transaction->debit; @endphp
|
||||
<td style="padding: 2px;"> - {{ ugandan_shillings($transaction->debit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
</table>
|
||||
</div>
|
||||
@endif
|
||||
|
||||
|
||||
<strong><b>Deposits and Credits</b></strong>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>To</th>
|
||||
<th>Memo</th>
|
||||
<th>Date</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@if(count($reconciled_transactions) > 0)
|
||||
@foreach($reconciled_transactions as $trans_id)
|
||||
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
|
||||
@if(!is_null($transaction))
|
||||
@if($transaction->trans_type == 'DEPOSIT')
|
||||
@php $other_accounts_array = explode(',',$transaction->other_accounts); @endphp
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 3px;">
|
||||
@for($x = 0; $x < count($other_accounts_array); $x ++)
|
||||
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
|
||||
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
|
||||
@else
|
||||
@php
|
||||
$item = isset($payment_items[$other_accounts_array[$x]]) ? $payment_items[$other_accounts_array[$x]] : "";
|
||||
@endphp
|
||||
{{ $item }}
|
||||
@endif
|
||||
@endfor
|
||||
</td>
|
||||
<td style="padding: 3px;">{{ $chart_of_accounts[$transaction->bank] }}</td>
|
||||
<td style="padding: 3px;">{{ $transaction->memo }}</td>
|
||||
<td style="padding: 3px;">{{ streamline_date($transaction->trans_date) }}</td>
|
||||
@php $total_cleared_credit += (int)$transaction->credit; @endphp
|
||||
<td style="padding: 3px;">{{ ugandan_shillings($transaction->credit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</table>
|
||||
|
||||
<h6><b>Total Cleared Balance : {{ ugandan_shillings($total_cleared = ($total_cleared_credit - $total_cleared_debit)) }}</b></h6>
|
||||
|
||||
<br/>
|
||||
<hr/>
|
||||
|
||||
<h6><b>Uncleared Transactions</b></h6>
|
||||
<strong><b>Checks and Payments</b></strong>
|
||||
|
||||
|
||||
@if(count($unreconciled_transactions) > 0)
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>To</th>
|
||||
<th>Memo</th>
|
||||
<th>Date</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@foreach($unreconciled_transactions as $trans_id)
|
||||
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
|
||||
@if(!is_null($transaction))
|
||||
@if($transaction->trans_type == 'PAYMENT' || $transaction->trans_type == 'TRANSFER')
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 3px;">{{ $chart_of_accounts[$transaction->bank] }}</td>
|
||||
<td style="padding: 3px;">
|
||||
@php
|
||||
$uncleared_other_accounts_string = $transaction->other_accounts;
|
||||
$uncleared_other_accounts_array = is_null($uncleared_other_accounts_string) ? [] : explode(",", $uncleared_other_accounts_string);
|
||||
@endphp
|
||||
@for($x = 0; $x < count($uncleared_other_accounts_array); $x ++)
|
||||
@if(isset($chart_of_accounts[$uncleared_other_accounts_array[$x]]))
|
||||
{{ $chart_of_accounts[$uncleared_other_accounts_array[$x]] }}
|
||||
@else
|
||||
@php
|
||||
$item = $payment_items[$uncleared_other_accounts_array[$x]] ?? "";
|
||||
@endphp
|
||||
{{ $item }}
|
||||
@endif
|
||||
@endfor
|
||||
</td>
|
||||
<td style="padding: 3px;">{{ $transaction->memo }}</td>
|
||||
<td style="padding: 3px;">{{ streamline_date($transaction->trans_date) }}</td>
|
||||
@php $total_uncleared_debit += (int)$transaction->debit; @endphp
|
||||
<td style="padding: 3px;">{{ ugandan_shillings($transaction->debit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
</table>
|
||||
@endif
|
||||
|
||||
<strong><b>Deposits and Credits</b></strong>
|
||||
|
||||
<table class="table">
|
||||
<thead><td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<td>
|
||||
<tr>
|
||||
<th>From</th>
|
||||
<th>To</th>
|
||||
<th>Memo</th>
|
||||
<th>Date</th>
|
||||
<th>Amount</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@if(count($unreconciled_transactions) > 0)
|
||||
@foreach($unreconciled_transactions as $trans_id)
|
||||
@php $transaction = \Streamline\Models\Banking::find($trans_id)@endphp
|
||||
@if(!is_null($transaction))
|
||||
@if($transaction->trans_type == 'DEPOSIT')
|
||||
@php $other_accounts_array = explode(',',$transaction->other_accounts); @endphp
|
||||
<tbody>
|
||||
<tr>
|
||||
<td style="padding: 3px;">
|
||||
@for($x = 0; $x < count($other_accounts_array); $x ++)
|
||||
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
|
||||
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
|
||||
@else
|
||||
@php
|
||||
$item = isset($payment_items[$other_accounts_array[$x]]) ? $payment_items[$other_accounts_array[$x]] : "";
|
||||
@endphp
|
||||
{{ $item }}
|
||||
@endif
|
||||
@endfor
|
||||
</td>
|
||||
<td style="padding: 3px;">{{ $chart_of_accounts[$transaction->bank] }}</td>
|
||||
<td style="padding: 3px;">{{ $transaction->memo }}</td>
|
||||
<td style="padding: 3px;">{{ streamline_date($transaction->trans_date) }}</td>
|
||||
@php $total_uncleared_credit += (int)$transaction->credit; @endphp
|
||||
<td style="padding: 3px;">{{ ugandan_shillings($transaction->credit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</table>
|
||||
|
||||
<h6><b> Total Uncleared Balance : {{ ugandan_shillings($total_uncleared = ($total_uncleared_credit - $total_uncleared_debit)) }}</b></h6><br/>
|
||||
|
||||
<table class="table table-bordered">
|
||||
<tbody>
|
||||
<tr>
|
||||
<th style="padding: 5px;">Reconciled By: </th>
|
||||
<td style="padding: 5px;">
|
||||
{{ get_full_name($report->created_by, "id", "first_name", "last_name", "users")}}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="padding: 5px;">Checked By: </th>
|
||||
<td style="padding: 5px;">.................................</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<th style="padding: 5px;">Approved By: </th>
|
||||
<td style="padding: 5px;">..................................</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
{{-- @php
|
||||
$last_banking_record = \Streamline\Models\Banking::where('reconciled',$report->id)->orderBy('id', 'desc')->first();
|
||||
@endphp
|
||||
@if ($last_banking_record->memo == "bank reconciliation adjustment")
|
||||
<strong> Reconciliation Discrepancy Balance : <b>{{ $last_banking_record->credit ? ugandan_shillings($last_banking_record->credit) : "-".ugandan_shillings(abs($last_banking_record->debit))}}</b></strong><br>
|
||||
@else
|
||||
<strong> Reconciliation Discrepancy Balance : <b>{{ ugandan_shillings(0) }}</b></strong><br>
|
||||
@endif
|
||||
|
||||
@php $beginning_of_month = \Carbon\Carbon::parse($report->reconciliation_period)->startOfMonth()->toDateTimeString(); @endphp
|
||||
<strong>Stre@mline Opening Balance ({{ streamline_date($beginning_of_month) }}): <b>{{ ugandan_shillings($report->opening_streamline_balance) }}</b></strong>
|
||||
<strong>Bank Statement Ending Balance ({{ streamline_date($report->reconciliation_period) }}): <b>{{ ugandan_shillings($report->ending_bank_statement_balance) }}</b></strong>
|
||||
@php
|
||||
$banking_record = get_latest_banking_record($report->bank, $report->reconciliation_period);
|
||||
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
|
||||
@endphp
|
||||
<strong>Register Bank Closing Balance ({{ streamline_date($report->reconciliation_period) }}): <b>{{ ugandan_shillings($bank_balance_that_day) }}</b></strong> --}} <!-- $total_uncleared + $total_cleared -->
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
+462
@@ -0,0 +1,462 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
|
||||
<style>
|
||||
.row_color{
|
||||
background: gold;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Bank Reconciliation Report</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-bank"></i> Bank Reconciliation Report</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
$reconciled_transactions = explode(',',$report->reconciled_trans_ids);
|
||||
$unreconciled_transactions = explode(',',$report->unreconciled_trans_ids);
|
||||
$total_cleared_credit = $total_cleared_debit = 0;
|
||||
$total_uncleared_credit = $total_uncleared_debit = 0;
|
||||
$total_uncleared = $total_cleared = 0;
|
||||
@endphp
|
||||
|
||||
<br/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="col-md-3"></div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<a class="btn btn-rounded"
|
||||
style="background-color:#03C03C; color: white; margin-bottom: 20px;"
|
||||
href="{{ route('banking.reconcile') }}">
|
||||
<i class="fa fa-plus"></i>
|
||||
Start New Reconciliation
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<a class="btn btn-rounded"
|
||||
style="background-color:red; color: white; margin-bottom: 20px;"
|
||||
onclick="return confirm('Are you sure you want to undo this reconciliation?')"
|
||||
href="{{ route('banking.undo_bank_reconciliation', $report->id) }}">
|
||||
<i class="fa fa-undo"></i>
|
||||
Undo Reconciliation
|
||||
</a>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<a class="btn btn-rounded" target="_blank"
|
||||
style="background-color:#03C03C; color: white; margin-bottom: 20px;"
|
||||
href="{{ route('banking.print_bank_reconciliation', $report->id) }}">
|
||||
<i class="fa fa-print"></i>
|
||||
Print Reconciliation Report
|
||||
</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
<div class="row">
|
||||
|
||||
<div class="col-md-10 text-center offset-1">
|
||||
<h2><b>RECONCILIATION REPORT</b></h2><br/>
|
||||
<h3><b>{{ $chart_of_accounts[$report->bank] }} AS AT {{ streamline_date($report->reconciliation_period) }}</b></h3>
|
||||
<h3><b>RECONCILED BY: {{ get_full_name($report->created_by, "id", "first_name", "last_name", "users")}} <br>DATE: {{ streamline_date($report->created_at) }}</b></h3>
|
||||
</div>
|
||||
<div class="col-md-10 text-left offset-1">
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center">
|
||||
Reconciliation Summary
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@php
|
||||
$beginning_of_month = \Carbon\Carbon::parse($report->reconciliation_period)->startOfMonth()->toDateTimeString();
|
||||
@endphp
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
Stre@mline Opening Balance As Of {{ streamline_date($beginning_of_month) }}:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ ugandan_shillings($report->opening_streamline_balance) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Bank Statement Ending Balance As Of {{ streamline_date($report->reconciliation_period) }}:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ ugandan_shillings($report->ending_bank_statement_balance) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@php
|
||||
$banking_record = get_latest_banking_record($report->bank, $report->reconciliation_period);
|
||||
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
|
||||
|
||||
$orderByCreatedAtIfTransDateIsTheSame = "created_at DESC";
|
||||
$orderByIdIfTransDateIsTheSame = "id DESC";
|
||||
|
||||
$last_record_that_month = DB::table('banking')
|
||||
->whereNull('deleted_at')
|
||||
->where('bank', '=', $report->bank)
|
||||
->where('memo', '!=', 'bank reconciliation adjustment')
|
||||
->whereDate('trans_date', '<=', \Carbon\Carbon::parse($report->reconciliation_period)->toDateString())
|
||||
->orderBy('trans_date', 'desc')
|
||||
->orderByRaw($orderByCreatedAtIfTransDateIsTheSame)
|
||||
->orderByRaw($orderByIdIfTransDateIsTheSame)
|
||||
->first();
|
||||
$last_running_balance_of_month = ($last_record_that_month != null) ? (int)$last_record_that_month->account_balance : 0;
|
||||
@endphp
|
||||
Bank Register Closing Balance As Of {{ streamline_date($report->reconciliation_period) }}:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ ugandan_shillings($last_running_balance_of_month) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
$last_banking_record = \Streamline\Models\Banking::where('reconciled',$report->id)->orderBy('id', 'desc')->first();
|
||||
@endphp
|
||||
@if ($last_banking_record->memo == "bank reconciliation adjustment")
|
||||
<td> Reconciliation Discrepancy Balance : </td>
|
||||
<td>
|
||||
<b>{{ $last_banking_record->credit ? ugandan_shillings($last_banking_record->credit) : "-".ugandan_shillings(abs($last_banking_record->debit)) }}</b>
|
||||
</td>
|
||||
@else
|
||||
<td> Reconciliation Discrepancy Balance :</td>
|
||||
<td>
|
||||
<b>{{ ugandan_shillings(0) }}</b>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
<tr>
|
||||
<td>Memo :</td>
|
||||
<td>
|
||||
{{ $report->memo }}
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h4><b>Cleared Transactions</b></h4>
|
||||
<h5><b>Checks and Payments</b></h5>
|
||||
|
||||
<div class="table-responsive">
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>From :</th>
|
||||
<th>To : </th>
|
||||
<th>Memo : </th>
|
||||
<th>Date :</th>
|
||||
<th>Amount :</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@if(count($reconciled_transactions) > 0)
|
||||
@foreach($reconciled_transactions as $trans_id)
|
||||
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
|
||||
@if(!is_null($transaction))
|
||||
@if($transaction->trans_type == 'PAYMENT' || $transaction->trans_type == 'TRANSFER')
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ $chart_of_accounts[$transaction->bank] }}</td>
|
||||
|
||||
@php
|
||||
$other_accounts_array = explode(',',$transaction->other_accounts);
|
||||
@endphp
|
||||
|
||||
<td>
|
||||
@for($x = 0; $x < count($other_accounts_array); $x ++)
|
||||
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
|
||||
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
|
||||
@else
|
||||
@php
|
||||
$item = $payment_items[$other_accounts_array[$x]] ?? "";
|
||||
@endphp
|
||||
{{ $item }}
|
||||
@endif
|
||||
@endfor
|
||||
</td>
|
||||
|
||||
<td>{{ $transaction->memo }}</td>
|
||||
|
||||
<td>{{ streamline_date($transaction->trans_date) }}</td>
|
||||
@php $total_cleared_debit += (int)$transaction->debit; @endphp
|
||||
<td> - {{ ugandan_shillings($transaction->debit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</table>
|
||||
</div>
|
||||
|
||||
<h5><b>Deposits and Credits</b></h5>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>From : </td>
|
||||
<td>To :</td>
|
||||
<td>Memo : </td>
|
||||
<td>Date :</td>
|
||||
<td>Amount :</td>
|
||||
</tr>
|
||||
</thead>
|
||||
@if(count($reconciled_transactions) > 0)
|
||||
@foreach($reconciled_transactions as $trans_id)
|
||||
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
|
||||
@if(!is_null($transaction))
|
||||
@if($transaction->trans_type == 'DEPOSIT')
|
||||
@php $other_accounts_array = explode(',',$transaction->other_accounts); @endphp
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
@for($x = 0; $x < count($other_accounts_array); $x ++)
|
||||
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
|
||||
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
|
||||
@else
|
||||
@php
|
||||
$item = $payment_items[$other_accounts_array[$x]] ?? "";
|
||||
@endphp
|
||||
{{ $item }}
|
||||
@endif
|
||||
@endfor
|
||||
</td>
|
||||
<td>{{ $chart_of_accounts[$transaction->bank] }}</td>
|
||||
<td>{{ $transaction->memo }}</td>
|
||||
<td>{{ streamline_date($transaction->trans_date) }}</td>
|
||||
@php $total_cleared_credit += (int)$transaction->credit; @endphp
|
||||
<td>{{ ugandan_shillings($transaction->credit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</table>
|
||||
|
||||
<h4><b>Total Cleared Balance : {{ ugandan_shillings($total_cleared = ($total_cleared_credit - $total_cleared_debit)) }}</b></h4>
|
||||
|
||||
<br/>
|
||||
<hr/>
|
||||
|
||||
<h4><b>Uncleared Transactions</b></h4>
|
||||
<h5><b>Checks and Payments</b></h5>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>From :</td>
|
||||
<td>To : </td>
|
||||
<td>Memo : </td>
|
||||
<td>Date :</td>
|
||||
<td>Amount :</td>
|
||||
</tr>
|
||||
</thead>
|
||||
@if(count($unreconciled_transactions) > 0)
|
||||
@foreach($unreconciled_transactions as $trans_id)
|
||||
@php $transaction = \Streamline\Models\Banking::find($trans_id); @endphp
|
||||
@if(!is_null($transaction))
|
||||
@if($transaction->trans_type == 'PAYMENT' || $transaction->trans_type == 'TRANSFER')
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>{{ $chart_of_accounts[$transaction->bank] }}</td>
|
||||
<td>
|
||||
@php
|
||||
$uncleared_other_accounts_string = $transaction->other_accounts;
|
||||
$uncleared_other_accounts_array = is_null($uncleared_other_accounts_string) ? [] : explode(",", $uncleared_other_accounts_string);
|
||||
@endphp
|
||||
@for($x = 0; $x < count($uncleared_other_accounts_array); $x ++)
|
||||
@if(isset($chart_of_accounts[$uncleared_other_accounts_array[$x]]))
|
||||
{{ $chart_of_accounts[$uncleared_other_accounts_array[$x]] }}
|
||||
@else
|
||||
@php
|
||||
$item = $payment_items[$uncleared_other_accounts_array[$x]] ?? "";
|
||||
@endphp
|
||||
{{ $item }}
|
||||
@endif
|
||||
@endfor
|
||||
</td>
|
||||
<td>{{ $transaction->memo }}</td>
|
||||
<td>{{ streamline_date($transaction->trans_date) }}</td>
|
||||
@php $total_uncleared_debit += (int)$transaction->debit; @endphp
|
||||
<td>{{ ugandan_shillings($transaction->debit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</table>
|
||||
|
||||
<h5><b>Deposits and Credits</b></h5>
|
||||
|
||||
<table class="table">
|
||||
<thead>
|
||||
<tr>
|
||||
<td>From : </td>
|
||||
<td>To :</td>
|
||||
<td>Memo : </td>
|
||||
<td>Date :</td>
|
||||
<td>Amount :</td>
|
||||
</tr>
|
||||
</thead>
|
||||
@if(count($unreconciled_transactions) > 0)
|
||||
@foreach($unreconciled_transactions as $trans_id)
|
||||
@php $transaction = \Streamline\Models\Banking::find($trans_id)@endphp
|
||||
@if(!is_null($transaction))
|
||||
@if($transaction->trans_type == 'DEPOSIT')
|
||||
@php $other_accounts_array = explode(',',$transaction->other_accounts); @endphp
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
@for($x = 0; $x < count($other_accounts_array); $x ++)
|
||||
@if(isset($chart_of_accounts[$other_accounts_array[$x]]))
|
||||
{{ $chart_of_accounts[$other_accounts_array[$x]] }}
|
||||
@else
|
||||
@php
|
||||
$item = $payment_items[$other_accounts_array[$x]] ?? "";
|
||||
@endphp
|
||||
{{ $item }}
|
||||
@endif
|
||||
@endfor
|
||||
</td>
|
||||
<td>{{ $chart_of_accounts[$transaction->bank] }}</td>
|
||||
<td>{{ $transaction->memo }}</td>
|
||||
<td>{{ streamline_date($transaction->trans_date) }}</td>
|
||||
@php $total_uncleared_credit += (int)$transaction->credit; @endphp
|
||||
<td>{{ ugandan_shillings($transaction->credit) }}</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
@endif
|
||||
@endif
|
||||
@endforeach
|
||||
@endif
|
||||
</table>
|
||||
|
||||
<h4><b> Total Uncleared Balance : {{ ugandan_shillings($total_uncleared = ($total_uncleared_credit - $total_uncleared_debit)) }}</b></h4><br/>
|
||||
|
||||
<table class="table table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th colspan="2" style="text-align: center">
|
||||
<b>Reconciliation Summary</b>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
@php
|
||||
$beginning_of_month = \Carbon\Carbon::parse($report->reconciliation_period)->startOfMonth()->toDateTimeString();
|
||||
@endphp
|
||||
<tbody>
|
||||
<tr>
|
||||
<td>
|
||||
Stre@mline Opening Balance As Of {{ streamline_date($beginning_of_month) }}:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ ugandan_shillings($report->opening_streamline_balance) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
Bank Statement Ending Balance As Of {{ streamline_date($report->reconciliation_period) }}:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ ugandan_shillings($report->ending_bank_statement_balance) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
<td>
|
||||
@php
|
||||
$banking_record = get_latest_banking_record($report->bank, $report->reconciliation_period);
|
||||
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
|
||||
|
||||
$orderByCreatedAtIfTransDateIsTheSame = "created_at DESC";
|
||||
$orderByIdIfTransDateIsTheSame = "id DESC";
|
||||
|
||||
$last_record_that_month = DB::table('banking')
|
||||
->whereNull('deleted_at')
|
||||
->where('bank', '=', $report->bank)
|
||||
->where('memo', '!=', 'bank reconciliation adjustment')
|
||||
->whereDate('trans_date', '<=', \Carbon\Carbon::parse($report->reconciliation_period)->toDateString())
|
||||
->orderBy('trans_date', 'desc')
|
||||
->orderByRaw($orderByCreatedAtIfTransDateIsTheSame)
|
||||
->orderByRaw($orderByIdIfTransDateIsTheSame)
|
||||
->first();
|
||||
$last_running_balance_of_month = ($last_record_that_month != null) ? (int)$last_record_that_month->account_balance : 0;
|
||||
@endphp
|
||||
Register Bank Closing Balance As Of {{ streamline_date($report->reconciliation_period) }}:
|
||||
</td>
|
||||
<td>
|
||||
<b>{{ ugandan_shillings($last_running_balance_of_month) }}</b>
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
$last_banking_record = \Streamline\Models\Banking::where('reconciled',$report->id)->orderBy('id', 'desc')->first();
|
||||
@endphp
|
||||
@if ($last_banking_record->memo == "bank reconciliation adjustment")
|
||||
<td> Reconciliation Discrepancy Balance : </td>
|
||||
<td>
|
||||
<b>{{ $last_banking_record->credit ? ugandan_shillings($last_banking_record->credit) : "-".ugandan_shillings(abs($last_banking_record->debit)) }}</b>
|
||||
</td>
|
||||
@else
|
||||
<td> Reconciliation Discrepancy Balance :</td>
|
||||
<td>
|
||||
<b>{{ ugandan_shillings(0) }}</b>
|
||||
</td>
|
||||
@endif
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
"bPaginate": false,
|
||||
"aoColumnDefs": [{
|
||||
"aTargets": [2,3],
|
||||
"defaultContent": "",
|
||||
}]
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
<link href="{{ asset('elite/bower_components/icheck/skins/all.css') }}" rel="stylesheet">
|
||||
<style>
|
||||
.row_color {
|
||||
background: gold;
|
||||
}
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-4 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Bank Reconciliation Reports</h4>
|
||||
</div>
|
||||
<div class="col-lg-8 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('banking.home') }}</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('banking.finance_home') }}</a></li>
|
||||
<li class="active"><i class="fa fa-bank"></i>Bank Reconciliation Reports</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
{{ Form::open(['method'=>'post','route' => 'banking.reconcile.reports']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3 b-r">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.staff_in_charge') }}</label>
|
||||
<select class="form-control compulsory required" name="staff_member" id="staff_member" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="ALL STAFF">{{ __('banking.all_staff') }}</option>
|
||||
@foreach($staff_members as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->username }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.bank') }} :</label>
|
||||
<select class="form-control compulsory required" name="bank" id="bank" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="ALL BANKS">ALL BANKS</option>
|
||||
@foreach($banks as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.select_date') }}</label>
|
||||
<select class="form-control compulsory required" name="dates" id="dates" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="today">{{ __('banking.today') }}</option>
|
||||
<option value="yesterday">{{ __('banking.yesterday') }}</option>
|
||||
<option value="custom_date">{{ __('banking.custom_date') }}</option>
|
||||
<option value="custom_date_range">{{ __('banking.date_range') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div id="sDate" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.date_on') }}</label>
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'start_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div id="eDate" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="end_date">{{ __('banking.end_date') }}</label>
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'end_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<div class="form-group" style="margin-top: 25px;">
|
||||
{{ Form::submit('Submit', ['class'=>'btn btn-success btn-rounded btn-block pull-right']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
<hr style="height: 2px" />
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@if(isset($display))
|
||||
<h3 class="label label-info label-rounded"> {!! isset($display) ? $display : '' !!}</h3>
|
||||
@endif
|
||||
<br /><br />
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="table" class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Bank Name</th>
|
||||
<th>Reconciliation Period</th>
|
||||
<th>Date Submitted</th>
|
||||
<th>Stre@mline Bank Opening Balance</th>
|
||||
<th>Bank Statement Ending Balance</th>
|
||||
<th>Bank Register Closing Balance</th>
|
||||
<th>Reconciliation Discrepancy</th>
|
||||
<th>Staff Incharge</th>
|
||||
<th>{{ __('banking.action') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@if(count($records) > 0)
|
||||
@foreach($records as $record)
|
||||
<tr>
|
||||
<td>{{ get_name($record->bank, 'id', 'name', 'chart_of_accounts') }}</td>
|
||||
<td>
|
||||
@php $beginning_of_month = Carbon\Carbon::parse($record->reconciliation_period)->startOfMonth()->toDateString(); @endphp
|
||||
From {{ streamline_date($beginning_of_month) }} to {{ streamline_date($record->reconciliation_period) }}.
|
||||
</td>
|
||||
<td>{{ streamline_date_time_short($record->created_at) }}</td>
|
||||
<td>{{ ugandan_shillings($record->opening_streamline_balance) }}</td>
|
||||
<td>{{ ugandan_shillings($record->ending_bank_statement_balance) }}</td>
|
||||
<td>
|
||||
@php
|
||||
$banking_record = get_latest_banking_record($record->bank, $record->reconciliation_period);
|
||||
$bank_balance_that_day = ($banking_record != null) ? (int)$banking_record->account_balance : 0;
|
||||
|
||||
$orderByCreatedAtIfTransDateIsTheSame = "created_at DESC";
|
||||
$orderByIdIfTransDateIsTheSame = "id DESC";
|
||||
|
||||
$last_record_that_month = DB::table('banking')
|
||||
->whereNull('deleted_at')
|
||||
->where('bank', '=', $record->bank)
|
||||
->where('memo', '!=', 'bank reconciliation adjustment')
|
||||
->whereDate('trans_date', '<=', \Carbon\Carbon::parse($record->reconciliation_period)->toDateString())
|
||||
->orderBy('trans_date', 'desc')
|
||||
->orderByRaw($orderByCreatedAtIfTransDateIsTheSame)
|
||||
->orderByRaw($orderByIdIfTransDateIsTheSame)
|
||||
->first();
|
||||
$last_running_balance_of_month = ($last_record_that_month != null) ? (int)$last_record_that_month->account_balance : 0;
|
||||
@endphp
|
||||
{{ ugandan_shillings($last_running_balance_of_month) }}
|
||||
</td>
|
||||
<td>
|
||||
@php
|
||||
$discrepancy_banking_record = \Streamline\Models\Banking::where('reconciled',$record->id)->orderBy('id', 'desc')->first();
|
||||
@endphp
|
||||
@if ($discrepancy_banking_record && $discrepancy_banking_record->memo == "bank reconciliation adjustment")
|
||||
{{ $discrepancy_banking_record->credit ? ugandan_shillings($discrepancy_banking_record->credit) : "-".ugandan_shillings(abs($discrepancy_banking_record->debit))}}
|
||||
@elseif($discrepancy_banking_record && $discrepancy_banking_record->memo != "bank reconciliation adjustment")
|
||||
{{ ugandan_shillings(0) }}
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ get_name($record->created_by, 'id', 'username', 'users') }}</td>
|
||||
<td>
|
||||
<a class="btn-sm btn btn-success btn-rounded" href="{{ route('bank.reconciliation.report', $record->id) }}">
|
||||
<i class="fa fa-eye"></i>
|
||||
View Report
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- Date Picker Plugin JavaScript -->
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
"bPaginate": false,
|
||||
"aoColumnDefs": [{
|
||||
"aTargets": [2, 3],
|
||||
"defaultContent": "",
|
||||
}]
|
||||
});
|
||||
|
||||
$('#dates').change(function(e) {
|
||||
if ($(this).val() === "custom_date") {
|
||||
$("#eDate").hide();
|
||||
$("#sDate").show();
|
||||
} else if ($(this).val() === "custom_date_range") {
|
||||
$("#sDate").show();
|
||||
$("#eDate").show();
|
||||
} else {
|
||||
$("#eDate").hide();
|
||||
$("#sDate").hide();
|
||||
}
|
||||
});
|
||||
|
||||
jQuery('#end_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
|
||||
jQuery('#start_date ,#deposit_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#staff_member').select2({
|
||||
placeholder: "-- select --"
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
+343
@@ -0,0 +1,343 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('banking.bank_register_report') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('banking.home') }}</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('banking.finance_home') }}</a></li>
|
||||
<li class="active"><i class="fa fa-bank"></i>{{ __('banking.bank_register_report') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
{{ Form::open(['method'=>'post','route' => 'banking.register']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3 b-r">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.staff_in_charge') }}</label>
|
||||
<select class="form-control compulsory required" name="staff_member" id="staff_member" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="ALL STAFF">{{ __('banking.all_staff') }}</option>
|
||||
@foreach($staff_members as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->username }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.bank') }} :</label>
|
||||
<select class="form-control compulsory required" name="bank" id="bank" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
{{-- <option value="ALL BANKS">ALL BANKS</option> --}}
|
||||
@foreach($banks as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.select_date') }}</label>
|
||||
<select class="form-control compulsory required" name="dates" id="dates" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="today">{{ __('banking.today') }}</option>
|
||||
<option value="yesterday">{{ __('banking.yesterday') }}</option>
|
||||
<option value="custom_date">{{ __('banking.custom_date') }}</option>
|
||||
<option value="custom_date_range">{{ __('banking.date_range') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div id="sDate" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.date_on') }}</label>
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'start_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div id="eDate" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="end_date">{{ __('banking.end_date') }}</label>
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'end_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-1">
|
||||
<div class="form-group" style="margin-top: 25px;">
|
||||
{{ Form::submit('Submit', ['class'=>'btn btn-success btn-rounded btn-block pull-right']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
<hr style="height: 2px"/>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
@if(isset($display))
|
||||
<h3 class="label label-info label-rounded"> {!! isset($display) ? $display : '' !!}</h3>
|
||||
@endif
|
||||
<br/><br/>
|
||||
|
||||
@php
|
||||
$sum_balance = 0;
|
||||
$sum_credit = 0;
|
||||
$sum_debit = 0;
|
||||
@endphp
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="table" class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Transaction ID</th>
|
||||
<th>{{ __('banking.transaction_date') }}</th>
|
||||
<th>{{ __('banking.record_date') }}</th>
|
||||
<th>{{ __('banking.staff_in_charge') }}</th>
|
||||
<th>{{ __('banking.type') }}</th>
|
||||
<th>{{ __('banking.account') }}</th>
|
||||
<th>{{ __('banking.memo') }}</th>
|
||||
<th>{{ __('banking.decrease') }}</th>
|
||||
<th>{{ __('banking.increase') }}</th>
|
||||
<th>{{ __('banking.balance') }}</th>
|
||||
{{--
|
||||
@if(Auth::user()->can('banking-reverse'))
|
||||
<th>{{ __('banking.action') }}</th>
|
||||
@endif
|
||||
--}}
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@if(count($records) > 0)
|
||||
@foreach($records as $record)
|
||||
@php
|
||||
$sum_credit += $record->credit;
|
||||
$sum_debit += $record->debit;
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $record->trans_id }}</td>
|
||||
<td>{{ streamline_date($record->trans_date) }}</td>
|
||||
<td>{{ streamline_date_time_short($record->created_at) }}</td>
|
||||
<td>{{ get_full_name($record->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
||||
<td>{{ $record->trans_type }}</td>
|
||||
@php
|
||||
$banks = explode(',',$record->bank);
|
||||
$other_accounts = explode(',',$record->other_accounts);
|
||||
@endphp
|
||||
|
||||
<td>
|
||||
@for($x = 0; $x < count($other_accounts); $x++)
|
||||
{{ get_name($other_accounts[$x], 'id', 'name', 'chart_of_accounts') }} <br/>
|
||||
@endfor
|
||||
</td>
|
||||
<td>{{ $record->memo }}</td>
|
||||
@if($record->debit != 0) <td>{{ ugandan_shillings($record->debit) }}</td> @else <td> - </td> @endif
|
||||
@if($record->credit != 0) <td>{{ ugandan_shillings($record->credit) }}</td> @else <td> - </td> @endif
|
||||
<td>{{ ugandan_shillings($record->account_balance) }}</td>
|
||||
|
||||
@if($loop->last)
|
||||
@php $sum_balance = $record->account_balance; @endphp
|
||||
@endif
|
||||
|
||||
{{--
|
||||
@if(Auth::user()->can('banking-reverse'))
|
||||
<td>
|
||||
<a class="btn-sm btn btn-danger btn-rounded"
|
||||
onclick="return confirm('Are you sure you want to reverse this transaction ?')"
|
||||
href="{{ route('banking.reverse', $record->trans_id) }}">
|
||||
<i class="fa fa-trash"></i>
|
||||
Reverse
|
||||
</a>
|
||||
</td>
|
||||
@endif
|
||||
--}}
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
|
||||
@if(count($records) > 0)
|
||||
<tr>
|
||||
<td colspan="8"></td>
|
||||
<td>
|
||||
<strong>{{ __('banking.current_running_balance') }}</strong>
|
||||
</td>
|
||||
<td>
|
||||
{{ ugandan_shillings($sum_balance) }}
|
||||
</td>
|
||||
{{--
|
||||
@if(Auth::user()->can('banking-reverse'))
|
||||
<td></td>
|
||||
@endif
|
||||
--}}
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- Date Picker Plugin JavaScript -->
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
|
||||
$('#dates').change(function (e) {
|
||||
|
||||
if($(this).val() === "custom_date"){
|
||||
|
||||
$("#eDate").hide();
|
||||
$("#sDate").show();
|
||||
|
||||
}else if($(this).val() === "custom_date_range"){
|
||||
|
||||
$("#sDate").show();
|
||||
$("#eDate").show();
|
||||
}else{
|
||||
|
||||
$("#eDate").hide();
|
||||
$("#sDate").hide();
|
||||
}
|
||||
});
|
||||
|
||||
function bank_deposit(cashier_income_id, amount) {
|
||||
$('#deposit_amount').val(amount);
|
||||
$('#cashier_income_id').val(cashier_income_id);
|
||||
$('#banking_modal').modal('show');
|
||||
}
|
||||
|
||||
$('#confirm_deposit').click(function () {
|
||||
|
||||
var cashier_income_id = $('#cashier_income_id').val();
|
||||
var deposit_amount = $('#deposit_amount').val();
|
||||
var deposit_account = $('#deposit_account').val();
|
||||
var deposit_date = $('#deposit_date').val();
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/quick_bank_deposit',
|
||||
data: {
|
||||
'cashier_income_id' : cashier_income_id,
|
||||
'deposit_amount' : deposit_amount,
|
||||
'deposit_account' : deposit_account,
|
||||
'deposit_date' : deposit_date,
|
||||
},
|
||||
|
||||
success: function(response){
|
||||
console.log(response);
|
||||
$('#banking_modal').modal('hide');
|
||||
$('#bank_' + cashier_income_id).hide();
|
||||
$('#div_' + cashier_income_id).append("<label class='label label-success'>BANKED</label>");
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function get_acc_bal(bank_id) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/get_current_account_balance',
|
||||
data: {'bank_id' : bank_id},
|
||||
|
||||
success: function(response){
|
||||
var acc_bal = response[0].balance;
|
||||
var amount = $('#deposit_amount').val();
|
||||
$('#current_account_balance').val(acc_bal);
|
||||
$('#new_account_balance').val(acc_bal + parseInt(amount));
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery('#end_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery('#start_date ,#deposit_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
"aoColumnDefs": [{
|
||||
"aTargets": [2,3],
|
||||
"defaultContent": "",
|
||||
}],
|
||||
ordering: false,
|
||||
pageLength : 100,
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#staff_member').select2({
|
||||
placeholder: "-- select --"
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
+311
@@ -0,0 +1,311 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('banking.bank_transfer') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('banking.home') }}</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('banking.finance_home') }}</a></li>
|
||||
<li class="active"><i class="fa fa-bank"></i> {{ __('banking.new_bank_transfer') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
$balance = 0;
|
||||
@endphp
|
||||
|
||||
@include('flash::message')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
{{ Form::open(['route' => 'banking.process_transfer', 'data-toggle' => 'validator', 'id'=>'bank_transfer_form']) }}
|
||||
|
||||
<h2 class="text-center"><strong>{{ __('banking.transfer_funds') }}</strong></h2>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-4">
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.transfer_from') }}</label>
|
||||
<select class="form-control compulsory required" name="transfer_from" id="transfer_from" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
@foreach($banks as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.transfer_to') }}</label>
|
||||
<select class="form-control compulsory required" name="transfer_to" id="transfer_to" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
@foreach($banks as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->name }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.date') }} :</label>
|
||||
<div class="input-group">
|
||||
<input class="center form-control" id="transfer_date" readonly style="padding: 2px;border: 1px solid #ddd;" name="transfer_date">
|
||||
<span class="input-group-addon"><i class="fa fa-calendar"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.account_balance_from_account') }}</label>
|
||||
<div class="input-group">
|
||||
<input class="center form-control" id="from_account_balance" type="number" value="0" readonly style="padding: 2px;border: 1px solid #ddd;" name="from_account_balance">
|
||||
<span class="input-group-addon">{{ __('banking.ugx') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.account_balance_to_account') }}</label>
|
||||
<div class="input-group">
|
||||
<input class="center form-control" id="to_account_balance" value="0" type="number" readonly style="padding: 2px;border: 1px solid #ddd;" name="to_account_balance">
|
||||
<span class="input-group-addon">{{ __('banking.ugx') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.amount') }} :</label>
|
||||
<div class="input-group">
|
||||
<input class="center form-control compulsory" required id="transfer_amount" type="number" style="padding: 2px;border: 1px solid #ddd;" name="transfer_amount">
|
||||
<span class="input-group-addon">{{ __('banking.ugx') }}</span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-4">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.memo') }} :</label>
|
||||
<div class="input-group">
|
||||
{{ Form::textarea('transfer_memo', '', ['class'=>'form-control compulsory required', 'id'=>'transfer_memo']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-10"></div>
|
||||
<div class="col-md-2">
|
||||
<button type="submit" class="btn btn-success btn-block btn-rounded float-right" style="display: none;" id="confirm_deposit">{{ __('banking.transfer') }}</button>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{ Form::close() }}
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- Date Picker Plugin JavaScript -->
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#dates').change(function(e) {
|
||||
|
||||
if ($(this).val() === "custom_date") {
|
||||
|
||||
$("#eDate").hide();
|
||||
$("#sDate").show();
|
||||
|
||||
} else if ($(this).val() === "custom_date_range") {
|
||||
|
||||
$("#sDate").show();
|
||||
$("#eDate").show();
|
||||
} else {
|
||||
|
||||
$("#eDate").hide();
|
||||
$("#sDate").hide();
|
||||
}
|
||||
});
|
||||
|
||||
|
||||
|
||||
function bank_deposit(cashier_income_id, amount) {
|
||||
$('#deposit_amount').val(amount);
|
||||
$('#cashier_income_id').val(cashier_income_id);
|
||||
$('#banking_modal').modal('show');
|
||||
}
|
||||
|
||||
$('#transfer_date').on('change', function() {
|
||||
|
||||
var transfer_to = $('#transfer_to').val();
|
||||
var transfer_from = $('#transfer_from').val();
|
||||
var transfer_date = this.value;
|
||||
console.log(transfer_date)
|
||||
|
||||
var today = new Date();
|
||||
var dd = String(today.getDate()).padStart(2, '0');
|
||||
var mm = String(today.getMonth() + 1).padStart(2, '0'); // January is 0!
|
||||
var yyyy = today.getFullYear();
|
||||
var today_formatted = dd + '-' + mm + '-' + yyyy;
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/get_latest_bank_balance',
|
||||
data: {
|
||||
'to': transfer_to,
|
||||
'from': transfer_from,
|
||||
'date': today_formatted, // transfer_date,
|
||||
},
|
||||
|
||||
success: function(response) {
|
||||
$('#to_account_balance').val(parseInt(response[0]));
|
||||
$('#from_account_balance').val(parseInt(response[1]));
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
// $('#transfer_from').on('change', function () {
|
||||
// var account = this.value;
|
||||
// if(account != ""){
|
||||
// $.ajax({
|
||||
// method: 'POST',
|
||||
// url: '/banking/get_current_account_balance',
|
||||
// data: {'bank_id' : account},
|
||||
//
|
||||
// success: function(response){ console.log(response);
|
||||
// var acc_bal = response['account_balance'];
|
||||
// $('#from_account_balance').val(acc_bal);
|
||||
// },
|
||||
// error: function (error) {
|
||||
// console.log(error);
|
||||
// }
|
||||
// });
|
||||
// }else{
|
||||
// alert('Please an account that you wish to transfer funds from..!');
|
||||
// $('#from_account_balance').val(0);
|
||||
// }
|
||||
// });
|
||||
//
|
||||
// $('#transfer_to').on('change', function () {
|
||||
// var account = this.value;
|
||||
// if(account != ""){
|
||||
// $.ajax({
|
||||
// method: 'POST',
|
||||
// url: '/banking/get_current_account_balance',
|
||||
// data: {'bank_id' : account},
|
||||
//
|
||||
// success: function(response){ console.log(response)
|
||||
// var acc_bal = response['account_balance'];
|
||||
// $('#to_account_balance').val(acc_bal);
|
||||
// },
|
||||
// error: function (error) {
|
||||
// console.log(error);
|
||||
// }
|
||||
// });
|
||||
// }else{
|
||||
// alert('Please an account that you wish to transfer funds To..!');
|
||||
// $('#from_account_balance').val(0);
|
||||
// }
|
||||
// });
|
||||
|
||||
$('#transfer_amount').on('change', function() {
|
||||
var amount = parseInt(this.value);
|
||||
var from_account_balance = $('#from_account_balance').val();
|
||||
var from_account = $('#transfer_from').val();
|
||||
var to_account = $('#transfer_to').val();
|
||||
|
||||
if (from_account != "" && to_account != "") {
|
||||
if (amount <= from_account_balance) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/transfer/compute_transfer',
|
||||
data: {
|
||||
'amount': amount,
|
||||
'from_account': from_account,
|
||||
'to_account': to_account,
|
||||
},
|
||||
success: function(response) {
|
||||
// $('#to_account_balance').val(parseInt(response.new_to_acc_bal));
|
||||
// $('#from_account_balance').val(parseInt(response.new_from_acc_bal));
|
||||
$('#confirm_deposit').show();
|
||||
},
|
||||
error: function(error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
} else {
|
||||
var isConfirmed = confirm('You are trying to transfer funds that are more than the balance on the account');
|
||||
if (isConfirmed == true) {
|
||||
$('#confirm_deposit').show();
|
||||
} else {
|
||||
$('#transfer_amount').val(0);
|
||||
$('#confirm_deposit').hide();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
alert('Please be sure to the select the accounts that you with to transfer to and from.');
|
||||
$('#transfer_amount').val(0);
|
||||
$('#confirm_deposit').hide();
|
||||
}
|
||||
});
|
||||
|
||||
$('#confirm_deposit').click(function() {
|
||||
$('#bank_transfer_form').submit();
|
||||
$(this).attr("disabled", true);
|
||||
});
|
||||
</script>
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
jQuery('#transfer_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
"aoColumnDefs": [{
|
||||
"aTargets": [2, 3],
|
||||
"defaultContent": "",
|
||||
}]
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#staff_member_cashier').select2({
|
||||
placeholder: "-- select --"
|
||||
});
|
||||
$('#staff_member_accountant').select2({
|
||||
placeholder: "-- select --"
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
+276
@@ -0,0 +1,276 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('banking.bank_transfer_history') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> {{ __('banking.home') }}</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> {{ __('banking.finance_home') }}</a></li>
|
||||
<li class="active"><i class="fa fa-bank"></i> {{ __('banking.bank_transfer_history') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
|
||||
<div class="panel">
|
||||
<div class="panel-body">
|
||||
|
||||
{{ Form::open(['method'=>'post','route' => 'banking.transfer_history']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>{{ __('banking.transfer_by') }}</label>
|
||||
<select class="form-control compulsory required" name="staff_member" id="staff_member" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="ALL STAFF">{{ __('banking.all_staff') }}</option>
|
||||
@foreach($staff_members as $item)
|
||||
<option value="{{ $item->id }}">{{ $item->username }}</option>
|
||||
@endforeach
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
<label>Select Date:</label>
|
||||
<select class="form-control compulsory required" name="dates" id="dates" required>
|
||||
<option value="">{{ __('banking.select') }}</option>
|
||||
<option value="today">{{ __('banking.today') }}</option>
|
||||
<option value="yesterday">{{ __('banking.yesterday') }}</option>
|
||||
<option value="custom_date">{{ __('banking.custom_date') }}</option>
|
||||
<option value="custom_date_range">{{ __('banking.date_range') }}</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div id="sDate" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="start_date">{{ __('banking.date_on') }}</label>
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'start_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div id="eDate" style="display: none;">
|
||||
<div class="form-group">
|
||||
<label for="end_date">{{ __('banking.end_date') }}</label>
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date', '', ['class'=>'form-control required compulsory', 'readonly', 'id'=>'end_date']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2">
|
||||
<div class="form-group" style="margin-top: 25px;">
|
||||
{{ Form::submit('Submit', ['class'=>'btn btn-success btn-rounded btn-block pull-right']) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
|
||||
<hr style="height: 2px"/>
|
||||
|
||||
|
||||
<h2><strong>{{ __('banking.transfer_history') }}</strong></h2>
|
||||
<br/>
|
||||
@if(isset($display))
|
||||
<h3 class="label label-info"> {!! isset($display) ? $display : '' !!}</h3>
|
||||
@endif
|
||||
@php
|
||||
$sum_total = 0;
|
||||
@endphp
|
||||
<br/>
|
||||
<br/>
|
||||
<div class="table-responsive">
|
||||
<table id="table" class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>{{ __('banking.staff_in_charge') }}</th>
|
||||
<th>{{ __('banking.deposit_from') }}</th>
|
||||
<th>{{ __('banking.deposit_to') }}</th>
|
||||
<th>{{ __('banking.date') }}</th>
|
||||
{{-- <th>{{ __('banking.previous_balance_from_account') }}</th>--}}
|
||||
<th>{{ __('banking.account_balance') }}</th>
|
||||
<th>{{ __('banking.amount') }}</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@if(count($transfers) > 0)
|
||||
@foreach($transfers as $item)
|
||||
<tr>
|
||||
<td>{{ get_full_name($item->created_by, 'id', 'first_name', 'last_name', 'users') }}</td>
|
||||
<td>{{ get_name($item->bank, 'id', 'name', 'chart_of_accounts') }}</td>
|
||||
<td>{{ isset($chart_of_accounts[$item->other_accounts]) ? $chart_of_accounts[$item->other_accounts] : ("N/A") }}</td>
|
||||
<td>{{ streamline_date($item->trans_date) }}</td>
|
||||
{{-- <td>{{ ugandan_shillings($item->previous_from_account_balance) }}</td>--}}
|
||||
<td>{{ ugandan_shillings($item->account_balance) }}</td>
|
||||
<td>{{ ugandan_shillings($item->debit) }}</td>
|
||||
</tr>
|
||||
@php
|
||||
$sum_total += $item->credit;
|
||||
@endphp
|
||||
@endforeach
|
||||
@endif
|
||||
|
||||
</tbody>
|
||||
@if(count($transfers) > 0)
|
||||
<tr>
|
||||
<td colspan="4"></td>
|
||||
<td>
|
||||
<strong>{{ __('banking.total') }}</strong>
|
||||
</td>
|
||||
<td>
|
||||
{{ ugandan_shillings($sum_total) }}
|
||||
</td>
|
||||
</tr>
|
||||
@endif
|
||||
</table>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<!-- Date Picker Plugin JavaScript -->
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
|
||||
$('#dates').change(function (e) {
|
||||
|
||||
if($(this).val() === "custom_date"){
|
||||
|
||||
$("#eDate").hide();
|
||||
$("#sDate").show();
|
||||
|
||||
}else if($(this).val() === "custom_date_range"){
|
||||
|
||||
$("#sDate").show();
|
||||
$("#eDate").show();
|
||||
}else{
|
||||
|
||||
$("#eDate").hide();
|
||||
$("#sDate").hide();
|
||||
}
|
||||
});
|
||||
|
||||
function bank_deposit(cashier_income_id, amount) {
|
||||
$('#deposit_amount').val(amount);
|
||||
$('#cashier_income_id').val(cashier_income_id);
|
||||
$('#banking_modal').modal('show');
|
||||
}
|
||||
|
||||
$('#confirm_deposit').click(function () {
|
||||
|
||||
var cashier_income_id = $('#cashier_income_id').val();
|
||||
var deposit_amount = $('#deposit_amount').val();
|
||||
var deposit_account = $('#deposit_account').val();
|
||||
var deposit_date = $('#deposit_date').val();
|
||||
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/quick_bank_deposit',
|
||||
data: {
|
||||
'cashier_income_id' : cashier_income_id,
|
||||
'deposit_amount' : deposit_amount,
|
||||
'deposit_account' : deposit_account,
|
||||
'deposit_date' : deposit_date,
|
||||
},
|
||||
|
||||
success: function(response){
|
||||
console.log(response);
|
||||
$('#banking_modal').modal('hide');
|
||||
$('#bank_' + cashier_income_id).hide();
|
||||
$('#div_' + cashier_income_id).append("<label class='label label-success'>BANKED</label>");
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
function get_acc_bal(bank_id) {
|
||||
$.ajax({
|
||||
method: 'POST',
|
||||
url: '/banking/get_current_account_balance',
|
||||
data: {'bank_id' : bank_id},
|
||||
|
||||
success: function(response){
|
||||
var acc_bal = response[0].balance;
|
||||
var amount = $('#deposit_amount').val();
|
||||
$('#current_account_balance').val(acc_bal);
|
||||
$('#new_account_balance').val(acc_bal + parseInt(amount));
|
||||
},
|
||||
error: function (error) {
|
||||
console.log(error);
|
||||
}
|
||||
});
|
||||
}
|
||||
</script>
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
|
||||
jQuery('#end_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
</script>
|
||||
|
||||
<script type="text/javascript">
|
||||
jQuery('#start_date ,#deposit_date').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy'
|
||||
});
|
||||
</script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
"aoColumnDefs": [{
|
||||
"aTargets": [2,3],
|
||||
"defaultContent": "",
|
||||
}]
|
||||
});
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#staff_member').select2({
|
||||
placeholder: "-- select --"
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:api')->get('/banking', function () {
|
||||
return "Banking";
|
||||
});
|
||||
@@ -0,0 +1,36 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['middleware' => ['auth', 'disablebackbutton', 'user-locale','subscription-tracking']], function () {
|
||||
/* Banking */
|
||||
Route::any('/banking/deposit', 'BankingController@deposit')->name('banking.deposit');
|
||||
Route::any('/banking/bank_deposit_slip/{trans_id}', 'BankingController@bank_deposit_slip')->name('banking.bank_deposit_slip');
|
||||
Route::any('/banking/quick_bank_deposit', 'BankingController@quick_bank_deposit')->name('banking.quick_bank_deposit');
|
||||
Route::any('/banking/transfer', 'BankingController@transfer')->name('banking.transfer');
|
||||
Route::any('/banking/transfer/compute_transfer', 'BankingController@compute_transfer')->name('banking.transfer.compute_transfer');
|
||||
Route::any('/banking/transfer_history', 'BankingController@transfer_history')->name('banking.transfer_history');
|
||||
Route::any('/banking/deposit_history', 'BankingController@deposit_history')->name('banking.deposit_history');
|
||||
Route::any('/banking/process_deposit', 'BankingController@process_deposit')->name('banking.process_deposit');
|
||||
Route::any('/banking/process_transfer', 'BankingController@process_transfer')->name('banking.process_transfer');
|
||||
Route::any('/banking/get_current_account_balance', 'BankingController@get_current_account_balance')->name('banking.get_current_account_balance');
|
||||
Route::any('/banking/get_current_account_balance_per_date', 'BankingController@get_current_account_balance_per_date')->name('banking.get_current_account_balance_per_date');
|
||||
Route::any('/banking/get_opening_account_balance', 'BankingController@get_opening_account_balance')->name('banking.get_opening_account_balance');
|
||||
Route::any('/banking/get_latest_bank_balance', 'BankingController@get_latest_bank_balance')->name('banking.get_latest_bank_balance');
|
||||
Route::any('/banking/get_last_reconciliation_balance', 'BankingController@get_last_reconciliation_balance')->name('banking.get_last_reconciliation_balance');
|
||||
Route::any('/banking/get_other_income_account_balance', 'BankingController@get_other_income_account_balance')->name('banking.get_other_income_account_balance');
|
||||
Route::any('/banking/store_other_income_deposit', 'BankingController@store_other_income_deposit')->name('banking.store_other_income_deposit');
|
||||
|
||||
/* Banking Records */
|
||||
Route::any('/banking/reverse/{trans_id}', 'BankingController@reverse')->name('banking.reverse');
|
||||
Route::any('/banking/register', 'BankingController@register')->name('banking.register');
|
||||
Route::any('/banking/write_off_balance', 'BankingController@write_off_balance')->name('banking.write_off_balance');
|
||||
Route::any('/banking/reconcile', 'BankingController@reconcile')->name('banking.reconcile');
|
||||
Route::any('/banking/reconcile/reports', 'BankingController@reconciliation_reports')->name('banking.reconcile.reports');
|
||||
Route::any('/banking/finish_adjustment', 'BankingController@finish_adjustment')->name('banking.finish_adjustment');
|
||||
Route::any('/banking/finish_with_balance', 'BankingController@finish_with_balance')->name('banking.finish_with_balance');
|
||||
Route::any('/banking/finish_reconciling', 'BankingController@finish_reconciling')->name('banking.finish_reconciling');
|
||||
Route::any('/bank/reconciliation/report/{id}', 'BankingController@bank_reconciliation_report')->name('bank.reconciliation.report');
|
||||
Route::any('/banking/print_bank_reconciliation/{id}', 'BankingController@print_bank_reconciliation')->name('banking.print_bank_reconciliation');
|
||||
Route::any('/banking/undo_bank_reconciliation/{id}', 'BankingController@undo_bank_reconciliation')->name('banking.undo_bank_reconciliation');
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
image: alpine/git:latest
|
||||
|
||||
pipelines:
|
||||
branches:
|
||||
main:
|
||||
- step:
|
||||
name: Merge To Beta
|
||||
script:
|
||||
- git remote set-url origin https://Kabricks:${APP_SECRET}@bitbucket.org/dcsammi/${BITBUCKET_REPO_SLUG}
|
||||
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
- git fetch
|
||||
- git checkout beta
|
||||
- git merge main
|
||||
- git commit --amend -m "[skip ci] Merge changes from main"
|
||||
- git push
|
||||
- step:
|
||||
name: Deploy To Test
|
||||
script:
|
||||
- echo "Ready to deploy to demo or production!"
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Banking",
|
||||
"alias": "banking",
|
||||
"description": "Banking module",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Banking\\Providers\\BankingServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Budgets'
|
||||
];
|
||||
@@ -0,0 +1,681 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Budgets\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\Budget;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Barryvdh\Snappy\Facades\SnappyPdf;
|
||||
|
||||
class BudgetController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:budget-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:budget-create', ['only' => ['create', 'clone', 'store']]);
|
||||
$this->middleware('permission:budget-edit', ['only' => ['edit', 'update', 'edit_all', 'update_all']]);
|
||||
$this->middleware('permission:budget-delete', ['only' => ['destroy', 'inactive', 'activate']]);
|
||||
$this->middleware('permission:budget-performance-report', ['only' => ['budget_performance']]);
|
||||
$this->middleware('permission:budget-detail-performance-report', ['only' => ['budget_performance']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(Request $request)
|
||||
{
|
||||
$created_by = $request->created_by;
|
||||
$dates = $request->dates;
|
||||
$filters = [];
|
||||
|
||||
if ($created_by == null) :
|
||||
// pass
|
||||
elseif ($created_by != 'all') :
|
||||
array_push($filters, ['created_by', '=', $created_by]);
|
||||
endif;
|
||||
|
||||
switch ($dates) {
|
||||
case 'today':
|
||||
$today = Carbon::today()->format('Y-m-d');
|
||||
$budgets = Budget::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', $today)->paginate(1000);
|
||||
break;
|
||||
|
||||
case 'yesterday':
|
||||
$yesterday = Carbon::yesterday()->format('Y-m-d');
|
||||
$budgets = Budget::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', $yesterday)->paginate(1000);
|
||||
break;
|
||||
|
||||
case 'week':
|
||||
$week_ago = Carbon::today()->subDays(7)->format('Y-m-d');
|
||||
$budgets = Budget::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', '>=', $week_ago)->paginate(1000);
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
$month_ago = Carbon::today()->subDays(30)->format('Y-m-d');
|
||||
$budgets = Budget::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', '>=', $month_ago)->paginate(1000);
|
||||
break;
|
||||
|
||||
case 'custom-date':
|
||||
$start_date = Carbon::parse($request->start_date)->format('Y-m-d');
|
||||
|
||||
$budgets = Budget::orderBy('created_at', 'desc')->where($filters)->whereDate('created_at', '=', $start_date)->paginate(1000);
|
||||
break;
|
||||
|
||||
case 'custom-range':
|
||||
$start_date = Carbon::parse($request->start_date)->format('Y-m-d');
|
||||
$end_date = Carbon::parse($request->end_date)->format('Y-m-d');
|
||||
|
||||
$budgets = Budget::orderBy('created_at', 'desc')->where($filters)->whereBetween('created_at', [$start_date, $end_date])->paginate(1000);
|
||||
break;
|
||||
|
||||
default:
|
||||
$budgets = Budget::orderBy('created_at', 'desc')->where($filters)->paginate(1000);
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if ($budgets->count() <= 0) {
|
||||
flash("There are no budgets found!")->error();
|
||||
}
|
||||
|
||||
// users with activity
|
||||
$created_by_array = DB::table('budgets')->groupBy('created_by')->select('created_by')->get()->toArray();
|
||||
$created_by = array(count($created_by_array));
|
||||
|
||||
foreach ($created_by_array as $value) {
|
||||
$created_by[$value->created_by] = get_full_name($value->created_by, 'id', 'first_name', 'last_name', 'users');
|
||||
}
|
||||
|
||||
// remove the count from the array
|
||||
unset($created_by[0]);
|
||||
|
||||
// add --select--
|
||||
$created_by = ['all' => 'ALL'] + $created_by;
|
||||
|
||||
// $budgets = Budget::orderBy('id', 'asc')->paginate(2000);
|
||||
$budgets = DB::table('budgets')->leftJoin('users', 'users.id', '=', 'budgets.created_by')
|
||||
->whereNull('budgets.deleted_at')
|
||||
->select('budgets.*', DB::raw("CONCAT(users.first_name,' ',users.last_name) AS user_by"))
|
||||
->orderBy('budgets.id', 'desc')
|
||||
->paginate(2000);
|
||||
|
||||
return view('budgets::budgets.index', compact('budgets', 'created_by'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
$this_year = Carbon::today()->year;
|
||||
$accounts = DB::table('chart_of_accounts as c')
|
||||
->leftJoin('account_types AS a', 'a.id', '=', 'c.type')
|
||||
->select('c.id', 'c.name', 'c.sub_account_of', 'a.name as type')
|
||||
->whereIn('c.type', [1, 2, 7]) // 1 - Income, 2 - Expense, 7 - Cost of Goods
|
||||
->get();
|
||||
return view('budgets::budgets.create', compact('this_year', 'accounts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'period' => 'required',
|
||||
'budget_name' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
$budget = new Budget;
|
||||
|
||||
$period = $request->period;
|
||||
$period_count = 0;
|
||||
$period_start = 0;
|
||||
|
||||
switch ($period) {
|
||||
case 'months':
|
||||
$period_count = $request->period_count_months;
|
||||
// $period_start = $request->period_start;
|
||||
break;
|
||||
case 'quarters':
|
||||
$period_count = $request->period_count_quarters;
|
||||
// $period_start = $request->period_start;
|
||||
break;
|
||||
case 'years':
|
||||
$period_count = $request->period_count_years;
|
||||
// $period_start = $request->period_start;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$entries = [];
|
||||
$accs = [];
|
||||
$row_entry = explode(',', $request->accountsNumber);
|
||||
for ($i = 0; $i < count($row_entry); $i++) {
|
||||
$acc_id = 'account_id_row_' . $row_entry[$i];
|
||||
$entry_id = 'budget_entry_row_' . $row_entry[$i];
|
||||
$account = preg_split("/\~/", $request->$acc_id);
|
||||
$entry = ['account_id' => $account[0], 'name' => $account[1], 'type' => $account[2], 'sub_account'=>$account[3], 'account_entries' => $request->$entry_id];
|
||||
array_push($entries, $entry);
|
||||
array_push($accs, $account[0]);
|
||||
}
|
||||
|
||||
try {
|
||||
Budget::create([
|
||||
"name" => $request->budget_name,
|
||||
"period" => $period, // dropdown months, quarters, years
|
||||
"period_count" => $period_count, // no. of months, quarters, years
|
||||
"period_start" => $request->period_start, // date
|
||||
"accounts" => implode(",", $accs),
|
||||
"entries" => json_encode($entries),
|
||||
"affected_tables" => implode(",", []),
|
||||
"created_by" => $logged_in_user_id,
|
||||
]);
|
||||
flash($request->budget_name . " Budget has been saved")->success();
|
||||
return redirect('/budgets/');
|
||||
} catch (QueryException $e) {
|
||||
if ($e->errorInfo != null) {
|
||||
flash($request->budget_name . " Budget already exists!")->error();
|
||||
return back()->withInput();
|
||||
} else {
|
||||
flash($e->getMessage())->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
$budget = Budget::findOrFail($id);
|
||||
$arr3 = json_decode($budget->entries, true);
|
||||
$income = $income_section = $income_sub_accounts = $expense = $expense_section = $expense_sub_accounts = [];
|
||||
$cost_of_goods = $cost_of_goods_section = $cost_of_goods_sub_accounts = $options = [];
|
||||
foreach ($arr3 as $rkey => $resource) {
|
||||
if ($resource['type'] == 'Income') {
|
||||
$income[] = $resource;
|
||||
if(!empty($resource['sub_account'])) $income_sub_accounts[$resource['sub_account']][] = $resource;
|
||||
else $income_section[] = $resource;
|
||||
}
|
||||
else if ($resource['type'] == 'Cost Of Goods') {
|
||||
$cost_of_goods[] = $resource;
|
||||
if(!empty($resource['sub_account'])) $cost_of_goods_sub_sub_accounts[$resource['sub_account']][] = $resource;
|
||||
else $cost_of_goods_section[] = $resource;
|
||||
}
|
||||
else {
|
||||
$expense[] = $resource;
|
||||
if(!empty($resource['sub_account'])) $expense_sub_accounts[$resource['sub_account']][] = $resource;
|
||||
else $expense_section[] = $resource;
|
||||
}
|
||||
}
|
||||
$options[] = ['section_header' => 'Income', 'total_header' => 'Total Income', 'entries' => $income, 'sub_accounts' =>$income_sub_accounts, 'section'=>$income_section];
|
||||
$options[] = ['section_header' => 'Cost of Goods', 'total_header' => 'Cost of Goods Total', 'entries' => $cost_of_goods, 'sub_accounts' =>$cost_of_goods_sub_accounts, 'section' => $cost_of_goods_section];
|
||||
$options[] = ['section_header' => 'Expenses', 'total_header' => 'Total Expenditure', 'entries' => $expense, 'sub_accounts' =>$expense_sub_accounts, 'section'=>$expense_section];
|
||||
// echo '<pre>' . var_export($budgets, true) . '</pre>';exit;
|
||||
return view('budgets::budgets.show', compact('budget', 'options'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Print the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function print_budget($id)
|
||||
{
|
||||
$budget = Budget::findOrFail($id);
|
||||
$arr3 = json_decode($budget->entries, true);
|
||||
$income = $income_section = $income_sub_accounts = $expense = $expense_section = $expense_sub_accounts = [];
|
||||
$cost_of_goods = $cost_of_goods_section = $cost_of_goods_sub_accounts = $options = [];
|
||||
foreach ($arr3 as $rkey => $resource) {
|
||||
if ($resource['type'] == 'Income') {
|
||||
$income[] = $resource;
|
||||
if(!empty($resource['sub_account'])) $income_sub_accounts[$resource['sub_account']][] = $resource;
|
||||
else $income_section[] = $resource;
|
||||
}
|
||||
else if ($resource['type'] == 'Cost Of Goods') {
|
||||
$cost_of_goods[] = $resource;
|
||||
if(!empty($resource['sub_account'])) $cost_of_goods_sub_sub_accounts[$resource['sub_account']][] = $resource;
|
||||
else $cost_of_goods_section[] = $resource;
|
||||
}
|
||||
else {
|
||||
$expense[] = $resource;
|
||||
if(!empty($resource['sub_account'])) $expense_sub_accounts[$resource['sub_account']][] = $resource;
|
||||
else $expense_section[] = $resource;
|
||||
}
|
||||
}
|
||||
$options[] = ['section_header' => 'Income', 'total_header' => 'Total Income', 'entries' => $income, 'sub_accounts' =>$income_sub_accounts, 'section'=>$income_section];
|
||||
$options[] = ['section_header' => 'Cost of Goods', 'total_header' => 'Cost of Goods Total', 'entries' => $cost_of_goods, 'sub_accounts' =>$cost_of_goods_sub_accounts, 'section' => $cost_of_goods_section];
|
||||
$options[] = ['section_header' => 'Expenses', 'total_header' => 'Total Expenditure', 'entries' => $expense, 'sub_accounts' =>$expense_sub_accounts, 'section'=>$expense_section];
|
||||
$data = [
|
||||
'budget' => $budget,
|
||||
'options' => $options
|
||||
];
|
||||
$pdf = SnappyPDF::loadView('budgets::budgets/print_budget', $data)
|
||||
->setOrientation('landscape')
|
||||
->setOption('margin-bottom', 7)
|
||||
->setOption('margin-top', 5)
|
||||
->setOption('footer-html', '<i>Stre@mline - Printed On ' . date('Y-m-d') . ' By ' . auth()->user()->first_name . " " . auth()->user()->last_name . '</i>');
|
||||
|
||||
return $pdf->inline(ucfirst($budget->name) . date(" d-m-y h:ia") . '.pdf');
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the clone resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function clone($id)
|
||||
{
|
||||
$budget = Budget::findOrFail($id);
|
||||
$this_year = Carbon::today()->year;
|
||||
$accounts = DB::table('chart_of_accounts as c')
|
||||
->leftJoin('account_types AS a', 'a.id', '=', 'c.type')
|
||||
->select('c.id', 'c.name', 'c.sub_account_of', 'a.name as type')
|
||||
->whereIn('c.type', [1, 2, 7])
|
||||
->get();
|
||||
$arr = explode(',', $budget->accounts);
|
||||
$budget_accounts_ids = [];
|
||||
for ($i = 0; $i < count($arr); $i++) array_push($budget_accounts_ids, $arr[$i]);
|
||||
$arr2 = explode(',', $budget->entries);
|
||||
$entries = [];
|
||||
for ($i = 0; $i < count($arr2); $i++) array_push($entries, $arr2[$i]);
|
||||
$budget_accounts = DB::table('chart_of_accounts as c')
|
||||
->leftJoin('account_types AS a', 'a.id', '=', 'c.type')
|
||||
->select('c.id', 'c.name', 'c.sub_account_of', 'a.name as type')
|
||||
->whereIn('c.id', $budget_accounts_ids)
|
||||
->orderByRaw("FIELD(c.id, " . $budget->accounts . ")")
|
||||
->get();
|
||||
return view('budgets::budgets.clone', compact('budget', 'budget_accounts', 'entries', 'this_year', 'accounts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$budget = Budget::findOrFail($id);
|
||||
$this_year = Carbon::today()->year;
|
||||
$accounts = DB::table('chart_of_accounts as c')
|
||||
->leftJoin('account_types AS a', 'a.id', '=', 'c.type')
|
||||
->select('c.id', 'c.name', 'c.sub_account_of', 'a.name as type')
|
||||
->whereIn('c.type', [1, 2, 7])
|
||||
->get();
|
||||
$arr2 = explode(',', $budget->entries);
|
||||
$entries = [];
|
||||
for ($i = 0; $i < count($arr2); $i++) array_push($entries, $arr2[$i]);
|
||||
return view('budgets::budgets.edit', compact('budget', 'this_year', 'accounts', 'entries'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$budget = Budget::findOrFail($id);
|
||||
$validator = Validator::make($request->all(), [
|
||||
'budget_name' => 'required',
|
||||
'period' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
|
||||
$period_count = 0;
|
||||
$period = $request->period;
|
||||
switch ($period) {
|
||||
case 'months':
|
||||
$period_count = $request->period_count_months;
|
||||
// $period_start = $request->period_start_month;
|
||||
break;
|
||||
case 'quarters':
|
||||
$period_count = $request->period_count_quarters;
|
||||
// $period_start = $request->period_start_quarter;
|
||||
break;
|
||||
case 'years':
|
||||
$period_count = $request->period_count_years;
|
||||
// $period_start = $request->period_start_year;
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
}
|
||||
$entries = [];
|
||||
$row_ids = explode(',', $request->accountsNumber);
|
||||
$accs = [];
|
||||
for ($i = 0; $i < count($row_ids); $i++) {
|
||||
$acc_id = 'account_id_row_' . $row_ids[$i];
|
||||
$entry_id = 'budget_entry_row_' . $row_ids[$i];
|
||||
$account = preg_split("/\~/", $request->$acc_id);
|
||||
$entry = ['account_id' => $account[0], 'name' => $account[1], 'type' => $account[2], 'sub_account'=>$account[3], 'account_entries' => $request->$entry_id];
|
||||
array_push($entries, $entry);
|
||||
array_push($accs, $account[0]);
|
||||
}
|
||||
|
||||
try {
|
||||
$budget->update([
|
||||
'name' => $request->budget_name,
|
||||
'period' => $request->period,
|
||||
'period_count' => $period_count, // no. of months, quarters, years
|
||||
'period_start' => $request->period_start,
|
||||
'accounts' => implode(",", $accs),
|
||||
'entries' => $entries,
|
||||
'updated_by' => Auth::user()->id,
|
||||
]);
|
||||
flash($request->budget_name . " has been updated")->success();
|
||||
return redirect("/budgets/");
|
||||
} catch (QueryException $e) {
|
||||
flash($request->budget_name . " already exists!")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$budget = Budget::findOrFail($id);
|
||||
|
||||
if ($budget->delete()) {
|
||||
flash("Budget has been deleted.")->success();
|
||||
return redirect('/budgets/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive()
|
||||
{
|
||||
$budgets = Budget::onlyTrashed()->orderBy('name', 'asc')->paginate(50);
|
||||
// users with activity
|
||||
$created_by_array = DB::table('budgets')->groupBy('created_by')->select('created_by')->get()->toArray();
|
||||
$created_by = array(count($created_by_array));
|
||||
|
||||
foreach ($created_by_array as $value) {
|
||||
$created_by[$value->created_by] = get_full_name($value->created_by, 'id', 'first_name', 'last_name', 'users');
|
||||
}
|
||||
|
||||
// remove the count from the array
|
||||
unset($created_by[0]);
|
||||
|
||||
// add --select--
|
||||
$created_by = ['all' => 'ALL'] + $created_by;
|
||||
|
||||
if ($budgets->isEmpty()) {
|
||||
flash()->error("There is no inactive budget.");
|
||||
return redirect('/budgets/');
|
||||
} else {
|
||||
return view('budgets::budgets.inactive', compact('budgets', 'created_by'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id)
|
||||
{
|
||||
$budget = Budget::onlyTrashed()->findOrFail($id);
|
||||
|
||||
if ($budget->restore()) {
|
||||
flash("Budget has been activated.")->success();
|
||||
return redirect('/budgets/');
|
||||
} else {
|
||||
flash()->error("Budget hasn't been activated.");
|
||||
return redirect()->route('budgets.inactive');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Search a resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function search(Request $request)
|
||||
{
|
||||
|
||||
$filters = [];
|
||||
if ($request->created_by != 'all') $filters[] = ['created_by', '=', $request->created_by];
|
||||
if ($request->dates && $request->dates != 'all') {
|
||||
switch ($request->dates) {
|
||||
case 'today':
|
||||
$end_date = Carbon::today()->endOfDay();
|
||||
$start_date = Carbon::today()->startOfDay();
|
||||
$filters[] = ['created_at', '>=', $start_date];
|
||||
$filters[] = ['created_at', '<=', $end_date];
|
||||
break;
|
||||
|
||||
case 'yesterday':
|
||||
$end_date = Carbon::yesterday()->endOfDay();
|
||||
$start_date = Carbon::yesterday()->startOfDay();
|
||||
$filters[] = ['created_at', '>=', $start_date];
|
||||
$filters[] = ['created_at', '<=', $end_date];
|
||||
break;
|
||||
|
||||
case 'week':
|
||||
$end_date = Carbon::today()->endOfDay();
|
||||
$start_date = Carbon::today()->subDays(7)->startOfDay();
|
||||
$filters[] = ['created_at', '>=', $start_date];
|
||||
$filters[] = ['created_at', '<=', $end_date];
|
||||
break;
|
||||
|
||||
case 'month':
|
||||
$end_date = Carbon::today()->endOfDay();
|
||||
$start_date = Carbon::today()->subDays(7)->startOfDay();
|
||||
$filters[] = ['created_at', '>=', $start_date];
|
||||
$filters[] = ['created_at', '<=', $end_date];
|
||||
break;
|
||||
|
||||
case 'custom-date':
|
||||
$end_date = Carbon::parse($request->start_date)->endOfDay();
|
||||
$start_date = Carbon::parse($request->start_date)->startOfDay();
|
||||
$filters[] = ['created_at', '>=', $start_date];
|
||||
$filters[] = ['created_at', '<=', $end_date];
|
||||
break;
|
||||
|
||||
case 'custom-range':
|
||||
$end_date = Carbon::parse($request->end_date)->endOfDay();
|
||||
$start_date = Carbon::parse($request->start_date)->startOfDay();
|
||||
$filters[] = ['created_at', '>=', $start_date];
|
||||
$filters[] = ['created_at', '<=', $end_date];
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
$created_by_array = DB::table('budgets')->groupBy('created_by')->select('created_by')->get()->toArray();
|
||||
$created_by = array(count($created_by_array));
|
||||
|
||||
foreach ($created_by_array as $value) {
|
||||
$created_by[$value->created_by] = get_full_name($value->created_by, 'id', 'first_name', 'last_name', 'users');
|
||||
}
|
||||
|
||||
// remove the count from the array
|
||||
unset($created_by[0]);
|
||||
|
||||
// add --select--
|
||||
$created_by = ['all' => 'ALL'] + $created_by;
|
||||
|
||||
if ($request->query_active) {
|
||||
if ($request->active_state == 'active') $budgets = Budget::where($filters)->orderBy('id', 'desc')->get();
|
||||
else $budgets = Budget::withTrashed()->where($filters)->orderBy('id', 'desc')->get();
|
||||
return view('budgets::budgets.index', compact('budgets', 'created_by'));
|
||||
} else {
|
||||
$budgets = Budget::where($filters)->onlyTrashed()->orderBy('deleted_at', 'desc')->get();
|
||||
return view('budgets::budgets.inactive', compact('budgets', 'created_by'));
|
||||
}
|
||||
}
|
||||
|
||||
public function get_budgets()
|
||||
{
|
||||
//code to be returned to view
|
||||
$code = "<option> -- select -- </option>";
|
||||
|
||||
$budgets = Budget::orderBy('name', 'asc')->get();
|
||||
|
||||
foreach ($budgets as $budget) {
|
||||
$code .= "<option value='" . $budget->id . "'>" . $budget->name . "</option>";
|
||||
}
|
||||
|
||||
return $code;
|
||||
}
|
||||
|
||||
/* test server side scolling with datatables */
|
||||
public function datatable_test()
|
||||
{
|
||||
$budgets = Budget::orderBy('name', 'asc')->get();
|
||||
|
||||
return response()->json($budgets);
|
||||
}
|
||||
|
||||
//budget vs actual report
|
||||
public function budget_performance(Request $request)
|
||||
{
|
||||
$budget = (!empty($request->budget_id))? Budget::findOrFail($request->budget_id) : Budget::latest()->first();
|
||||
if (empty($budget)) return redirect('/budgets/');
|
||||
$other_budgets = Budget::where('id', '<>', $budget->id)->select('name', 'id')->get();
|
||||
$entries = json_decode($budget->entries, true);
|
||||
$income = $income_ids = $expense = $expense_ids = $cost_of_goods = $cost_of_goods_ids = $options = [];
|
||||
|
||||
foreach ($entries as $rkey => $resource) {
|
||||
if ($resource['type'] == 'Income') $income_ids[] = $resource['account_id'];
|
||||
else if ($resource['type'] == 'Cost Of Goods') $cost_of_goods_ids[] = $resource['account_id'];
|
||||
else $expense_ids[] = $resource['account_id'];
|
||||
}
|
||||
|
||||
$budget_start_date = Carbon::parse($budget->period_start)->startOfDay()->toDateString();
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$budget_end_date = date("Y-m-t", strtotime("+". $budget->period_count - 1 ." month", strtotime($budget_start_date)));
|
||||
$end_date =Carbon::parse($budget_end_date)->endOfDay()->toDateString();
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$budget_end_date = date("Y-m-t", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$end_date = Carbon::parse($budget_end_date)->endOfDay()->toDateString();
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$day = (date('d', strtotime($budget_start_date)) > 28)? date('Y-m-d', strtotime('-3 day', strtotime($budget_start_date))) : $budget_start_date;
|
||||
$budget_end_date = date("Y-m-t", strtotime("+". $budget->period_count - 1 ." year", strtotime('-1 month', strtotime($day))));
|
||||
$end_date =Carbon::parse($budget_end_date)->endOfDay()->toDateString();
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
$request->request->add(['dates' => 'custom_date_range']);
|
||||
$request->request->add(['start_date' => $budget_start_date]);
|
||||
$request->request->add(['end_date' => $end_date]);
|
||||
$request->request->add(['cost_of_goods_ids' => $cost_of_goods_ids]);
|
||||
$request->request->add(['expense_ids' => $expense_ids]);
|
||||
$request->request->add(['income_ids' => $income_ids]);
|
||||
// echo '<pre>' . var_export($budget, true) . '</pre>';exit;
|
||||
$data = getNetIncome($request);
|
||||
|
||||
$actual_income = $data['accrual_income_total'] + $data['cash_income_total'];
|
||||
$actual_cost_of_goods = $data['cog_accrual_total'] + $data['cog_cash_total'];
|
||||
$actual_expense = $data['expenses_accrual_total'] + $data['expenses_cash_total'];
|
||||
foreach ($entries as $entry) {
|
||||
if ($entry['type'] == 'Income') {
|
||||
$actual_entry = isset($data['revenue'][0][$entry['account_id']]['cash'])? $data['revenue'][0][$entry['account_id']]['cash'] + $data['revenue'][0][$entry['account_id']]['accrual'] : 0;
|
||||
$entry['actual_entry'] = $actual_entry;
|
||||
$income [] = $entry;
|
||||
}
|
||||
else if ($entry['type'] == 'Cost Of Goods') {
|
||||
$actual_entry = isset($data['revenue'][1][$entry['account_id']]['cash'])? $data['revenue'][1][$entry['account_id']]['cash'] + $data['revenue'][1][$entry['account_id']]['accrual'] : 0;
|
||||
$entry['actual_entry'] = $actual_entry;
|
||||
$cost_of_goods[] = $entry;
|
||||
}
|
||||
else {
|
||||
$actual_entry = isset($data['expense_accounts'][$entry['account_id']]['cash'])? $data['expense_accounts'][$entry['account_id']]['cash'] + $data['expense_accounts'][$entry['account_id']]['accrual'] : 0;
|
||||
$entry['actual_entry'] = $actual_entry;
|
||||
$expense[] = $entry;
|
||||
}
|
||||
}
|
||||
$options[] = ['section_header' => 'Income', 'total_header' => 'Total Income', 'entries' => $income, 'actual' => $actual_income];
|
||||
$options[] = ['section_header' => 'Cost of Goods', 'total_header' => 'Cost of Goods Total', 'entries' => $cost_of_goods, 'actual' => $actual_cost_of_goods];
|
||||
$options[] = ['section_header' => 'Expenses', 'total_header' => 'Total Expenditure', 'entries' => $expense, 'actual' => $actual_expense];
|
||||
|
||||
$type = explode('/',$request->url());
|
||||
$view = ($type[count($type) - 1] == 'summary') ? 'budgets::budgets.budget_performance' : 'budgets::budgets.budget_performance_detail';
|
||||
return view($view, compact('budget', 'options', 'data','budget_start_date','budget_end_date','other_budgets'));
|
||||
|
||||
}
|
||||
|
||||
function print_budget_report(Request $request){
|
||||
|
||||
$budget = json_decode($request->budget);
|
||||
$options = json_decode($request->options, true);
|
||||
$data = json_decode($request->data, true);
|
||||
$range = $request->range;
|
||||
if ($request->type == 'summary') {
|
||||
$view = 'budgets::budgets.print_budget_performance';
|
||||
$orientation = 'portrait';
|
||||
}
|
||||
else {
|
||||
$view = 'budgets::budgets.print_budget_performance_detail';
|
||||
$orientation = 'landscape';
|
||||
}
|
||||
$pdf = SnappyPDF::loadView($view, compact('budget', 'options','data', 'range'))
|
||||
->setOrientation($orientation)
|
||||
->setOption('margin-bottom', 7)
|
||||
->setOption('margin-top', 5)
|
||||
->setOption('footer-html', '<i>Stre@mline - Printed On ' . date('Y-m-d') . ' By ' . auth()->user()->first_name . " " . auth()->user()->last_name . '</i>');
|
||||
return $pdf->inline(ucfirst($budget->name) . date(" d-m-y h:ia") . '.pdf');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Budgets\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -0,0 +1,113 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Budgets\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Modules\Budgets\Providers\RouteServiceProvider;
|
||||
|
||||
class BudgetsServiceProvider extends ServiceProvider{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'Budgets';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'budgets';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Budgets\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* This namespace is applied to your controller routes.
|
||||
*
|
||||
* In addition, it is set as the URL generator's root namespace.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $namespace = 'Modules\Budgets\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Define your route model bindings, pattern filters, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->namespace)
|
||||
->group(module_path('Budgets', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->namespace)
|
||||
->group(module_path('Budgets', '/Routes/api.php'));
|
||||
}
|
||||
}
|
||||
+243
@@ -0,0 +1,243 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.budgets') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- @include('budgets::budgets.menu')
|
||||
@include('flash::message') --}}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="white-box">
|
||||
@php
|
||||
$period_months = getMonthsList();
|
||||
$columns = ['Account', 'Budget Total', 'Actual Total', 'Percentage Variance <br> Actual vs Budget', 'Actual Variance <br> Actual vs Budget'];
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d",
|
||||
strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[]=$quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// $period_range = $budget_start_date . " to " . $budget_end_date;
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
<div class="row">
|
||||
@if(isset($other_budgets))
|
||||
<div class="dropdown col-md-2">
|
||||
<a href="#" class="btn btn-success btn-rounded dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Previous budget</a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
{{ Form::open(['method' => 'POST', 'route' => ['budgets.performance','summary'], 'id' =>'budgetPerformance']) }}
|
||||
<input type="hidden" name="budget_id" id="budget_id" />
|
||||
@php
|
||||
foreach($other_budgets as $other_budget){
|
||||
echo '<a class="dropdown-item" onclick="performance_budget(this)" href="#" data-href="'.$other_budget->id.'">'.$other_budget->name.'</a>';
|
||||
}
|
||||
@endphp
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class='col-md-6'></div>
|
||||
<div class="col-md-2">
|
||||
<a href="#" onclick="download_table_as_csv('table', '{{ __('budgets.performance') . ': ' . $budget->name }}');"
|
||||
title="Download CSV of budget" class="btn btn-success btn-rounded"><span class="glyphicon glyphicon-download"></span> Download CSV</a>
|
||||
|
||||
</div>
|
||||
{{ Form::open(['method' => 'POST', 'route' => 'budgets.print_reports', 'id' =>'budgetPrint']) }}
|
||||
<input type="hidden" name="budget" id="budget" value='{{ json_encode($budget) }}' />
|
||||
<input type="hidden" name="options" id="options" value='{{ json_encode($options) }}' />
|
||||
<input type="hidden" name="data" id="data" value='{{ json_encode($data) }}' />
|
||||
<input type="hidden" name="type" id="type" value='summary' />
|
||||
<input type="hidden" name="range" id="range" value='{{ $period_range }}' />
|
||||
<div class='col-md-2'>
|
||||
<button title= '{{ __('budgets.performance_detail') . ": print to pdf " }}' type='submit' class='btn btn-rounded btn-success'><span class="glyphicon glyphicon-print"></span> Print Report</button>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<hr />
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p>
|
||||
<h4>{{ __('budgets.performance') . ": " . $budget->name }}</h4>
|
||||
</p>
|
||||
<p>
|
||||
<h4>{{ "Period(" . ucfirst($budget->period) . "): " . $period_range }}</h4>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<table id="table" class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr style='display:none;'>
|
||||
<td colspan='<?php echo count($columns); ?>'>
|
||||
Budget Name: {{ ucfirst($budget->name) .' - Period('. ucfirst($budget->period) .'): '.$period_range }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$actual_totals = $totals_budgets = $summary_colums = $income_column_totals=[];
|
||||
$expense_column_totals=[];$cost_of_goods_column_totals=[];
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($option['entries'] as $entry )
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j]; $col_percent=($entry['actual_entry']>0)? round(((($entry['actual_entry'] - $sum) / $entry['actual_entry']) * 100),2).'%' : 'N/A';
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i == 1) echo "<td>" . ugandan_shillings($sum) . "</td>" ;//Budget Total
|
||||
else if ($i == 2) echo "<td>" . ugandan_shillings($entry['actual_entry']) . "</td>" ; //Actual Total
|
||||
else if ($i == 3) echo "<td>" . $col_percent . "</td>" ; //Percentage variance
|
||||
else if ($i == 4) echo "<td>" . ugandan_shillings($entry['actual_entry'] - $sum) . "</td>" ; //Actual Variance
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Budget Section column Totals --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section = $columnTotal_section = 0;
|
||||
if ($i==0) echo '<td>' .$option['total_header']. '</td>' ;
|
||||
else if ($i==1){ //Budget totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) $columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" . ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else if ($i==2) {
|
||||
array_push($actual_totals, $option['actual']);
|
||||
echo "<td>" . ugandan_shillings($option['actual']) . "</td>" ; //Actual Total
|
||||
} else if ($i==3) {
|
||||
$percent=($option['actual'] != 0)? round(((($option['actual'] - $totals_budgets[count($totals_budgets) - 1]) / $option['actual'] ) * 100),2) .'%' : 'N/A';
|
||||
echo "<td>" . $percent . "</td>" ; //Percentage variance
|
||||
}
|
||||
else if ($i == 4) echo "<td>" .ugandan_shillings($option['actual'] - $totals_budgets[count($totals_budgets) - 1]). "</td>" ; //Actual Variance
|
||||
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Overall Budget Performance --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
array_push($summary_colums, $overall_projection);
|
||||
$total_actual = $data['accrual_net_income'] + $data['cash_net_income'];
|
||||
array_push($summary_colums, $total_actual);
|
||||
$overall_percentage = ($summary_colums[1] != 0)? round(((($summary_colums[1] - $summary_colums[0]) / $summary_colums[1]) * 100),2) .'%' : 'N/A';
|
||||
@endphp
|
||||
<td>Performance</td>
|
||||
<td> {{ ugandan_shillings($overall_projection) }} </td> {{-- Budget Projection --}}
|
||||
<td> {{ ugandan_shillings($total_actual) }} </td> {{-- Actual Total --}}
|
||||
<td> {{ $overall_percentage }} </td> {{-- Percentage variance --}}
|
||||
<td> {{ ugandan_shillings($summary_colums[1] - $summary_colums[0]) }} </td> {{-- Actual Variance --}}
|
||||
</tr>
|
||||
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
{{-- </div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script src="{{ asset('js/streamline_functions.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function performance_budget(data) {
|
||||
var cell = data.getAttribute('data-href');
|
||||
$('#budget_id').val(cell);
|
||||
$("#budgetPerformance").submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
+284
@@ -0,0 +1,284 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
td {
|
||||
min-width: 140px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.budgets') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- @include('budgets::budgets.menu')
|
||||
@include('flash::message') --}}
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="white-box">
|
||||
@php
|
||||
$period_months = getMonthsList();
|
||||
$column_1 = ['Account'];
|
||||
$colum_2 = ['Budget Total', 'Actual Total', 'Percentage Variance <br> (Actual vs Budget)', 'Actual Variance <br> (Actual vs Budget)'];
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d",
|
||||
strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
$columns = array_merge($column_1, $months_data);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[]=$quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
$columns = array_merge($column_1, $other_columns);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// $period_range = $budget_start_date . " to " . $budget_end_date;
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
<div class="row">
|
||||
<div class="col-md-2">
|
||||
<a href="#" onclick="download_table_as_csv('table', '{{ __('budgets.performance_detail') . ': ' . $budget->name }}');"
|
||||
title="Download CSV of budget" class="btn btn-success btn-rounded"><span
|
||||
class="glyphicon glyphicon-download"></span> Download CSV</a>
|
||||
</div>
|
||||
{{ Form::open(['method' => 'POST', 'route' => 'budgets.print_reports', 'id' =>'budgetPrint']) }}
|
||||
<input type="hidden" name="budget" id="budget" value='{{ json_encode($budget, true) }}' />
|
||||
<input type="hidden" name="options" id="options" value='{{ json_encode($options, true) }}' />
|
||||
<input type="hidden" name="data" id="data" value='{{ json_encode($data, true) }}' />
|
||||
<input type="hidden" name="range" id="range" value='{{ $period_range }}' />
|
||||
<input type="hidden" name="type" id="type" value='detail' />
|
||||
<div class='col-md-2'>
|
||||
<button title= '{{ __('budgets.performance_detail') . ": print to pdf " }}' type='submit' class='btn btn-rounded btn-success'><span class="glyphicon glyphicon-print"></span> Print Report</button>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
@if(isset($other_budgets))
|
||||
<div class="dropdown col-md-2">
|
||||
<a href="#" class="btn btn-success btn-rounded dropdown-toggle" id="dropdownMenuButton" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false">Select Previous budget</a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
{{ Form::open(['method' => 'POST', 'route' => ['budgets.performance','detail'], 'id' =>'budgetPerformance']) }}
|
||||
<input type="hidden" name="budget_id" id="budget_id" />
|
||||
@php
|
||||
foreach($other_budgets as $other_budget){
|
||||
echo '<a class="dropdown-item" onclick="performance_budget(this)" href="#" data-href="'.$other_budget->id.'">'.$other_budget->name.'</a>';
|
||||
}
|
||||
@endphp
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
<div class='col-md-6'></div>
|
||||
</div>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<hr />
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p>
|
||||
<h4>{{ __('budgets.performance_detail') . ": " . $budget->name }}</h4>
|
||||
</p>
|
||||
<p>
|
||||
<h4>{{ "Period(" .ucfirst($budget->period) . "): " . $period_range }}</h4>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<table id="table" class="table color-bordered-table table-responsive success-bordered-table">
|
||||
<thead>
|
||||
<tr style='display:none;'>
|
||||
<td colspan='<?php echo count($columns); ?>'>
|
||||
Budget Name: {{ ucfirst($budget->name) .' - Period('. ucfirst($budget->period) .'): '.$period_range }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$actual_totals = $totals_budgets = $summary_colums = $income_column_totals=[];
|
||||
$expense_column_totals = $cost_of_goods_column_totals=[];
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($option['entries'] as $entry)
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j]; $col_percent=($entry['actual_entry']>0)? round(((($entry['actual_entry'] - $sum) / $entry['actual_entry']) * 100),2).'%' : 'N/A';
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i === $counter) echo "<td>" . ugandan_shillings($sum) . "</td>" ;//Budget Total
|
||||
else if ($i == $counter + 1) echo "<td>" . ugandan_shillings($entry['actual_entry']) . "</td>" ; //Actual Total
|
||||
else if ($i == $counter + 2) echo "<td>" . $col_percent . "</td>" ; //Percentage variance
|
||||
else if ($i == $counter + 3) echo "<td>" . ugandan_shillings($entry['actual_entry'] - $sum) . "</td>" ; //Actual Variance
|
||||
else {
|
||||
echo "<td>" .ugandan_shillings($entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Budget Section column Totals --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section = $columnTotal_section = 0;
|
||||
if ($i==0) echo '<td>' .$option['total_header']. '</td>' ;
|
||||
else if ($i == $counter){ //Budget totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) $columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" . ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else if ($i == $counter + 1) {
|
||||
array_push($actual_totals, $option['actual']);
|
||||
echo "<td>" . ugandan_shillings($option['actual']) . "</td>" ; //Actual Total
|
||||
} else if ($i== $counter+2) {
|
||||
$percent=($option['actual']> 0)? round(((($option['actual'] - $totals_budgets[count($totals_budgets) - 1]) / $option['actual'] ) * 100),2) .'%' : 'N/A';
|
||||
echo "<td>" . $percent . "</td>" ; //Percentage variance
|
||||
}
|
||||
else if ($i == $counter+3) echo "<td>" .ugandan_shillings($option['actual'] - $totals_budgets[count($totals_budgets) - 1]). "</td>" ; //Actual Variance
|
||||
else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
//Push to column total arrays
|
||||
if($entry['type'] == 'Income') array_push($income_column_totals, $columnTotal_section);
|
||||
else if($entry['type'] == 'Expense') array_push($expense_column_totals, $columnTotal_section);
|
||||
else array_push($cost_of_goods_column_totals, $columnTotal_section);
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Overall Budget Performance --}}
|
||||
|
||||
<tr class="total">
|
||||
@php
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
array_push($summary_colums, $overall_projection);
|
||||
$total_actual = $data['accrual_net_income'] + $data['cash_net_income'];
|
||||
array_push($summary_colums, $total_actual);
|
||||
$overall_percentage = ($summary_colums[1] > 0)? round(((($summary_colums[1] - $summary_colums[0]) / $summary_colums[1]) * 100),2) .'%' : 'N/A';
|
||||
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
if ($i==0) echo '<td>Summary</td>' ;
|
||||
else if ($i == $counter){ //Budget Totals
|
||||
echo "<td>" . ugandan_shillings($overall_projection) . "</td>" ;
|
||||
} else if ($i == $counter + 1) {
|
||||
echo "<td>" . ugandan_shillings($total_actual) . "</td>" ;
|
||||
} else if ($i == $counter + 2) {
|
||||
echo "<td>" . $overall_percentage . "</td>" ;
|
||||
} else if ($i == $counter + 3) {
|
||||
echo "<td>" . ugandan_shillings($summary_colums[1] - $summary_colums[0]) . "</td>" ;
|
||||
} else {
|
||||
$columnTotal_projection=$income_column_totals[$i-1] - $expense_column_totals[$i-1] - $cost_of_goods_column_totals[$i-1];
|
||||
echo "<td>".ugandan_shillings($columnTotal_projection). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
{{-- </div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script src="{{ asset('js/streamline_functions.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function performance_budget(data) {
|
||||
var cell = data.getAttribute('data-href');
|
||||
$('#budget_id').val(cell);
|
||||
$("#budgetPerformance").submit();
|
||||
}
|
||||
|
||||
</script>
|
||||
@endpush
|
||||
File diff suppressed because it is too large
Load Diff
+1000
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,243 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li><a href="{{ route('budgets.index') }}"><i class="fa fa-book"></i> {{ __('budgets.budgets') }}</a></li>
|
||||
<li class="active"><i class="fa fa-undo"></i> Inactive Budgets </li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- @include('budgets::budgets.menu') --}}
|
||||
|
||||
<div class="white-box">
|
||||
{{ Form::open(['route' => 'budgets.search']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('created_by', "Staff member") }}
|
||||
{{ Form::select('created_by', $created_by, null, ['class' => 'form-control compulsory','required']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('date_range', "Select the date") }}
|
||||
<div class="input-group">
|
||||
<select class="form-control compulsory required" id="dates" name="dates" required>
|
||||
<option value="ALL">ALL DATES</option>
|
||||
<option value="today">TODAY</option>
|
||||
<option value="yesterday">YESTERDAY</option>
|
||||
<option value="week">LAST 7 DAYS</option>
|
||||
<option value="month">LAST 30 DAYS</option>
|
||||
<option value="custom-date">CUSTOM DAY</option>
|
||||
<option value="custom-range">DATE RANGE</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" style="display: none;" id="start-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('start_date', "Date From") }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date','',['class' => 'form-control compulsory',
|
||||
'required','readonly','id'=>'datepicker-from']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" style="display: none;" id="end-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('end_date', "Date To") }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date','',['class' => 'form-control compulsory',
|
||||
'required','readonly','id'=>'datepicker-to']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-11"></div>
|
||||
<div class="col-md-1">
|
||||
{{ Form::button("Search", ['type'=>'submit','style'=>"border-radius: 5px;", 'class'=>'btn btn-success
|
||||
waves-effect waves-light m-r-10'])
|
||||
}}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
@include('flash::message')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="white-box">
|
||||
{{-- <p class="text-muted m-b-30">{{ __('finance.export_data_to_copy_csv_pdf_print') }}</p> --}}
|
||||
<div class="table-responsive">
|
||||
<table class="table table-striped">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Budget Breakdown</th>
|
||||
<th>Period</th>
|
||||
<th>Created By</th>
|
||||
<th>Date & Time Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@if(count($budgets) > 0)
|
||||
@foreach($budgets as $budget)
|
||||
@php
|
||||
$period = "N/A";
|
||||
$period_count = $budget->period_count;
|
||||
$period_start = $budget->period_start;
|
||||
$period_range = "N/A";
|
||||
|
||||
switch ($budget->period) {
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
|
||||
$period_months = getMonthsList();
|
||||
if (isset($period_months[$period_start]) && isset($period_months[$period_start +
|
||||
$period_count])) {
|
||||
$period_range = $period_months[$period_start] . " - " . $period_months[$period_start +
|
||||
$period_count];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
|
||||
$period_quarters = array("First", "Second", "Third", "Fourth");
|
||||
if (isset($period_quarters[$period_start]) && isset($period_quarters[$period_start +
|
||||
$period_count])) {
|
||||
$period_range = $period_quarters[$period_start] . " - " . $period_quarters[$period_start +
|
||||
$period_count];
|
||||
}
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
|
||||
if (is_numeric($period_start)) {
|
||||
$period_range = $period_start . " - " . ($period_start + $period_count);
|
||||
}
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $budget->name }}</td>
|
||||
<td>{{ ucfirst($budget->period) }}</td>
|
||||
<td>{{ $period_range }}</td>
|
||||
<td>{{ get_full_name($budget->created_by, 'id', 'first_name', 'last_name', 'users') }}
|
||||
</td>
|
||||
<td>{{ streamline_date_time_short($budget->created_at) }}</td>
|
||||
|
||||
<td>
|
||||
@if( Auth::user()->can('budget-delete'))
|
||||
{{ Form::model($budget->id ,['method' => 'POST', 'route' => ['budgets.activate',
|
||||
$budget->id]]) }}
|
||||
<button type="submit" class="btn btn-sm btn-warning btn-rounded"
|
||||
onclick="return confirm('Are you sure you want to activate this budget?')"><i
|
||||
class="fa fa-check"></i> {{ __('budgets.activate') }}</button>
|
||||
{{ Form::close() }}
|
||||
@endif
|
||||
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Budget Breakdown</th>
|
||||
<th>Period</th>
|
||||
<th>Created By</th>
|
||||
<th>Date & Time Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
responsive: true,
|
||||
order: []
|
||||
});
|
||||
|
||||
function show(id) {
|
||||
if (document.getElementById(id).style.display === 'none') {
|
||||
document.getElementById(id).style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#datepicker-from, #datepicker-to').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy',
|
||||
});
|
||||
|
||||
$('#dates').change(function() {
|
||||
var val = $(this).val();
|
||||
switch (val) {
|
||||
case 'custom-date':
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
case 'custom-range':
|
||||
$('#end-date-div').show();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
default:
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').hide();
|
||||
break;
|
||||
}
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,309 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.budgets') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('budgets::budgets.menu')
|
||||
|
||||
<div class="white-box">
|
||||
{{ Form::open(['route' => 'budgets.search']) }}
|
||||
<div class="row">
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('created_by', "Staff member") }}
|
||||
{{ Form::select('created_by', $created_by, null, ['class' => 'form-control compulsory','required']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('date_range', "Select the date") }}
|
||||
<div class="input-group">
|
||||
<select class="form-control compulsory required" id="dates" name="dates" required>
|
||||
<option value="ALL">ALL DATES</option>
|
||||
<option value="today">TODAY</option>
|
||||
<option value="yesterday">YESTERDAY</option>
|
||||
<option value="week">LAST 7 DAYS</option>
|
||||
<option value="month">LAST 30 DAYS</option>
|
||||
<option value="custom-date">CUSTOM DAY</option>
|
||||
<option value="custom-range">DATE RANGE</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3">
|
||||
<div class="form-group">
|
||||
{{ Form::label('active_state', "Select Active/Inactive Budgets") }}
|
||||
<div class="input-group">
|
||||
<select class="form-control" id="active_state" name="active_state">
|
||||
<option value="active">ACTIVE</option>
|
||||
<option value="inactive">INACTIVE</option>
|
||||
</select>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3"></div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6"></div>
|
||||
<div class="col-md-3" style="display: none;" id="start-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('start_date', "Date From") }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('start_date','',['class' => 'form-control compulsory',
|
||||
'required','readonly','id'=>'datepicker-from']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-3" style="display: none;" id="end-date-div">
|
||||
<div class="form-group">
|
||||
{{ Form::label('end_date', "Date To") }}
|
||||
<div class="input-group">
|
||||
{{ Form::text('end_date','',['class' => 'form-control compulsory',
|
||||
'required','readonly','id'=>'datepicker-to']) }}
|
||||
<span class="input-group-addon"><i class="icon-calender"></i></span>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-11"></div>
|
||||
<div class="col-md-1">
|
||||
{{ Form::hidden('query_active', 'active') }}
|
||||
{{ Form::button("Search", ['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
|
||||
</div>
|
||||
</div>
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="row">
|
||||
<div class="col-sm-12">
|
||||
<div class="white-box">
|
||||
<p class="text-muted m-b-30">{{ __('finance.export_data_to_copy_csv_pdf_print') }}</p>
|
||||
{{-- <div class="table-responsive"> --}}
|
||||
<table class="table table-striped table-responsive">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Budget Breakdown</th>
|
||||
<th>Period</th>
|
||||
<th>Income</th>
|
||||
<th>Cost of Goods</th>
|
||||
<th>Expense</th>
|
||||
<th>Projected Net Income</th>
|
||||
<th>Created By</th>
|
||||
<th>Date Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
|
||||
<tbody>
|
||||
@if(!empty($budgets))
|
||||
@foreach($budgets as $budget)
|
||||
@php
|
||||
$period = "N/A";
|
||||
$period_count = $budget->period_count;
|
||||
$period_start = $budget->period_start;
|
||||
$period_range = "N/A";
|
||||
|
||||
$arr3 = json_decode($budget->entries, true);
|
||||
$income =[]; $expense=[]; $cost_of_goods =[];
|
||||
$income_total=0;$expense_total=0;$cost_of_goods_total = 0;
|
||||
foreach ($arr3 as $rkey => $resource){
|
||||
if ($resource['type'] == 'Income') $income[] = $resource;
|
||||
else if ($resource['type'] == 'Cost Of Goods') $cost_of_goods[] = $resource;
|
||||
else $expense[] = $resource;
|
||||
}
|
||||
if(!empty($income)) {
|
||||
for($counter =0; $counter < count($income); $counter++ ) if(!empty($income[$counter]['account_entries'])) $income_total +=array_sum($income[$counter]['account_entries']);
|
||||
}
|
||||
if(!empty($expense)) {
|
||||
for($counter =0; $counter < count($expense); $counter++ ) if(!empty($expense[$counter]['account_entries'])) $expense_total +=array_sum($expense[$counter]['account_entries']);
|
||||
}
|
||||
if(!empty($cost_of_goods)) {
|
||||
for($counter =0; $counter < count($cost_of_goods); $counter++ ) if(!empty($cost_of_goods[$counter]['account_entries'])) $cost_of_goods_total +=array_sum($cost_of_goods[$counter]['account_entries']);
|
||||
}
|
||||
$projection_total = $income_total - $expense_total - $cost_of_goods_total;
|
||||
|
||||
switch ($budget->period) {
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
|
||||
$period_months = getMonthsList();
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[] = $quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
<tr>
|
||||
<td>{{ $budget->name }}</td>
|
||||
<td>{{ $period }}</td>
|
||||
<td>{{ $period_range }}</td>
|
||||
<td>{{ ugandan_shillings($income_total) }}</td>
|
||||
<td>{{ ugandan_shillings($cost_of_goods_total) }}</td>
|
||||
<td>{{ ugandan_shillings($expense_total) }}</td>
|
||||
<td>{{ ugandan_shillings($projection_total) }}</td>
|
||||
{{-- <td>{{ get_full_name($budget->created_by, 'id', 'first_name', 'last_name', 'users') }}</td> --}}
|
||||
<td>{{ $budget->user_by }}</td>
|
||||
<td>{{ streamline_date_time_short($budget->created_at) }}</td>
|
||||
|
||||
<td>
|
||||
@if( Auth::user()->can('budget-view'))
|
||||
<a class="btn btn-sm btn-rounded btn-info"
|
||||
href="{{ route('budgets.show',$budget->id) }}"><i class="fa fa-info-circle"></i> {{
|
||||
__('budgets.view') }}</a>
|
||||
@endif
|
||||
|
||||
@if( Auth::user()->can('budget-edit'))
|
||||
<a class="btn btn-sm btn-warning btn-rounded"
|
||||
href="{{ route('budgets.edit',$budget->id) }}"><i class="fa fa-pencil"></i> {{
|
||||
__('budgets.edit') }}</a>
|
||||
@endif
|
||||
|
||||
@if( Auth::user()->can('budget-delete'))
|
||||
{{ Form::model($budget->id ,['method' => 'DELETE', 'route' => ['budgets.destroy',
|
||||
$budget->id], 'style'=>'display:inline']) }}
|
||||
<button type="submit" class="btn btn-sm btn-rounded btn-danger"
|
||||
onclick="return confirm('<?php echo __('budgets.are_you_sure') ?>')"><i
|
||||
class="fa fa-trash"></i> {{ __('budgets.delete') }}</button>
|
||||
{{ Form::close() }}
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
@endif
|
||||
</tbody>
|
||||
|
||||
<tfoot>
|
||||
<tr>
|
||||
<th>Name</th>
|
||||
<th>Budget Breakdown</th>
|
||||
<th>Period</th>
|
||||
<th>Income</th>
|
||||
<th>Cost of Goods</th>
|
||||
<th>Expense</th>
|
||||
<th>Projected Net Income</th>
|
||||
<th>Created By</th>
|
||||
<th>Date Created</th>
|
||||
<th>Actions</th>
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
{{-- </div> --}}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
{{-- <script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script> --}}
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('.table').DataTable({
|
||||
responsive: true,
|
||||
dom: 'Bfrtip',
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
],
|
||||
pageLength: 5,
|
||||
order: [],
|
||||
});
|
||||
|
||||
function show(id) {
|
||||
if (document.getElementById(id).style.display === 'none') {
|
||||
document.getElementById(id).style.display = '';
|
||||
}
|
||||
}
|
||||
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
|
||||
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
|
||||
|
||||
<script type="text/javascript">
|
||||
$('#datepicker-from, #datepicker-to').datepicker({
|
||||
autoclose: true,
|
||||
todayHighlight: true,
|
||||
format: 'dd-mm-yyyy',
|
||||
});
|
||||
|
||||
$('#dates').change(function() {
|
||||
var val = $(this).val();
|
||||
switch (val) {
|
||||
case 'custom-date':
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
case 'custom-range':
|
||||
$('#end-date-div').show();
|
||||
$('#start-date-div').show();
|
||||
break;
|
||||
default:
|
||||
$('#end-date-div').hide();
|
||||
$('#start-date-div').hide();
|
||||
break;
|
||||
}
|
||||
});
|
||||
|
||||
function clone_budget(data) {
|
||||
var cell = data.getAttribute('data-href').split("_");
|
||||
if (confirm(`Are you sure you want to clone ${cell[1]}?`) == true)
|
||||
window.location.href = cell[2];
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,25 @@
|
||||
<div class="panel panel-default">
|
||||
<div class="panel-body">
|
||||
@if( Auth::user()->can('budget-list'))
|
||||
<a href="{{ route('budgets.index') }}" class="nav-item btn btn-info" style="border-radius: 5px;"><i class="fa fa-eye" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('budgets.view_budgets') }}</span></a>
|
||||
@endif
|
||||
@if( Auth::user()->can('budget-create') )
|
||||
<a href="{{ route('budgets.create') }}" class="nav-item btn btn-success" title='Create new Budget' style="border-radius: 5px;"><i class="fa fa-plus" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('budgets.add_new_budget') }}</span></a>
|
||||
@if(isset($budgets))
|
||||
<div class="dropdown" style="display: inline-block !important;" title='Create from Previous Budgets'>
|
||||
<a href="#" class="btn btn-success dropdown-toggle" id="dropdownMenuButton" style="border-radius: 5px;" data-toggle="dropdown" aria-haspopup="true" aria-expanded="false"><span style="margin-left: 5px">Clone Previous budget</span></a>
|
||||
<div class="dropdown-menu" aria-labelledby="dropdownMenuButton">
|
||||
@php
|
||||
foreach($budgets as $budget){
|
||||
echo '<a class="dropdown-item" onclick="clone_budget(this)" href="#" data-href="'.$budget->id.'_'.$budget->name.'_'.route('budgets.clone',$budget->id).'">'.$budget->name.'</a>';
|
||||
}
|
||||
@endphp
|
||||
</div>
|
||||
</div>
|
||||
@endif
|
||||
@endif
|
||||
@if( Auth::user()->can('budget-delete'))
|
||||
<a href="{{ route('budgets.inactive') }}" class="nav-item btn btn-danger" title='Deleted Budgets' style="border-radius: 5px;"><i class="fa fa-undo" aria-hidden="true"></i> <span style="margin-left: 5px">{{ __('budgets.view_inactive_budgets') }}</span></a>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
@@ -0,0 +1,314 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Streamline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('elite/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<!-- Custom CSS -->
|
||||
<link href="{{ asset('elite/css/style.css') }}" rel="stylesheet">
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 14px;
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
tr {
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Preloader -->
|
||||
<div class="preloader">
|
||||
<div class="cssload-speeding-wheel"></div>
|
||||
</div>
|
||||
<div class="white-box">
|
||||
<div class='col-md-12'>
|
||||
@php
|
||||
$second_col = "Account"; $end_col = "Budget Total";
|
||||
$hospital_info = \Streamline\Models\HospitalInformation::find(1);
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d", strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $months_data);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[] = $quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $other_columns);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// if (is_numeric($year)) $period_range = $year . " to " . ($year + $budget->period_count-1);
|
||||
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if(is_null($hospital_info->pdf_print_header))
|
||||
<img style="max-width: 300px; max-height: 100px;" src="{{ asset($hospital_info->logo) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
<p class="h6 text-center mt-0 font-weight-bold">
|
||||
{{ $hospital_info->name . ' | ' . $hospital_info->phone_number . ' | ' .
|
||||
$hospital_info->email . ' | ' . $hospital_info->address . ' ' .
|
||||
$hospital_info->country }}
|
||||
</p>
|
||||
@else
|
||||
<img style="max-height: 150px;" src="{{ asset($hospital_info->pdf_print_header) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
@endif
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p><h4>{{ __('budgets.budget_name') . ": " . $budget->name }}</h4></p>
|
||||
<p><h4>{{ "Period(" .ucfirst($budget->period) . "): " . $period_range }}</h4></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<table class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr style='display:none;'>
|
||||
<td colspan='<?php echo count($columns); ?>'>
|
||||
Budget Name: {{ ucfirst($budget->name) . " - Period(" .ucfirst($budget->period) . "): " . $period_range }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$totals_budgets = $sub_accounts = $totals_budgets_colums = $income_column_totals = $expense_column_totals = $cost_of_goods_column_totals = [];
|
||||
$sub_account_total= 0;
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
{{-- @foreach ($option['sub_accounts'] as $sub_account)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5>{{ get_name(key($option['sub_accounts']), 'id', 'name','chart_of_accounts') }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($sub_account as $sub_account_entry)
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($sub_account_entry['account_entries']); $j++) $sum +=(int)$sub_account_entry['account_entries'][$j];
|
||||
if ($i==0) echo '<td>' .$sub_account_entry['name']. '</td>' ;
|
||||
else if ($i==$collength - 1) echo "<td style='background-color: #34394D !important; color: #fff !important;'>" . ugandan_shillings($sum) . "</td>" ;
|
||||
else echo "<td>" .ugandan_shillings($sub_account_entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach --}}
|
||||
{{-- Sub Account Section column Totals --}}
|
||||
{{-- <tr style='background-color: rgba(0, 0, 0, 0.075) !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sub_account_total_section = $sub_account_columnTotal_section=0; $keys = array_keys($option['sub_accounts']);
|
||||
if ($i==0) echo '<td>'. get_name(key($option['sub_accounts']), 'id', 'name','chart_of_accounts') . ' Total</td>' ;
|
||||
else if ($i==$collength - 1){ //Sub account totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['sub_accounts']); $m++) {
|
||||
for ($l = 0; $l < count($option['sub_accounts'][$keys[$m]]); $l++) $columnTotal +=(int)($option['sub_accounts'][$keys[$m]][$l]['account_entries'][$k]);
|
||||
}
|
||||
$sub_account_total_section += $columnTotal;
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($sub_account_total_section) . "</td>" ;
|
||||
} else {
|
||||
for ($b=0; $b < count($option['sub_accounts']); $b++) {
|
||||
for ($l = 0; $l < count($option['sub_accounts'][$keys[$b]]); $l++) $sub_account_columnTotal_section +=(int)($option['sub_accounts'][$keys[$b]][$l]['account_entries'][$i - 1]);
|
||||
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($sub_account_columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach --}}
|
||||
{{-- @if (!empty($option['sub_accounts']))
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5>{{ 'Other '. $option['section_header'] }}</h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif --}}
|
||||
@foreach ($option['entries'] as $entry )
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j];
|
||||
$total=ugandan_shillings($sum);
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i==$collength - 1) echo "<td style='background-color: #34394D !important; color: #fff !important;'>" .$total. "</td>" ;
|
||||
else echo "<td>" .ugandan_shillings($entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Other income Section column Totals --}}
|
||||
{{-- @if (!empty($option['sub_accounts']))
|
||||
|
||||
<tr style='background-color: rgba(0, 0, 0, 0.075) !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section=0; $columnTotal_section=0;
|
||||
if ($i==0) echo '<td> Other '.$option['total_header']. '</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget totals for
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) {
|
||||
$columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
}
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
}
|
||||
else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endif --}}
|
||||
{{-- Operating Budget Section Totals --}}
|
||||
<tr style='background-color: #34394D !important; color: #fff !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section=0; $columnTotal_section=0;
|
||||
if ($i==0) echo '<td class="font-weight-bold">'.$option['total_header']. '</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget totals for
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) {
|
||||
$columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
}
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" .ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
//Push to column total arrays
|
||||
if($entry['type'] == 'Income') array_push($income_column_totals, $columnTotal_section);
|
||||
else if($entry['type'] == 'Expense') array_push($expense_column_totals, $columnTotal_section);
|
||||
else array_push($cost_of_goods_column_totals, $columnTotal_section);
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Budget Projections --}}
|
||||
<tr style='background-color: #34394D !important; color: #fff !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
if ($i==0) echo '<td>Projected Net Income</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget Totals
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
echo "<td>" . ugandan_shillings($overall_projection) . "</td>" ;
|
||||
} else {
|
||||
$columnTotal_projection=$income_column_totals[$i-1] - $expense_column_totals[$i-1] - $cost_of_goods_column_totals[$i-1];
|
||||
echo "<td>".ugandan_shillings($columnTotal_projection). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
<!-- /#wrapper -->
|
||||
<!-- jQuery -->
|
||||
<script src="{{ asset('elite/bower_components/jquery/dist/jquery.min.js') }}"></script>
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/tether.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/sidebar-nav/src/metisMenu.js') }}"></script>
|
||||
<!--slimscroll JavaScript -->
|
||||
<script src="{{ asset('elite/js/jquery.slimscroll.js') }}"></script>
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="{{ asset('elite/js/custom.min.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+222
@@ -0,0 +1,222 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Streamline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('elite/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<!-- Custom CSS -->
|
||||
<link href="{{ asset('elite/css/style.css') }}" rel="stylesheet">
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 14px;
|
||||
/* line-height: 1.2; */
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
tr {
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
.total {
|
||||
background-color: #34394D !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Preloader -->
|
||||
<div class="preloader">
|
||||
<div class="cssload-speeding-wheel"></div>
|
||||
</div>
|
||||
<div class="white-box">
|
||||
<div class='col-md-12'>
|
||||
@php
|
||||
$hospital_info = \Streamline\Models\HospitalInformation::find(1);
|
||||
$period_months = getMonthsList();
|
||||
$columns = ['Account', 'Budget Total', 'Actual Total', 'Percentage Variance <br> Actual vs Budget', 'Actual Variance <br> Actual vs Budget'];
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d",
|
||||
strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[]=$quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// $period_range = $range;
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if(is_null($hospital_info->pdf_print_header))
|
||||
<img style="max-width: 300px; max-height: 100px;" src="{{ asset($hospital_info->logo) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
<p class="h6 text-center mt-0 font-weight-bold">
|
||||
{{ $hospital_info->name . ' | ' . $hospital_info->phone_number . ' | ' .
|
||||
$hospital_info->email . ' | ' . $hospital_info->address . ' ' .
|
||||
$hospital_info->country }}
|
||||
</p>
|
||||
@else
|
||||
<img style="max-height: 150px;" src="{{ asset($hospital_info->pdf_print_header) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
@endif
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p><h4>{{ __('budgets.budget_name') . ": " . $budget->name }}</h4></p>
|
||||
<p><h4>Period: {{ ucfirst($budget->period) . " (" . $period_range . ") " }}</h4></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table class="table color-bordered-table success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$actual_totals = $totals_budgets = $summary_colums = $income_column_totals=[];
|
||||
$expense_column_totals=[];$cost_of_goods_column_totals=[];
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($option['entries'] as $entry )
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j]; $col_percent=($entry['actual_entry']>0)? round(((($entry['actual_entry'] - $sum) / $entry['actual_entry']) * 100),2).'%' : 'N/A';
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i == 1) echo "<td>" . ugandan_shillings($sum) . "</td>" ;//Budget Total
|
||||
else if ($i == 2) echo "<td>" . ugandan_shillings($entry['actual_entry']) . "</td>" ; //Actual Total
|
||||
else if ($i == 3) echo "<td>" . $col_percent . "</td>" ; //Percentage variance
|
||||
else if ($i == 4) echo "<td>" . ugandan_shillings($entry['actual_entry'] - $sum) . "</td>" ; //Actual Variance
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Budget Section column Totals --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section = $columnTotal_section = 0;
|
||||
if ($i==0) echo '<td>' .$option['total_header']. '</td>' ;
|
||||
else if ($i==1){ //Budget totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) $columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" . ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else if ($i==2) {
|
||||
array_push($actual_totals, $option['actual']);
|
||||
echo "<td>" . ugandan_shillings($option['actual']) . "</td>" ; //Actual Total
|
||||
} else if ($i==3) {
|
||||
$percent=($option['actual']> 0)? round(((($option['actual'] - $totals_budgets[count($totals_budgets) - 1]) / $option['actual'] ) * 100),2) .'%' : 'N/A';
|
||||
echo "<td>" . $percent . "</td>" ; //Percentage variance
|
||||
}
|
||||
else if ($i == 4) echo "<td>" .ugandan_shillings($option['actual'] - $totals_budgets[count($totals_budgets) - 1]). "</td>" ; //Actual Variance
|
||||
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Overall Budget Performance --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
array_push($summary_colums, $overall_projection);
|
||||
$total_actual = $data['accrual_net_income'] + $data['cash_net_income'];
|
||||
array_push($summary_colums, $total_actual);
|
||||
$overall_percentage = ($summary_colums[1] > 0)? round(((($summary_colums[1] - $summary_colums[0]) / $summary_colums[1]) * 100),2) .'%' : 'N/A';
|
||||
@endphp
|
||||
<td>Performance</td>
|
||||
<td> {{ ugandan_shillings($overall_projection) }} </td> {{-- Budget Projection --}}
|
||||
<td> {{ ugandan_shillings($total_actual) }} </td> {{-- Actual Total --}}
|
||||
<td> {{ $overall_percentage }} </td> {{-- Percentage variance --}}
|
||||
<td> {{ ugandan_shillings($summary_colums[1] - $summary_colums[0]) }} </td> {{-- Actual Variance --}}
|
||||
</tr>
|
||||
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /#wrapper -->
|
||||
<!-- jQuery -->
|
||||
<script src="{{ asset('elite/bower_components/jquery/dist/jquery.min.js') }}"></script>
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/tether.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/sidebar-nav/src/metisMenu.js') }}"></script>
|
||||
<!--slimscroll JavaScript -->
|
||||
<script src="{{ asset('elite/js/jquery.slimscroll.js') }}"></script>
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="{{ asset('elite/js/custom.min.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
+258
@@ -0,0 +1,258 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<!-- CSRF Token -->
|
||||
<meta name="csrf-token" content="{{ csrf_token() }}">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16"
|
||||
href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Streamline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('elite/bootstrap/dist/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
<!-- Custom CSS -->
|
||||
<link href="{{ asset('elite/css/style.css') }}" rel="stylesheet">
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
|
||||
<style type="text/css">
|
||||
body {
|
||||
font-size: 14px;
|
||||
/* line-height: 1.2; */
|
||||
}
|
||||
|
||||
strong {
|
||||
font-weight: bold;
|
||||
}
|
||||
|
||||
.total {
|
||||
background-color: #34394D !important;
|
||||
color: #fff !important;
|
||||
}
|
||||
|
||||
tr {
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<!-- Preloader -->
|
||||
<div class="preloader">
|
||||
<div class="cssload-speeding-wheel"></div>
|
||||
</div>
|
||||
<div class="white-box">
|
||||
<div class='col-md-12'>
|
||||
@php
|
||||
$hospital_info = \Streamline\Models\HospitalInformation::find(1);
|
||||
$period_months = getMonthsList();
|
||||
$column_1 = ['Account'];
|
||||
$colum_2 = ['Budget Total', 'Actual Total', 'Percentage Variance <br> (Actual vs Budget)', 'Actual Variance <br> (Actual vs Budget)'];
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d",
|
||||
strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
$columns = array_merge($column_1, $months_data);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[]=$quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
$columns = array_merge($column_1, $other_columns);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
// $period_range = $range;
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
$counter = count($columns);
|
||||
$columns = array_merge($columns, $colum_2);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
@endphp
|
||||
|
||||
@if(is_null($hospital_info->pdf_print_header))
|
||||
<img style="max-width: 300px; max-height: 100px;" src="{{ asset($hospital_info->logo) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
<p class="h6 text-center mt-0 font-weight-bold">
|
||||
{{ $hospital_info->name . ' | ' . $hospital_info->phone_number . ' | ' .
|
||||
$hospital_info->email . ' | ' . $hospital_info->address . ' ' .
|
||||
$hospital_info->country }}
|
||||
</p>
|
||||
@else
|
||||
<img style="max-height: 150px;" src="{{ asset($hospital_info->pdf_print_header) }}" class="mx-auto d-block mx-3" alt="Responsive image">
|
||||
@endif
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p><h4>{{ __('budgets.budget_name') . ": " . $budget->name }}</h4></p>
|
||||
<p><h4>Period: {{ ucfirst($budget->period) . " (" . $period_range . ") " }}</h4></p>
|
||||
|
||||
</div>
|
||||
</div>
|
||||
<table class="table color-bordered-table table-responsive success-bordered-table">
|
||||
<thead>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$actual_totals = $totals_budgets = $summary_colums = $income_column_totals=[];
|
||||
$expense_column_totals = $cost_of_goods_column_totals=[];
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@foreach ($option['entries'] as $entry)
|
||||
<tr>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j]; $col_percent=($entry['actual_entry']>0)? round(((($entry['actual_entry'] - $sum) / $entry['actual_entry']) * 100),2).'%' : 'N/A';
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i === $counter) echo "<td>" . ugandan_shillings($sum) . "</td>" ;//Budget Total
|
||||
else if ($i == $counter + 1) echo "<td>" . ugandan_shillings($entry['actual_entry']) . "</td>" ; //Actual Total
|
||||
else if ($i == $counter + 2) echo "<td>" . $col_percent . "</td>" ; //Percentage variance
|
||||
else if ($i == $counter + 3) echo "<td>" . ugandan_shillings($entry['actual_entry'] - $sum) . "</td>" ; //Actual Variance
|
||||
else {
|
||||
echo "<td>" .ugandan_shillings($entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Budget Section column Totals --}}
|
||||
<tr class="total">
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section = $columnTotal_section = 0;
|
||||
if ($i==0) echo '<td>' .$option['total_header']. '</td>' ;
|
||||
else if ($i == $counter){ //Budget totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) $columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" . ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else if ($i == $counter + 1) {
|
||||
array_push($actual_totals, $option['actual']);
|
||||
echo "<td>" . ugandan_shillings($option['actual']) . "</td>" ; //Actual Total
|
||||
} else if ($i== $counter+2) {
|
||||
$percent=($option['actual']> 0)? round(((($option['actual'] - $totals_budgets[count($totals_budgets) - 1]) / $option['actual'] ) * 100),2) .'%' : 'N/A';
|
||||
echo "<td>" . $percent . "</td>" ; //Percentage variance
|
||||
}
|
||||
else if ($i == $counter+3) echo "<td>" .ugandan_shillings($option['actual'] - $totals_budgets[count($totals_budgets) - 1]). "</td>" ; //Actual Variance
|
||||
else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
//Push to column total arrays
|
||||
if($entry['type'] == 'Income') array_push($income_column_totals, $columnTotal_section);
|
||||
else if($entry['type'] == 'Expense') array_push($expense_column_totals, $columnTotal_section);
|
||||
else array_push($cost_of_goods_column_totals, $columnTotal_section);
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Overall Budget Performance --}}
|
||||
|
||||
<tr class="total">
|
||||
@php
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
array_push($summary_colums, $overall_projection);
|
||||
$total_actual = $data['accrual_net_income'] + $data['cash_net_income'];
|
||||
array_push($summary_colums, $total_actual);
|
||||
$overall_percentage = ($summary_colums[1] > 0)? round(((($summary_colums[1] - $summary_colums[0]) / $summary_colums[1]) * 100),2) .'%' : 'N/A';
|
||||
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
if ($i==0) echo '<td>Summary</td>' ;
|
||||
else if ($i == $counter){ //Budget Totals
|
||||
echo "<td>" . ugandan_shillings($overall_projection) . "</td>" ;
|
||||
} else if ($i == $counter + 1) {
|
||||
echo "<td>" . ugandan_shillings($total_actual) . "</td>" ;
|
||||
} else if ($i == $counter + 2) {
|
||||
echo "<td>" . $overall_percentage . "</td>" ;
|
||||
} else if ($i == $counter + 3) {
|
||||
echo "<td>" . ugandan_shillings($summary_colums[1] - $summary_colums[0]) . "</td>" ;
|
||||
} else {
|
||||
$columnTotal_projection=$income_column_totals[$i-1] - $expense_column_totals[$i-1] - $cost_of_goods_column_totals[$i-1];
|
||||
echo "<td>".ugandan_shillings($columnTotal_projection). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
|
||||
|
||||
</div>
|
||||
<!-- /#wrapper -->
|
||||
<!-- jQuery -->
|
||||
<script src="{{ asset('elite/bower_components/jquery/dist/jquery.min.js') }}"></script>
|
||||
<!-- Bootstrap Core JavaScript -->
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/tether.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bootstrap/dist/js/bootstrap.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/bower_components/sidebar-nav/src/metisMenu.js') }}"></script>
|
||||
<!--slimscroll JavaScript -->
|
||||
<script src="{{ asset('elite/js/jquery.slimscroll.js') }}"></script>
|
||||
<!-- Custom Theme JavaScript -->
|
||||
<script src="{{ asset('elite/js/custom.min.js') }}"></script>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -0,0 +1,353 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet"
|
||||
type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<style type="text/css">
|
||||
td {
|
||||
min-width: 130px;
|
||||
}
|
||||
|
||||
</style>
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-3 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('finance.budgets') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}"><i class="fa fa-home"></i> Home</a></li>
|
||||
<li><a href="{{ route('finance') }}"><i class="fa fa-money"></i> Finance Home</a></li>
|
||||
<li class="active"><i class="fa fa-file"></i> {{ __('finance.budgets') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('budgets::budgets.menu')
|
||||
@include('flash::message')
|
||||
<div class="row">
|
||||
<div class="col-md-12">
|
||||
<div class="white-box">
|
||||
<div class="row">
|
||||
<div class='col-md-2'>
|
||||
<div id="divCloneBudget" style='margin-top: 20px;'>
|
||||
<a id="add_item" title='Create a new budget from this one'
|
||||
href="{{ route('budgets.clone',$budget->id) }}" class='btn btn-rounded btn-success'><span
|
||||
class="glyphicon glyphicon-copy"></span> Clone Budget</a>
|
||||
</div>
|
||||
</div>
|
||||
<div class='col-md-2'>
|
||||
<div id="editBudget" style='margin-top: 20px;'>
|
||||
<a id="edit_item" title='Edit this Budget' href="{{ route('budgets.edit',$budget->id) }}"
|
||||
class='btn btn-rounded btn-warning'><span class="glyphicon glyphicon-edit"></span> Edit
|
||||
Budget</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="col-md-2">
|
||||
<div style="margin-top: 20px;">
|
||||
<a href="#" onclick="download_table_as_csv('table', '<?php echo ucfirst($budget->name);?>');"
|
||||
title="Download CSV of budget" class="btn btn-success btn-rounded"><span
|
||||
class="glyphicon glyphicon-download"></span> Download CSV</a>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
{{-- <div class="col-md-2">
|
||||
<div style="margin-top: 20px;">
|
||||
<a href="#" onclick="print_div('divToPrint')" title="Print to Pdf"
|
||||
class="btn btn-success btn-rounded"> <span class="glyphicon glyphicon-print"></span> Web
|
||||
Print</a>
|
||||
</div>
|
||||
</div> --}}
|
||||
|
||||
<div class='col-md-2'>
|
||||
<div id="divPrintBudget" style='margin-top: 20px;'>
|
||||
<a title='Print this Budget to pdf' target="_blank"
|
||||
href="{{ route('budgets.print',$budget->id) }}" class='btn btn-rounded btn-success'><span
|
||||
class="glyphicon glyphicon-print"></span> Print Budget</a>
|
||||
</div>
|
||||
</div>
|
||||
@php
|
||||
$period_months = getMonthsList();
|
||||
$second_col = "Account"; $end_col = "Budget Total";
|
||||
switch ($budget->period)
|
||||
{
|
||||
case 'months':
|
||||
$period = "Months";
|
||||
$budget_start_date = strtotime($budget->period_start);//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". $budget->period_count - 1 ." month", $budget_start_date));
|
||||
$period_range = date("M-Y", $budget_start_date) . " to " . date("M-Y", strtotime($budget_end_date));
|
||||
$interval = DateInterval::createFromDateString('1 month');
|
||||
$period = new DatePeriod(new DateTime($budget->period_start), $interval, new DateTime(date("Y-m-d", strtotime("+". $budget->period_count ." month", $budget_start_date))));
|
||||
foreach ($period as $dt) $months_data[] = $dt->format("M-Y");
|
||||
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $months_data);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
|
||||
break;
|
||||
|
||||
case 'quarters':
|
||||
$period = "Quarters";
|
||||
$other_columns =[];$quarter_start_dates =['-01-01', '-04-01', '-07-01', '-10-01']; //m-d
|
||||
$budget_start_date = $budget->period_start;//y-m-d
|
||||
$budget_end_date = date("Y-m-d", strtotime("+". ($budget->period_count-1) * 3 ." month", strtotime('-1 day', strtotime($budget_start_date))));
|
||||
$quarters_data = get_quarters($budget_start_date, $budget_end_date);
|
||||
for($y =0; $y < count($quarters_data); $y++) $other_columns[] = $quarters_data[$y]->period;
|
||||
$period_range = $other_columns[0] . " to " . $other_columns[count($other_columns)-1];
|
||||
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $other_columns);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
case 'years':
|
||||
$period = "Years";
|
||||
$year=date('Y', strtotime($budget->period_start));
|
||||
$sec = substr($year, -2);
|
||||
$years_data = [$year.'/'. ++$sec];
|
||||
for ($i = 1; $i <$budget->period_count; $i++) array_push($years_data, $year + $i .'/'. ++$sec);
|
||||
$period_range = $years_data[0] . " to " . $years_data[count($years_data)-1];
|
||||
$column_1 = [$second_col];
|
||||
$columns = array_merge($column_1, $years_data);
|
||||
array_push($columns, $end_col);
|
||||
$collength = count($columns);
|
||||
break;
|
||||
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
@endphp
|
||||
|
||||
<div class='col-md-4'></div>
|
||||
</div>
|
||||
<div id='divToPrint'>
|
||||
<div class='row'>
|
||||
<div class='col-md-12'>
|
||||
<hr />
|
||||
<div class="row text-center m-t-10">
|
||||
<div class="col-md-12">
|
||||
<p>
|
||||
<h4>{{ __('budgets.budget_name') . ": " . $budget->name }}</h4>
|
||||
</p>
|
||||
<p>
|
||||
<h4>{{ "Period(" .ucfirst($budget->period) . "): " . $period_range }}</h4>
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="row table-responsive">
|
||||
<table class="table color-bordered-table success-bordered-table" id="table">
|
||||
<thead>
|
||||
<tr style='display:none;'>
|
||||
<td colspan='<?php echo count($columns); ?>'>
|
||||
Budget Name: {{ ucfirst($budget->name) .' - Period('. ucfirst($budget->period) .'): '.$period_range }}
|
||||
</td>
|
||||
</tr>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
$totals_budgets = $sub_accounts = $totals_budgets_colums = $income_column_totals = $expense_column_totals = $cost_of_goods_column_totals = [];
|
||||
$sub_account_total= 0;
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach ($options as $option)
|
||||
<tr>
|
||||
<td colspan='<?php echo $collength; ?>'>
|
||||
<h5><strong>{{ $option['section_header'] }}</strong></h5>
|
||||
</td>
|
||||
</tr>
|
||||
{{-- @foreach ($option['sub_accounts'] as $keyid => $sub_account) --}}
|
||||
{{-- <tr>
|
||||
<td class='other' data-section='{{ 'other-rows-'.$keyid }}' onclick='toggler(this);' colspan='<?php echo $collength; ?>'>
|
||||
<h5>{{ get_name($keyid, 'id', 'name','chart_of_accounts') }} <span id={{ 'other-rows-'.$keyid }}>-</span></h5>
|
||||
</td>
|
||||
</tr> --}}
|
||||
{{-- @foreach ($sub_account as $sub_account_entry)
|
||||
<tr class={{ 'other-rows-'.$keyid }}>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($sub_account_entry['account_entries']); $j++) $sum +=(int)$sub_account_entry['account_entries'][$j];
|
||||
if ($i==0) echo '<td>' .$sub_account_entry['name']. '</td>' ;
|
||||
else if ($i==$collength - 1) echo "<td style='background-color: #34394D !important; color: #fff !important;'>" . ugandan_shillings($sum) . "</td>" ;
|
||||
else echo "<td>" .ugandan_shillings($sub_account_entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach --}}
|
||||
{{-- Sub Account Section column Totals --}}
|
||||
{{-- <tr class={{ 'other-rows-'.$keyid }} style='background-color: rgba(0, 0, 0, 0.075) !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sub_account_total_section = $sub_account_columnTotal_section=0; $keys = array_keys($option['sub_accounts']);
|
||||
if ($i==0) echo '<td>'. get_name($keyid, 'id', 'name','chart_of_accounts') . ' Total</td>' ;
|
||||
else if ($i==$collength - 1){ //Sub account totals
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['sub_accounts'][$keyid]); $m++) {
|
||||
$columnTotal +=(int)($option['sub_accounts'][$keyid][$m]['account_entries'][$k]);
|
||||
}
|
||||
$sub_account_total_section += $columnTotal;
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($sub_account_total_section) . "</td>" ;
|
||||
} else {
|
||||
for ($b=0; $b < count($option['sub_accounts'][$keyid]); $b++) {
|
||||
$sub_account_columnTotal_section +=(int)($option['sub_accounts'][$keyid][$b]['account_entries'][$i - 1]);
|
||||
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($sub_account_columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr> --}}
|
||||
{{-- @endforeach
|
||||
@if (!empty($option['sub_accounts']))
|
||||
<tr>
|
||||
<td class='other' data-section='{{ 'other-rows-'.$option['section_header'] }}' onclick='toggler(this);' colspan='<?php echo $collength; ?>'>
|
||||
<h5>{{ 'Other '. $option['section_header'] }} <span id={{ 'other-rows-'.$option['section_header'] }}>-</span></h5>
|
||||
</td>
|
||||
</tr>
|
||||
@endif --}}
|
||||
@foreach ($option['entries'] as $entry )
|
||||
<tr class={{ 'other-rows-'.$option['section_header'] }}>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$sum=0;
|
||||
for ($j=0; $j < count($entry['account_entries']); $j++) $sum +=(int)$entry['account_entries'][$j];
|
||||
$total=ugandan_shillings($sum);
|
||||
|
||||
if ($i==0) echo '<td>' .$entry['name']. '</td>' ;
|
||||
else if ($i==$collength - 1) echo "<td style='background-color: #34394D !important; color: #fff !important;'>" .$total. "</td>" ;
|
||||
else echo "<td>" .ugandan_shillings($entry['account_entries'][$i - 1]). "</td>" ;
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
{{-- Other income Section column Totals --}}
|
||||
{{-- @if (!empty($option['sub_accounts']))
|
||||
|
||||
<tr class={{ 'other-rows-'.$option['section_header'] }} style='background-color: rgba(0, 0, 0, 0.075) !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section=0; $columnTotal_section=0;
|
||||
if ($i==0) echo '<td> Other '.$option['section_header']. ' total</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget totals for
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) {
|
||||
$columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
}
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
echo "<td>" .ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
}
|
||||
else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endif --}}
|
||||
{{-- Operating Budget Section Totals --}}
|
||||
<tr style='background-color: #34394D !important; color: #fff !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
$budget_total_section=0; $columnTotal_section=0;
|
||||
if ($i==0) echo '<td class="font-weight-bold">'.$option['total_header']. '</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget totals for
|
||||
for($k=0; $k < $budget->period_count; $k++){
|
||||
$columnTotal = 0;
|
||||
for ($m = 0; $m < count($option['entries']); $m++) {
|
||||
$columnTotal +=(int)($option['entries'][$m]['account_entries'][$k]);
|
||||
}
|
||||
$budget_total_section +=$columnTotal;
|
||||
}
|
||||
array_push($totals_budgets, $budget_total_section);
|
||||
echo "<td>" .ugandan_shillings($budget_total_section) . "</td>" ;
|
||||
} else {
|
||||
for ($b=0; $b < count($option['entries']); $b++) {
|
||||
$columnTotal_section +=(int)($option['entries'][$b]['account_entries'][$i - 1]);
|
||||
}
|
||||
//Push to column total arrays
|
||||
if($entry['type'] == 'Income') array_push($income_column_totals, $columnTotal_section);
|
||||
else if($entry['type'] == 'Expense') array_push($expense_column_totals, $columnTotal_section);
|
||||
else array_push($cost_of_goods_column_totals, $columnTotal_section);
|
||||
|
||||
echo "<td>" .ugandan_shillings($columnTotal_section). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
</tr>
|
||||
@endforeach
|
||||
|
||||
{{-- Budget Projections --}}
|
||||
<tr style='background-color: #34394D !important; color: #fff !important;'>
|
||||
@php
|
||||
for ($i =0; $i < $collength; $i++) {
|
||||
if ($i==0) echo '<td class="font-weight-bold">Projected Net Income</td>' ;
|
||||
else if ($i==$collength - 1){ //Budget Totals
|
||||
$overall_projection = $totals_budgets[0] - $totals_budgets[1] - $totals_budgets[2];
|
||||
echo "<td>" . ugandan_shillings($overall_projection) . "</td>" ;
|
||||
} else {
|
||||
$columnTotal_projection=$income_column_totals[$i-1] - $expense_column_totals[$i-1] - $cost_of_goods_column_totals[$i-1];
|
||||
echo "<td>".ugandan_shillings($columnTotal_projection). "</td>" ;
|
||||
}
|
||||
}
|
||||
@endphp
|
||||
|
||||
</tr>
|
||||
|
||||
|
||||
<tbody>
|
||||
<tfoot>
|
||||
<tr>
|
||||
@php
|
||||
for ($i = 0; $i < count($columns); $i++) echo '<th>' .$columns[$i].'</th>';
|
||||
@endphp
|
||||
</tr>
|
||||
</tfoot>
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
<script src="{{ asset('js/streamline_functions.js') }}"></script>
|
||||
<script type="text/javascript">
|
||||
function toggler(data){
|
||||
let section = data.getAttribute('data-section'); console.log(section);
|
||||
$('#'+section).text(function(_, value){return value=='-'?'+':'-'});
|
||||
$('.' + section).toggle(1000);
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:api')->get('/budgets', function () {
|
||||
return "Budgets";
|
||||
});
|
||||
@@ -0,0 +1,16 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['middleware' => ['auth', 'disablebackbutton', 'user-locale','subscription-tracking', 'password-expiry']], function () {
|
||||
/* budgets */
|
||||
Route::any('budgets_search', 'BudgetController@search')->name('budgets.search');
|
||||
Route::any('budget/performance/{type}', 'BudgetController@budget_performance')->name('budgets.performance');
|
||||
Route::get('budgets_inactive', 'BudgetController@inactive')->name('budgets.inactive');
|
||||
Route::get('budgets/clone/{id}', 'BudgetController@clone')->name('budgets.clone');
|
||||
Route::get('budgets/print/{id}', 'BudgetController@print_budget')->name('budgets.print');
|
||||
Route::post('budgets_activate/{id}', 'BudgetController@activate')->name('budgets.activate');
|
||||
Route::any('/budgets/get_budgets', 'BudgetController@get_budgets')->name('budgets.get_outcomes');
|
||||
Route::post('budgets/print_budget_report', 'BudgetController@print_budget_report')->name('budgets.print_reports');
|
||||
Route::resource('budgets', 'BudgetController');
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
image: alpine/git:latest
|
||||
|
||||
pipelines:
|
||||
branches:
|
||||
main:
|
||||
- step:
|
||||
name: Merge To Beta
|
||||
script:
|
||||
- git remote set-url origin https://Kabricks:${APP_SECRET}@bitbucket.org/dcsammi/${BITBUCKET_REPO_SLUG}
|
||||
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
- git fetch
|
||||
- git checkout beta
|
||||
- git merge main
|
||||
- git commit --amend -m "[skip ci] Merge changes from main"
|
||||
- git push
|
||||
- step:
|
||||
name: Deploy To Test
|
||||
script:
|
||||
- echo "Ready to deploy to demo or production!"
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Budgets",
|
||||
"alias": "budgets",
|
||||
"description": "Budgets",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Budgets\\Providers\\BudgetsServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Cancer'
|
||||
];
|
||||
@@ -0,0 +1,735 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Cancer\Http\Controllers;
|
||||
|
||||
use Barryvdh\Snappy\Facades\SnappyPdf;
|
||||
use Illuminate\Contracts\Foundation\Application;
|
||||
use Illuminate\Contracts\Support\Renderable;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Routing\Controller;
|
||||
use Illuminate\Routing\Redirector;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Modules\ClinicalData\Services\Drugs\DrugRoutesService;
|
||||
use Modules\ClinicalData\Services\Drugs\DrugsService;
|
||||
use Modules\ClinicalData\Services\Drugs\DrugUnitsService;
|
||||
use Streamline\Models\CancerProtocol;
|
||||
use Streamline\Models\HospitalInformation;
|
||||
use Streamline\Models\OrderedCancerProtocols;
|
||||
use Streamline\Models\Patient;
|
||||
|
||||
class CancerProtocolController extends Controller
|
||||
{
|
||||
public function __construct(
|
||||
protected DrugsService $drugsService,
|
||||
protected DrugRoutesService $drugRoutesService,
|
||||
protected DrugUnitsService $drugUnitsService
|
||||
) {}
|
||||
|
||||
public static array $factors = [0 => 'Standard', 1 => 'BSA', 2 => 'Weight'];
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function index() {
|
||||
$cancer_protocols = CancerProtocol::all();
|
||||
|
||||
$drugs = $this->drugsService->pluckAvailableDrugs('name');
|
||||
$drug_with_units = $this->drugsService->pluckAvailableDrugs('unit_id');
|
||||
$drug_units = $this->drugUnitsService->pluckAvailableDrugUnits('name');
|
||||
$drug_routes = $this->drugRoutesService->pluckAvailableDrugRoutes('name');
|
||||
|
||||
$factors = static::$factors;
|
||||
|
||||
return view('cancer::cancer_protocol.index', compact('cancer_protocols', 'drugs', 'drug_routes',
|
||||
'factors', 'drug_units', 'drug_with_units'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
* @return Renderable
|
||||
*/
|
||||
public function create() {
|
||||
$drugs = $this->drugsService->pluckAvailableDrugs('name')->prepend('-- select drugs --', '');
|
||||
$drug_routes = $this->drugRoutesService->pluckAvailableDrugRoutes('name')->prepend('-- select routes --', '');
|
||||
|
||||
$factors = static::$factors;
|
||||
|
||||
$option_drugs = "";
|
||||
foreach ($drugs as $key => $value){
|
||||
$drug_name = str_replace("'", '', $value);
|
||||
$drug_name = str_replace("\"", '', $drug_name);
|
||||
$drug_name = str_replace("+", '', $drug_name);
|
||||
$option_drugs .= "<option value='$key'>$drug_name</option>";
|
||||
}
|
||||
|
||||
$option_drug_routes = "";
|
||||
foreach ($drug_routes as $key => $value){
|
||||
$option_drug_routes .= "<option value='$key'>$value</option>";
|
||||
}
|
||||
|
||||
$option_factors = "<option value=''>-select-</option>";
|
||||
foreach ($factors as $key => $value){
|
||||
$option_factors .= "<option value='$key'>$value</option>";
|
||||
}
|
||||
|
||||
return view('cancer::cancer_protocol.create', compact('drugs', 'factors', 'drug_routes',
|
||||
'option_drugs', 'option_drug_routes', 'option_factors'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
* @param Request $request
|
||||
* @return Application|\Illuminate\Foundation\Application|RedirectResponse|Redirector
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
$request->validate([
|
||||
"name" => "required",
|
||||
"protocol_billing_type" => "required"
|
||||
]);
|
||||
|
||||
$protocol_billing_type = $request->protocol_billing_type;
|
||||
$protocol_cost = $request->protocol_cost;
|
||||
|
||||
if ($protocol_billing_type == 0 && !is_numeric($protocol_cost)) {
|
||||
flash("Please add a protocol cost when billing type is umbrella")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
|
||||
/* Pre Chemo Section */
|
||||
$pre_chemo_row_counter_arr = $request->pre_chemo_row_counter;
|
||||
$pre_chemo_drug_id_arr = $request->pre_chemo_drug_id;
|
||||
$pre_chemo_drug_route_arr = $request->pre_chemo_drug_route;
|
||||
$pre_chemo_drug_factor_id_arr = $request->pre_chemo_drug_factor_id;
|
||||
$pre_chemo_drug_weight_range_arr = $request->pre_chemo_drug_weight_range;
|
||||
$pre_chemo_drug_dose_arr = $request->pre_chemo_drug_dose;
|
||||
$pre_chemo_drug_duration_arr = $request->pre_chemo_drug_duration;
|
||||
$pre_chemo_drug_instructions_arr = $request->pre_chemo_drug_instructions;
|
||||
$pre_chemo_child_row_id_arr = $request->pre_chemo_child_row_id;
|
||||
$pre_chemo_child_drug_weight_range_arr = $request->pre_chemo_child_drug_weight_range;
|
||||
$pre_chemo_child_drug_dose_arr = $request->pre_chemo_child_drug_dose;
|
||||
$pre_chemo_child_drug_duration_arr = $request->pre_chemo_child_drug_duration;
|
||||
$pre_chemo_child_drug_instructions_arr = $request->pre_chemo_child_drug_instructions;
|
||||
|
||||
$pre_chemo_drugs = [];
|
||||
|
||||
for ($x = 0; $x < count($pre_chemo_drug_id_arr); $x++) {
|
||||
$pre_chemo_drugs[$pre_chemo_row_counter_arr[$x]] = [
|
||||
"drug_id" => $pre_chemo_drug_id_arr[$x],
|
||||
"drug_route" => $pre_chemo_drug_route_arr[$x],
|
||||
"drug_factor" => $pre_chemo_drug_factor_id_arr[$x],
|
||||
"dose" => [[
|
||||
"weight_range" => $pre_chemo_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $pre_chemo_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $pre_chemo_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $pre_chemo_drug_instructions_arr[$x] ?? '',
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
if (is_array($pre_chemo_child_row_id_arr)) {
|
||||
for ($x = 0; $x < count($pre_chemo_child_row_id_arr); $x++) {
|
||||
if(isset($pre_chemo_drugs[$pre_chemo_child_row_id_arr[$x]])) {
|
||||
$pre_chemo_drugs[$pre_chemo_child_row_id_arr[$x]]["dose"][] = [
|
||||
"weight_range" => $pre_chemo_child_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $pre_chemo_child_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $pre_chemo_child_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $pre_chemo_child_drug_instructions_arr[$x] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Chemo Section */
|
||||
$chemo_row_counter_arr = $request->chemo_row_counter;
|
||||
$chemo_drug_id_arr = $request->chemo_drug_id;
|
||||
$chemo_drug_route_arr = $request->chemo_drug_route;
|
||||
$chemo_drug_factor_id_arr = $request->chemo_drug_factor_id;
|
||||
$chemo_drug_weight_range_arr = $request->chemo_drug_weight_range;
|
||||
$chemo_drug_dose_arr = $request->chemo_drug_dose;
|
||||
$chemo_drug_duration_arr = $request->chemo_drug_duration;
|
||||
$chemo_drug_instructions_arr = $request->chemo_drug_instructions;
|
||||
$chemo_child_row_id_arr = $request->chemo_child_row_id;
|
||||
$chemo_child_drug_weight_range_arr = $request->chemo_child_drug_weight_range;
|
||||
$chemo_child_drug_dose_arr = $request->chemo_child_drug_dose;
|
||||
$chemo_child_drug_duration_arr = $request->chemo_child_drug_duration;
|
||||
$chemo_child_drug_instructions_arr = $request->chemo_child_drug_instructions;
|
||||
|
||||
$chemo_drugs = [];
|
||||
|
||||
for ($x = 0; $x < count($chemo_drug_id_arr); $x++) {
|
||||
$chemo_drugs[$chemo_row_counter_arr[$x]] = [
|
||||
"drug_id" => $chemo_drug_id_arr[$x],
|
||||
"drug_route" => $chemo_drug_route_arr[$x],
|
||||
"drug_factor" => $chemo_drug_factor_id_arr[$x],
|
||||
"dose" => [[
|
||||
"weight_range" => $chemo_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $chemo_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $chemo_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $chemo_drug_instructions_arr[$x] ?? '',
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
if (is_array($chemo_child_row_id_arr)) {
|
||||
for ($x = 0; $x < count($chemo_child_row_id_arr); $x++) {
|
||||
if(isset($chemo_drugs[$chemo_child_row_id_arr[$x]])) {
|
||||
$chemo_drugs[$chemo_child_row_id_arr[$x]]["dose"][] = [
|
||||
"weight_range" => $chemo_child_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $chemo_child_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $chemo_child_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $chemo_child_drug_instructions_arr[$x] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Post Chemo Section */
|
||||
$post_chemo_row_counter_arr = $request->post_chemo_row_counter;
|
||||
$post_chemo_drug_id_arr = $request->post_chemo_drug_id;
|
||||
$post_chemo_drug_route_arr = $request->post_chemo_drug_route;
|
||||
$post_chemo_drug_factor_id_arr = $request->post_chemo_drug_factor_id;
|
||||
$post_chemo_drug_weight_range_arr = $request->post_chemo_drug_weight_range;
|
||||
$post_chemo_drug_dose_arr = $request->post_chemo_drug_dose;
|
||||
$post_chemo_drug_duration_arr = $request->post_chemo_drug_duration;
|
||||
$post_chemo_drug_instructions_arr = $request->post_chemo_drug_instructions;
|
||||
$post_chemo_child_row_id_arr = $request->post_chemo_child_row_id;
|
||||
$post_chemo_child_drug_weight_range_arr = $request->post_chemo_child_drug_weight_range;
|
||||
$post_chemo_child_drug_dose_arr = $request->post_chemo_child_drug_dose;
|
||||
$post_chemo_child_drug_duration_arr = $request->post_chemo_child_drug_duration;
|
||||
$post_chemo_child_drug_instructions_arr = $request->post_chemo_child_drug_instructions;
|
||||
|
||||
$post_chemo_drugs = [];
|
||||
|
||||
for ($x = 0; $x < count($post_chemo_drug_id_arr); $x++) {
|
||||
$post_chemo_drugs[$post_chemo_row_counter_arr[$x]] = [
|
||||
"drug_id" => $post_chemo_drug_id_arr[$x],
|
||||
"drug_route" => $post_chemo_drug_route_arr[$x],
|
||||
"drug_factor" => $post_chemo_drug_factor_id_arr[$x],
|
||||
"dose" => [[
|
||||
"weight_range" => $post_chemo_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $post_chemo_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $post_chemo_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $post_chemo_drug_instructions_arr[$x] ?? '',
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
if (is_array($post_chemo_child_row_id_arr)) {
|
||||
for ($x = 0; $x < count($post_chemo_child_row_id_arr); $x++) {
|
||||
if(isset($post_chemo_drugs[$post_chemo_child_row_id_arr[$x]])) {
|
||||
$post_chemo_drugs[$post_chemo_child_row_id_arr[$x]]["dose"][] = [
|
||||
"weight_range" => $post_chemo_child_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $post_chemo_child_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $post_chemo_child_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $post_chemo_child_drug_instructions_arr[$x] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cancer_protocol = new CancerProtocol();
|
||||
$cancer_protocol->name = $request->name;
|
||||
$cancer_protocol->protocol_billing_type = $protocol_billing_type;
|
||||
$cancer_protocol->protocol_cost = $protocol_cost;
|
||||
$cancer_protocol->pre_chemo_comments = $request->pre_chemo_comments;
|
||||
$cancer_protocol->pre_chemo_drugs = json_encode(array_values($pre_chemo_drugs));
|
||||
$cancer_protocol->chemo_comments = $request->chemo_comments;
|
||||
$cancer_protocol->chemo_drugs = json_encode(array_values($chemo_drugs));
|
||||
$cancer_protocol->post_chemo_comments = $request->post_chemo_comments;
|
||||
$cancer_protocol->post_chemo_drugs = json_encode(array_values($post_chemo_drugs));
|
||||
$cancer_protocol->created_by = Auth::id();
|
||||
|
||||
try {
|
||||
$cancer_protocol->save();
|
||||
return redirect('/cancer_protocol/');
|
||||
} catch (QueryException $exception) {
|
||||
flash("An error occurred. Please try again later")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
return view('cancer::show');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function edit($id) {
|
||||
$drugs = DB::table('drugs')->whereNull('deleted_at')
|
||||
->where('available', 1)
|
||||
->pluck('name', 'id')->prepend('-- select drugs --', '');
|
||||
|
||||
$drug_routes = DB::table('drug_routes')->whereNull('deleted_at')
|
||||
->where('available', 1)
|
||||
->pluck('name', 'id')->prepend('-- select routes --', '');
|
||||
|
||||
$factors = static::$factors;
|
||||
|
||||
$option_drugs = "";
|
||||
foreach ($drugs as $key => $value){
|
||||
$drug_name = str_replace("'", '', $value);
|
||||
$drug_name = str_replace("\"", '', $drug_name);
|
||||
$drug_name = str_replace("+", '', $drug_name);
|
||||
$option_drugs .= "<option value='$key'>$drug_name</option>";
|
||||
}
|
||||
|
||||
$option_drug_routes = "";
|
||||
foreach ($drug_routes as $key => $value){
|
||||
$option_drug_routes .= "<option value='$key'>$value</option>";
|
||||
}
|
||||
|
||||
$option_factors = "<option value=''>-select-</option>";
|
||||
foreach ($factors as $key => $value){
|
||||
$option_factors .= "<option value='$key'>$value</option>";
|
||||
}
|
||||
|
||||
$cancer_protocol = CancerProtocol::find($id);
|
||||
|
||||
return view('cancer::cancer_protocol.edit', compact('drugs', 'factors', 'drug_routes',
|
||||
'option_drugs', 'option_drug_routes', 'option_factors', 'cancer_protocol'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return Renderable
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
$request->validate([
|
||||
"name" => "required",
|
||||
"protocol_billing_type" => "required"
|
||||
]);
|
||||
|
||||
$protocol_billing_type = $request->protocol_billing_type;
|
||||
$protocol_cost = $request->protocol_cost;
|
||||
|
||||
if ($protocol_billing_type == 0 && !is_numeric($protocol_cost)) {
|
||||
flash("Please add a protocol cost when billing type is umbrella")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
|
||||
/* Pre Chemo Section */
|
||||
$pre_chemo_row_counter_arr = $request->pre_chemo_row_counter;
|
||||
$pre_chemo_drug_id_arr = $request->pre_chemo_drug_id;
|
||||
$pre_chemo_drug_route_arr = $request->pre_chemo_drug_route;
|
||||
$pre_chemo_drug_factor_id_arr = $request->pre_chemo_drug_factor_id;
|
||||
$pre_chemo_drug_weight_range_arr = $request->pre_chemo_drug_weight_range;
|
||||
$pre_chemo_drug_dose_arr = $request->pre_chemo_drug_dose;
|
||||
$pre_chemo_drug_duration_arr = $request->pre_chemo_drug_duration;
|
||||
$pre_chemo_drug_instructions_arr = $request->pre_chemo_drug_instructions;
|
||||
$pre_chemo_child_row_id_arr = $request->pre_chemo_child_row_id;
|
||||
$pre_chemo_child_drug_weight_range_arr = $request->pre_chemo_child_drug_weight_range;
|
||||
$pre_chemo_child_drug_dose_arr = $request->pre_chemo_child_drug_dose;
|
||||
$pre_chemo_child_drug_duration_arr = $request->pre_chemo_child_drug_duration;
|
||||
$pre_chemo_child_drug_instructions_arr = $request->pre_chemo_child_drug_instructions;
|
||||
|
||||
$pre_chemo_drugs = [];
|
||||
|
||||
for ($x = 0; $x < count($pre_chemo_drug_id_arr); $x++) {
|
||||
$pre_chemo_drugs[$pre_chemo_row_counter_arr[$x]] = [
|
||||
"drug_id" => $pre_chemo_drug_id_arr[$x],
|
||||
"drug_route" => $pre_chemo_drug_route_arr[$x],
|
||||
"drug_factor" => $pre_chemo_drug_factor_id_arr[$x],
|
||||
"dose" => [[
|
||||
"weight_range" => $pre_chemo_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $pre_chemo_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $pre_chemo_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $pre_chemo_drug_instructions_arr[$x] ?? '',
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
if (is_array($pre_chemo_child_row_id_arr)) {
|
||||
for ($x = 0; $x < count($pre_chemo_child_row_id_arr); $x++) {
|
||||
if(isset($pre_chemo_drugs[$pre_chemo_child_row_id_arr[$x]])) {
|
||||
$pre_chemo_drugs[$pre_chemo_child_row_id_arr[$x]]["dose"][] = [
|
||||
"weight_range" => $pre_chemo_child_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $pre_chemo_child_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $pre_chemo_child_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $pre_chemo_child_drug_instructions_arr[$x] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Chemo Section */
|
||||
$chemo_row_counter_arr = $request->chemo_row_counter;
|
||||
$chemo_drug_id_arr = $request->chemo_drug_id;
|
||||
$chemo_drug_route_arr = $request->chemo_drug_route;
|
||||
$chemo_drug_factor_id_arr = $request->chemo_drug_factor_id;
|
||||
$chemo_drug_weight_range_arr = $request->chemo_drug_weight_range;
|
||||
$chemo_drug_dose_arr = $request->chemo_drug_dose;
|
||||
$chemo_drug_duration_arr = $request->chemo_drug_duration;
|
||||
$chemo_drug_instructions_arr = $request->chemo_drug_instructions;
|
||||
$chemo_child_row_id_arr = $request->chemo_child_row_id;
|
||||
$chemo_child_drug_weight_range_arr = $request->chemo_child_drug_weight_range;
|
||||
$chemo_child_drug_dose_arr = $request->chemo_child_drug_dose;
|
||||
$chemo_child_drug_duration_arr = $request->chemo_child_drug_duration;
|
||||
$chemo_child_drug_instructions_arr = $request->chemo_child_drug_instructions;
|
||||
|
||||
$chemo_drugs = [];
|
||||
|
||||
for ($x = 0; $x < count($chemo_drug_id_arr); $x++) {
|
||||
$chemo_drugs[$chemo_row_counter_arr[$x]] = [
|
||||
"drug_id" => $chemo_drug_id_arr[$x],
|
||||
"drug_route" => $chemo_drug_route_arr[$x],
|
||||
"drug_factor" => $chemo_drug_factor_id_arr[$x],
|
||||
"dose" => [[
|
||||
"weight_range" => $chemo_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $chemo_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $chemo_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $chemo_drug_instructions_arr[$x] ?? '',
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
if (is_array($chemo_child_row_id_arr)) {
|
||||
for ($x = 0; $x < count($chemo_child_row_id_arr); $x++) {
|
||||
if(isset($chemo_drugs[$chemo_child_row_id_arr[$x]])) {
|
||||
$chemo_drugs[$chemo_child_row_id_arr[$x]]["dose"][] = [
|
||||
"weight_range" => $chemo_child_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $chemo_child_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $chemo_child_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $chemo_child_drug_instructions_arr[$x] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/* Post Chemo Section */
|
||||
$post_chemo_row_counter_arr = $request->post_chemo_row_counter;
|
||||
$post_chemo_drug_id_arr = $request->post_chemo_drug_id;
|
||||
$post_chemo_drug_route_arr = $request->post_chemo_drug_route;
|
||||
$post_chemo_drug_factor_id_arr = $request->post_chemo_drug_factor_id;
|
||||
$post_chemo_drug_weight_range_arr = $request->post_chemo_drug_weight_range;
|
||||
$post_chemo_drug_dose_arr = $request->post_chemo_drug_dose;
|
||||
$post_chemo_drug_duration_arr = $request->post_chemo_drug_duration;
|
||||
$post_chemo_drug_instructions_arr = $request->post_chemo_drug_instructions;
|
||||
$post_chemo_child_row_id_arr = $request->post_chemo_child_row_id;
|
||||
$post_chemo_child_drug_weight_range_arr = $request->post_chemo_child_drug_weight_range;
|
||||
$post_chemo_child_drug_dose_arr = $request->post_chemo_child_drug_dose;
|
||||
$post_chemo_child_drug_duration_arr = $request->post_chemo_child_drug_duration;
|
||||
$post_chemo_child_drug_instructions_arr = $request->post_chemo_child_drug_instructions;
|
||||
|
||||
$post_chemo_drugs = [];
|
||||
|
||||
for ($x = 0; $x < count($post_chemo_drug_id_arr); $x++) {
|
||||
$post_chemo_drugs[$post_chemo_row_counter_arr[$x]] = [
|
||||
"drug_id" => $post_chemo_drug_id_arr[$x],
|
||||
"drug_route" => $post_chemo_drug_route_arr[$x],
|
||||
"drug_factor" => $post_chemo_drug_factor_id_arr[$x],
|
||||
"dose" => [[
|
||||
"weight_range" => $post_chemo_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $post_chemo_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $post_chemo_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $post_chemo_drug_instructions_arr[$x] ?? '',
|
||||
]],
|
||||
];
|
||||
}
|
||||
|
||||
if (is_array($post_chemo_child_row_id_arr)) {
|
||||
for ($x = 0; $x < count($post_chemo_child_row_id_arr); $x++) {
|
||||
if(isset($post_chemo_drugs[$post_chemo_child_row_id_arr[$x]])) {
|
||||
$post_chemo_drugs[$post_chemo_child_row_id_arr[$x]]["dose"][] = [
|
||||
"weight_range" => $post_chemo_child_drug_weight_range_arr[$x] ?? '',
|
||||
"dose" => $post_chemo_child_drug_dose_arr[$x] ?? '',
|
||||
"duration" => $post_chemo_child_drug_duration_arr[$x] ?? '',
|
||||
"instructions" => $post_chemo_child_drug_instructions_arr[$x] ?? '',
|
||||
];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
$cancer_protocol = CancerProtocol::find($id);
|
||||
$cancer_protocol->name = $request->name;
|
||||
$cancer_protocol->protocol_billing_type = $protocol_billing_type;
|
||||
$cancer_protocol->protocol_cost = $protocol_cost;
|
||||
$cancer_protocol->pre_chemo_comments = $request->pre_chemo_comments;
|
||||
$cancer_protocol->pre_chemo_drugs = json_encode(array_values($pre_chemo_drugs));
|
||||
$cancer_protocol->chemo_comments = $request->chemo_comments;
|
||||
$cancer_protocol->chemo_drugs = json_encode(array_values($chemo_drugs));
|
||||
$cancer_protocol->post_chemo_comments = $request->post_chemo_comments;
|
||||
$cancer_protocol->post_chemo_drugs = json_encode(array_values($post_chemo_drugs));
|
||||
$cancer_protocol->updated_by = Auth::id();
|
||||
|
||||
try {
|
||||
$cancer_protocol->save();
|
||||
return redirect('/cancer_protocol/');
|
||||
} catch (QueryException $exception) {
|
||||
flash("An error occurred. Please try again later")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
* @param int $id
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$protocol = CancerProtocol::find($id);
|
||||
|
||||
if ($protocol->delete()){
|
||||
flash("Protocol has been deleted.")->success();
|
||||
return redirect('/cancer_protocol/');
|
||||
} else {
|
||||
flash("An error occurred. Please try again later")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function inactive() {
|
||||
$cancer_protocols = CancerProtocol::onlyTrashed()->get();
|
||||
|
||||
return view('cancer::cancer_protocol.inactive', compact('cancer_protocols'));
|
||||
}
|
||||
|
||||
public function activate($id) {
|
||||
$protocol = CancerProtocol::withTrashed()->find($id);
|
||||
|
||||
if ($protocol->restore()){
|
||||
flash("Protocol has been activated")->success();
|
||||
return redirect('/cancer_protocol/');
|
||||
} else {
|
||||
flash("An error occurred. Please try again later")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function print_all_protocols() {
|
||||
$cancer_protocols = CancerProtocol::all();
|
||||
$hospital_information = HospitalInformation::find(1);
|
||||
|
||||
$drugs = $this->drugsService->pluckAvailableDrugs('name');
|
||||
$drug_with_units = $this->drugsService->pluckAvailableDrugs('unit_id');
|
||||
$drug_units = $this->drugUnitsService->pluckAvailableDrugUnits('name');
|
||||
$drug_routes = $this->drugRoutesService->pluckAvailableDrugRoutes('name');
|
||||
|
||||
$factors = static::$factors;
|
||||
|
||||
$data = [
|
||||
'drugs' => $drugs,
|
||||
'hospitalInfo' => $hospital_information,
|
||||
'cancer_protocols' => $cancer_protocols,
|
||||
'drug_with_units' => $drug_with_units,
|
||||
'drug_units' => $drug_units,
|
||||
'drug_routes' => $drug_routes,
|
||||
'factors' => $factors
|
||||
];
|
||||
|
||||
$print_footer = (!is_null($hospital_information->print_footer)) ? '     <i>' . $hospital_information->print_footer . '</i>' : '';
|
||||
|
||||
$pdf = SnappyPDF::loadView("cancer::cancer_protocol/print_all_protocols", $data)
|
||||
->setOrientation('portrait')
|
||||
->setPaper('a4')
|
||||
->setOption('margin-bottom', 5)
|
||||
->setOption('margin-top', 5)
|
||||
->setOption('footer-html', '<i>© ' . date('Y') . ' Stre@mline</i>' . $print_footer);
|
||||
|
||||
|
||||
return $pdf->inline('Cancer Protocols' . date(" d-m-y h:ia") . '.pdf');
|
||||
}
|
||||
|
||||
public function order_protocol(Request $request) {
|
||||
$patient_id = session()->get('patient_id');
|
||||
$episode_id = session()->get('episode_id');
|
||||
$inpatient_info_id = session()->get('inpatient_info_id');
|
||||
$selected_protocols = [];
|
||||
|
||||
if (isset($request->cancer_protocols) && is_array($request->cancer_protocols)) {
|
||||
$selected_protocols = CancerProtocol::whereIn('id', $request->cancer_protocols)->get();
|
||||
}
|
||||
|
||||
$patient = Patient::find($patient_id);
|
||||
|
||||
$cancer_protocols = CancerProtocol::pluck('name', 'id');
|
||||
|
||||
$drugs = $this->drugsService->pluckAvailableDrugs('name');
|
||||
$drug_with_units = $this->drugsService->pluckAvailableDrugs('unit_id');
|
||||
$drug_units = $this->drugUnitsService->pluckAvailableDrugUnits('name');
|
||||
$drug_routes = $this->drugRoutesService->pluckAvailableDrugRoutes('name');
|
||||
|
||||
$factors = static::$factors;
|
||||
|
||||
return view('cancer::cancer_protocol.order_protocol', compact('patient_id', 'episode_id', 'inpatient_info_id',
|
||||
'cancer_protocols', 'patient', 'selected_protocols', 'drugs', 'drug_routes', 'drug_units', 'drug_with_units', 'factors'));
|
||||
}
|
||||
|
||||
public function save_protocol_order(Request $request) {
|
||||
$protocol_ids = $request->protocol_id;
|
||||
$inpatient_id = $request->inpatient_info_id;
|
||||
$patient_id = $request->patient_id;
|
||||
$episode_id = $request->episode_id;
|
||||
$adjusted_dose = $request->adjusted_dose;
|
||||
$adjusted_dose_reason = $request->adjusted_dose_reason;
|
||||
$count = 0;
|
||||
|
||||
foreach ($protocol_ids as $protocol_id) {
|
||||
$pre_chemo_drugs_to_save = [];
|
||||
$chemo_drugs_to_save = [];
|
||||
$post_chemo_drugs_to_save = [];
|
||||
$cancer_protocol = CancerProtocol::find($protocol_id);
|
||||
|
||||
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
|
||||
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
|
||||
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
|
||||
|
||||
for($x = 0; $x < count($pre_chemo_drugs); $x++) {
|
||||
$drug_doses = [];
|
||||
|
||||
for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++){
|
||||
$duration_array = explode(",", $pre_chemo_drugs[$x]['dose'][$i]['duration']);
|
||||
$duration_array_to_store = [];
|
||||
|
||||
foreach ($duration_array as $duration) {
|
||||
$duration_array_to_store[] = [
|
||||
"name" => $duration,
|
||||
"given_by" => NULL,
|
||||
"given_on" => NULL,
|
||||
"quantity_given" => 0,
|
||||
];
|
||||
}
|
||||
|
||||
$drug_doses[] = [
|
||||
"dose" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose[$count] : $pre_chemo_drugs[$x]['dose'][$i]['dose'],
|
||||
"weight_range" => $pre_chemo_drugs[$x]['dose'][$i]['weight_range'],
|
||||
"duration" => $duration_array_to_store,
|
||||
"instructions" => $pre_chemo_drugs[$x]['dose'][$i]['instructions'],
|
||||
"adjusted_dose_reason" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose_reason[$count] : NULL
|
||||
];
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
$pre_chemo_drugs_to_save[] = [
|
||||
"protocol_id" => $protocol_id,
|
||||
"drug_id" => $pre_chemo_drugs[$x]['drug_id'],
|
||||
"drug_route" => $pre_chemo_drugs[$x]['drug_route'],
|
||||
"drug_factor" => $pre_chemo_drugs[$x]['drug_factor'],
|
||||
"dose" => $drug_doses
|
||||
];
|
||||
}
|
||||
|
||||
for($x = 0; $x < count($chemo_drugs); $x++) {
|
||||
$drug_doses = [];
|
||||
|
||||
for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++){
|
||||
$duration_array = explode(",", $chemo_drugs[$x]['dose'][$i]['duration']);
|
||||
$duration_array_to_store = [];
|
||||
|
||||
foreach ($duration_array as $duration) {
|
||||
$duration_array_to_store[] = [
|
||||
"name" => $duration,
|
||||
"given_by" => NULL,
|
||||
"given_on" => NULL,
|
||||
"quantity_given" => 0,
|
||||
];
|
||||
}
|
||||
|
||||
$drug_doses[] = [
|
||||
"dose" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose[$count] : $chemo_drugs[$x]['dose'][$i]['dose'],
|
||||
"weight_range" => $chemo_drugs[$x]['dose'][$i]['weight_range'],
|
||||
"duration" => $duration_array_to_store,
|
||||
"instructions" => $chemo_drugs[$x]['dose'][$i]['instructions'],
|
||||
"adjusted_dose_reason" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose_reason[$count] : NULL
|
||||
];
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
$chemo_drugs_to_save[] = [
|
||||
"protocol_id" => $protocol_id,
|
||||
"drug_id" => $chemo_drugs[$x]['drug_id'],
|
||||
"drug_route" => $chemo_drugs[$x]['drug_route'],
|
||||
"drug_factor" => $chemo_drugs[$x]['drug_factor'],
|
||||
"dose" => $drug_doses
|
||||
];
|
||||
}
|
||||
|
||||
for($x = 0; $x < count($post_chemo_drugs); $x++) {
|
||||
$drug_doses = [];
|
||||
|
||||
for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++){
|
||||
$duration_array = explode(",", $post_chemo_drugs[$x]['dose'][$i]['duration']);
|
||||
$duration_array_to_store = [];
|
||||
|
||||
foreach ($duration_array as $duration) {
|
||||
$duration_array_to_store[] = [
|
||||
"name" => $duration,
|
||||
"given_by" => NULL,
|
||||
"given_on" => NULL,
|
||||
"quantity_given" => 0,
|
||||
];
|
||||
}
|
||||
|
||||
$drug_doses[] = [
|
||||
"dose" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose[$count] : $post_chemo_drugs[$x]['dose'][$i]['dose'],
|
||||
"weight_range" => $post_chemo_drugs[$x]['dose'][$i]['weight_range'],
|
||||
"duration" => $duration_array_to_store,
|
||||
"instructions" => $post_chemo_drugs[$x]['dose'][$i]['instructions'],
|
||||
"adjusted_dose_reason" => (!empty($adjusted_dose[$count]) && is_numeric($adjusted_dose[$count])) ? $adjusted_dose_reason[$count] : NULL
|
||||
];
|
||||
|
||||
$count++;
|
||||
}
|
||||
|
||||
$post_chemo_drugs_to_save[] = [
|
||||
"protocol_id" => $protocol_id,
|
||||
"drug_id" => $post_chemo_drugs[$x]['drug_id'],
|
||||
"drug_route" => $post_chemo_drugs[$x]['drug_route'],
|
||||
"drug_factor" => $post_chemo_drugs[$x]['drug_factor'],
|
||||
"dose" => $drug_doses
|
||||
];
|
||||
}
|
||||
|
||||
$ordered_cancer_protocol = new OrderedCancerProtocols();
|
||||
$ordered_cancer_protocol->protocol_id = $protocol_id;
|
||||
$ordered_cancer_protocol->patient_id = $patient_id;
|
||||
$ordered_cancer_protocol->episode_id = $episode_id;
|
||||
$ordered_cancer_protocol->inpatient_id = $inpatient_id;
|
||||
$ordered_cancer_protocol->pre_chemo_drugs = json_encode($pre_chemo_drugs_to_save);
|
||||
$ordered_cancer_protocol->chemo_drugs = json_encode($chemo_drugs_to_save);
|
||||
$ordered_cancer_protocol->post_chemo_drugs = json_encode($post_chemo_drugs_to_save);
|
||||
$ordered_cancer_protocol->created_by = Auth::id();
|
||||
|
||||
try {
|
||||
$ordered_cancer_protocol->save();
|
||||
flash("Cancer protocol ordering successful")->success();
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred when adding cancer protocols")->error();
|
||||
}
|
||||
}
|
||||
|
||||
return redirect('in_patient_sheet');
|
||||
}
|
||||
|
||||
public function cancel_protocol_order($id) {
|
||||
$protocol = OrderedCancerProtocols::find($id);
|
||||
|
||||
// check if any drugs have been dispensed
|
||||
|
||||
if ($protocol && $protocol->pre_chemo_status == 0 && $protocol->chemo_status == 0 && $protocol->post_chemo_status == 0) {
|
||||
if ($protocol->delete()){
|
||||
flash("Protocol has been deleted.")->success();
|
||||
} else {
|
||||
flash("An error occurred. Please try again later")->error();
|
||||
}
|
||||
} else {
|
||||
flash("Drugs in the protocol have already been dispensed")->error();
|
||||
}
|
||||
|
||||
return redirect('in_patient_sheet');
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,114 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Cancer\Providers;
|
||||
|
||||
use Illuminate\Support\ServiceProvider;
|
||||
use Illuminate\Database\Eloquent\Factory;
|
||||
|
||||
class CancerServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* @var string $moduleName
|
||||
*/
|
||||
protected $moduleName = 'Cancer';
|
||||
|
||||
/**
|
||||
* @var string $moduleNameLower
|
||||
*/
|
||||
protected $moduleNameLower = 'cancer';
|
||||
|
||||
/**
|
||||
* Boot the application events.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
$this->registerTranslations();
|
||||
$this->registerConfig();
|
||||
$this->registerViews();
|
||||
$this->loadMigrationsFrom(module_path($this->moduleName, 'Database/Migrations'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Register the service provider.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function register()
|
||||
{
|
||||
$this->app->register(RouteServiceProvider::class);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register config.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function registerConfig()
|
||||
{
|
||||
$this->publishes([
|
||||
module_path($this->moduleName, 'Config/config.php') => config_path($this->moduleNameLower . '.php'),
|
||||
], 'config');
|
||||
$this->mergeConfigFrom(
|
||||
module_path($this->moduleName, 'Config/config.php'), $this->moduleNameLower
|
||||
);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register views.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerViews()
|
||||
{
|
||||
$viewPath = resource_path('views/modules/' . $this->moduleNameLower);
|
||||
|
||||
$sourcePath = module_path($this->moduleName, 'Resources/views');
|
||||
|
||||
$this->publishes([
|
||||
$sourcePath => $viewPath
|
||||
], ['views', $this->moduleNameLower . '-module-views']);
|
||||
|
||||
$this->loadViewsFrom(array_merge($this->getPublishableViewPaths(), [$sourcePath]), $this->moduleNameLower);
|
||||
}
|
||||
|
||||
/**
|
||||
* Register translations.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function registerTranslations()
|
||||
{
|
||||
$langPath = resource_path('lang/modules/' . $this->moduleNameLower);
|
||||
|
||||
if (is_dir($langPath)) {
|
||||
$this->loadTranslationsFrom($langPath, $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom($langPath);
|
||||
} else {
|
||||
$this->loadTranslationsFrom(module_path($this->moduleName, 'Resources/lang'), $this->moduleNameLower);
|
||||
$this->loadJsonTranslationsFrom(module_path($this->moduleName, 'Resources/lang'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Get the services provided by the provider.
|
||||
*
|
||||
* @return array
|
||||
*/
|
||||
public function provides()
|
||||
{
|
||||
return [];
|
||||
}
|
||||
|
||||
private function getPublishableViewPaths(): array
|
||||
{
|
||||
$paths = [];
|
||||
foreach (\Config::get('view.paths') as $path) {
|
||||
if (is_dir($path . '/modules/' . $this->moduleNameLower)) {
|
||||
$paths[] = $path . '/modules/' . $this->moduleNameLower;
|
||||
}
|
||||
}
|
||||
return $paths;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\Cancer\Providers;
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
use Illuminate\Foundation\Support\Providers\RouteServiceProvider as ServiceProvider;
|
||||
|
||||
class RouteServiceProvider extends ServiceProvider
|
||||
{
|
||||
/**
|
||||
* The module namespace to assume when generating URLs to actions.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
protected $moduleNamespace = 'Modules\Cancer\Http\Controllers';
|
||||
|
||||
/**
|
||||
* Called before routes are registered.
|
||||
*
|
||||
* Register any model bindings or pattern based filters.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function boot()
|
||||
{
|
||||
parent::boot();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the routes for the application.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
public function map()
|
||||
{
|
||||
$this->mapApiRoutes();
|
||||
|
||||
$this->mapWebRoutes();
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "web" routes for the application.
|
||||
*
|
||||
* These routes all receive session state, CSRF protection, etc.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapWebRoutes()
|
||||
{
|
||||
Route::middleware('web')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Cancer', '/Routes/web.php'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Define the "api" routes for the application.
|
||||
*
|
||||
* These routes are typically stateless.
|
||||
*
|
||||
* @return void
|
||||
*/
|
||||
protected function mapApiRoutes()
|
||||
{
|
||||
Route::prefix('api')
|
||||
->middleware('api')
|
||||
->namespace($this->moduleNamespace)
|
||||
->group(module_path('Cancer', '/Routes/api.php'));
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,560 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">{{ __('cancer_protocol.add_cancer_protocol') }}</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">{{ __('cancer_protocol.dashboard') }}</a></li>
|
||||
<li><a href="{{ route('cancer_protocol.index') }}">{{ __('cancer_protocol.cancer_protocols') }}</a></li>
|
||||
<li class="active">{{ __('cancer_protocol.create') }}</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('cancer::cancer_protocol.menu')
|
||||
|
||||
<!--Flash messages at the top -->
|
||||
@include('flash::message')
|
||||
<div class="white-box">
|
||||
{{ Form::open(['route' => 'cancer_protocol.store', 'data-toggle' => 'validator']) }}
|
||||
|
||||
<h3>Protocol Details</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
{{ Form::label('name', "Protocol Name") }}
|
||||
{{ Form::text('name', '', ['class' => 'form-control compulsory', 'required']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
{{ Form::label('name', "Protocol Billing Type") }}
|
||||
<br>
|
||||
{{ Form::radio('protocol_billing_type', 0, false, ["required", "onclick" => "show('protocol_cost_div');"]) }} Umbrella Cost
|
||||
{{ Form::radio('protocol_billing_type', 1, false, ["required", "onclick" => "hide('protocol_cost_div');"]) }} Bill Per Drug
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="form-group" id="protocol_cost_div" style="display: none">
|
||||
{{ Form::label('protocol_cost', "Protocol Cost") }}
|
||||
{{ Form::number('protocol_cost', '', ['class' => 'form-control compulsory', 'min' => 0]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3><label class="label label-warning">PRE-CHEMOTHERAPY</label></h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ Form::label('pre_chemo_comments', 'Comments') }}
|
||||
{{ Form::textarea('pre_chemo_comments', '', ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<table class='table color-bordered-table success-bordered-table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<div class="row">
|
||||
<div class="col-3">Drug</div>
|
||||
<div class="col-1">Route</div>
|
||||
<div class="col-2">Factor</div>
|
||||
<div class="col-1">Dose</div>
|
||||
<div class="col-2">Duration(Separate with commas)</div>
|
||||
<div class="col-2">Instructions</div>
|
||||
<div class="col-1"></div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="pre_chemo_drugs_div">
|
||||
<tr>
|
||||
<td>
|
||||
<div id="pre_chemo_row_0">
|
||||
{{ Form::hidden('pre_chemo_row_counter[]', 0) }}
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
{{ Form::select('pre_chemo_drug_id[]', $drugs, '', ['class' => 'form-control compulsory drugs_id_class', 'id' => 'pre_chemo_drug_id_0', 'onchange' => 'drugs_details(0, this.value, \'pre_chemo\')', 'required']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::select('pre_chemo_drug_route[]', $drug_routes, '', ['class' => 'form-control compulsory', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::select('pre_chemo_drug_factor_id[]', $factors, '', ['class' => 'form-control compulsory', 'onchange' => 'check_factor(0, \'pre_chemo\')', 'required', 'id' => 'pre_chemo_drug_factor_id_0']) }}
|
||||
|
||||
<div id="pre_chemo_drug_weight_0" style="display: none">
|
||||
<hr>
|
||||
|
||||
{{ Form::label('pre_chemo_drug_weight_range', 'Range (Kg)') }}
|
||||
{{ Form::text('pre_chemo_drug_weight_range[]', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::number('pre_chemo_drug_dose[]', '', ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_unit_0'></span>
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_factor_unit_0'></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('pre_chemo_drug_duration[]', '', ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('pre_chemo_drug_instructions[]', '', ['class' => 'form-control', 'rows' => '3']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<a href="#pre_chemo_row_0" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_pre_chemo_dose(0)">Add Dose</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-success btn-rounded btn-sm" onclick="add_pre_chemo_drug()">Add Drug</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3><label class="label label-warning">CHEMOTHERAPY</label></h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ Form::label('chemo_comments', 'Comments') }}
|
||||
{{ Form::textarea('chemo_comments', '', ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<table class='table color-bordered-table success-bordered-table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<div class="row">
|
||||
<div class="col-3">Drug</div>
|
||||
<div class="col-1">Route</div>
|
||||
<div class="col-2">Factor</div>
|
||||
<div class="col-1">Dose</div>
|
||||
<div class="col-2">Duration(Separate with commas)</div>
|
||||
<div class="col-2">Instructions</div>
|
||||
<div class="col-1"></div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="chemo_drugs_div">
|
||||
<tr>
|
||||
<td>
|
||||
<div id="chemo_row_0">
|
||||
{{ Form::hidden('chemo_row_counter[]', 0) }}
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
{{ Form::select('chemo_drug_id[]', $drugs, '', ['class' => 'form-control compulsory drugs_id_class', 'id' => 'chemo_drug_id_0', 'onchange' => 'drugs_details(0, this.value, \'chemo\')', 'required']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::select('chemo_drug_route[]', $drug_routes, '', ['class' => 'form-control compulsory', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::select('chemo_drug_factor_id[]', $factors, '', ['class' => 'form-control compulsory', 'onchange' => 'check_factor(0, \'chemo\')', 'required', 'id' => 'chemo_drug_factor_id_0']) }}
|
||||
|
||||
<div id="chemo_drug_weight_0" style="display: none">
|
||||
<hr>
|
||||
|
||||
{{ Form::label('chemo_drug_weight_range', 'Range (Kg)') }}
|
||||
{{ Form::text('chemo_drug_weight_range[]', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::number('chemo_drug_dose[]', '', ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_unit_0'></span>
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_factor_unit_0'></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('chemo_drug_duration[]', '', ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('chemo_drug_instructions[]', '', ['class' => 'form-control', 'rows' => '3']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<a href="#chemo_row_0" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_chemo_dose(0)">Add Dose</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-success btn-rounded btn-sm" onclick="add_chemo_drug()">Add Drug</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3><label class="label label-warning">POST-CHEMOTHERAPY</label></h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ Form::label('post_chemo_comments', 'Comments') }}
|
||||
{{ Form::textarea('post_chemo_comments', '', ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<table class='table color-bordered-table success-bordered-table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<div class="row">
|
||||
<div class="col-3">Drug</div>
|
||||
<div class="col-1">Route</div>
|
||||
<div class="col-2">Factor</div>
|
||||
<div class="col-1">Dose</div>
|
||||
<div class="col-2">Duration(Separate with commas)</div>
|
||||
<div class="col-2">Instructions</div>
|
||||
<div class="col-1"></div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="post_chemo_drugs_div">
|
||||
<tr>
|
||||
<td>
|
||||
<div id="post_chemo_row_0">
|
||||
{{ Form::hidden('post_chemo_row_counter[]', 0) }}
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
{{ Form::select('post_chemo_drug_id[]', $drugs, '', ['class' => 'form-control compulsory drugs_id_class', 'id' => 'post_chemo_drug_id_0', 'onchange' => 'drugs_details(0, this.value, \'post_chemo\')', 'required']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::select('post_chemo_drug_route[]', $drug_routes, '', ['class' => 'form-control compulsory', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::select('post_chemo_drug_factor_id[]', $factors, '', ['class' => 'form-control compulsory', 'onchange' => 'check_factor(0, \'post_chemo\')', 'required', 'id' => 'post_chemo_drug_factor_id_0']) }}
|
||||
|
||||
<div id="post_chemo_drug_weight_0" style="display: none">
|
||||
<hr>
|
||||
|
||||
{{ Form::label('post_chemo_drug_weight_range', 'Range (Kg)') }}
|
||||
{{ Form::text('post_chemo_drug_weight_range[]', '', ['class' => 'form-control']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::number('post_chemo_drug_dose[]', '', ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_unit_0'></span>
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_factor_unit_0'></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('post_chemo_drug_duration[]', '', ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('post_chemo_drug_instructions[]', '', ['class' => 'form-control', 'rows' => '3']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<a href="#post_chemo_row_0" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_post_chemo_dose(0)">Add Dose</a>
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-success btn-rounded btn-sm" onclick="add_post_chemo_drug()">Add Drug</a>
|
||||
|
||||
<hr>
|
||||
|
||||
{{ Form::button(__('cancer_protocol.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
|
||||
{{ Form::button(__('cancer_protocol.cancel'),['type'=>'reset','class'=>'btn btn-default btn-rounded waves-effect waves-light']) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
let pre_chemo_counter = 1;
|
||||
let chemo_counter = 1;
|
||||
let post_chemo_counter = 1;
|
||||
|
||||
function remove_field(id) {
|
||||
$('#' + id).remove();
|
||||
}
|
||||
|
||||
function add_pre_chemo_drug() {
|
||||
$('#pre_chemo_drugs_div').append("<tr id='pre_chemo_row_delete_" + pre_chemo_counter + "'>\
|
||||
<td>\
|
||||
<div id='pre_chemo_row_" + pre_chemo_counter + "'>\
|
||||
<input type='hidden' name='pre_chemo_row_counter[]' value='" + pre_chemo_counter + "'>\
|
||||
<div class='row'>\
|
||||
<div class='col-3'>\
|
||||
<select name='pre_chemo_drug_id[]' id='pre_chemo_drug_id_" + pre_chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + pre_chemo_counter + ", this.value, \"pre_chemo\")'>@php echo $option_drugs; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<select name='pre_chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<select name='pre_chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + pre_chemo_counter + ", \"pre_chemo\")' id='pre_chemo_drug_factor_id_" + pre_chemo_counter + "'>@php echo $option_factors; @endphp</select>\
|
||||
<div id='pre_chemo_drug_weight_" + pre_chemo_counter + "' style='display: none'>\
|
||||
<hr>\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type='text' name='pre_chemo_drug_weight_range[]' class='form-control'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<input type='number' name='pre_chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_unit_" + pre_chemo_counter + "'></span>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_factor_unit_" + pre_chemo_counter + "'></span>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='pre_chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='pre_chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<a href='#pre_chemo_row_" + pre_chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_pre_chemo_dose(" + pre_chemo_counter + ")'>Add Dose</a>\
|
||||
<br><br>\
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"pre_chemo_row_delete_" + pre_chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</td>\
|
||||
</tr>");
|
||||
|
||||
generalSelect2Set('pre_chemo_drug_id_'+pre_chemo_counter);
|
||||
pre_chemo_counter++;
|
||||
}
|
||||
|
||||
function add_chemo_drug() {
|
||||
$('#chemo_drugs_div').append("<tr id='chemo_row_delete_" + chemo_counter + "'>\
|
||||
<td>\
|
||||
<div id='chemo_row_" + chemo_counter + "'>\
|
||||
<input type='hidden' name='chemo_row_counter[]' value='" + chemo_counter + "'>\
|
||||
<div class='row'>\
|
||||
<div class='col-3'>\
|
||||
<select name='chemo_drug_id[]' id='chemo_drug_id_" + chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + chemo_counter + ", this.value, \"chemo\")'>@php echo $option_drugs; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<select name='chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<select name='chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + chemo_counter + ", \"chemo\")' id='chemo_drug_factor_id_" + chemo_counter + "'>@php echo $option_factors; @endphp</select>\
|
||||
<div id='chemo_drug_weight_" + chemo_counter + "' style='display: none'>\
|
||||
<hr>\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type='text' name='chemo_drug_weight_range[]' class='form-control'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<input type='number' name='chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_unit_" + chemo_counter + "'></span>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_factor_unit_" + chemo_counter + "'></span>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<a href='#chemo_row_" + chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_chemo_dose(" + chemo_counter + ")'>Add Dose</a>\
|
||||
<br><br>\
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"chemo_row_delete_" + chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</td>\
|
||||
</tr>");
|
||||
|
||||
generalSelect2Set('chemo_drug_id_'+chemo_counter);
|
||||
chemo_counter++;
|
||||
}
|
||||
|
||||
function add_post_chemo_drug() {
|
||||
$('#post_chemo_drugs_div').append("<tr id='post_chemo_row_delete_" + post_chemo_counter + "'>\
|
||||
<td>\
|
||||
<div id='post_chemo_row_" + post_chemo_counter + "'>\
|
||||
<input type='hidden' name='post_chemo_row_counter[]' value='" + post_chemo_counter + "'>\
|
||||
<div class='row'>\
|
||||
<div class='col-3'>\
|
||||
<select name='post_chemo_drug_id[]' id='post_chemo_drug_id_" + post_chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + post_chemo_counter + ", this.value, \"post_chemo\")'>@php echo $option_drugs; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<select name='post_chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<select name='post_chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + post_chemo_counter + ", \"post_chemo\")' id='post_chemo_drug_factor_id_" + post_chemo_counter + "'>@php echo $option_factors; @endphp</select>\
|
||||
<div id='post_chemo_drug_weight_" + post_chemo_counter + "' style='display: none'>\
|
||||
<hr>\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type='text' name='post_chemo_drug_weight_range[]' class='form-control'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<input type='number' name='post_chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_unit_" + post_chemo_counter + "'></span>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_factor_unit_" + post_chemo_counter + "'></span>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='post_chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='post_chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<a href='#post_chemo_row_" + post_chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_post_chemo_dose(" + post_chemo_counter + ")'>Add Dose</a>\
|
||||
<br><br>\
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"post_chemo_row_delete_" + post_chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</td>\
|
||||
</tr>");
|
||||
|
||||
generalSelect2Set('post_chemo_drug_id_'+post_chemo_counter);
|
||||
post_chemo_counter++;
|
||||
}
|
||||
|
||||
function generalSelect2Set(id) {
|
||||
$('#'+id).select2({
|
||||
width: "100%"
|
||||
});
|
||||
}
|
||||
|
||||
function add_pre_chemo_dose(row_id) {
|
||||
let current_count = $('.pre_chemo_child_delete_' + row_id).length + 1;
|
||||
$('#pre_chemo_row_' + row_id).append('<div class="row pre_chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="pre_chemo_child_delete_' + row_id + '_' + current_count + '">\
|
||||
<div class="col-5"><input type="hidden" name="pre_chemo_child_row_id[]" value="' + row_id + '"></div>\
|
||||
<div class="col-2">\
|
||||
<div class="pre_chemo_child_drug_weight_' + row_id + '" style="display: none">\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type="text" name="pre_chemo_child_drug_weight_range[]" class="form-control">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<input type="number" class="form-control compulsory" required name="pre_chemo_child_drug_dose[]" min="0" step=0.0001>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_unit_' + row_id + '"></span>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_factor_unit_' + row_id + '"></span>\
|
||||
</div>\
|
||||
<div class="col-2">\
|
||||
<textarea name="pre_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<textarea name="pre_chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'pre_chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
|
||||
|
||||
check_factor(row_id, "pre_chemo");
|
||||
}
|
||||
|
||||
function add_chemo_dose(row_id) {
|
||||
let current_count = $('.chemo_child_delete_' + row_id).length + 1;
|
||||
$('#chemo_row_' + row_id).append('<div class="row chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="chemo_child_delete_' + row_id + '_' + current_count + '">\
|
||||
<div class="col-5"><input type="hidden" name="chemo_child_row_id[]" value="' + row_id + '"></div>\
|
||||
<div class="col-2">\
|
||||
<div class="chemo_child_drug_weight_' + row_id + '" style="display: none">\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type="text" name="chemo_child_drug_weight_range[]" class="form-control">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<input type="number" class="form-control compulsory" required name="chemo_child_drug_dose[]" min="0" step=0.0001>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_unit_' + row_id + '"></span>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_factor_unit_' + row_id + '"></span>\
|
||||
</div>\
|
||||
<div class="col-2">\
|
||||
<textarea name="chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<textarea name="chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
|
||||
|
||||
check_factor(row_id, "chemo");
|
||||
}
|
||||
|
||||
function add_post_chemo_dose(row_id) {
|
||||
let current_count = $('.post_chemo_child_delete_' + row_id).length + 1;
|
||||
$('#post_chemo_row_' + row_id).append('<div class="row post_chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="post_chemo_child_delete_' + row_id + '_' + current_count + '">\
|
||||
<div class="col-5"><input type="hidden" name="post_chemo_child_row_id[]" value="' + row_id + '"></div>\
|
||||
<div class="col-2">\
|
||||
<div class="post_chemo_child_drug_weight_' + row_id + '" style="display: none">\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type="text" name="post_chemo_child_drug_weight_range[]" class="form-control">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<input type="number" class="form-control compulsory" required name="post_chemo_child_drug_dose[]" min="0" step=0.0001>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_unit_' + row_id + '"></span>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_factor_unit_' + row_id + '"></span>\
|
||||
</div>\
|
||||
<div class="col-2">\
|
||||
<textarea name="post_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<textarea name="post_chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'post_chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
|
||||
|
||||
check_factor(row_id, "post_chemo");
|
||||
}
|
||||
|
||||
function drugs_details (id, drug_id, prefix) {
|
||||
$.ajax({
|
||||
url: '/prescriptions/get_drug_details/',
|
||||
data: {'drug_id':drug_id, 'patient_id':0, 'patient_insurance_status': 0},
|
||||
success: function(response){
|
||||
let arr = JSON.parse(response);
|
||||
|
||||
$('.' + prefix + '_drug_unit_' + id).text(arr["drug_unit"]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function check_factor(id, prefix) {
|
||||
let factor_value = $('#' + prefix + '_drug_factor_id_' + id).val();
|
||||
|
||||
if (factor_value == 1) {
|
||||
$('.' + prefix + '_drug_factor_unit_' + id).html('/m<sup>2</sup>');
|
||||
$('#' + prefix + '_drug_weight_' + id).hide();
|
||||
$('.' + prefix + '_child_drug_weight_' + id).hide();
|
||||
} else if (factor_value == 2) {
|
||||
$('.' + prefix + '_drug_factor_unit_' + id).text('/Kg');
|
||||
$('#' + prefix + '_drug_weight_' + id).show();
|
||||
$('.' + prefix + '_child_drug_weight_' + id).show();
|
||||
} else {
|
||||
$('.' + prefix + '_drug_factor_unit_' + id).text('');
|
||||
$('#' + prefix + '_drug_weight_' + id).hide();
|
||||
$('.' + prefix + '_child_drug_weight_' + id).hide();
|
||||
}
|
||||
}
|
||||
|
||||
$('.drugs_id_class').select2({
|
||||
placeholder: "Select drug"
|
||||
});
|
||||
|
||||
function show(id) {
|
||||
if (document.getElementById(id).style.display == 'none') {
|
||||
document.getElementById(id).style.display = '';
|
||||
}
|
||||
}
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,665 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Edit Cancer Protocol</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">{{ __('cancer_protocol.dashboard') }}</a></li>
|
||||
<li><a href="{{ route('cancer_protocol.index') }}">{{ __('cancer_protocol.cancer_protocols') }}</a></li>
|
||||
<li class="active">Edit</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('cancer::cancer_protocol.menu')
|
||||
|
||||
<!--Flash messages at the top -->
|
||||
@include('flash::message')
|
||||
<div class="white-box">
|
||||
{{ Form::model($cancer_protocol, ['method' => 'PUT', 'route' => ['cancer_protocol.update',$cancer_protocol] , 'data-toggle' => 'validator']) }}
|
||||
|
||||
<h3>Protocol Details</h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
{{ Form::label('name', "Protocol Name") }}
|
||||
{{ Form::text('name', $cancer_protocol->name, ['class' => 'form-control compulsory', 'required']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-md-2"></div>
|
||||
<div class="col-md-5">
|
||||
<div class="form-group">
|
||||
{{ Form::label('name', "Protocol Billing Type") }}
|
||||
<br>
|
||||
{{ Form::radio('protocol_billing_type', 0, $cancer_protocol->protocol_billing_type == 0, ["required", "onclick" => "show('protocol_cost_div');"]) }} Umbrella Cost
|
||||
{{ Form::radio('protocol_billing_type', 1, $cancer_protocol->protocol_billing_type == 1, ["required", "onclick" => "hide('protocol_cost_div');"]) }} Bill Per Drug
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<div class="form-group" id="protocol_cost_div" @if($cancer_protocol->protocol_billing_type == 1) style="display: none" @endif>
|
||||
{{ Form::label('protocol_cost', "Protocol Cost") }}
|
||||
{{ Form::number('protocol_cost', $cancer_protocol->protocol_cost, ['class' => 'form-control compulsory', 'min' => 0]) }}
|
||||
</div>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@php
|
||||
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
|
||||
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
|
||||
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
|
||||
$pre_chemo_counter = 0;
|
||||
$chemo_counter = 0;
|
||||
$post_chemo_counter = 0;
|
||||
@endphp
|
||||
|
||||
<hr>
|
||||
|
||||
<h3><label class="label label-warning">PRE-CHEMOTHERAPY</label></h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ Form::label('pre_chemo_comments', 'Comments') }}
|
||||
{{ Form::textarea('pre_chemo_comments', $cancer_protocol->pre_chemo_comments, ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<table class='table color-bordered-table success-bordered-table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<div class="row">
|
||||
<div class="col-3">Drug</div>
|
||||
<div class="col-1">Route</div>
|
||||
<div class="col-2">Factor</div>
|
||||
<div class="col-1">Dose</div>
|
||||
<div class="col-2">Duration(Separate with commas)</div>
|
||||
<div class="col-2">Instructions</div>
|
||||
<div class="col-1"></div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="pre_chemo_drugs_div">
|
||||
@foreach($pre_chemo_drugs as $pre_chemo_drug)
|
||||
<tr id='pre_chemo_row_delete_{{ $pre_chemo_counter }}'>
|
||||
<td>
|
||||
<div id="pre_chemo_row_{{ $pre_chemo_counter }}">
|
||||
{{ Form::hidden('pre_chemo_row_counter[]', $pre_chemo_counter) }}
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
{{ Form::select('pre_chemo_drug_id[]', $drugs, $pre_chemo_drug["drug_id"], ['class' => 'form-control compulsory drugs_id_class', 'id' => 'pre_chemo_drug_id_' . $pre_chemo_counter, 'onchange' => 'drugs_details(' . $pre_chemo_counter . ', this.value, \'pre_chemo\')', 'required']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::select('pre_chemo_drug_route[]', $drug_routes, $pre_chemo_drug["drug_route"], ['class' => 'form-control compulsory', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::select('pre_chemo_drug_factor_id[]', $factors, $pre_chemo_drug["drug_factor"], ['class' => 'form-control compulsory', 'onchange' => 'check_factor(' . $pre_chemo_counter . ', \'pre_chemo\')', 'required', 'id' => 'pre_chemo_drug_factor_id_' . $pre_chemo_counter]) }}
|
||||
|
||||
<div id="pre_chemo_drug_weight_{{ $pre_chemo_counter }}" @if($pre_chemo_drug["drug_factor"] != 2) style="display: none" @endif>
|
||||
<hr>
|
||||
|
||||
{{ Form::label('pre_chemo_drug_weight_range', 'Range (Kg)') }}
|
||||
{{ Form::text('pre_chemo_drug_weight_range[]', $pre_chemo_drug["dose"][0]["weight_range"], ['class' => 'form-control']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::number('pre_chemo_drug_dose[]', $pre_chemo_drug["dose"][0]["dose"], ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_unit_{{ $pre_chemo_counter }}'></span>
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_factor_unit_{{ $pre_chemo_counter }}'></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('pre_chemo_drug_duration[]', $pre_chemo_drug["dose"][0]["duration"], ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('pre_chemo_drug_instructions[]', $pre_chemo_drug["dose"][0]["instructions"], ['class' => 'form-control', 'rows' => '3']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<a href="#pre_chemo_row_{{ $pre_chemo_counter }}" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_pre_chemo_dose({{ $pre_chemo_counter }})">Add Dose</a>
|
||||
|
||||
@if($pre_chemo_counter != 0)
|
||||
<br><br>
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field("pre_chemo_row_delete_{{ $pre_chemo_counter }}")'><i class='fa fa-trash'></i></button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@for($x=1; $x < count($pre_chemo_drug["dose"]); $x++)
|
||||
<div class="row pre_chemo_child_delete_{{ $pre_chemo_counter }}" style="margin-top: 10px" id="pre_chemo_child_delete_{{ $pre_chemo_counter }}_{{ $x }}">
|
||||
<div class="col-5"><input type="hidden" name="pre_chemo_child_row_id[]" value="{{ $pre_chemo_counter }}"></div>
|
||||
<div class="col-2">
|
||||
<div class="pre_chemo_child_drug_weight_{{ $pre_chemo_counter }}" @if($pre_chemo_drug["drug_factor"] != 2) style="display: none" @endif>
|
||||
<label>Range (Kg)</label>
|
||||
<input type="text" name="pre_chemo_child_drug_weight_range[]" class="form-control" value="{{ $pre_chemo_drug["dose"][$x]["weight_range"] }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<input type="number" class="form-control compulsory" required name="pre_chemo_child_drug_dose[]" min="0" value="{{ $pre_chemo_drug["dose"][$x]["dose"] }}" step='0.0001'>
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_unit_{{ $pre_chemo_counter }}"></span>
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_factor_unit_{{ $pre_chemo_counter }}"></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<textarea name="pre_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3">{{ $pre_chemo_drug["dose"][$x]["duration"] }}</textarea>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<textarea name="pre_chemo_child_drug_instructions[]" class="form-control" rows="3">{{ $pre_chemo_drug["dose"][$x]["instructions"] }}</textarea>
|
||||
</div>
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field('pre_chemo_child_delete_{{ $pre_chemo_counter }}_{{ $x }}')"><i class="fa fa-trash"></i></button></div></div>
|
||||
@endfor
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@php $pre_chemo_counter++; @endphp
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-success btn-rounded btn-sm" onclick="add_pre_chemo_drug()">Add Drug</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3><label class="label label-warning">CHEMOTHERAPY</label></h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ Form::label('chemo_comments', 'Comments') }}
|
||||
{{ Form::textarea('chemo_comments', $cancer_protocol->chemo_comments, ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<table class='table color-bordered-table success-bordered-table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<div class="row">
|
||||
<div class="col-3">Drug</div>
|
||||
<div class="col-1">Route</div>
|
||||
<div class="col-2">Factor</div>
|
||||
<div class="col-1">Dose</div>
|
||||
<div class="col-2">Duration(Separate with commas)</div>
|
||||
<div class="col-2">Instructions</div>
|
||||
<div class="col-1"></div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="chemo_drugs_div">
|
||||
@foreach($chemo_drugs as $chemo_drug)
|
||||
<tr id='chemo_row_delete_{{ $chemo_counter }}'>
|
||||
<td>
|
||||
<div id="chemo_row_{{ $chemo_counter }}">
|
||||
{{ Form::hidden('chemo_row_counter[]', $chemo_counter) }}
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
{{ Form::select('chemo_drug_id[]', $drugs, $chemo_drug["drug_id"], ['class' => 'form-control compulsory drugs_id_class', 'id' => 'chemo_drug_id_' . $chemo_counter, 'onchange' => 'drugs_details(' . $chemo_counter . ', this.value, \'chemo\')', 'required']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::select('chemo_drug_route[]', $drug_routes, $chemo_drug["drug_route"], ['class' => 'form-control compulsory', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::select('chemo_drug_factor_id[]', $factors, $chemo_drug["drug_factor"], ['class' => 'form-control compulsory', 'onchange' => 'check_factor(' . $chemo_counter . ', \'chemo\')', 'required', 'id' => 'chemo_drug_factor_id_' . $chemo_counter]) }}
|
||||
|
||||
<div id="chemo_drug_weight_{{ $chemo_counter }}" @if($chemo_drug["drug_factor"] != 2) style="display: none" @endif>
|
||||
<hr>
|
||||
|
||||
{{ Form::label('chemo_drug_weight_range', 'Range (Kg)') }}
|
||||
{{ Form::text('chemo_drug_weight_range[]', $chemo_drug["dose"][0]["weight_range"], ['class' => 'form-control']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::number('chemo_drug_dose[]', $chemo_drug["dose"][0]["dose"], ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_unit_{{ $chemo_counter }}'></span>
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_factor_unit_{{ $chemo_counter }}'></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('chemo_drug_duration[]', $chemo_drug["dose"][0]["duration"], ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('chemo_drug_instructions[]', $chemo_drug["dose"][0]["instructions"], ['class' => 'form-control', 'rows' => '3']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<a href="#chemo_row_{{ $chemo_counter }}" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_chemo_dose({{ $chemo_counter }})">Add Dose</a>
|
||||
|
||||
@if($chemo_counter != 0)
|
||||
<br><br>
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field("chemo_row_delete_{{ $chemo_counter }}")'><i class='fa fa-trash'></i></button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@for($x=1; $x < count($chemo_drug["dose"]); $x++)
|
||||
<div class="row chemo_child_delete_{{ $chemo_counter }}" style="margin-top: 10px" id="chemo_child_delete_{{ $chemo_counter }}_{{ $x }}">
|
||||
<div class="col-5"><input type="hidden" name="chemo_child_row_id[]" value="{{ $chemo_counter }}"></div>
|
||||
<div class="col-2">
|
||||
<div class="chemo_child_drug_weight_{{ $chemo_counter }}" @if($chemo_drug["drug_factor"] != 2) style="display: none" @endif>
|
||||
<label>Range (Kg)</label>
|
||||
<input type="text" name="chemo_child_drug_weight_range[]" class="form-control" value="{{ $chemo_drug["dose"][$x]["weight_range"] }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<input type="number" class="form-control compulsory" required name="chemo_child_drug_dose[]" min="0" value="{{ $chemo_drug["dose"][$x]["dose"] }}" step='0.0001'>
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_unit_{{ $chemo_counter }}"></span>
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_factor_unit_{{ $chemo_counter }}"></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<textarea name="chemo_child_drug_duration[]" class="form-control compulsory" required rows="3">{{ $chemo_drug["dose"][$x]["duration"] }}</textarea>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<textarea name="chemo_child_drug_instructions[]" class="form-control" rows="3">{{ $chemo_drug["dose"][$x]["instructions"] }}</textarea>
|
||||
</div>
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field('chemo_child_delete_{{ $chemo_counter }}_{{ $x }}')"><i class="fa fa-trash"></i></button></div></div>
|
||||
@endfor
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@php $chemo_counter++; @endphp
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-success btn-rounded btn-sm" onclick="add_chemo_drug()">Add Drug</a>
|
||||
|
||||
<hr>
|
||||
|
||||
<h3><label class="label label-warning">POST-CHEMOTHERAPY</label></h3>
|
||||
|
||||
<div class="row">
|
||||
<div class="col-md-6">
|
||||
{{ Form::label('post_chemo_comments', 'Comments') }}
|
||||
{{ Form::textarea('post_chemo_comments', $cancer_protocol->post_chemo_comments, ['class' => 'form-control compulsory', 'required', 'rows' => '5']) }}
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<br>
|
||||
|
||||
<table class='table color-bordered-table success-bordered-table'>
|
||||
<thead>
|
||||
<tr>
|
||||
<th>
|
||||
<div class="row">
|
||||
<div class="col-3">Drug</div>
|
||||
<div class="col-1">Route</div>
|
||||
<div class="col-2">Factor</div>
|
||||
<div class="col-1">Dose</div>
|
||||
<div class="col-2">Duration(Separate with commas)</div>
|
||||
<div class="col-2">Instructions</div>
|
||||
<div class="col-1"></div>
|
||||
</div>
|
||||
</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody id="post_chemo_drugs_div">
|
||||
@foreach($post_chemo_drugs as $post_chemo_drug)
|
||||
<tr id='post_chemo_row_delete_{{ $post_chemo_counter }}'>
|
||||
<td>
|
||||
<div id="post_chemo_row_{{ $post_chemo_counter }}">
|
||||
{{ Form::hidden('post_chemo_row_counter[]', $post_chemo_counter) }}
|
||||
<div class="row">
|
||||
<div class="col-3">
|
||||
{{ Form::select('post_chemo_drug_id[]', $drugs, $post_chemo_drug["drug_id"], ['class' => 'form-control compulsory drugs_id_class', 'id' => 'post_chemo_drug_id_' . $post_chemo_counter, 'onchange' => 'drugs_details(' . $post_chemo_counter . ', this.value, \'post_chemo\')', 'required']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::select('post_chemo_drug_route[]', $drug_routes, $post_chemo_drug["drug_route"], ['class' => 'form-control compulsory', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::select('post_chemo_drug_factor_id[]', $factors, $post_chemo_drug["drug_factor"], ['class' => 'form-control compulsory', 'onchange' => 'check_factor(' . $post_chemo_counter . ', \'post_chemo\')', 'required', 'id' => 'post_chemo_drug_factor_id_' . $post_chemo_counter]) }}
|
||||
|
||||
<div id="post_chemo_drug_weight_{{ $post_chemo_counter }}" @if($post_chemo_drug["drug_factor"] != 2) style="display: none" @endif>
|
||||
<hr>
|
||||
|
||||
{{ Form::label('post_chemo_drug_weight_range', 'Range (Kg)') }}
|
||||
{{ Form::text('post_chemo_drug_weight_range[]', $post_chemo_drug["dose"][0]["weight_range"], ['class' => 'form-control']) }}
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
{{ Form::number('post_chemo_drug_dose[]', $post_chemo_drug["dose"][0]["dose"], ['class' => 'form-control compulsory', 'min' => 0, 'required', 'step' => 0.0001]) }}
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_unit_{{ $post_chemo_counter }}'></span>
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_factor_unit_{{ $post_chemo_counter }}'></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('post_chemo_drug_duration[]', $post_chemo_drug["dose"][0]["duration"], ['class' => 'form-control compulsory', 'rows' => '3', 'required']) }}
|
||||
</div>
|
||||
<div class="col-2">
|
||||
{{ Form::textarea('post_chemo_drug_instructions[]', $post_chemo_drug["dose"][0]["instructions"], ['class' => 'form-control', 'rows' => '3']) }}
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<a href="#post_chemo_row_{{ $post_chemo_counter }}" class="btn btn-outline-success btn-rounded btn-sm" onclick="add_post_chemo_dose({{ $post_chemo_counter }})">Add Dose</a>
|
||||
|
||||
@if($post_chemo_counter != 0)
|
||||
<br><br>
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field("post_chemo_row_delete_{{ $post_chemo_counter }}")'><i class='fa fa-trash'></i></button>
|
||||
@endif
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@for($x=1; $x < count($post_chemo_drug["dose"]); $x++)
|
||||
<div class="row post_chemo_child_delete_{{ $post_chemo_counter }}" style="margin-top: 10px" id="post_chemo_child_delete_{{ $post_chemo_counter }}_{{ $x }}">
|
||||
<div class="col-5"><input type="hidden" name="post_chemo_child_row_id[]" value="{{ $post_chemo_counter }}"></div>
|
||||
<div class="col-2">
|
||||
<div class="post_chemo_child_drug_weight_{{ $post_chemo_counter }}" @if($pre_chemo_drug["drug_factor"] != 2) style="display: none" @endif>
|
||||
<label>Range (Kg)</label>
|
||||
<input type="text" name="post_chemo_child_drug_weight_range[]" class="form-control" value="{{ $post_chemo_drug["dose"][$x]["weight_range"] }}">
|
||||
</div>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<input type="number" class="form-control compulsory" required name="post_chemo_child_drug_dose[]" min="0" value="{{ $post_chemo_drug["dose"][$x]["dose"] }}" step='0.0001'>
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_unit_{{ $post_chemo_counter }}"></span>
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_factor_unit_{{ $post_chemo_counter }}"></span>
|
||||
</div>
|
||||
<div class="col-2">
|
||||
<textarea name="post_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3">{{ $post_chemo_drug["dose"][$x]["duration"] }}</textarea>
|
||||
</div>
|
||||
<div class="col-1">
|
||||
<textarea name="post_chemo_child_drug_instructions[]" class="form-control" rows="3">{{ $post_chemo_drug["dose"][$x]["instructions"] }}</textarea>
|
||||
</div>
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field('post_chemo_child_delete_{{ $post_chemo_counter }}_{{ $x }}')"><i class="fa fa-trash"></i></button></div></div>
|
||||
@endfor
|
||||
</div>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@php $post_chemo_counter++; @endphp
|
||||
@endforeach
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<a class="btn btn-success btn-rounded btn-sm" onclick="add_post_chemo_drug()">Add Drug</a>
|
||||
|
||||
<hr>
|
||||
|
||||
{{ Form::button(__('cancer_protocol.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
|
||||
{{ Form::button(__('cancer_protocol.cancel'),['type'=>'reset','class'=>'btn btn-default btn-rounded waves-effect waves-light']) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
let pre_chemo_counter = {{ $pre_chemo_counter }};
|
||||
let chemo_counter = {{ $chemo_counter }};
|
||||
let post_chemo_counter = {{ $post_chemo_counter }};
|
||||
|
||||
function remove_field(id) {
|
||||
$('#' + id).remove();
|
||||
}
|
||||
|
||||
function add_pre_chemo_drug() {
|
||||
$('#pre_chemo_drugs_div').append("<tr id='pre_chemo_row_delete_" + pre_chemo_counter + "'>\
|
||||
<td>\
|
||||
<div id='pre_chemo_row_" + pre_chemo_counter + "'>\
|
||||
<input type='hidden' name='pre_chemo_row_counter[]' value='" + pre_chemo_counter + "'>\
|
||||
<div class='row'>\
|
||||
<div class='col-3'>\
|
||||
<select name='pre_chemo_drug_id[]' id='pre_chemo_drug_id_" + pre_chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + pre_chemo_counter + ", this.value, \"pre_chemo\")'>@php echo $option_drugs; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<select name='pre_chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<select name='pre_chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + pre_chemo_counter + ", \"pre_chemo\")' id='pre_chemo_drug_factor_id_" + pre_chemo_counter + "'>@php echo $option_factors; @endphp</select>\
|
||||
<div id='pre_chemo_drug_weight_" + pre_chemo_counter + "' style='display: none'>\
|
||||
<hr>\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type='text' name='pre_chemo_drug_weight_range[]' class='form-control'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<input type='number' name='pre_chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_unit_" + pre_chemo_counter + "'></span>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='pre_chemo_drug_factor_unit_" + pre_chemo_counter + "'></span>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='pre_chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='pre_chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<a href='#pre_chemo_row_" + pre_chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_pre_chemo_dose(" + pre_chemo_counter + ")'>Add Dose</a>\
|
||||
<br><br>\
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"pre_chemo_row_delete_" + pre_chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</td>\
|
||||
</tr>");
|
||||
|
||||
generalSelect2Set('pre_chemo_drug_id_'+pre_chemo_counter);
|
||||
pre_chemo_counter++;
|
||||
}
|
||||
|
||||
function add_chemo_drug() {
|
||||
$('#chemo_drugs_div').append("<tr id='chemo_row_delete_" + chemo_counter + "'>\
|
||||
<td>\
|
||||
<div id='chemo_row_" + chemo_counter + "'>\
|
||||
<input type='hidden' name='chemo_row_counter[]' value='" + chemo_counter + "'>\
|
||||
<div class='row'>\
|
||||
<div class='col-3'>\
|
||||
<select name='chemo_drug_id[]' id='chemo_drug_id_" + chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + chemo_counter + ", this.value, \"chemo\")'>@php echo $option_drugs; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<select name='chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<select name='chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + chemo_counter + ", \"chemo\")' id='chemo_drug_factor_id_" + chemo_counter + "'>@php echo $option_factors; @endphp</select>\
|
||||
<div id='chemo_drug_weight_" + chemo_counter + "' style='display: none'>\
|
||||
<hr>\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type='text' name='chemo_drug_weight_range[]' class='form-control'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<input type='number' name='chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_unit_" + chemo_counter + "'></span>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='chemo_drug_factor_unit_" + chemo_counter + "'></span>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<a href='#chemo_row_" + chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_chemo_dose(" + chemo_counter + ")'>Add Dose</a>\
|
||||
<br><br>\
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"chemo_row_delete_" + chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</td>\
|
||||
</tr>");
|
||||
|
||||
generalSelect2Set('chemo_drug_id_'+chemo_counter);
|
||||
chemo_counter++;
|
||||
}
|
||||
|
||||
function add_post_chemo_drug() {
|
||||
$('#post_chemo_drugs_div').append("<tr id='post_chemo_row_delete_" + post_chemo_counter + "'>\
|
||||
<td>\
|
||||
<div id='post_chemo_row_" + post_chemo_counter + "'>\
|
||||
<input type='hidden' name='post_chemo_row_counter[]' value='" + post_chemo_counter + "'>\
|
||||
<div class='row'>\
|
||||
<div class='col-3'>\
|
||||
<select name='post_chemo_drug_id[]' id='post_chemo_drug_id_" + post_chemo_counter + "' class='form-control compulsory required drugs_id_class' required onchange='drugs_details(" + post_chemo_counter + ", this.value, \"post_chemo\")'>@php echo $option_drugs; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<select name='post_chemo_drug_route[]' class='form-control compulsory' required>@php echo $option_drug_routes; @endphp</select>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<select name='post_chemo_drug_factor_id[]' class='form-control compulsory' required onchange='check_factor(" + post_chemo_counter + ", \"post_chemo\")' id='post_chemo_drug_factor_id_" + post_chemo_counter + "'>@php echo $option_factors; @endphp</select>\
|
||||
<div id='post_chemo_drug_weight_" + post_chemo_counter + "' style='display: none'>\
|
||||
<hr>\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type='text' name='post_chemo_drug_weight_range[]' class='form-control'>\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<input type='number' name='post_chemo_drug_dose[]' class='form-control compulsory' required min='0' step=0.0001>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_unit_" + post_chemo_counter + "'></span>\
|
||||
<span style='margin-bottom: 4px; font-size: smaller;' class='post_chemo_drug_factor_unit_" + post_chemo_counter + "'></span>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='post_chemo_drug_duration[]' class='form-control compulsory' required rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-2'>\
|
||||
<textarea name='post_chemo_drug_instructions[]' class='form-control' rows='3'></textarea>\
|
||||
</div>\
|
||||
<div class='col-1'>\
|
||||
<a href='#post_chemo_row_" + post_chemo_counter + "' class='btn btn-outline-success btn-rounded btn-sm' onclick='add_post_chemo_dose(" + post_chemo_counter + ")'>Add Dose</a>\
|
||||
<br><br>\
|
||||
<button type='button' class='btn btn-sm btn-rounded btn-danger' style='color: white;' onclick='remove_field(\"post_chemo_row_delete_" + post_chemo_counter + "\")'><i class='fa fa-trash'></i></button>\
|
||||
</div>\
|
||||
</div>\
|
||||
</div>\
|
||||
</td>\
|
||||
</tr>");
|
||||
|
||||
generalSelect2Set('post_chemo_drug_id_'+post_chemo_counter);
|
||||
post_chemo_counter++;
|
||||
}
|
||||
|
||||
function generalSelect2Set(id) {
|
||||
$('#'+id).select2({
|
||||
width: "100%"
|
||||
});
|
||||
}
|
||||
|
||||
function add_pre_chemo_dose(row_id) {
|
||||
let current_count = $('.pre_chemo_child_delete_' + row_id).length + 1;
|
||||
$('#pre_chemo_row_' + row_id).append('<div class="row pre_chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="pre_chemo_child_delete_' + row_id + '_' + current_count + '">\
|
||||
<div class="col-5"><input type="hidden" name="pre_chemo_child_row_id[]" value="' + row_id + '"></div>\
|
||||
<div class="col-2">\
|
||||
<div class="pre_chemo_child_drug_weight_' + row_id + '" style="display: none">\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type="text" name="pre_chemo_child_drug_weight_range[]" class="form-control">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<input type="number" class="form-control compulsory" required name="pre_chemo_child_drug_dose[]" min="0" step=0.0001>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_unit_' + row_id + '"></span>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="pre_chemo_drug_factor_unit_' + row_id + '"></span>\
|
||||
</div>\
|
||||
<div class="col-2">\
|
||||
<textarea name="pre_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<textarea name="pre_chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'pre_chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
|
||||
|
||||
check_factor(row_id, "pre_chemo");
|
||||
}
|
||||
|
||||
function add_chemo_dose(row_id) {
|
||||
let current_count = $('.chemo_child_delete_' + row_id).length + 1;
|
||||
$('#chemo_row_' + row_id).append('<div class="row chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="chemo_child_delete_' + row_id + '_' + current_count + '">\
|
||||
<div class="col-5"><input type="hidden" name="chemo_child_row_id[]" value="' + row_id + '"></div>\
|
||||
<div class="col-2">\
|
||||
<div class="chemo_child_drug_weight_' + row_id + '" style="display: none">\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type="text" name="chemo_child_drug_weight_range[]" class="form-control">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<input type="number" class="form-control compulsory" required name="chemo_child_drug_dose[]" min="0" step=0.0001>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_unit_' + row_id + '"></span>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="chemo_drug_factor_unit_' + row_id + '"></span>\
|
||||
</div>\
|
||||
<div class="col-2">\
|
||||
<textarea name="chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<textarea name="chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
|
||||
|
||||
check_factor(row_id, "chemo");
|
||||
}
|
||||
|
||||
function add_post_chemo_dose(row_id) {
|
||||
let current_count = $('.post_chemo_child_delete_' + row_id).length + 1;
|
||||
$('#post_chemo_row_' + row_id).append('<div class="row post_chemo_child_delete_' + row_id + '" style="margin-top: 10px" id="post_chemo_child_delete_' + row_id + '_' + current_count + '">\
|
||||
<div class="col-5"><input type="hidden" name="post_chemo_child_row_id[]" value="' + row_id + '"></div>\
|
||||
<div class="col-2">\
|
||||
<div class="post_chemo_child_drug_weight_' + row_id + '" style="display: none">\
|
||||
<label>Range (Kg)</label>\
|
||||
<input type="text" name="post_chemo_child_drug_weight_range[]" class="form-control">\
|
||||
</div>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<input type="number" class="form-control compulsory" required name="post_chemo_child_drug_dose[]" min="0" step=0.0001>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_unit_' + row_id + '"></span>\
|
||||
<span style="margin-bottom: 4px; font-size: smaller;" class="post_chemo_drug_factor_unit_' + row_id + '"></span>\
|
||||
</div>\
|
||||
<div class="col-2">\
|
||||
<textarea name="post_chemo_child_drug_duration[]" class="form-control compulsory" required rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1">\
|
||||
<textarea name="post_chemo_child_drug_instructions[]" class="form-control" rows="3"></textarea>\
|
||||
</div>\
|
||||
<div class="col-1"><button type="button" class="btn btn-sm btn-rounded btn-danger" style="color: white;" onclick="remove_field(\'post_chemo_child_delete_' + row_id + '_' + current_count + '\')"><i class="fa fa-trash"></i></button></div></div>');
|
||||
|
||||
check_factor(row_id, "post_chemo");
|
||||
}
|
||||
|
||||
function drugs_details (id, drug_id, prefix) {
|
||||
$.ajax({
|
||||
url: '/prescriptions/get_drug_details/',
|
||||
data: {'drug_id':drug_id, 'patient_id':0, 'patient_insurance_status': 0},
|
||||
success: function(response){
|
||||
let arr = JSON.parse(response);
|
||||
|
||||
$('.' + prefix + '_drug_unit_' + id).text(arr["drug_unit"]);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
function check_factor(id, prefix) {
|
||||
let factor_value = $('#' + prefix + '_drug_factor_id_' + id).val();
|
||||
|
||||
if (factor_value == 1) {
|
||||
$('.' + prefix + '_drug_factor_unit_' + id).html('/m<sup>2</sup>');
|
||||
$('#' + prefix + '_drug_weight_' + id).hide();
|
||||
$('.' + prefix + '_child_drug_weight_' + id).hide();
|
||||
} else if (factor_value == 2) {
|
||||
$('.' + prefix + '_drug_factor_unit_' + id).text('/Kg');
|
||||
$('#' + prefix + '_drug_weight_' + id).show();
|
||||
$('.' + prefix + '_child_drug_weight_' + id).show();
|
||||
} else {
|
||||
$('.' + prefix + '_drug_factor_unit_' + id).text('');
|
||||
$('#' + prefix + '_drug_weight_' + id).hide();
|
||||
$('.' + prefix + '_child_drug_weight_' + id).hide();
|
||||
}
|
||||
}
|
||||
|
||||
$('.drugs_id_class').select2({
|
||||
placeholder: "Select drug"
|
||||
});
|
||||
|
||||
function show(id) {
|
||||
if (document.getElementById(id).style.display == 'none') {
|
||||
document.getElementById(id).style.display = '';
|
||||
}
|
||||
}
|
||||
function hide(id) {
|
||||
document.getElementById(id).style.display = 'none';
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,84 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Inactive Protocols</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">{{ __('insurance_groups.dashboard') }}</a></li>
|
||||
<li class="active">Inactive Protocols</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('cancer::cancer_protocol.menu')
|
||||
|
||||
<div class="white-box">
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="table" class="table table-striped color-bordered-table success-bordered-table table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Protocol</th>
|
||||
<th>Billing Type</th>
|
||||
<th></th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($cancer_protocols as $cancer_protocol)
|
||||
<tr>
|
||||
<td>{{ $cancer_protocol->name }}</td>
|
||||
<td>
|
||||
@if($cancer_protocol->protocol_billing_type == 0)
|
||||
Total Cost of {{ ugandan_shillings($cancer_protocol->protocol_cost) }}
|
||||
@else
|
||||
Billing Per Drug
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::model($cancer_protocol->id ,['method' => 'POST', 'route' => ['cancer_protocol.activate', $cancer_protocol->id]]) }}
|
||||
<button type="submit" class="btn btn-warning" onclick="return confirm('<?php echo __('age_groups.are_you_sure'); ?>')"><i class="fa fa-check"></i> {{ __('age_groups.activate') }}</button>
|
||||
{{ Form::close() }}
|
||||
</td>
|
||||
</tr>
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
bInfo: false,
|
||||
bPaginate: false,
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
]
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,227 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('/elite/bower_components/datatables/jquery.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
<link href="{{ asset('elite/tables/css/buttons.dataTables.min.css') }}" rel="stylesheet" type="text/css" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Cancer Protocols</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">{{ __('insurance_groups.dashboard') }}</a></li>
|
||||
<li class="active">Cancer Protocols</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('cancer::cancer_protocol.menu')
|
||||
|
||||
<div class="white-box">
|
||||
|
||||
<a href="/cancer_protocol/print_all_protocols" target="_blank" class="btn btn-success">Print Protocols</a>
|
||||
|
||||
@include('flash::message')
|
||||
|
||||
<div class="table-responsive">
|
||||
<table id="table" class="table table-striped color-bordered-table success-bordered-table table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Protocol</th>
|
||||
<th>Section</th>
|
||||
<th>Section Comment</th>
|
||||
<th>Drugs</th>
|
||||
<th>Route</th>
|
||||
<th>Factor</th>
|
||||
<th>Dose</th>
|
||||
<th>Duration</th>
|
||||
<th>Instructions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($cancer_protocols as $cancer_protocol)
|
||||
@php
|
||||
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
|
||||
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
|
||||
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
|
||||
|
||||
$pre_chemo_drugs_count = count($pre_chemo_drugs);
|
||||
$chemo_drugs_count = count($chemo_drugs);
|
||||
$post_chemo_drugs_count = count($post_chemo_drugs);
|
||||
|
||||
$pre_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $pre_chemo_drugs));
|
||||
$chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $chemo_drugs));
|
||||
$post_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $post_chemo_drugs));
|
||||
@endphp
|
||||
<tr>
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + $chemo_drugs_count + $chemo_doses_count + $post_chemo_drugs_count + $post_chemo_doses_count + 4 }}">
|
||||
<h3>{{ $cancer_protocol->name }}</h3>
|
||||
|
||||
<br>
|
||||
|
||||
@if($cancer_protocol->protocol_billing_type == 0)
|
||||
Total Cost of {{ ugandan_shillings($cancer_protocol->protocol_cost) }}
|
||||
@else
|
||||
Billing Per Drug
|
||||
@endif
|
||||
|
||||
<hr>
|
||||
|
||||
<a href="/cancer_protocol/{{ $cancer_protocol->id }}/edit/" class="btn btn-warning btn-rounded">Edit</a>
|
||||
|
||||
<br><br>
|
||||
|
||||
{{ Form::model($cancer_protocol->id ,['method' => 'DELETE', 'route' => ['cancer_protocol.destroy', $cancer_protocol->id]]) }}
|
||||
<button type="submit" class="btn btn-danger btn-rounded" onclick="return confirm('<?php echo __('wards.are_you_sure');?>')"><i class="fa fa-trash"></i> {{ __('wards.delete') }}</button>
|
||||
{{ Form::close() }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">Pre-Chemo</td>
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">{{ $cancer_protocol->pre_chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $pre_chemo_drugs_count; $x++)
|
||||
<tr>
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$pre_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$pre_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$pre_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$pre_chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($pre_chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($pre_chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $pre_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $pre_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
|
||||
<tr>
|
||||
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">Chemo</td>
|
||||
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">{{ $cancer_protocol->chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $chemo_drugs_count; $x++)
|
||||
<tr>
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$chemo_drugs[$x]['drug_id']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$chemo_drugs[$x]['drug_route']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
|
||||
<tr>
|
||||
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">Post-Chemo</td>
|
||||
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">{{ $cancer_protocol->post_chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $post_chemo_drugs_count; $x++)
|
||||
<tr>
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$post_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$post_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$post_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$post_chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($post_chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($post_chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $post_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $post_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
|
||||
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
|
||||
|
||||
<script src="{{ asset('elite/tables/js/dataTables.buttons.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.flash.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/jszip.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/pdfmake.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/vfs_fonts.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.html5.min.js') }}"></script>
|
||||
<script src="{{ asset('elite/tables/js/buttons.print.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#table').DataTable({
|
||||
dom: 'Bfrtip',
|
||||
bInfo: false,
|
||||
bPaginate: false,
|
||||
buttons: [
|
||||
'copy', 'csv', 'excel', 'pdf', 'print'
|
||||
]
|
||||
});
|
||||
</script>
|
||||
@endpush
|
||||
@@ -0,0 +1,5 @@
|
||||
<div class="white-box">
|
||||
@if(Auth::user()->can('cancer-protocol-create'))<a href="/cancer_protocol/create" class="nav-item btn btn-success" style="border-radius: 5px;"><i class="fa fa-plus"></i> <span style="margin-left: 10px">{{ __('cancer_protocol.add_cancer_protocol') }}</span></a>@endif
|
||||
@if(Auth::user()->can('cancer-protocol-list'))<a href="/cancer_protocol/" class="nav-item btn btn-info" style="border-radius: 5px;"><i class="fa fa-eye"></i> <span style="margin-left: 10px">{{ __('cancer_protocol.view_cancer_protocols') }}</span></a>@endif
|
||||
@if(Auth::user()->can('cancer-protocol-delete'))<a href="/cancer_protocol/inactive" class="nav-item btn btn-danger" style="border-radius: 5px;"><i class="fa fa-trash"></i> <span style="margin-left: 10px">{{ __('cancer_protocol.inactive_cancer_protocols') }}</span></a>@endif
|
||||
</div>
|
||||
+272
@@ -0,0 +1,272 @@
|
||||
@extends('layouts.main')
|
||||
|
||||
@push('styles')
|
||||
<link href="{{ asset('elite/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
|
||||
@endpush
|
||||
|
||||
@section('content')
|
||||
|
||||
<div class="row bg-title">
|
||||
<div class="col-lg-3 col-md-4 col-sm-4 col-xs-12">
|
||||
<h4 class="page-title">Prescribe Protocol</h4>
|
||||
</div>
|
||||
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
|
||||
<ol class="breadcrumb">
|
||||
<li><a href="{{ route('home') }}">{{ __('insurance_groups.dashboard') }}</a></li>
|
||||
<li class="active">Prescribe Protocol</li>
|
||||
</ol>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
@include('patients::allergies.header')
|
||||
|
||||
<div class="white-box">
|
||||
@include('flash::message')
|
||||
|
||||
{{ Form::open(['route' => 'cancer_protocol.order_protocol' , 'data-toggle' => 'validator']) }}
|
||||
|
||||
{{ Form::label('cancer_protocols', 'Choose cancer protocols') }}
|
||||
|
||||
<div class="form-group">
|
||||
{{ Form::select('cancer_protocols[]', $cancer_protocols, '',['id'=>'cancer_protocols', 'multiple', 'class' => 'form-control', 'required']) }}
|
||||
</div>
|
||||
|
||||
{{ Form::button(__('cancer_protocol.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
|
||||
<hr>
|
||||
|
||||
@php $count = 1; @endphp
|
||||
|
||||
@if(count($selected_protocols) > 0)
|
||||
{{ Form::open(['route' => 'cancer_protocol.save_protocol_order' , 'data-toggle' => 'validator']) }}
|
||||
|
||||
{{ Form::hidden('patient_id', $patient_id) }}
|
||||
{{ Form::hidden('episode_id', $episode_id) }}
|
||||
{{ Form::hidden('inpatient_info_id', $inpatient_info_id) }}
|
||||
|
||||
<table id="table" class="table table-striped color-bordered-table success-bordered-table table-hover table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Protocol</th>
|
||||
<th>Section</th>
|
||||
<th>Section Comment</th>
|
||||
<th>Drugs</th>
|
||||
<th>Route</th>
|
||||
<th>Factor</th>
|
||||
<th>Dose</th>
|
||||
<th width="8%">Adjusted Dose</th>
|
||||
<th>Duration</th>
|
||||
<th>Instructions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($selected_protocols as $cancer_protocol)
|
||||
@php
|
||||
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
|
||||
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
|
||||
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
|
||||
|
||||
$pre_chemo_drugs_count = count($pre_chemo_drugs);
|
||||
$chemo_drugs_count = count($chemo_drugs);
|
||||
$post_chemo_drugs_count = count($post_chemo_drugs);
|
||||
|
||||
$pre_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $pre_chemo_drugs));
|
||||
$chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $chemo_drugs));
|
||||
$post_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $post_chemo_drugs));
|
||||
@endphp
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + $chemo_drugs_count + $chemo_doses_count + $post_chemo_drugs_count + $post_chemo_doses_count + 4 }}">
|
||||
<h3>{{ $cancer_protocol->name }}</h3>
|
||||
{{ Form::hidden('protocol_id[]', $cancer_protocol->id) }}
|
||||
|
||||
<br>
|
||||
|
||||
@if($cancer_protocol->protocol_billing_type == 0)
|
||||
Total Cost of {{ ugandan_shillings($cancer_protocol->protocol_cost) }}
|
||||
@else
|
||||
Billing Per Drug
|
||||
@endif
|
||||
|
||||
<hr>
|
||||
|
||||
<a class="btn btn-danger btn-rounded" onclick="remove_protocol({{ $count }})">Remove</a>
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">Pre-Chemo</td>
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">{{ $cancer_protocol->pre_chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $pre_chemo_drugs_count; $x++)
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">
|
||||
{{ $drugs[$pre_chemo_drugs[$x]['drug_id']] ?? '' }}
|
||||
</td>
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">
|
||||
{{ $drug_routes[$pre_chemo_drugs[$x]['drug_route']] ?? '' }}
|
||||
</td>
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">
|
||||
{{ $factors[$pre_chemo_drugs[$x]['drug_factor']] ?? '' }}
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$pre_chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($pre_chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($pre_chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++)
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td>
|
||||
{{ $pre_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $pre_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::number('adjusted_dose[]', '', ['class' => 'form-control', 'step' => '0.0001']) }}
|
||||
|
||||
<br><br>
|
||||
|
||||
{{ Form::label('adjusted_dose_reason', 'Reason') }}
|
||||
{{ Form::textarea('adjusted_dose_reason[]', '', ['class' => 'form-control', 'rows' => 2]) }}
|
||||
</td>
|
||||
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">Chemo</td>
|
||||
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">{{ $cancer_protocol->chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $chemo_drugs_count; $x++)
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$chemo_drugs[$x]['drug_id']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$chemo_drugs[$x]['drug_route']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++)
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td>
|
||||
{{ $chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::number('adjusted_dose[]', '', ['class' => 'form-control', 'step' => '0.0001']) }}
|
||||
|
||||
<br><br>
|
||||
|
||||
{{ Form::label('adjusted_dose_reason', 'Reason') }}
|
||||
{{ Form::textarea('adjusted_dose_reason[]', '', ['class' => 'form-control', 'rows' => 2]) }}
|
||||
</td>
|
||||
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">Post-Chemo</td>
|
||||
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">{{ $cancer_protocol->post_chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $post_chemo_drugs_count; $x++)
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$post_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$post_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$post_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$post_chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($post_chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($post_chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++)
|
||||
<tr class="protocol_row_{{ $count }}">
|
||||
<td>
|
||||
{{ $post_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $post_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>
|
||||
{{ Form::number('adjusted_dose[]', '', ['class' => 'form-control', 'step' => '0.0001']) }}
|
||||
|
||||
<br><br>
|
||||
|
||||
{{ Form::label('adjusted_dose_reason', 'Reason') }}
|
||||
{{ Form::textarea('adjusted_dose_reason[]', '', ['class' => 'form-control', 'rows' => 2]) }}
|
||||
</td>
|
||||
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
|
||||
@php $count++ @endphp
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
|
||||
{{ Form::button(__('cancer_protocol.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
|
||||
|
||||
{{ Form::close() }}
|
||||
@else
|
||||
<code class="text-center">Please select a protocol above to continue</code>
|
||||
@endif
|
||||
</div>
|
||||
@endsection
|
||||
|
||||
@push('scripts')
|
||||
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
|
||||
|
||||
<script>
|
||||
$('#cancer_protocols').select2({
|
||||
placeholder: "Select",
|
||||
width: "100%"
|
||||
});
|
||||
|
||||
function remove_protocol(count) {
|
||||
if (confirm("Are you sure you want to remove this protocol?")) {
|
||||
$('.protocol_row_' + count).remove();
|
||||
}
|
||||
}
|
||||
</script>
|
||||
@endpush
|
||||
+202
@@ -0,0 +1,202 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang="{{ app()->getLocale() }}">
|
||||
|
||||
<head>
|
||||
<meta charset="utf-8">
|
||||
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1">
|
||||
<meta name="description" content="">
|
||||
<meta name="author" content="">
|
||||
|
||||
<link rel="icon" type="image/png" sizes="16x16" href="{{ asset('uploads/streamline/color/streamline_icon-02.png') }}">
|
||||
<title>{{ config('app.name', 'Inpatient Bill - Stre@mline') }}</title>
|
||||
<!-- Bootstrap Core CSS -->
|
||||
<link href="{{ asset('bootstrap/css/bootstrap.min.css') }}" rel="stylesheet">
|
||||
|
||||
<style>
|
||||
body{
|
||||
font-size: 0.8em;
|
||||
}
|
||||
/*thead, tfoot { display: table-row-group }*/
|
||||
thead {
|
||||
display: table-header-group;
|
||||
}
|
||||
tfoot {
|
||||
display: table-row-group;
|
||||
}
|
||||
tr {
|
||||
page-break-before: always;
|
||||
page-break-after: always;
|
||||
page-break-inside: avoid !important;
|
||||
}
|
||||
</style>
|
||||
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div class="container-fluid">
|
||||
@include('layouts.header_pdf_print')
|
||||
|
||||
<table id="table" class="table table-striped table-bordered">
|
||||
<thead>
|
||||
<tr>
|
||||
<th>Protocol</th>
|
||||
<th>Section</th>
|
||||
<th>Section Comment</th>
|
||||
<th>Drugs</th>
|
||||
<th>Route</th>
|
||||
<th>Factor</th>
|
||||
<th>Dose</th>
|
||||
<th>Duration</th>
|
||||
<th>Instructions</th>
|
||||
</tr>
|
||||
</thead>
|
||||
<tbody>
|
||||
@foreach($cancer_protocols as $cancer_protocol)
|
||||
@php
|
||||
$pre_chemo_drugs = json_decode($cancer_protocol->pre_chemo_drugs, true);
|
||||
$chemo_drugs = json_decode($cancer_protocol->chemo_drugs, true);
|
||||
$post_chemo_drugs = json_decode($cancer_protocol->post_chemo_drugs, true);
|
||||
|
||||
$pre_chemo_drugs_count = count($pre_chemo_drugs);
|
||||
$chemo_drugs_count = count($chemo_drugs);
|
||||
$post_chemo_drugs_count = count($post_chemo_drugs);
|
||||
|
||||
$pre_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $pre_chemo_drugs));
|
||||
$chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $chemo_drugs));
|
||||
$post_chemo_doses_count = array_sum(array_map(function ($value) {return count($value['dose']);}, $post_chemo_drugs));
|
||||
@endphp
|
||||
<tr>
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + $chemo_drugs_count + $chemo_doses_count + $post_chemo_drugs_count + $post_chemo_doses_count + 4 }}">
|
||||
<h3>{{ $cancer_protocol->name }}</h3>
|
||||
|
||||
<br>
|
||||
|
||||
@if($cancer_protocol->protocol_billing_type == 0)
|
||||
Total Cost of {{ ugandan_shillings($cancer_protocol->protocol_cost) }}
|
||||
@else
|
||||
Billing Per Drug
|
||||
@endif
|
||||
</td>
|
||||
</tr>
|
||||
|
||||
<tr>
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">Pre-Chemo</td>
|
||||
<td rowspan="{{ $pre_chemo_drugs_count + $pre_chemo_doses_count + 1 }}">{{ $cancer_protocol->pre_chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $pre_chemo_drugs_count; $x++)
|
||||
<tr>
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$pre_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$pre_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($pre_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$pre_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$pre_chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($pre_chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($pre_chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($pre_chemo_drugs[$x]['dose']); $i++)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $pre_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($pre_chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $pre_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $pre_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
|
||||
<tr>
|
||||
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">Chemo</td>
|
||||
<td rowspan="{{ $chemo_drugs_count + $chemo_doses_count + 1 }}">{{ $cancer_protocol->chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $chemo_drugs_count; $x++)
|
||||
<tr>
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$chemo_drugs[$x]['drug_id']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$chemo_drugs[$x]['drug_route']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($chemo_drugs[$x]['dose']); $i++)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
|
||||
<tr>
|
||||
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">Post-Chemo</td>
|
||||
<td rowspan="{{ $post_chemo_drugs_count + $post_chemo_doses_count + 1 }}">{{ $cancer_protocol->post_chemo_comments }}</td>
|
||||
</tr>
|
||||
|
||||
@for($x = 0; $x < $post_chemo_drugs_count; $x++)
|
||||
<tr>
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drugs[$post_chemo_drugs[$x]['drug_id']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $drug_routes[$post_chemo_drugs[$x]['drug_route']] ?? '' }}</td>
|
||||
<td rowspan="{{ count($post_chemo_drugs[$x]['dose']) + 1 }}">{{ $factors[$post_chemo_drugs[$x]['drug_factor']] ?? '' }}</td>
|
||||
</tr>
|
||||
|
||||
@php
|
||||
$drug_dosage = $drug_units[$drug_with_units[$post_chemo_drugs[$x]['drug_id']]];
|
||||
|
||||
if ($post_chemo_drugs[$x]['drug_factor'] == 1) {
|
||||
$drug_dosage .= '/m<sup>2</sup>';
|
||||
} else if ($post_chemo_drugs[$x]['drug_factor'] == 2) {
|
||||
$drug_dosage .= '/Kg';
|
||||
}
|
||||
@endphp
|
||||
|
||||
@for($i = 0; $i < count($post_chemo_drugs[$x]['dose']); $i++)
|
||||
<tr>
|
||||
<td>
|
||||
{{ $post_chemo_drugs[$x]['dose'][$i]['dose'] }} {!! $drug_dosage !!}
|
||||
|
||||
@if(!empty($post_chemo_drugs[$x]['dose'][$i]['weight_range']))
|
||||
<br><br>
|
||||
<span style="color: #0a776c">({{ $post_chemo_drugs[$x]['dose'][$i]['weight_range'] }})</span>
|
||||
@endif
|
||||
</td>
|
||||
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['duration'] }}</td>
|
||||
<td>{{ $post_chemo_drugs[$x]['dose'][$i]['instructions'] }}</td>
|
||||
</tr>
|
||||
@endfor
|
||||
@endfor
|
||||
@endforeach
|
||||
</tbody>
|
||||
|
||||
</table>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,18 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
/*
|
||||
|--------------------------------------------------------------------------
|
||||
| API Routes
|
||||
|--------------------------------------------------------------------------
|
||||
|
|
||||
| Here is where you can register API routes for your application. These
|
||||
| routes are loaded by the RouteServiceProvider within a group which
|
||||
| is assigned the "api" middleware group. Enjoy building your API!
|
||||
|
|
||||
*/
|
||||
|
||||
Route::middleware('auth:api')->get('/cancer', function (Request $request) {
|
||||
return $request->user();
|
||||
});
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
use Illuminate\Support\Facades\Route;
|
||||
|
||||
Route::group(['middleware' => ['auth', 'disablebackbutton', 'user-locale','subscription-tracking', 'password-expiry']], function () {
|
||||
Route::get('cancer_protocol/inactive', 'CancerProtocolController@inactive')->name('cancer_protocol.inactive');
|
||||
Route::post('cancer_protocol/activate/{id}', 'CancerProtocolController@activate')->name('cancer_protocol.activate');
|
||||
Route::any('cancer_protocol/print_all_protocols', 'CancerProtocolController@print_all_protocols')->name('cancer_protocol.print_all_protocols');
|
||||
Route::any('cancer_protocol/order_protocol', 'CancerProtocolController@order_protocol')->name('cancer_protocol.order_protocol');
|
||||
Route::any('cancer_protocol/save_protocol_order', 'CancerProtocolController@save_protocol_order')->name('cancer_protocol.save_protocol_order');
|
||||
Route::any('cancer_protocol/cancel_protocol_order/{id}', 'CancerProtocolController@cancel_protocol_order')->name('cancer_protocol.cancel_protocol_order');
|
||||
Route::resource('cancer_protocol', 'CancerProtocolController');
|
||||
});
|
||||
@@ -0,0 +1,19 @@
|
||||
image: alpine/git:latest
|
||||
|
||||
pipelines:
|
||||
branches:
|
||||
main:
|
||||
- step:
|
||||
name: Merge To Beta
|
||||
script:
|
||||
- git remote set-url origin https://Kabricks:${APP_SECRET}@bitbucket.org/dcsammi/${BITBUCKET_REPO_SLUG}
|
||||
- git config remote.origin.fetch "+refs/heads/*:refs/remotes/origin/*"
|
||||
- git fetch
|
||||
- git checkout beta
|
||||
- git merge main
|
||||
- git commit --amend -m "[skip ci] Merge changes from main"
|
||||
- git push
|
||||
- step:
|
||||
name: Deploy To Test
|
||||
script:
|
||||
- echo "Ready to deploy to demo or production!"
|
||||
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"name": "Cancer",
|
||||
"alias": "cancer",
|
||||
"description": "",
|
||||
"keywords": [],
|
||||
"priority": 0,
|
||||
"providers": [
|
||||
"Modules\\Cancer\\Providers\\CancerServiceProvider"
|
||||
],
|
||||
"files": []
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?php
|
||||
|
||||
return [
|
||||
'name' => 'Clinical Data'
|
||||
];
|
||||
+203
@@ -0,0 +1,203 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\AccountType;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class AccountTypeController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:account-types-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:create-account-types', ['only' => ['create','store','edit','update']]);
|
||||
$this->middleware('permission:view-account-type-details', ['only' => ['show']]);
|
||||
$this->middleware('permission:activate-account-types', ['only' => ['activate']]);
|
||||
$this->middleware('permission:de-activate-account-types', ['only' => ['inactive']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index() {
|
||||
$account_types = AccountType::orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
return view('clinical_data::account_types.index', compact('account_types'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create() {
|
||||
return view('clinical_data::account_types.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
//validation failed
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
// flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
|
||||
//validation passed
|
||||
$account_type = new AccountType;
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$account_type->name = $request->name;
|
||||
$account_type->description = $request->description;
|
||||
$account_type->created_by = $logged_in_user_id;
|
||||
$account_type->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$account_type->save();
|
||||
flash($request->name . " Account Type has been saved")->success();
|
||||
return redirect("/account_types/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id) {
|
||||
$account_type = AccountType::where(['id' => $id])->first();
|
||||
|
||||
if (!$account_type) {
|
||||
flash()->error("Account Type not found");
|
||||
return redirect('/account_types/');
|
||||
} else {
|
||||
return view('clinical_data::account_types.edit', compact('account_type'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
//validation failed
|
||||
|
||||
$string = "";
|
||||
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
|
||||
// flash($string)->error();
|
||||
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
//validation passed
|
||||
$account_type = AccountType::find($id);
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$account_type->name = $request->name;
|
||||
$account_type->description = $request->description;
|
||||
$account_type->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$account_type->save();
|
||||
flash($request->name . " Account Type has been updated")->success();
|
||||
return redirect("/account_types/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$account_type = AccountType::find($id);
|
||||
|
||||
if ($account_type->delete()):
|
||||
flash("Account Type has been deleted.")->success();
|
||||
return redirect('/account_types/');
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive() {
|
||||
$account_types = AccountType::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
if (count($account_types) < 1) {
|
||||
flash()->error("There is no inactive account type");
|
||||
return redirect('/account_types/');
|
||||
} else {
|
||||
return view('clinical_data::account_types.inactive', compact('account_types'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id) {
|
||||
$account_type = AccountType::withTrashed()->find($id);
|
||||
|
||||
if ($account_type->restore()):
|
||||
flash("Account Type has been activated.")->success();
|
||||
return redirect('/account_types/inactive');
|
||||
endif;
|
||||
}
|
||||
|
||||
}
|
||||
+173
@@ -0,0 +1,173 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\AgeGroup;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class AgeGroupController extends Controller
|
||||
{
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:age-group-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:age-group-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:age-group-edit', ['only' => ['edit', 'update']]);
|
||||
$this->middleware('permission:age-group-delete', ['only' => ['destroy', 'inactive', 'activate']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$age_groups = AgeGroup::orderBy('name','asc')->paginate(50);
|
||||
|
||||
return view('clinical_data::age_groups.index', compact('age_groups'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('clinical_data::age_groups.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
$age_group = new AgeGroup;
|
||||
|
||||
$age_group->name = $request->name;
|
||||
$age_group->age_type = $request->age_type;
|
||||
$age_group->from_age = $request->from_age;
|
||||
$age_group->to_age = $request->to_age;
|
||||
$age_group->created_by = $logged_in_user_id;
|
||||
$age_group->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$age_group->save();
|
||||
flash($request->name . " Age Group has been saved")->success();
|
||||
return redirect("/age_groups/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$age_group = AgeGroup::where(['id' => $id])->first();
|
||||
|
||||
if (!$age_group) {
|
||||
flash()->error("There is no such Age Group");
|
||||
return redirect('/age_groups/');
|
||||
} else {
|
||||
return view('clinical_data::age_groups.edit', compact('age_group'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
$age_group = AgeGroup::find($id);
|
||||
|
||||
$age_group->name = $request->name;
|
||||
$age_group->age_type = $request->age_type;
|
||||
$age_group->from_age = $request->from_age;
|
||||
$age_group->to_age = $request->to_age;
|
||||
$age_group->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$age_group->save();
|
||||
flash($request->name . " Age Group has been updated")->success();
|
||||
return redirect("/age_groups/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$age_group = AgeGroup::find($id);
|
||||
|
||||
if ($age_group->delete()):
|
||||
flash("Age Group has been deleted.")->success();
|
||||
return redirect('/age_groups/');
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
*/
|
||||
public function inactive() {
|
||||
$age_groups = AgeGroup::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
if (count($age_groups) < 1) {
|
||||
flash()->error("There is no inactive age group");
|
||||
return redirect('/age_groups/');
|
||||
} else {
|
||||
return view('clinical_data::age_groups.inactive', compact('age_groups'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function activate($id) {
|
||||
$age_group= AgeGroup::withTrashed()->find($id);
|
||||
|
||||
if ($age_group->restore()):
|
||||
flash("Age Group has been activated.")->success();
|
||||
return redirect('/age_groups/inactive');
|
||||
endif;
|
||||
}
|
||||
|
||||
}
|
||||
+181
@@ -0,0 +1,181 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Streamline\Models\ChartOfAccount;
|
||||
use Streamline\Models\InpatientBedCategory;
|
||||
use Streamline\Models\WardBedStay;
|
||||
|
||||
class BedCategoriesController extends Controller {
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:bed_categories-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:bed_categories-detail', ['only' => ['show']]);
|
||||
$this->middleware('permission:bed_categories-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:bed_categories-edit', ['only' => ['edit', 'update']]);
|
||||
$this->middleware('permission:bed_categories-delete', ['only' => ['destroy']]);
|
||||
$this->middleware('permission:bed_categories-status', ['only' => ['activate, inactive']]);
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
*/
|
||||
public function index() {
|
||||
$bed_categories = InpatientBedCategory::orderBy('name', 'asc')->paginate(50);
|
||||
$bed_data = [];
|
||||
$bed_stays = WardBedStay::distinct('bed_category')->whereNotNull('bed_category')->get(['bed_category']);
|
||||
foreach ($bed_stays as $value) $bed_data[] = $value->bed_category;
|
||||
|
||||
return view('clinical_data::bed_categories.index',compact('bed_categories', 'bed_data'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
*/
|
||||
public function create() {
|
||||
$chart_of_accounts = ChartOfAccount::pluck('name', 'id')->prepend('-select-', '')->toArray();
|
||||
|
||||
$income_accounts = ChartOfAccount::where(['type' => 1])
|
||||
->orderBy('name', 'asc')->pluck('name', 'id')->toArray();
|
||||
$income_accounts = ['' => '- select -'] + $income_accounts;
|
||||
|
||||
return view('clinical_data::bed_categories.create', compact('chart_of_accounts', 'income_accounts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$bed_category = new InpatientBedCategory;
|
||||
$bed_category->name = $request->name;
|
||||
$bed_category->cost_type = $request->cost_type;
|
||||
$bed_category->cost_per_night = $request->cost_per_night;
|
||||
$bed_category->cost_first_night = $request->cost_first_night;
|
||||
$bed_category->to_night = $request->to_night;
|
||||
$bed_category->income_account = $request->income_account;
|
||||
$bed_category->cost_range = $request->cost_range;
|
||||
$bed_category->cost_after = $request->cost_after;
|
||||
$bed_category->available = $request->available;
|
||||
$bed_category->staff_in_charge = Auth::id();
|
||||
$bed_category->created_by = Auth::id();
|
||||
|
||||
try {
|
||||
$bed_category->save();
|
||||
flash('successfully saved bed category')->success();
|
||||
return redirect('bed_categories');
|
||||
} catch (\Exception $e) {
|
||||
flash('Error in saving bed category. Contact system admin')->error();
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
*/
|
||||
public function edit($id) {
|
||||
$inpatient_bed_category = InpatientBedCategory::where(['id' => $id])->first();
|
||||
$chart_of_accounts = ChartOfAccount::pluck('name', 'id')->prepend('-select-', '')->toArray();
|
||||
|
||||
if (!$inpatient_bed_category) {
|
||||
flash()->error("There is no such bed category");
|
||||
return redirect('/bed_categories/');
|
||||
} else {
|
||||
return view('clinical_data::bed_categories.edit', compact('inpatient_bed_category', 'chart_of_accounts'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$bed_category = InpatientBedCategory::find($id);
|
||||
$bed_category->name = $request->name;
|
||||
$bed_category->cost_type = $request->cost_type;
|
||||
$bed_category->cost_per_night = $request->cost_per_night;
|
||||
$bed_category->cost_first_night = $request->cost_first_night;
|
||||
$bed_category->to_night = $request->to_night;
|
||||
$bed_category->cost_range = $request->cost_range;
|
||||
$bed_category->income_account = $request->income_account;
|
||||
$bed_category->cost_after = $request->cost_after;
|
||||
$bed_category->available = $request->available;
|
||||
$bed_category->updated_by = Auth::id();
|
||||
|
||||
try {
|
||||
$bed_category->save();
|
||||
flash('successfully edited bed category')->success();
|
||||
return redirect('bed_categories');
|
||||
} catch (\Exception $e) {
|
||||
flash('Error in editing bed category. Contact system admin')->error();
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$inpatient_bed_category = InpatientBedCategory::find($id);
|
||||
|
||||
if ($inpatient_bed_category->delete()) {
|
||||
flash($inpatient_bed_category->name. ' inpatient bed category has been successfully deleted')->success();
|
||||
return redirect('bed_categories');
|
||||
}
|
||||
|
||||
flash('error occurred. Contact system admin')->error();
|
||||
return redirect()->back()->withInput();
|
||||
}
|
||||
|
||||
/*
|
||||
*Display inactive bed categories
|
||||
*/
|
||||
public function inactive() {
|
||||
$bed_categories = InpatientBedCategory::onlyTrashed()->orderBy('name','asc')->paginate(50);
|
||||
|
||||
if (empty($bed_categories)) {
|
||||
flash()->error("There is no inactive occupation");
|
||||
return redirect('/bed_categories/');
|
||||
} else {
|
||||
return view('clinical_data::bed_categories.inactive', compact('bed_categories'));
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* Activate an inactive inpatient bed category
|
||||
*/
|
||||
public function activate($id) {
|
||||
$bed_categories = InpatientBedCategory::withTrashed()->find($id);
|
||||
|
||||
try {
|
||||
$bed_categories->restore();
|
||||
flash("Bed Category has been activated.")->success();
|
||||
} catch (\Exception $e) {
|
||||
flash("Bed Category activation failed.")->success();
|
||||
}
|
||||
|
||||
return redirect('/inactive/bed_categories/');
|
||||
}
|
||||
}
|
||||
+298
@@ -0,0 +1,298 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Carbon\Carbon;
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\AccountType;
|
||||
use Streamline\Models\Banking;
|
||||
use Streamline\Models\ChartOfAccount;
|
||||
use Streamline\Models\ChartOfAccountSlug;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Streamline\Models\TrackReceipt;
|
||||
|
||||
class ChartOfAccountController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:chart-of-accounts-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:create-chart-of-accounts', ['only' => ['create','store','edit','update']]);
|
||||
$this->middleware('permission:view-chart-of-account-details', ['only' => ['show']]);
|
||||
$this->middleware('permission:activate-chart-of-accounts', ['only' => ['activate']]);
|
||||
$this->middleware('permission:de-activate-chart-of-accounts', ['only' => ['inactive']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index() {
|
||||
$chart_of_accounts = ChartOfAccount::orderBy('name', 'asc')->get();
|
||||
|
||||
$chart_of_accounts_list = ChartOfAccount::orderBy('name', 'asc')
|
||||
->pluck('name', 'id');
|
||||
|
||||
$account_types = DB::table('account_types')
|
||||
->orderBy('name', 'asc')
|
||||
->pluck('name', 'id');
|
||||
|
||||
return view('clinical_data::chart_of_accounts.index', compact('chart_of_accounts', 'chart_of_accounts_list', 'account_types'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create() {
|
||||
$chart_of_accounts_list = ChartOfAccount::orderBy('name', 'asc')
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
$chart_of_accounts_list = ['' => '- select -'] + $chart_of_accounts_list;
|
||||
|
||||
$account_types = AccountType::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
|
||||
|
||||
$coa_slugs = ChartOfAccountSlug::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
|
||||
$slugs = [];
|
||||
$slugs = [" " => "- Select -"];
|
||||
foreach ($coa_slugs as $key => $value) {
|
||||
$slug_item = str_replace("_", " ", $value);
|
||||
$slugs[$value] = $slug_item;
|
||||
}
|
||||
|
||||
return view('clinical_data::chart_of_accounts.create', compact('chart_of_accounts_list', 'account_types', 'slugs'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
//validation failed
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
|
||||
//validation passed
|
||||
$chart_of_account = new ChartOfAccount;
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$chart_of_account->name = $request->name;
|
||||
$chart_of_account->type = $request->type;
|
||||
$chart_of_account->description = $request->description;
|
||||
$chart_of_account->sub_account_of = $request->sub_account_of;
|
||||
$chart_of_account->balance = $request->balance ? $request->balance : 0;
|
||||
$chart_of_account->slug = str_replace(" ", "_", strtolower($chart_of_account->name));
|
||||
$chart_of_account->core = $request->core;
|
||||
$chart_of_account->created_by = $logged_in_user_id;
|
||||
$chart_of_account->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
|
||||
$chart_of_account->save();
|
||||
|
||||
$trans_id = generateReceiptNumberFromDB('Initial Bank Deposit');
|
||||
|
||||
if($request->type == '4'){
|
||||
capture_bank_record('DEPOSIT', Carbon::parse($request->opening_balance_date)->toDateTimeString(), $chart_of_account->id, 'Initial Deposit', ($request->opening_balance ? $request->opening_balance : 0),
|
||||
($request->opening_balance ? $request->opening_balance : 0), 0, 'Initial Deposit', $trans_id);
|
||||
/* capture_bank_record('DEPOSIT', Carbon::parse($current_balance_date=0)->toDateTimeString(), $chart_of_account->id, 'Current Balance', ($request->opening_balance ? $request->opening_balance : 0),
|
||||
($request->opening_balance ? $request->opening_balance : 0), 0, 'Current Balance', $trans_id_2); */
|
||||
}
|
||||
|
||||
flash($request->name . " Chart of Account has been saved")->success();
|
||||
return redirect("/chart_of_accounts/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id) {
|
||||
$chart_of_account = ChartOfAccount::where('id', $id)->first();
|
||||
|
||||
$chart_of_accounts_list = ChartOfAccount::orderBy('name', 'asc')
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
$chart_of_accounts_list = ['' => '- select -'] + $chart_of_accounts_list;
|
||||
|
||||
$account_types = AccountType::orderBy('name', 'asc')
|
||||
->pluck('name', 'id')
|
||||
->toArray();
|
||||
$account_types = ['' => '- select -'] + $account_types;
|
||||
|
||||
$coa_slugs = ChartOfAccountSlug::orderBy('name', 'asc')->pluck('name', 'id')->toArray();
|
||||
$slugs = [" " => "- Select -"];
|
||||
foreach ($coa_slugs as $key => $value) {
|
||||
$slug_item = str_replace("_", " ", $value);
|
||||
$slugs[$value] = $slug_item;
|
||||
}
|
||||
|
||||
if (!$chart_of_account) {
|
||||
flash()->error("Chart of Account not found");
|
||||
return redirect('/chart_of_accounts/');
|
||||
} else {
|
||||
return view('clinical_data::chart_of_accounts.edit', compact('chart_of_account', 'chart_of_accounts_list', 'account_types', 'slugs'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
//validation failed
|
||||
|
||||
$string = "";
|
||||
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
//validation passed
|
||||
$chart_of_account = ChartOfAccount::find($id);
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$chart_of_account->name = $request->name;
|
||||
$chart_of_account->type = $request->type ?? $chart_of_account->type;
|
||||
$chart_of_account->description = $request->description;
|
||||
$chart_of_account->sub_account_of = $request->sub_account_of ?? NULL;
|
||||
$chart_of_account->balance = $request->balance;
|
||||
$chart_of_account->core = $request->core ?? $chart_of_account->core;
|
||||
$chart_of_account->updated_by = $logged_in_user_id;
|
||||
if (!is_null($request->slug)) {
|
||||
$chart_of_account->slug = $request->slug;
|
||||
}
|
||||
|
||||
try {
|
||||
$initial_transaction = Banking::where(['bank' => $id, 'memo' => 'Initial Deposit'])
|
||||
->update([
|
||||
'account_balance' => $request->balance
|
||||
]);
|
||||
}catch (QueryException $_e){
|
||||
flash('Failed To Update Opening Bank Balance.')->error();
|
||||
}
|
||||
|
||||
try {
|
||||
$chart_of_account->save();
|
||||
flash($request->name . " Chart of Account has been updated")->success();
|
||||
return redirect("/chart_of_accounts/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$undeletable_core_chart_of_accounts = [];
|
||||
//check if the account is a core before allowing deletion
|
||||
$undeletable_core_chart_of_accounts = ChartOfAccount::where('core',1)->orderBy('id', 'asc')->pluck('id')->toArray();
|
||||
if (in_array($id, $undeletable_core_chart_of_accounts)) {
|
||||
flash('You can not delete this chart of accounts. It is a core chart of account used by the system')->error();
|
||||
return redirect()->back();
|
||||
}
|
||||
|
||||
//check if the account has any attached transaction without and not delete it
|
||||
//Table to check 1. banking, 2. Quotations, 3.payments, 4.patient_category_invoices
|
||||
//maybe checking many tables isn't the best idea.
|
||||
|
||||
$chart_of_account = ChartOfAccount::find($id);
|
||||
|
||||
if ($chart_of_account->delete()):
|
||||
flash("Chart of Account has been deleted.")->success();
|
||||
return redirect('/chart_of_accounts/');
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive() {
|
||||
$chart_of_accounts = ChartOfAccount::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->get();
|
||||
|
||||
$chart_of_accounts_list = ChartOfAccount::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->pluck('name', 'id');
|
||||
|
||||
$account_types = AccountType::orderBy('name', 'asc')
|
||||
->pluck('name', 'id');
|
||||
|
||||
if (count($chart_of_accounts) < 1) {
|
||||
flash()->error("There is no inactive chart_of_account");
|
||||
return redirect('/chart_of_accounts/');
|
||||
} else {
|
||||
// Log::info($chart_of_accounts);
|
||||
return view('clinical_data::chart_of_accounts.inactive', compact('chart_of_accounts', 'chart_of_accounts_list', 'account_types'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id) {
|
||||
$chart_of_account = ChartOfAccount::withTrashed()->find($id);
|
||||
|
||||
if ($chart_of_account->restore()):
|
||||
flash("Chart of Account has been activated.")->success();
|
||||
return redirect('/chart_of_accounts/inactive');
|
||||
endif;
|
||||
}
|
||||
|
||||
}
|
||||
+214
@@ -0,0 +1,214 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Contracts\View\View;
|
||||
use Illuminate\Http\RedirectResponse;
|
||||
use Illuminate\Http\Request;
|
||||
use Modules\ClinicalData\Services\Clinics\ClinicsServiceInterface;
|
||||
use Streamline\Models\Clinic;
|
||||
use Streamline\Models\Triage;
|
||||
use Streamline\Models\PatientEpisode;
|
||||
use Streamline\Services\StreamlineSetupServiceInterface;
|
||||
|
||||
class ClinicController extends Controller {
|
||||
|
||||
protected ClinicsServiceInterface $clinicService;
|
||||
protected StreamlineSetupServiceInterface $setupService;
|
||||
|
||||
public function __construct(ClinicsServiceInterface $clinicService, StreamlineSetupServiceInterface $setupService) {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:clinic-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:clinic-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:clinic-edit', ['only' => ['edit', 'update']]);
|
||||
$this->middleware('permission:clinic-delete', ['only' => ['destroy', 'inactive', 'activate']]);
|
||||
|
||||
$this->clinicService = $clinicService;
|
||||
$this->setupService = $setupService;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function index(): View
|
||||
{
|
||||
$clinics = Clinic::orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
$clinic_types = $this->clinicService->getClinicTypes();
|
||||
|
||||
$clinic_ids = PatientEpisode::distinct('clinic_id')->whereNotNull('clinic_id')->pluck('clinic_id', 'clinic_id')->toArray();
|
||||
$triage_clinics = Triage::distinct('clinic_allocation')->whereNotNull('clinic_allocation')->pluck('clinic_allocation', 'clinic_allocation')->toArray();
|
||||
foreach ($triage_clinics as $value) if(!empty($value) && !in_array($value,$clinic_ids)) $clinic_ids[$value] = $value;
|
||||
|
||||
return view('clinical_data::clinics.index', compact('clinics', 'clinic_types', 'clinic_ids'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return View
|
||||
*/
|
||||
public function create(): View
|
||||
{
|
||||
$clinics = $this->clinicService->getClinicsSeeder();
|
||||
$clinic_types = $this->clinicService->getClinicTypes();
|
||||
|
||||
return view('clinical_data::clinics.create',compact('clinics', 'clinic_types'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function store(Request $request): RedirectResponse
|
||||
{
|
||||
//validation passed
|
||||
|
||||
if (isset($request->skip)&& session()->has('streamline_setup')) {
|
||||
//update the streamline setup table with the new finished step
|
||||
$this->setupService->saveStep("clinics registration", 1);
|
||||
|
||||
return redirect("wards/create");
|
||||
} else {
|
||||
$createdClinic = $this->clinicService->createClinic($request->name, $request->clinic_type, $request->available);
|
||||
|
||||
if ($createdClinic) {
|
||||
flash($request->name . " Clinic has been saved")->success();
|
||||
} else {
|
||||
flash("An error occurred will saving the clinic")->error();
|
||||
}
|
||||
|
||||
//in case more clinics have been added during the initial setup
|
||||
if (session()->has('streamline_setup')) {
|
||||
if (isset($request->other_clinics)) {
|
||||
$other_clinics_array = $request->other_clinics;
|
||||
for ($i=0; $i < count($other_clinics_array) ; $i++) {
|
||||
$createdClinic = $this->clinicService->createClinic($other_clinics_array[$i]);
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($request->selected_clinics)) {
|
||||
$selected_clinics_array = $request->selected_clinics;
|
||||
$seeder_clinics = $this->clinicService->getClinicsSeeder();
|
||||
|
||||
for ($i=0; $i < count($selected_clinics_array) ; $i++) {
|
||||
$clinic_name = $seeder_clinics[$selected_clinics_array[$i]]["name"];
|
||||
$clinic_slug = $seeder_clinics[$selected_clinics_array[$i]]["slug"];
|
||||
$createdClinic = $this->clinicService->createClinic($clinic_name, $clinic_slug);
|
||||
}
|
||||
}
|
||||
|
||||
// update the streamline setup table with the new finished step
|
||||
$this->setupService->saveStep("clinics registration", 1);
|
||||
|
||||
flash("Clinics have been added")->success();
|
||||
|
||||
return redirect("wards/create");
|
||||
}
|
||||
|
||||
return redirect("/clinics/");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
*/
|
||||
public function edit($id): View | RedirectResponse
|
||||
{
|
||||
$clinic = $this->clinicService->getClinicById($id);
|
||||
$clinic_types = $this->clinicService->getClinicTypes();
|
||||
|
||||
if (!$clinic) {
|
||||
flash()->error("Clinic not found");
|
||||
return redirect('/clinics/');
|
||||
} else {
|
||||
return view('clinical_data::clinics.edit', compact('clinic', 'clinic_types'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param Request $request
|
||||
* @param int $id
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, int $id): RedirectResponse
|
||||
{
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
//validation passed
|
||||
$updated_clinic = $this->clinicService->editClinic($id, $request->name, $request->available, $request->clinic_type);
|
||||
|
||||
if ($updated_clinic) {
|
||||
flash($request->name . " clinic has been updated")->success();
|
||||
return redirect("/clinics/");
|
||||
} else {
|
||||
flash("An error occurred! Please try again later")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function destroy(int $id): RedirectResponse {
|
||||
$isClinicDeleted = $this->clinicService->deactivateClinic($id);
|
||||
|
||||
if ($isClinicDeleted) {
|
||||
flash("Clinic has been deleted.")->success();
|
||||
return redirect('/clinics/');
|
||||
} else {
|
||||
flash("An error occurred")->error();
|
||||
return redirect('/clinics/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return RedirectResponse|View
|
||||
*/
|
||||
public function inactive(): RedirectResponse|View {
|
||||
$clinics = Clinic::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
if (empty($clinics)) {
|
||||
flash()->error("There is no inactive clinic");
|
||||
return redirect('/clinics/');
|
||||
} else {
|
||||
return view('clinical_data::clinics.inactive', compact('clinics'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return RedirectResponse
|
||||
*/
|
||||
public function activate(int $id): RedirectResponse
|
||||
{
|
||||
$isClinicActive = $this->clinicService->activateClinic($id);
|
||||
|
||||
if($isClinicActive[0]){
|
||||
flash($isClinicActive[1])->success();
|
||||
} else {
|
||||
flash($isClinicActive[1])->error();
|
||||
}
|
||||
|
||||
return redirect('/clinics/inactive');
|
||||
}
|
||||
|
||||
}
|
||||
+83
@@ -0,0 +1,83 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class ClinicalDataController extends Controller {
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index() {
|
||||
return view('clinical_data::clinical_data.index');
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
}
|
||||
+192
@@ -0,0 +1,192 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Streamline\Models\Company;
|
||||
use Illuminate\Http\Request;
|
||||
|
||||
class CompanyController extends Controller
|
||||
{
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function index() {
|
||||
$companies = Company::orderBy('name', 'asc')->paginate(50);
|
||||
return view('clinical_data::companies.index', compact('companies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Contracts\View\Factory|\Illuminate\View\View
|
||||
*/
|
||||
public function create() {
|
||||
return view('clinical_data::companies.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
$company = new Company;
|
||||
|
||||
$company->name = $request->name;
|
||||
$company->contact = $request->contact;
|
||||
$company->slug = $request->identifier;
|
||||
$company->created_by = $logged_in_user_id;
|
||||
$company->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$company->save();
|
||||
flash($request->name . " Company has been saved")->success();
|
||||
return redirect("/companies/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function quick_store(Request $request) {
|
||||
|
||||
$company = new Company;
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
$company->name = $request->name;
|
||||
$company->contact = $request->contact;
|
||||
$company->slug = $request->slug;
|
||||
$company->created_by = $logged_in_user_id;
|
||||
$company->updated_by = $logged_in_user_id;
|
||||
|
||||
if($company->save()){
|
||||
return 'success';
|
||||
}else{
|
||||
return 'fail';
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
public function edit($id) {
|
||||
$company = Company::where(['id' => $id])->first();
|
||||
|
||||
if (!$company) {
|
||||
flash()->error("There is no such Company");
|
||||
return redirect('/companies/');
|
||||
} else {
|
||||
return view('clinical_data::companies.edit', compact('company'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$company = Company::find($id);
|
||||
$company->name = $request->name;
|
||||
$company->contact = $request->contact;
|
||||
$company->slug = $request->slug;
|
||||
$company->created_by = $logged_in_user_id;
|
||||
$company->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$company->save();
|
||||
flash($request->name . " Company has been updated")->success();
|
||||
return redirect("/companies/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$company = Company::find($id);
|
||||
|
||||
if ($company->delete()):
|
||||
flash("Company has been deleted.")->success();
|
||||
return redirect('/companies/');
|
||||
endif;
|
||||
}
|
||||
|
||||
|
||||
public function inactive() {
|
||||
|
||||
$companies = Company::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
if (count($companies) < 1) {
|
||||
flash()->error("There is no inactive Company");
|
||||
return redirect('/companies/');
|
||||
} else {
|
||||
return view('clinical_data::companies.inactive', compact('companies'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\RedirectResponse|\Illuminate\Routing\Redirector
|
||||
*/
|
||||
public function activate($id) {
|
||||
$company = Company::withTrashed()->find($id);
|
||||
|
||||
if ($company->restore()):
|
||||
flash("Company has been activated.")->success();
|
||||
return redirect('/companies/inactive');
|
||||
endif;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Foundation\Bus\DispatchesJobs;
|
||||
use Illuminate\Routing\Controller as BaseController;
|
||||
use Illuminate\Foundation\Validation\ValidatesRequests;
|
||||
use Illuminate\Foundation\Auth\Access\AuthorizesRequests;
|
||||
|
||||
class Controller extends BaseController
|
||||
{
|
||||
use AuthorizesRequests, DispatchesJobs, ValidatesRequests;
|
||||
}
|
||||
@@ -0,0 +1,197 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Streamline\Models\Country;
|
||||
|
||||
class CountriesController extends Controller
|
||||
{
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:countries-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:countries-detail', ['only' => ['show']]);
|
||||
$this->middleware('permission:countries-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:countries-edit', ['only' => ['edit', 'edit_all', 'update', 'update_all', 'updatePatientEpisode']]);
|
||||
$this->middleware('permission:countries-delete', ['only' => ['destroy']]);
|
||||
$this->middleware('permission:countries-status', ['only' => ['activate, inactive']]);
|
||||
}
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$countries = Country::orderBy('name', 'asc')->paginate(50);
|
||||
|
||||
return view('clinical_data::countries.index', compact('countries'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('clinical_data::countries.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails())
|
||||
{
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
}
|
||||
|
||||
else {
|
||||
$country = new Country;
|
||||
|
||||
$country->name = $request->name;
|
||||
$country->created_by = Auth::user()->id;
|
||||
$country->updated_by = Auth::user()->id;
|
||||
|
||||
try {
|
||||
$country->save();
|
||||
flash($request->name . " Country has been saved")->success();
|
||||
return redirect("/countries/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$country = Country::where(['id' => $id])->first();
|
||||
|
||||
if (!$country) {
|
||||
flash()->error("There is no such country");
|
||||
return redirect('/countries/');
|
||||
} else {
|
||||
return view('clinical_data::countries.edit', compact('country'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
*/
|
||||
public function update(Request $request, Country $countries)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
//flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$country = Country::find($id);
|
||||
$country->name = $request->name;
|
||||
$country->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$country->save();
|
||||
flash($request->name . " Country has been updated")->success();
|
||||
return redirect("/countries/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$country = Country::find($id);
|
||||
|
||||
if ($country->delete()):
|
||||
flash("Country has been deleted.")->success();
|
||||
return redirect('/countries/');
|
||||
endif;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive()
|
||||
{
|
||||
$countries = Country::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
if (count($countries) < 1) {
|
||||
flash()->error("There is no inactive country");
|
||||
return redirect('/countries/');
|
||||
} else {
|
||||
return view('clinical_data::countries.inactive', compact('countries'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id)
|
||||
{
|
||||
$country = Country::withTrashed()->find($id);
|
||||
|
||||
if ($country->restore()):
|
||||
flash("Country has been activated.")->success();
|
||||
return redirect('/countries/inactive');
|
||||
endif;
|
||||
}
|
||||
|
||||
}
|
||||
+200
@@ -0,0 +1,200 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Database\QueryException;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Streamline\Models\County;
|
||||
use Streamline\Models\District;
|
||||
|
||||
class CountyController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:county-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:county-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:county-edit', ['only' => ['edit', 'update']]);
|
||||
$this->middleware('permission:county-delete', ['only' => ['destroy', 'inactive', 'activate']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index() {
|
||||
$counties = County::orderBy('name', 'asc')->get();
|
||||
|
||||
$districts = District::pluck('name', 'id');
|
||||
|
||||
return view('clinical_data::counties.index', compact('counties', 'districts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create() {
|
||||
$districts = District::pluck('name', 'id')->toArray();
|
||||
|
||||
$districts = ['' => '- select -'] + $districts;
|
||||
|
||||
return view('clinical_data::counties.create', compact('districts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'district_id' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
|
||||
}else{
|
||||
|
||||
$user_id = Auth::user()->id;
|
||||
$county = new County;
|
||||
|
||||
$county->name = $request->name;
|
||||
$county->district_id = $request->district_id;
|
||||
$county->created_by = $user_id;
|
||||
$county->updated_by = $user_id;
|
||||
|
||||
try {
|
||||
$county->save();
|
||||
flash($request->name . " County has been saved")->success();
|
||||
return redirect("/counties/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id) {
|
||||
$county = County::where(['id' => $id])->first();
|
||||
|
||||
$districts = District::pluck('name', 'id')->toArray();
|
||||
|
||||
$districts = ['' => '- select -'] + $districts;
|
||||
|
||||
if (!$county) {
|
||||
flash()->error("That county is not registered");
|
||||
return redirect('/counties/');
|
||||
} else {
|
||||
return view('clinical_data::counties.edit', compact('county', 'districts'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
request()->validate([
|
||||
'name' => 'required',
|
||||
'district_id' => 'required'
|
||||
]);
|
||||
|
||||
$county = County::find($id);
|
||||
|
||||
$county->name = $request->name;
|
||||
$county->district_id = $request->district_id;
|
||||
$county->updated_by = Auth::user()->id;
|
||||
|
||||
try {
|
||||
$county->save();
|
||||
flash($request->name . " County has been updated")->success();
|
||||
return redirect("/counties/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$county = County::find($id);
|
||||
|
||||
if ($county->delete()) {
|
||||
flash("County has been deleted.")->success();
|
||||
return redirect('/counties/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive() {
|
||||
$counties = County::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->get();
|
||||
|
||||
$districts = District::pluck('name', 'id');
|
||||
|
||||
if (count($counties) < 1) {
|
||||
flash()->error("There is no inactive counties");
|
||||
return redirect('/counties/');
|
||||
} else {
|
||||
return view('clinical_data::counties.inactive', compact('counties', 'districts'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id) {
|
||||
$county = County::withTrashed()->find($id);
|
||||
|
||||
if($county->restore()){
|
||||
flash("County has been activated.")->success();
|
||||
return redirect('/counties/inactive');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+263
@@ -0,0 +1,263 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\Department;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class DepartmentController extends Controller
|
||||
{
|
||||
|
||||
public function __construct()
|
||||
{
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:departments-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:departments-detail', ['only' => ['show']]);
|
||||
$this->middleware('permission:departments-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:departments-edit', ['only' => ['edit', 'edit_all', 'update', 'update_all', 'updatePatientEpisode']]);
|
||||
$this->middleware('permission:departments-delete', ['only' => ['destroy']]);
|
||||
$this->middleware('permission:departments-status', ['only' => ['activate, inactive']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index()
|
||||
{
|
||||
$departments = Department::orderBy('name', 'asc')->paginate(50);
|
||||
|
||||
return view('clinical_data::departments.index', compact('departments'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create()
|
||||
{
|
||||
return view('clinical_data::departments.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
$department = new Department;
|
||||
|
||||
$department->name = $request->name;
|
||||
$department->created_by = $logged_in_user_id;
|
||||
$department->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$department->save();
|
||||
flash($request->name . " Department has been saved")->success();
|
||||
return redirect("/departments/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id)
|
||||
{
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id)
|
||||
{
|
||||
$department = Department::where(['id' => $id])->first();
|
||||
|
||||
if (!$department) {
|
||||
flash()->error("There is no such department");
|
||||
return redirect('/departments/');
|
||||
} else {
|
||||
return view('clinical_data::departments.edit', compact('department'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
// flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$department = Department::find($id);
|
||||
$department->name = $request->name;
|
||||
$department->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$department->save();
|
||||
flash($request->name . " Department has been updated")->success();
|
||||
return redirect("/departments/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id)
|
||||
{
|
||||
$department = Department::find($id);
|
||||
|
||||
if ($department->delete()):
|
||||
flash("Department has been deleted.")->success();
|
||||
return redirect('/departments/');
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive()
|
||||
{
|
||||
$departments = Department::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
if (count($departments) < 1) {
|
||||
flash()->error("There is no inactive department");
|
||||
return redirect('/departments/');
|
||||
} else {
|
||||
return view('clinical_data::departments.inactive', compact('departments'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id)
|
||||
{
|
||||
$department = Department::withTrashed()->find($id);
|
||||
|
||||
if ($department->restore()):
|
||||
flash("Department has been activated.")->success();
|
||||
return redirect('/departments/inactive');
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the active resources for bulk editing.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit_all()
|
||||
{
|
||||
$departments = Department::orderBy('name', 'asc')->paginate(25);
|
||||
|
||||
if (count($departments) < 1) {
|
||||
flash()->error("There is no active department");
|
||||
return redirect('/departments/');
|
||||
} else {
|
||||
return view('clinical_data::departments.edit.all', compact('departments'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the resources in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update_all(Request $request)
|
||||
{
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
// flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$id_array = $request->id;
|
||||
$name_array = $request->name;
|
||||
|
||||
for ($x = 0; $x < count($id_array); $x++):
|
||||
$department = Department::find($id_array[$x]);
|
||||
|
||||
$department->name = $name_array[$x];
|
||||
$department->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$department->save();
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
endfor;
|
||||
|
||||
flash("Departments have been updated")->success();
|
||||
return redirect("/departments/");
|
||||
}
|
||||
}
|
||||
}
|
||||
+495
@@ -0,0 +1,495 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\Diagnosis;
|
||||
use Streamline\Models\Consultation;
|
||||
use Streamline\Models\InpatientInfo;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
use Streamline\Models\DiagnosisCategory;
|
||||
use Streamline\Models\InsuranceTariff;
|
||||
use Streamline\Models\HmisCategory;
|
||||
use Streamline\Models\HmisCategoryOptions;
|
||||
|
||||
class DiagnosisController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:diagnosis-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:diagnosis-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:diagnosis-edit', ['only' => ['edit', 'update', 'edit_all', 'update_all']]);
|
||||
$this->middleware('permission:diagnosis-delete', ['only' => ['destroy', 'inactive', 'activate']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
*/
|
||||
public function index() {
|
||||
$diagnoses = Diagnosis::orderBy('name', 'asc')->leftJoin('hmis_category_options as h', 'h.id', 'diagnoses.hmis_no_inpatient')
|
||||
->select('diagnoses.*', 'h.number as inpatient_number')
|
||||
->paginate(10000);
|
||||
|
||||
$hmis_categories = DB::table('hmis_categories')
|
||||
->orderBy('title', 'asc')
|
||||
->pluck('title', 'id');
|
||||
|
||||
$issued_diagnoses = [];
|
||||
$hmis_category_options = HmisCategoryOptions::orderBy('name', 'asc')->pluck('name', 'id');
|
||||
$consultations_primary = Consultation::distinct('primary_diagnosis')->select('primary_diagnosis');
|
||||
$inpatient_primary = InpatientInfo::distinct('primary_diagnosis')->select('primary_diagnosis')->union($consultations_primary)->get()->toArray();
|
||||
foreach($inpatient_primary as $diagnosis) if(!in_array($diagnosis['primary_diagnosis'], $issued_diagnoses) && !empty($diagnosis['primary_diagnosis'])) $issued_diagnoses[]=$diagnosis['primary_diagnosis'];
|
||||
$consultations_other = Consultation::distinct('other_diagnoses')->select('other_diagnoses');
|
||||
$inpatient_other = InpatientInfo::distinct('other_diagnoses')->select('other_diagnoses')->union($consultations_other)->get();
|
||||
foreach($inpatient_other as $diagnosis_other) {
|
||||
$other_diagnoses = unserialize($diagnosis_other->other_diagnoses);
|
||||
if(!empty($other_diagnoses)) foreach($other_diagnoses as $other_diagnosis) if(!in_array(intval($other_diagnosis), $issued_diagnoses)) $issued_diagnoses[]= intval($other_diagnosis);
|
||||
}
|
||||
|
||||
return view('clinical_data::diagnoses.index', compact('diagnoses', 'hmis_categories','issued_diagnoses', 'hmis_category_options'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
*/
|
||||
public function create() {
|
||||
$hmis_categories = DB::table('hmis_categories')->whereIn('section_number',[6,7,1])->orderBy('title', 'asc')->get();
|
||||
$inpatient_hmis_categories = $hmis_categories->filter(function($hmis_category){
|
||||
return $hmis_category->type == 1;
|
||||
})->pluck('title', 'id')->prepend('- Select HMIS Inpatient Category -', '');
|
||||
$outpatient_hmis_categories = $hmis_categories->filter(function($hmis_category){
|
||||
return $hmis_category->type == 0;
|
||||
})->pluck('title', 'id')->prepend('- Select HMIS Outpatient Category -', '');
|
||||
|
||||
$parent_categories = array_unique(HmisCategoryOptions::where('parent_option', '<>','')->pluck('parent_option')->toArray());
|
||||
$diagnosis_categories = DiagnosisCategory::orderBy('name', 'asc')->pluck('name', 'id')->prepend('None', 0);
|
||||
|
||||
$insurance_tariffs = DB::table('insurance_tariffs')->whereNull('deleted_at')->pluck('name', 'id')->toArray();
|
||||
|
||||
return view('clinical_data::diagnoses.create', compact('hmis_categories', 'insurance_tariffs','parent_categories', 'inpatient_hmis_categories', 'outpatient_hmis_categories', 'diagnosis_categories'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
request()->validate([
|
||||
'name' => 'required|unique:diagnoses'
|
||||
]);
|
||||
|
||||
$logged_in_user_id = Auth()->user()->id;
|
||||
$diagnosis = new Diagnosis;
|
||||
|
||||
//Reference Names
|
||||
$reference_names_array = $request->reference_names;
|
||||
$reference_names = "";
|
||||
|
||||
//Processing reference areas
|
||||
$reference_areas_array = $request->reference_areas;
|
||||
$reference_areas = "";
|
||||
|
||||
if ($request->insurance_tariffs) {
|
||||
$diagnosis->insurance_tariffs = implode(",", $request->insurance_tariffs);
|
||||
}
|
||||
|
||||
for ($x = 0; $x < count($reference_areas_array); $x++):
|
||||
$reference_area = $reference_areas_array[$x];
|
||||
$reference_area_data = parse_url($reference_area);
|
||||
if (empty($reference_area_data['scheme'])):
|
||||
$reference_area = 'http://' . ltrim($reference_area, '/');
|
||||
endif;
|
||||
|
||||
$reference_areas .= $reference_area . ",";
|
||||
$reference_names .= rtrim($reference_names_array[$x], ", ") . ",";
|
||||
endfor;
|
||||
if (!empty($request->district_code) && $request->outpatient_hmis_category_option == '655') {
|
||||
$district_code = HmisCategoryOptions::updateOrCreate(['name' => $request->district_code,'number' => 'Code', 'hmis_category_id' => 0],[
|
||||
'name' => $request->district_code,
|
||||
'number' => 'Code',
|
||||
'hmis_category_id' => 0,
|
||||
'parent_option' => $request->outpatient_hmis_category_option,
|
||||
'created_by' => Auth()->user()->id
|
||||
]);
|
||||
}
|
||||
|
||||
$diagnosis->name = $request->name;
|
||||
$diagnosis->icd10_code = $request->icd10_code;
|
||||
$diagnosis->available = $request->available;
|
||||
// $diagnosis->hmis_no_outpatient = $request->hmis_no_outpatient;
|
||||
$diagnosis->hmis_no_inpatient = $request->hmis_no_inpatient;
|
||||
$diagnosis->prompts = $request->prompts;
|
||||
$diagnosis->diagnosis_category = $request->diagnosis_category?? null;
|
||||
$diagnosis->chronic_status = $request->chronic_status;
|
||||
$diagnosis->reference_areas = rtrim($reference_areas, ", ");
|
||||
$diagnosis->reference_names = rtrim($reference_names, ", ");
|
||||
$diagnosis->hmis_category = $request->hmis_category;
|
||||
$diagnosis->dependent_option = $request->parent_dependent_option ?? null;
|
||||
$diagnosis->outpatient_hmis_category = $request->outpatient_hmis_category ?? null;
|
||||
$diagnosis->outpatient_hmis_category_option = $request->outpatient_hmis_category_option ?? null;
|
||||
if(!empty($district_code->id)) $diagnosis->outpatient_dependent_option = $district_code->id;
|
||||
else $diagnosis->outpatient_dependent_option = $request->outpatient_dependent_option ?? null;
|
||||
$diagnosis->created_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$diagnosis->save();
|
||||
|
||||
if ($request->insurance_tariffs) {
|
||||
// add diagnoses to the tariffs
|
||||
foreach ($request->insurance_tariffs as $tariff_id) {
|
||||
try {
|
||||
$tariff = InsuranceTariff::find($tariff_id);
|
||||
|
||||
if ($tariff->linked_diagnoses) {
|
||||
$current_diagnoses = explode(",", $tariff->linked_diagnoses);
|
||||
$current_diagnoses = array_merge($current_diagnoses, $diagnosis->id);
|
||||
} else {
|
||||
$current_diagnoses = [$diagnosis->id];
|
||||
}
|
||||
|
||||
$tariff->linked_diagnoses = implode(",", $current_diagnoses);
|
||||
$tariff->save();
|
||||
|
||||
} catch (\Exception $exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
flash($request->name . " Diagnosis has been saved")->success();
|
||||
return redirect("/diagnoses/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred!")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
*/
|
||||
public function edit($id) {
|
||||
$diagnosis = Diagnosis::findOrFail($id);
|
||||
$hmis_categories = HmisCategory::whereIn('section_number',[6,7,1])->orderBy('title', 'asc')->get();
|
||||
$diagnosis_categories = DiagnosisCategory::orderBy('name', 'asc')->pluck('name', 'id')->prepend('None', 0);
|
||||
$parent_categories = array_unique(HmisCategoryOptions::where('parent_option', '<>','')->pluck('parent_option')->toArray());
|
||||
$insurance_tariffs = DB::table('insurance_tariffs')->whereNull('deleted_at')->pluck('name', 'id')->toArray();
|
||||
|
||||
$inpatient_category_options_header = (!empty($diagnosis->hmis_no_inpatient) || $diagnosis->hmis_no_inpatient == '-')? '- Select HMIS Inpatient Category Option -': '- Firstly, Select HMIS Inpatient Category -';
|
||||
$outpatient_category_options_header = !empty($diagnosis->outpatient_hmis_category)? '- Select HMIS Outpatient Category Option -': '- Firstly, Select HMIS Outpatient Category -';
|
||||
$dependent_options_header = '- Select Dependent Option -';$inpatient_category_options = $outpatient_dependent_options = $dependent_options = $outpatient_category_options =[];
|
||||
if(!empty($diagnosis->hmis_no_inpatient) || $diagnosis->hmis_no_inpatient == '-') $inpatient_category_options = HmisCategoryOptions::where('hmis_category_id', $diagnosis->hmis_category)->pluck('name','id')->prepend($inpatient_category_options_header, '');
|
||||
if(!empty($diagnosis->outpatient_hmis_category)) $outpatient_category_options = HmisCategoryOptions::where('hmis_category_id', $diagnosis->outpatient_hmis_category)->pluck('name','id')->prepend($outpatient_category_options_header, '');
|
||||
if(!empty($diagnosis->hmis_no_inpatient) || $diagnosis->hmis_no_inpatient == '-' || in_array($diagnosis->hmis_no_inpatient, $parent_categories)) $dependent_options = HmisCategoryOptions::where('parent_option', $diagnosis->hmis_no_inpatient)->pluck('name','id')->prepend($dependent_options_header, '');
|
||||
if(!empty($diagnosis->outpatient_hmis_category_option) || in_array($diagnosis->outpatient_hmis_category_option, $parent_categories)) $outpatient_dependent_options = HmisCategoryOptions::where('parent_option', $diagnosis->outpatient_hmis_category_option)->pluck('name','id')->prepend($dependent_options_header, '');
|
||||
$inpatient_hmis_categories = $hmis_categories->filter(function($hmis_category){
|
||||
return $hmis_category->type == 1;
|
||||
})->pluck('title', 'id')->prepend('- Select HMIS Inpatient Category -', '');
|
||||
$outpatient_hmis_categories = $hmis_categories->filter(function($hmis_category){
|
||||
return $hmis_category->type == 0;
|
||||
})->pluck('title', 'id')->prepend('- Select HMIS Outpatient Category -', '');
|
||||
|
||||
return view('clinical_data::diagnoses.edit', compact('diagnosis', 'inpatient_hmis_categories', 'insurance_tariffs', 'outpatient_hmis_categories', 'outpatient_category_options', 'diagnosis_categories', 'inpatient_category_options', 'dependent_options', 'parent_categories', 'outpatient_dependent_options'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
request()->validate([
|
||||
'name' => 'required|unique:diagnoses,name,'.$id
|
||||
]);
|
||||
|
||||
$logged_in_user_id = Auth()->user()->id;
|
||||
|
||||
//Reference Names
|
||||
$reference_names_array = $request->reference_names;
|
||||
$reference_names = "";
|
||||
|
||||
//Processing reference areas
|
||||
$reference_areas_array = $request->reference_areas;
|
||||
$reference_areas = "";
|
||||
|
||||
if (!empty($reference_areas_array)) {
|
||||
for ($x = 0; $x < count($reference_areas_array); $x++):
|
||||
$reference_area = $reference_areas_array[$x];
|
||||
$reference_area_data = parse_url($reference_area);
|
||||
if (empty($reference_area_data['scheme'])):
|
||||
$reference_area = 'http://' . ltrim($reference_area, '/');
|
||||
endif;
|
||||
|
||||
$reference_areas .= $reference_area . ",";
|
||||
$reference_names .= rtrim($reference_names_array[$x], ", ") . ",";
|
||||
endfor;
|
||||
}
|
||||
|
||||
if (!empty($request->district_code) && $request->outpatient_hmis_category_option == '655') {
|
||||
$district_code = HmisCategoryOptions::updateOrCreate(['id' => $request->district_code_id,'number' => 'Code', 'hmis_category_id' => 0],[
|
||||
// 'id'=>$hmis_category_option['id'],
|
||||
'name' => $request->district_code,
|
||||
'number' => 'Code',
|
||||
'hmis_category_id' => 0,
|
||||
'parent_option' => $request->outpatient_hmis_category_option,
|
||||
'created_by' => Auth()->user()->id
|
||||
]);
|
||||
}
|
||||
|
||||
$diagnosis = Diagnosis::find($id);
|
||||
$diagnosis->name = $request->name;
|
||||
$diagnosis->icd10_code = $request->icd10_code;
|
||||
$diagnosis->available = $request->available;
|
||||
// $diagnosis->hmis_no_outpatient = $request->hmis_no_outpatient;
|
||||
$diagnosis->hmis_no_inpatient = $request->hmis_no_inpatient;
|
||||
$diagnosis->prompts = $request->prompts;
|
||||
$diagnosis->chronic_status = $request->chronic_status;
|
||||
$diagnosis->reference_areas = rtrim($reference_areas, ", ");
|
||||
$diagnosis->reference_names = rtrim($reference_names, ", ");
|
||||
$diagnosis->hmis_category = $request->hmis_category;
|
||||
$diagnosis->diagnosis_category = $request->diagnosis_category?? null;
|
||||
$diagnosis->dependent_option = $request->parent_dependent_option ?? null;
|
||||
$diagnosis->outpatient_hmis_category = $request->outpatient_hmis_category ?? null;
|
||||
$diagnosis->outpatient_hmis_category_option = $request->outpatient_hmis_category_option ?? null;
|
||||
if(!empty($district_code->id) && $request->outpatient_hmis_category_option == '655') $diagnosis->outpatient_dependent_option = $district_code->id;
|
||||
else $diagnosis->outpatient_dependent_option = $request->outpatient_dependent_option ?? null;
|
||||
$diagnosis->updated_by = $logged_in_user_id;
|
||||
|
||||
if ($request->insurance_tariffs) {
|
||||
$original_tariffs = explode(",", $diagnosis->insurance_tariffs);
|
||||
$diagnosis->insurance_tariffs = implode(",", $request->insurance_tariffs);
|
||||
|
||||
$removed_tariffs = array_diff($original_tariffs, $request->insurance_tariffs);
|
||||
$added_tariffs = array_diff($request->insurance_tariffs, $original_tariffs);
|
||||
|
||||
// add diagnoses to the tariffs
|
||||
foreach ($added_tariffs as $tariff_id) {
|
||||
try {
|
||||
$tariff = InsuranceTariff::find($tariff_id);
|
||||
|
||||
if ($tariff->linked_diagnoses) {
|
||||
$current_diagnoses = explode(",", $tariff->linked_diagnoses);
|
||||
$current_diagnoses = array_merge($current_diagnoses, $diagnosis->id);
|
||||
} else {
|
||||
$current_diagnoses = [$diagnosis->id];
|
||||
}
|
||||
|
||||
$tariff->linked_diagnoses = implode(",", $current_diagnoses);
|
||||
$tariff->save();
|
||||
|
||||
} catch (\Exception $exception) {}
|
||||
}
|
||||
|
||||
// remove diagnosis from tariffs
|
||||
foreach ($removed_tariffs as $tariff_id) {
|
||||
try {
|
||||
$tariff = InsuranceTariff::find($tariff_id);
|
||||
$current_diagnoses = explode(",", $tariff->linked_diagnoses);
|
||||
|
||||
if (in_array($diagnosis->id, $current_diagnoses)) {
|
||||
unset($current_diagnoses[array_search($diagnosis->id, $current_diagnoses)]);
|
||||
|
||||
$tariff->linked_diagnoses = implode(",", $current_diagnoses);
|
||||
$tariff->save();
|
||||
}
|
||||
} catch (\Exception $exception) {}
|
||||
}
|
||||
}
|
||||
|
||||
try {
|
||||
$diagnosis->save();
|
||||
flash($request->name . " Diagnosis has been updated")->success();
|
||||
return redirect("/diagnoses/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred!")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$diagnosis = Diagnosis::find($id);
|
||||
|
||||
if ($diagnosis->delete()){
|
||||
flash("Diagnosis has been deleted.")->success();
|
||||
return redirect('/diagnoses/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive() {
|
||||
$diagnoses = Diagnosis::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
$hmis_categories = DB::table('hmis_categories')
|
||||
->orderBy('title', 'asc')
|
||||
->pluck('title', 'id');
|
||||
|
||||
if (empty($diagnoses)) {
|
||||
flash()->error("There is no inactive diagnosis");
|
||||
return redirect('/diagnoses/');
|
||||
} else {
|
||||
return view('clinical_data::diagnoses.inactive', compact('diagnoses', 'hmis_categories'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id) {
|
||||
$diagnosis = Diagnosis::withTrashed()->find($id);
|
||||
|
||||
if ($diagnosis->restore()){
|
||||
flash("Diagnosis has been activated.")->success();
|
||||
return redirect('/diagnoses/inactive');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the active resources for bulk editing.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit_all() {
|
||||
$diagnoses = Diagnosis::orderBy('name', 'asc')
|
||||
->get();
|
||||
|
||||
$hmis_categories = DB::table('hmis_categories')
|
||||
->pluck('title', 'id')
|
||||
->toArray();
|
||||
|
||||
$hmis_categories = ['' => '- select -'] + $hmis_categories;
|
||||
|
||||
if (count($diagnoses) < 1) {
|
||||
flash()->error("There is no active diagnosis");
|
||||
return redirect('/diagnoses/');
|
||||
} else {
|
||||
return view('clinical_data::diagnoses.edit.all', compact('diagnoses', 'hmis_categories'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update all the resources in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update_all(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
// flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth()->user()->id;
|
||||
|
||||
$id_array = $request->id;
|
||||
$name_array = $request->name;
|
||||
$icd10_code_array = $request->icd10_code;
|
||||
$hmis_no_outpatient_array = $request->hmis_no_outpatient;
|
||||
$hmis_no_inpatient_array = $request->hmis_no_inpatient;
|
||||
$prompts_array = $request->prompts;
|
||||
$chronic_status_array = $request->chronic_status;
|
||||
$reference_areas_array = $request->reference_areas;
|
||||
$reference_names_array = $request->reference_names;
|
||||
$hmis_category_array = $request->hmis_category;
|
||||
|
||||
for ($x = 0; $x < count($id_array); $x++):
|
||||
$diagnosis = Diagnosis::find($id_array[$x]);
|
||||
|
||||
$diagnosis->name = $name_array[$x];
|
||||
$diagnosis->icd10_code = $icd10_code_array[$x];
|
||||
$diagnosis->hmis_no_outpatient = $hmis_no_outpatient_array[$x];
|
||||
$diagnosis->hmis_no_inpatient = $hmis_no_inpatient_array[$x];
|
||||
$diagnosis->prompts = $prompts_array[$x];
|
||||
$diagnosis->chronic_status = $chronic_status_array[$x];
|
||||
$diagnosis->reference_areas = rtrim($reference_areas_array[$x], ", ");
|
||||
$diagnosis->reference_names = rtrim($reference_names_array[$x], ", ");
|
||||
$diagnosis->hmis_category = $hmis_category_array[$x];
|
||||
$diagnosis->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$diagnosis->save();
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
endfor;
|
||||
|
||||
flash("Diagnoses have been updated")->success();
|
||||
return redirect("/diagnoses/");
|
||||
}
|
||||
}
|
||||
|
||||
public function get_diagnosis(Request $request) {
|
||||
$diagnosis_id = $request->diagnosis_id;
|
||||
$diagnosis = Diagnosis::where('id', $diagnosis_id)->first();
|
||||
|
||||
$reference_areas_array = explode(",", $diagnosis->reference_areas);
|
||||
$reference_names_array = explode(",", $diagnosis->reference_names);
|
||||
|
||||
$prompt = empty($diagnosis->prompts) ? " " : $diagnosis->prompts;
|
||||
|
||||
$links = "";
|
||||
|
||||
for ($x = 0; $x < count($reference_areas_array); $x++) {
|
||||
if (isset($reference_areas_array[$x]) && isset($reference_names_array[$x])){
|
||||
$links .= "<a href='" . $reference_areas_array[$x] . "' target='_blank' >" . $reference_names_array[$x] . "</a> <span style='color: red'> | </span>";
|
||||
}
|
||||
}
|
||||
|
||||
return $prompt . "&&" . $links;
|
||||
}
|
||||
|
||||
public function get_diagnosis_by_category($category){
|
||||
$code = "<option> - select - </option>";
|
||||
$diagnoses = Diagnosis::where('diagnosis_category', $category)->orderBy('name', 'asc')->get();
|
||||
foreach ($diagnoses as $diagnosis) {
|
||||
$code .= "<option value='" . $diagnosis->id . "'>" . $diagnosis->name . "</option>";
|
||||
}
|
||||
$code .= "</select>";
|
||||
return $code;
|
||||
}
|
||||
|
||||
public function get_diagnosis_categories(){
|
||||
$diagnoses = DiagnosisCategory::all();
|
||||
$code = "<option> - select - </option>";
|
||||
foreach ($diagnoses as $diagnosis) {
|
||||
$code .= "<option value='" . $diagnosis->id . "'>" . $diagnosis->name . "</option>";
|
||||
}
|
||||
$code .= "</select>";
|
||||
return $code;
|
||||
}
|
||||
|
||||
}
|
||||
+142
@@ -0,0 +1,142 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\District;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class DistrictController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:district-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:district-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:district-edit', ['only' => ['edit', 'update']]);
|
||||
$this->middleware('permission:district-delete', ['only' => ['destroy', 'inactive', 'activate']]);
|
||||
}
|
||||
|
||||
public function index() {
|
||||
$districts = District::orderBy('name', 'asc')->get();
|
||||
|
||||
return view('clinical_data::districts.index', compact('districts'));
|
||||
}
|
||||
|
||||
public function create() {
|
||||
return view('clinical_data::districts.create');
|
||||
}
|
||||
|
||||
public function store(Request $request) {
|
||||
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
flash($string)->error();
|
||||
return back()->withErrors($validator)->withInput();
|
||||
|
||||
} else{
|
||||
|
||||
$user_id = Auth::user()->id;
|
||||
$district = new District;
|
||||
|
||||
$district->name = $request->name;
|
||||
$district->created_by = $user_id;
|
||||
$district->updated_by = $user_id;
|
||||
|
||||
try {
|
||||
$district->save();
|
||||
flash($request->name . " District has been saved")->success();
|
||||
return redirect("/districts/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
public function edit($id) {
|
||||
$district = District::where(['id' => $id])->first();
|
||||
|
||||
if (!$district) {
|
||||
flash()->error("That district is not registered");
|
||||
return redirect('/districts/');
|
||||
} else {
|
||||
return view('clinical_data::districts.edit', compact('district'));
|
||||
}
|
||||
}
|
||||
|
||||
public function update(Request $request, $id) {
|
||||
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
$district = District::find($id);
|
||||
|
||||
$district->name = $request->name;
|
||||
$district->updated_by = Auth::user()->id;
|
||||
|
||||
try {
|
||||
$district->save();
|
||||
flash($request->name . " District has been updated")->success();
|
||||
return redirect("/districts/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
public function destroy($id) {
|
||||
$district = District::find($id);
|
||||
|
||||
if ($district->delete()) {
|
||||
flash("District has been deleted.")->success();
|
||||
return redirect('/districts/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive() {
|
||||
$districts = District::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->get();
|
||||
|
||||
if (count($districts) < 1) {
|
||||
flash()->error("There is no inactive district");
|
||||
}
|
||||
|
||||
return view('clinical_data::districts.inactive', compact('districts'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id) {
|
||||
$district = District::withTrashed()->find($id);
|
||||
|
||||
if($district->restore()){
|
||||
flash("District has been activated.")->success();
|
||||
return redirect('/districts/inactive');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
+171
@@ -0,0 +1,171 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Streamline\Models\Donors;
|
||||
use Illuminate\Http\Request;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
class DonorsController extends Controller{
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:donors-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:donors-detail', ['only' => ['show']]);
|
||||
$this->middleware('permission:donors-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:donors-edit', ['only' => ['edit', 'update']]);
|
||||
$this->middleware('permission:donors-delete', ['only' => ['destroy']]);
|
||||
$this->middleware('permission:donors-status', ['only' => ['activate, inactive']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index(){
|
||||
$donors = Donors::orderBy('name', 'asc')->paginate(50);
|
||||
|
||||
return view('clinical_data::donors.index', compact('donors'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create(){
|
||||
return view('clinical_data::donors.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request){
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
//validation passed
|
||||
$donor = new Donors;
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$donor->name = $request->name;
|
||||
$donor->created_by = $logged_in_user_id;
|
||||
$donor->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$donor->save();
|
||||
flash($request->name . " donor has been saved")->success();
|
||||
return redirect("/donors/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id){
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id){
|
||||
$donor = Donors::where(['id' => $id])->first();
|
||||
|
||||
if (!$donor) {
|
||||
flash()->error("Donor not found");
|
||||
return redirect('/donors/');
|
||||
} else {
|
||||
return view('clinical_data::donors.edit', compact('donor'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id){
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
//validation passed
|
||||
$donor = Donors::find($id);
|
||||
$donor->name = $request->name;
|
||||
|
||||
try {
|
||||
$donor->save();
|
||||
flash($request->name . " donor has been updated")->success();
|
||||
return redirect("/donors/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id){
|
||||
$donor = Donors::find($id);
|
||||
|
||||
if ($donor->delete()){
|
||||
flash("Donor has been deleted.")->success();
|
||||
return redirect('/donors/');
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive() {
|
||||
$donors = Donors::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
if (count($donors) < 1) {
|
||||
flash()->error("There is no inactive donor");
|
||||
return redirect('/donors/');
|
||||
} else {
|
||||
return view('clinical_data::donors.inactive', compact('donors'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id) {
|
||||
$donor = Donors::withTrashed()->find($id);
|
||||
|
||||
if ($donor->restore()):
|
||||
flash("Donor has been activated.")->success();
|
||||
return redirect('/donors/inactive');
|
||||
endif;
|
||||
}
|
||||
}
|
||||
+188
@@ -0,0 +1,188 @@
|
||||
<?php
|
||||
|
||||
namespace Modules\ClinicalData\Http\Controllers;
|
||||
|
||||
use Illuminate\Http\Request;
|
||||
use Streamline\Models\DosageFrequency;
|
||||
use Illuminate\Support\Facades\Validator;
|
||||
use Illuminate\Support\Facades\Auth;
|
||||
use Illuminate\Database\QueryException;
|
||||
|
||||
class DosageFrequencyController extends Controller {
|
||||
|
||||
public function __construct() {
|
||||
$this->middleware('auth');
|
||||
$this->middleware('permission:dosage-frequency-list', ['only' => ['index']]);
|
||||
$this->middleware('permission:dosage-frequency-create', ['only' => ['create', 'store']]);
|
||||
$this->middleware('permission:dosage-frequency-edit', ['only' => ['edit', 'update']]);
|
||||
$this->middleware('permission:dosage-frequency-delete', ['only' => ['destroy', 'inactive', 'activate']]);
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function index() {
|
||||
$frequencies = DosageFrequency::orderBy('name', 'asc')->paginate(50);
|
||||
|
||||
return view('clinical_data::dosage_frequencies.index', compact('frequencies'));
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for creating a new resource.
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function create() {
|
||||
return view('clinical_data::dosage_frequencies.create');
|
||||
}
|
||||
|
||||
/**
|
||||
* Store a newly created resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function store(Request $request) {
|
||||
$validator = Validator::make($request->all(), [
|
||||
'name' => 'required',
|
||||
'factor' => 'required'
|
||||
]);
|
||||
|
||||
request()->validate([
|
||||
'name' => 'required'
|
||||
]);
|
||||
|
||||
if ($validator->fails()) {
|
||||
$string = "";
|
||||
foreach ($validator->errors()->getMessages() as $item) {
|
||||
$string .= "{$item[0]}<br>";
|
||||
}
|
||||
return back()->withErrors($validator)->withInput();
|
||||
} else {
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
$frequency = new DosageFrequency;
|
||||
|
||||
$frequency->name = $request->name;
|
||||
$frequency->factor = $request->factor;
|
||||
$frequency->created_by = $logged_in_user_id;
|
||||
$frequency->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$frequency->save();
|
||||
flash($request->name . " Dosage Frequency has been saved")->success();
|
||||
return redirect("/dosage_frequencies/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Display the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function show($id) {
|
||||
//
|
||||
}
|
||||
|
||||
/**
|
||||
* Show the form for editing the specified resource.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function edit($id) {
|
||||
$frequency = DosageFrequency::where(['id' => $id])->first();
|
||||
|
||||
if (!$frequency) {
|
||||
flash()->error("There is no such dosage frequency");
|
||||
return redirect('/dosage_frequencies/');
|
||||
} else {
|
||||
return view('clinical_data::dosage_frequencies.edit', compact('frequency'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Update the specified resource in storage.
|
||||
*
|
||||
* @param \Illuminate\Http\Request $request
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function update(Request $request, $id) {
|
||||
request()->validate([
|
||||
'name' => 'required',
|
||||
'factor' => 'required'
|
||||
]);
|
||||
|
||||
$logged_in_user_id = Auth::user()->id;
|
||||
|
||||
$frequency = DosageFrequency::find($id);
|
||||
$frequency->name = $request->name;
|
||||
$frequency->factor = $request->factor;
|
||||
$frequency->updated_by = $logged_in_user_id;
|
||||
|
||||
try {
|
||||
$frequency->save();
|
||||
flash($request->name . " Dosage Frequency has been updated")->success();
|
||||
return redirect("/dosage_frequencies/");
|
||||
} catch (QueryException $e) {
|
||||
flash("An error occurred")->error();
|
||||
return back()->withInput();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Remove the specified resource from storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function destroy($id) {
|
||||
$frequency = DosageFrequency::find($id);
|
||||
|
||||
if ($frequency->delete()):
|
||||
flash("Frequency has been deleted.")->success();
|
||||
return redirect('/dosage_frequencies/');
|
||||
endif;
|
||||
}
|
||||
|
||||
/**
|
||||
* Display a listing of the inactive resource(s).
|
||||
*
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function inactive() {
|
||||
$frequencies = DosageFrequency::onlyTrashed()
|
||||
->orderBy('name', 'asc')
|
||||
->paginate(50);
|
||||
|
||||
if (count($frequencies) < 1) {
|
||||
flash()->error("There is no inactive frequency");
|
||||
return redirect('/dosage_frequencies/');
|
||||
} else {
|
||||
return view('clinical_data::dosage_frequencies.inactive', compact('frequencies'));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Activate the specified resource in storage.
|
||||
*
|
||||
* @param int $id
|
||||
* @return \Illuminate\Http\Response
|
||||
*/
|
||||
public function activate($id) {
|
||||
$dosage_frequency = DosageFrequency::withTrashed()->find($id);
|
||||
|
||||
if ($dosage_frequency->restore()){
|
||||
flash("Frequency has been activated.")->success();
|
||||
return redirect('/dosage_frequencies/inactive');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user