Zahabiya Chemicals Industries (Pvt.) Ltd.

CASH FLOW

From July {{CommonHelper::changeDateFormat($from)}} to {{CommonHelper::changeDateFormat($to)}}

CASH FLOW ACTIVITIES

@php $get_acc_id = array(); if ($acc_id) { $get_acc_id = [intval($acc_id)]; } else{ $get_acc_id = [90,91,92,86,87,88,388,389]; } $opening_balance = CommonHelper::get_opening_bal_array($from,$to,$get_acc_id); // dump($get_acc_id , $acc_id , $opening_balance); @endphp @php $total_debit_amount = 0; $total_credit_amount = 0; $debit_cash_flow = DB::connection('mysql2')->table('cash_flow_sub_heads as csh') ->join('cash_flow_heads as ch' , 'ch.id' , 'csh.cash_flow_head_id') ->select('csh.*') ->where('csh.status' , 1) ->where('ch.status' , 1) ->where('ch.debit_credit' , 1) ->get(); @endphp @foreach ($debit_cash_flow as $value) @php $transactions = DB::connection('mysql2') ->table('transactions') ->whereBetween('v_date',[$from ,$to]); if($acc_id) { $transactions = $transactions->where('acc_id',$acc_id); } $transactions = $transactions->where('debit_credit' , 1) ->where('status' , 1) ->where('voucher_type' , '>' , 0) ->where('cash_flow_head_id' , $value->id) ->select(DB::raw('SUM(amount) as total_amount')) ->value('total_amount'); $total_debit_amount += $transactions; @endphp @endforeach @php $debit_with_opening_amount = $total_debit_amount + $opening_balance; @endphp @php $credit_cash_flow = DB::connection('mysql2')->table('cash_flow_heads') ->where('status' , 1) ->where('debit_credit' , 0) ->get(); @endphp @foreach ($credit_cash_flow as $value) @php $sub_credit_cash_flow = DB::connection('mysql2')->table('cash_flow_sub_heads') ->where('cash_flow_head_id' ,$value->id ) ->where('status' , 1)->get(); @endphp @foreach ($sub_credit_cash_flow as $value1) @php $transactions = DB::connection('mysql2') ->table('transactions') ->whereBetween('v_date',[$from ,$to]); if($acc_id) { $transactions = $transactions->where('acc_id',$acc_id); } $transactions = $transactions->where('debit_credit' , 0) ->where('status' , 1) ->where('voucher_type' , '>' , 0) ->where('cash_flow_head_id' , $value1->id) ->select(DB::raw('SUM(amount) as total_amount')) ->value('total_amount'); // $transactions = DB::connection('mysql2') // ->selectOne('select SUM(amount) amount from transactions where status=1 AND cash_flow_head_id = '.$value1->id.' // AND voucher_type > 0 AND debit_credit = 1')->amount; $total_credit_amount += $transactions; @endphp @endforeach @endforeach @php $sub_total_bank_amount = 0; @endphp @foreach ($get_acc_id as $value3) @php $debit_bank_amount = DB::connection('mysql2') ->table('transactions') ->whereBetween('v_date',[$from ,$to]) ->where('debit_credit' , 1) ->where('acc_id',$value3) ->where('status' , 1) ->where('voucher_type' , '>' , 0) ->where('cash_flow_head_id' , '!=' , null) ->select(DB::raw('SUM(amount) as total_amount')) ->value('total_amount'); $credit_bank_amount = DB::connection('mysql2') ->table('transactions') ->whereBetween('v_date',[$from ,$to]) ->where('debit_credit' , 0) ->where('acc_id',$value3) ->where('status' , 1) ->where('voucher_type' , '>' , 0) ->where('cash_flow_head_id' , '!=' , null) ->select(DB::raw('SUM(amount) as total_amount')) ->value('total_amount'); $total_bank_amount = $debit_bank_amount - $credit_bank_amount; $sub_total_bank_amount += $total_bank_amount; @endphp @endforeach {{-- --}}
Particulars Amount Amount
Opening Balance {{$opening_balance}}
CASH IN-FLOWS (Receipts)
{{$value->name}} {{number_format($transactions??0 , 2)}}
TOTAL IN-FLOWS {{number_format($total_debit_amount ,2)}}
Cash And Cash Equivalents Available For Use {{number_format($debit_with_opening_amount , 2)}}
CASH OUT-FLOWS (PAYMENTS)
{{$value->name}}:
{{$value1->name}} {{number_format($transactions??0 , 2)}}
TOTAL OUT-FLOWS {{number_format( $debit_with_opening_amount ? ($total_credit_amount * 100) / $debit_with_opening_amount : 0 , 2)}} % ({{ number_format($total_credit_amount , 2)}})
Ending Balance [Surplus/(Deficit)] {{number_format($debit_with_opening_amount - $total_credit_amount , 2)}}
Breakup of Ending Balance
{{CommonHelper::get_account_name($value3)}} {{number_format($total_bank_amount , 2)}}
MEEZAN BANK- SA(0759) xxxxxx
BANK AL HABIB- CA(30501) xxxxxx
HABIB METRO- CA(7281) xxxxxx
UNITED BANK LTD (CA 6765) xxxxxx
HABIB METRO SA(7281) xxxxxx
Cash In Hand xxxxxx
Total {{number_format($sub_total_bank_amount , 2)}}