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
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
|
<?php require_once('check_login.php'); require_once 'dompdf/autoload.inc.php';
use Dompdf\Dompdf; use Dompdf\Options;
set_time_limit(0); ini_set('memory_limit', '512M'); ini_set('apc.cache_by_default', 0);
if(empty($_GET["order_id"]) || (int)$_GET["order_id"] <= 0){ echo "<script>alert('請選擇正確的合約。'); history.back();</script>"; exit; }
date_default_timezone_set('Asia/Hong_Kong');
ini_set('apc.cache_by_default', 0);
if (PHP_SAPI == 'cli') die('This example should only be run from a Web Browser');
//get order data $order_id = (int)$_GET["order_id"]; if(!empty($order_id)){ $order_info = get_order($order_id); $order_room_info = get_order_room($order_id); $order_room_list_txt = ""; foreach($order_room_info as $order_room){ $room_info = get_room($order_room["room_id"]); $order_room_list_txt .= check_combine_room($room_info["code"]).", "; } $order_room_list_txt = substr_replace($order_room_list_txt, "", -2);
$customer_info = get_customer($order_info["customer_id"]); $location_info = get_location($order_info["location_id"]); $Licensor_en = $location_info['contract_en']; $Licensor_tc = $location_info['contract_tc'];
//紅酒倉 $sql = "SELECT * FROM otherspage WHERE ospageid = 3"; $row = bind_pdo($sql, null, "selectone"); $wine_terms = ""; $wine_terms_en = ""; if($order_info["location_id"] == 8){ $wine_terms = '<div class="page_break"></div>' . nl2br($row["wine_ospagedesc_tc"]); $wine_terms_en = '<div class="page_break"></div>' . nl2br($row["wine_ospagedesc_en"]); } $terms_txt = '<div class="page_break"></div>' . nl2br($row["ospagedesc_tc"]); $terms_txt_en = '<div class="page_break"></div>' . nl2br($row["ospagedesc_en"]);
if($order_info["customer_typeid"] == "PERSONAL"){ $idno = "Identification Number 身份證明號碼 :" . rsa_crypt($order_info["customer_identity_id"], 2); $name = "Name 姓名 :" . $order_info["customer_name"]; $display_name = $order_info["customer_name"]; }else{ $idno = "Business Registration No 商業登記證號碼 :" . rsa_crypt($order_info["customer_identity_id"], 2); $name = "Company Name 公司名稱 :" . $order_info["customer_companyname"]; $display_name = $order_info["customer_companyname"]; }
$paymethod = get_master_type_code("PAYMENT_METHOD", $order_info["paymethod"]); if(empty($order_info["paymethod2"])) $order_info["paymethod2"] = $order_info["paymethod"];
$paymethod2 = get_master_type_code("PAYMENT_METHOD", $order_info["paymethod2"]);
if($order_info["prepaid_month"] > 0){ $total_prepaid = $order_info["prepaid_amount"]+$order_info["total_order_product"];
$total_paid = $order_info["last_paid"]+$order_info["prepaid_amount"]+$order_info["total_order_product"];
//$total_remain = $order_info["total_discounted_price"]*$order_info["rent_month"]+$order_info["deposit"]+$order_info["total_order_product"]-$order_info["last_paid"]-$order_info["prepaid_amount"]-$order_info["free_first_month_deduct"]-$order_info["free_2_month_deduct"]; //kelvin, 20200803 $total_remain = $order_info["total_discounted_price"]*$order_info["rent_month"]+$order_info["deposit"]+$order_info["total_order_product"]-$order_info["last_paid"]-$total_prepaid-$order_info["free_first_month_deduct"]-$order_info["free_2_month_deduct"]-$order_info["discount_amount"]; }else{ //prevent error if($order_info["prepaid_month"] == 0){ $total_prepaid = 0;
$total_paid = $order_info["last_paid"]; $total_remain = $order_info["total_discounted_price"]*$order_info["rent_month"]+$order_info["deposit"]+$order_info["total_order_product"]-$order_info["last_paid"]-$order_info["prepaid_amount"]-$order_info["free_first_month_deduct"]-$order_info["free_2_month_deduct"]-$order_info["discount_amount"]; } }
//unit change if($order_info["createdate"] > "2017-04-27 18:00:00"){ $unit = "平方呎"; }else{ $unit = "立方呎"; } if($order_info['renew'] == 1){ $rent_txt = "租金以".$paymethod2["name_tc"]."支付"; $rent_txt2 = ""; }else{ $rent_txt = $paymethod["name_tc"] == "未付" ? "按金未付" : "按金以".$paymethod["name_tc"]."支付".($order_info["paymethod"] == "CREDIT_CARD"?" (並會扣除3%手續費)":""); $rent_txt2 = $paymethod2["name_tc"] == "未付" ? "租金未付" : "租金以".$paymethod2["name_tc"]."支付"; }
$contact = ""; if($order_info["customer_typeid"] == "BUSINESS"){ $contact = "Contact Person 聯絡人 :" . $order_info["customer_name"] . "<br>"; } /************** invoice ***************/ //invoice id $sql = 'select id from invoice where order_id = ? and deleted = ?'; $parameters = array($order_id, 0); $_invoice = bind_pdo($sql, $parameters, 'selectone'); $invoice_id = (int)$_invoice['id'];
if (!empty($invoice_id)) { // deposit $deposit_info = get_deposit($invoice_id); $items = "";
foreach ($order_room_info as $k => $order_room) { $room_info = get_room($order_room["room_id"]); $master_room_info = get_master_room($room_info["master_room_id"]); $order_room_list = check_combine_room($room_info["code"]) . " (" . $master_room_info["length"] . "'x" . $master_room_info["width"] . "'x" . $master_room_info["height"] . "')<br>"; //$order_room_list = substr_replace($order_room_list ,"",-2);
if ($k == 0) { $items = "<br><div style='display: inline-block; width: 45%; vertical-align: top;'>合約編號: " . $order_info["code"] . ",</div><div style='display: inline-block; width: 50%; vertical-align: top; text-align: right;'> 租用單位: " . $order_room_list; } else { $items .= $order_room_list; } } $items .= "</div>"; // invoice $invoice_info = get_invoice($invoice_id); $invoice_total = numberformat($order_info["total_discounted_price"] * $order_info["rent_month"] + $order_info["total_order_product"]); if ($order_info["id"] == 1007) { $invoice_total = numberformat($order_info["total_discounted_price"] * $order_info["rent_month"] + $order_info["total_order_product"] - 5418); } $customer_paid = $invoice_info["amount"] - $invoice_info["balance"]; $customer_unpaid = $invoice_info["balance"]; $sql = "select *, invoice.id as invoice_id, invoice.status as invoice_status, invoice.code as invoice_code, invoice.docdate as invoice_docdate, invoice.duedate as invoice_duedate, invoice.amount as invoice_amount, invoice_dtl.amount as invoice_dtl_amount from `invoice` invoice INNER JOIN `invoice_dtl` invoice_dtl ON invoice_dtl.invoice_id = invoice.id where invoice.id = ? and invoice.deleted = ? order by FIELD(invoice_dtl.type, 'PENALTY','ORDER_PRODUCT', 'RENT' ), invoice_dtl.month DESC";
$parameters = array($invoice_id, 0); $invoice_dtl_info = bind_pdo($sql, $parameters, "selectall"); $rp_txt = ""; $op_txt = ""; $penalty_txt = ""; if (!empty($invoice_dtl_info)) {
foreach ($invoice_dtl_info as $dtl) { if ($dtl["type"] == "RENT") { $i = $dtl["month"]; $customer_paid -= $dtl["invoice_dtl_amount"];
$result = get_rent_date_from_to($order_info["warehousing_date"], $dtl["month"]); $start_date = $result["start"]; $end_date = $result["end"];
$rent_price = numberformat($order_info["total_discounted_price"]);
if ($order_info["id"] == 1007) { $rent_price = numberformat($dtl["invoice_dtl_amount"]); } $rp_txt .= "<tr><td style='width: 60%;'>租金<br> 日期: " . $start_date . " 至 " . $end_date. "<br> $items</td> <td>$rent_price</td></tr>"; }
if ($dtl["type"] == "ORDER_PRODUCT") {
$order_product_balance = 0;
if ($customer_paid > 0) { if ($customer_paid >= $dtl["invoice_dtl_amount"]) { $customer_paid -= $dtl["invoice_dtl_amount"]; $order_product_balance = 0; } } else { $customer_paid = 0; $order_product_balance = $dtl["invoice_dtl_amount"] - $customer_paid; }
$product_info = get_product($dtl["order_dtl_id"]); $op_txt .= "<tr><td style='width: 60%;'>其他<br>" . $product_info["name_tc"] . " </td> </td><td>" . numberformat($dtl["invoice_dtl_amount"]) . "</td></tr>"; }
if ($dtl["type"] == "PENALTY") { $penalty_balance = $dtl["invoice_dtl_amount"] - $customer_paid;
if ($customer_paid > 0) { if ($customer_paid >= $dtl["invoice_dtl_amount"]) { $customer_paid -= $dtl["invoice_dtl_amount"]; $penalty_balance = 0; } }
if (!empty($dtl["remark"])) { $remark = " (" . $dtl["remark"] . ")"; } else { $remark = ""; } $penalty_txt .= "<tr><td style='width: 60%;'>罰款 </td> </td><td>" . numberformat($dtl["invoice_dtl_amount"]) . "</td></tr>"; } } } } /************** end invoice ***************/ /************** payment ***************/ $sql = 'select payment_id from payment_dtl where payable_type = ? and payable_id = ? and status = ? and deleted = ? order by docdate DESC'; $parameters = array('INVOICE', $invoice_id, 'PAID', 0); $_payment = bind_pdo($sql, $parameters, 'selectone'); $_GET['payment_id'] = $_payment['payment_id'];
$payment_info = get_payment_by_id((int)$_GET["payment_id"]); $pcustomer_info = get_customer($payment_info["customer_id"]);
$payment_dtl_info = get_payment_dtl((int)$_GET["payment_id"]); $thistype_total_amt = 0; $total_amt = 0; $last_paid = 0; $total_ori_amt = 0;
foreach ($payment_dtl_info as $key => $payment_dtl) { $total_amt += $payment_dtl["amount"]; if ($payment_dtl["payable_type"] == "INVOICE") { $thistype_total_amt += $payment_dtl["amount"]; $_info = get_invoice($payment_dtl["payable_id"]); if (!empty($_info)) { $_order_info = get_order($_info["order_id"]); $last_paid = $_order_info["last_paid"]; $total_ori_amt = $_order_info["total_discounted_price"] * $_order_info["rent_month"] + $_order_info["total_order_product"]; } } }
$docdate = new DateTime($payment_info["docdate"]);
$pay1_obj = get_master_type_code("PAYMENT_METHOD", $payment_info["paymethod"]); $pay1 = $pay1_obj['name_tc']; if ($payment_info["paymethod"] == "CHEQUE") { $pay1 = $pay1 . " - " . $payment_info["bank_name"] . "<br>" . $payment_info["cheque_num"]; } else if ($payment_info["paymethod"] == "OTHER" || $payment_info["paymethod"] == "BANKIN") { $pay1 = $payment_info["paymethod_other"]; }
$pay2_obj = get_master_type_code("PAYMENT_METHOD", $payment_info["paymethod2"]); $pay2 = $pay2_obj["name_tc"]; if ($payment_info["paymethod2"] == "CHEQUE") { $pay2 = $pay2 . " - " . $payment_info["bank_name2"] . "<br>" . $payment_info["cheque_num2"]; } else if ($payment_info["paymethod2"] == "OTHER" || $payment_info["paymethod2"] == "BANKIN") { $pay2 = $payment_info["paymethod_other2"]; }
if (!empty($payment_dtl_info)) { $p_deposit_txt = ""; foreach ($payment_dtl_info as $dtl) { $d_payable_info = get_deposit($dtl["payable_id"]); $d_payable_code = $d_payable_info["deposit_code"]; $i_payable_info = get_invoice($dtl["payable_id"]); $i_payable_code = $i_payable_info["invoice_code"];
if ($dtl["payable_type"] == "DEPOSIT") { $porder_info = get_order($d_payable_info["order_id"]); $order_room_info = get_order_room($porder_info["id"]); $order_room_list = ""; $p_items = "";
foreach ($order_room_info as $k => $order_room) { $room_info = get_room($order_room["room_id"]); $master_room_info = get_master_room($room_info["master_room_id"]); $order_room_list = check_combine_room($room_info["code"]) . " (" . $master_room_info["length"] . "'x" . $master_room_info["width"] . "'x" . $master_room_info["height"] . "')<br>"; //$order_room_list = substr_replace($order_room_list ,"",-2);
if ($k == 0) { $p_items .= "<div style='display: inline-block; width: 45%; vertical-align: top;'>合約編號: " . $porder_info["code"] . ",</div><div style='display: inline-block; width: 50%; vertical-align: top; text-align: right;'>租用單位: " . $order_room_list; } else { $p_items .= $order_room_list; } } $p_items .= "</div>"; $p_deposit_txt .= "<tr><td style='width: 60%;'>按金 (發票編號: " . $d_payable_code . ")<br>$pitems</td> <td>" . numberformat($d_payable_info["amount"]) . "</td></tr>";
} else if ($dtl["payable_type"] == "INVOICE") { $sql = "select *, invoice.id as invoice_id, invoice.status as invoice_status, invoice.code as invoice_code, invoice.docdate as invoice_docdate, invoice.duedate as invoice_duedate, invoice.amount as invoice_amount, invoice_dtl.amount as invoice_dtl_amount from `invoice` invoice INNER JOIN `invoice_dtl` invoice_dtl ON invoice_dtl.invoice_id = invoice.id where invoice.id = ? and invoice.deleted = ? order by FIELD(invoice_dtl.type, 'PENALTY','ORDER_PRODUCT', 'RENT' ), invoice_dtl.month DESC";
$parameters = array($dtl["payable_id"], 0); $invoice_dtl_info = bind_pdo($sql, $parameters, "selectall");
if (!empty($invoice_dtl_info)) { $p_rp_txt = ""; $p_op_txt = ""; $p_penalty_txt = "";
foreach ($invoice_dtl_info as $dtl2) { if ($dtl2["type"] == "RENT") {
$i = $dtl2["month"]; $porder_info = get_order($i_payable_info["order_id"]);
$result = get_rent_date_from_to($porder_info["warehousing_date"], $dtl2["month"]); $start_date = $result["start"]; $end_date = $result["end"];
$order_room_info = get_order_room($porder_info["id"]); $order_room_list = ""; $p_items = ""; foreach ($order_room_info as $k => $order_room) { $room_info = get_room($order_room["room_id"]); $master_room_info = get_master_room($room_info["master_room_id"]); $order_room_list = check_combine_room($room_info["code"]) . " (" . $master_room_info["length"] . "'x" . $master_room_info["width"] . "'x" . $master_room_info["height"] . "')<br>"; //$order_room_list = substr_replace($order_room_list ,"",-2);
if ($k == 0) { $p_items .= "<div style='display: inline-block; width: 45%; vertical-align: top;'>合約編號: " . $porder_info["code"] . ",</div><div style='display: inline-block; width: 50%; vertical-align: top; text-align: right;'>租用單位: " . $order_room_list; } else { $p_items .= $order_room_list; } } $p_items .= "</div>"; $p_rp_txt .= "<tr><td style='width: 60%;'>租金 (發票編號: " . $i_payable_code . ")<br>日期: " . $start_date . " 至 " . $end_date . "<br>$p_items</td> <td>" . numberformat($porder_info["total_discounted_price"]) . "</td></tr>"; }
if ($dtl["type"] == "ORDER_PRODUCT") { $product_info = get_product($dtl2["order_dtl_id"]); $p_op_txt .= "<tr><td style='width: 60%;'>其他 (發票編號: " . $i_payable_code . ")<br>" . $product_info["name_tc"] . "</td> <td>" . numberformat($dtl2["invoice_dtl_amount"]) . "</td></tr>"; }
if ($dtl2["type"] == "PENALTY") { if (!empty($dtl2["remark"])) { $remark = " (" . $dtl2["remark"] . ")"; } else { $remark = ""; } $p_penalty_txt .= "<tr><td style='width: 60%;'>罰款 $remark </td> </td><td>" . numberformat($dtl2["invoice_dtl_amount"]) . "</td></tr>"; } } } } } } /************** end payment ***************/
$content = "<!doctype html> <html lang='en'> <head> <meta charset='utf-8'> <title></title> <style> table { width: 100%; }
* { font-family: 'simsun'; } /** Set the margins of the page to 0, so the footer and the header can be of the full height and width ! **/ @page { margin: 0cm 0cm; }
/** Define now the real margins of every page in the PDF **/ body { margin-top: 3.5cm; margin-left: 2cm; margin-right: 2cm; margin-bottom: 0.5cm; }
/** Define the header rules **/ header { position: fixed; top: 0cm; left: 0cm; right: 0cm; height: 3cm; }
/** Define the footer rules **/ footer { position: fixed; bottom: 0cm; left: 0cm; right: 0cm; height: 2cm; } u { text-decoration: none; border-bottom: 1px solid #333; padding-bottom: 5px; display: inline-block; } td { font-size: 12px; word-wrap: break-word; } p { margin-top: 0; font-size: 12px; } .page_break { page-break-before: always; } .terms p { font-size: 10px; word-wrap: break-word; } .terms p.title { font-size: 18px; text-align: center; } table.format-table tr td:last-of-type { text-align: right; } </style> </head> <body> <header> <img src='http://" . $_SERVER['SERVER_NAME'] . "/innoutstorage/webadmin/pdf_template/header.png' width='100%' height='100%'/> </header> <p style='font-size: 18px; text-align: center;'>Unit Storage License Agreement<br>單位儲存許可協議書</p> <table> <tr> <td>License Agreement Number 許可協議書編號: " . $order_info["code"] . "</td> <td style='text-align: right;'>Date 日期: " . date("Y-m-d") . "</td> </tr> </table> <table style='table-layout:fixed;'> <tr> <td style='width: 20%;'>Licensor:<br>許可人:</td> <td style='width: 80%;'>$Licensor_en<br>$Licensor_tc</td> </tr> </table> <br> <b><u>Licensee Information 被許可人資料</u></b> <p>$idno<br> $name<br> Address 地址: " . rsa_crypt($order_info["customer_address"], 2) . "<br> $contact Contact Phone 聯絡電話: " . rsa_crypt($order_info["customer_tel"], 2) . "<br> E-Mail Address 電郵地址: " . rsa_crypt($order_info["customer_email"], 2) . "<br> </p> <b><u>Agreed Terms By Licensor and Licensee</u></b> <p>Unit Number 單位號碼: $order_room_list_txt<br> Customer I.D. 顧客編號: " . $order_info['customer_code'] . "<br> Approximate Size 大約面積: " . $order_info["roughly_size"].$unit . "<br> Effective Date 生效日期: " . $order_info["startdate"]." 至 ".$order_info["enddate"] . "<br> Smart Card No. 智能卡號碼: " . $order_info["room_key"] . "<br> </p> <table> <tr> <td><b><u>Fees and Charges 費用及收費</u></b></td> <td style='text-align: right;'>港幣 : HKD$" . numberformat($order_info["total_discounted_price"])." x ".$order_info["rent_month"] . "月</td> </tr> <tr> <td>Monthly License Fee 每月許可費:</td> <td style='text-align: right;'>(原價 : HKD$" . numberformat($order_info["total_retail_price"]) . ")</td> </tr> <tr> <td>Effective Duration Fee 有效期價:</td> <td style='text-align: right;'>港幣 : HKD$" . numberformat($order_info["total_discounted_price"]*$order_info["rent_month"]) . "</td> </tr> <tr> <td>Deposit 按金:</td> <td style='text-align: right;'>港幣 : HKD$" . numberformat($order_info["deposit"]) . "</td> </tr> <tr> <td>Others 其他:</td> <td style='text-align: right;'>港幣 : HKD$" . numberformat($order_info["total_order_product"]) . "</td> </tr> <tr> <td>Discount 租金優惠:</td> <td style='text-align: right;'>港幣 : -HKD$" . numberformat($order_info["free_first_month_deduct"]+$order_info["free_2_month_deduct"]) . "</td> </tr> <tr> <td>Other Discount 其餘優惠:</td> <td style='text-align: right;'>港幣 : -HKD$" . numberformat($order_info["discount_amount"]) . "</td> </tr> <tr> <td>Total 合計:</td> <td style='text-align: right;'>港幣 : HKD$" . numberformat(($order_info["total_discounted_price"]*$order_info["rent_month"])+$order_info["deposit"]+$order_info["total_order_product"]-$order_info["free_first_month_deduct"]-$order_info["free_2_month_deduct"]-$order_info["discount_amount"]) . "</td> </tr> <tr> <td>Paid 已付費用: (預繳: HKD$" . numberformat($total_prepaid) . ")</td> <td style='text-align: right;'>港幣 : -HKD$" . numberformat($total_paid) . "</td> </tr> <tr> <td>Remaining Balance 餘款:</td> <td style='text-align: right;'>港幣 : HKD$" . numberformat($total_remain) . "</td> </tr> </table> <br> <b><u>Remark 備註</b></u> <p>" . $order_info["remark"] . "</p> <p>$rent_txt<br>$rent_txt2</p> <p style='font-size: 13px;'> I have read and agreed all the terms and conditions in this License Agreement and that of the company annexed hereto which this agreement is subject to my signature below indicates acceptance thereof.<br> In case of any disputes, In N Out International Corporate Limited reserves the right of final decision.<br><br> 本人已經閱讀並同意本許可協議及借用條款及細則。<br> 本人在下欄的簽署表示本人接受該等條文及聲明。<br> 如有任何爭議 , 出入易國際有限公司保留最終之決定權。 </p> <br><br><br> <table> <tr> <td> <p>Licensee Signature 被許可人簽署<br><div style='height: 90px; display: block;'></div>_________________________________<br>Date 日期 " . date("Y-m-d") . "</p> </td> <td> <p>Licensor Signature 許可人簽署</p> <div> <img src='http://" . $_SERVER['SERVER_NAME'] . "/innoutstorage/webadmin/pdf_template/chop.jpg' style='width: 80px; margin-left: 25%; margin-top: 10px; margin-bottom: 0;'> <p style='text-align: left; margin: 0;'>_________________________________<br>Date 日期 " . date("Y-m-d") . "</p> </div> </td> </tr> </table> <div class='page_break'></div> <p style='font-size: 22px; text-align: center;'>按金發票</p>
<table class='format-table'> <tr> <td>客戶編號 :</td> <td>" . $customer_info["code"] . "</td> <td>發票日期 :</td> <td>" . date("Y-m-d", strtotime($deposit_info["docdate"])) . "</td> </tr> <tr> <td>客戶姓名 :</td> <td>" . $display_name . "</td> <td>發票編號 :</td> <td>" . $deposit_info["deposit_code"] . "</td> </tr> <tr> <td style='width: 20%;'>客戶地址 :</td> <td style='width: 40%;'>" . rsa_crypt($order_info["customer_address"], 2) . "</td> <td></td> <td></td> </tr> </table> <table class='format-table' style='border-top: 1px solid #333;'> <tr> <td>服務詳情 :</td> <td>費用(HK$)</td> </tr> <tr> <td style='width: 60%;'>按金<br> 日期: " . $order_info['startdate'] . " 至 " . $order_info['enddate'] . "<br> $items</td> <td>" . numberformat($deposit_info["deposit_amount"]) . "</td> </tr> <tr> <td></td> <td style='border-top: 1px solid #333;'>" . numberformat($deposit_info["deposit_amount"]) . "</td> </tr> <tr> <td>已付金額</td> <td>- 0.00</td> </tr> <tr> <td>總金額</td> <td>" . numberformat($deposit_info["deposit_amount"]) . "</td> </tr> </table> <p style='margin-left: 2px;'>備註: " . $deposit_info["remark"] . "</p> <div class='page_break'></div> <p style='font-size: 22px; text-align: center;'>租金及其他發票</p>
<table class='format-table'> <tr> <td>客戶編號 :</td> <td>" . $customer_info["code"] . "</td> <td>發票日期 :</td> <td>" . date("Y-m-d", strtotime($invoice_info["docdate"])) . "</td> </tr> <tr> <td>客戶姓名 :</td> <td>" . $display_name . "</td> <td>發票編號 :</td> <td>" . $invoice_info["invoice_code"] . "</td> </tr> <tr> <td style='width: 20%;'>客戶地址 :</td> <td style='width: 40%;'>" . rsa_crypt($order_info["customer_address"], 2) . "</td> <td></td> <td></td> </tr> </table> <table class='format-table' style='border-top: 1px solid #333;'> <tr> <td>服務詳情 :</td> <td>費用(HK$)</td> </tr> $rp_txt $op_txt $penalty_txt <tr> <td></td> <td style='border-top: 1px solid #333;'>" . $invoice_total . "</td> </tr> <tr> <td>已付金額</td> <td>" . "- " . numberformat($order_info["last_paid"]) . "</td> </tr> <tr> <td>總金額</td> <td>" . numberformat($invoice_info["amount"]) . "</td> </tr> </table> <p style='margin-left: 2px;'>備註: " . $invoice_info["remark"] . "</p> <div class='page_break'></div> <p style='font-size: 22px; text-align: center;'>按金付款收據</p>
<table class='format-table'> <tr> <td>客戶編號 :</td> <td>" . $pcustomer_info["code"] . "</td> <td>收據編號 :</td> <td>" . $payment_info["code"] . "</td> </tr> <tr> <td>客戶姓名 :</td> <td>" . $pcustomer_info["customer_name"] . "</td> <td>付款日期 :</td> <td>" . $docdate->format("Y-m-d") . "</td> </tr> <tr> <td style='width: 20%;'>客戶地址 :</td> <td style='width: 40%;'>" . rsa_crypt($pcustomer_info["address"], 2) . "</td> <td>付款方式 :</td> <td>" . $pay1 . "</td> </tr> </table> <table class='format-table' style='border-top: 1px solid #333;'> <tr> <td>付款詳情 :</td> <td>金額(HK$)</td> </tr> $p_deposit_txt <tr> <td>總金額</td> <td style='border-top: 1px solid #333;'>" . numberformat($total_amt) . "</td> </tr> </table> <p style='margin-left: 2px;'>備註: " . $deposit_info["remark"] . "</p> <div class='page_break'></div> <p style='font-size: 22px; text-align: center;'>正式收據</p>
<table class='format-table'> <tr> <td>客戶編號 :</td> <td>" . $pcustomer_info["code"] . "</td> <td>收據編號 :</td> <td>" . $payment_info["code"] . "</td> </tr> <tr> <td>客戶姓名 :</td> <td>" . $pcustomer_info["customer_name"] . "</td> <td>付款日期 :</td> <td>" . $docdate->format("Y-m-d") . "</td> </tr> <tr> <td style='width: 20%;'>客戶地址 :</td> <td style='width: 40%;'>" . rsa_crypt($pcustomer_info["address"], 2) . "</td> <td>付款方式 :</td> <td>" . $pay2 . "</td> </tr> </table> <table class='format-table' style='border-top: 1px solid #333;'> <tr> <td>付款詳情 :</td> <td>金額(HK$)</td> </tr> $p_rp_txt $p_op_txt $p_penalty_txt <tr> <td></td> <td style='border-top: 1px solid #333;'>" . numberformat($total_ori_amt) . "</td> </tr> <tr> <td>已付金額</td> <td>- " . numberformat($last_paid) . "</td> </tr> <tr> <td>總金額</td> <td>" . numberformat($thistype_total_amt) . "</td> </tr> </table> <div class='terms'> $terms_txt $terms_txt_en $wine_terms $wine_terms_en </div> </body> </html>";
$options = new Options(); $options->set('isHtml5ParserEnabled', true); $options->set('isRemoteEnabled', true); $options->set('isFontSubsettingEnabled', true); $dompdf = new Dompdf($options); $dompdf->loadHtml($content); $dompdf->render(); $dompdf->stream(str_replace(",", "_", $order_room_list_txt) . "_" . date("d-m-Y", strtotime($order_info["startdate"])) . "_" . date("d-m-Y", strtotime($order_info["enddate"])) . "_ALL.pdf"); }else{ echo "<script>alert('找不到相關合約。');history.back();</script>"; } exit;
|