Merge branch 'dillon/34.5-jenkins-vapor' into vapor/development

This commit is contained in:
Dillon Ngo
2024-06-22 17:15:39 +08:00
@@ -61,65 +61,7 @@
</tr>
</thead>
<tbody>
@php
$roundOff = 2;
if ($isPrecise) {
$roundOff = 5;
}
$current_running_balance = 0;
@endphp
@foreach ($transactions as $key => $transaction)
@php
$description = "";
$incoming = "";
$outgoing = "";
$marking = "";
switch ($transaction->type) {
case 1:
if ($transaction->owner_type === "App\Models\Booking") {
$description = "Payment <br>" . $transaction->bill_no;
$marking = $transaction->owner->marking;
} else {
$description = "Payment <br>" . $transaction->bill_no;
$marking = \App\Models\Transaction::where('payment_reference', $transaction->bill_no)->first()->owner->marking;
}
$outgoing = number_format($transaction->amount, $roundOff);
break;
case 2:
$description = "Invoice <br>" . $transaction->bill_no;
$incoming = number_format(($transaction->amount / $transaction->currency_rate + $transaction->service_charge), $roundOff);
$marking = $transaction->owner->marking;
break;
case 5:
$description = "Top Up <br>" . $transaction->payment_reference;
$incoming = number_format($transaction->amount, $roundOff);
break;
case 9:
$description = "Credit Note <br>" . $transaction->payment_reference;
$incoming = number_format($transaction->amount, $roundOff);
break;
}
$current_running_balance = floatval($current_running_balance) + floatval($incoming) - floatval($outgoing);
$current_running_balance = number_format($current_running_balance, $roundOff);
@endphp
<tr>
<td width="5%" class="center top">{{ $key + 1 }}</td>
<td class="stock-code top" width="15%" style="text-align: center;">{{ \Carbon\Carbon::parse($transaction->created_at)->format('Y-m-d') }}</td>
<td class="description">{!! $description !!} <br> {{$marking}}</td>
<td width="15%" class="center top" style="text-align: center;">
{{ $incoming }}
</td>
<td width="15%" class="center top" style="text-align: center;">
{{ $outgoing }}
</td>
<td width="20%" class="center top" style="text-align: center;">
{{ number_format($current_running_balance, $roundOff) }}
</td>
</tr>
@endforeach
</tbody>
</table>