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

213 lines
14 KiB
PHP
Executable File

@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" />
<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">{{ __('pharmacy.print_requisition') }}</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 class="active">{{ __('pharmacy.requisition_receipt') }} </li>
</ol>
</div>
</div>
<div class="row">
<div class="col-sm-12">
@include('flash::message')
<div style="float: right;">
<br>
<a href="/item_requisition_print/{{$requisition_id}}/{{$requisition_model->quotation_type_id}}" target="_blank" class="btn btn-rounded" style="background-color: #03C03C; color: white;">
<i class="fa fa-print"></i><span style="margin-left: 10px;">PDF {{ __('stores.print') }}</span>
</a>
</div>
</div>
</div><br>
<div class="row">
<div class="col-sm-12">
<div class="white-box">
<div id="printableContent">
<div class="row">
<div class="col-sm-12"><center>{{ __('pharmacy.date') }} : {{ streamline_date($requisition_model->created_at) }}</center></div>
<div class="col-sm-9">
<address class="margin-none">
<strong>{{ $hospital_details->name }}</strong><br/>
{{ $hospital_details->address }}<br/>
{{ get_name($hospital_details->district, "id", "name", "districts") }}<br/>
<a href="#">{{ $hospital_details->email }}</a><br/>
{{ $hospital_details->phone_number }}<br/>
</address>
</div>
<div class="col-sm-12">
<strong>{{get_quotation_type_name($requisition_model->quotation_type_id)}} {{ __('pharmacy.request_from_requisition') }} {{ get_requisition_origin($requisition_model->requisition_origin) }}: <?php echo "#" . sprintf('%04u', $requisition_id) ?></strong>
<div class="white-box">
<div class="table-responsive">
<table class="table color-bordered-table success-bordered-table">
<thead>
<tr>
<th>{{ __('pharmacy.number') }}</th>
<th>{{ __('pharmacy.item_name') }}</th>
<th>{{ __('pharmacy.quantity') }}</th>
@if($requisition_model->quotation_type_id ==1 || $requisition_model->quotation_type_id ==5) <th>{{ __('pharmacy.units') }}</th>@endif
<th>{{ __('pharmacy.cost_value') }}</th>
</tr>
</thead>
<tbody>
@php
$counter = 1;
$grand_total = 0;
$requisiton_details = $requisition_model;
$requisition_type_id = $requisition_model->quotation_type_id;
$item_array = explode(",", $requisiton_details->drug_id);
$quantity_array = explode(",", $requisiton_details->quantity_requested);
@endphp
@for($i = 0; $i < count($quantity_array) ; $i++)
@if(isset($quantity_array[$i]) && $quantity_array[$i] != "" && isset($item_array[$i]))
<tr>
<td>{{ $counter }}. </td>
<!-- 1-drug 2-sundry 3-dental 4-radiology 5-Lab -->
@if($requisition_type_id == 1)
<td>{{ get_name($item_array[$i], 'id', 'name', 'drugs') }}</td>
@php
$cost_price = get_name($item_array[$i], 'id', 'cost_price', 'drugs');
$drug_form = get_name($item_array[$i], 'id', 'form_id', 'drugs');
$drug_form_name = get_name($drug_form,'id','name','drug_forms');
if ($drug_form_name == 'N/A') $drug_form_name =null;
@endphp
@elseif($requisition_type_id == 2)
<td>{{ get_name($item_array[$i], 'id', 'name','sundries') }}</td>
@php
$cost_price = get_name($item_array[$i], 'id', 'cost_price', 'sundries');
$drug_form = get_name($item_array[$i], 'id', 'package_unit_id', 'sundries');
@endphp
@elseif($requisition_type_id == 3)
<td>{{ get_name($item_array[$i], 'id', 'name','dentals') }}</td>
@php
$cost_price = get_name($item_array[$i], 'id', 'cost_price', 'dentals');
$drug_form = null;
@endphp
@elseif($requisition_type_id == 4)
<td>{{ get_name($item_array[$i], 'id', 'name','radiologies') }}</td>
@php
$cost_price = get_name($item_array[$i], 'id', 'cost_price', 'radiologies');
$drug_form = get_name($item_array[$i], 'id', 'form_id', 'radiologies');
@endphp
@elseif($requisition_type_id == 5)
<td>{{ get_name($item_array[$i], 'id', 'name','labs') }}</td>
@php
$cost_price = get_name($item_array[$i], 'id', 'cost_price', 'labs');
$drug_form = get_name($item_array[$i], 'id', 'form_id', 'labs');
$drug_form_name=get_name($drug_form, 'id','name','lab_forms');
if ($drug_form_name == 'N/A') $drug_form_name =null;
@endphp
@elseif($requisition_type_id == 6)
<td>{{ get_name($item_array[$i], 'id', 'name','general_items') }}</td>
@php
$cost_price = get_name($item_array[$i], 'id', 'cost_price', 'general_items');
$drug_form = null;
@endphp
@elseif($requisition_type_id == 7)
<td>{{ get_name($item_array[$i], 'id', 'name','eye_glasses') }}</td>
@php
$cost_price = get_name($item_array[$i], 'id', 'buying_price', 'eye_glasses');
$drug_form = null;
@endphp
@endif
<td>{{ $quantity_array[$i] }}</td>
@if($requisition_type_id ==1 || $requisition_type_id ==5 )<td>{{ $drug_form_name }}</td>@endif
<td>
@php
if (track_items_using_batches()){
$item_sub_total =get_unit_cost_from_store_batch($item_array[$i],$requisition_type_id,$quantity_array[$i],'store_stock');
}else{
$quantity = (isset($quantity_array[$i]) && is_numeric($quantity_array[$i])) ? $quantity_array[$i] : 0;
$item_cost = is_numeric($cost_price) ? $cost_price : 0;
$item_sub_total = $quantity * $item_cost;
}
$grand_total += $item_sub_total;
@endphp
{{ ugandan_shillings($item_sub_total) }}
</td>
</tr>
@php $counter++; @endphp
@endif
@endfor
</tbody>
<tfoot>
<tr>
<td colspan="2"></td>
@if($requisition_type_id ==1 || $requisition_model->quotation_type_id ==5) <td ></td>@endif
<td>{{ __('pharmacy.total') }}</td>
<td>{{ ugandan_shillings($grand_total) }}</td>
</tr>
</tfoot>
</table>
</div>
</div>
</div>
<div class="col-sm-6">
<strong>{{ __('pharmacy.requisitioned_by') }}:</strong><br><br>
<strong>{{ get_full_name($requisition_model->created_by, "id", "first_name", "last_name", "users") }}</strong><br><br>
<small>{{ streamline_date_time_short($requisition_model->created_at) }}</small><br><br>
.......................................
</div>
<div class="col-sm-6">
<strong>{{ __('pharmacy.received_by') }}:</strong><br><br>
.......................................
</div>
<div class="col-sm-12">
<br>
<i><small>{{ get_full_name(auth()->user()->id, "id", "first_name", "last_name", "users") .' '.streamline_date_time(date('Y-m-d')) }}</small></i>
</div>
</div>
</div>
</div>
</div>
</div>
@endsection
@push('scripts')
<script type="text/javascript">
function printElementContent(elem,title){
var mywindow = window.open('', 'PRINT', 'height=400,width=600');
var css = '<link href="elite/bootstrap/dist/css/bootstrap.min.css" rel="stylesheet">';
mywindow.document.write('<html><head><title></title>');
mywindow.document.write('</head><body >');
mywindow.document.write(css);
mywindow.document.write('<center><h3>' + title + '</h3></center>');
mywindow.document.write(document.getElementById(elem).innerHTML);
mywindow.document.write('</body></html>');
mywindow.document.close(); // necessary for IE >= 10
//mywindow.focus(); // necessary for IE >= 10*/
setTimeout(function () {
mywindow.focus();
mywindow.print();
mywindow.remove();
}, 500);
return true;
}
//$("#printPurchaseOrderReceipt").click(function(e){
// printElementContent('printableContent','Requisition receipt');
//});
</script>
@endpush