@extends('layouts.home_layout') @php $pageTitle = "Breed Wise Animal Report"; @endphp @section('title', $pageTitle) @section('style') @endsection @section('content') @php // dd($list); @endphp

{{$pageTitle}}

@if (sizeof($list) > 0) @include('common.print_css') @php $fullColspan = 11; $partner_id = request()->get('partner_id'); $cooperative_id = request()->get('cooperative_id'); $group_id = request()->get('group_id'); $farmer_id = request()->get('farmer_id'); $animal_type_id = request()->get('animal_type_id'); $cattle_gender_id = request()->get('cattle_gender_id'); $livestock_breed_id = request()->get('cattle_gender_id'); $division_id = request()->get('division_id'); $district_id = request()->get('district_id'); $upazilla_id = request()->get('upazilla_id'); $union_id = request()->get('union_id'); $village_id = request()->get('village_id'); $firstColspan = 2; $lastColspan = ($fullColspan - $firstColspan); @endphp @if ($reportInfo['partners']) @endif @if ($reportInfo['cooperative']) @endif @if ($reportInfo['group']) @endif @if ($reportInfo['farmer']) @endif @if ($reportInfo['animal_type']) @endif @if ($reportInfo['livestock_breed']) @endif @if ($reportInfo['cattle_gender']) @endif @if ($reportInfo['division']) @endif @if ($reportInfo['district']) @endif @if ($reportInfo['upazilla']) @endif @if ($reportInfo['union']) @endif @if ($reportInfo['village']) @endif @php $i = 1; $breedTotalAnimal = json_decode($breedTotalAnimal); $cattleWeight = json_decode($cattleWeight); @endphp @foreach ($list as $key => $v) @php $bta_arr = array_values(array_filter($breedTotalAnimal, function($nta) use($v) { return $nta->cooperative_id == $v->id; })); @endphp @if ($bta_arr) @php $j = 1; @endphp @foreach ($bta_arr as $item) @php $currentStock = ($item->totalCattle - $item->totalSoldCattle); $totalCattleWeight = 0; // $number_of_cattle = 1; $avg_sold_weight = 0; $totalFatteningDays = 0; $fatteningMonth = 0; $weight_arr = array_values(array_filter($cattleWeight, function($weight) use ($v, $item) { return $weight->cooperative_id == $v->id && $weight->livestock_breed_id == $item->livestock_breed_id; })); if($weight_arr) { // $number_of_cattle = sizeof($weight_arr); foreach ($weight_arr as $t) { $totalCattleWeight += $t->weight ? $t->weight : $t->scale_weight; $totalFatteningDays += $t->fattening_days ?: 0; } // $avg_sold_weight = ($totalCattleWeight / $number_of_cattle); } else { // $avg_sold_weight = $item->cattle_weight; // $totalCattleWeight += $item->cattle_weight; } if($item->totalSoldCattle != 0) { // $avg_sold_weight = ($totalCattleWeight / 1); $avg_sold_weight = ($totalCattleWeight / $item->totalSoldCattle); $avg_fattening_days = ($totalFatteningDays / $item->totalSoldCattle); $start_date = new DateTime(date("Y/m/d")); $end_date = new DateTime(date("Y/m/d",strtotime("+$avg_fattening_days days"))); $dd = date_diff($start_date, $end_date); $fatteningMonth = "$dd->m months $dd->d days"; } @endphp @if ($j==1) @endif @endforeach @endif @endforeach

{{$pageTitle}}

Partner Name {{$reportInfo['partners']->partner_name_en}} {{$reportInfo['partners']->partner_code ? "[{$reportInfo['partners']->partner_code}]" : ''}}
Cooperative Name {{$reportInfo['cooperative']->cp_name_en}} {{$reportInfo['cooperative']->cp_code ? "[{$reportInfo['cooperative']->cp_code}]" : ''}}
Farmer Group Name {{$reportInfo['group']->group_name_en}} {{$reportInfo['group']->group_code ? "[{$reportInfo['group']->group_code}]" : ''}}
Farmer Name {{$reportInfo['farmer']->farmer_name_en}} {{$reportInfo['farmer']->farmer_code ? "[{$reportInfo['farmer']->farmer_code}]" : ''}}
Animal Type Name {{$reportInfo['animal_type']->type_name}}
Livestock Breed Name {{$reportInfo['livestock_breed']->breed_name_en}}
Cattle Gender {{$reportInfo['cattle_gender']->gender_name}}
Division Name {{$reportInfo['division']->name}}
District Name {{$reportInfo['district']->name}}
Upazila Name {{$reportInfo['upazilla']->name}}
Union Name {{$reportInfo['union']->name}}
Village Name {{$reportInfo['village']->en_name}}
Reporting Date {{date('d-M-Y')}}
# Cooperative Name # {!!str_repeat(" ", 15)!!}Breed Name{!!str_repeat(" ", 15)!!} Number of Animals Sold Current Stock Avg. Weight at Sold Avg. Duration of Fattening (month)
{{($key+1)}} {{$v->cp_name_en}}{{$j++}} {{$item->breed_name_en}} {{$item->totalCattle}} {{$item->totalSoldCattle}} {{$currentStock}} {{$avg_sold_weight}} {{$fatteningMonth?:''}}
@endif
{{-- Modal Start id="modal" --}} {{-- Modal End --}}
@endsection @section('script') @endsection