@extends('layouts.app') @section('title') {{'Foreign Sales Report'}} @endsection @section('content') @include('layouts.numbertowords')
Foreign Sales Report Back
@if (Session::has('msg'))
{{ Session::get('msg') }}
@endif
Search Customer
Search Group
Search Sub Group
Start Date
End Date

 

@include('layouts.head')

Foreign Sales Report

{!! 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

Customer 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 }}
@if (isset($_GET['group_id']) && $_GET['group_id'] != "") @php $selected_group = null; foreach ($group_info as $val) { if ($val->id == $_GET['group_id']) { $selected_group = $val; break; } } @endphp @if ($selected_group)
Group Name: {{ $selected_group->values }}
@endif @elseif (isset($_GET['sub_group_id']) && $_GET['sub_group_id'] != "") @php $selected_sub_group = null; foreach ($sub_group_info as $val) { if ($val->id == $_GET['sub_group_id']) { $selected_sub_group = $val; break; } } @endphp @if ($selected_sub_group)
Sub Group Name: {{ $selected_sub_group->department_name }}
@endif @else
Customer Name : {{ isset($_GET['id']) && $_GET['id'] == "All" ? "All" : "Summary" }}
@endif
{{-- --}} @php $i = 1; $grand_torder_quantity = 0; $grand_total_price = 0; $grand_total_commission_tk = 0; $grand_total_value = 0; @endphp @if (isset($_GET['id']) && $_GET['id'] == 'All') @foreach($department_info as $cust_name => $dept) @php $sub_grand_qty = 0; $sub_grand_total = 0; $sub_grand_commission_tk = 0; $sub_grand_total_value = 0; $product_information = []; @endphp @foreach($dept as $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 $sub_torder_quantity = 0; $sub_total_price = 0; $sub_commission_tk = 0; $sub_total_value = 0; $product_information = []; foreach($product_info as $row) { $product_id = $row->product_id; $product_name = $row->product_name; $pack_type = $row->pack_type; $product_qty = $row->quantity; $tp_price = $row->tp_price; $commission = $row->commission; $total = $product_qty; $amount = $total * $tp_price; $commission_tk = ($amount * $commission)/100; $total_value = $amount - $commission_tk; if(isset($product_quantity[$product_id]) && $row->supplier_id == $catrow->supplier_id) { $sub_torder_quantity += $product_qty; $sub_commission_tk += $commission_tk; $sub_total_price += $amount; $sub_total_value += $total_value; if(!isset($product_information[$product_id])) $product_information[$product_id] = array('product_id'=>$product_id,'product_name'=>$product_name,'pack_type'=>$pack_type); $product_information[$product_id]['product_qty'] = ($product_information[$product_id]['product_qty'] ?? 0) + $product_qty; $product_information[$product_id]['tp_price'] = ($product_information[$product_id]['tp_price'] ?? 0) + $tp_price; $product_information[$product_id]['amount'] = ($product_information[$product_id]['amount'] ?? 0) + $amount; $product_information[$product_id]['commission_tk'] = ($product_information[$product_id]['commission_tk'] ?? 0) + $commission_tk; $product_information[$product_id]['total_value'] = ($product_information[$product_id]['total_value'] ?? 0) + $total_value; } } foreach($product_information as $info){ echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; // echo ' '; echo ' '; echo ' '; echo ' '; echo ''; } $sub_grand_qty += $sub_torder_quantity; $sub_grand_total += $sub_total_price; $sub_grand_commission_tk += $sub_commission_tk; $sub_grand_total_value += $sub_total_value; $grand_torder_quantity += $sub_torder_quantity; $grand_total_price += $sub_total_price; $grand_total_commission_tk += $sub_commission_tk; $grand_total_value += $sub_total_value; @endphp {{-- --}} @endforeach {{-- --}} @endforeach @else @foreach($department_info as $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 $sub_torder_quantity = 0; $sub_total_price = 0; $sub_commission_tk = 0; $sub_total_value = 0; 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; $tp_price = $row->tp_price; $total = $product_qty; $amount = $total * $tp_price; $commission_tk = $row->t_commission; $total_value = $amount - $commission_tk; if(isset($product_quantity[$product_id])) { $sub_torder_quantity += $product_qty; $sub_commission_tk += $commission_tk; $sub_total_price += $amount; $sub_total_value += $total_value; echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; // echo ' '; echo ' '; echo ' '; echo ' '; echo ''; } } $grand_torder_quantity += $sub_torder_quantity; $grand_total_price += $sub_total_price; $grand_total_commission_tk += $sub_commission_tk; $grand_total_value += $sub_total_value; @endphp {{-- --}} @endforeach @endif {{-- --}}
S.L. ID Item Name Unit Sales QuantitySales PriceAmount Comm. Tk. Total
Customer Name: {{ $cust_name }}
{{ $catrow->department_name }}
'. $i++ .''. $info['product_id'] .''. $info['product_name'] .''. $info['pack_type'] .''. $info['product_qty'] .''. $info['tp_price'] .''. number_format($info['amount'],2) .''. number_format($info['commission_tk'],2) .''. number_format($info['total_value'],2) .'
Sub Total = {!! number_format($sub_torder_quantity) !!}{!! number_format($sub_total_price,2) !!} {!! number_format($sub_commission_tk,2) !!} {!! number_format($sub_total_value,2) !!}
Sub Grand Total = {!! number_format($sub_grand_qty) !!}{!! number_format($sub_grand_total,2) !!} {!! number_format($sub_grand_commission_tk,2) !!} {!! number_format($sub_grand_total_value,2) !!}
{{ $catrow->department_name }}
'. $i++ .''. $product_id .''. $product_name .''. $pack_type .''. $product_qty .''. $tp_price .''. $amount .''. $commission_tk .''. $total_value .'
Sub Total = {!! number_format($sub_torder_quantity) !!}{!! number_format($sub_total_price,2) !!} {!! number_format($sub_commission_tk,2) !!} {!! number_format($sub_total_value,2) !!}
Grand Total = {!! number_format($grand_torder_quantity) !!}{{ number_format($grand_total_price,2) }} {{ number_format($grand_total_commission_tk,2) }} {{ number_format($grand_total_value,2) }}
IN WORDS : {!! numberTowords($grand_total_value) !!}
@endsection