@if(count($details))
@php
$grandtotal = 0;
$i=1;
$lastresi = null;
@endphp
@foreach($details as $detail)
@php
$biayacbmkg = 0;
$cekbiayacbmkg = null;
$ekspedisi_detail_id = null;
$harga_ekspedisi = 0;
@endphp
@if(is_object($detail->detail_barang->first()->ekspedisi))
@php
$biayacbmkg = 0;
$cekbiayacbmkg = cekbiayaekspedisicreate($detail);
if ($cekbiayacbmkg != null) {
$ekspedisi_detail_id = $cekbiayacbmkg->id;
$harga_ekspedisi = $cekbiayacbmkg->harga;
$biayacbmkg = $cekbiayacbmkg->harga;
}
// cek harga per user
if ($biayacbmkg != 0 && $ekspedisi_detail_id != null) {
$cekhargauser = cekhargauser($customer->id, $ekspedisi_detail_id);
if ($cekhargauser != null) {
$biayacbmkg = $cekhargauser->harga;
}
}
// $biayacbmkg = $detail->detail_barang->first()->ekspedisi->harga;
$finbiayacbmkg = $biayacbmkg;
// perhitungan voucher jika potongan biaya cbm / kg
if (@$detail->receipt->voucheruser) {
$potongan = 0;
$potongancbmkg = 0;
// $finbiayacbmkg = $biayacbmkg;
$jumlahvoucher = @$detail->receipt->voucheruser->voucher->jumlah;
$tipepotongan = @$detail->receipt->voucheruser->voucher->tipe_potongan;
$tipevoucher = @$detail->receipt->voucheruser->voucher->tipe_voucher;
if ($tipepotongan != null) {
if ($tipepotongan == 2) {
if ($tipevoucher == 1) {
$potongancbmkg = @$detail->receipt->voucheruser->voucher->jumlah/100 * $biayacbmkg;
} else {
$potongancbmkg = @$detail->receipt->voucheruser->voucher->jumlah;
}
$finbiayacbmkg = $biayacbmkg - $potongancbmkg;
}
}
}
@endphp
@if(strtolower($detail->detail_barang->first()->ekspedisi->tipe_ekspedisi) == "udara")
@php
$volume = (($detail->panjang * $detail->lebar * $detail->tinggi)/6000) * $detail->carton_count;
@endphp
@if($volume > ($detail->berat * $detail->carton_count))
@php
$berat_tambahan = $volume - ($detail->berat * $detail->carton_count);
$fber = number_format($berat_tambahan,2,'.','');
$berat_tambahan = floatval($fber);
$harga_tambahan = @$finbiayacbmkg/2;
// $total = ($berat_tambahan)
$total = (($detail->berat * $detail->carton_count) * @$finbiayacbmkg) + ($berat_tambahan * $harga_tambahan)
@endphp
@else
@php
$total = @$finbiayacbmkg * $detail->carton_count * $detail->berat;
@endphp
@endif
@else
@php
$volume = (($detail->panjang * $detail->lebar * $detail->tinggi)/1000000) * $detail->carton_count;
$total = 0;
$total = @$finbiayacbmkg * round($volume, 2);
@endphp
@endif
@else
@php
$volume = (($detail->panjang * $detail->lebar * $detail->tinggi)/1000000) * $detail->carton_count;
$total = 0;
$total = @$finbiayacbmkg * round($volume, 2);
@endphp
@endif
@php
$biaya_qc = 0;
if (@$detail->receipt->total_biaya_qc != null) {
$biaya_qc = @$detail->receipt->total_biaya_qc;
}
// $total = 50000;
// perhitungan voucher
if (@$detail->receipt->voucheruser) {
if ($tipepotongan != null) {
if ($tipepotongan == 1) {
if ($tipevoucher == 1) {
$potongan = @$detail->receipt->voucheruser->voucher->jumlah/100 * $total;
} else {
$potongan = @$detail->receipt->voucheruser->voucher->jumlah;
}
if ($total > 0) {
$total = $total - $potongan;
}
}
}
}
$grandtotal += $total;
@endphp
{{-- cek : {{$cekhargauser}} --}}
{{--
--}}
{{-- {{round($volume, 2)}} --}}
{{-- @if ($cekbiayacbmkg != null) --}}
{{-- @endif --}}
| {{ @$detail->receipt->no_resi }} |
{{ @$detail->receipt->shipping_mark }} |
{{ @$detail->detail_barang->first()->ekspedisi->tipe_barang }} |
{{ $detail->carton_count }} |
{{-- Total Volume --}}
{{--
|
{{-- Berat --}}
{{-- Jika menggunakan ekspedisi udara dan berat volume > berat utama --}}
@if((strtolower(@$detail->detail_barang->first()->ekspedisi->tipe_ekspedisi) == "udara") && ($volume > ($detail->berat * $detail->carton_count)))
* Berat Utama
{{--
* Berat tambahan
|
{{-- Jika menggunakan ekspedisi laut atau menggunakan ekspedisi udara tapi berat volume < berat utama --}}
@else
|
@endif
{{-- Harga / Perhitungan tergantung ekspedisi udara atau laut --}}
{{-- Jika menggunakan ekspedisi udara dan berat volume > berat utama --}}
@if((strtolower(@$detail->detail_barang->first()->ekspedisi->tipe_ekspedisi) == "udara") && ($volume > ($detail->berat * $detail->carton_count)))
* {{@$detail->detail_barang->first()->ekspedisi->tipe_ekspedisi}}
* Biaya tambahan
|
{{-- Jika menggunakan ekspedisi laut atau menggunakan ekspedisi udara tapi berat volume < berat utama --}}
@else
* {{@$detail->detail_barang->first()->ekspedisi->tipe_ekspedisi}}
|
@endif
{{-- Total harga 1 row --}}
{{-- cek ekspedisi --}}
@if(strtolower(@$detail->detail_barang->first()->ekspedisi->tipe_ekspedisi) == "laut")
* {{@$detail->detail_barang->first()->ekspedisi->satuan}} x Harga
@else
@if($volume > ($detail->berat * $detail->carton_count))
* (Berat * Harga) + (Berat Volume - Berat) * (Harga / 2)
@else
* Kg x Harga
@endif
@endif
|
@if(strtolower(@$detail->detail_barang->first()->ekspedisi->tipe_ekspedisi) == "laut")
|
@else
|
@endif
|
@php
$valcgberat = 0;
@endphp
@if(strtolower(@$detail->detail_barang->first()->ekspedisi->tipe_ekspedisi) == "laut")
@php
$cgmaxberat = $volume * $setting->max_cbm_laut;
$cgberat = $detail->berat * $detail->carton_count;
// jika berat melebihi max berat charge laut
if ($cgberat > $cgmaxberat) {
$prevalcgberat = $cgberat - $cgmaxberat;
$valcgberat = $prevalcgberat * $setting->charge_berat_laut;
}
@endphp
Charge Berat Laut
|
@endif
@php
$taxrefund = @$detail->receipt->tax_refund;
$resi = $detail->receipt;
$volumeresi = $resi->receipt_detail()->sum('total_volume');
$taxrefundkirim = @$detail->receipt->tax_refund_biaya_kirim * $volumeresi;
$codcina = @$detail->receipt->biaya_cod_cina;
if (!$loop->first) {
if ($lastresi == $detail->receipt->no_resi) {
$taxrefund = 0;
$taxrefundkirim = 0;
$codcina = 0;
}
}
@endphp
Tax Refund
|
Tax Refund Biaya Kirim
|
Biaya COD China
|
@php
// $subtotal_det = $valcgberat + $taxrefundkirim + (($taxrefund * $kurensi->rate_rupiah) + ($codcina * $kurensi->rate_rupiah)) ;
$subtotal_det = $valcgberat + $taxrefundkirim + (($taxrefund * $kurensi) + ($codcina * $kurensi)) ;
$grandtotal += $subtotal_det;
@endphp
Subtotal
|
|
Deskripsi
|
@foreach ($detail->detail_barang as $barang)
@if ($barang->deskripsi == null)
-
@else
@if (!$loop->first)
,
@endif
{{$barang->deskripsi}}
@endif
@endforeach
|
| Biaya Packing & Asuransi yg sudah tercantum di resi
| Packing : Rp {{ribuan(@$detail->receipt->harga_packing)}} |
Asuransi : Rp {{ribuan(@$detail->receipt->harga_asuransi)}} |
@if ($detail->receipt->voucheruser)
| Voucher |
@php
$voucherid = @$detail->receipt->voucheruser->voucher->id;
@endphp
{{@$detail->receipt->voucheruser->voucher->nama_voucher}}
|
Tipe Potongan : {{config('custom.tipe_potongan_voucher.'.$tipepotongan)}}
Tipe Voucher : {{config('custom.tipe_voucher.'.$tipevoucher)}}
Jumlah :
@if ($tipevoucher == 2)
Rp
@endif
{{ribuan(@$detail->receipt->voucheruser->voucher->jumlah)}}
@if ($tipevoucher == 1)
%
@endif
|
@if ($tipepotongan == 2)
Potongan Biaya cbm/kg: Rp
{{ribuan(@$potongancbmkg)}}
Potongan Biaya cbm/kg dengan potongan : Rp
{{ribuan(@$biayacbmkg - $potongancbmkg)}}
@else
Total Potongan : Rp
{{ribuan(@$potongan)}}
Subtotal dengan potongan : Rp
{{ribuan(@$total + $potongan)}}
@endif
{{-- --}}
|
@endif
@php
$lastresi = @$detail->receipt->no_resi;
$i++;
@endphp
@endforeach
@endif
| Keterangan |
|
|
Masukkan Biaya Packing
@if (@$detail->receipt->harga_packing != null)
Rp {{ribuan(@$detail->receipt->harga_packing)}}
@else
-Kosong-
@endif
|
|
Masukkan Biaya Asuransi
@if (@$detail->receipt->harga_asuransi != null)
Rp {{ribuan(@$detail->receipt->harga_asuransi)}}
@else
-Kosong-
@endif
|
|
| Rekening |
|
{{-- | --}}
Biaya Quality Control |
|
| Term |
|
{{-- | --}}
|
{{--
@if (strtolower(@$detail->detail_barang->first()->ekspedisi->tipe_ekspedisi) == "udara")
COD
@else
CHARGE BERAT
@endif --}}
{{-- Biaya Lain --}}
{{-- | --}}
{{-- | --}}
Other
|
|
{{--
| |
Other
|
|
--}}
{{--
| |
Biaya COD China
|
|
| |
Tax Refund Nominal
|
|
--}}
@if(strtolower(@$details->first()->detail_barang->first()->ekspedisi->tipe_ekspedisi) == "udara")
@else
{{--
| |
Biaya Kelebihan Berat |
|
--}}
@endif
| |
Grandtotal |
|