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
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
|
<?php require_once(__DIR__ . '/inc/configure.php');
function get_user_browser() { $u_agent = $_SERVER['HTTP_USER_AGENT']; $ub = ''; if (preg_match('/MSIE/i', $u_agent)) { $ub = "ie"; } elseif (preg_match('/Firefox/i', $u_agent)) { $ub = "firefox"; } elseif (preg_match('/Safari/i', $u_agent)) { $ub = "safari"; } elseif (preg_match('/Chrome/i', $u_agent)) { $ub = "chrome"; } elseif (preg_match('/Flock/i', $u_agent)) { $ub = "flock"; } elseif (preg_match('/Opera/i', $u_agent)) { $ub = "opera"; }
return $ub; }
$user_browser = get_user_browser();
if (!function_exists('encrypt_decrypt')) { function encrypt_decrypt($action, $string) { $output = false;
$encrypt_method = "AES-256-CBC"; $secret_key = '4ySxqyry98'; $secret_iv = 'BsTsudlvcf';
// hash $key = hash('sha256', $secret_key);
// iv - encrypt method AES-256-CBC expects 16 bytes - else you will get a warning $iv = substr(hash('sha256', $secret_iv), 0, 16);
if ($action == 'encrypt') { $output = openssl_encrypt($string, $encrypt_method, $key, 0, $iv); $output = base64_encode($output); } else if ($action == 'decrypt') { $output = openssl_decrypt(base64_decode($string), $encrypt_method, $key, 0, $iv); }
return $output; } }
if (is_numeric($_GET["id"])) { //encrypt $encrypted_string = encrypt_decrypt('encrypt', $_GET["id"]);
header("Location: report_call_in.php?id=" . $encrypted_string); } else { //decrypt $decrypt_string = encrypt_decrypt('decrypt', $_GET["id"]);
$decrypt_string = substr($decrypt_string, 8);
$sql = " SELECT job.staff_tel_no as job_staff_tel_no, staff.staff_tel_no as staff_staff_tel_no, job.contact_person as job_contact_person, job.*,customer.*,staff.*, job.id as job_id FROM sup_job job, v_cm_customer_support customer, sys_login staff WHERE job.customer_id = customer.cust_id AND job.staff_id = staff.id AND job.deleted = ? AND job.id = ? GROUP BY job.id ";
$parameters = array("0", $decrypt_string);
if (!($sth = $dbh->prepare($sql))) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); exit; }
if (!$sth->execute($parameters)) { throw new Exception('[' . $sth->errorCode() . ']: ' . print_r($sth->errorInfo())); exit; }
$job_info = $sth->fetch(PDO::FETCH_ASSOC);
}
?>
<!DOCTYPE html> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"/> <title>One Solution: Support</title> <meta name="viewport" content="width=device-width, initial-scale=1.0"/> <meta name="keywords" content="One Solution Limited"/> <meta name="description" content="One Solution Limited"/> <meta name="author" content="One Solution Limited"/> <meta http-equiv="X-UA-Compatible" content="IE=8"/>
<style type="text/css" media="print"> #print_btn { display: none; } </style>
<style type="text/css"> @media print { #footer { clear: both; position: absolute; bottom: <?php if($user_browser == "ie") echo "0px"; else echo "0px"; ?>; } }
body { background-color: #fff; width: 910px; font-family: arial, helvetica, sans-serif; min-height: 297mm; }
#job_date { float: left; border-bottom: 1px solid #000000; width: 257px; }
@page { margin: 19.5mm; /* All margins set to 19.5mm, as ie default */ }
#footer { page-break-inside: avoid }
#parts_service_status { page-break-inside: avoid; margin-top: 20px; } </style>
<script src="//code.jquery.com/jquery-1.11.0.min.js"></script> <script src="//code.jquery.com/jquery-migrate-1.2.1.min.js"></script> <script> $(function () {
if (parseInt($("body").height()) > 1170) { $('head').append('<style type="text/css">@media print {#footer { position: relative !important; bottom: 0 !important;}}</style>'); }
/*if($("#footer").position().top > 1170 && $("#footer").position().top < 1345){ $('head').append('<style type="text/css">@media print {#page_break { page-break-after: always;}}</style>'); }
console.log($("#footer").position().top);*/ }); </script>
<head>
<body>
<div id="head_info" style="width: 910px;"> <div style="float: right;"> <button id="print_btn" type="button" onclick="window.print();return false;"> Print</button> </div>
<div style="clear: both"></div>
<div style="display: table-cell; width: 530px;vertical-align: middle;"> <img src="images/header_logo.png"/> </div>
<div style="display: table-cell;vertical-align: middle;"> One Solution Limited<br>Unit 16, 11/F., Wah Shing Centre,<br>11-13 Shing Yip Street, Kwun Tong, <br>Kowloon, Hong Kong<br> Tel : (852) 3189 9000 Fax : (852) 3189 9099<br> Email : info@onesolution.com.hk<br> </div> </div>
<div style="clear: both;"></div>
<div style="margin: 40px 0;text-align: center;font-size: 21px; font-weight: bold;text-decoration: underline;"> SERVICES REPORT </div>
<div style="margin-top: 10px;"> <div style="float: left;width: 85px;"> Customer : </div>
<div style="float: left; border-bottom: 1px solid #000000;width: 90%;"> <?= $job_info{"company_name"} ?> </div> </div>
<div style="clear: both;"></div>
<div style="margin-top: 20px;"> <div style="float: left;width: 85px;"> Contact : </div>
<div style="float: left; border-bottom: 1px solid #000000;width: 45%;margin-right: 98px;"> <?php if (empty($job_info{"job_contact_person"})) echo " "; else echo $job_info{"job_contact_person"}; ?> </div>
<div style="float: left;width: 85px;"> Tel No : </div>
<div style="float: left; border-bottom: 1px solid #000000;width: 25%;"> <?php if (empty($job_info{"contact_tel_no"})) echo " "; else echo $job_info{"contact_tel_no"}; ?> </div>
</div>
<div style="clear: both;"></div>
<div style="margin-top: 20px;"> <div style="float: left;width: 85px;"> Engineer : </div>
<div style="float: left; border-bottom: 1px solid #000000;width: 45%;margin-right: 98px;"> <?php echo $job_info{"username"};
if(!empty($job_info["other_staff_id"])){ $other_staff_id_list = explode(",", $job_info["other_staff_id"]);
$other_staff_name_list = ""; foreach($other_staff_id_list as $staff_id){ $sql3 = "SELECT * from sys_login where id = ?";
$parameters3 = array($staff_id);
if (!($sth3 = $dbh->prepare($sql3))) { throw new Exception("sql prepare statement failure: $sql3"); }
if (!$sth3->execute($parameters3)) { throw new Exception("sql execute statement failure: $sql3"); }
$staff_info = $sth3->fetch();
$other_staff_name_list .= ", ".$staff_info["username"]; }
echo $other_staff_name_list; } ?> </div>
<div style="float: left;width: 85px;"> Tel No : </div>
<div style="float: left; border-bottom: 1px solid #000000;width: 25%;"> <?php if (empty($job_info{"job_staff_tel_no"})) echo " "; else echo $job_info{"staff_tel_no"}; ?> </div>
</div>
<div style="clear: both;"></div>
<div style="margin-top: 20px;"> <div style="float: left;width: 84px;"> Call Time : </div>
<!--<div style="float: left;">Start : </div>-->
<div style="float: left; border-bottom: 1px solid #000000;width: 45%;"> <?= $job_info{"call_time"} ?> </div>
<!--<div style="float: left;">End : </div>-->
<!--<div style="float: left; border-bottom: 1px solid #000000;width: 130px;margin-right: 55px;"> <?/*= $job_info{"end_time"} */?> </div>-->
<div style="float: left; margin-left: 111px;width: 74px;">Date : </div>
<div id="job_date" style="float: left;width: 25%; "> <?= $job_info{"call_date"} ?> </div>
</div>
<div style="clear: both;"></div>
<div style="margin-top: 20px;"> <div style="float: left;width: 135px;"> Service Type : </div>
<div style="float: left; width: 771px;"> <?php $type_list = Job::typeOptions(); foreach ($type_list as $key => $this_type) { if ($job_info{"type"} == $key) { $this_checked = "checked"; } else { $this_checked = ""; } ?> <input type="checkbox" <?= $this_checked ?>><label style="margin-right: 20px;"><?= $this_type ?></label> <?php } ?> </div> </div>
<div style="clear: both;"></div>
<div style="margin-top: 20px;"> <div style="float: left;width: 135px;"> Remarks : </div>
<div style="float: left; width: 771px; /*background: url(images/underline.png) repeat;*/line-height: 21px;"> <?php if (empty($job_info{"remarks"})) echo " "; else echo nl2br($job_info{"remarks"}); ?> </div> </div>
<div style="clear: both;"></div>
<?php $sql5 = "select * from sup_job_detail where deleted = ? and job_id = ? order by id ASC"; if (!($sth5 = $dbh->prepare($sql5))) { throw new Exception("sql prepare statement failure: $sql5"); }
if (!$sth5->execute(array("0", $decrypt_string))) { throw new Exception("sql execute statement failure: $sql5"); } $job_detail = $sth5->fetchAll();
foreach ($job_detail as $key => $this_task) { ?> <div style="margin-top: 20px;"> <div style="float: left;width: 135px;"> Job Symptoms : </div>
<div style="float: left; width: 771px; /*background: url(images/underline.png) repeat;*/line-height: 21px;"> <?= $this_task{"title"} ?> </div> </div>
<div style="clear: both;"></div>
<div style="margin-top: 20px;"> <div style="float: left;width: 135px;"> Action : </div>
<div style="float: left; width: 771px;/* background: url(images/underline.png) repeat;*/line-height: 21px;"> <?php if (empty($this_task{"remarks"})) echo " "; else echo nl2br($this_task{"remarks"}); ?> </div> </div>
<div style="clear: both;"></div>
<div style="margin-top: 20px;"> <div style="float: left;width: 135px;"> Job Status : </div>
<div style="float: left; width: 771px;">
<input type="checkbox" <?php if ($this_task["status"] == 2) echo "checked"; ?>><label style="margin-right: 20px;">Done</label> <input type="checkbox" <?php if ($this_task["status"] == 3) echo "checked"; ?>><label style="margin-right: 20px;">Follow Up</label> <input type="checkbox" <?php if ($this_task["status"] == 4) echo "checked"; ?>><label style="margin-right: 20px;">Cancel</label> </div> </div>
<div style="clear: both;"></div>
<?php for ($i = 0; $i < 0; $i++) { ?> <p>test</p> <?php } ?>
<?php } ?>
<div id="parts_service_status">
Parts Service Status :<br>
<div style="width: 910px;"> <table style="width: 910px; border-collapse: collapse;" border="1"> <tr> <td style="width: 20%;">Model.</td> <td style="width: 25%;">Part S/N</td> <td style="width: 40%;">Description</td> <td style="width: 15%;">Qty</td> </tr>
<tr> <td> </td> <td> </td> <td> </td> <td> </td> </tr> </table> </div> </div>
<div id="footer"> <div style="margin-top: 20px; width: 910px;"> <div style="float: left; text-align: center;width: 45%;"> Service confirmed, Accepted & product Received By<br>
<div style="width: 100%;height: 120px; border-bottom: 1px solid #000;">
</div> <br> Company Chop And Signature </div>
<div style="width: 10%; float: left;"> </div>
<div style="float: left; text-align: left;width: 45%;"> Services By:<br>
<div style="width: 100%;height: 120px; border-bottom: 1px solid #000;">
</div> <br>
<div style="text-align: center;"> One Solution Limited </div> </div> </div>
<div style="clear: both"></div>
</div>
</body> </html>
|