-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.html
executable file
·338 lines (290 loc) · 7.86 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
<!DOCTYPE html>
<html>
<head>
<style>
body {
width: 100%;
height: 100%;
margin: 0;
padding: 0;
background-color: #FAFAFA;
font: 12pt "Tahoma";
}
* {
box-sizing: border-box;
-moz-box-sizing: border-box;
}
.page {
width: 210mm;
min-height: 297mm;
/*padding: 20mm;*/
margin: 10mm auto;
border: 1px #D3D3D3 solid;
border-radius: 5px;
background: white;
box-shadow: 0 0 5px rgba(0, 0, 0, 0.1);
position: relative;
}
.subpage {
/*padding: 1cm;*/
/*border: 5px red solid;*/
/*height: 257mm;*/
/*outline: 2cm #FFEAEA solid;*/
}
.form div{
margin-top: 15px;
}
.important{
color: #ff0000;
font-weight: 800;
}
/*
<-- element style start -->
*/
@font-face {
font-family: "CenturyGothic";
src: url("century-gothic.ttf");
}
@font-face {
font-family: "AvenirNext";
src: url("avenir-next-regular.ttf");
}
.page .element{
position: absolute;
}
.title-name{
font-size: 17.82mm;
color: #000;
font-family: "CenturyGothic";
top: 21.87mm;
left: 18mm;
}
.subtitle{
color: #4d4d4d;
font-size: 4.23mm;
font-family: "AvenirNext";
top: 46.21mm;
left: 18.35mm;
}
.date-text{
color: #E1600F;
font-size: 4.23mm;
font-family: "AvenirNext";
top: 46.21mm;
left: 60.35mm;
}
.header-row {
color: #999;
font-size: 4.23mm;
font-family: "CenturyGothic";
}
.header-row.row-item-header{
top: 94.88mm;
left: 88.24mm;
}
.header-row.row-qty-header{
top: 94.88mm;
left: 157.05mm;
}
.header-row.row-total-header{
top: 94.88mm;
left: 176.47mm;
}
.header-line{
outline: 0.35mm #999 solid;
width: 98.12mm;
top: 101.94mm;
left: 89.64mm;
}
.invoice-item{
font-family: "CenturyGothic";
top: 105.82mm;
left: 87.88mm;
}
.invoice-item-name{
color: #4d4d4d;
font-size: 4.94mm;
width: 51.18mm;
}
.invoice-qty{
color: #4d4d4d;
font-size: 4.94mm;
left: 71.29mm;
text-align: right;
}
.invoice-price{
color: #4d4d4d;
font-size: 4.94mm;
left: 87.35mm;
text-align: right;
}
.invoice-price-total{
color: #999;
font-size: 5.64mm;
text-align: right;
top: 20.46mm;
left: 86.65mm;
}
.footer-line{
outline: 1mm #000 solid;
/*height: 1.41mm;*/
height: 0;
width: 167.12mm;
/*background-color: #000;*/
top: 257.14mm;
left: 19.59mm;
}
.company-address{
color: #4D4D4D;
font-size: 2.82mm;
font-family: "CenturyGothic";
top: 263.49mm;
left: 19.41mm;
}
.company-address b{
font-size: 3.5mm;
}
.invoice-address{
color: #4D4D4D;
font-size: 2.82mm;
font-family: "CenturyGothic";
top: 263.49mm;
left: 63.88mm;
}
.invoice-address b{
color: #000;
font-size: 3.5mm;
}
.thankyou{
color: #E1600F;
font-size: 3.5mm;
font-family: "CenturyGothic";
top: 263.49mm;
left: 112.59mm;
}
input[type="button"]{
background-color: #0f0;
}
/*
<-- element style end -->
*/
@page {
size: A4;
margin: 0;
}
@media print {
html, body {
width: 210mm;
height: 297mm;
}
.page {
margin: 0;
border: initial;
border-radius: initial;
width: initial;
min-height: initial;
box-shadow: initial;
background: initial;
page-break-after: always;
}
.form{
display: none;
}
}
</style>
</head>
<body>
<div class="form">
<div>
Purchase date: <input type="text" id="dateText" value="Nov 14, 2017" />
</div>
<div>
Item name: <br/>
<textarea cols="80" rows="5" id="itemText">Subscription to Magic Mirror 3 Pro Year ($23.99/month)</textarea>
</div>
<div>
Qty: <input type="text" id="qtyText" value="1" />
</div>
<div>
Single price (add if any discounted amount on newline): <br/>
<textarea cols="80" rows="2" id="priceText">23.99$
-11.99$
</textarea>
</div>
<div>
Total: <input type="text" id="totalText" value="12.00$" />
</div>
<div>
Address 1: (or company name) <br>
<textarea id="address1Text" cols="80" rows="5">Address line 1</textarea>
</div>
<div>
Address 2: <br>
<textarea id="address2Text" cols="80" rows="5">Address line 2
address line 3
address line 4</textarea>
</div>
<div>
<input type="button" value="Update and print" id="printButton" /> * Print as pdf to save<br>
Select A4 size, no margin, no header/footer in options.
</div>
<div class="important">
** Important!!! After generating invoice, remember upload a copy of it to Magic Sketch Google drive:<br>
Shared with me (MagicSketch) > sales > invoices-magicmirror3.<br>
Filename format: {date}-{customer name}.pdf as shown below:<br>
<img src="ggdrive.png" />
</div>
<hr>
</div>
<div class="book">
<div class="page">
<div class="title-name element">magic mirror</div>
<div class="subtitle element">plugin for Sketch 3</div>
<div class="date-text element">Sep 12, 2016</div>
<div class="row-item-header header-row element">Item</div>
<div class="row-qty-header header-row element">Qty</div>
<div class="row-total-header header-row element">Total</div>
<div class="header-line element"></div>
<div class="invoice-item element">
<div class="invoice-item-name element">Magic Mirror Pro Version</div>
<div class="invoice-qty element">1</div>
<div class="invoice-price element">12.0$</div>
<div class="invoice-price-total element">12.0$</div>
</div>
<div class="footer-line element"></div>
<div class="company-address element"><b>MagicSketch Limited</b><br/>
Room C, 2/F.,<br/>
Capital Trade Centre,<br/>
62 Tsun Yip Street,<br/>
Kwun Tong,<br/>
Hong Kong SAR
</div>
<div class="invoice-address element"><b>Adress line 1</b><br/>
Adress line 2<br>Adress line 1<br>Adress line 1
</div>
<div class="thankyou element">Thank you.</div>
</div>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/2.2.2/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#printButton').click(function(e){
var dateText = $("#dateText").val();
var itemText = $("#itemText").val();
var qtyText = $("#qtyText").val();
var priceText = $("#priceText").val();
var totalText = $("#totalText").val();
var address1Text = $("#address1Text").val();
var address2Text = $("#address2Text").val();
$('.date-text').html(dateText);
$('.invoice-item-name').html(itemText);
$('.invoice-qty').html(qtyText);
$('.invoice-price').html(priceText.replace(/\n/g, "<br>"));
$('.invoice-price-total').html(totalText);
$('.invoice-address').html("<b>" + address1Text.replace(/\n/g, "<br>") + "</b><br>").append(address2Text.replace(/\n/g, "<br>"));
window.print();
});
});
</script>
</div>
</body>
</html>