@extends('Reports.template') @section('title') {{__('IP Medicine Issue Lead Time Report')}} @endsection @section('ExternalCss') @parent @endsection @section('Content') @php $currentTime = \Carbon\Carbon::now(); @endphp @if($reportType == "D") @else @endif @if($reportType == "D") @php $srHeader = 1; $oldIndentID = ''; $leadTimeSeconds = 0; $count = 0; $avgLeadTime = 0; $totalLeadTimeSeconds = 0; $totalCount = 0; $totalAvgLeadTime = 0; @endphp @foreach($medicineTransactionData as $medicineTransaction) @php $patName = " ".$medicineTransaction->patient_id." / ".$medicineTransaction->patient_name; $ipID = "IP - ".$medicineTransaction->ipd_reg_id; $indentID = $medicineTransaction->trn_id; $leadTime = ''; @endphp @if($indentID != $oldIndentID) @if($avgLeadTime != 0 || ($avgLeadTime == 0 && $oldIndentID != '')) @if($count != 0 && $leadTimeSeconds != 0) @php $startSecond = new DateTime("@0"); $endSecond = new DateTime("@".ceil($leadTimeSeconds/$count)); $diff = $endSecond->diff($startSecond); $avgLeadTime = $diff->format('%dd %hh %im %ss'); @endphp @else @php $avgLeadTime = ''; @endphp @endif @endif @php $sr = 1; $leadTimeSeconds = 0; $count = 0; $avgLeadTime = 0; @endphp @endif @if($medicineTransaction->leadTimeInSecond != 0) @php $count++; $leadTimeSeconds += $medicineTransaction->leadTimeInSecond; $startSecond = new DateTime("@0"); $endSecond = new DateTime("@$medicineTransaction->leadTimeInSecond"); $diff = $endSecond->diff($startSecond); $leadTime = $diff->format('%dd %hh %im %ss'); $totalLeadTimeSeconds += $medicineTransaction->leadTimeInSecond; $totalCount++; @endphp @else @php $leadTime = "****"; @endphp @endif @php $createdDateFormated = \Helper::getDisplayDate($medicineTransaction->created_date)." ".$medicineTransaction->created_time; $issuedDateFormated = \Helper::getDisplayDate($medicineTransaction->issued_date)." ".$medicineTransaction->issued_time; @endphp @php $oldIndentID = $indentID; $leadTime = ''; @endphp @endforeach @if($count != 0 && $leadTimeSeconds != 0) @php $startSecond = new DateTime("@0"); $endSecond = new DateTime("@".ceil($leadTimeSeconds/$count)); $diff = $endSecond->diff($startSecond); $avgLeadTime = $diff->format('%dd %hh %im %ss'); @endphp @else @php $avgLeadTime = ''; @endphp @endif @if($totalCount != 0 && $totalLeadTimeSeconds != 0) @php $startSecond = new DateTime("@0"); $endSecond = new DateTime("@".ceil($totalLeadTimeSeconds/$totalCount)); $diff = $endSecond->diff($startSecond); $totalAvgLeadTime = $diff->format('%dd %hh %im %ss'); @endphp @else @php $totalAvgLeadTime = ''; @endphp @endif @else @php $srHeader = 1; $totalLeadTimeSeconds = 0; $totalCount = 0; $totalAvgLeadTime = 0; @endphp @foreach($medicineTransactionData as $medicineTransaction) @php $patName = " ".$medicineTransaction->patient_id." / ".$medicineTransaction->patient_name; $ipID = "IP - ".$medicineTransaction->ipd_reg_id; $indentID = $medicineTransaction->trn_id; $minCreatedDateFormated = \Helper::getDisplayDate($medicineTransaction->minCreatedDate)." ".$medicineTransaction->minCreatedTime; $maxIssuedDateFormated = \Helper::getDisplayDate($medicineTransaction->maxIssuedDate)." ".$medicineTransaction->maxIssuedTime; $count = $medicineTransaction->totalCount; $leadTimeSeconds = $medicineTransaction->totalLeadTimeInSecond; $totalCount += $medicineTransaction->totalCount; $totalLeadTimeSeconds += $medicineTransaction->totalLeadTimeInSecond; @endphp @if($count != 0 && $leadTimeSeconds != 0) @php $startSecond = new DateTime("@0"); $endSecond = new DateTime("@".ceil($leadTimeSeconds/$count)); $diff = $endSecond->diff($startSecond); $avgLeadTime = $diff->format('%dd %hh %im %ss'); @endphp @else @php $avgLeadTime = ''; @endphp @endif @endforeach @if($totalCount != 0 && $totalLeadTimeSeconds != 0) @php $startSecond = new DateTime("@0"); $endSecond = new DateTime("@".ceil($totalLeadTimeSeconds/$totalCount)); $diff = $endSecond->diff($startSecond); $totalAvgLeadTime = $diff->format('%dd %hh %im %ss'); @endphp @else @php $totalAvgLeadTime = ''; @endphp @endif @endif
@if($businessEntityMasterData[0]->logo != null) Pharmacy Logologo )}}"/> @endif
{{ $businessEntityMasterData[0]->name }}
{{$businessEntityMasterData[0]->add1. " " .$businessEntityMasterData[0]->add2 ." ".$businessEntityMasterData[0]->city." : " .$businessEntityMasterData[0]->pincode }}
{{"Phone : ".$businessEntityMasterData[0]->tel1}}
{{__('IP Medicine Issue Lead Time Report')}} {{__('Period')}} : {{\Helper::getDisplayDate($fromDate)}} {{__('TO')}} {{\Helper::getDisplayDate($toDate)}}
{{__('Sr.')}}    {{__('Indent No.')}} {{__('IP ID')}} {{__('Patient Details')}}
{{__('Sr.')}}    {{__('Medicine Name')}}  {{__('Requested Qty')}}  {{__('Issued Qty')}}  {{__('Indent By')}}  {{__('Issued By')}} {{__('Indent DateTime')}} {{__('Issued DateTime')}} {{__('Lead Time')}}
{{__('Sr.')}}    {{__('Indent No.')}} {{__('IP ID')}} {{__('Patient Details')}} {{__('Indent By')}} {{__('Issued By')}} {{__('Min Indent DateTime')}} {{__('Max Issued DateTime')}} {{__('Avg Lead Time')}}
{{__('Avg Lead Time')}} : {{$avgLeadTime}}
{{$srHeader++}}    {{$indentID}} {{$ipID}} {{$patName}}
{{$sr++}}    {{$medicineTransaction->product_name}}  {{$medicineTransaction->loose_quantity}}  {{$medicineTransaction->issue_qty}}  {{$medicineTransaction->createdBy}}  {{$medicineTransaction->issuedBy}} {{$createdDateFormated}} {{$issuedDateFormated}} {{$leadTime}}
{{__('Avg Lead Time')}} : {{$avgLeadTime}}
{{__('Overall Lead Time')}} : {{$totalAvgLeadTime}}
{{$srHeader++}}    {{$indentID}} {{$ipID}} {{$patName}} {{$medicineTransaction->createdBy}} {{$medicineTransaction->issuedBy}} {{$minCreatedDateFormated}} {{$maxIssuedDateFormated}} {{$avgLeadTime}}
{{__('Overall Lead Time')}} : {{$totalAvgLeadTime}}
{{ strtoupper(Session::get('userId'))." # ".$currentTime->format('d/m/Y H:i:s ')}}


{{__('Back')}}
@endsection @section('BootstrapModals') @endsection @section('ExternalJs') @endsection