I have two array named as payment and invoice. i need to display these arrays order by Invoice date and Payment Date ASC.
Controller Code :
$reqsales=Sales::Where('inv_date','>=',$request->input('frmdate_submit'))->Where('inv_date','<=',$request->input('todate_submit'))->Where('customer_id',$request->input('clients'))->get();
$reqpayments=Paymenttransaction::Where('transaction_date','>=',$request->input('frmdate_submit'))->Where('transaction_date','<=',$request->input('todate_submit'))->Where('transaction_category',1)->Where('transaction_type',2)->Where('transaction_cus_vendor',$request->input('clients'))->get();
View code is below
@foreach($reqsales as $sales)
<tr>
<td>{{date("d M Y",strtotime($sales->inv_date))}}</td>
<td>Invoice - {{$sales->inv_prefix.''.$sales->inv_no}}</td>
<td align="right"> {{number_format($sales->invoice_totalamt,2)}} @php $debitamt+=$sales->invoice_totalamt; @endphp</td>
<td></td>
</tr>
@endforeach
@foreach($reqpayments as $payments)
<tr>
<td>{{date("d M Y",strtotime($payments->transaction_date))}}</td>
<td>Payment for {{$payments->sales->inv_prefix.''.$payments->sales->inv_no}}</td>
<td></td>
<td align="right">{{number_format($payments->transaction_amt,2)}} @php $creditamt+=$payments->transaction_amt; @endphp</td>
</tr>
@endforeach
Currently Displayed
Need to Display

