001.
<?php
002.
session_start();
003.
ob_start();
004.
require
(
'include/db_connect.php'
);
005.
require
(
'include/function.php'
);
006.
if
((isset(
$_SESSION
[
'lname'
])));
007.
{
008.
009.
?>
010.
<!DOCTYPE html>
011.
<html lang=
"en"
>
012.
<head>
013.
<meta charset=
"utf-8"
>
014.
<meta http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
015.
<meta name=
"viewport"
content=
"width=device-width, initial-scale=1"
>
016.
017.
<title><?php
echo
TITLE; ?></title>
018.
<link href=
"css/bootstrap.min.css"
rel=
"stylesheet"
>
019.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
020.
<meta http-equiv=
"Content-Type"
content=
"text/html; charset=UTF-8"
/>
021.
<link href=
"css/textcss.css"
type=
"text/css"
rel=
"stylesheet"
>
022.
<link href=
"css/styleinput.css"
type=
"text/css"
rel=
"stylesheet"
>
023.
<link href=
"css/stylelink.css"
type=
"text/css"
rel=
"stylesheet"
>
024.
<link href=
"style.css"
rel=
"stylesheet"
type=
"text/css"
/>
025.
</head>
026.
<link rel=
"stylesheet"
type=
"text/css"
027.
href=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/css/smoothness/jquery-ui-1.9.2.custom.css"
/>
028.
<script type=
"text/javascript"
src=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/js/jquery-1.8.3.js"
> </script>
029.
<script type=
"text/javascript"
src=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.min.js"
></script>
030.
<script type=
"text/javascript"
src=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.js"
></script>
031.
<script type=
"text/javascript"
src=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/css/smoothness/jquery-ui-1.9.2.custom.css"
></script>
032.
<script type=
"text/javascript"
src=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/css/smoothness/jquery-ui-1.9.2.custom.min.css"
></script>
033.
<script type=
"text/javascript"
src=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/js/jquery-1.8.3.js"
></script>
034.
<script type=
"text/javascript"
src=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.js"
></script>
035.
<script type=
"text/javascript"
src=
"jquery-ui-1.9.2.custom/jquery-ui-1.9.2.custom/js/jquery-ui-1.9.2.custom.min.js"
></script>
036.
037.
<body>
038.
<?php
039.
if
(
$_SESSION
[
'lL'
] == 1)
040.
{
041.
$Se
="SELECT distinct
042.
product_main.ProAuto,
043.
product_main.ProductID,
044.
product_main.DeptID,
045.
product_main.ProductNameLao,
046.
product_main.TypeID,
047.
product_main.Size,
048.
product_main.Price,
049.
product_main.Result,
050.
product_main.QTYMain,
051.
product_main.DateMain,
052.
product_main.Remark,
053.
product_main.AdminID,
054.
currency.CurrencyID,
055.
currency.CurrencyName,
056.
brand.BrandID,
057.
brand.BrandName,
058.
asset_province.APID,
059.
asset_province.AssetProvince_Name,
060.
tbphoto.PhotoID
061.
FROM stock_supplies.product_main
062.
LEFT JOIN stock_supplies.currency ON currency.CurrencyID = product_main.CurrencyID
063.
LEFT JOIN stock_supplies.brand ON brand.BrandID = product_main.BrandID
064.
LEFT JOIN stock_supplies.asset_province ON asset_province.APID = product_main.APID
065.
LEFT JOIN stock_supplies.tbphoto ON tbphoto.PhotoID = product_main.PhotoID";
066.
}
else
{
067.
$Se
="SELECT distinct
068.
product_main.ProAuto,
069.
product_main.ProductID,
070.
product_main.DeptID,
071.
product_main.ProductNameLao,
072.
product_main.TypeID,
073.
product_main.Size,
074.
product_main.Price,
075.
product_main.Result,
076.
product_main.QTYMain,
077.
product_main.DateMain,
078.
product_main.Remark,
079.
product_main.AdminID,
080.
currency.CurrencyID,
081.
currency.CurrencyName,
082.
brand.BrandID,
083.
brand.BrandName,
084.
asset_province.APID,
085.
asset_province.AssetProvince_Name,
086.
tbphoto.PhotoID
087.
FROM stock_supplies.product_main
088.
LEFT JOIN stock_supplies.currency ON currency.CurrencyID = product_main.CurrencyID
089.
LEFT JOIN stock_supplies.brand ON brand.BrandID = product_main.BrandID
090.
LEFT JOIN stock_supplies.asset_province ON asset_province.APID = product_main.APID
091.
LEFT JOIN stock_supplies.tbphoto ON tbphoto.PhotoID = product_main.PhotoID
092.
WHERE product_main.DeptID =
'".$_SESSION['
lDeptID
']."'
093.
";
094.
}
095.
$SQL
=mysql_query(
$Se
);
096.
097.
?>
098.
<form action=
""
name=
"frmMain"
id=
"frmMain"
>
099.
100.
101.
102.
<table width=
"96%"
border=
"1"
cellspacing=
"0"
cellpadding=
"0"
align=
"center"
class
=
"table-responsive"
>
103.
<tr>
104.
<td colspan=
"16"
> TEST</td>
105.
106.
</tr>
107.
<tr>
108.
<td> No:</td>
109.
<td> ProductID</td>
110.
<td> Photo</td>
111.
<td> Name </td>
112.
<td> TypeID</td>
113.
<td> Size</td>
114.
<td> Price</td>
115.
<td> BrandID</td>
116.
<td> QTYMain</td>
117.
<td> Monney</td>
118.
<td> CurrencyID</td>
119.
<td> AssetProvince_Name</td>
120.
<td> DateMain</td>
121.
<td> Remark</td>
122.
<td> Insert Detail</td>
123.
<td> Show Detail</td>
124.
125.
</tr>
126.
<?php
127.
$i
=1;
128.
while
(
$row
=mysql_fetch_assoc(
$SQL
))
129.
{
130.
131.
$K
=number_format(
$row
[
"Result"
],0);
132.
$A
=
$row
[
"ProAuto"
];
133.
$P
=
$row
[
"ProductID"
];
134.
$N
=
$row
[
"QTYMain"
];
135.
?>
136.
137.
138.
139.
140.
<tr>
141.
<td> <input type=
"text"
name=
"No<?php echo $i;?>"
id=
"No"
value=
"<?php echo $row["
ProAuto
"];?>"
></td>
142.
<td> <input type=
"text"
name=
"ProductIDs<?php echo $i;?>"
id=
"ProductIDs"
value=
"<?php echo $row["
ProductID
"];?>"
></td>
143.
<td align=
"center"
><img src=
"Photo/<?php echo $row['PhotoID'];?>"
width=
"100"
height=
"100"
/></td>
144.
<td> <input type=
"text"
name=
"ProductNameLao<?php echo $i;?>"
id=
""
value=
"<?php echo $row["
ProductNameLao
"];?>"
></td>
145.
<td> <input type=
"text"
name=
"TypeID<?php echo $i;?>"
id=
"TypeID"
value=
"<?php echo $row["
TypeID
"];?>"
></td>
146.
<td> <input type=
"text"
name=
"Size<?php echo $i;?>"
id=
"Size"
value=
"<?php echo $row["
Size
"];?>"
></td>
147.
<td> <input type=
"text"
name=
"Price<?php echo $i;?>"
id=
"Price"
value=
"<?php echo $row["
Price
"];?>"
></td>
148.
<td> <input type=
"text"
name=
"BrandName<?php echo $i;?>"
id=
"BrandName"
value=
"<?php echo $row["
BrandName
"];?>"
></td>
149.
<td> <input type=
"text"
name=
"QTYMain<?php echo $i;?>"
id=
"QTYMain"
value=
"<?php echo $row["
QTYMain
"];?>"
></td>
150.
<td> <input type=
"text"
name=
"Result<?php echo $i;?>"
id=
"Result"
value=
"<?php echo $row["
Result
"];?>"
></td>
151.
<td> <input type=
"text"
name=
"CurrencyName<?php echo $i;?>"
id=
"CurrencyName"
value=
"<?php echo $row["
CurrencyName
"];?>"
></td>
152.
<td> <input type=
"text"
name=
"AssetProvince_Name<?php echo $i;?>"
id=
""
value=
"<?php echo $row["
AssetProvince_Name
"];?>"
></td>
153.
<td> <input type=
"text"
name=
"DateMain<?php echo $i;?>"
id=
"DateMain"
value=
"<?php echo $row["
DateMain
"];?>"
></td>
154.
<td> <input type=
"text"
name=
"Remark<?php echo $i;?>"
id=
"Remark"
value=
"<?php echo $row["
Remark
"];?>"
></td>
155.
<td align=
"center"
><?php
echo
"<a href='frminsert_details.php?ProAuto="
.
$A
.
"&ProductID="
.
$P
.
"&n="
.
$N
."'>
156.
<img src=
'img/note_add.png'
width=
'22'
height=
'22'
/></a>"; ?></td>
157.
<td align=
"center"
><input type=
"text"
name=
"ProductID<?php echo $i;?>"
id=
"ProductID"
value=
"<?php echo $row["
ProductID
"]; ?>"
>
158.
<script>
159.
160.
161.
function
getDataFromDb()
162.
{
163.
164.
$.ajax({
165.
url:
"data.php"
,
166.
type:
"POST"
,
167.
data: {ProductID: $(
"#ProductID<?php echo $i;?>"
).val()}
168.
169.
})
170.
.success(
function
(result) {
171.
var
obj = jQuery.parseJSON(result);
172.
if
(obj !=
''
)
173.
{
174.
175.
$(
"#myBody"
).
empty
();
176.
$.each(obj,
function
(key, val) {
177.
var
tr =
"<tr>"
;
178.
tr = tr +
"<td>"
+ val[
"ProductID"
] +
"</td>"
;
179.
tr = tr +
"<td>"
+ val[
"ProductIDList"
] +
"</td>"
;
180.
tr = tr +
"<td>"
+ val[
"AssetDeptName"
] +
"</td>"
;
181.
tr = tr +
"<td>"
+ val[
"location"
] +
"</td>"
;
182.
tr = tr +
"<td>"
+ val[
"QTY"
] +
"</td>"
;
183.
tr = tr +
"<td>"
+ val[
"GroupName"
] +
"</td>"
;
184.
tr = tr +
"<td>"
+ val[
"DateCreate"
] +
"</td>"
;
185.
tr = tr +
"<td>"
+ val[
"DateEX"
] +
"</td>"
;
186.
tr = tr +
"<td>"
+ val[
"UseName"
] +
"</td>"
;
187.
tr = tr +
"<td>"
+ val[
"Remark"
] +
"</td>"
;
188.
189.
190.
191.
192.
tr = tr +
"</tr>"
;
193.
$(
'#myTable > tbody:last'
).append(tr);
194.
});
195.
}
196.
197.
});
198.
199.
}
200.
201.
setInterval(getDataFromDb,1000);
202.
</script>
203.
<center>
204.
<h1>My Web</h1>
205.
206.
<table width=
"600"
border=
"1"
id=
"myTable"
>
207.
<!-- head table -->
208.
<thead>
209.
<tr>
210.
<td width=
"91"
> <div align=
"center"
>ProductID </div></td>
211.
<td width=
"98"
> <div align=
"center"
>ProductIDList </div></td>
212.
<td width=
"198"
> <div align=
"center"
>AssetDeptName </div></td>
213.
<td width=
"97"
> <div align=
"center"
>location </div></td>
214.
<td width=
"59"
> <div align=
"center"
>QTY </div></td>
215.
<td width=
"71"
> <div align=
"center"
>GroupName </div></td>
216.
<td width=
"198"
> <div align=
"center"
>DateCreate </div></td>
217.
<td width=
"97"
> <div align=
"center"
>DateEX </div></td>
218.
<td width=
"59"
> <div align=
"center"
>UseName </div></td>
219.
<td width=
"71"
> <div align=
"center"
>Remark </div></td>
220.
</tr>
221.
</thead>
222.
<!-- body dynamic rows -->
223.
<tbody id=
"myBody"
></tbody>
224.
</table>
225.
226.
<center>
227.
228.
229.
</td>
230.
231.
</tr>
232.
233.
<?php } ?>
234.
235.
</table>
236.
</div>
237.
</form>
238.
</body>
239.
</html>
240.
241.
242.
<?php } ?>
243.
<?php
244.
ob_end_flush();
245.
mysql_close(
$d1
,
$db1
,
$c1
);
246.
mysql_close(
$d2
,
$db2
,
$c1
);
247.
248.
exit
();
249.
?>