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
|
<? require("inc/configure.php"); require("inc/global.php"); require("inc/checklogin.php"); if ($logged_in == 0) { //echo 'Not logged in. <a href="login.php">Login</a>'; header('Window-target: _parent'); header('Location: login.php'); exit(); } ?> <? $custid = $_GET['custid']; $carid = $_GET['carid']; ?> <html> <head> <title><?=$systitle?></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link rel="stylesheet" href="main.css" type="text/css"> <script type="text/javascript" src="calendarDateInput.js"></script>
<link rel="stylesheet" href="_common/css/main.css" type="text/css" media="all"> <link href="sortableTable.css" rel="stylesheet" type="text/css" /> <script type="text/javascript" src="_common/js/mootools.js"></script> <script type="text/javascript" src="sortableTable.js"></script>
<script type="text/javascript" src="//code.jquery.com/jquery-1.7.2.min.js"></script> <link rel="stylesheet" href="//code.jquery.com/ui/1.7.3/themes/base/jquery-ui.css" /> <script type="text/javascript" src="//code.jquery.com/ui/1.7.3/jquery-ui.min.js"></script>
<!--popup start--> <script language="javascript"> function popups(lnk) { window.open(lnk,"Popupdetail","height=400,width=550,scrollbars=yes") }
$(function() { $( ".datepicker" ).datepicker({dateFormat: "yy-mm-dd"}); }); </script> <!--popup end-->
</head> <body bgcolor="#FFFFFF" leftmargin="10" topmargin="10" marginwidth="0" marginheight="0"> <!--********************************************************--> <script language="JavaScript"> <!-- var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i function formCheck(formobj){ // Enter name of mandatory fields var fieldRequired = Array(); // Enter field description to appear in the dialog box var fieldDescription = Array(); // dialog message var alertMsg = "Please complete the following fields:\n"; var l_Msg = alertMsg.length; var x = 0;
// check caryear start //var caryear = formobj.caryear.value //if (caryear.length > 0) //{ // if (IsNumeric(caryear) == false) // { // alertMsg += " - Please enter expected Year using the following format (Eg. YYYY).\n"; // } //} // check caryear end var licno = formobj.licno.value var chassisno = formobj.chassisno.value
if (licno.length == 0) { x = 1; } if (chassisno.length == 0) { if (x == 1) { alertMsg += " - Please enter <?=licno?> or <?=chassisno?>\n"; } }
for (var i = 0; i < fieldRequired.length; i++){ var obj = formobj.elements[fieldRequired[i]]; if (obj){ switch(obj.type){ case "select-one": if (obj.selectedIndex == -1 || obj.options[obj.selectedIndex].text == ""){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "select-multiple": if (obj.selectedIndex == -1){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; case "text": case "textarea": if (obj.value == "" || obj.value == null){ alertMsg += " - " + fieldDescription[i] + "\n"; } break; default: } if (obj.type == undefined){ var blnchecked = false; for (var j = 0; j < obj.length; j++){ if (obj[j].checked){ blnchecked = true; } } if (!blnchecked){ alertMsg += " - " + fieldDescription[i] + "\n"; } } } }
if (alertMsg.length == l_Msg){ return submitForm(); }else{ alert(alertMsg); return false; } } function IsNumeric(sText) { var ValidChars = "0123456789."; var IsNumber=true; var Char;
for (i = 0; i < sText.length && IsNumber == true; i++) { Char = sText.charAt(i); if (ValidChars.indexOf(Char) == -1) { IsNumber = false; } } return IsNumber;
} function y2k(number) { return (number < 1000) ? number + 1900 : number; }
function daysElapsed(date1,date2) { var difference = Date.UTC(y2k(date1.getYear()),date1.getMonth(),date1.getDate(),0,0,0) - Date.UTC(y2k(date2.getYear()),date2.getMonth(),date2.getDate(),0,0,0); return difference/1000/60/60/24; } function submitForm() { return true; } // -->
</script> <script type="text/javascript">
var emailfilter=/^\w+[\+\.\w-]*@([\w-]+\.)*\w+[\w-]*\.([a-z]{2,4}|\d+)$/i
function checkmail(e){ var returnval=emailfilter.test(e.value) if (returnval==false){ alert("Please enter a valid email address.") e.select() } return returnval } </script> <!--********************************************************--> <form action="cardetail.php" name="custform" method="get"> <input type="hidden" name="carid" value="<?=$carid?>"> <input type="hidden" name="custid"> </form> <!--********************************************************--> <? $jointdate = date("Y-m-d"); $sql = " select * from CM_CAR where carid = $carid "; $result = mysql_query($sql); $date = date("Y-m-d"); if ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $carid = $row{'carid'}; $licno = $row{'licno'}; $modelno = $row{'modelno'}; $chassisno = $row{'chassisno'}; $caryear = $row{'caryear'}; $status = $row{'status'}; $licence_expiry_date = $row{'licence_expiry_date'}=='0000-00-00' ? '' : $row{'licence_expiry_date'}; }
$sql = "select * from CM_CUSTOMER where custid = $custid "; $result = mysql_query($sql); if ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { $custno = $row{'custno'}; $custnameeng = $row{'custnameeng'}; } ?> <p class="pageheader">Car information</p> <p class="contentmsg"><?=$msg?></p> <form action="caradd.php" name="addform" method="post" onsubmit="return formCheck(this);"> <input type="hidden" name="custid" value="<?=$custid?>"> <input type="hidden" name="carid" value="<?=$carid?>"> <table border='0' cellpadding='0' cellspacing='0'> <tr><td valign="top" width="500" class="content"> <input type="image" name="btnsave" src="icons/save.jpg"> </td></tr> <tr><td> <table width="500" cellpadding='0' cellspacing='0'> <tr><td class="content"><?=custno?>: <img src="images/browser.png" border="0" onclick="popups('customerpopup.php?formname=custform&fieldname=custid')"></td> <td><input type="text" name="custno" value="<?=$custno?>" class="content" size="10" readonly> <?=$custnameeng?></td>
<tr><td class="content"><?=licno?>:</td> <td><input type="text" class="content" size="30" name="licno" maxlength="30" value="<?=$licno?>"></td> </tr> <tr><td class="content"><?=modelno?>:</td> <td><input type="text" class="content" size="30" name="modelno" maxlength="30" value="<?=$modelno?>"></td> </tr> <tr><td class="content"><?=chassisno?>:</td> <td><input type="text" class="content" size="30" name="chassisno" maxlength="50" value="<?=$chassisno?>"></td> </tr> <tr><td class="content"><?=caryear?>:</td> <td><input type="text" class="content" size="10" name="caryear" maxlength="50" value="<?php echo $caryear; ?>"></td> </tr> <tr><td class="content">牌費到期:</td> <td><input type="text" class="content datepicker" size="10" name="licence_expiry_date" maxlength="50" value="<?php echo $licence_expiry_date; ?>"></td> </tr> <tr><td class="content"><?=status?>:</td> <td><select class="content" name="status"><?=selectstatus($status);?></select></td> </tr> </table> </td></tr> </table> </form>
<br> <table width="700"> <tr><td width="100">Date</td> <td width="60"><?=mileage?></td> <td width="360">Product</td> <td width="60">Qty</td> <td width="60">UOM</td> <td width="60">Amount</td></tr> <? $sql = "SELECT a.orderdate , a.mileage , b.prodid , b.prodname , b.qty , b.uom , b.amount , a.invoiceno , b.lineno from OM_INVOICE_HDR a , OM_INVOICE_DTL b where a.invoiceno = b.invoiceno and carid = $carid order by orderdate desc, a.invoiceno, b.lineno"; $result = mysql_query($sql); $n = 1; while ($row = mysql_fetch_array($result,MYSQL_ASSOC)) { ?> <tr> <td><?=$row{'orderdate'}?></td> <td><?=$row{'mileage'}?></td> <td><?=$row{'prodname'}?></td> <td><?=$row{'qty'}?></td> <td><?=$row{'uom'}?></td> <td><?=$row{'amount'}?></td> </tr> <? } ?>
</table> </body> </html>
|