001.
<?php
002.
include
"chksession.php"
003.
?>
004.
<html>
005.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=TIS-620"
>
006.
<head>
007.
008.
009.
010.
</head>
011.
<body>
012.
Login System
013.
ยินดีต้องรับคุณ <?php print
$sess_username
?>
014.
<table border=
'0'
>
015.
<tr>
016.
<td><a href=
"main.php"
>[ข้อมูลการจอง ] </a>
017.
<td><a href=
"changepass.php"
>เปลี่ยนรหัสผ่าน</a>
018.
<td><b>[พิมพ์ใบงาน ]</b>
019.
020.
</table>
021.
022.
<form action=
'fpdf16/print2.php'
method=
'post'
>
023.
<?php
024.
025.
$connection_string
=
'DRIVER={SQL Server};SERVER=FLEET-TRUCKING\SQLEXPRESS;DATABASE=GIS'
;
026.
027.
$user
=
'sa'
;
028.
$pass
=
'123456'
;
029.
030.
$link
= odbc_connect(
$connection_string
,
$user
,
$pass
);
031.
if
(!
$link
) {
032.
exit
(
"Error "
.odbc_error().
" ! - "
.odbc_errormsg().
"."
);
033.
}
034.
035.
036.
new
COM(
"ADODB.Connection"
, NULL, CP_UTF8);
037.
038.
039.
040.
041.
$sql
=
"SELECT *"
;
042.
043.
$sql
.=
"FROM FLST_WORK_ORDER_BOOKING INNER JOIN "
;
044.
$sql
.=
" FLST_WORK_ORDER ON FLST_WORK_ORDER_BOOKING.WORK_ORDER_ID = FLST_WORK_ORDER.WORK_ORDER_ID INNER JOIN"
;
045.
$sql
.=
" FLST_BOOKING ON FLST_WORK_ORDER_BOOKING.BOOKING_ID = FLST_BOOKING.BOOKING_ID INNER JOIN"
;
046.
$sql
.=
" FLST_BOOKING_INVOICE ON FLST_WORK_ORDER_BOOKING.BOOKING_ID = FLST_BOOKING_INVOICE.BOOKING_ID INNER JOIN"
;
047.
$sql
.=
" FLST_BOOKING_INVOICE_DETAIL ON FLST_WORK_ORDER_BOOKING.BOOKING_ID = FLST_BOOKING_INVOICE_DETAIL.BOOKING_ID INNER JOIN"
;
048.
$sql
.=
" FLEET_ONLINE_BOOKING ON FLST_WORK_ORDER.WORK_ORDER_ID = FLEET_ONLINE_BOOKING.FLEET_ONLINE_BOOKING_WORK_ORDER"
;
049.
$sql
.=
" WHERE (FLST_WORK_ORDER.WORK_ORDER_ID ='"
.
$_POST
[wor].
"' )"
;
050.
051.
052.
053.
054.
055.
$result
= odbc_exec(
$link
,
$sql
);
056.
057.
058.
$count
=0;
059.
060.
061.
print
"<table border='1'>"
;
062.
063.
064.
print
"<tr>"
;
065.
print
"<td> <center><b>ประเภทงาน"
;
066.
print
"<td> <center><b>หมายเลขการจอง"
;
067.
print
"<td> <center><b>สถาณที่รับ"
;
068.
print
"<td> <center><b>ที่อยู่"
;
069.
print
"<td> <center><b>สถานที่ส่ง"
;
070.
print
"<td> <center><b>ที่อยู่"
;
071.
print
"<td> <center><b>HAWB"
;
072.
print
"<td> <center><b>เวลารับ"
;
073.
print
"<td> <center><b>เวลาส่ง"
;
074.
print
"<td> <center><b>น้ำหนักรวม"
;
075.
print
"<td> <center><b>-"
;
076.
print
"<td> <center><b>จำนวนชิ้น"
;
077.
078.
while
(
$itemrow
=odbc_fetch_row(
$result
)) {
079.
080.
081.
if
(
$chkflt
<> odbc_result(
$result
,
"BOOKING_ID"
)){
082.
083.
084.
085.
$sum_amount
= odbc_fetch_array(odbc_exec(
$link
,
"SELECT sum(PACKAGE_AMOUNT) as amount2 from FLST_BOOKING_INVOICE_DETAIL where BOOKING_ID='"
.odbc_result(
$result
,
"BOOKING_ID"
).
"'"
));
086.
087.
print
"<tr>"
;
088.
089.
if
(odbc_result(
$result
,
"TRANSPORT_MODE"
) == 1){
090.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='แอร์ขาเข้า' name='mod[]'/>แอร์ขาเข้า"
;
091.
print
" <input type='hidden' value='X' name='mod1[]'/>"
;
092.
093.
}
elseif
(odbc_result(
$result
,
"TRANSPORT_MODE"
) == 2) {
094.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='แอร์ขาออก' name='mod[]'/>แอร์ขาออก"
;
095.
print
" <input type='hidden' value='X' name='mod2[]'/>"
;
096.
}
elseif
(odbc_result(
$result
,
"TRANSPORT_MODE"
) == 3) {
097.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='เรือขาเข้า' name='mod[]'/>เรือขาเข้า"
;
098.
print
" <input type='hidden' value='X' name='mod1[]'/>"
;
099.
}
elseif
(odbc_result(
$result
,
"TRANSPORT_MODE"
) == 4) {
100.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='เรือขาออก' name='mod[]'/>เรือขาออก"
;
101.
print
" <input type='hidden' value='X' name='mod2[]'/>"
;
102.
}
elseif
(odbc_result(
$result
,
"TRANSPORT_MODE"
) == 5) {
103.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='ภายในประเทศ' name='mod[]'/>ภายในประเทศ"
;
104.
105.
106.
107.
108.
109.
}
110.
111.
112.
113.
print
" <input type='hidden' value='"
.odbc_result(
$result
,
"WORK_ORDER_ID"
).
"' name='a[]'/> "
;
114.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.odbc_result(
$result
,
"BOOKING_ID"
).
"' name='b[]'/>"
.odbc_result(
$result
,
"BOOKING_ID"
);
115.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.odbc_result(
$result
,
"RECEIVER_LOCATION_NAME"
).
"' name='c[]'/>"
.odbc_result(
$result
,
"RECEIVER_LOCATION_NAME"
);
116.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.odbc_result(
$result
,
"RECEIVER_LOCATION_ADDRESS"
).
"' name='d[]'/>"
.odbc_result(
$result
,
"RECEIVER_LOCATION_ADDRESS"
);
117.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.odbc_result(
$result
,
"SENDER_LOCATION_NAME"
).
"' name='e[]'/>"
.odbc_result(
$result
,
"SENDER_LOCATION_NAME"
);
118.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.odbc_result(
$result
,
"SENDER_LOCATION_ADDRESS"
).
"' name='f[]'/>"
.odbc_result(
$result
,
"SENDER_LOCATION_ADDRESS"
);
119.
print
" <input type='hidden' value='"
.odbc_result(
$result
,
"DRIVE_NAME"
).
"' name='g[]'/>"
;
120.
print
" <input type='hidden' value='"
.odbc_result(
$result
,
"USER_NAME"
).
"' name='h[]'/>"
;
121.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.odbc_result(
$result
,
"HBL"
).
"' name='i[]'/>"
.odbc_result(
$result
,
"HBL"
);
122.
print
" <input type='hidden' value='"
.odbc_result(
$result
,
"OBL"
).
"' name='j[]'/>"
;
123.
print
" <input type='hidden' value='"
.odbc_result(
$result
,
"INVOICE_CUSTOMER"
).
"' name='k[]'/>"
;
124.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.odbc_result(
$result
,
"receiving_DATE"
).
"' name='l[]'/>"
.odbc_result(
$result
,FLEET_ONLINE_BOOKING_DATE);
125.
list(
$day
,
$time
) =
explode
(
" "
,odbc_result(
$result
,
"FLEET_ONLINE_BOOKING_DATE"
));
126.
list(
$y
,
$mm
,
$d
) =
explode
(
"-"
,
$day
);
127.
list(
$h
,
$m
) =
explode
(
":"
,
$time
);
128.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.
"$d-$mm-$y"
.
"' name='l1[]'/>"
.odbc_result(
$result
,
"sending_date"
);
129.
130.
131.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.
"$d-$mm-$y"
.
"' name='l1[]'/>"
.odbc_result(
$result
,
"GROSS_WEIGHT"
);
132.
print
" <input type='hidden' value='"
.
"$h : $m"
.
"' name='l2[]'/>"
;
133.
134.
135.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='"
.odbc_result(
$result
,
"GROSS_WEIGHT"
).
"' name='m[]'/>"
.odbc_result(
$result
,
"GROSS_WEIGHT"
);
136.
print
"<td style='border:1px #C0C0C0 solid;'><center> <input type='hidden' value='$sum_amount[amount2]' name='n[]'/>$sum_amount[amount2]"
;
137.
print
"<input type='hidden' value='"
.odbc_result(
$result
,
"VEHICLE_LICENSE"
).
"' name='o[]'/>"
;
138.
139.
140.
141.
142.
143.
144.
$chkflt
=odbc_result(
$result
,
"BOOKING_ID"
);
145.
146.
147.
$count
=
$count
+1;
148.
}
149.
}
150.
echo
"<input type=
'hidden'
value=
'$count'
name=
'count'
/>
151.
";
152.
print
"</table>"
;
153.
154.
print
"จำนวนใบงานทั้งหมด "
.
$count
.
" หน้า"
;
155.
156.
157.
158.
odbc_close(
$link
);
159.
odbc_free_result;
160.
161.
?>
162.
163.
164.
165.
<input type=
'submit'
value=
'พิมพ์ใบงาน'
name=
'confirm'
/> </form>
166.
167.
168.
169.
</body>
170.
</html>