-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlogic_main.html
132 lines (109 loc) · 3.99 KB
/
logic_main.html
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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<title> Logic - Beforg modul </title>
<meta name="Generator" content="EditPlus">
<meta name="Author" content="">
<meta name="Keywords" content="">
<meta name="Description" content="">
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-2" />
<script>
function calc_length (id1, id2) {
if (document.getElementById(id1)) {
document.getElementById(id2).innerHTML = document.getElementById(id1).value.length;
}
}
function calc_margin (id) {
nettoFogyar = document.getElementById("fogyar[" + id + "]").value / 1.27;
superbruttoBeszar = document.getElementById("beszar[" + id + "]").value * 1.2;
document.getElementById("margin[" + id + "]").value = (Math.round((nettoFogyar - superbruttoBeszar) / nettoFogyar * 10000))/100;
}
function calc_cogs (id) {
nettoFogyar = document.getElementById("fogyar[" + id + "]").value / 1.27;
document.getElementById("cogs[" + id + "]").value = (Math.round(document.getElementById("beszar[" + id + "]").value / nettoFogyar * 10000))/100;
}
function calcAllLengths () {
idArray = document.getElementsByName("newItemRowId[]");
for (id in idArray) {
rowId = idArray[id].value;
calc_length("shortname[" + rowId + "]", "shortnamecount[" + rowId + "]");
calc_length("longname[" + rowId + "]", "longnamecount[" + rowId + "]");
}
}
function setHelpVis (helpRowName) {
if (document.getElementsByName(helpRowName)) {
arrrr = document.getElementsByName(helpRowName);
for (x in arrrr) {
if (x != "length" && x != "item") {
if (arrrr[x].style.display == "none") {
arrrr[x].style.display = "inline";
}else{
arrrr[x].style.display = "none";
}
}
}
}
}
function copyContent (rowId, value, targetField) {
if (targetField != "all") {
document.getElementById(targetField + "[" + rowId + "]").value = value;
if (targetField == "shortname" || targetField == "longname") {
calc_length(targetField + "[" + rowId + "]", targetField + "count[" + rowId + "]");
}
if (targetField == "fogyar") {
calc_margin(rowId);
calc_cogs(rowId);
}
}else{
document.getElementById("groupname[" + rowId + "]").value = value;
document.getElementById("shortname[" + rowId + "]").value = value;
document.getElementById("longname[" + rowId + "]").value = value;
document.getElementById("fogyar[" + rowId + "]").value = value;
calc_length("shortname[" + rowId + "]", "shortname" + "count[" + rowId + "]");
calc_length("logname[" + rowId + "]", "logname" + "count[" + rowId + "]");
calc_margin(rowId);
calc_cogs(rowId);
}
}
function copyLongName(rowId) {
if (document.getElementById("shortname[" + rowId + "]").value == "" ) {
document.getElementById("shortname[" + rowId + "]").value = document.getElementById("longname[" + rowId + "]").value.substr(0,23);
calc_length("shortname[" + rowId + "]", "shortname" + "count[" + rowId + "]");
}
}
function checkSubmit () {
alert(document.getElementById("submitState").value);
if (document.getElementById("submitState").value == "true") {
return true;
}else{
return false;
}
}
function setSubmit (state) {
document.getElementById("submitState").value = state;
document.getElementById("dataform").submit();
return true;
}
</script>
</head>
<body onLoad="calcAllLengths();">
<form onSubmit="return checkSubmit();" method="POST" action="download.php" id="dataform">
<table border="1">
<tr >
<td style="background: #aaaaaa" colspan="13"><div style="text-align:left;position: inline;float: left;">ÚJ CIKKEK</div><div style="text-align:right; position: inline;float: right">EUR rate: {eurrate} €</div></td>
</tr>
{newitemrows}
</table>
<input type="hidden" id="submitState" value="false">
<input type="button" value="Elküld" onClick="return setSubmit('true');" />
</form>
<table border="1">
<tr >
<td style="background: #aaaaaa" colspan="11">RÉGI CIKKEK</td>
</tr>
{olditemrows}
</table>
<a href="upload.php">upload</a>
<a href="logout.php">logout</a>
</body>
</html>