HPP PRODUCT {{ strtoupper($invoice->product_category) }} - {{ strtoupper($invoice->product_name) }}

@php // ============================================ // ✅ RECALCULATE HPP WITH CORRECTED FORMULAS // ============================================ // GET BIAYA PRODUKSI (M³) dan M³ Total $biayaProduksi = $invoice->biaya_produksi ?? 0; $totalM3 = $invoice->total_m3 ?? 0; $hargaPerM3 = $invoice->harga_per_m3 ?? 6000000; // ✅ HPP UNFINISHED BASE (tanpa Material Painting & Biaya Produksi Painting) $hppUnfinishedBase = 0; $hppUnfinishedBase += $hppData['material_wood_panel'] ?? 0; $hppUnfinishedBase += $hppData['hardware'] ?? 0; $hppUnfinishedBase += $hppData['fitting'] ?? 0; $hppUnfinishedBase += $hppData['handle'] ?? 0; $hppUnfinishedBase += $hppData['stone'] ?? 0; $hppUnfinishedBase += $hppData['metal'] ?? 0; $hppUnfinishedBase += $hppData['ukir_bubut'] ?? 0; $hppUnfinishedBase += $hppData['box'] ?? 0; $hppUnfinishedBase += $biayaProduksi; // ✅ Biaya Produksi M³ // ✅ TOTAL HPP UNFINISHED = Base × 1.12 $totalHppUnfinished = $hppUnfinishedBase * 1.12; // ✅ HPP FINISHED BASE = HPP Unfinished Base + Material Painting + Biaya Produksi Painting $hppFinishedBase = $hppUnfinishedBase; $hppFinishedBase += $hppData['material_painting'] ?? 0; $hppFinishedBase += $hppData['biaya_produksi_painting'] ?? 0; // ✅ TOTAL HPP FINISHED = (HPP Finished Base × 1.12) + Biaya Produksi Packing $totalHppFinished = ($hppFinishedBase * 1.12) + ($hppData['biaya_produksi_packing'] ?? 0); // ============================================ // COUNT FILLED COLUMNS (EXCLUDE YANG KOSONG) // ============================================ // HPP UNFINISHED COLUMNS $unfinishedColumnsCount = 0; $unfinishedColumns = []; // ✅ M³ Column (Display Only - PALING KIRI, ALWAYS SHOW if M³ > 0) if ($totalM3 > 0) { $unfinishedColumns[] = 'm3_display'; $unfinishedColumnsCount++; } if (($hppData['material_wood_panel'] ?? 0) > 0) { $unfinishedColumns[] = 'material_wood_panel'; $unfinishedColumnsCount++; } if (($hppData['hardware'] ?? 0) > 0) { $unfinishedColumns[] = 'hardware'; $unfinishedColumnsCount++; } if (($hppData['fitting'] ?? 0) > 0) { $unfinishedColumns[] = 'fitting'; $unfinishedColumnsCount++; } if (($hppData['handle'] ?? 0) > 0) { $unfinishedColumns[] = 'handle'; $unfinishedColumnsCount++; } if (($hppData['stone'] ?? 0) > 0) { $unfinishedColumns[] = 'stone'; $unfinishedColumnsCount++; } if (($hppData['metal'] ?? 0) > 0) { $unfinishedColumns[] = 'metal'; $unfinishedColumnsCount++; } if (($hppData['ukir_bubut'] ?? 0) > 0) { $unfinishedColumns[] = 'ukir_bubut'; $unfinishedColumnsCount++; } if (($hppData['box'] ?? 0) > 0) { $unfinishedColumns[] = 'box'; $unfinishedColumnsCount++; } // ✅ Biaya Produksi (M³) Column (PALING KANAN, ALWAYS SHOW if > 0) if ($biayaProduksi > 0) { $unfinishedColumns[] = 'biaya_produksi_m3'; $unfinishedColumnsCount++; } // ============================================ // HPP INCLUDE FINISHING COLUMNS (3 KOLOM) // ============================================ $finishedColumnsCount = 0; $finishedColumns = []; if (($hppData['material_painting'] ?? 0) > 0) { $finishedColumns[] = 'material_painting'; $finishedColumnsCount++; } if (($hppData['biaya_produksi_painting'] ?? 0) > 0) { $finishedColumns[] = 'biaya_produksi_painting'; $finishedColumnsCount++; } if (($hppData['biaya_produksi_packing'] ?? 0) > 0) { $finishedColumns[] = 'biaya_produksi_packing'; $finishedColumnsCount++; } // Exchange Rate (Default) $exchangeRateDefault = 13500; @endphp @if($unfinishedColumnsCount > 0) @endif @if($finishedColumnsCount > 0) @endif @if(in_array('m3_display', $unfinishedColumns)) @endif @if(in_array('material_wood_panel', $unfinishedColumns)) @endif @if(in_array('hardware', $unfinishedColumns)) @endif @if(in_array('fitting', $unfinishedColumns)) @endif @if(in_array('handle', $unfinishedColumns)) @endif @if(in_array('stone', $unfinishedColumns)) @endif @if(in_array('metal', $unfinishedColumns)) @endif @if(in_array('ukir_bubut', $unfinishedColumns)) @endif @if(in_array('box', $unfinishedColumns)) @endif @if(in_array('biaya_produksi_m3', $unfinishedColumns)) @endif @if($unfinishedColumnsCount > 0) @endif @if(in_array('material_painting', $finishedColumns)) @endif @if(in_array('biaya_produksi_painting', $finishedColumns)) @endif @if(in_array('biaya_produksi_packing', $finishedColumns)) @endif @if($finishedColumnsCount > 0) @endif @if($unfinishedColumnsCount > 0) @endif @if($finishedColumnsCount > 0) @endif @if(in_array('m3_display', $unfinishedColumns)) @endif @if(in_array('material_wood_panel', $unfinishedColumns)) @endif @if(in_array('hardware', $unfinishedColumns)) @endif @if(in_array('fitting', $unfinishedColumns)) @endif @if(in_array('handle', $unfinishedColumns)) @endif @if(in_array('stone', $unfinishedColumns)) @endif @if(in_array('metal', $unfinishedColumns)) @endif @if(in_array('ukir_bubut', $unfinishedColumns)) @endif @if(in_array('box', $unfinishedColumns)) @endif @if(in_array('biaya_produksi_m3', $unfinishedColumns)) @endif @if($unfinishedColumnsCount > 0) @endif @if(in_array('material_painting', $finishedColumns)) @endif @if(in_array('biaya_produksi_painting', $finishedColumns)) @endif @if(in_array('biaya_produksi_packing', $finishedColumns)) @endif @if($finishedColumnsCount > 0) @endif
No. Image Dimensi
(mm)
Kode Item Jenis
Kayu
VeneerHPP UNFINISHEDHPP Include Finishing

(Component)
Total Material
Wood & Panel
HardwareFittingHandleStoneMetalUkir/BubutBox PackingBiaya Produksi
(M³)
TOTAL HPP UNFINISHED
Material
Painting
Biaya Produksi
Painting
Biaya Produksi
Packing
TOTAL HPP FINISHED
Rp $Rp $
1 @if($invoice->image_path) Product @else
No Image
@endif
{{ $invoice->size }} {{ $invoice->product_code }} {{ $invoice->product_type }} {{ $invoice->panel_type }} {{ $invoice->veneer_face_type }} {{ number_format($totalM3, 6) }}
Rp {{ number_format($hppData['material_wood_panel'], 0, ',', '.') }}
Rp {{ number_format($hppData['hardware'], 0, ',', '.') }}
Rp {{ number_format($hppData['fitting'], 0, ',', '.') }}
Rp {{ number_format($hppData['handle'], 0, ',', '.') }}
Rp {{ number_format($hppData['stone'], 0, ',', '.') }}
Rp {{ number_format($hppData['metal'], 0, ',', '.') }}
Rp {{ number_format($hppData['ukir_bubut'], 0, ',', '.') }}
Rp {{ number_format($hppData['box'], 0, ',', '.') }}
@if($hppData['box'] > 0) @php $boxData = json_decode($invoiceBox->box_data ?? '{}', true); $breakdown = []; // ✅ COMPONENTS if (!empty($boxData['components'])) { $compTotal = array_sum(array_column($boxData['components'], 'harga')); if ($compTotal > 0) { $breakdown[] = 'Components: Rp ' . number_format($compTotal, 0, ',', '.'); } } // ✅ KOMPONEN PENDUKUNG (Separate Regular & SKID) if (!empty($boxData['komponen_pendukung'])) { $regularKP = []; $skidItems = []; foreach ($boxData['komponen_pendukung'] as $item) { if (isset($item['is_skid']) && $item['is_skid'] === true) { $skidItems[] = $item; } else { $regularKP[] = $item; } } // Regular KP if (!empty($regularKP)) { $kpTotal = array_sum(array_column($regularKP, 'total')); if ($kpTotal > 0) { $breakdown[] = 'KP: Rp ' . number_format($kpTotal, 0, ',', '.'); } } // ✅ SKID (NEW - Separated from KP) if (!empty($skidItems)) { $skidTotal = array_sum(array_column($skidItems, 'total')); if ($skidTotal > 0) { $breakdown[] = 'SKID: Rp ' . number_format($skidTotal, 0, ',', '.'); } } } // ✅ PENUNJANG if (!empty($boxData['penunjang']['enabled'])) { $penunjangTotal = $boxData['penunjang']['total'] ?? 0; if ($penunjangTotal > 0) { $breakdown[] = 'Penunjang: Rp ' . number_format($penunjangTotal, 0, ',', '.'); } } // ✅ PALLET if (!empty($boxData['pallet']['enabled'])) { $palletTotal = $boxData['pallet']['total'] ?? 0; if ($palletTotal > 0) { $breakdown[] = 'Pallet: Rp ' . number_format($palletTotal, 0, ',', '.'); } } echo implode('
', $breakdown); @endphp
@endif
Rp {{ number_format($biayaProduksi, 0, ',', '.') }}
Rp {{ number_format($totalHppUnfinished, 0, ',', '.') }}
$ @php $totalUnfinishedUSD = $totalHppUnfinished / $exchangeRateDefault; @endphp {{ number_format($totalUnfinishedUSD, 2, '.', ',') }}
Rp {{ number_format($hppData['material_painting'], 0, ',', '.') }}
Rp {{ number_format($hppData['biaya_produksi_painting'], 0, ',', '.') }}
Rp {{ number_format($hppData['biaya_produksi_packing'], 0, ',', '.') }}
Rp {{ number_format($totalHppFinished, 0, ',', '.') }}
$ @php $totalFinishedUSD = $totalHppFinished / $exchangeRateDefault; @endphp {{ number_format($totalFinishedUSD, 2, '.', ',') }}