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

 

@include('layouts.head')

Sales 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

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 }}
Customer Name : {{ isset($_GET['id']) && $_GET['id'] == "All" ? "All" : "Summary" }}
@php $grand_torder_quantity = 0; $grand_total_price = 0; $grand_total_commission_tk = 0; $grand_total_value = 0; $grand_r_torder_quantity = 0; $grand_r_total_price = 0; $grand_r_total_commission_tk = 0; $grand_r_total_value = 0; $grand_t_total_value = 0; @endphp @if (isset($_GET['id']) && $_GET['id'] == 'All') @elseif (isset($_GET['id']) && $_GET['id'] != "") @else @endif @if (isset($_GET['id']) && $_GET['id'] == 'All') @foreach($department_info as $txn_date => $dept) @php $sub_grand_qty = 0; $sub_grand_total = 0; $sub_grand_commission_tk = 0; $sub_grand_total_value = 0; @endphp @foreach($dept as $sales_id => $catrow) @php unset($product_quantity); $product_id = isset($catrow->product_id) ? explode(',',$catrow->product_id) : []; $product_qty = isset($catrow->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; $sub_torder_quantity = 0; $sub_total_price = 0; $sub_commission_tk = 0; $sub_total_value = 0; 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; $tp_price = $row->tp_price; $total = $product_qty; $commission_tk = $row->t_commission; $t_price = $row->t_price; $total_value = $t_price - $commission_tk; if(isset($product_quantity[$product_id]) && $catrow->sales_id == $row->sales_id) { $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; $t_r_quantity = $row->t_r_quantity; $t_r_commission = $row->t_r_commission; $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 ''; } } $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; $grand_t_total_value = $grand_total_value; @endphp @endforeach @endforeach @elseif (isset($_GET['id']) && $_GET['id'] != "") @foreach($department_info as $sales_id => $catrow) @php unset($product_quantity); $product_id = isset($catrow->product_id) ? explode(',',$catrow->product_id) : []; $product_qty = isset($catrow->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 $i = 1; $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]) && $row->sales_id == $catrow->sales_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 ''; } } $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; $grand_t_total_value = $grand_total_value; @endphp @if (isset($_GET['id']) && $_GET['id'] != "") @endif @endforeach @else @php $product_information = []; @endphp @foreach($department_info as $return_id => $catrow) @php unset($product_quantity); $product_id = isset($catrow->product_id) ? explode(',',$catrow->product_id) : []; $product_qty = isset($catrow->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]; } $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->quantity; $tp_price = $row->tp_price; $commission = $row->commission; $total = $product_qty; $commission_tk = $row->t_commission; $amount = $row->t_price; $total_value = $amount - $commission_tk; $t_r_quantity = $row->t_r_quantity; $t_r_amount = $t_r_quantity * $tp_price; $t_r_commission = $row->t_r_commission; if(isset($product_quantity[$product_id]) && $catrow->sales_id == $row->sales_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,'t_r_quantity'=>$t_r_quantity,'t_r_commission'=>$t_r_commission,'t_r_amount'=>$t_r_amount); $product_information[$product_id]['product_qty'] = ($product_information[$product_id]['product_qty'] ?? 0) + $product_qty; $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; //$product_information[$product_id]['t_r_quantity'] = ($product_information[$product_id]['t_r_quantity'] ?? 0) + $t_r_quantity; } } $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 @php $i=1; foreach($product_information as $info){ echo ''; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ' '; echo ''; $grand_r_torder_quantity += $info['t_r_quantity']; $grand_r_total_price += $info['t_r_amount']; $grand_r_total_commission_tk += $info['t_r_commission']; $grand_r_total_value += $info['t_r_amount']-$info['t_r_commission']; $grand_t_total_value += $info['total_value']-$info['t_r_amount']-$info['t_r_commission']; } @endphp @endif
S.L. ID Item Name Unit Sales Qty Amount Comm. Tk. Sub Total
S.L. ID Item Name Unit Sales Qty Amount Comm. Tk. Sub Total
S.L. ID Item Name Unit Sales Qty Amount Comm. Tk. Sales Total Return Qty Amount Comm. Tk. Return Total Sub Total
Date: {!! date('d-F-Y', strtotime($txn_date)) !!}
SI#{{ $sales_id }} {{'- - -'}}Customer Name : {{ $catrow->id }} - {{ $catrow->name }}
'. $i++ .''. $product_id .''. $product_name .''. $pack_type .''. $product_qty .''. $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) !!}
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) !!}
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) }}
SI#{{ $catrow->sales_id }} - - - Date: {!! date('d-F-Y', strtotime($catrow->txn_date)) !!}
'. $i++ .''. $product_id .''. $product_name .''. $pack_type .''. $product_qty .''. $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) }}
'. $i++ .''. $info['product_id'] .''. $info['product_name'] .''. $info['pack_type'] .''. $info['product_qty'] .''. number_format($info['amount'],2) .''. number_format($info['commission_tk'],2) .''. number_format($info['total_value'],2) .''. $info['t_r_quantity'] .''. number_format($info['t_r_amount'],2) .''. number_format($info['t_r_commission'],2) .''. number_format($info['t_r_amount']-$info['t_r_commission'],2) .''. number_format($info['total_value']-$info['t_r_amount']-$info['t_r_commission'],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) }} {!! number_format($grand_r_torder_quantity) !!} {{ number_format($grand_r_total_price,2) }} {{ number_format($grand_r_total_commission_tk,2) }} {{ number_format($grand_r_total_value,2) }} {{ number_format($grand_t_total_value,2) }}
IN WORDS : {!! numberTowords($grand_t_total_value) !!}
@endsection