@php use App\Helpers\CommonHelper; use App\Helpers\ImportHelper; $data = DB::connection('mysql2') ->table('bl_details as b') ->join('lc_and_lg_against_po as lc', 'lc.id', '=', 'b.lc_and_lg_against_po_id') // ->join('lc_and_lg_against_po_data as lc_d' ,'lc.id' , 'lc_d.master_id' ) ->leftjoin('purchase_request as p', 'p.id', 'lc.po_id') // ->leftjoin('purchase_request_data as pd','pd.master_id','p.id') // ->leftJoin('lc_and_lg_against_po as c','a.id','c.po_id') ->join('shipping_expenses as sh', 'sh.lc_and_lg_against_po_id', '=', 'lc.id') ->join('clearing_agents as cl', 'cl.lc_and_lg_against_po_id', '=', 'lc.id') ->join('g_d_details as gd', 'gd.lc_and_lg_against_po_id', '=', 'lc.id') ->join('maturity_details as m', 'm.lc_and_lg_against_po_id', '=', 'lc.id') // ->join('maturity_details as m' , 'm.lc_and_lg_against_po_id' ,'=' ,'lc.id') ->select( 'lc.beneficiary_id', 'p.supplier_id', 'lc.description', 'lc.lc_no', 'lc.lc_date', 'lc.sub_description', 'lc.Currency', 'lc.Currency_id', 'b.bl_date', 'b.bl_nbp', 'm.maturity_date', 'm.rate as maturity_rate', 'gd.gd_no', 'gd.date as gd_date', 'gd.gd_rate', 'b.ioco', 'b.efs', 'gd.assessed_value', 'gd.custome_duty_percent', 'gd.custome_duty_amount', 'gd.acd_percent', 'gd.acd_amount', 'gd.rd_percent', 'gd.rd_amount', 'gd.st_percent', 'gd.st_amount', 'gd.it_percent', 'gd.it_amount', 'gd.fed_percent', 'gd.fed_amount', 'gd.ast_percent', 'gd.ast_amount', 'gd.eto_percent', 'gd.eto_amount', // 'lc_d.item_id','lc_d.total_amount', 'cl.amount as total_amount', 'gd.gd_cfr_value', 'gd.gd_new', // 'pd.sub_item_id', 'sh.do_charges', 'sh.lolo', 'sh.port_charges', 'cl.bill_no as cl_bill_no', ) ->orderBy('lc.id', 'desc') ->get(); // dd($data); $counter = 1; @endphp @foreach ($data as $row) @php $bl_amount = $row->total_amount * $row->bl_nbp; $maturity_amount = $row->total_amount * $row->maturity_rate; $gain_loss_amount = $bl_amount - $maturity_amount; @endphp