@php function getLocationData($value, $type = 'sale') { $customer = null; $district = ''; $department = ''; $province = ''; $type_doc = null; if ($type == 'sale') { $type_doc = $value->document; } if ( $value && $type_doc && $type_doc->customer ) { $customer = $type_doc->customer; } if ($customer != null) { if ( $customer->district && $customer->district->description ) { $district = $customer->district->description; } if ( $customer->department && $customer->department->description ) { $department = $customer->department->description; } if ( $customer->province && $customer->province->description ) { $province = $customer->province->description; } } return [ 'district' => $district, 'department' => $department, 'province' => $province, ]; } @endphp REPORTE PRODUCTOS @if(!empty($records))
@include('report::general_items.partials.report_pdf_header',[ 'document_type_id'=>$document_type_id, 'type'=>$type, 'plus'=>$plus, ]) @if($type == 'sale') @if($document_type_id == '80') @php $exiteNotaVenta = true; @endphp @foreach($records as $key => $value) @php if(isset($qty)) unset($qty); $series = ''; if (isset($value->item->lots)) { $series_data = collect($value->item->lots)->where('has_sale', 1)->pluck('series')->toArray(); $series = implode(" - ", $series_data); } $total_item_purchase = \Modules\Report\Http\Resources\GeneralItemCollection::getPurchaseUnitPrice($value); $utility_item = $value->total - $total_item_purchase; //totales $totalFinal += $value->total; $totalCompraFinal += $total_item_purchase; $totalGananciaFinal += $utility_item; $item = $value->getModelItem(); $model = $item->model; $document = $value->sale_note; $platform = $item->getWebPlatformModel(); if ($platform !== null) { $platform = $platform->name; } $pack = $item->getSetItems(); @endphp @include('report::general_items.partials.report_pdf_body_sale',[ 'document_type_id'=>$document_type_id, 'document'=>$document, 'type'=>$type, 'value'=>$value, 'key'=>$key, 'item'=>$item, ]) @if($pack !== null) @foreach($pack as $item_pack) @php $value->item = $item_pack->individual_item; $item = $value->item; $qty = $item_pack->quantity; @endphp @include('report::general_items.partials.report_pdf_body_sale',[ 'document_type_id'=>$document_type_id, 'document'=>$document, 'type'=>$type, 'value'=>$value, 'key'=>$key, 'item'=>$item, ]) @endforeach @endif @endforeach @else @php if($document_type_id != '80' && $type != 'sale') $existeCompra = true; @endphp @foreach($records as $key => $value) @php if(isset($qty)) unset($qty); $series = ''; if (isset($value->item->lots)) { $series_data = collect($value->item->lots)->where('has_sale', 1)->pluck('series')->toArray(); $series = implode(" - ", $series_data); } $total_item_purchase = \Modules\Report\Http\Resources\GeneralItemCollection::getPurchaseUnitPrice($value); $utility_item = $value->total - $total_item_purchase; //totales $totalFinal += $value->total; $totalCompraFinal += $total_item_purchase; $totalGananciaFinal += $utility_item; $item = $value->getModelItem(); $model = $item->model; $document = $value->document; $purchseOrder = $document->purchase_order; $platform = $item->getWebPlatformModel(); if ($platform !== null) { $platform = $platform->name; } $pack = $item->getSetItems(); $item = $value->item; $stablihsment = getLocationData($value, $type); @endphp @include('report::general_items.partials.report_pdf_body_sale',[ 'document_type_id'=>$document_type_id, 'document'=>$document, 'type'=>$type, 'value'=>$value, 'key'=>$key, 'item'=>$item, 'stablihsment'=>$stablihsment, ]) @if($pack !== null) @foreach($pack as $item_pack) @php $value->item = $item_pack->individual_item; $item = $value->item; $qty = $item_pack->quantity; // dd($item); @endphp @include('report::general_items.partials.report_pdf_body_sale', [ 'document_type_id'=>$document_type_id, 'document'=>$document, 'type'=>$type, 'value'=>$value, 'key'=>$key, 'item'=>$item, 'qty'=>$qty, 'stablihsment'=>$stablihsment, ]) @endforeach @endif @endforeach @endif @else @foreach($records as $key => $value) @php $document = $value->purchase; @endphp @include('report::general_items.partials.report_pdf_body_purchase', [ 'value'=>$value, 'document'=>$document, ]) @endforeach @endif @php $isSaleNote = ($document_type_id != '80' && $type == 'sale') ? true : false; $totalColumnas = 19; @endphp @if($exiteNotaVenta== true) @php // dd("dd"); $totalColumnas = $totalColumnas-3; @endphp @endif @if( $existeCompra == true) @php // dd("1111"); $totalColumnas = $totalColumnas-2; @endphp @endif @php // dd($totalColumnas); @endphp
Totales {{ $totalColumnas }} {{ $totalCompraFinal }} {{ $totalGananciaFinal }}
@else

No se encontraron registros.

@endif