@extends('layouts.app') @section('title') {{'Purchase Register'}} @endsection @section('content') @include('layouts.numbertowords')
Purchase Register Back
@if (Session::has('msg'))
{{ Session::get('msg') }}
@endif
Search Supplier
Start Date
End Date

 

@include('layouts.head')

Purchase Register

{!! date('d-F-Y', strtotime($start_date)) !!} to {!! date('d-F-Y', strtotime($end_date)) !!}

@if (isset( $supplier_list[0]->id) && $supplier_list[0]->id !='') @else @endif

Supplier Name : {{ $supplier_list[0]->id }} - {{ $supplier_list[0]->name }}
Contact Person : {{ $supplier_list[0]->person_name }}
Address : {{ $supplier_list[0]->address }}
Mobile No. : {{ $supplier_list[0]->mobile }}
Supplier Name : {{ isset($_GET['id']) && $_GET['id'] == "All" ? "All" : "Summary" }}
@if (isset($_GET['id']) && $_GET['id'] == 'All') @elseif (isset($_GET['id']) && $_GET['id'] != "") @else @endif @php $total = 0; $g_torder_quantity = 0; $g_r_torder_quantity = 0; $actual_pur=0; $avg_price=0; $g_t_quantity = 0; $g_t_total_price = 0; @endphp @if (request()->get('id') == 'All') @foreach($department_info as $txn_date => $dept) @php $remove_dup_return=[]; $sub_grand_qty = 0; $sub_grand_r_qty = 0; $sub_grand_act_pur = 0; $sub_grand_total = 0; @endphp @foreach($dept as $invoice_id => $catrow) @php unset($product_quantity); $product_id = explode(',',$catrow->product_id); $product_qty = explode(',',$catrow->product_qty); $product_information = []; foreach ($product_id as $k => $v) { $product_quantity[$v] = 0; $product_information[$v] = $product_qty[$k]; } foreach ($product_id as $k => $v) { $product_quantity[$v] += @$product_qty[$k]; } @endphp @php $i = 1; $torder_quantity = 0; $r_torder_quantity = 0; $act_pur = 0; $t_quantity = 0; $t_total_price = 0; $products=[]; foreach($product_info as $row) { // print_r($product_information[$row->product_id]); // print_r($row->product_id); // exit(); $product_qty = isset($product_information[$row->product_id]) ? $product_information[$row->product_id] : 0; //$product_qty = $product_information[$row->product_id]; $product_id = $row->product_id; $product_name = $row->product_name; $pack_type = $row->pack_type; if(!isset($remove_dup_return[$txn_date][$catrow->name])) $r_product_qty = $row->t_r_quantity; else $r_product_qty=null; $rest_pur=$product_qty-$r_product_qty; $dp_price = $row->dp_price; $total = $product_qty; $total_value = $product_qty * $dp_price; // $total_value = $row->t_dp_price; if($total >0){ $avg_price = $total_value / $total; }else{ $avg_price = ""; } if(isset($product_quantity[$product_id]) && $row->invoice_id == $catrow->invoice_id) { $torder_quantity += $product_qty; $r_torder_quantity += $r_product_qty; $act_pur += $rest_pur; $t_quantity += $total; $t_total_price += $total_value; echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; // echo ' '; // echo ' '; //echo ' '; echo ' '; echo ' '; echo ''; if(!isset($products[$product_id])) $products[$product_id]=$product_id; } } $g_torder_quantity += $torder_quantity; $g_r_torder_quantity += $r_torder_quantity; $g_t_quantity += $t_quantity; $actual_pur += $act_pur; $g_t_total_price += $t_total_price; $sub_grand_qty += $torder_quantity; $sub_grand_total += $t_total_price; $sub_grand_r_qty += $r_torder_quantity; $sub_grand_act_pur += $act_pur; if(!isset($remove_dup_return[$txn_date][$catrow->name])) $remove_dup_return[$txn_date][$catrow->name]=1; @endphp {{-- --}} @endforeach {{-- --}} @endforeach {{-- --}} @elseif (isset($_GET['id']) && $_GET['id'] != "") @php $i = 1; @endphp @foreach($department_info as $invoice_id => $catrow) @php unset($product_quantity); $product_id = explode(',',$catrow->product_id); $product_qty = explode(',',$catrow->product_qty); foreach ($product_id as $k => $v) { $product_quantity[$v] = 0; } foreach ($product_id as $k => $v) { $product_quantity[$v] += @$product_qty[$k]; } @endphp @php $remove_dup_return=[]; $torder_quantity = 0; $r_torder_quantity = 0; $act_pur=0; $t_quantity = 0; $t_total_price = 0; //print_r($product_info); foreach($product_info as $row) { $product_id = $row->product_id; $product_name = $row->product_name; $pack_type = $row->pack_type; $product_qty = $row->t_quantity; if(!isset($remove_dup_return[$catrow->txn_date])) $r_product_qty = $row->t_r_quantity; else $r_product_qty = null; $rest_pur=$product_qty-$r_product_qty; $dp_price = $row->dp_price; $total = $product_qty; //$total_value = $product_qty * $dp_price; $total_value = $row->t_dp_price; if($total >0){ $avg_price = $total_value / $total; }else{ $avg_price = ""; } if(isset($product_quantity[$product_id]) && $catrow->invoice_id == $row->invoice_id ) { $torder_quantity += $product_qty; $r_torder_quantity += $r_product_qty; $act_pur += $rest_pur; $t_quantity += $total; $t_total_price += $total_value; echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; // echo ' '; // echo ' '; // echo ' '; // echo ' '; echo ' '; echo ' '; echo ''; } if(!isset($remove_dup_return[$catrow->txn_date])) $remove_dup_return[$catrow->txn_date] = 1; } $g_torder_quantity += $torder_quantity; $g_r_torder_quantity += $r_torder_quantity; $g_t_quantity += $t_quantity; $actual_pur += $act_pur; $g_t_total_price += $t_total_price; @endphp @if (isset($_GET['id']) && $_GET['id'] != "") {{-- --}} @endif @endforeach {{-- --}} @else @php $i = 1; $prod_information=[]; @endphp @foreach($department_info as $invoice_id => $catrow) @php unset($product_quantity); $product_id = explode(',',$catrow->product_id); $product_qty = explode(',',$catrow->product_qty); foreach ($product_id as $k => $v) { $product_quantity[$v] = 0; } foreach ($product_id as $k => $v) { if(isset($product_quantity[$k])) $product_quantity[$v] += @$product_qty[$k]; } $torder_quantity = 0; $t_quantity = 0; $t_total_price = 0; //print_r($product_info); foreach($product_info as $row) { $product_id = $row->product_id; $product_name = $row->product_name; $pack_type = $row->pack_type; $product_qty = $row->t_quantity; $r_product_qty = $row->t_r_quantity; $dp_price = $row->dp_price; $total = $product_qty; //$total_value = $total * $dp_price; $total_value_dp = $row->t_dp_price; $total_value_dp_re = $row->t_r_dp_price; $total_value = $total_value_dp - $total_value_dp_re; if(isset($product_quantity[$product_id]) ) { if(!isset($prod_information[$product_id])) $prod_information[$product_id]=array('product_qty'=>$product_qty,'r_product_qty'=>$r_product_qty,'product_name'=>$product_name,'pack_type'=>$pack_type,'dp_price'=>$dp_price ,'total_value'=>$total_value); else{ $prod_information[$product_id]['product_qty']+=$product_qty; $prod_information[$product_id]['r_product_qty']+=$r_product_qty; } } } @endphp @endforeach @php foreach($prod_information as $product_id => $prod){ $rest_pur = $prod['product_qty'] - $prod['r_product_qty']; $actual_pur += $rest_pur; //$total_value = $rest_pur * $prod['dp_price']; $total_value = $prod['total_value']; if($rest_pur > 0){ $avg_price = $total_value / $rest_pur; } else{ $avg_price = 0; } $g_torder_quantity += $prod['product_qty']; $g_r_torder_quantity += $prod['r_product_qty']; $g_t_total_price += $total_value; echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; //echo ' '; echo ' '; echo ' '; echo ''; } @endphp @endif
S.L. ID Item Name Unit Purchase Qty Avg Price Total
S.L. ID Item Name Unit Purchase Qty Avg Price Total
S.L. ID Item Name Unit Purchase Qty Return Qty Actual Purchase Avg Price Total
Date: {!! date('d-F-Y', strtotime($txn_date)) !!}
PI#{{ $invoice_id }} {{'- - -'}}Supplier Name : {{ $catrow->name }}
'. $i++ .''. $product_id .''. $product_name .''. $pack_type .''. $product_qty .''. $r_product_qty .''. $rest_pur .''. $dp_price .''. number_format($avg_price,2) .''. number_format($total_value,2) .'
Voucher Total = {!! number_format($torder_quantity) !!}{!! number_format($r_torder_quantity) !!} {!! number_format($act_pur) !!} {!! number_format($t_total_price,2) !!}
Sub Total = {!! number_format($sub_grand_qty) !!}{!! number_format($sub_grand_r_qty) !!} {!! number_format($sub_grand_act_pur) !!} {!! number_format($sub_grand_total,2) !!}
Grand Total = {!! number_format($g_torder_quantity) !!}{!! number_format($g_r_torder_quantity) !!} {!! number_format($actual_pur) !!} {{ number_format($g_t_total_price,2) }}
PI#{{ $catrow->invoice_id }}--Date: {!! date('d-F-Y', strtotime($catrow->txn_date)) !!}
'. $i++ .''. $product_id .''. $product_name .''. $pack_type .''. $product_qty .''. $r_product_qty .''. $rest_pur .''. $dp_price .''. $total_value .''. number_format($avg_price,2) .''. number_format($total_value,2) .'
Sub Total = {!! number_format($torder_quantity) !!}{!! number_format($r_torder_quantity) !!} {!! number_format($act_pur) !!} {!! number_format($t_total_price,2) !!}
Grand Total = {!! number_format($g_torder_quantity) !!}{!! number_format($g_r_torder_quantity) !!} {!! number_format($actual_pur) !!} {{ number_format($g_t_total_price,2) }}
'. $i++ .''. $product_id .''. $prod['product_name'] .''. $prod['pack_type'] .''. $prod['product_qty'] .''. $prod['r_product_qty'] .''. $rest_pur .''. $prod['dp_price'] .''. number_format($avg_price,2) .''. number_format($total_value,2) .'
Grand Total = {!! number_format($g_torder_quantity) !!} {!! number_format($g_r_torder_quantity) !!} {!! number_format($actual_pur) !!} {{ number_format($g_t_total_price,2) }}
IN WORDS : {!! numberTowords($g_t_total_price) !!}
@endsection