@php function formatDate($date) { // Check if the date is valid if (!strtotime($date)) { return ''; } return date('d-m-Y', strtotime($date)); } function printTillSpecificLength($string, $maxLength) { // Check if the length of the string is less than or equal to the maxLength if (strlen($string) <= $maxLength) { echo $string; } else { // If the length exceeds maxLength, print only up to maxLength characters echo substr($string, 0, $maxLength); } } function numberToWords($number) { $no = floor($number); $point = round($number - $no, 2) * 100; $hundred = null; $digits_1 = strlen($no); $i = 0; $str = array(); $words = array( '0' => '', '1' => 'One', '2' => 'Two', '3' => 'Three', '4' => 'Four', '5' => 'Five', '6' => 'Six', '7' => 'Seven', '8' => 'Eight', '9' => 'Nine', '10' => 'Ten', '11' => 'Eleven', '12' => 'Twelve', '13' => 'Thirteen', '14' => 'Fourteen', '15' => 'Fifteen', '16' => 'Sixteen', '17' => 'Seventeen', '18' => 'Eighteen', '19' => 'Nineteen', '20' => 'Twenty', '30' => 'Thirty', '40' => 'Forty', '50' => 'Fifty', '60' => 'Sixty', '70' => 'Seventy', '80' => 'Eighty', '90' => 'Ninety' ); $digits = array('', 'Hundred', 'Thousand', 'Lakh', 'Crore'); while ($i < $digits_1) { $divider = ($i == 2) ? 10 : 100; $number = floor($no % $divider); $no = floor($no / $divider); $i += ($divider == 10) ? 1 : 2; if ($number) { $plural = (($counter = count($str)) && $number > 9) ? 's' : null; $hundred = ($counter == 1 && $str[0]) ? ' and ' : null; $str [] = ($number < 21) ? $words[$number] . " " . $digits[$counter] . $plural . " " . $hundred : $words[floor($number / 10) * 10] . " " . $words[$number % 10] . " " . $digits[$counter] . $plural . " " . $hundred; } else $str[] = null; } $str = array_reverse($str); $result = implode('', $str); $points = ($point) ? "." . $words[$point / 10] . " " . $words[$point = $point % 10] : ''; echo $result . "Rupees "; // echo $result . "Rupees " . $points . " Paise"; } $copies = isset($_GET['copies'])?$_GET['copies']:'account'; // BREAK $copies INTO ARRAY $copies = explode(',', $copies); @endphp G.G.CARRIERS Details @foreach($copies as $copy)

CHALLAN

{{ $company->company_name ?? '' }}

Admin Office:{{ $company->address1 ?? '' }}

Tel.{{ $company->mob1 ?? '' }}, {{ $company->mob2 ?? '' }}

{{ $copy }} Copy

Date:  {{ formatDate($challan->challan_date) ?? '' }} From:  {{$challan['source']->station_name ?? ''}} To:  {{$challan['destination']->station_name ?? ''}} Challan No.: {{$challan->challan_number}}
Vehicle No.:  {{ $challan['vehicle']->vehicle_number ?? ''}} Model & Size fo Vehicle:  {{ $challan->vehicle_type ?? '' }}
Name of Driver:  {{ $challan['driver']->emp_name ?? '' }} Owner:  {{ $challan['broker']->party_name ?? '' }}
Sender Through:   Driver Number:   {{ $challan['driver']->contact_number ?? '' }}
Remarks: {{ $challan->remarks ?? '' }} 
@php $tot_pkg = 0; $tot_wt = 0; $tot_labour = 0; $tot_crain = 0; $tot_dd = 0; $tot_grand = 0; $dd_amt = 0; @endphp @foreach($challan->challan_desc as $index => $desc_item) @php $g_amt = $desc_item['grand_total'] ?? ''; $tot_grand += $g_amt; @endphp @endforeach
# From To GR Date GR No. Consignor Consignee Item
(Method)
Pkgs. Wt.Kg. Cartage
/Labour
Crain Door
Del.
To Pay Paid TBB
{{ $index+1 }} {{ $desc_item['source'] ?? '' }} {{ $desc_item['destination'] ?? '' }} {{ formatDate($desc_item['gr_date']) ?? '' }} {{ $desc_item['gr_number'] ?? '' }} {{ $desc_item['consignor'] ?? '' }} {{ $desc_item['consignee'] ?? '' }} {{$desc_item['material'] ?? ''}} @php $pkg_amt = $desc_item['pkg'] ?? ''; $tot_pkg += $pkg_amt; @endphp {{$pkg_amt}} @php $wt_amt = $desc_item['wt'] ?? 0; $tot_wt += $wt_amt; @endphp {{ $wt_amt }} @php $load_amt = (float) ($desc_item['payment_dynamic_fields']->cartage ?? 0); $tot_labour += $load_amt; @endphp {{$load_amt}} @php $crain_amt = isset($desc_item['payment_dynamic_fields']->crain) ? (int)$desc_item['payment_dynamic_fields']->crain : 0; $tot_crain += $crain_amt; @endphp {{$crain_amt}} @php $dd_amt = isset($desc_item['payment_dynamic_fields']->dd_chg) ? (int)$desc_item['payment_dynamic_fields']->dd_chg : 0; $tot_dd += $dd_amt; @endphp {{$dd_amt}} {{$desc_item['pay_mode'] == 'TO PAY' ? $g_amt : ''}} {{$desc_item['pay_mode'] == 'PAID' ? $g_amt : ''}} {{$desc_item['pay_mode'] == 'TBB' ? $g_amt : ''}}
TOTAL  {{$tot_pkg}} {{$tot_wt}} {{$tot_labour}} {{$tot_crain}} {{$tot_dd}} {{$desc_item['pay_mode'] == 'TO PAY' ? $tot_grand : ''}} {{$desc_item['pay_mode'] == 'PAID' ? $tot_grand : ''}} {{$desc_item['pay_mode'] == 'TBB' ? $tot_grand : ''}}
Total Lorry Freight Advance Loading Unloading Commission Other Charges Total Net Payable
{{ $challan->lh_net_freight ?? '' }} {{ $challan->lh_advance ?? '' }} {{$challan->loading_detention ?? ''}} {{$challan->unloading_detention ?? ''}} {{$challan->lh_munshiana ?? ''}} {{$challan->lh_extra_point ?? ''}} {{$challan->lh_balance ?? ''}} {{$challan->lh_balance ?? ''}}

I have received the goods mentioned above in good condition. I, and my owner both are responsible to Deliver the goods to destination in good condition.

Signature of Driver Loaded by
@endforeach