-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathListStoreItem.php
More file actions
105 lines (83 loc) · 2.2 KB
/
Copy pathListStoreItem.php
File metadata and controls
105 lines (83 loc) · 2.2 KB
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
<?php
require_once("session.php");
$se=new session();
if(!$SerialNumbers=$se->get_value("SerialNumbers"))
{
echo "******************取得SerialNumbers失敗******************";
exit();
}
require_once("connect_mysql_class.php");
require_once("mysql_inc.php");
$db=new DB();
$db->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
$query="SELECT ID FROM ".$SerialNumbers." WHERE State !='DIE'";
$db->query($query);
$temp=$db->fetch_array();
$ItemID=$temp['ID'];
$query="SELECT * FROM StoreTakenItem WHERE Store='".$SerialNumbers."'";
$db->query($query);
//找出所有商品清單 之後轉換名字用
while($temp=$db->fetch_array())
{
$TakenItemIDList[]=$temp['TakenItemID'];
$TakenItemNameList[]=$temp['ItemName'];
$TakenItemPriceList[]=$temp['Price'];
}
$query="SELECT * FROM Type2".$ItemID;
$db->query($query);
$count=0;
while($temp=$db->fetch_array())
{
$data=null;
$dbtemp=new DB();
$dbtemp->connect_db($_DB['host'], $_DB['username'], $_DB['password'], $_DB['dbname']);
$query="Select number From custom_information where store ='".$SerialNumbers."' and item ='".$ItemID."' and custom_id ='".$temp['CustomID']."' and life='0'";
$dbtemp->query($query);
$dbtempdata=$dbtemp->fetch_array();
$data['CustomNumber']=$dbtempdata['number'];
$data['CustomID']=$temp['CustomID'];
$data['Quantity']=$temp['Quantity'];
$data['Life']=$temp['Life'];
if($count==0)
{
for($i=0;$i<count($TakenItemIDList);$i++)
{
if($TakenItemIDList[$i]==$temp['ItemID'])
{
$output[$count]['ItemName']=$TakenItemNameList[$i];
}
}
$output[$count]['ItemID']=$temp['ItemID'];
$output[$count]['WaitingCustomData'][]=$data;
$count++;
}
else
{
$flag=0;
for($i=0;$i<count($output);$i++)
{
if($output[$i]['ItemID']==$temp['ItemID'])
{
$output[$i]['WaitingCustomData'][]=$data;
$flag=1;
break;
}
}
if($flag==0)
{
for($i=0;$i<count($TakenItemIDList);$i++)
{
if($TakenItemIDList[$i]==$temp['ItemID'])
{
$output[$count]['ItemName']=$TakenItemNameList[$i];
}
}
$output[$count]['ItemID']=$temp['ItemID'];
$output[$count]['WaitingCustomData'][]=$data;
$count++;
}
}
}
echo json_encode($output);
//print_r($output);
?>