@php
$total = $sub_total;
$sign_tax = '';
if ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_INCLUDE) {
$ppn_flat = round(($sub_total * $y[0]->termin_tax_ppn_percent) / 100);
$before_ppn = round($sub_total - $ppn_flat); // +
$pph_flat = round(0 * -1 * (($before_ppn * $y[0]->termin_tax_pph_percent) / 100)); // -1 *
$before_ppn_pph = round($sub_total + $ppn_flat + $pph_flat); // + +
$tax_flat = round($ppn_flat + $pph_flat);
$total = round($before_ppn_pph);
// $sign_tax = '-';
}
// $disc_flat = round($x->invc_disc_flat) ?? 0; ngebug kalo diskon sudah ada tetapi ada item baru, kalkulasinya tidak terupdate tetapi ke yang lama
if ($x->invc_disc_type === \App\Models\OrdersAItems::AMT_TYPE_FLAT) {
$disc_flat = round($x->invc_disc_flat);
} else {
$disc_flat = round(($total / 100) * $x->invc_disc_percent);
}
$pengurangan_disc = round($total - ($disc_flat ?? 0));
$total = $pengurangan_disc;
if ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_EXCLUDE) {
$ppn_flat = round(($total * $y[0]->termin_tax_ppn_percent) / 100);
$after_ppn = round($total + $ppn_flat);
$pph_flat = round((0 * $after_ppn * $y[0]->termin_tax_pph_percent) / 100);
$tax_flat = round($ppn_flat + $pph_flat);
$total += $tax_flat;
} elseif ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_WITHOUT) {
$ppn_flat = 0;
$pph_flat = 0;
$tax_flat = 0;
}
@endphp
| Sub total |
@if ($result_is_enable_btn === 1 || $result_is_enable_btn === 2)
@if ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_EXCLUDE)
{{ number_format($sub_total, 0, ',', '.') }}
@elseif ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_INCLUDE)
{{-- {{ number_format($before_ppn_pph, 0, ',', '.') }} --}}
{{ number_format($sub_total, 0, ',', '.') }}
@else
{{ number_format($sub_total, 0, ',', '.') }}
@endif
|
@else
@if ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_EXCLUDE)
{{ number_format($sub_total, 0, ',', '.') }}
@elseif ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_INCLUDE)
{{-- {{ number_format($before_ppn_pph, 0, ',', '.') }} --}}
{{ number_format($sub_total, 0, ',', '.') }}
@else
{{ number_format($sub_total, 0, ',', '.') }}
@endif
|
@endif
@if ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_EXCLUDE)
@if ($x->invc_disc_type === \App\Models\OrdersInvoices::AMT_TYPE_PERCENT)
Diskon ({{ $x->invc_disc_percent }}%)
@else
Diskon
@endif
|
{{ $disc_flat > 0 ? '-' . number_format($disc_flat, 0, ',', '.') : $disc_flat }} |
| PPN ({{ $y[0]->termin_tax_ppn_percent }}%) |
{{ $sign_tax . number_format($ppn_flat, 0, ',', '.') }} |
@if ($pph_flat > 0)
| PPH ({{ $y[0]->termin_tax_pph_percent }}%) |
{{ $sign_tax . number_format($pph_flat, 0, ',', '.') }} |
@endif
@elseif ($y[0]->termin_tax_type === \App\Models\OrdersAItems::AMT_TAX_TYPE_INCLUDE)
|
@if ($x->invc_disc_type === \App\Models\OrdersInvoices::AMT_TYPE_PERCENT)
Diskon ({{ $x->invc_disc_percent }}%)
@else
Diskon
@endif
|
{{ $disc_flat > 0 ? '-' . number_format($disc_flat, 0, ',', '.') : $disc_flat }} |
| PPN ({{ $y[0]->termin_tax_ppn_percent }}%) |
{{ $sign_tax . number_format($ppn_flat, 0, ',', '.') }} |
@if ($pph_flat > 0)
| PPH ({{ $y[0]->termin_tax_pph_percent }}%) |
{{ $sign_tax . number_format(-1 * $pph_flat, 0, ',', '.') }} |
@endif
@else
|
@if ($x->invc_disc_type === \App\Models\OrdersInvoices::AMT_TYPE_PERCENT)
Diskon ({{ $x->invc_disc_percent }}%)
@else
Diskon
@endif
|
{{ $disc_flat > 0 ? '-' . number_format($disc_flat, 0, ',', '.') : $disc_flat }} |
@endif