@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; $typeOfCalculation = 1; $totalDamageReturn = 0; @endphp @forelse($groups as $group_id=>$productGroup) @if ($multipleTh == 1) @endif @php $pp = 0; $netBillArray[$group_id] = 0; $total = 0; $netHiddenTotal = 0; $discount_total = 0; $discountHiddenTotal = 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 = $typeOfCalculation == 1 ? $discountHiddenTotal : ($invoice->dc_percentage / 100) * $total; $tot_dc += $discount_total; $netBillArray[$group_id] = $typeOfCalculation == 1 ? $netHiddenTotal : $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 ($totalDamageReturn > 0) @endif @if ($printData['invoice']->other_dc_percentage != 0) @endif @php $net = array_sum($netBillArray) + $totalDamageReturn; $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) @php $p_balance = ledgerWiseValue([$invoice->party_id=> $invoice->party->account_id], $invoice->date); @endphp @endif @if (in_array(9, $fs)) @endif @endif
{!! $head !!}
{{__('obs.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
{{__('obs.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)
{{__('obs.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 : '' }}
{{__('obs.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++; $isDamageReturn = 0; $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; if ($item->transaction_type == 7 && $item->dr_cr == 0) { $isDamageReturn = 1; $total += 0; $netHiddenTotal += 0; $totalDamageReturn += $net * ($invoice->party_return_percentage / 100); } else { $total += $t; $discountHiddenTotal += $dc; $netHiddenTotal += $net; } @endphp
{{ ++$i }}
@if (in_array(1, $fs))
{{ $item->product->name_eng . (store_info()->is_barcode_show == 1 ? ' (' . $item->product->barcode . ')' : '') }} {{ $isDamageReturn == 1 ? '(FD)' : '' }}
@endif @if (in_array(2, $fs))
{{ $item->product->name_local . (store_info()->is_barcode_show == 1 ? ' (' . $item->product->barcode . ')' : '') }} {{ $isDamageReturn == 1 ? '(FD)' : '' }}
@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 @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
{{__('obs.total')}}
{{ $setting->fraction_type == 1 ? number_format($total, 2) : number_format(round($total), 2) }}
@if ($chunk == 2)
@endif
{{__('obs.discount')}} @ {{ $invoice->dc_percentage }}%
{{ $setting->fraction_type == 1 ? number_format($discount_total, 2) : number_format(round($discount_total), 2) }}
@if ($chunk == 2)
@endif
{{__('obs.net_amount')}}
{{ $setting->fraction_type == 1 ? number_format($total - $discount_total, 2) : number_format(round($total - $discount_total), 2) }}
{{__('obs.transaction_summery')}}
{{__('obs.total_amount')}}
{{ $setting->fraction_type == 1 ? number_format($g_tot, 2) : number_format(round($g_tot), 2) }}
{{__('obs.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 . ')' : '' }} {{__('obs.add_charge')}}
(+) {{ $setting->fraction_type == 1 ? number_format($invoice->other_charge, 2) : number_format(round($invoice->other_charge), 2) }}
{{ ' FD Total ' }} @ {{ abs($invoice->party_return_percentage) }}%
+ {{ $setting->fraction_type == 1 ? number_format(abs($totalDamageReturn), 2) : number_format(round($totalDamageReturn), 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) }}
{{__('obs.net_amount')}}
{{ number_format($nt, 2) }}
{{__('obs.paid_amount')}}
{{ $printData['invoice']->cash_amount }}
{{__('obs.due')}}
{{ round($nt, 2) - $printData['invoice']->cash_amount }}
{{__('obs.opening_balance')}}:
{{ number_format($p_balance, 2) }}
{{__('obs.closing_balance')}}:
@php $balance=in_array($printData['invoice']->transaction_type,[4])?($p_balance - $nt):($p_balance + $nt); @endphp
{{ number_format($balance, 2) }}
   {{ ucwords(getNumberInWords(number_format($nt, 2, '.', ''))) }} {{ $currency ? $currency->name : '' }} {{__('obs.only')}}.
{!! $foot !!}