001.
<?php
require_once
(
'Connections/orderrm.php'
); ?>
002.
<?php
003.
004.
005.
if
(!function_exists(
"GetSQLValueString"
)) {
006.
function
GetSQLValueString(
$theValue
,
$theType
,
$theDefinedValue
=
""
,
$theNotDefinedValue
=
""
)
007.
{
008.
if
(PHP_VERSION < 6) {
009.
$theValue
= get_magic_quotes_gpc() ?
stripslashes
(
$theValue
) :
$theValue
;
010.
}
011.
012.
$theValue
= function_exists(
"mysql_real_escape_string"
) ? mysql_real_escape_string(
$theValue
) : mysql_escape_string(
$theValue
);
013.
014.
switch
(
$theType
) {
015.
case
"text"
:
016.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
017.
break
;
018.
case
"long"
:
019.
case
"int"
:
020.
$theValue
= (
$theValue
!=
""
) ?
intval
(
$theValue
) :
"NULL"
;
021.
break
;
022.
case
"double"
:
023.
$theValue
= (
$theValue
!=
""
) ? doubleval(
$theValue
) :
"NULL"
;
024.
break
;
025.
case
"date"
:
026.
$theValue
= (
$theValue
!=
""
) ?
"'"
.
$theValue
.
"'"
:
"NULL"
;
027.
break
;
028.
case
"defined"
:
029.
$theValue
= (
$theValue
!=
""
) ?
$theDefinedValue
:
$theNotDefinedValue
;
030.
break
;
031.
}
032.
return
$theValue
;
033.
}
034.
035.
036.
}
037.
038.
$editFormAction
=
$_SERVER
[
'PHP_SELF'
];
039.
if
(isset(
$_SERVER
[
'QUERY_STRING'
])) {
040.
$editFormAction
.=
"?"
. htmlentities(
$_SERVER
[
'QUERY_STRING'
]);
041.
}
042.
043.
if
((isset(
$_POST
[
"MM_insert"
])) && (
$_POST
[
"MM_insert"
] ==
"form1"
)) {
044.
$insertSQL
= sprintf(
"INSERT INTO `order` (`date`, namejob, customer, itemcode, papername, rp, so, price, amount, total, aom, ae, poo, ple, ked, fon, mol, doung) VALUES (NOW(), %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)"
,
045.
GetSQLValueString(
$_POST
[
'namejob'
],
"text"
),
046.
GetSQLValueString(
$_POST
[
'customer'
],
"text"
),
047.
GetSQLValueString(
$_POST
[
'itemcode'
],
"text"
),
048.
GetSQLValueString(
$_POST
[
'papername'
],
"text"
),
049.
GetSQLValueString(
$_POST
[
'rp'
],
"text"
),
050.
GetSQLValueString(
$_POST
[
'so'
],
"text"
),
051.
GetSQLValueString(
$_POST
[
'price'
],
"int"
),
052.
GetSQLValueString(
$_POST
[
'amount'
],
"int"
),
053.
GetSQLValueString(
$_POST
[
'total'
],
"int"
),
054.
GetSQLValueString(
$_POST
[
'aom'
],
"int"
),
055.
GetSQLValueString(
$_POST
[
'ae'
],
"int"
),
056.
GetSQLValueString(
$_POST
[
'poo'
],
"int"
),
057.
GetSQLValueString(
$_POST
[
'ple'
],
"int"
),
058.
GetSQLValueString(
$_POST
[
'ked'
],
"int"
),
059.
GetSQLValueString(
$_POST
[
'fon'
],
"int"
),
060.
GetSQLValueString(
$_POST
[
'mol'
],
"int"
),
061.
GetSQLValueString(
$_POST
[
'doung'
],
"int"
));
062.
063.
mysql_select_db(
$database_orderrm
,
$orderrm
);
064.
$Result1
= mysql_query(
$insertSQL
,
$orderrm
)
or
die
(mysql_error());
065.
066.
$insertGoTo
=
"insertData.php"
;
067.
if
(isset(
$_SERVER
[
'QUERY_STRING'
])) {
068.
$insertGoTo
.= (
strpos
(
$insertGoTo
,
'?'
)) ?
"&"
:
"?"
;
069.
$insertGoTo
.=
$_SERVER
[
'QUERY_STRING'
];
070.
}
071.
header(sprintf(
"Location: %s"
,
$insertGoTo
));
072.
}
073.
074.
mysql_select_db(
$database_orderrm
,
$orderrm
);
075.
$query_Recordset1
=
"SELECT * ,(aom+ae+poo+ple+ked+fon+mol+doung) AS total FROM `order`"
;
076.
$Recordset1
= mysql_query(
$query_Recordset1
,
$orderrm
)
or
die
(mysql_error());
077.
$row_Recordset1
= mysql_fetch_assoc(
$Recordset1
);
078.
$totalRows_Recordset1
= mysql_num_rows(
$Recordset1
);
079.
080.
mysql_query(
"SET character_set_results=UTF8"
);
081.
mysql_query(
"SET character_set_client=UTF8"
);
082.
mysql_query(
"SET character_set_connection=UTF8"
);
083.
?>
086.
<head>
087.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=utf-8"
/>
088.
<title>เพิ่มข้อมูล</title>
089.
</head>
090.
091.
<body>
092.
093.
<form action=
"<?php echo $editFormAction; ?>"
method=
"post"
name=
"form1"
id=
"form1"
>
094.
<table align=
"center"
>
095.
<tr align=
"center"
valign=
"baseline"
bgcolor=
"#66CCFF"
>
096.
<td nowrap=
"nowrap"
> </td>
097.
<td>บันทึกรายการ</td>
098.
</tr>
099.
<tr valign=
"baseline"
>
100.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>ชื่องาน</td>
101.
<td><input type=
"text"
name=
"namejob"
value=
""
size=
"32"
/></td>
102.
</tr>
103.
<tr valign=
"baseline"
>
104.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>ชื่อลูกค้า</td>
105.
<td><input type=
"text"
name=
"customer"
value=
""
size=
"32"
/></td>
106.
</tr>
107.
<tr valign=
"baseline"
>
108.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>Itemcode:</td>
109.
<td><input type=
"text"
name=
"itemcode"
value=
""
size=
"32"
/></td>
110.
</tr>
111.
<tr valign=
"baseline"
>
112.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>ชื่อกระดาษ</td>
113.
<td><input type=
"text"
name=
"papername"
value=
""
size=
"32"
/></td>
114.
</tr>
115.
<tr valign=
"baseline"
>
116.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>RP:</td>
117.
<td><input type=
"text"
name=
"rp"
value=
""
size=
"32"
/></td>
118.
</tr>
119.
<tr valign=
"baseline"
>
120.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>SO:</td>
121.
<td><input type=
"text"
name=
"so"
value=
""
size=
"32"
/></td>
122.
</tr>
123.
<tr valign=
"baseline"
>
124.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>ราคาต่อหน่วย</td>
125.
<td><input type=
"text"
name=
"price"
value=
""
size=
"32"
/></td>
126.
</tr>
127.
<tr valign=
"baseline"
>
128.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>จำนวนชิ้นงาน:</td>
129.
<td><input type=
"text"
name=
"amount"
value=
""
size=
"32"
/></td>
130.
</tr>
131.
<tr valign=
"baseline"
>
132.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
> </td>
133.
<td> </td>
134.
</tr>
135.
<tr valign=
"baseline"
>
136.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>อ้อม</td>
137.
<td><input type=
"text"
name=
"aom"
value=
""
size=
"32"
/></td>
138.
</tr>
139.
<tr valign=
"baseline"
>
140.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>เอ๋</td>
141.
<td><input type=
"text"
name=
"ae"
value=
""
size=
"32"
/></td>
142.
</tr>
143.
<tr valign=
"baseline"
>
144.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>ปู</td>
145.
<td><input type=
"text"
name=
"poo"
value=
""
size=
"32"
/></td>
146.
</tr>
147.
<tr valign=
"baseline"
>
148.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>เปิ้ล</td>
149.
<td><input type=
"text"
name=
"ple"
value=
""
size=
"32"
/></td>
150.
</tr>
151.
<tr valign=
"baseline"
>
152.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>เกต</td>
153.
<td><input type=
"text"
name=
"ked"
value=
""
size=
"32"
/></td>
154.
</tr>
155.
<tr valign=
"baseline"
>
156.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>ฝน</td>
157.
<td><input type=
"text"
name=
"fon"
value=
""
size=
"32"
/></td>
158.
</tr>
159.
<tr valign=
"baseline"
>
160.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>มล</td>
161.
<td><input type=
"text"
name=
"mol"
value=
""
size=
"32"
/></td>
162.
</tr>
163.
<tr valign=
"baseline"
>
164.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
>อุ๋ย</td>
165.
<td><input type=
"text"
name=
"doung"
value=
""
size=
"32"
/></td>
166.
</tr>
167.
<tr valign=
"baseline"
>
168.
<td align=
"center"
nowrap=
"nowrap"
bgcolor=
"#66CCFF"
> </td>
169.
<td><input type=
"submit"
value=
"Insert record"
/></td>
170.
</tr>
171.
</table>
172.
<input type=
"hidden"
name=
"MM_insert"
value=
"form1"
/>
173.
</form>
174.
<p><br />
175.
</p>
176.
<table border=
"1"
align=
"center"
cellpadding=
"1"
cellspacing=
"1"
>
177.
<tr align=
"center"
bgcolor=
"#66CCFF"
>
178.
<td>วันที่</td>
179.
<td>ชื่องาน</td>
180.
<td>ชื่อลูกค้า</td>
181.
<td>itemcode</td>
182.
<td>ชื่อกระดาษ</td>
183.
<td>RP</td>
184.
<td>SO</td>
185.
<td>ราคาต่อชิ้น</td>
186.
<td>จำนวนชิ้น</td>
187.
<td>รวม</td>
188.
<td>อ้อม</td>
189.
<td>เอ๋</td>
190.
<td>ปู</td>
191.
<td>เปิ้ล</td>
192.
<td>เกต</td>
193.
<td>ฝน</td>
194.
<td>มล</td>
195.
<td>อุ๋ย</td>
196.
<td>สถานนะซื้อ</td>
197.
<td>วันที่สั่งซื้อ</td>
198.
<td>สถานะของเข้า</td>
199.
<td>วันที่รับของเข้า</td>
200.
</tr>
201.
<?php
do
{ ?>
202.
<tr bgcolor=
"#CCFF99"
>
203.
<td><?php
echo
$row_Recordset1
[
'date'
]; ?></td>
204.
<td><?php
echo
$row_Recordset1
[
'namejob'
]; ?></td>
205.
<td><?php
echo
$row_Recordset1
[
'customer'
]; ?></td>
206.
<td><?php
echo
$row_Recordset1
[
'itemcode'
]; ?></td>
207.
<td><?php
echo
$row_Recordset1
[
'papername'
]; ?></td>
208.
<td><?php
echo
$row_Recordset1
[
'rp'
]; ?></td>
209.
<td><?php
echo
$row_Recordset1
[
'so'
]; ?></td>
210.
<td><?php
echo
$row_Recordset1
[
'price'
]; ?></td>
211.
<td><?php
echo
$row_Recordset1
[
'amount'
]; ?></td>
212.
<td><?php
echo
$row_Recordset1
[
'total'
]; ?></td>
213.
<td><?php
echo
$row_Recordset1
[
'aom'
]; ?></td>
214.
<td><?php
echo
$row_Recordset1
[
'ae'
]; ?></td>
215.
<td><?php
echo
$row_Recordset1
[
'poo'
]; ?></td>
216.
<td><?php
echo
$row_Recordset1
[
'ple'
]; ?></td>
217.
<td><?php
echo
$row_Recordset1
[
'ked'
]; ?></td>
218.
<td><?php
echo
$row_Recordset1
[
'fon'
]; ?></td>
219.
<td><?php
echo
$row_Recordset1
[
'mol'
]; ?></td>
220.
<td><?php
echo
$row_Recordset1
[
'doung'
]; ?></td>
221.
<td><?php
echo
$row_Recordset1
[
'buy'
]; ?></td>
222.
<td><?php
echo
$row_Recordset1
[
'buydate'
]; ?></td>
223.
<td><?php
echo
$row_Recordset1
[
'import'
]; ?></td>
224.
<td><?php
echo
$row_Recordset1
[
'importdate'
]; ?></td>
225.
</tr>
226.
<?php }
while
(
$row_Recordset1
= mysql_fetch_assoc(
$Recordset1
)); ?>
227.
</table>
228.
</body>
229.
</html>
230.
<?php
231.
mysql_free_result(
$Recordset1
);
232.
?>