// Simulasi pembuatan kode unik acak antara 100 - 999 untuk mempermudah pengecekan mutasi bank $amount_unique_code = rand(100, 999); $amount_subtotal = 500000.00; // Harga dasar paket premium $amount_total = $amount_subtotal + $amount_unique_code; $ins_invoice = $pdo_central->prepare(" INSERT INTO saas_invoices (invoice_number, company_id, package_code, paket, branch_name, price, duration_months, amount_subtotal, amount_unique_code, amount_total, payment_status) VALUES (?, ?, ?, ?, ?, ?, 1, ?, ?, ?, 'unpaid') "); $ins_invoice->execute([ 'INV-' . date('Ym') . '-' . rand(100, 999), $company['id'], 'PK-PREMIUM', $company['paket'], 'Kantor Pusat', $amount_subtotal, $amount_subtotal, $amount_unique_code, $amount_total ]);