<!DOCTYPE html>
<html lang="bn">
<head>
    <meta charset="UTF-8">
    <title>{{ $company->company_name }} - SCALE REPORT</title>
    <style>
        @media print {
            body { margin: 0; padding: 20px; }
            .no-print { display: none; }
        }
        body {
            font-family: 'Courier New', monospace;
            font-size: 14px;
            padding: 20px;
            background: white;
        }
        .report-container {
            max-width: 400px;
            margin: 0 auto;
            border: 2px solid #000;
            padding: 20px;
        }
        .header {
            text-align: center;
            border-bottom: 1px dashed #000;
            padding-bottom: 10px;
            margin-bottom: 15px;
        }
        .company-name {
            font-size: 18px;
            font-weight: bold;
            text-transform: uppercase;
        }
        .address {
            font-size: 10px;
        }
        .title {
            text-align: center;
            font-size: 16px;
            font-weight: bold;
            margin: 10px 0;
        }
        .info-row {
            display: flex;
            justify-content: space-between;
            margin: 5px 0;
            border-bottom: 1px dotted #ccc;
            padding: 3px 0;
        }
        .label {
            font-weight: bold;
        }
        .footer {
            text-align: center;
            margin-top: 15px;
            font-size: 10px;
            border-top: 1px dashed #000;
            padding-top: 10px;
        }
        button {
            background: #4CAF50;
            color: white;
            border: none;
            padding: 10px 20px;
            margin: 10px;
            cursor: pointer;
        }
    </style>
</head>
<body>
    <div class="report-container">
        <div class="header">
            <div class="company-name">{{ $company->company_name }}</div>
            <div class="address">{{ $company->address }}</div>
            <div>Tel: {{ $company->phone }}, Cell: {{ $company->mobile }}</div>
        </div>
        
        <div class="title">SCALE REPORT</div>
        
        <div class="info-row">
            <span class="label">Serial No:</span>
            <span>{{ $weighment->serial_no }}</span>
        </div>
        
        <div class="info-row">
            <span class="label">Truck Number:</span>
            <span>{{ $weighment->vehicle_no }}</span>
        </div>
        
        <div class="info-row">
            <span class="label">Sender:</span>
            <span>{{ $weighment->sender_name ?? '-' }}</span>
        </div>
        
        <div class="info-row">
            <span class="label">Receiver:</span>
            <span>{{ $weighment->receiver_name ?? '-' }}</span>
        </div>
        
        <div class="info-row">
            <span class="label">Goods:</span>
            <span>{{ $weighment->goods_name ?? '-' }}</span>
        </div>
        
        <div class="info-row">
            <span class="label">Bags:</span>
            <span>{{ $weighment->bags ?? 0 }}</span>
        </div>
        
        <div class="info-row">
            <span class="label">Gross:</span>
            <span>{{ number_format($weighment->gross_weight, 0) }} KG</span>
        </div>
        
        <div class="info-row">
            <span class="label">Tare:</span>
            <span>{{ number_format($weighment->tare_weight, 0) }} KG</span>
        </div>
        
        <div class="info-row">
            <span class="label">Discount:</span>
            <span>{{ number_format($weighment->discount, 0) }} KG</span>
        </div>
        
        <div class="info-row">
            <span class="label">Net:</span>
            <span><strong>{{ number_format($weighment->final_weight ?? $weighment->net_weight, 0) }} KG</strong></span>
        </div>
        
        <div class="info-row">
            <span class="label">Gross Time:</span>
            <span>{{ $weighment->gross_time ? date('m/d/Y h:i:s A', strtotime($weighment->gross_time)) : '-' }}</span>
        </div>
        
        <div class="info-row">
            <span class="label">Tare Time:</span>
            <span>{{ $weighment->tare_time ? date('m/d/Y h:i:s A', strtotime($weighment->tare_time)) : '-' }}</span>
        </div>
        
        <div class="info-row">
            <span class="label">Operator:</span>
            <span>{{ $weighment->operator_name ?? 'OPERATOR' }}</span>
        </div>
        
        <div class="footer">
            Print Time: {{ date('m/d/Y h:i:s A') }}
            <br>{{ $company->footer_note ?? 'Thank you' }}
        </div>
    </div>
    
    <div class="no-print" style="text-align: center;">
        <button onclick="window.print()">🖨️ PRINT</button>
        <button onclick="window.close()">❌ CLOSE</button>
    </div>
    
    <script>
        window.onload = function() {
            // Auto print
            setTimeout(function() {
                window.print();
            }, 500);
        }
    </script>
</body>
</html>