001.
<!DOCTYPE html>
002.
<html lang=
"en"
>
003.
<head>
004.
<meta charset=
"UTF-8"
>
005.
<meta http-equiv=
"X-UA-Compatible"
content=
"IE=edge"
>
006.
<meta name=
"viewport"
content=
"width=device-width, initial-scale=1.0"
>
007.
<title>ProductRecipe</title>
008.
<link rel =
"icon"
type =
"image/png"
href =
"images/icon/favicon.ico"
>
009.
<?php
010.
$user_id
=
$_REQUEST
[
"user_id"
];
011.
include
(
'navbar.php'
);
012.
$batch
=
$_REQUEST
[
"batch"
];
013.
include
(
"connectpdo1.php"
);
014.
$sql
= "SELECT SampleName,Batch,Quantity,Batch.Application_ID
as
ApplicationID,Application.Name
as
name
015.
FROM [Application].[dbo].[Batch]
016.
Inner join Application on Batch.Application_ID=Application.ID
017.
where Batch=
'$batch'
";
018.
$stmt
=
$conn
->prepare(
$sql
);
019.
$stmt
->execute();
020.
$result
=
$stmt
->fetch(PDO::FETCH_ASSOC);
021.
?>
022.
<link rel=
"stylesheet"
herf=
"css/bootstrap.min.css"
>
023.
<script src=
"js/bootstrap.min.js"
></script>
024.
<script src=
"js/jquery-3.6.0.min.js"
></script>
027.
<script type=
"text/javascript"
>
028.
$(document).ready(
function
(){
029.
var
rows = 1;
030.
$(
"#createRows"
).click(
function
(){
031.
var
tr =
"<tr>"
;
032.
tr = tr +
"<td><input type='text' name='ingredient"
+rows+
"' id='ingredient"
+rows+
"' ></td>"
;
033.
tr = tr +
"<td><input type='text' name='percent"
+rows+
"' id='percent"
+rows+
"' ></td>"
;
034.
tr = tr +
"</tr>"
;
035.
$(
'#myTable > tbody:last'
).append(tr);
036.
037.
$(
'#hdnCount'
).val(rows);
038.
rows = rows + 1;
039.
});
040.
041.
$(
"#deleteRows"
).click(
function
(){
042.
if
($(
"#myTable tr"
).length != 1) {
043.
$(
"#myTable tr:last"
).remove();
044.
}
045.
});
046.
047.
$(
"#clearRows"
).click(
function
(){
048.
rows = 1;
049.
$(
'#hdnCount'
).val(rows);
050.
$(
'#myTable > tbody:last'
).
empty
();
051.
});
052.
053.
$(
"#frmMain"
).submit(
function
() {
054.
055.
var
bFlag = true;
056.
$(
"table#myTable input[id*='ingredient']"
).each(
function
(index) {
057.
var
line = index + 1;
058.
var
ingredient = $(
"table#myTable input[id*='ingredient']"
).eq(index);
059.
var
percent = $(
"table#myTable input[id*='percent']"
).eq(index);
060.
061.
if
($(ingredient).val() !=
""
|| $(percent).val() !=
""
)
062.
{
063.
if
($(ingredient).val() ==
""
)
064.
{
065.
alert(
'Please input Ingredient line...'
+ line);
066.
bFlag = false;
067.
}
068.
if
($(percent).val() ==
""
)
069.
{
070.
alert(
'Please input % line...'
+ line);
071.
bFlag = false;
072.
}
073.
}
074.
});
075.
if
(!bFlag) {
return
false; }
076.
return
true;
077.
});
078.
});
079.
</script>
080.
081.
</head>
082.
<body>
083.
<form id=
"frmMain"
name=
"frmMain"
method=
"post"
action=
"SavePredust.php"
>
084.
<div
class
=
"container"
>
085.
<table
class
=
"table table-bordered"
>
086.
<thead
class
=
"thead-dark"
>
087.
<tr>
088.
<th>Sample Name</th>
089.
<th>Batch Ref No.</th>
090.
<th>Quantity</th>
091.
<th>Application</th>
092.
</tr>
093.
</thead>
094.
<tbody>
095.
<tr>
096.
<td><?php
echo
$result
[
"SampleName"
];?></td>
097.
<td>
098.
<?php
echo
$result
[
"Batch"
];?>
099.
<input type =
"hidden"
name=
"batch"
value=
"<?php echo $result["
Batch
"];?>"
>
100.
</td>
101.
<td><?php
echo
$result
[
"Quantity"
];?></td>
102.
<td><?php
echo
$result
[
"name"
];?></td>
103.
</tr>
104.
</tbody>
105.
</table>
106.
<fieldset><legend>ProductRecipe</legend>
107.
<table
class
=
"table table-bordered"
>
108.
<thead
class
=
"thead-dark"
align=
"center"
>
109.
<tr>
110.
<th>NameProduct</th>
111.
<th><input name=
"NameProduct"
type=
"text"
></th>
112.
<th>
Date
</th>
113.
<th><input name=
"date"
type=
"date"
></th>
114.
</tr>
115.
</thead>
116.
<tbody>
117.
<tr>
118.
<td>flour name</td>
119.
<td><input name=
"flourname"
type=
"text"
></td>
120.
<td>Volume</td>
121.
<td><input name=Volume type=
"text"
></td>
122.
</tr>
123.
</tbody>
124.
<tbody>
125.
<tr>
126.
<td>CustomerName</td>
127.
<td><input name=
"customerName"
typr=
"text"
></td>
128.
<td>Application</td>
129.
<td>
130.
<?php
echo
$result
[
"name"
];?>
131.
<input type=
"hidden"
name=
"Application_ID"
value=
"<?php echo $result["
ApplicationID
"]?>"
>
132.
</td>
133.
</tr>
134.
</tbody>
135.
<tbody>
136.
<tr>
137.
<td>Note</td>
138.
<td><textarea name=
"Note"
rows=
"4"
cols=
"40"
></textarea></td>
139.
</tr>
140.
</tbody>
141.
</table>
142.
</fieldset>
143.
144.
<fieldset><legend>Predust</legend>
145.
<table id=
"myTable"
width=
"40%"
cellspacing=
"1"
cellpadding=
"1"
align=
"center"
border=
"1"
>
146.
<thead>
147.
<tr>
148.
<td align=
"middle"
>ingredient</td>
149.
<td align=
"middle"
>%</td>
150.
</tr>
151.
</thead>
152.
<tbody>
153.
<tr>
154.
<input type=
"button"
id=
"createRows"
value=
"Add"
>
155.
<input type=
"button"
id=
"deleteRows"
value=
"Del"
>
156.
<input type=
"button"
id=
"clearRows"
value=
"Clear"
>
157.
</tr>
158.
</tbody>
159.
</table>
160.
</fieldset>
161.
<input type=
"hidden"
id=
"hdnCount"
name=
"hdnCount"
>
162.
<input type =
"hidden"
name=
"user_id"
value=
"<?php echo $user_id; ?>"
>
163.
<input type=
"submit"
value=
"Submit"
>
164.
</div>
165.
</form>
166.
</body>
167.
</html>