<div id="print_div">
    <div class="pathology-bill">
        <div class="row">
            <div class="col-md-12 col-xs-12 p-1">
                <div class="card border-0">
                    <div class="card-body">
                        <div class="row">
                            <x-MiniLetterHead :fromDate="$from_date" :toDate="$to_date" :companyName="$company->name" :voucherTitle="@$voucher_type->voucher_title" />
                            <div class="col-12">
                                <table class="table table-borderless report-container">
                                    <tbody class="report-content">
                                        <tr>
                                            <td class="report-content-cell">
                                                <div class="row">
                                                    <div class="col-12">
                                                        <table class="table table-bordered-print w-100 table-only-header-full-width mb-1" id="quotation_products">

                                                            <thead>
                                                                <tr class="text-uppercase">
                                                                    <th style="text-align: left; width: 5%">Sl no</th>
                                                                    <th style="text-align: left;">Date </th>
                                                                    <th style="text-align: left;">Voucher </th>
                                                                    <th style="text-align: left;">Account Name </th>
                                                                    <th style="text-align: left;">Voucher Type</th>
                                                                    <th style="text-align: left;"> Reference </th>
                                                                    <th style="text-align: left;"> Mode </th>
                                                                    <th style="text-align: right;">Amount</th>
                                                                </tr>
                                                            </thead>
                                                            <tbody>
                                                                @if(isset($accountJournal) && count($accountJournal) > 0)
                                                                @php $i = 1; @endphp
                                                                @php $grand_total = 0; @endphp
                                                                @foreach($accountJournal as $payment)

                                                                @if(isset($payment->accountJournalTransaction)&&count($payment->accountJournalTransaction)>0)
                                                                @foreach($payment->accountJournalTransaction as $key => $transactions)
                                                                @php
                                                                $count = count(@$payment->accountJournalTransaction) ?? 0;
                                                                @endphp
                                                                <tr>
                                                                    @if($key == 0)
                                                                    <td style="text-align: left;" rowspan="{{$count}}">{!! $i !!}</td>
                                                                    <td style="text-align: left;" rowspan="{{$count}}">{{ formatedDate($transactions->transaction_date) }}</td>
                                                                    <td style="text-align: left;" rowspan="{{$count}}">{!! $payment->voucher_no !!}</td>
                                                                    {{--@php
                                                                    $i += 1;
                                                                    @endphp--}}
                                                                    @endif
                                                                    <td style="text-align: left;">
                                                                        {!! isset($transactions->transaction_type)&&$transactions->transaction_type=='DEBIT' ? "" : "" !!}
                                                                        {{ $transactions->account->name }}
                                                                    </td>
                                                                    <td style="text-align: left;">{!! $transactions->voucher_type !!}</td>
                                                                    <td style="text-align: left;">{{ $transactions->transaction_referrence ?? '' }}</td>
                                                                    <td style="text-align: left;">
                                                                        {!! isset($transactions->transaction_type)&&$transactions->transaction_type=='DEBIT' ? "" : "" !!}
                                                                        {{ $transactions->transaction_type }}
                                                                    </td>
                                                                    <td style="text-align: right;">{{ convertDecimelPoint(@$transactions->amount) }}</td>
                                                                </tr>
                                                                {{--@php
                                                                $i += 1;
                                                                @endphp--}}
                                                                @endforeach

                                                                @php
                                                                $grand_total = $grand_total + $transactions->amount;
                                                                @endphp
                                                                @endif
                                                                @php
                                                                    $i += 1;
                                                                    @endphp
                                                                @endforeach
                                                                <tr>
                                                                    <td colspan="7" style="text-align: right;"><b>Total</b></td>
                                                                    <td style="text-align: right;"><b>{!! convertDecimelPoint($grand_total) !!}</b></td>
                                                                </tr>
                                                                @else
                                                                <tr>
                                                                    <td colspan="9">No Data Found</td>
                                                                </tr>
                                                                @endif
                                                            </tbody>
                                                        </table>
                                                    </div>
                                                </div>
                                            </td>
                                        </tr>
                                    </tbody>
                                </table>
                            </div>
                        </div>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
@if(isset($accountJournal) && count($accountJournal) > 0)
<div class="row">
<div class="col-md-6" style="text-align: right;">
    <button id="btn_print" type="button" class="btn btn-primary btn-lg"><i class="bi bi-printer text-white"></i> Print Statement </button>
</div>

<div class="col-md-6" style="text-align: left;">
    <a href="javascript:;" class="btn btn-outline-primary export-statement"><i class="bi bi-download"></i> Export</a>
</div>
</div>
@endif