resolved conflicts

This commit is contained in:
2025-03-31 03:46:05 +03:00
6454 changed files with 1520539 additions and 9 deletions
@@ -0,0 +1,224 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/icheck/skins/all.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">{{ __('sundries.add_sundry') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('sundries.dashboard') }}</a></li>
<li><a href="/sundries/">{{ __('sundries.sundries') }}</a></li>
<li class="active">{{ __('sundries.create') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('clinical_data::sundries.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
@if (session()->has('streamline_setup'))
<h3><font color="blue">{{ __('sundries.streamline_setup') }}</font></h3>
{{ Form::open(['route' => 'sundries.store' ,]) }}
<div class="row">
<div class="col-sm-6">
<div class="form-group">
{{ Form::label('name', __('sundries.sundry_name')) }}
{{ Form::text('name', '', ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('price', __('sundries.buying_price')) }}
{{ Form::number('price', '', ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group non_insured_price_div">
{{ Form::label('non_insured_price', __('sundries.non_insured_price')) }}
{{ Form::number('non_insured_price', '', ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('available', __('sundries.is_sundry_available')) }}&ensp;
{{ Form::radio('available', 1, false, ['class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('sundries.yes') }} &nbsp;&nbsp;
{{ Form::radio('available', 0, false, ['class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('sundries.no') }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('account_id', __('sundries.income_account')) }}
{{ Form::select('account_id', $income_accounts, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('cog_account', __('sundries.cost_of_goods')) }}
{{ Form::select('cog_account', $cost_of_goods_accounts, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('inventory_account', __('sundries.inventory_asset_account')) }}
{{ Form::select('inventory_account', $inventory_asset_accounts, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
</div>
<div class="col-sm-2"></div>
<div class="col-sm-4" style="background: #eceeef;">
<h4>{{ __('sundries.select_from_list') }}</h4>
<input id="select_all" type="checkbox"> <b>Select All</b><br><br>
@foreach ($sundries as $defaultSundry)
<div class="form-group">
{{ Form::checkbox('selected_sundries[]', $defaultSundry['Item_Name'], false, ['class' => 'item_checkbox']) }} {{ $defaultSundry['Item_Name'] }} &nbsp;&nbsp;
</div>
@endforeach
</div>
</div>
{{ Form::button(__('sundries.next'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10 next']) }}
{{ Form::button(__('sundries.skip'),['type'=>'submit','name' => 'skip','value'=>'skip','class'=>'btn btn-default waves-effect waves-light m-r-10']) }}
@else
{{ Form::open(['route' => 'sundries.store' , 'data-toggle' => 'validator']) }}
<div class="form-group">
{{ Form::label('name', __('sundries.sundry_name')) }}
{{ Form::text('name', '', ['class' => 'form-control compulsory']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('price', __('sundries.buying_price')) }}
{{ Form::number('price', '', ['class' => 'form-control compulsory']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group non_insured_price_div">
{{ Form::label('non_insured_price', __('sundries.non_insured_price')) }}
{{ Form::number('non_insured_price', '', ['class' => 'form-control compulsory', 'id' => 'non_insured_price']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('available', __('sundries.is_sundry_available')) }}&ensp;
{{ Form::radio('available', 1, false, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('sundries.yes') }} &nbsp;&nbsp;
{{ Form::radio('available', 0, false, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('sundries.no') }}
<div class="help-block with-errors"></div>
</div>
@php
$price_list_categories = \Streamline\Models\PriceListCategories::select('patient_category_id', 'id')->get();
@endphp
@foreach($price_list_categories as $record)
<div class="form-group">
{{ Form::label('non_insured_price', get_name($record->patient_category_id, 'id', 'name', 'patient_categories').' Price') }}
{{ Form::hidden('price_list_category_id[]', $record->id) }}
{{ Form::number('price_list_price[]', '', ['class'=>'form-control price_list_price']) }}
</div>
@endforeach
<div class="form-group">
{{ Form::label('account_id', __('sundries.income_account')) }}
{{ Form::select('account_id', $income_accounts, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('form_id', __('sundries.form')) }}
{{ Form::select('form_id', $forms, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('cog_account', __('sundries.cost_of_goods')) }}
{{ Form::select('cog_account', $cost_of_goods_accounts, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('inventory_account', __('sundries.inventory_asset_account')) }}
{{ Form::select('inventory_account', $inventory_asset_accounts, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('sundries.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10 submit-btn']) }}
{{ Form::button(__('sundries.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
@endif
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript">
function setOptions() {
if (document.getElementById("insured_checkbox").checked) {
document.querySelector(".insured_price_div").style.display = "block";
//document.querySelector(".non_insured_price_div").style.display = "none";
}
if (document.getElementById("non_insured_checkbox").checked) {
document.querySelector(".insured_price_div").style.display = "none";
}
}
</script>
<!-- icheck -->
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
<script type="text/javascript">
$(".next,.submit-btn").click(function (e) { // make sure that all compulsory fields have been filled out
var empty_compulsory_fields = [];
$(".compulsory").each(function () {
if ($(this).val() == "") {
var textname = $(this).attr('name');
$(this).focus();
empty_compulsory_fields.push(textname);
$(this).css('border','1px solid #F08080');
}
});
/* check if the array containing empty compulsory fields is not empty then return false */
if (empty_compulsory_fields.length != 0) {
alert("Please fill in all compulsory fields");
console.log(empty_compulsory_fields);
e.preventDefault();
return false;
}
});
$('#select_all').change(function() {
if (this.checked === true) {
$(".item_checkbox").each(function() {
this.checked = true;
});
} else {
$(".item_checkbox").each(function() {
this.checked = false;
});
}
});
$('#non_insured_price').change(function(e) {
var non_insured_price = $(this).val();
if (non_insured_price > 0) {
$(".price_list_price").each(function () {
$(this).val(non_insured_price);
});
}
});
</script>
@endpush
@@ -0,0 +1,111 @@
@extends('layouts.main')
@push('styles')
<link href="{{ asset('elite/bower_components/icheck/skins/all.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">{{ __('sundries.edit_sundry') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('sundries.dashboard') }}</a></li>
<li><a href="/sundries/">{{ __('sundries.sundries') }}</a></li>
<li class="active">{{ __('sundries.edit') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('clinical_data::sundries.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
{{ Form::model($sundry, ['method' => 'PUT', 'route' => ['sundries.update',$sundry] , 'data-toggle' => 'validator']) }}
<div class="form-group">
{{ Form::label('name', __('sundries.sundry_name')) }}
{{ Form::text('name', $sundry->name, ['class' => 'form-control compulsory', 'required']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('price', __('sundries.buying_price')) }}
{{ Form::number('price', $sundry->cost_price, ['class' => 'form-control compulsory', 'required', 'step' => '.01']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group" id="non_insured_price_div">
{{ Form::label('non_insured_price', __('sundries.non_insured_price')) }}
{{ Form::number('non_insured_price', $sundry->non_insured_price, ['class' => 'form-control', 'step' => '.01']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('available', __('sundries.is_sundry_available')) }}&ensp;
{{ Form::radio('available', 1, $sundry->available == 1, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('sundries.yes') }} &nbsp;&nbsp;
{{ Form::radio('available', 0, $sundry->available == 0, ["required", 'class' => 'check form-control', 'data-radio'=>'iradio_flat-green']) }} {{ __('sundries.no') }}
<div class="help-block with-errors"></div>
</div>
@if($sundry->price_list_category && $sundry->price_list_category != '')
@php
$price_list_categories = explode(",", $sundry->price_list_category);
$price_list_prices = explode(",", $sundry->price_list_price);
@endphp
@for($i = 0; $i < count($price_list_categories); $i++)
<div class="form-group">
{{ Form::label('non_insured_price', get_name($price_list_categories[$i], 'id', 'name', 'patient_categories').' Price') }}
{{ Form::hidden('price_list_category_id[]', $price_list_categories[$i]) }}
{{ Form::number('price_list_price[]', $price_list_prices[$i], ['class'=>'form-control price_list_price']) }}
</div>
@endfor
@endif
<div class="form-group">
{{ Form::label('account_id', __('sundries.income_account')) }}
{{ Form::select('account_id', $income_accounts, null, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('form_id', __('sundries.form')) }}
{{ Form::select('form_id', $forms, $sundry->form_id, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('cog_account', __('sundries.cost_of_goods')) }}
{{ Form::select('cog_account', $cost_of_goods_accounts, $sundry->cost_of_goods_account, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
<div class="form-group">
{{ Form::label('inventory_account', __('sundries.inventory_asset_account')) }}
{{ Form::select('inventory_account', $inventory_asset_accounts, $sundry->inventory_account, ['class' => 'form-control']) }}
<div class="help-block with-errors"></div>
</div>
{{ Form::button(__('sundries.submit'),['type'=>'submit','class'=>'btn btn-success waves-effect waves-light m-r-10']) }}
{{ Form::button(__('sundries.cancel'),['type'=>'reset','class'=>'btn btn-default waves-effect waves-light']) }}
{{ Form::close() }}
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/js/validator.js') }}"></script>
<!-- icheck -->
<script src="{{ asset('elite/bower_components/icheck/icheck.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/icheck/icheck.init.js') }}"></script>
@endpush
@@ -0,0 +1,112 @@
@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">{{ __('drugs.expired_drugs') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('drugs.dashboard') }}</a></li>
<li><a href="{{ route('drugs.index') }}">{{ __('drugs.drugs') }}</a></li>
<li class="active">{{ __('drugs.expiring') }}</li>
</ol>
</div>
</div>
@include('flash::message')
<div class="row">
<div class="col-md-4">
<div class="panel panel-default">
<div class="panel-body">
{{ Form::open(['route' => 'sundries.expiring_sundries']) }}
<div class="form-group">
{{ Form::label('time_period', __('drugs.expiring_with_in')) }}
{{ Form::select('time_period', ['1' => __('drugs.1_week'), '2' => __('drugs.2_weeks'), '4' => __('drugs.1_month'), '0' => __('drugs.expired_drugs')], null, ['class' => 'form-control']) }}
</div>
{{ Form::button(__('drugs.submit'),['type'=>'submit','class'=>'btn btn-success btn-rounded waves-effect waves-light m-r-10']) }}
{{ Form::close() }}
</div>
</div>
</div>
<div class="col-md-8">
<div class="panel panel-default">
<div class="panel-body">
<div class="table-responsive">
<table id="table" class="table table-striped">
<thead>
<tr>
<th>{{ __('drugs.drug_name') }}</th>
<th>{{ __('drugs.store_stock') }}</th>
<th class="shown_input">{{ __('drugs.batch_details') }}</th>
<th>Expiry Date</th>
</tr>
</thead>
<tfoot>
<tr>
<th>{{ __('drugs.drug_name') }}</th>
<th>{{ __('drugs.store_stock') }}</th>
<th class="shown_input">{{ __('drugs.batch_details') }}</th>
<th>Expiry Date</th>
</tr>
</tfoot>
<tbody>
@foreach($sundries as $sundry)
<tr>
<td>{{ get_drug_name($sundry->id) }}</td>
<td>{{ $sundry->store_stock}}</td>
<td>
@php
$quotation_records = get_all_batches_for_this_drug_with_balances($sundry->id, $item_type = 2);
$details_of_batch_in_use = details_of_batch_currently_in_use_sundries($sundry->id);
@endphp
@if(count($quotation_records) > 0)
@foreach($quotation_records as $record)
<div class="row" @if(($record->batch_number == $details_of_batch_in_use['batch_number']) && ($record->id == $details_of_batch_in_use['quotation_id'])) style="background-color: #e1e1ef; border-radius: 5px 5px; padding: 5px 0px;" @endif>
<div class="col-sm-4">
<b>{{ __('drugs.quantity') }} </b>{{ $record->batch_balance }}
</div>
<div class="col-sm-3">
<b>{{ __('drugs.batch') }} </b>{{ $record->batch_number }}
</div>
<div class="col-sm-5">
<b>{{ __('drugs.expiry_date') }} </b>{{ streamline_date($record->expiry_date) }}
</div>
</div><br>
@endforeach
@endif
</td>
<td>{{ streamline_date($sundry->expiry_date) }}</td>
</tr>
@endforeach
</tbody>
</table>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script>
$('#table').DataTable({
pageLength: 100,
});
</script>
@endpush
@@ -0,0 +1,93 @@
@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">{{ __('sundries.activate_sundries') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('sundries.dashboard') }}</a></li>
<li><a href="/sundries/index">{{ __('sundries.sundries') }}</a></li>
<li class="active">{{ __('sundries.activate') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('clinical_data::sundries.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('sundries.sundry_name') }}</th>
<th>{{ __('sundries.buying_price') }}</th>
<th>{{ __('sundries.income_account') }}</th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>{{ __('sundries.sundry_name') }}</th>
<th>{{ __('sundries.buying_price') }}</th>
<th>{{ __('sundries.income_account') }}</th>
<th></th>
</tr>
</tfoot>
<tbody>
@foreach($sundries as $sundry)
<tr>
<td>{{ $sundry->name }}</td>
<td>{{ $sundry->buying_price }}</td>
<td>{{ $chart_of_accounts[$sundry->account_id] ?? '' }}</td>
<td>
{{ Form::model($sundry->id ,['method' => 'POST', 'route' => ['sundries.activate', $sundry->id]]) }}
<button type="submit" class="btn btn-warning" onclick="return confirm('<?php echo __('sundries.are_you_sure');?>')"><i class="fa fa-check"></i> {{ __('sundries.activate') }}</button>
{{ Form::close() }}
</td>
</tr>
@endforeach
</tbody>
</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({
dom: 'Bfrtip',
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,112 @@
@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">{{ __('sundries.sundries') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('sundries.dashboard') }}</a></li>
<li class="active">{{ __('sundries.sundries') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('clinical_data::sundries.menu')
</div>
</div>
<div class="row">
<div class="col-sm-12">
<!--Flash messages at the top -->
@include('flash::message')
<div class="white-box">
<div class="table-responsive">
<table class="table table-striped">
<thead>
<tr>
<th>{{ __('sundries.sundry_name') }}</th>
<th>{{ __('sundries.buying_price') }}</th>
<th>{{ __('sundries.non_insured_price') }}</th>
<th>{{ __('sundries.income_account') }}</th>
<th>Cost of Goods Account</th>
<th>Inventory Account</th>
<th></th>
<th></th>
</tr>
</thead>
<tfoot>
<tr>
<th>{{ __('sundries.sundry_name') }}</th>
<th>{{ __('sundries.buying_price') }}</th>
<th>{{ __('sundries.non_insured_price') }}</th>
<th>{{ __('sundries.income_account') }}</th>
<th>Cost of Goods Account</th>
<th>Inventory Account</th>
<th></th>
<th></th>
</tr>
</tfoot>
<tbody>
@foreach($sundries as $sundry)
<tr>
<td>{{ $sundry['name'] }}</td>
<td>{{ ugandan_shillings($sundry['cost_price']) }}</td>
<td>{{ ugandan_shillings($sundry['non_insured_price']) }}</td>
<td>{{ isset($chart_of_accounts[$sundry['account_id']]) ? $chart_of_accounts[$sundry['account_id']] : 'N/A' }}</td>
<td>{{ isset($chart_of_accounts[$sundry['cost_of_goods_account']]) ? $chart_of_accounts[$sundry['cost_of_goods_account']] : 'N/A' }}</td>
<td>{{ isset($chart_of_accounts[$sundry['inventory_account']]) ? $chart_of_accounts[$sundry['inventory_account']] : 'N/A' }}</td>
<td>
<a href="/sundries/{{ $sundry['id'] }}/edit/" class="btn btn-info"><i class="fa fa-pencil"></i> {{ __('sundries.edit') }}</a>
</td>
<td>
@if (Auth::user()->can('sundry-delete') && empty($sundry['pharmacy_stock']) && empty($sundry['store_stock']) && empty($sundry['opening_stock']) && !in_array($sundry['id'], $ordered_sundries_ids))
{{ Form::model($sundry['id'] ,['method' => 'DELETE', 'route' => ['sundries.destroy', $sundry['id']]]) }}
<button type="submit" class="btn btn-danger" onclick="return confirm('<?php echo __('sundries.are_you_sure');?>')"><i class="fa fa-trash"></i> {{ __('sundries.delete') }}</button>
{{ Form::close() }}
@elseif (Auth::user()->can('sundry-delete') && (!empty($sundry['pharmacy_stock']) || !empty($sundry['store_stock']) || !empty($sundry['opening_stock'])))
<b class="text-success">Still Stocked</b>
@elseif (in_array($sundry['id'], $ordered_sundries_ids))
<b class="text-success">Sundry was Ordered</b>
@endif
</td>
</tr>
@endforeach
</tbody>
</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({
dom: 'Bfrtip',
pageLength: 50,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
]
});
</script>
@endpush
@@ -0,0 +1,7 @@
<div class="panel panel-default">
<div class="panel-body">
<a href="{{ route('sundries.create') }}" class="nav-item btn btn-default ti-plus"> {{ __('sundries.add_sundry') }}</a>
<a href="{{ route('sundries.index') }}" class="nav-item btn btn-default ti-pencil"> {{ __('sundries.sundries') }}</a>
<a href="{{ route('sundries.inactive') }}" class="nav-item btn btn-default ti-pencil"> {{ __('sundries.activate_sundries') }}</a>
</div>
</div>
@@ -0,0 +1,405 @@
@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/bower_components/select2/select2.min.css') }}" rel="stylesheet" />
<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-6 col-md-7 col-sm-7 col-xs-12">
<h4 class="page-title">{{ __('sundries.order_sundries') }} {{ $patient->last_name }} {{ __('sundries.for_episode') }}:<a>{{ streamline_date(get_name($episode_id, 'id', 'created_at', 'patient_episodes')) }}</h4>
</div>
<div class="col-lg-6 col-sm-5 col-md-5 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('sundries.dashboard') }}</a></li>
<li><a href="{{ route('patient_episodes.index') }}">{{ __('sundries.patient_home') }}</a></li>
<li class="active">{{ __('sundries.ordering_sundries') }}</li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('patients::allergies.header')
</div>
</div>
<br>
<div class="white-box">
<!--Flash messages at the top -->
@include('flash::message')
@foreach ($errors->all() as $error)
<div>{{ $error }}</div>
@endforeach
{{ Form::open(['route' => 'sundries.ordered']) }}
@php $patient_insurance_status = patient_insurance_status($patient_id); @endphp
{{ Form::hidden('patient_id', $patient_id, ['id' => 'patient_id'])}}
{{ Form::hidden('patient_insurance_status', $patient_insurance_status, ['id' => 'patient_insurance_status'])}}
<div id='payments_items'>
<table class='table color-bordered-table success-bordered-table'>
<thead>
<tr>
<th>
<div class='row'>
<div class='col-3'>Sundry</div>
<div class='col-2'>Quantity</div>
<div class='col-3' @if(view_sundry_price_on_order()==0) style='display: none' @endif>Unit Cost</div>
<div class='col-3' @if(view_sundry_price_on_order()==0) style='display: none' @endif>Total Cost</div>
<div class='col-1'></div>
</div>
</th>
</tr>
</thead>
@php
$option_sundries = "<option value=''>-select-</option>";
foreach ($sundries as $key => $value){
$option_sundries .= "<option value='$key'>$value</option>";
}
$option_employees = "<option value=''>-select-</option>";
foreach ($employees as $employee){
$option_employees .= "<option value='$employee->id'>$employee->first_name $employee->last_name</option>";
}
$counter = 0;
@endphp
<tbody class='input_fields_wrap'>
@if($ordered_sundries)
<tr>
<td style='background-color: #FFE6E6; font-weight: bolder;'>
<u>{{ __('sundries.pending_sundries') }}</u>
@if(Auth::user()->can('cancel-ordered-sundries') )
<b><a class="pull-right text-blue" onclick="cancelOrderedItems({{ $ordered_sundries->id }})">Cancel all ordered sundries</a></b>
@endif
</td>
</tr>
{{ Form::hidden('order_id', $ordered_sundries->id) }}
@php
$sundry_ids = explode(",", $ordered_sundries->sundries_id);
$sundry_quantities = explode(",", $ordered_sundries->quantity);
@endphp
@for($i = 0; $i < count($sundry_ids); $i++)
<tr>
<td>
<div class='row'>
<div class='col-3'>
<div class='form-group'>
<div class='controls'>
{{ Form::select('sundries_id[]', $sundries, $sundry_ids[$i], ['class' => 'form-control compulsory required sundries_id_class', 'id' => 'sundries_id_' . $counter]) }}
</div>
<div id='chi_coverage_div_{{ $counter }}'>
@if (is_chi_enabled() && is_patient_item_covered($patient_id, $sundry_ids[$i], 5))
&nbsp;&nbsp;<br><span style="color: darkgreen"><b>Covered by CHI</b></span>
@endif
</div>
</div>
</div>
<div class='col-2'>
<div class='form-group'>
<div class='controls'>
<input type='number' value='{{ $sundry_quantities[$i] }}' name='item_quantity[]' id='item_quantity_{{ $counter }}' class='form-control item_quantity compulsory' required/>
</div>
</div>
</div>
@php
if ($patient_insurance_status == 1){
$sundries_cost = get_item_insurance_co_payment($patient_id, $sundry_ids[$i], 5, false, 0);
} else {
// check if the patient category is attached to a price list
$price_list_id = is_patient_category_attached_to_price_list($patient_id);
if ($price_list_id){
$sundries_cost = get_price_list_category_price($price_list_id, 5, $sundry_ids[$i]);
} else {
$sundries_cost = get_name($sundry_ids[$i], 'id', 'non_insured_price', 'sundries');
}
}
@endphp
<div class='col-3' @if(view_sundry_price_on_order()==0) style='display: none' @endif>
<div class='form-group'>
<div class='controls'>
<input type='number' value="{{ ($sundries_cost) }}" name='item_unit_cost[]' id='item_unit_cost_{{ $counter }}' class='form-control item_unit_cost compulsory' readonly/>
</div>
</div>
</div>
<div class='col-3' @if(view_sundry_price_on_order()==0) style='display: none' @endif>
<div class='form-group'>
<div class='controls'>
<input type='number' value="{{ ($sundry_quantities[$i] * $sundries_cost) }}" name='item_total_cost[]' id='item_total_cost_{{ $counter }}' class='form-control item_total_cost compulsory' readonly/>
</div>
</div>
</div>
<div class='col-1'>
<div class='form-group' style='margin-top: 10px;'>
@if($counter == 0)
<a class='btn btn-sm btn-rounded btn-success add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i></a>
@else
<a class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white; margin-left: 25px;'><i class='fa fa-trash'></i></a>
@endif
</div>
</div>
</div>
</td>
</tr>
@php $counter++; @endphp
@endfor
@else
<tr>
<td>
<div class='row'>
<div class='col-3'>
<div class='form-group'>
<div class='controls'>
<select name='sundries_id[]' id='sundries_id_{{ $counter }}' class='form-control compulsory required sundries_id_class'>@php echo $option_sundries; @endphp</select>
</div>
<div id='chi_coverage_div_{{ $counter }}'></div>
</div>
</div>
<div class='col-2'>
<div class='form-group'>
<div class='controls'>
<input type='number' value='1' name='item_quantity[]' id='item_quantity_{{ $counter }}' class='form-control item_quantity compulsory' required/>
</div>
</div>
</div>
<div class='col-3' @if(view_sundry_price_on_order()==0) style='display: none' @endif>
<div class='form-group'>
<div class='controls'>
<input type='number' name='item_unit_cost[]' id='item_unit_cost_{{ $counter }}' class='form-control item_unit_cost compulsory' readonly/>
</div>
</div>
</div>
<div class='col-3' @if(view_sundry_price_on_order()==0) style='display: none' @endif>
<div class='form-group'>
<div class='controls'>
<input type='number' name='item_total_cost[]' id='item_total_cost_{{ $counter }}' class='form-control item_total_cost compulsory' readonly/>
</div>
</div>
</div>
<div class='col-1'>
<div class='form-group' style='margin-top: 10px;'>
<a class='btn btn-sm btn-rounded btn-success add_item' style='color: white; margin-left: 25px;'><i class='fa fa-plus'></i></a>
</div>
</div>
</div>
</td>
</tr>
@endif
</tbody>
</table>
</div>
<div class='row' @if(view_sundry_price_on_order()==0) style='display: none' @endif>
<div style="float: right;">
<h3>Total: <span id="itemGrandTotal"></span></h3>
</div>
</div>
<div class='row'>
<div class='col-md-9'>
</div>
<div class='col-md-3'>
<button class='btn btn-rounded btn-info pull-right' id='submit_button'>Save Sundries</button>
</div>
</div>
{{ Form::close() }}
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/select2/select2.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.min.js') }}"></script>
<script src="{{ asset('elite/js/validator.js') }}"></script>
<script type="text/javascript">
var max_rows = 20;
var wrapper = $(".input_fields_wrap");
var add_button = $(".add_item");
var show_price_setting = <?php echo view_sundry_price_on_order(); ?>;
var x = <?php echo $counter + 1; ?> // initial row count
add_button.click(function (e) { // on add input button click
e.preventDefault();
if (x < max_rows) {
$(wrapper).append("\
<tr>\
<td>\
<div class='row'>\
<div class='col-3'>\
<div class='form-group'>\
<div class='controls'>\
<select name='sundries_id[]' id='sundries_id_" + x + "' class='form-control compulsory required sundries_id_class' required>@php echo $option_sundries; @endphp</select>\
</div>\
<div id='chi_coverage_div_" + x + "'></div>\
</div>\
</div>\
<div class='col-2'>\
<div class='form-group'>\
<div class='controls'>\
<input type='number' value='1' name='item_quantity[]' id='item_quantity_" + x + "' class='form-control item_quantity compulsory' required/>\
</div>\
</div>\
</div>\
<div class='col-3'"+(show_price_setting==0?'style="display:none"':'')+">\
<div class='form-group'>\
<div class='controls'>\
<input type='number' name='item_unit_cost[]' id='item_unit_cost_" + x + "' class='form-control item_unit_cost compulsory' readonly/>\
</div>\
</div>\
</div>\
<div class='col-3'"+(show_price_setting==0?'style="display:none"':'')+">\
<div class='form-group'>\
<div class='controls'>\
<input type='number' name='item_total_cost[]' id='item_total_cost_" + x + "' class='form-control item_total_cost compulsory' readonly/>\
</div>\
</div>\
</div>\
<div class='col-1'>\
<div class='form-group' style='margin-top: 10px;'>\
<button class='remove_field btn btn-sm btn-rounded btn-danger' style='color: white; margin-left: 25px;'><i class='fa fa-trash'></i></button>\
</div>\
</div>\
</div>\
</td>\
</tr>");
generalSelect2Set('sundries_id_'+x);
$("select.item_select").change(function(){
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var name_selected = $(this).children("option:selected").val();
$("#name_" + id).val(parseInt(name_selected));
});
x++;
}
});
$(wrapper).on("click", ".remove_field", function (e) {
e.preventDefault();
$(this).parent('div').parent('div').parent('div').parent('td').parent('tr').remove();
});
$(".input_fields_wrap").on('change', ".sundries_id_class", function () {
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
var item = $("#sundries_id_" + id).val();
let patient_id = $('#patient_id').val();
let patient_insurance_status = $('#patient_insurance_status').val();
$.ajax({
url: '/get_sundry_details',
data: {'sundry_id':item, 'patient_id':patient_id, 'patient_insurance_status': patient_insurance_status, 'ward_id': 0},
success: function(response){
let arr = JSON.parse(response);
$("#item_unit_cost_"+id).val(arr["selling_price"]);
$("#item_total_cost_"+id).val(arr["selling_price"]);
$("#item_quantity_"+id).val(1);
if (arr["covered_by_chi"] !== "") {
$("#chi_coverage_div_" + id).html(arr["covered_by_chi"]).show();
} else {
$("#chi_coverage_div_" + id).hide();
}
//loop through the prices
let auto_price_grand_total = 0;
$(".item_total_cost").each(function(){
auto_price_grand_total += parseInt($(this).val());
});
// recalculate the grand total
$("#itemGrandTotal").html(numberWithCommas(auto_price_grand_total) + " Ugx");
}
});
});
$(".sundries_id_class").select2({
width: "100%"
});
$(".input_fields_wrap").on('change', ".item_quantity", function () {
// make sure the lowest number is 1
if (+$(this).val() < 1) {
$(this).val(1);
}
// get the quantity and multiply against this for the total
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
let total_cost = +$('#item_unit_cost_' + id).val() * +$(this).val();
$('#item_total_cost_' + id).val(total_cost);
let auto_price_grand_total = 0;
$(".item_total_cost").each(function(){
auto_price_grand_total += +$(this).val();
});
// recalculate the grand total
$("#itemGrandTotal").html(numberWithCommas(auto_price_grand_total) + " Ugx");
});
$(".input_fields_wrap").on('change', ".item_unit_cost", function () {
// get the quantity and multiply against this for the total
var id = /\d+(?=\D*$)/.exec($(this).attr('id'));
let total_cost = +$('#item_quantity_' + id).val() * +$(this).val();
$('#item_total_cost_' + id).val(total_cost);
let auto_price_grand_total = 0;
$(".item_total_cost").each(function(){
auto_price_grand_total += +$(this).val();
});
// recalculate the grand total
$("#itemGrandTotal").html(numberWithCommas(auto_price_grand_total) + " Ugx");
});
function generalSelect2Set(id) {
$('#'+id).select2({
width: "100%"
});
}
function numberWithCommas(x) {
return x.toString().replace(/\B(?=(\d{3})+(?!\d))/g, ",");
}
function cancelOrderedItems(order_id) {
if (confirm("Are you sure you want to continue? This will cancel all unpaid orders")) {
$.ajax({
url: '/cancel_ordered_sundries/' + order_id,
success: function(response){
if (response == 1) {
alert("Sundries have been cancelled");
window.location.reload();
} else {
alert("Cancellation of sundries failed");
}
}
});
}
}
</script>
@endpush