001.
<tr>
002.
<td><input name=
"accept1[]"
type=
"checkbox"
id=
"accept1[]"
value= <?php
echo
$potest
;?> > </td>
003.
<td><center><div
class
=
"form-group col-xl-100"
><input type=
"text"
name=
"quotation[]"
id=
"quotation"
value=
"<?php echo $resultpo["
QUOTATOIN
"];?>"
class
=
"form-control"
></div></center></td>
004.
<td><center><div
class
=
"form-group col-xl-100"
><input type=
"text"
name=
"vendorcdate[]"
placeholder=
"2018-01-01"
id=
"vendorcdate"
value=
"<?php echo $resultpo["
VCONFDATE
"];?>"
class
=
"form-control"
></div></center></td>
005.
<td><center><div
class
=
"form-group col-xl-100"
><input type=
"text"
name=
"vendorcqty[]"
id=
"vendorcqty"
value=
"<?php echo $resultpo["
VCONFQTY
"];?>"
class
=
"form-control"
></div></center></td>
006.
<td><center><div
class
=
"form-group col-xl-100"
><input type=
"text"
name=
"invoice[]"
id=
"invoice"
value=
"<?php echo $resultpo["
VINVNO
"];?>"
class
=
"form-control"
></div></center></td>
007.
<td><center><?php
echo
$resultpo
[
"STATUS"
];?></center></td>
008.
<td><center><?php
echo
$resultpo
[
"PRIORITY"
];?></center></td>
009.
<td><font size =
'2'
color =
'red'
> <b><center><?php
if
(
$resultpo
[
'NEWITEM'
]==
'Y'
)
echo
'✔'
;?></font></b></center></td>
010.
<td><font size =
'2'
color =
'red'
> <b><center><?php
if
(
$resultpo
[
'CMAT'
]==
'Y'
)
echo
'✔'
;?></font></b></center></td>
011.
<td><font size =
'2'
color =
'red'
> <b><center><?php
if
(
$resultpo
[
'CDESC'
]==
'Y'
)
echo
'✔'
;?></font></b></center></td>
012.
<td><font size =
'2'
color =
'red'
> <b><center><?php
if
(
$resultpo
[
'CQTY'
]==
'Y'
)?></font></b></center></td>
013.
<td><font size =
'2'
color =
'red'
> <b><center><?php
if
(
$resultpo
[
'CPRICE'
]==
'Y'
)?></font></b></center></td>
014.
<td><font size =
'2'
color =
'red'
> <b><center><?php
if
(
$resultpo
[
'CDELDATE'
]==
'Y'
)?></font></b></center></td>
015.
<td><font size =
'2'
color =
'red'
> <b><center><?php
if
(
$resultpo
[
"CADDLINE"
]==
'Y'
)?></font></b></td>
016.
<td><font size =
'2'
color =
'red'
> <b><center><?php
if
(
$resultpo
[
'CDELLINE'
]==
'Y'
)?></font></b></center></td>
017.
<td></td>
018.
<td><center><?php
echo
$resultpo
[
"PONO"
];?></center></td>
019.
<td><center><?php
echo
$resultpo
[
"POLINE"
];?></center></td>
020.
<td><center><?php
echo
$resultpo
[
"MATERIAL"
];?></center></td>
021.
<td><center><?php
echo
$resultpo
[
"DESCR"
];?></center></td>
022.
<td><center><?php
echo
$resultpo
[
"DRAWNO"
];?></center></td>
023.
<td><center><?php
echo
$resultpo
[
"POQTY"
];?></center></td>
024.
<td><center><?php
echo
$resultpo
[
"OPENQTY"
];?></center></td>
025.
<td><center><?php
echo
$resultpo
[
"UPRICE"
];?></center></td>
026.
<td><center><?php
echo
$resultpo
[
"TOTPRICE"
];?></center></td>
027.
<td><center><?php
echo
$resultpo
[
"CUR"
];?></center></td>
028.
<td><center><?php
echo
DateThai (
$resultpo
[
"PODATE"
]);?></center></td>
029.
<td><center><?php
echo
DateThai (
$resultpo
[
"DELDATE"
]);?></center></td>
030.
<td><center><?php
echo
DateThai (
$resultpo
[
"NEWDUEDATE"
]);?></center></td>
031.
<td><center><?php
echo
DateThai (
$resultpo
[
"MRPDATE"
]);?></center></td>
032.
<td><center><?php
echo
$resultpo
[
"QCCLASS"
];?></center></td>
033.
<td><center><?php
echo
$resultpo
[
"NOTE"
];?></center></td>
034.
<div style=
"display:none"
><input type=
"text"
style=
"width:190px;"
maxlength=
"100"
name=
"potest[]"
id=
'potest'
value=
"<?php echo $resultpo["
PONO
"]; echo $_POST['PONO'];?>"
></div>
035.
<div style=
"display:none"
><input type=
"text"
style=
"width:190px;"
maxlength=
"100"
name=
"pono1[]"
id=
'pono1'
value=
"<?php echo $resultpo["
PONO
"]; echo $_POST['PONO'];?>"
></div>
036.
<div style=
"display:none"
><input type=
"text"
style=
"width:190px;"
maxlength=
"100"
name=
"poline[]"
id=
'poline'
value=
"<?php echo $resultpo["
POLINE
"]; echo $_POST['POLINE'];?>"
></div>
037.
<div style=
"display:none"
><input type=
"text"
style=
"width:190px;"
maxlength=
"100"
name=
"poline1[]"
id=
'poline1'
value=
"<?php echo $resultpo["
POLINE
"]; echo $_POST['POLINE'];?>"
></div>
038.
<div style=
"display:none"
><input type=
"text"
style=
"width:190px;"
maxlength=
"100"
name=
"posubline[]"
id=
'posubline'
value=
"<?php echo $resultpo["
POSUBLINE
"]; echo $_POST['POSUBLINE'];?>"
></div>
039.
<div style=
"display:none"
><input type=
"text"
style=
"width:190px;"
maxlength=
"100"
name=
"posubline1[]"
id=
'posubline1'
value=
"<?php echo $resultpo["
POSUBLINE
"]; echo $_POST['POSUBLINE'];?>"
></div>
040.
<div style=
"display:none"
><input type=
"text"
style=
"width:190px;"
maxlength=
"100"
name=
"status1[]"
id=
'status1'
value=
"<?php echo $resultpo["
STATUS
"]; echo $_POST['STATUS'];?>"
></div>
041.
</tr>
042.
<?php
043.
$i
++;
044.
}
045.
?>
046.
<?php
047.
}
048.
?>
049.
<?php
050.
}
051.
?>
052.
</tbody>
053.
<div
class
=
"form-group col-xl-3"
>
054.
<?php
055.
if
(
$_GET
[
'status'
]==
"NEW"
||
$_GET
[
'status'
]==
"PROCESS"
||
$_GET
[
'status'
]==
"PROCESS"
)
056.
{
057.
?>
058.
<button style=
"margin-right: 3px;"
type=
"submit"
name=
"submit"
value=
"update"
class
=
"btn-xs btn btn-warning edit "
onClick=
"return confirm('Are you sure you want to update?')"
><i
class
=
"fa fa-edit"
></i>Update</button>
059.
<?php
060.
}
061.
if
(
$_GET
[
'status'
]==
"CHANGE"
)
062.
{
063.
?>
064.
<button style=
"margin-right: 3px;"
type=
"submit"
name=
"submit"
value=
"updatemax"
class
=
"btn-xs btn btn-warning edit "
onClick=
"return confirm('Are you sure you want to working?')"
><i
class
=
"fa fa-edit"
></i>Update</button>
065.
<?php
066.
}
067.
?>
068.
</div>
069.
</table>
070.
<?php
071.
$accept1
=
array
();
$poline1
=
array
();
$posubline1
=
array
();
$pono1
=
array
();
$posubline
=
array
();
$poline
=
array
();
$potest
=
array
();
$quotation
=
array
();
$vendorcdate
=
array
();
$vendorcqty
=
array
();
$invoice
=
array
();
072.
$i
=0;
073.
foreach
(
$_POST
[
"quotation"
]
as
$var
)
074.
{
075.
$quotation
[
$i
]=
$var
;
$i
++;
076.
}
077.
$i
=0;
078.
foreach
(
$_POST
[
"vendorcdate"
]
as
$var
)
079.
{
080.
$year
=
substr
(
$var
,6,4);
081.
$month
=
substr
(
$var
,3,2);
082.
$date
=
substr
(
$var
,0,2);
083.
$vendorcdate
[
$i
]=
$year
.
"-"
.
$month
.
"-"
.
$date
;
084.
085.
$i
++;
086.
}
087.
088.
$i
=0;
089.
foreach
(
$_POST
[
"vendorcqty"
]
as
$var
)
090.
{
091.
$vendorcqty
[
$i
]=
$var
;
$i
++;
092.
}
093.
$i
=0;
094.
foreach
(
$_POST
[
"invoice"
]
as
$var
)
095.
{
096.
$invoice
[
$i
]=
$var
;
$i
++;
097.
}
098.
099.
$i
=0;
100.
foreach
(
$_POST
[
"potest"
]
as
$var
)
101.
{
102.
$potest
[
$i
]=
$var
;
$i
++;
103.
}
104.
$i
=0;
105.
foreach
(
$_POST
[
"poline"
]
as
$var
)
106.
{
107.
$poline
[
$i
]=
$var
;
$i
++;
108.
}
109.
$i
=0;
110.
foreach
(
$_POST
[
"posubline"
]
as
$var
)
111.
{
112.
$posubline
[
$i
]=
$var
;
$i
++;
113.
}
114.
$i
=0;
115.
foreach
(
$_POST
[
"pono1"
]
as
$var
)
116.
{
117.
$pono1
[
$i
]=
$var
;
$i
++;
118.
}
119.
$i
=0;
120.
foreach
(
$_POST
[
"poline1"
]
as
$var
)
121.
{
122.
$poline1
[
$i
]=
$var
;
$i
++;
123.
}
124.
$i
=0;
125.
foreach
(
$_POST
[
"posubline1"
]
as
$var
)
126.
{
127.
$posubline1
[
$i
]=
$var
;
$i
++;
128.
}
129.
$i
=0;
130.
foreach
(
$_POST
[
"accept1"
]
as
$var
)
131.
{
132.
$accept1
[
$i
]=
$var
;
$i
++;
133.
}
134.
135.
136.
137.
138.
139.
$pono
=
$_POST
[
'pono'
];
140.
141.
142.
143.
$confdel
=sqlEscape (
$_POST
[
"confdel"
]);
144.
145.
$statusin
=sqlEscape (
$_POST
[
"statusin"
]);
146.
$priority
=sqlEscape (
$_POST
[
"priority"
]);
147.
148.
149.
if
(
$_POST
[
"submit"
]==
"update"
)
150.
{
151.
152.
for
(
$j
=0;
$j
<
$i
;
$j
++)
153.
{
154.
155.
$update
="update PUR_POVEN SET
156.
QUOTATOIN =
'".$quotation[$j]."'
157.
,VCONFDATE=
'".$vendorcdate[$j]."'
158.
,VCONFQTY =
'".$vendorcqty[$j]."'
159.
,VINVNO =
'".$invoice[$j]."'
160.
,VDELBY =
'$default'
161.
,VACCNPODATE = NOW()
162.
,VACCNPOBY =
'$default'
";
163.
$update
.=
"where PONO = "
.
$potest
[
$j
].
" AND POLINE = "
.
$poline
[
$j
].
" AND POSUBLINE = "
.
$posubline
[
$j
].
""
;
164.
$queryupdate
=mysqli_query(
$conn
,
$update
);
165.
}
166.
if
(
$queryupdate
)
167.
{
168.
for
(
$b
=0;
$b
<
$i
;
$b
++)
169.
{
170.
$updatepo
=
"update PUR_POV SET STATUS = 'PROCESS'"
;
171.
172.
$updatepo
.=
"where PONO = "
.
$pono1
[
$b
].
" AND POLINE = "
.
$poline1
[
$b
].
" AND POSUBLINE = "
.
$posubline1
[
$b
].
" AND STATUS = 'NEW'"
;
173.
$queryupdatepo
=mysqli_query(
$conn
,
$updatepo
);
174.
}
175.
if
(
$queryupdatepo
)
176.
{
177.
echo
"<script>alert('Update Complete ✔✔'); location.href='accept_edit.php?material=$material&potest=$potest';</script>"
;
178.
}
179.
else
echo
"<script>alert('Update queryupdatepo Fail!!!'); location.href='accept_edit.php?material=$material';</script>"
;
return
0;
180.
}
181.
else
echo
"<script>alert('Update queryupdate Fail!!!'); location.href='accept_edit.php?material=$material';</script>"
;
return
0;
182.
}