@foreach($bills as $bill) @php $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; } $fuelAmount = ($bill->amount * $bill->fchpercent)/100; $totAmount = $bill->amount + $fuelAmount; $parcels = 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]) ->whereBetween('p.date', array($bill->start_date, $bill->end_last)) ->select([DB::raw('SUM(p.net_amt) as total_amount')])->get(); $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]) ->whereBetween('p.date', array($bill->start_date, $bill->end_last)) ->select([ 'p.id as parcel_id', 'p.net_amt', 'p.amont', 'p.weight', 'p.number_of_box', 'dp.name as dp_name', 'p.consignment_no', 'p.remakrs', 'r.name as receiver_name', 'c.name as city_name', 'p.date', 'p.insurance_amt', 'p.fuel_charge', 'clnt.weight_in_mails as clientWeight', 'clnt.charge_in_mails as clientCharge', ])->orderBy('p.date')->orderBy('p.consignment_no')->get(); $data = array(); $total_fuel_for_main_bill = 0; foreach ($all_parcels as $parcel) { $parcel_array = array(); $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['remakrs'] = $parcel->remakrs; $parcel_array['parcel_amount'] = $parcel->amont; $parcel_array['weight'] = $parcel->weight; $parcel_array['number_of_box'] = $parcel->number_of_box; $parcel_array['insurance'] = $parcel->insurance_amt; $parcel_fuel_amount = ($parcel->amont * $parcel->fuel_charge)/100; $parcel_array['fuel'] = $parcel_fuel_amount; $parcel_array['amount'] = $parcel->amont + $parcel_fuel_amount + $parcel->insurance_amt; $total_fuel_for_main_bill = $total_fuel_for_main_bill + $parcel_fuel_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['receiver'] = $charge_type_parcel->charge_name; $info['center'] = ''; $info['date'] = ''; $info['cons_no'] = ''; $info['remakrs'] = ''; $info['parcel_amount'] = ''; $info['weight'] = ''; $info['number_of_box'] = ''; $info['insurance'] = ''; $info['fuel'] = ''; $info['amount'] = $charge_type_parcel->charge_amount; $other_amount = $other_amount + $charge_type_parcel->charge_amount; $data[] = $info; } } } $final_value = number_format((double)($parcels[0]->total_amount - $bill->amount), 2); if($final_value > 0){ $value = 'Positive'; }else{ $value = 'Negative'; } sleep(2); @endphp
@if($branch['bill_terms_and_conditions'] != '') @endif

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

{{@$branch['person_name']}}

{{@$branch['address']}}, {{@$branch['city']}} - {{@$branch['zipcode']}}

GST Number: {{@$branch['gstno']}} --- SAC Code: 996812 --- PAN No: {{@$branch['pancard']}}

PH: {{@$branch['contact_no']}} Email: {{@$branch_email}}

Tax Invoice

{{$bill->name}}

Bill Period:

{{date("d/m/Y", strtotime($bill->start_date))}} TO {{date("d/m/Y", strtotime($bill->end_last))}}

@php $total_parcel_amount = $total_ins = $total_fuel = $total_booking_amount = 0; @endphp

{{@$bill->address1.' '.@$bill->address2.' '.@$bill->city}}

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

A/c GST Number: {{@$bill->gstno}}

Bill No.: {{$bill->billno}}
@foreach($data as $parcel) @endforeach
Doc No Date Center Consignee's Name Weight Amount Insur. Fuel Charges
{{@$parcel['cons_no']}} {{(@$parcel['date'] != '') ? date("d/m/Y", strtotime(@$parcel['date'])) :''}} {{@$parcel['center']}} {{@$parcel['receiver']}} {{@$parcel['weight']}} @if($parcel['number_of_box'] != null) ({{$parcel['number_of_box']}} Box) @endif {{Laracore::showPrice(@$parcel['parcel_amount'])}} {{Laracore::showPrice(@$parcel['insurance'])}} {{Laracore::showPrice(@$parcel['fuel'])}} {{Laracore::showPrice(@$parcel['amount'])}}
@if($value == 'Positive') @endif @if($bill->igstpercent > 0) @endif @if($roundValue > 0 && $roundValue <= 0.50) @endif
Amount {{Laracore::showPrice($total_parcel_amount)}} {{Laracore::showPrice($total_ins)}} {{Laracore::showPrice($total_fuel)}} {{Laracore::showPrice($total_booking_amount)}}
Gross Amount: {{Laracore::showPrice($parcels[0]->total_amount)}}
Discount : - {{Laracore::showPrice($parcels[0]->total_amount - $bill->amount)}}
Fuel Charge : {{Laracore::showPrice($total_fuel_for_main_bill)}}
Net Taxable Amount : {{Laracore::showPrice($totAmount)}}
C.GST : {{$bill->cgstpercent}}% {{Laracore::showPrice(($totAmount * $bill->cgstpercent)/100)}}
S.GST / UT.GST : {{$bill->sgstpercent}}% {{Laracore::showPrice(($totAmount * $bill->sgstpercent)/100)}}
I.GST : {{$bill->igstpercent}}% {{Laracore::showPrice(($totAmount * $bill->igstpercent)/100)}}
Round Of {{Laracore::showPrice($roundValue)}}
Bill Amount : {{ Laracore::showPrice($finalGrandTotal) }}
Rupees in words : {{ getIndianCurrency($finalGrandTotal) }}
Remark : For, {{strtoupper(@$branch['name'])}}
A/C. No:{{@$branch['bank_acno']}}
IFSC CODE:{{@$branch['ifsc_code']}}
MSME No.:{{@$branch['msme_no']}}
Cheque Will be issued in the name of
{{strtoupper(@$branch['name'])}} Authorised Signature
 
 
Terms and Conditions
    @php $termsAndConditionsArr = explode("\n", str_replace("\r", "", @$branch['bill_terms_and_conditions'])); @endphp @foreach($termsAndConditionsArr as $termsAndConditions)
  • {{$termsAndConditions}}
  • @endforeach
@endforeach