/var/www/hkosl.com/innoutstorage/webadmin/contract_alert.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
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
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
<?php
require_once("check_login.php");
require_once(
"Zebra_Pagination/Zebra_Pagination.php");
require_once 
dirname(__FILE__) . '/PHPExcel_1.8.0/Classes/PHPExcel.php';

$_SESSION["index_url_parameter"] = get_index_url_parameter();

$order_info = array();
$filter_sql "";
$parameters = array();

if (!empty(
$_GET["enddate_min"]) && !empty($_GET["enddate_max"])) {
    
$filter_sql .= " and enddate >= ? and enddate <= ?";
    
$parameters[] = $_GET["enddate_min"];
    
$parameters[] = $_GET["enddate_max"];
}

if (!empty(
$_GET["createdate_min"]) && !empty($_GET["createdate_max"])) {
    
$filter_sql .= " and o.createdate >= ? and o.createdate <= ?";
    
$parameters[] = $_GET["createdate_min"];
    
$parameters[] = $_GET["createdate_max"];
}

if (!empty(
$_GET["code"])) {
    
$filter_sql .= " and o.id = ?";
    
$parameters[] = $_GET["code"];
}

if (!empty(
$_GET["customer_code"]) || !empty($_GET["customer_name"]) || !empty($_GET["customer_tel"])) {
    
$filter_sql .= " and customer_id IN (?)";
    
$ids = array($_GET["customer_code"], $_GET["customer_name"], $_GET["customer_tel"]);
    
$parameters[] = implode(","array_filter($ids));
}

if (!empty(
$_GET["order_room"])) {
    
$room_ids = array();
    
$room_list get_order_by_room_id($_GET["order_room"]);
    
    foreach (
$room_list as $rl) {
        
$room_ids[] = $rl['order_id'];
    }

    
$filter_sql .= " and o.id IN (" implode(","$room_ids) . ")";
}

if (!empty(
$_GET["status"])) {
    
$filter_sql .= " and status = ?";
    
$parameters[] = $_GET["status"];
}
    
if (empty(
$filter_sql)) {
    
$date = new DateTime();
    
$date->modify("+1 month");

    
$filter_sql .= " and o.status = ? and enddate <= ? and enddate >= ?";
    
$parameters = array("NEW"$date->format("Y-m-d"), date("Y-m-d"));
}

//pagination
// how many records should be displayed on a page?
$records_per_page 20;
// instantiate the pagination object
$pagination = new Zebra_Pagination();

// records per page
$pagination->records_per_page($records_per_page);

$sql "select count(*) as count from `order` as o INNER JOIN location l ON o.location_id = l.id where o.deleted = 0 " $filter_sql " order by o.enddate ASC";
$order_info bind_pdo($sql$parameters"selectone");

// the number of total records is the number of records in the array
$pagination->records($order_info['count']);

$sql "select o.*, CONCAT(l.code, ' ', l.name_tc) AS loc FROM `order` as o INNER JOIN location l ON o.location_id = l.id where o.deleted = 0 " $filter_sql " order by o.enddate ASC";
$sql .= ' LIMIT ' . (($pagination->get_page() - 1) * $records_per_page) . ', ' $records_per_page ;
$order_info bind_pdo($sql$parameters"selectall");

foreach (
$order_info as $key => $order) {

    
$order_info[$key]["order_code"] = $order["code"];
    
/*$customer_info = get_customer($order["customer_id"]);
    $order_info[$key]["customer_code"] = $customer_info["code"];
    $order_info[$key]["customer_name"] = $customer_info["customer_name"];*/

    
$customer_name get_customer_name(rsa_crypt($order["customer_firstname"], 2), rsa_crypt($order["customer_lastname"], 2));
    
$order_info[$key]["customer_code"] = $order["customer_code"];
    
$order_info[$key]["customer_name"] = $customer_name;
    
$order_info[$key]["customer_tel"] = rsa_crypt($order_info[$key]["customer_tel"], 2);
    
// order rooms per orderId 
    
$order_room_info get_order_room($order["id"]);

    
// reset data
    
$order_room_list NULL;
    
// $order_room_list = "";
    
$master_room_total_retail_price "";
    
$master_room_display_size NULL;
    
// $master_room_display_size = "";

    // each of order room
    
foreach ($order_room_info as $detail) {

        
$room_info get_room($detail["room_id"]);
        
$order_room_list[] = check_combine_room($room_info["code"]);
        
// $order_room_list .= check_combine_room($room_info["code"]) . ", ";

        
$master_room get_master_room($room_info["master_room_id"]);
        
$master_room_total_retail_price += (int)$master_room["retail_price"];

        
$master_room_display_size[] = $master_room["display_size"];
        
// $master_room_display_size .= $master_room["display_size"] . ", ";

    
}

    
$order_info[$key]["order_room_list"] = implode('<br>'$order_room_list);;
    
//     $order_info[$key]["order_room_list"] = substr_replace($order_room_list, "", -2);
    
$order_info[$key]["master_room_total_retail_price"] = $master_room_total_retail_price;
    
$order_info[$key]["master_room_display_size"] = implode('<br>'$master_room_display_size);
    
// $order_info[$key]["master_room_display_size"] = substr_replace($master_room_display_size, "", -2);

}

//
$filter_order_code "";
$filter_customer_code "";
$filter_customer_name "";
$filter_customer_tel "";
$filter_status "";
$filter_startfrom "";
$filter_room "";

$all_order_info get_order2();
foreach (
$all_order_info as $key => $order) {
    
$filter_order_code[$key][0] = $order["id"];
    
$filter_order_code[$key][1] = $order["code"];
}

$all_order_info get_customer2();
foreach (
$all_order_info as $key => $customer) {
    
$filter_customer_code[$key][0] = $customer["id"];
    
$filter_customer_code[$key][1] = $customer["code"];

    
$filter_customer_name[$key][0] = $customer["id"];
    
$filter_customer_name[$key][1] = $customer["customer_name"];
    
    
$filter_customer_tel[$key][0] = $customer["id"];
    
$filter_customer_tel[$key][1] = $customer["tel"];
}

$all_room_info get_room();
foreach (
$all_room_info as $key => $room) {
    
$filter_room[$key][0] = $room["id"];
    
$filter_room[$key][1] = $room["code"];
}

$status_info get_master_type_code("ORDER_STATUS");
foreach (
$status_info as $key => $status) {
    
$filter_status[$key][0] = $status["code"];
    
$filter_status[$key][1] = $status["name_tc"];
}

$filter2_info = array(=> $filter_order_code=> $filter_customer_code=> $filter_customer_name=> "user_input"=> $filter_status=> "user_input"=> $filter_customer_tel=> $filter_room);

if(!empty(
$_GET["export"])){    
    
$sql "select o.*, CONCAT(l.code, ' ', l.name_tc) AS loc FROM `order` as o INNER JOIN location l ON o.location_id = l.id where o.deleted = 0 " $filter_sql " order by o.enddate ASC";
        
    
$export_info bind_pdo($sql$parameters"selectall");

    foreach (
$export_info as $key => $order) {
        
$export_info[$key]["order_code"] = $order["code"];
        
$customer_name get_customer_name(rsa_crypt($order["customer_firstname"], 2), rsa_crypt($order["customer_lastname"], 2));
        
$export_info[$key]["customer_code"] = $order["customer_code"];
        
$export_info[$key]["customer_name"] = $customer_name;
        
$export_info[$key]["customer_tel"] = rsa_crypt($export_info[$key]["customer_tel"], 2);
        
        
$order_room_info get_order_room($order["id"]);
        
$order_room_list "";
        foreach (
$order_room_info as $detail) {
            
$room_info get_room($detail["room_id"]);
            
$order_room_list .= check_combine_room($room_info["code"]) . ", ";
        }
        
        
$export_info[$key]["order_room_list"] = substr_replace($order_room_list"", -2);
    }
    
    
    
$excel = new PHPExcel();
    
$sheet $excel->getActiveSheet();
    
$sheet->setTitle("Daily sales report");
    
    
$header = array('合約編號''客戶姓名''聯絡電話''分店''租用單位''面積(平方呎)''尺寸''生效日期''結束日期''租用期(月)''備註');
    
    foreach (
$header as $k => $h) {
        
$sheet->getCellByColumnAndRow($k1)->setValueExplicit($h);
    }
    
    foreach (
$export_info as $i => $o) {
        
$r $i 2;
        
$sheet->getCellByColumnAndRow(0$r)->setValueExplicit($o['order_code']);
        
$sheet->getCellByColumnAndRow(1$r)->setValueExplicit($o['customer_name']);
        
$sheet->getCellByColumnAndRow(2$r)->setValueExplicit($o['customer_tel']);
        
$sheet->getCellByColumnAndRow(3$r)->setValueExplicit($o['loc']);
        
$sheet->getCellByColumnAndRow(4$r)->setValueExplicit($o['order_room_list']);
        
$sheet->getCellByColumnAndRow(5$r)->setValueExplicit($o['roughly_size']);
        
$sheet->getCellByColumnAndRow(6$r)->setValueExplicit($o['startdate']);
        
$sheet->getCellByColumnAndRow(7$r)->setValueExplicit($o['enddate']);
        
$sheet->getCellByColumnAndRow(8$r)->setValueExplicit($o['rent_month']);
    }    
    
    
$objWriter = new PHPExcel_Writer_Excel2007($excel);
    
header('Content-Type: application/vnd.ms-excel');
    
header('Content-Disposition: attachment;filename="contract_alert_data_' date('Ymd') . '.xlsx"');
    
header('Cache-Control: max-age=0');
    
$objWriter->save('php://output');    
    die();
}

if(!empty(
$_GET["send_alert"]) && !empty($_GET["id"])){
    if(
$_GET["send_alert"] == 1){
        
//$order_info = get_order((int)$_GET["id"]);

        
contract_alert_email((int)$_GET["id"]);
    }
}
?>
<!DOCTYPE html>
<html>
<head>
    <?php require_once("html_head.php"); ?>
    <link rel="stylesheet" href="Zebra_Pagination/css/zebra_pagination.css" type="text/css">

    <script src="Zebra_Pagination/js/zebra_pagination.js"></script>

    <script type="text/javascript" src="js/chosen_v1.4.1/chosen.jquery.min.js"></script>
    <link rel="stylesheet" href="js/chosen_v1.4.1/chosen.min.css">

    <script type="text/javascript">

        $(function () {
            $(".selectbox").chosen({width: "150px", search_contains: true});
        });

    </script>
</head>

<body>
<table width="1200" height="600" border="0" cellpadding="0" cellspacing="0">
    <tr>
        <td width="200" align="left" valign="top">
            <table width="200" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td height="70" align="left" valign="middle">&nbsp;</td>
                </tr>
                <tr>
                    <td width="200" align="left" valign="top"><!-- Main Menu -->
                        <?php require("menu.php"); ?><!-- End Main Menu --></td>
                </tr>
            </table>
        </td>
        <td width="1000" align="left" valign="top">
            <table width="1000" border="0" cellpadding="0" cellspacing="0">
                <tr>
                    <td>
                        <table width="1000" border="0" cellspacing="0" cellpadding="0">
                            <tr>
                                <td height="70" class="pagetitletxt">&nbsp;&nbsp;</td>
                                <td width="50" align="center" class="icontxt">

                                </td>
                            </tr>
                        </table>
                    </td>
                </tr>
                <tr>
                    <td class="pagetitletxt">
                        &nbsp;&nbsp;<b><img src="images/iconList.jpg" width="48" height="48" align="absmiddle"/>

                            快將完結合約

                        </b></td>
                </tr>
                <tr>
                    <td height="25" align="left" valign="middle" class="msg"><?php if (isset($_GET["msg"])) echo $_GET['msg']; ?></td>
                </tr>

                <tr>
                    <td align="left" valign="middle">

                        <div>
                            <form method="get" action="">
                            搜尋
                            <br>
                            <select name="code" class="selectbox">
                                <option value="">---合約編號---</option>
                                <?php

                                
foreach ($filter2_info[0] as $data) {
                                    if (isset(
$_GET["code"]))
                                        
$selected matched_option($data[0], $_GET["code"], "select");

                                    echo 
'<option value="' $data[0] . '" ' $selected ' class="' $key '">' $data[1] . '</option>';
                                }

                                
?>
                            </select>

                            <select name="customer_code" class="selectbox">
                                <option value="">---客戶編號---</option>
                                <?php
                                
foreach ($filter2_info[1] as $data) {
                                    if (isset(
$_GET["customer_code"]))
                                        
$selected matched_option($data[0], $_GET["customer_code"], "select");

                                    echo 
'<option value="' $data[0] . '" ' $selected ' class="' $key '">' $data[1] . '</option>';
                                }


                                
?>
                            </select>

                            <select name="customer_name" class="selectbox">
                                <option value="">---客戶姓名---</option>
                                <?php

                                
foreach ($filter2_info[2] as $data) {
                                    if (isset(
$_GET["customer_name"]))
                                        
$selected matched_option($data[0], $_GET["customer_name"], "select");

                                    echo 
'<option value="' $data[0] . '" ' $selected ' class="' $key '">' $data[1] . '</option>';
                                }

                                
?>
                            </select>
                            
                            <select name="customer_tel" class="selectbox">
                                <option value="">---聯絡電話---</option>
                                <?php

                                
foreach ($filter2_info[6] as $data) {
                                    if (isset(
$_GET["customer_tel"]))
                                        
$selected matched_option($data[0], $_GET["customer_tel"], "select");

                                    echo 
'<option value="' $data[0] . '" ' $selected ' class="' $key '">' $data[1] . '</option>';
                                }

                                
?>
                            </select>
                            
                            <select name="order_room" class="selectbox">
                                <option value="">---租用單位---</option>
                                <?php

                                
foreach ($filter2_info[7] as $data) {
                                    if (isset(
$_GET["order_room"]))
                                        
$selected matched_option($data[0], $_GET["order_room"], "select");

                                    echo 
'<option value="' $data[0] . '" ' $selected ' class="' $key '">' $data[1] . '</option>';
                                }

                                
?>
                            </select>

                            <select name="status" class="selectbox">
                                <option value="">---狀態---</option>
                                <?php
                                
foreach ($filter2_info[4] as $data) {
                                    if (isset(
$_GET["status"]))
                                        
$selected matched_option($data[0], $_GET["status"], "select");

                                    echo 
'<option value="' $data[0] . '" ' $selected ' class="' $key '">' $data[1] . '</option>';
                                }
                                
?>
                            </select>
                            
                            <br>
                            
                            <p>完結日期</p>
                            
                            <input type="date" name="enddate_min"
                                value="<?= isset($_GET["enddate_min"]) ? $_GET["enddate_min"] : ""?>" style="width: 150px;" />
                            至
                            <input type="date" name="enddate_max"
                                value="<?= isset($_GET["enddate_max"]) ? $_GET["enddate_max"] : ""?>" style="width: 150px;" />

                            <br>
                            
                            <p>建立日期</p>
                                                        
                            <input type="date" name="createdate_min"
                                value="<?= isset($_GET["createdate_min"]) ? $_GET["createdate_min"] : ""?>" style="width: 150px;" />
                            至
                            <input type="date" name="createdate_max"
                                value="<?= isset($_GET["createdate_max"]) ? $_GET["createdate_max"] : ""?>" style="width: 150px;" />

                            <br><br>

                            <button type="submit" name="export" value="0">送出</button>
                            <button type="submit" name="export" value="1" style="margin-left: 15px;">匯出</button>
                        
                            </form>
                        </div>

                        <br>

                        <table width="1420" border="0" cellpadding="0" cellspacing="0">
                            <tr>
                                <td width="10" class="listtitletxt"></td>
                                <td width="100" class="listtitletxt">合約編號</td>
                                <td width="100" class="listtitletxt">門卡號碼</td>
                                <!--<td width="150" class="listtitletxt">客戶類別</td>-->
                                <td width="150" class="listtitletxt">客戶姓名</td>
                                <td width="80" class="listtitletxt">聯絡電話</td>
                                <td width="200" class="listtitletxt">分店</td>
                                <td width="150" class="listtitletxt">租用單位</td>
                                <td width="80" class="listtitletxt">面積<br>(平方呎)</td>
                                <td width="150" class="listtitletxt">尺寸</td>
                                <td width="70" class="listtitletxt" style="white-space: nowrap">租用期(月)</td>
                                <td width="80" class="listtitletxt">生效日期</td>
                                <td width="80" class="listtitletxt">結束日期</td>
                                <td width="50" class="listtitletxt">狀態</td>
                                <td width="100" class="listtitletxt">發出電郵通知</td>
                                <td width="100" class="listtitletxt">Whataspp</td>
                            </tr>
                            <?php
                            
foreach ($order_info as $order) {
                                print 
"<tr>";
                                print 
"<td class='listtxt' style='padding-left:5'>&nbsp;</td>";
                                print 
"<td class='listtxt' style='padding-left:5; white-space: nowrap'>" $order['order_code'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['room_key'] . "</td>";
                                
/*$customer_type = get_master_type_code("CUSTOMER_TYPE", $order["customer_typeid"]);
                                if($order["customer_typeid"] == "BUSINESS"){
                                    print "<td class='listtxt' style='padding-left:5'>" . $customer_type["name_tc"] . "<br>".$order["customer_companyname"]."</td>";
                                }else if($order["customer_typeid"] == "PERSONAL"){
                                    print "<td class='listtxt' style='padding-left:5'>" . $customer_type["name_tc"] . "</td>";
                                }*/
                                
print "<td class='listtxt' style='padding-left:5'>" $order['customer_name'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['customer_tel'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['loc'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['order_room_list'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['roughly_size'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['master_room_display_size'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['rent_month'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['startdate'] . "</td>";
                                print 
"<td class='listtxt' style='padding-left:5'>" $order['enddate'] . "</td>";
                                
$order_status get_master_type_code("ORDER_STATUS"$order["status"]);
                                print 
"<td class='listtxt' style='padding-left:5'>" $order_status["name_tc"] . "</td>";

                                
// Modify
                                
$total_retail_price = (int)$order['master_room_total_retail_price'];

                                
/* contract price (superseded)
                                if ($order['location_id'] == "5") {
                                    $default_msg = "您好,出入易迷你倉提提您,您的迷你倉" . $order['order_room_list'] . "," . $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" . (int)$order["total_retail_price"] . "/月\n預付3個月:$" . ceil((int)$order["total_retail_price"]*0.95) . "/月\n預付6個月:$" . ceil((int)$order["total_retail_price"]*0.9) . "/月\n預付12個月:$" . ceil((int)$order["total_retail_price"]*0.88) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " . substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準";
                                } else {
                                    $default_msg = "您好,出入易迷你倉提提您,您的迷你倉" . $order['order_room_list'] . "," . $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" . (int)$order["total_retail_price"] . "/月\n預付3個月:$" . ceil((int)$order["total_retail_price"]*0.95) . "/月\n預付6-12個月:$" . ceil((int)$order["total_retail_price"]*0.9) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " . substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準";
                                }
                                */

                                // master room price
                                /*if ($order['location_id'] == "5") {
                                    $default_msg = "您好,出入易迷你倉提提您,您的迷你倉" . $order['order_room_list'] . "," . $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" . $total_retail_price . "/月\n預付3個月:$" . ceil($total_retail_price*0.95) . "/月\n預付6個月:$" . ceil($total_retail_price*0.9) . "/月\n預付12個月:$" . ceil($total_retail_price*0.88) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " . substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準";
                                } else {
                                    $default_msg = "您好,出入易迷你倉提提您,您的迷你倉" . $order['order_room_list'] . "," . $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" . $total_retail_price . "/月\n預付3個月:$" . ceil($total_retail_price*0.95) . "/月\n預付6-12個月:$" . ceil($total_retail_price*0.9) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " . substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準";
                                }*/ // deleted 20240328

                                
if (($order['location_id'] == "18") || ($order['location_id'] == "22")) { //油塘和新蒲崗
                                    
$default_msg "您好,出入易迷你倉提提您,您的迷你倉" $order['order_room_list'] . "," $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" $total_retail_price "/月\n預付3個月:$" ceil($total_retail_price*0.8) . "/月\n預付6-12個月:$" ceil($total_retail_price*0.7) . "/月\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準";                                    
                                } else {
                                    
$default_msg "您好,出入易迷你倉提提您,您的迷你倉" $order['order_room_list'] . "," $order['roughly_size'] . "平方呎倉 .,合約將於".$order["enddate"]."到期,請參考以下最新續約價錢:\n\n每月付:$" $total_retail_price "/月\n預付3個月:$" ceil($total_retail_price*0.95) . "/月\n預付6個月:$" ceil($total_retail_price*0.9) . "/月\n預付12個月:$" ceil($total_retail_price*0.88) . "/月";
                                    
                                    if (
date('Y-m-d') <= date('Y-m-d'strtotime('- 14 days'strtotime($order['enddate'])))) {
                                        
$default_msg .= "\n*Early bird 優惠 於".date('d/m'strtotime('- 14 days'strtotime($order['enddate'])))." 或之前付款即可享有全單額外1% 優惠*";
                                    }
                                    
$default_msg .= "\n\n繳款方法:\n1) PPS 繳費靈本公司之商戶號碼:6602\n您的客戶編號: " substr($order["customer_code"],1) . "\n2) FPS 轉數快\n本公司之商戶號碼:160830451\n3)入票或轉帳至本公司之恆生銀行戶口\n戶口名稱:In N Out International Corporate Limited \n戶口號碼:239-480981-001\n4)親臨城都5樓辦公室以現金/支票/EPS繳費,或以支付寶(+1.5%附加費)/信用卡(+3%附加費)支付\n\n** 本公司有權對以上迷你倉價格及優惠作出任何更改,一切以最後合約及收據為準";
                                }

                                print 
"<td class='listtxt'><button type='button' onclick='if(confirm(\"確定發出電郵通知?\")){location.href=\"contract_alert.php?id=".$order["id"]."&send_alert=1\";}'>發出</button></td>";
                                print 
"<td class='listtxt' style='padding-left:5'><button type='button' onclick=window.open('https://api.whatsapp.com/send?phone=852"  $order["customer_tel"] . "&text=" .  urlencode($default_msg) . "')  target='_blank'>點擊打開Whatsapp<button><br >
                                <textarea type='text' name='alertmessage' rows='5'>" 
$default_msg "</textarea>
                                <br />
                                <a href='https://wa.me/852" 
$order["customer_tel"] . "?text=預設相關的續租信息 <br />你的" $order['order_code'] . "合約即將到期'  target='_blank'>Whatsapp</a></td>";

                                print 
"</tr>";

                            }
                            
?>
                        </table>
                        <br>
                        <?php
                        
// render the pagination links
                        
$pagination->render();
                        
?>
                        <br>                        
                    </td>
                </tr>
            </table>
        </td>
    </tr>
</table>
</body>
</html>