001.
<td
class
=
"text-center"
>
002.
<button data-toggle=
"modal"
data-target=
"#view-modal"
data-cmreq-id=
"<?php echo $row["
cmreq_id
"]; ?>"
data-cmreq-code=
"<?php echo $row['cmreq_code']; ?>"
id=
"Btngetcmreq"
name=
"Btngetcmreq"
value=
""
class
=
"btn btn-sm btn-info"
><i
class
=
"glyphicon glyphicon-search"
></i> View</button>
003.
</td>
004.
ส่วนของ script
005.
<script>
006.
007.
$(document).ready(
function
(){
008.
009.
$(document).on(
'click'
,
'#Btngetcmreq'
,
function
(e){
010.
011.
e.preventDefault();
012.
013.
var
cmid = $(this).data(
'cmreq-id'
);
014.
015.
016.
$(
'#dynamic-content'
).html(
''
);
017.
$(
'#modal-loader'
).show();
018.
019.
$.ajax({
020.
url:
'getcmreq.php'
,
021.
type:
'POST'
,
022.
data:
'cmreq_id='
+cmid,
023.
dataType:
'html'
024.
})
025.
.done(
function
(data){
026.
console.log(data);
027.
028.
$(
'#dynamic-content'
).html(data);
029.
$(
'#modal-loader'
).hide();
030.
})
031.
.fail(
function
(){
032.
$(
'#dynamic-content'
).html(
'<i class="glyphicon glyphicon-info-sign"></i> Something went wrong, Please try again...'
);
033.
$(
'#modal-loader'
).hide();
034.
});
035.
036.
});
037.
038.
});
039.
040.
</script>
041.
042.
ส่วนของ php
043.
044.
045.
<div
class
=
"table-responsive"
>
046.
<table id=
"listreqitem"
name=
"listreqitem"
class
=
"table table-striped table-bordered"
>
047.
<tr>
048.
<th
class
=
"text-center"
>No.</th>
049.
<th
class
=
"text-center"
>PRODUCT CODE</th>
050.
<th
class
=
"text-center"
>PRODUCT NAME</th>
051.
<th
class
=
"text-center"
>STOCK</th>
052.
<th
class
=
"text-center"
>Min. STOCK</th>
053.
<th
class
=
"text-center"
>Req.QTY</th>
054.
<th
class
=
"text-center"
>CM Dis.1</th>
055.
<th
class
=
"text-center"
>CM Dis.2</th>
056.
</tr>
057.
058.
<?php
059.
060.
include
(
'config/conn.php'
);
061.
062.
$cmid
= json_decode(
file_get_contents
(
"php://input"
), true);
063.
064.
$sql_cmreq
=
"SELECT * FROM cm_request WHERE cmreq_id = '"
.
$cmid
.
"' "
;
065.
066.
067.
$querycm
=
$conn
->query(
$sql_cmreq
);
068.
069.
$rowcm
=
$querycm
->fetch_assoc();
070.
071.
$cmreqID
=
$rowcm
[
'cmreq_id'
];
072.
073.
$sql
= "SELECT * FROM items i
074.
LEFT JOIN product_master_detail p ON p.product_id = i.product_id
075.
WHERE i.cmreq_id =
'".$cmreqID."'
";
076.
077.
078.
$query
=
$conn
->query(
$sql
);
079.
080.
$listprocessing
=
array
();
081.
082.
while
(
$row
=
$query
->fetch_assoc())
083.
084.
{
085.
$listprocessing
[] =
$row
;
086.
087.
?>
088.
<tr>
089.
<td><?php
echo
$row
[
'item_code'
]; ?></td>
090.
<td><?php
echo
$row
[
'item_desc'
]; ?></td>
091.
<td
class
=
"text-center"
><?php
echo
$row
[
'item_qty'
]; ?></td>
092.
<td
class
=
"text-center"
><?php
echo
$row
[
'item_paycmchk'
]; ?></td>
093.
<td
class
=
"text-center"
><?php
echo
$row
[
'product_stock'
]; ?></td>
094.
<td
class
=
"text-center"
><?php
echo
$row
[
'product_minstock'
]; ?></td>
095.
</tr>
096.
<?php
097.
}
098.
099.
100.
?>
101.
</table>
102.
</div>