@php $no_of_bills = 0; @endphp @foreach($bills as $bill) @php $no_of_bills = $no_of_bills + 1; $isNewBill = isset($bill->rounding_amount) && !is_null($bill->rounding_amount) && $bill->rounding_amount != 0; if ($isRoundingEnabled) { if ($isNewBill) { $finalGrandTotal = $bill->grandtotal; $roundValue = $bill->rounding_amount; } else { $grandAmount = $bill->grandtotal; $ceilAmount = ceil($grandAmount); $floorAmount = floor($grandAmount); $roundValue = $ceilAmount - $grandAmount; $finalGrandTotal = ($roundValue > 0 && $roundValue <= 0.50) ? $ceilAmount : $floorAmount; } } else { $finalGrandTotal = $isNewBill ? $bill->grandtotal - $bill->rounding_amount : $bill->grandtotal; $roundValue = 0; } $totAmount = $bill->amount; $all_parcels = DB::table('bills as bl') ->leftJoin('parcels as p','p.client_id','=','bl.clientid') ->leftJoin('receivers as r','r.id','=','p.receiver_id') ->leftJoin('centers as c','c.id','=','p.center_id') ->leftJoin('clients as clnt','clnt.id','=','bl.clientid') ->leftJoin('default_packagetypes as dp','dp.id','=','p.package_type') ->where(['bl.id'=>$bill->id, 'p.bill_id'=>$bill->id, 'p.is_international'=>1, 'bl.branch_id'=>$branchId]) ->where(DB::raw('DATE_FORMAT(p.date,"%Y-%m")'), '=', DB::raw("'$month'")) ->select([ 'p.id as parcel_id', 'p.net_amt', 'p.amont as amount', 'p.weight', 'dp.name as dp_name', 'dp.weight_type as weight_type', 'p.consignment_no', 'r.name as receiver_name', 'c.name as city_name', 'p.date as date', 'p.insurance_amt', 'p.fuel_charge', 'p.ess_charge', 'p.remakrs as remarks', 'clnt.weight_in_mails as clientWeight', 'clnt.charge_in_mails as clientCharge', DB::raw('(SELECT SUM(parcel_charges.charge_amount) FROM parcel_charges WHERE parcel_charges.parcel_id = p.id) as total_other_charges_amount'), ])->orderBy('p.date')->orderBy('p.consignment_no')->get(); $data = array(); foreach ($all_parcels as $parcel) { $parcel_array = array(); $parcel_array['parcel_id'] = $parcel->parcel_id; $parcel_array['receiver'] = $parcel->receiver_name; $parcel_array['center'] = $parcel->city_name; $parcel_array['date'] = $parcel->date; $parcel_array['cons_no'] = $parcel->consignment_no; $parcel_array['remarks'] = $parcel->remarks; $parcel_array['parcel_amount'] = $parcel->amount; $parcel_array['weight'] = $parcel->weight; $parcel_array['weight_type'] = $parcel->weight_type; $parcel_array['insurance'] = $parcel->insurance_amt; $parcel_array['amount'] = $parcel->amount; $parcel_array['ess_charge'] = $parcel->ess_charge; $parcel_array['ess_charge_amount'] = (($parcel->amount + $parcel->total_other_charges_amount) * ($parcel->ess_charge) / 100); $parcel_array['fuel_percentage'] = $parcel->fuel_charge; $parcel_array['fuel_amount'] = (($parcel->amount + $parcel->total_other_charges_amount + $parcel_array['ess_charge_amount']) * $parcel->fuel_charge) / 100; $parcel_array['total_other_charges_amount'] = $parcel->total_other_charges_amount; $data[] = $parcel_array; $all_charge_type_parcels = DB::table('parcels as par') ->leftJoin('parcel_charges as par_charge','par.id','=','par_charge.parcel_id') ->leftJoin('_lists as list','list.id','=','par_charge.charge_type') ->where(['par_charge.branch_id'=>$branchId, 'par_charge.parcel_id'=>$parcel->parcel_id]) ->select([ 'list.item_name as charge_name', 'par_charge.charge_amount', ])->get(); if (!empty($all_charge_type_parcels)) { $other_amount = 0; foreach ($all_charge_type_parcels as $charge_type_parcel) { $info = array(); $info['parcel_id'] = ''; $info['receiver'] = $charge_type_parcel->charge_name; $info['center'] = ''; $info['date'] = ''; $info['cons_no'] = ''; $info['remakrs'] = ''; $info['parcel_amount'] = ''; $info['weight'] = ''; $info['weight_type'] = ''; $info['insurance'] = 0; $info['fuel_percentage'] = ''; $info['fuel_amount'] = 0; $info['amount'] = $charge_type_parcel->charge_amount; $other_amount = $other_amount + $charge_type_parcel->charge_amount; $data[] = $info; } } } $booking_amount = DB::table('bills as bl') ->leftJoin('parcels as p','p.client_id','=','bl.clientid') ->leftJoin('receivers as r','r.id','=','p.receiver_id') ->where(['bl.id'=>$bill->id, 'p.bill_id'=>$bill->id, 'p.is_international'=>1, 'bl.branch_id'=>$branchId]) ->where(DB::raw('DATE_FORMAT(p.date,"%Y-%m")'), '=', DB::raw("'$month'")) ->select([DB::raw('SUM(p.net_amt) as total_booking_amount')])->first(); $final_value = (round((double)$booking_amount->total_booking_amount,2) - round((double)$bill->amount,2)); if($final_value > 0){ $value = 'Positive'; }else{ $value = 'Negative'; } @endphp
{{@$branch['person_name']}}
{{@$branch['address']}}, {{@$branch['city']}} - {{@$branch['zipcode']}}

monthly bill / {{date("M Y", strtotime($bill->start_date))}}

M/s. {{$bill->name}} bill no. {{$bill->billno}}
Address: {{@$bill->address1.' '.@$bill->address2.' '.@$bill->city}} date {{date("d/m/Y", strtotime($bill->created_at))}}
phone: {{@$bill->phone1}}
GST No. {{@$bill->gstno}}
@if($value == 'Positive') @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
particular amount
courier charges for the month of {{date("M Y", strtotime($bill->start_date))}} {{Laracore::showPrice($booking_amount->total_booking_amount)}}
discount - {{Laracore::showPrice($booking_amount->total_booking_amount - $bill->amount)}}
cgst % ({{$bill->cgstpercent}}) {{Laracore::showPrice(($totAmount * $bill->cgstpercent)/100)}}
sgst / utgst % ({{$bill->sgstpercent}}) {{Laracore::showPrice(($totAmount * $bill->sgstpercent)/100)}}
igst % ({{$bill->igstpercent}}) {{Laracore::showPrice(($totAmount * $bill->igstpercent)/100)}}
Round Of {{Laracore::showPrice($roundValue)}}
grand total {{ Laracore::showPrice($finalGrandTotal) }}
(Rupees in words) {{ getIndianCurrency($finalGrandTotal) }}
@if($branch['bill_terms_and_conditions'] != '') @else
@if($bill->cgstpercent == 0 && $bill->sgstpercent == 0 && $bill->igstpercent == 0) @endif
GST No.- {{@$branch['gstno']}}
{{@$branch['bank_address']}}
A/C.No. - {{@$branch['bank_acno']}}
IFSC CODE - {{@$branch['ifsc_code']}}
LUT NO - {{@$branch['lut_no']}}
HSN/SAC CODE - {{@$branch['sac_code']}}
Pan Card No. - {{@$branch['pancard']}}
Mo. {{@$branch['contact_no']}}
    @php $termsAndConditionsArr = explode("\n", str_replace("\r", "", @$branch['bill_terms_and_conditions'])); @endphp @foreach($termsAndConditionsArr as $termsAndConditions) {{$termsAndConditions}}
    @endforeach

PLEASE MAKE PAYMENT BY A/c. PAYEE CHEQUE IN FAVOR OF {{strtoupper(@$branch['name'])}}

PLEASE MAKE PAYMENT BY AMOUNT DUE ON 1 TO 5 DAYS

@endif
@if($branch['payment_qr_code'])
Payment QR Code
Stamp
@endif
@if($digital_signature == 1)

Digitally signed by {{strtoupper(@$branch['name'])}}

Date:{{date("d/m/Y", strtotime($bill->created_at))}}

Location:{{@$branch['city']}}

@elseif($digital_signature == 2 && $branch['stamp'] != '')
for, {{@$branch['name']}}
Stamp
@else

For, {{@$branch['name']}}

Autho / Sign.

@endif
@if(count($data) > 0)

bill detail / {{date("M Y", strtotime($bill->start_date))}}

@php $srno = 1; $total_parcel_amount = $total_ess = $total_fuel = $total_insurance_amount = 0; @endphp @foreach($data as $parcels) @php (@$parcels['center'] != '') ? $srno++ :''; $total_parcel_amount = $total_parcel_amount + $parcels['amount']; $total_ess = $total_ess + @$parcels['ess_charge_amount']; $total_fuel = $total_fuel + @$parcels['fuel_amount']; $insurance_amount = (is_null($parcels['insurance'])) ? 0 : $parcels['insurance']; $total_insurance_amount = $total_insurance_amount + $insurance_amount; @endphp @endforeach @if($bill->igstpercent > 0) @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
sr receiver center date cons_no remark weight charges
{{(@$parcels['center'] != '') ? $srno :''}} {{@$parcels['receiver']}} {{@$parcels['center']}} {{(@$parcels['date'] != '') ? date("d/m/Y", strtotime(@$parcels['date'])) :''}} {{@$parcels['cons_no']}} {{@$parcels['remarks']}} {{@$parcels['weight']}} {{strtoupper(@$parcels['weight_type'])}} {{Laracore::showPrice(@$parcels['amount'])}}
Amount {{Laracore::showPrice(@$total_parcel_amount)}}
ESS Charge {{Laracore::showPrice(@$total_ess)}}
Fuel Charge {{Laracore::showPrice(@$total_fuel)}}
Insurance Amount {{Laracore::showPrice(@$total_insurance_amount)}}
cgst % ({{$bill->cgstpercent}}) {{Laracore::showPrice(($totAmount * $bill->cgstpercent)/100)}}
sgst / utgst % ({{$bill->sgstpercent}}) {{Laracore::showPrice(($totAmount * $bill->sgstpercent)/100)}}
igst % ({{$bill->igstpercent}}) {{Laracore::showPrice(($totAmount * $bill->igstpercent)/100)}}
Round Of {{Laracore::showPrice($roundValue)}}
grand total {{ Laracore::showPrice($finalGrandTotal) }}
(Rupees in words) {{ getIndianCurrency($finalGrandTotal) }}
@if($branch['payment_qr_code'])
Payment QR Code
Stamp
@endif
@if($digital_signature == 1)

Digitally signed by {{strtoupper(@$branch['name'])}}

Date:{{date("d/m/Y", strtotime($bill->created_at))}}

Location:{{@$branch['city']}}

@elseif($digital_signature == 2 && $branch['stamp'] != '')
for, {{@$branch['name']}}
Stamp
@else

For, {{@$branch['name']}}

Autho / Sign.

@endif
@endif @endforeach