prepare("SELECT id, nama_perusahaan, telepon_perusahaan, alamat_perusahaan, nama_bendahara, catatan_perusahaan, logo_perusahaan FROM data_server WHERE id = '$SvId'"); $stmt->execute(); $data = $stmt->fetchAll(); // echo "
";
// print_r($data);
// echo "
"; ?>
Invoice Setting
Click to upload image Image preview
Harus Format JPG / JPEG Ratio 1 x 1
prepare("UPDATE data_server SET nama_perusahaan = :nama_perusahaan, telepon_perusahaan = :telepon_perusahaan, alamat_perusahaan = :alamat_perusahaan, nama_bendahara = :nama_bendahara, catatan_perusahaan = :catatan_perusahaan, logo_perusahaan = :logo_perusahaan WHERE id = :id"); $stmt->bindParam(':nama_perusahaan', $_POST['nama_perusahaan']); $stmt->bindParam(':telepon_perusahaan', $_POST['telepon_perusahaan']); $stmt->bindParam(':alamat_perusahaan', $_POST['alamat_perusahaan']); $stmt->bindParam(':nama_bendahara', $_POST['nama_bendahara']); $stmt->bindParam(':catatan_perusahaan', $_POST['catatan_perusahaan']); $stmt->bindParam(':logo_perusahaan', $logo); $stmt->bindParam(':id', $SvId); $stmt->execute(); //Data PDF POST $nama = $_POST['nama_perusahaan']; $alamat = $_POST['alamat_perusahaan']; $telepon = $_POST['telepon_perusahaan'];// Detail pelanggan dan invoice $customerName = 'Nama Customer'; $customerAddress = 'Alamat Customer'; $invoiceNumber = 'INV20240001'; $invoiceDate = date('Y-m-d'); $invoiceLimit = "2045-08-17"; $customerNumber = "08xxxxxxxxxxxx"; $Keterangan = $_POST['catatan_perusahaan']; $Pembuat = $_POST['nama_bendahara']; // Total Amount (sederhana, untuk demo) $subtotal = '27.000.000'; $lainnya = '0'; $totalAmount = '27.000.000'; // Contoh jumlah total $terbilang = 'Dua Puluh Tujuh Juta Rupiah'; $header = array('No', 'Tanggal', 'Deskripsi', 'Qty', 'Harga'); $data = array( array("1", "2024-10-10", "Item Invoice 0001", "10 Pcs", "22.000.000"), array("2", "2024-10-10", "Item Invoice 0002", "10 Roll", "2.000.000"), array("3", "2024-10-10", "Item Invoice 0003", "150 Client", "1.500.000"), array("4", "2024-10-10", "Item Invoice 0004", "10 Pcs", "1.000.000"), array("5", "2024-10-10", "Item Invoice 0005", "10 Pcs", "500.000"), ); // Membuat instance PDF require ("invoice/generate_invoice.php"); $pdf = new PDF(); $pdf->setHeaderData($nama, $alamat, $telepon, $logo); $pdf->AddPage(); $pdf->SetFont('Arial', '', 12); // Menambahkan detail pelanggan dan invoice ke PDF $pdf->CustomerDetails($customerName, $customerAddress, $invoiceNumber, $invoiceDate, $customerNumber, $invoiceLimit); // Menambahkan tabel ke PDF $pdf->InvoiceTable($header, $data); // Menambahkan total amount ke PDF $pdf->Total($subtotal,$lainnya,$totalAmount,$terbilang); // Menambahkan keterangan ke PDF $pdf->Keterangan($Keterangan); // Menambahkan pembuat ke PDF $pdf->Pembuat($Pembuat); // Output PDF ke browser $pdf->Output('F', 'invoice/inv_contoh/inv-server-' . $SvId . '.pdf'); sweetAlert("Data berhasil di simpan", "success"); } catch (PDOException $e) { // Handle error echo 'Error: ' . $e->getMessage(); } } $_SESSION['uploaded_files']['invoice-'.$data[0]['id']] = $data[0]['logo_perusahaan']; ?>