
    <div class="container">
        <div class="daily__expense">

            <table class="table table-bordered ">
                <thead class="table-secondary">
                  <tr>
                    <th scope="col">SR.No</th>
                    <th scope="col">Date</th>

                    <th scope="col">Category</th>
                    <th scope="col">Payment Mode</th>
                    <th scope="col">Description</th>
                    <th scope="col">Expense</th>
                    <th scope="col">Income</th>
                    <th scope="col">Credit </th>

                  </tr>
                </thead>
                <tbody>

                    @php
                    $credit_loan='';
                    $credit='';
                    $debit='';
                    $description='';
                    $type='';
                    $payment_mode='';
                    $total_credit=0;
                    $total_debit=0;
                    $total_credit_loan=0;
                    $transaction_date='';
                    $company_name='';
                    @endphp
                    @foreach($final_data as $dat)

                    @if($dat->type == 'payment')
                    @php

                    $credit=round($dat->amount,3);
                    $type=$dat->type;
                    $debit='';
                    $credit_loan='';
                    $payment_mode=$dat->payment_mode;
                    $description=$dat->ledger.'-'.$dat->ledger_value;
                    $transaction_date=$dat->transaction_date;
                    $company_name=$dat->company_name;
                    $total_credit +=$credit;
                    @endphp
                    @endif

                    @if($dat->type == 'expense')
                    @php
                    $credit_loan='';
                    $credit='';
                    $type=$dat->type;
                    $debit=round($dat->amount,3);
                    $payment_mode=$dat->payment_mode;
                    $description=$dat->cat_name;
                    $total_debit +=$debit;
                    $transaction_date=$dat->transaction_date;
                    $company_name=$dat->description;
                    @endphp
                    @endif

                    @if($dat->type == 'unauthorized-income')
                    @php

                    $credit=round($dat->amount,3);
                    $type='unauthorized-income';
                    $debit='';
                    $credit_loan='';
                    $payment_mode=$dat->payment_mode;
                    $description=$dat->description;
                    $transaction_date=$dat->transaction_date;
                    $company_name='';
                    $total_credit +=$credit;
                    @endphp
                    @endif

                    @if($dat->type =='sale' && $dat->payment_mode !='credit')
                    @php
                    $credit='';
                    $type=$dat->type;
                    $credit_loan=round($dat->amount,3);
                    $debit='';
                    $payment_mode=$dat->payment_mode;
                    $description=$dat->ledger.'-'.$dat->ledger_value;
                    $total_credit_loan +=$credit_loan;
                    $transaction_date=$dat->transaction_date;
                    $company_name=$dat->company_name;
                    @endphp
                    @endif
                    @if($dat->type =='sale' && $dat->payment_mode =='credit')
                    @php
                    $credit='';
                    $debit='';
                    $type=$dat->type;
                    $credit_loan=round($dat->amount,3);
                    $payment_mode=$dat->payment_mode;
                    $description=$dat->ledger.'-'.$dat->ledger_value;
                    $total_credit_loan +=$credit_loan;
                    $transaction_date=$dat->transaction_date;
                    $company_name=$dat->company_name;
                    @endphp
                    @endif








                  <tr>
                    <td class="text-center">{{@$i +=1}}</td>
                     <td class="text-center">{{ \Carbon\Carbon::parse($transaction_date)->format('d/m/Y')}}</td>

                    <td class="text-center">{{$type}}</td>
                    <td class="text-center">{{$payment_mode}} </span></td>
                    <td class="text-center">{{$description}} @if($company_name)<p style="color:red;font-size: 12px;">{{$company_name}} </p> @endif</td>
                        <td>{{$debit}}</td>
                    <td class="text-center">{{$credit}}</td>
                    <td class="text-center">{{$credit_loan}}</td>
                   </tr>
                  @endforeach
                </tbody>

              </table>

        </div>
    </div>


