@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