-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.html
141 lines (131 loc) · 5.73 KB
/
index.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
133
134
135
136
137
138
139
140
141
<!doctype html>
<html>
<head>
<meta charset="utf_8">
<title>Generate Receipt</title>
<script src="http://ajax.googleapis.com/ajax/libs/jquery/1.7/jquery.js"></script>
<script src="http://malsup.github.com/jquery.form.js"></script>
<script type="text/javascript" src="src/money_math.js"></script>
<script type="text/javascript" src="src/item.js"></script>
<script type="text/javascript" src="src/imported_item.js"></script>
<script type="text/javascript" src="src/receipt.js"></script>
<script>
$(document).ready(function () {
$('#receipt').submit(function () {
var receipt = Receipt();
for (i=0; i<5; i++)
{
if ($("#item_type" + i).val() != '[choose yours]' && $("#price" + i).length > 0){
var price = parseFloat($("#price" + i).val());
var item_type = $("#item_type" + i).val();
var is_imported = $('#imported' + i).is(':checked');
if (is_imported){
receipt.add_imported_item(item_type, price);
}
else {
receipt.add_item(item_type, price);
}
}
}
receipt.print();
return false;
});
});
</script>
</head>
<body>
<form method="get" id="receipt">
<div class="receipt_item">
<div class="item_description">
<label for="item_type1">Item:</label>
<select id="item_type1" name="item_type1">
<option selected="selected">[choose yours]</option>
<option>book</option>
<option>music CD</option>
<option>chocolate bar</option>
<option>box of chocolates</option>
<option>bottle of perfume</option>
<option>packet of headache pills</option>
</select>
</div>
<div class="item_imported">
<label for="imported1">Imported?</label>
<input type="checkbox" id="imported1" name="imported1"/>
</div>
<div class="item_price">
<label for="price1">Shelf price:</label>
<input type="text" id="price1" name="price1"/>
</div>
<br/>
<div class="receipt_item">
<div class="item_description">
<label for="item_type2">Item:</label>
<select id="item_type2" name="item_type2">
<option selected="selected">[choose yours]</option>
<option>book</option>
<option>music CD</option>
<option>chocolate bar</option>
<option>box of chocolates</option>
<option>bottle of perfume</option>
<option>packet of headache pills</option>
</select>
</div>
<div class="item_imported">
<label for="imported2">Imported?</label>
<input type="checkbox" id="imported2" name="imported2"/>
</div>
<div class="item_price">
<label for="price2">Shelf price:</label>
<input type="text" id="price2" name="price2"/>
</div>
<br/>
<div class="receipt_item">
<div class="item_description">
<label for="item_type3">Item:</label>
<select id="item_type3" name="item_type3">
<option selected="selected">[choose yours]</option>
<option>book</option>
<option>music CD</option>
<option>chocolate bar</option>
<option>box of chocolates</option>
<option>bottle of perfume</option>
<option>packet of headache pills</option>
</select>
</div>
<div class="item_imported">
<label for="imported3">Imported?</label>
<input type="checkbox" id="imported3" name="imported3"/>
</div>
<div class="item_price">
<label for="price3">Shelf price:</label>
<input type="text" id="price3" name="price3"/>
</div>
<br/>
<div class="receipt_item">
<div class="item_description">
<label for="item_type4">Item:</label>
<select id="item_type4" name="item_type4">
<option selected="selected">[choose yours]</option>
<option>book</option>
<option>music CD</option>
<option>chocolate bar</option>
<option>box of chocolates</option>
<option>bottle of perfume</option>
<option>packet of headache pills</option>
</select>
</div>
<div class="item_imported">
<label for="imported4">Imported?</label>
<input type="checkbox" id="imported4" name="imported4"/>
</div>
<div class="item_price">
<label for="price4">Shelf price:</label>
<input type="text" id="price4" name="price4"/>
</div>
<br/>
<input type="submit" class="submit_button" value="Generate Receipt"/>
</div>
<div id="generated-receipt"></div>
</form>
</body>
</html>