@php $fs = explode(',',$setting->field_show); $fn = explode(',',$setting->field_name); $span = 0; $i=0; $netBillArray=[]; $chunk=$table_counter; $multipleTh=2;//0=>for One Time entire invoice 1=>for Each Group 2=>for every page header @endphp
@if($multipleTh==2) @endif @if($multipleTh==0) @endif @php $tot_dc = 0; $g_tot = 0; @endphp @forelse($groups as $group_id=>$productGroup) @if($multipleTh==1) @endif @php $pp=0; $total=0; $discount_total=0; if ($productGroup->first()->transaction_type == 4) { $transaction = $productGroup->unique('product_id'); } else { $transaction = $productGroup; } $counter=count($transaction); @endphp @forelse($transaction->chunk($chunk) as $ctransaction) @empty {{-- chuncked --}} @endforelse @php $g_tot += $total; $discount_total=($invoice->dc_percentage/100)*$total; $tot_dc += $discount_total; $netBillArray[$group_id]=($total-$discount_total); @endphp @if ($chalan != 1 && in_array(8, $fs)) @endif @empty {{-- group --}} @endforelse {{-- footer Total Table --}} @if ($chalan != 1 && in_array(12, $fs)) @if ($printData['invoice']->other_charge != 0) @endif @if ($printData['invoice']->other_dc_percentage != 0) @endif @php $net = array_sum($netBillArray); $nt = $printData['invoice']->other_dc_amount + ($setting->fraction_type == 1 ? ($net+$invoice->other_charge) : (round($net+$invoice->other_charge))); @endphp @if ($printData['invoice']->cash_amount > 0) @endif @if ($setting->show_balance == 1) @endif @if (in_array(9, $fs)) @endif @endif
{!! $head !!}
SL
@if (in_array(1, $fs))
{{ $fn[0] ? $fn[0] : 'Product Name' }}
@endif @if (in_array(2, $fs))
{{ $fn[1] ? $fn[1] : 'Local Name' }}
@endif @if (in_array(3, $fs))
{{ $fn[2] ? $fn[2] : 'Note' }}
@endif @if (in_array(4, $fs))
{{ $fn[3] ? $fn[3] : 'Qty' }}
@endif @if (in_array(10, $fs))
{{ $fn[9] ? $fn[9] : 'Unit' }}
@endif @if ($chalan != 1) @if (in_array(5, $fs))
{{ $fn[4] ? $fn[4] : 'Price' }}
@endif @if (in_array(13, $fs))
{{ $fn[12] ? $fn[12] : 'Total' }}
@endif @if (in_array(6, $fs))
{{ $fn[5] ? $fn[5] : 'Discount' }}
@endif @if (in_array(7, $fs))
{{ $fn[6] ? $fn[6] : 'Net Total' }}
@endif @endif @if($chunk==2)
SL
@if (in_array(1, $fs))
{{ $fn[0] ? $fn[0] : 'Product Name' }}
@endif @if (in_array(2, $fs))
{{ $fn[1] ? $fn[1] : 'Local Name' }}
@endif @if (in_array(3, $fs))
{{ $fn[2] ? $fn[2] : 'Note' }}
@endif @if (in_array(4, $fs))
{{ $fn[3] ? $fn[3] : 'Qty' }}
@endif @if (in_array(10, $fs))
{{ $fn[9] ? $fn[9] : 'Unit' }}
@endif @if ($chalan != 1) @if (in_array(5, $fs))
{{ $fn[4] ? $fn[4] : 'Price' }}
@endif @if (in_array(13, $fs))
{{ $fn[12] ? $fn[12] : 'Total' }}
@endif @if (in_array(6, $fs))
{{ $fn[5] ? $fn[5] : 'Discount' }}
@endif @if (in_array(7, $fs))
{{ $fn[6] ? $fn[6] : 'Net Total' }}
@endif @endif @endif
SL
@if (in_array(1, $fs))
{{ $fn[0] ? $fn[0] : 'Product Name' }}
@endif @if (in_array(2, $fs))
{{ $fn[1] ? $fn[1] : 'Local Name' }}
@endif @if (in_array(3, $fs))
{{ $fn[2] ? $fn[2] : 'Note' }}
@endif @if (in_array(4, $fs))
{{ $fn[3] ? $fn[3] : 'Qty' }}
@endif @if (in_array(10, $fs))
{{ $fn[9] ? $fn[9] : 'Unit' }}
@endif @if ($chalan != 1) @if (in_array(5, $fs))
{{ $fn[4] ? $fn[4] : 'Price' }}
@endif @if (in_array(13, $fs))
{{ $fn[12] ? $fn[12] : 'Total' }}
@endif @if (in_array(6, $fs))
{{ $fn[5] ? $fn[5] : 'Discount' }}
@endif @if (in_array(7, $fs))
{{ $fn[6] ? $fn[6] : 'Net Total' }}
@endif @endif @if($chunk==2)
SL
@if (in_array(1, $fs))
{{ $fn[0] ? $fn[0] : 'Product Name' }}
@endif @if (in_array(2, $fs))
{{ $fn[1] ? $fn[1] : 'Local Name' }}
@endif @if (in_array(3, $fs))
{{ $fn[2] ? $fn[2] : 'Note' }}
@endif @if (in_array(4, $fs))
{{ $fn[3] ? $fn[3] : 'Qty' }}
@endif @if (in_array(10, $fs))
{{ $fn[9] ? $fn[9] : 'Unit' }}
@endif @if ($chalan != 1) @if (in_array(5, $fs))
{{ $fn[4] ? $fn[4] : 'Price' }}
@endif @if (in_array(13, $fs))
{{ $fn[12] ? $fn[12] : 'Total' }}
@endif @if (in_array(6, $fs))
{{ $fn[5] ? $fn[5] : 'Discount' }}
@endif @if (in_array(7, $fs))
{{ $fn[6] ? $fn[6] : 'Net Total' }}
@endif @endif @endif
{{ ($groupNames->where('id',$group_id)->first() ? $groupNames->where('id',$group_id)->first()->name : '') }}
SL
@if (in_array(1, $fs))
{{ $fn[0] ? $fn[0] : 'Product Name' }}
@endif @if (in_array(2, $fs))
{{ $fn[1] ? $fn[1] : 'Local Name' }}
@endif @if (in_array(3, $fs))
{{ $fn[2] ? $fn[2] : 'Note' }}
@endif @if (in_array(4, $fs))
{{ $fn[3] ? $fn[3] : 'Qty' }}
@endif @if (in_array(10, $fs))
{{ $fn[9] ? $fn[9] : 'Unit' }}
@endif @if ($chalan != 1) @if (in_array(5, $fs))
{{ $fn[4] ? $fn[4] : 'Price' }}
@endif @if (in_array(13, $fs))
{{ $fn[12] ? $fn[12] : 'Total' }}
@endif @if (in_array(6, $fs))
{{ $fn[5] ? $fn[5] : 'Discount' }}
@endif @if (in_array(7, $fs))
{{ $fn[6] ? $fn[6] : 'Net Total' }}
@endif @endif @if($chunk==2)
SL
@if (in_array(1, $fs))
{{ $fn[0] ? $fn[0] : 'Product Name' }}
@endif @if (in_array(2, $fs))
{{ $fn[1] ? $fn[1] : 'Local Name' }}
@endif @if (in_array(3, $fs))
{{ $fn[2] ? $fn[2] : 'Note' }}
@endif @if (in_array(4, $fs))
{{ $fn[3] ? $fn[3] : 'Qty' }}
@endif @if (in_array(10, $fs))
{{ $fn[9] ? $fn[9] : 'Unit' }}
@endif @if ($chalan != 1) @if (in_array(5, $fs))
{{ $fn[4] ? $fn[4] : 'Price' }}
@endif @if (in_array(13, $fs))
{{ $fn[12] ? $fn[12] : 'Total' }}
@endif @if (in_array(6, $fs))
{{ $fn[5] ? $fn[5] : 'Discount' }}
@endif @if (in_array(7, $fs))
{{ $fn[6] ? $fn[6] : 'Net Total' }}
@endif @endif @endif
@php $odd=0; @endphp @forelse($ctransaction as $item) @php $odd++; $unit_qty = (in_array(14, $fs) ? $item->unit_qty : 1); $item_qty = $item->quantity; $item_price = $item->avg_price; $dc = ($item_price * $item_qty) * ($item->dc_price/100); if ($productGroup->first()->transaction_type == 4) { $item_qty = $productGroup->where('product_id', $item->product_id)->sum('quantity'); if (get_class($item) == 'App\Models\Inventory\DamageTransaction') { $item_price = $item->price; } } $t = $item_price * $item_qty; $net = $t - $dc; @endphp
{{++$i}}
@if (in_array(1, $fs))
{{ $item->product->name_eng . (store_info()->is_barcode_show == 1 ? ' ('. $item->product->barcode.')' : '') }}
@endif @if (in_array(2, $fs))
{{ $item->product->name_local . (store_info()->is_barcode_show == 1 ? ' ('. $item->product->barcode.')' : '') }}
@endif @if (in_array(3, $fs))
{{ $item->description }}
@endif @if (in_array(4, $fs))
{{ dualUnitQtyConverter($item_qty, 1, $unit_qty) }}
@endif @if (in_array(10, $fs))
{{ ((in_array(15, $fs) && $item->product->secoundaryUnit) ? $item->product->secoundaryUnit->name : $item->product->primaryUnit->name) }}
@endif @if ($chalan != 1) @if (in_array(5, $fs))
{{ number_format($item_price * $unit_qty, 2) }}
@endif @if (in_array(13, $fs))
{{ $setting->fraction_type == 1 ? number_format($t, 2) : number_format(round($t), 2) }}
@endif @if (in_array(6, $fs))
{{ $item->dc_price }}% ({{ $setting->fraction_type == 1 ? number_format($dc, 2) : number_format(round($dc), 2) }})
@endif @if (in_array(7, $fs))
{{ $setting->fraction_type == 1 ? number_format($net ,2) : number_format(round($net), 2) }}
@endif @endif @php $total += $t; @endphp @empty {{-- chuncked item --}} @endforelse @if(($chunk==2) && (($counter%2)==1) && $odd==1)
-
@if (in_array(1, $fs))
-
@endif @if (in_array(2, $fs))
-
@endif @if (in_array(3, $fs))
-
@endif @if (in_array(4, $fs))
-
@endif @if (in_array(10, $fs))
-
@endif @if ($chalan != 1) @if (in_array(5, $fs))
-
@endif @if (in_array(13, $fs))
-
@endif @if (in_array(6, $fs))
-
@endif @if (in_array(7, $fs))
-
@endif @endif @endif
@if($chunk==2)
@endif
Total
{{ $setting->fraction_type == 1 ? number_format($total,2) : number_format(round($total), 2) }}
@if($chunk==2)
@endif
Discount @ {{ $invoice->dc_percentage }}%
{{ $setting->fraction_type == 1 ? number_format($discount_total, 2) : number_format(round($discount_total), 2) }}
@if($chunk==2)
@endif
Net Amount
{{ $setting->fraction_type == 1 ? number_format(($total-$discount_total), 2) : number_format(round($total-$discount_total), 2) }}
TRANSACTION SUMMERY
Total Amount
{{ $setting->fraction_type == 1 ? number_format($g_tot, 2) : number_format(round($g_tot), 2) }}
Total Discount @ {{ $invoice->dc_percentage }}%
(-) {{ $setting->fraction_type == 1 ? number_format($tot_dc, 2) : number_format(round($tot_dc), 2) }}
{{ $invoice->issue_type_note ? '('.$invoice->issue_type_note.')' : '' }} Add Charge
(+) {{ $setting->fraction_type == 1 ? number_format($invoice->other_charge, 2) : number_format(round($invoice->other_charge), 2) }}
{{ $printData['invoice']->party->other_commission_title ?? 'Additional' }} @ {{ abs($printData['invoice']->other_dc_percentage) }}%
({{ $printData['invoice']->party->com_calc_type == 1 ? '+' : '-' }}) {{ $setting->fraction_type == 1 ? number_format(abs($printData['invoice']->other_dc_amount), 2) : number_format(round($printData['invoice']->other_dc_amount), 2) }}
Net Amount
{{ number_format($nt, 2) }}
Paid Amount
{{ $printData['invoice']->cash_amount }}
Due
{{ round($nt, 2) - $printData['invoice']->cash_amount }}
Opening Balance:
{{ number_format(getPartyBalance($invoice->party_id, $invoice->date), 2) }}
Closing Balance:
{{ number_format(getPartyBalance($invoice->party_id, $invoice->date) + $nt, 2) }}
   {{ ucwords(getNumberInWords(number_format($nt, 2, '.', '') )) }} {{ ($currency ? $currency->name : '') }} Only.
{!!$foot!!}