-
Notifications
You must be signed in to change notification settings - Fork 0
/
print_report_kuitansi.php
216 lines (190 loc) · 4.84 KB
/
print_report_kuitansi.php
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
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
<?php
require_once('../../../../../config/config.php');
die_login();
//die_app('A01');
//die_mod('JB10');
$conn = conn($sess_db);
die_conn($conn);
$per_page = (isset($_REQUEST['per_page'])) ? max(1, $_REQUEST['per_page']) : 20;
$page_num = (isset($_REQUEST['page_num'])) ? max(1, $_REQUEST['page_num']) : 1;
$periode_awal = (isset($_REQUEST['periode_awal'])) ? clean($_REQUEST['periode_awal']) : '';
$periode_akhir = (isset($_REQUEST['periode_akhir'])) ? clean($_REQUEST['periode_akhir']) : '';
$query_search = '';
if ($periode_awal <> '' || $periode_akhir <> '')
{
$query_search .= "WHERE TANGGAL >= CONVERT(DATETIME,'$periode_awal',105) AND TANGGAL <= CONVERT(DATETIME,'$periode_akhir',105)";
}
/* Pagination */
$query = "
SELECT
COUNT(*) AS TOTAL
FROM
KWITANSI_LAIN_LAIN
$query_search
";
$total_data = $conn->Execute($query)->fields['TOTAL'];
$total_page = ceil($total_data/$per_page);
$query = "SELECT * CS_REGISTER_CUSTOMER_SERVICE";
$obj = $conn->Execute($query);
$set_jrp = '
<tr><td colspan="10" class="nb"><b>' . $obj->fields['NAMA_PT'] . '</b></td></tr>
<tr><td colspan="10" class="nb"><b><u>' . $obj->fields['NAMA_DEP'] . '</u></b></td></tr>
<tr><td colspan="10" class="nb text-center"><b> LAPORAN KWITANSI </b></td></tr>
<tr><td colspan="8" class="nb text-center"> Periode ' .kontgl(date("d M Y", strtotime($periode_awal))). ' s/d ' .kontgl(date("d M Y", strtotime($periode_akhir))). ' </td></tr>
<tr>
<td colspan="8" class="nb">
</td>
<td colspan="2" align="right" class="nb text-right va-bottom">Halaman
';
$set_th = '
dari ' . $total_page . '</td>
</tr>
<tr>
<th rowspan="2">NO.</th>
<th rowspan="2">NOMOR KWITANSI</th>
<th rowspan="2">BLOK / NOMOR</th>
<th rowspan="2">NAMA PEMBAYAR</th>
<th rowspan="2">TANGGAL</th>
<th rowspan="2">NILAI</th>
<th colspan="2">PARAF</th>
</tr>
<tr>
<th colspan="1">COL.</th>
<th colspan="1">KEU.</th>
</tr>
';
$set_ttd = '
<tr>
<td colspan="7" class="nb text-center"></td>
<td colspan="3" class="nb text-center"><br><br><br><br></td>
</tr>
<tr>
<td colspan="7" class="nb text-center"></td>
<td colspan="3" class="nb text-center">' . $obj->fields['KOTA'] . ', ' .kontgl(date('d M Y')). '</td>
</tr>
<tr>
<td colspan="7" class="nb text-center"></td>
<td colspan="3" class="nb text-center">Mengetahui,</td>
</tr>
<tr>
<td colspan="7" class="nb text-center"></td>
<td colspan="3" class="nb text-center"><br><br><br><br></td>
</tr>
<tr>
<td colspan="7" class="nb text-center"></td>
<td colspan="3" class="nb text-center">(------------------)</td>
</tr>
';
$p = 1;
function th_print() {
Global $p, $set_jrp, $set_th;
echo $set_jrp . $p . $set_th;
$p++;
}
$filename = "LAPORAN KWITANSI";
header("Content-type: application/msexcel");
header("Content-Disposition: attachment; filename=$filename.xls");
header("Pragma: no-cache");
header("Expires: 0");
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>LAPORAN KWITANSI</title>
<style type="text/css">
@media print {
@page {
size: 8.5in 4in portrait;
}
.newpage {page-break-before:always;}
}
.newpage {margin-top:25px;}
table {
font-family:Arial, Helvetica, sans-serif;
width:100%;
border-spacing:0;
border-collapse:collapse;
}
table tr {
font-size:11px;
padding:2px;
}
table td {
padding:2px;
vertical-align:top;
}
table th.nb,
table td.nb {
border:none !important;
}
table.data th {
border:1px solid #000000;
}
table.data td {
border-right:1px solid #000000;
border-left:1px solid #000000;
}
tfoot tr {
font-weight:bold;
text-align:right;
border:1px solid #000000;
}
.break { word-wrap:break-word; }
.nowrap { white-space:nowrap; }
.va-top { vertical-align:top; }
.va-bottom { vertical-align:bottom; }
.text-left { text-align:left; }
.text-center { text-align:center; }
.text-right { text-align:right; }
</style>
</head>
<body>
<table class="data">
<?php
echo th_print();
if ($total_data > 0)
{
$query = "
SELECT *
FROM
KWITANSI_LAIN_LAIN
$query_search
ORDER BY NOMOR_KWITANSI
";
$obj = $conn->Execute($query);
$i = 1;
$total_rows = $obj->RecordCount();
while( ! $obj->EOF)
{
$id = $obj->fields['NOMOR_KWITANSI'];
?>
<tr class="onclick" id="<?php echo $id; ?>">
<td class="text-center"><?php echo $i; ?></td>
<td><?php echo $id; ?></td>
<td><?php echo $obj->fields['KODE_BLOK']; ?></td>
<td><?php echo $obj->fields['NAMA_PEMBAYAR']; ?></td>
<td><?php echo tgltgl(date("d-m-Y", strtotime($obj->fields['TANGGAL']))); ?></td>
<td class="text-right"><?php echo to_money($obj->fields['NILAI']); ?></td>
<td class="text-center"><?php echo status_check($obj->fields['VER_COLLECTION']); ?></td>
<td class="text-center"><?php echo status_check($obj->fields['VER_KEUANGAN']); ?></td>
</tr>
<?php
if ($i % $per_page === 0)
{
echo '<tr><td class="nb"><div class="newpage"></div></td></tr>';
th_print();
}
$i++;
$obj->movenext();
}
echo $set_ttd;
}
?>
</table>
</body>
</html>
<?php
close($conn);
exit;
?>