Files
streamline-emr/docker/streamline-src/Modules/Pharmacy/Resources/views/pharmacy/stock_sheet.blade.php
T

184 lines
8.2 KiB
PHP
Executable File

@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-4 col-sm-4 col-xs-12">
<h4 class="page-title">{{ __('pharmacy.pharmacy_stock_sheet') }}</h4>
</div>
<div class="col-lg-9 col-sm-8 col-md-8 col-xs-12">
<ol class="breadcrumb">
<li><a href="{{ route('home') }}">{{ __('pharmacy.dashboard') }}</a></li>
<li><a href="/pharmacy">{{ __('pharmacy.incoming_prescriptions') }}</a></li>
<li class="active">{{ __('pharmacy.pharmacy_stock_sheet') }}</li>
</ol>
</div>
</div>
@include('flash::message')
<div class="white-box">
@php
$total_cost_value = 0;
@endphp
<hr>
<div class="table-responsive">
<table class="table success-table table-sm table-striped table-hover">
<thead>
<tr>
<th style="width: 30%">{{ __('pharmacy.item_name') }}</th>
@if(track_items_using_batches())<th class="shown_input">{{ __('stores.batch_details') }}</th>@endif
<th style="width: 15%">{{ __('pharmacy.pharmacy_stock') }}</th>
<th style="width: 15%">{{ __('pharmacy.cost_value') }}</th>
<th style="width: 15%">{{ __('pharmacy.selling_price') }}</th>
<th style="width: 15%">{{ __('pharmacy.sale_value') }}</th>
</tr>
</thead>
<tfoot>
<tr>
<th style="width: 30%">{{ __('pharmacy.item_name') }}</th>
@if(track_items_using_batches())<th class="shown_input">{{ __('stores.batch_details') }}</th>@endif
<th style="width: 15%">{{ __('pharmacy.pharmacy_stock') }}</th>
<th style="width: 15%">{{ __('pharmacy.cost_value') }}</th>
<th style="width: 15%">{{ __('pharmacy.selling_price') }}</th>
<th style="width: 15%">{{ __('pharmacy.sale_value') }}</th>
</tr>
</tfoot>
<tbody>
@php $cost_value = 0; $sale_value = 0; @endphp
@foreach($drugs as $drug)
<tr>
<td>
@if($drug->insurance_coverage == 1)
<span style="color: green;"> {{ $drug->name }} </span>
@else
<span style="color: orange;"> {{ $drug->name }} </span>
@endif
</td>
@php
$drug_pharmacy_stock = 0;
$item_cost_value = 0;
@endphp
@if(track_items_using_batches())
<td id="div_to_append_{{ $drug->id }}">
@php
$batch_records = \Streamline\Models\ItemBatchWatcher::where(['item_type' => 1, 'item_id' => $drug->id])->where('pharmacy_stock', '!=', 0)->get();
@endphp
@if(count($batch_records) > 0)
@foreach($batch_records as $record)
<div class="row" style="background-color: #e1e1ef; border-radius: 5px 5px; border: 2px #c4b7b7 solid; margin-bottom: 2px;">
<div class="col-sm-12" style="word-wrap: break-word; padding: 0px; font-size: 10px">
<b>{{ __('stores.batch') }}: </b>{{ $record->batch_number }}
</div>
<div class="col-sm-12" style="word-wrap: break-word; padding: 0px; font-size: 10px">
<b>{{ __('stores.quantity') }}: </b>{{ $record->pharmacy_stock }}<br>
@php
$drug_pharmacy_stock += $record->pharmacy_stock;
@endphp
<b>{{ __('stores.expiry_date') }}: </b>{{ $record->expiry_date }}
</div>
<div class="col-sm-12" style="word-wrap: break-word; padding: 0px; font-size: 10px">
<b>{{ __('stores.unit_cost') }}: </b>{{ $record->cost_price }}
</div>
</div>
@php
$item_cost_value += $record->cost_price * $record->pharmacy_stock;
@endphp
@endforeach
@endif
<div class="row show_on_edit" style="display: none;" id="add_batch_{{ $drug->id }}"><a href="#">{{ __('stores.add_batch_small') }}<div>
</td>
@endif
<td>
<div class="shown_input">
{{ $drug_pharmacy_stock }}
</div>
<div class="hidden_input" style="display: none;">
<input type="hidden" name="drug_id[]" value="{{ $drug->id }}">
<input type="text" name="quantity[]" class="form-control" value="{{ $drug_pharmacy_stock }}" readonly>
</div>
</td>
<td>{{ ugandan_shillings($item_cost_value) }}</td>
<td>{{ ugandan_shillings($drug->non_insured_price) }}</td>
<td>{{ ugandan_shillings($drug->non_insured_price * $drug_pharmacy_stock) }}</td>
@php
$total_cost_value += $item_cost_value;
$sale_value += ($drug->non_insured_price * $drug_pharmacy_stock);
@endphp
</tr>
@endforeach
</tbody>
<tfoot>
<tr>
<td></td>
@if(track_items_using_batches())<td>{{ __('stores.batch_details') }}</td>@endif
<td class="shown_input"></td>
<td>{{ ugandan_shillings($total_cost_value) }}</td>
<td></td>
<td>{{ ugandan_shillings($sale_value) }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
@endsection
@push('scripts')
<script src="{{ asset('elite/bower_components/datatables/jquery.dataTables.min.js') }}"></script>
<script src="{{ asset('elite/bower_components/bootstrap-datepicker/bootstrap-datepicker.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: 100,
buttons: [
'copy', 'csv', 'excel', 'pdf', 'print'
],
drawCallback: function( settings ) {
console.log('DataTables has redrawn the table' );
showActivateDates();
}
});
function showActivateDates(){
$('.date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd',
});
}
$('#edit_stock').click(function(e){
e.preventDefault();
$('.hidden_input, #cancel_edit,#save_stock, .expiry_date_input').show();
$('.shown_input, .expiry_date').hide();
$(this).hide();
});
/* $('.date').datepicker({
autoclose: true,
todayHighlight: true,
format: 'yyyy-mm-dd'
}); */
</script>
@endpush