-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlaporan.php
More file actions
65 lines (63 loc) · 2.17 KB
/
Copy pathlaporan.php
File metadata and controls
65 lines (63 loc) · 2.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
<?php
require 'core/koneksi.php';
require_once __DIR__ . '/vendor/autoload.php';
$mpdf = new \Mpdf\Mpdf();
$tahun = $_POST['tahun'];
$id = $_POST['id'];
$html = '<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>Laporan Agent</title>
</head>
<body>
<section>
<h1>Laporan Penjualan</h1>
<table border="1" cellpadding="10" cellspacing="0">
<thead>
<tr>
<th>No</th>
<th>Tanggal Penjualan</th>
<th>Judul Property</th>
<th>Pemilik</th>
<th>Harga</th>
</tr>
</thead>
<tbody>';
$no = 1;
$laporansql = "
SELECT * FROM tb_property
INNER JOIN tb_user
ON tb_property.id_pemilik = tb_user.id
WHERE id_agent = '$id' AND status_property = '5' AND tanggal LIKE '$tahun%'";
$laporan = mysqli_query($conn, $laporansql);
while ($ceklaporan = mysqli_fetch_array($laporan))
{
$html .='
<tr>
<td>'.$no++.'</td>
<th>'.$ceklaporan['tanggal'].'</th>
<td>'.$ceklaporan['judul'].'</td>
<td>'.$ceklaporan['nama'].'</td>
<td>Rp. '.$ceklaporan['harga'].'</td>
</tr>';
}
$totallaporansql = "
SELECT SUM(harga) AS total_laporan
FROM tb_property
WHERE id_agent = '$id' AND status_property = '5' AND tanggal LIKE '$tahun%'";
$totallaporan = mysqli_query($conn, $totallaporansql);
$datatotal = mysqli_fetch_array($totallaporan);
$html .='
<tr>
<td colspan="4">Jumlah Profit</td>
<td>Rp. '.$datatotal['total_laporan'].'</td>
</tr>
</tbody>
</table>
</section>
</body>
</html>';
$mpdf->WriteHTML($html);
$mpdf->Output();
?>