-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsortiment.spl
executable file
·631 lines (578 loc) · 17.5 KB
/
sortiment.spl
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
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
#!/usr/bin/env splrun
load "file";
load "system";
var data;
var order;
var order_parts;
var order_provider;
var index;
var link_rules;
var mwst_rules;
function help()
{
debug "Usage: splrun sortiment.spl { wikitext | labelcsv | orderwiki | kastenwiki | folder | invsum }";
exit;
}
if (not declared argc or argc != 1)
help();
/* input file parser (sortiment) */
{
var current_cat;
var current_item;
var current_extra;
var last_ent;
var idx_lieferant;
var idx_ekprice;
var idx_ekpstk;
var idx_vpe;
foreach[] line (file_read("sortiment.txt") =~ /\n+/Sg)
{
if (line =~ /^\s*$/ or line =~ /^\//)
continue;
if (line =~ /^\*\s*(.*\S)/) {
foreach[] t ($1 =~ /\s*\|\|\s*/Sg)
push data[current_cat].base_titles, t;
last_ent = "*";
continue;
}
if (line =~ /^\.*\s*\|\|\s*(.*\S)/ and last_ent ~== "*") {
var list_txt = "$1 || EKP/Stk";
foreach[] t (list_txt =~ /\s*\|\|\s*/Sg) {
push data[current_cat].extra_titles, t;
if (t ~== "Lieferant")
idx_lieferant = prev data[current_cat].extra_titles, undef;
if (t ~== "EK-Preis")
idx_ekprice = prev data[current_cat].extra_titles, undef;
if (t ~== "EKP/Stk")
idx_ekpstk = prev data[current_cat].extra_titles, undef;
if (t ~== "VPE")
idx_vpe = prev data[current_cat].extra_titles, undef;
}
last_ent = undef;
continue;
}
if (line =~ /^\+\s*(.*\S)/) {
current_item++;
current_extra = -1;
data[current_cat].items[current_item] = [ base: undef, extra: undef, links: undef ];
foreach[] t ($1 =~ /\s*\|\|\s*/Sg) {
if ($[ and declared index[t])
panic "Duplicate Index: $t";
if ($[)
index[t] = data[current_cat].items[current_item];
push data[current_cat].items[current_item].base, t;
}
last_ent = "+";
continue;
}
if (line =~ /^\.*\s*\|\|\s*(.*\S)/ and last_ent ~== "+") {
current_extra++;
data[current_cat].items[current_item].extra[current_extra] = undef;
var curr_e_ptr = data[current_cat].items[current_item].extra[current_extra];
foreach[] t ($1 =~ /\s*\|\|\s*/Sg)
push curr_e_ptr, t;
if (declared mwst_rules[curr_e_ptr[idx_lieferant]]) {
curr_e_ptr[idx_ekprice] =~ e/([0-9,]+)/ ({ var price = $1 =~ s/,/./Rg;
price += price .* mwst_rules[curr_e_ptr[idx_lieferant]] ./ 100;
return fmt("%.03f", price) =~ s/\./,/Rg; });
}
if (declared curr_e_ptr[idx_vpe] and declared curr_e_ptr[idx_ekprice]) {
var ekprice = curr_e_ptr[idx_ekprice];
ekprice =~ s/,/./g; ekprice =~ s/ EUR//;
var vpe = curr_e_ptr[idx_vpe];
vpe =~ s/.*x//;
var ekpstk = ekprice ./ vpe;
curr_e_ptr[idx_ekpstk] = fmt("%.03f EUR", ekpstk) =~ s/\./,/Rg;
}
continue;
}
last_ent = undef;
if (line =~ /^!\s*(.*\S)/) {
current_cat = $1;
current_item = -1;
if (declared data[current_cat])
panic "cat dup in line ${$#+1}: $current_cat";
data[current_cat] = [
description: undef,
base_titles: undef,
extra_titles: undef,
has_links: 0,
variables: undef,
items: undef
];
continue;
}
if (line =~ /^\?\s*(.*)/) {
data[current_cat].description ~= "$1\n";
continue;
}
if (line =~ /^:\s*(\S+)\s+(\S+.*)/) {
push data[current_cat].items[current_item].links, [ "http://svn.clifford.at/metaparts/trunk/datasheets/DS_${system("echo '$1' | md5sum | cut -f1 -d' '")}.html", $2 ];
data[current_cat].has_links = 1;
continue;
}
if (line =~ /^:\s*(\S+)/) {
push data[current_cat].items[current_item].links, [ "http://svn.clifford.at/metaparts/trunk/datasheets/DS_${system("echo '$1' | md5sum | cut -f1 -d' '")}.html", "Datasheet" ];
data[current_cat].has_links = 1;
continue;
}
if (line =~ /^\=(\S+):\s*(.*)/) {
data[current_cat].variables[$1] = $2;
continue;
}
if (line =~ /^@linkrule@\s*(.*?)\s*\|\|\s*(.*\S)/) {
push link_rules, [ cond: $1, url: $2 ];
continue;
}
if (line =~ /^@mwstrule@\s*(.*?)\s*\|\|\s*(\d+)%/) {
mwst_rules[$1] = $2;
continue;
}
panic "syntax error in line ${$#+1}: $line";
}
}
/* input file parser (order) */
{
var provider;
foreach[] line (file_read("order.txt") =~ /\n+/Sg)
{
if (line =~ /^\s*$/ or line =~ /^\//)
continue;
if (line =~ /^==(.*)==$/) {
provider = $1;
order_provider[provider] = 1;
continue;
}
if (line =~ /^(\d+)x(\d+)\s+(.*\S)/) {
var num = $1, vpe = $2;
foreach[] part ($3 =~ /\s+/Sg) {
push order, [ provider: provider, num: num, vpe: vpe, part: part ];
order_parts[part][provider][vpe] = num;
}
continue;
}
panic "syntax error in line ${$#+1}: $line";
}
}
if (argv[0] ~== "wikitext")
{
write(<:>
: ==Bauteile==
: <!-- Auto-generated by sortiment.spl - do not manually change this section! -->
</>);
foreach[] c (data)
{
var links_header = c.has_links ? "! Links !" : "";
write(<:>
:
: ===$#===
: <!-- Auto-generated by sortiment.spl - do not manually change this section! -->
: ${c.description}
: {|border="1" cellpadding="5" cellspacing="0" style="text-align:right; width:100%;"
: <spl:foreach var="[]t" list="c.base_titles">! $t !</spl:foreach>$links_header$[
]<spl:foreach var="[]t" list="c.extra_titles">! $t<spl:if code="not $]"> !</spl:if></spl:foreach>
</>);
var dark_mode = 0;
var order_lines = 0;
var last_order_sig;
var lines;
foreach[] i (c.items)
foreach[] e (i.extra)
{
var this_line_data;
foreach idx (c.base_titles) {
this_line_data[c.base_titles[idx]] = i.base[idx];
}
foreach idx (c.extra_titles) {
this_line_data[c.extra_titles[idx]] = e[idx];
}
function get_field_text(name) {
var value = this_line_data[name];
foreach[] r (link_rules) {
if (name ~== "Bestell-Nr." and this_line_data["Lieferant"] ~== r.cond) {
var url = (r.url =~ e/\{(\S+)\}/R this_line_data[$1]) =~ s/ /+/Rg;
value = "[$url $value]";
}
}
return value;
}
var links_text = "";
foreach[] l (i.links) {
links_text ~= "[${l[0]} ${l[1]}]";
if (!$])
links_text ~= ", ";
}
if (c.has_links)
links_text = "| $links_text |";
var common_part = <:>
: <spl:foreach var="[]v" list="c.base_titles">| ${get_field_text(v)} |</spl:foreach>$links_text$[
]</>;
if ($# > 0)
common_part =~ s/[^ |]/ /g;
else
dark_mode = !dark_mode;
var extra_color = "#888";
var this_line_vpe = this_line_data["VPE"];
var this_line_min = 1;
if (this_line_vpe =~ /([0-9]+)x([0-9]+)/ ) {
this_line_min = $1;
this_line_vpe = $2;
}
var order_sig = "${this_line_data["Fach"]}|${this_line_data["Lieferant"]}|${this_line_data["Bestell-Nr."]}";
if (declared order_parts[this_line_data["Fach"]] and
declared order_parts[this_line_data["Fach"]][this_line_data["Lieferant"]] and
declared order_parts[this_line_data["Fach"]][this_line_data["Lieferant"]][this_line_vpe] and
order_parts[this_line_data["Fach"]][this_line_data["Lieferant"]][this_line_vpe] >= this_line_min) {
if (last_order_sig ~== order_sig)
lines[prev lines, undef] =~ s/color:#E45712/color:#888/g;
extra_color = "#E45712";
order_lines = 1;
}
last_order_sig = order_sig;
push lines, <:>
: |- ${dark_mode ? 'style="background:#ccc;"' : ''}
: ${common_part}<spl:foreach var="[]v" list="c.extra_titles">|style="color:$extra_color"| ${get_field_text(v)}<spl:if code="not $]">${" "}|</spl:if></spl:foreach>
</>;
}
write(<:>
<spl:foreach var="[]l" list="lines">$l</spl:foreach>
: |}
<spl:if code="order_lines">
: <div align="right"><small>Orangene Eintraege sind zur Nachbestellung vorgemerkt.</small></div>
</spl:if>
</>);
}
exit;
}
if (argv[0] ~== "labelcsv")
{
write("fach;title;extra;price\n");
foreach[] c (data)
foreach[] i (c.items)
{
var fach = i.base[0];
var title = (c.variables["title"] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
var extra = (c.variables["extra"] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
var price = (c.variables["price"] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
write("$fach;$title;$extra;$price\n");
}
exit;
}
if (argv[0] ~== "orderwiki")
{
var wikitext;
var bigtotal = 0.0;
var order_ok;
foreach p (order_provider)
{
var ordercode;
var linecount = 1;
var total = 0.0;
wikitext ~= <:>
:
: ===${p ~== "???" ? "Bestellung Ohne Zugewiesenem Lieferanten" : p}===
: <!-- Auto-generated by sortiment.spl - do not manually change this section! -->
: {|border="1" cellpadding="5" cellspacing="0" style="text-align:right;width:100%;"
: ! Fach !! Beschreibung !! Anzahl <spl:if code="p ~!= '???'">!! VPE !! Bestell-Nr. !! Einzel-Preis !! Preis</spl:if>
</>;
if (p ~== "Elecrow" or p ~== "Robotshop" or p ~== "CSD" or p ~== "DigiKey" or p ~== "SmartPrj" or p ~== "Ribu" or p ~== "Watterott" or p ~== "Futurlec" or p ~== "Conrad")
ordercode ~= <:>
: ${fmt("%5s %5s %5s %8s %40s %s",
"Num", "VPE", "Total", "Price", "Best-Nr.", "Beschreibung")}
: ${fmt("%5s %5s %5s %8s %40s %s",
"---", "---", "-----", "-----", "--------", "------------")}
</>;
foreach[] c (data)
foreach[] i (c.items)
foreach[] e (i.extra)
{
var part = i.base[0];
var provider, vpe, partid, price;
var title = (c.variables["title"] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
foreach[] t (c.extra_titles) {
if (t ~== "Lieferant")
provider = e[$#];
if (t ~== "VPE")
vpe = e[$#];
if (t ~== "Bestell-Nr.")
partid = e[$#];
if (t ~== "EK-Preis")
price = e[$#];
}
price =~ s/,/./g;
price =~ s/\s+EUR//g;
if (p ~!= provider and p ~!= "???")
continue;
foreach[] o (order) {
if (o.part ~!= part)
continue;
if (p ~!= "???") {
if (o.provider ~!= provider)
continue;
if (o.vpe ~!= vpe and !(vpe =~ /([0-9]+)x([0-9]+)/ && o.num >= $1 && o.vpe ~== $2))
continue;
}
order_ok[$#] = [
o: o,
provider: p,
title: title,
partid: partid,
price: p ~!= "???" ? price : 0
];
}
}
foreach[] x (order_ok)
{
if (x.provider ~!= p)
continue;
var o = x.o;
wikitext ~= <:>
: |- ${linecount % 2 ? 'style="background:#ccc;"' : ''}
: | $o.part
: | $x.title
<spl:if code="p ~!= '???'">
: | $o.num
: | $o.vpe
: | $x.partid
: | ${x.price =~ s/\./,/R} EUR
: | ${fmt("%.02f", x.price*o.num) =~ s/\./,/R} EUR
</spl:if><spl:else>
: | ${o.num * o.vpe}
</spl:else>
</>;
if (p ~== "RS")
ordercode ~= <:>
: $x.partid,$o.num
</>;
else if (p ~== "Reichelt")
ordercode ~= <:>
: $x.partid;$o.num
</>;
else if (p ~== "Elecrow" or p ~== "Robotshop" or p ~== "CSD" or p ~== "DigiKey" or p ~== "SmartPrj" or p ~== "Ribu" or p ~== "Watterott" or p ~== "Futurlec" or p ~== "Conrad")
ordercode ~= <:>
: ${fmt("%5d %5d %5d %8.2f %40s %s",
o.num, o.vpe, o.num*o.vpe,
x.price*o.num, x.partid, x.title)}
</>;
else if (p ~== "???")
/* do nothing */;
else
panic "Can not generate ordercode for supplier '$p'.";
total += x.price*o.num;
bigtotal += x.price*o.num;
linecount++;
}
wikitext ~= <:>
<spl:if code="p ~!= '???'">
: |- ${linecount % 2 ? 'style="background:#ccc;"' : ''}
: |colspan="6"|Total
: | ${fmt("%.02f", total) =~ s/\./,/R} EUR
</spl:if>
: |}
<spl:if code="defined ordercode">
:
: Code zum Bestellen ueber die Lieferantenhomepage:
: $ordercode</spl:if>$[
]</>;
var not_ok_list;
foreach[] o (order) {
if (o.provider ~!= p)
continue;
if (declared order_ok[$#])
continue;
not_ok_list ~= <:>
: ${o.num}x${o.vpe} ${o.part}
</>;
}
if (defined not_ok_list) {
wikitext ~= <:>
:
: Unable to handle the following parts:
: ==${p}==
: $not_ok_list$[
]</>;
}
}
write(<:>
: ==Naechste Bestellung==
: <!-- Auto-generated by sortiment.spl - do not manually change this section! -->
:
: Dieser Abschnitt beinhaltet den derzeitigen Stand der naechsten geplanten Bestellung.
:
: Kontakt fuer Bestellabwicklung (z.Bsp. bei dringendem Bedarf an nachgekauften Bauteilen):
: [[User:amir|amir]]
:
: ACHTUNG: Die tatsaechlichen Preise koennen abweichen, da Mengenrabatte nicht beruecksichtigt
: werden und die Preise beim Lieferanten sich inzwischen veraendert haben koennen.
:
: Gesamtbestellwert: ${fmt("%.02f", bigtotal) =~ s/\./,/R} EUR
: $wikitext
</>);
exit;
}
if (argv[0] ~== "kastenwiki")
{
var fach_text;
foreach[] c (data)
foreach[] i (c.items)
{
var fach = i.base[0] =~ s/\..*//R;
var title = (c.variables["title"] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
var extra = (c.variables["extra"] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
var price = (c.variables["price"] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
fach_text[fach] = <:>
: <b>$title</b><br/>$extra<br/>
: <div style="float:left">$fach</div>
: <div style="float:right">$price</div>
</>;
}
function fach(id)
{
return defined fach_text[id] ? fach_text[id] : id;
}
write(<:>
: == Kastenplan ==
: <!-- Auto-generated by sortiment.spl - do not manually change this section! -->
<spl:var var="table_style">border-color:blue; border-style:solid; border-width:2px; font-size:70%; width:100%;</spl:var>
<spl:var var="td_style">border-color:blue; border-style:solid; border-width:5px; height:10em; padding-left:1em; padding-right:1em; text-align:center;</spl:var>
<?spl foreach[] kasten ([1, 2, 3, 4, 5, 6]) { ?>
:
: ===Kasten $kasten===
: <!-- Auto-generated by sortiment.spl - do not manually change this section! -->
: {| style="$table_style"
<?spl foreach[] row ((kasten >= 3 ? kasten >= 5 ? "1234567" : "ABCDEFGHIJKL" : "MNOPQRS") =~ /./Ag) { ?>
: |-
<?spl for (var column=0; column<5; column++) { ?>
: |style="$td_style width:20%;" colspan="2"|${fach('$row${kasten % 2 == 1 ? column : column+5}')}
<?spl } ?>
<?spl } ?>
<?spl if (kasten <= 2 || kasten >= 5) { ?>
: |-
: |style="$td_style width:50%;" colspan="5"|${fach('${kasten >= 5 ? '8' : 'T'}${kasten % 2 == 1 ? 1 : 6}')}
: |style="$td_style width:50%;" colspan="5"|${fach('${kasten >= 5 ? '8' : 'T'}${kasten % 2 == 1 ? 3 : 8}')}
: |-
: |style="$td_style" colspan="10"|${fach('${kasten >= 5 ? '9' : 'U'}${kasten % 2 == 1 ? 2 : 7}')}
<?spl } ?>
: |}
<?spl } ?>
<?spl foreach[] kasten ([7, 8]) { ?>
:
: ===Kasten $kasten===
: <!-- Auto-generated by sortiment.spl - do not manually change this section! -->
: {| style="$table_style"
<?spl foreach[] row (("XYZ") =~ /./Ag) { ?>
: |-
<?spl for (var column=0; column<3; column++) { ?>
: |style="$td_style width:30%;" colspan="2"|${fach('$row${kasten % 2 == 1 ? column : column+3}')}
<?spl } ?>
<?spl } ?>
: |}
<?spl } ?>
<?spl foreach[] kasten ([9, 10]) { ?>
:
: ===Kasten $kasten===
: <!-- Auto-generated by sortiment.spl - do not manually change this section! -->
: {| style="$table_style"
<?spl foreach[] row (("XYZ") =~ /./Ag) { ?>
: |-
<?spl for (var column=0; column<3; column++) { ?>
: |style="$td_style width:30%;" colspan="2"|${fach('$row${kasten % 2 == 1 ? column+6 : column+9}')}
<?spl } ?>
<?spl } ?>
: |}
<?spl } ?>
</>);
exit;
}
if (argv[0] ~== "folder")
{
var texsrc = "";
function encode_tex(t) {
t =~ s/\\/\\textbackslash{}/g;
t =~ s/~/\\textasciitilde{}/g;
t =~ s/\^/\\textasciicircum{}/g;
t =~ s/(?<!textbackslash|textbackslash\{|$[
]textasciicircum|textasciicircum\{|$[
]textasciitilde|textasciitilde\{$[
])[_&$#{}\^%]/\\$0/g;
t =~ s/([<>]|--+)/\$$1\$/g;
return t;
}
foreach[] c (data)
{
if ($# ~== "Widerstaende (Axiale Bauform)")
continue;
if ($# ~== "Widerstaende (Axial, Niederohm)")
continue;
texsrc ~= <:>
: \section{$#}
: \begin{tabular}{<spl:foreach var="[]t" list="c.base_titles">|r</spl:foreach>|}
: \hline
: <spl:foreach var="[]t" list="c.base_titles"><spl:if code="not $[">${" & "}</spl:if>${tex::t}</spl:foreach> \\
: \hline
</>;
var lines;
foreach[] i (c.items)
{
var this_line_data;
foreach idx (c.base_titles) {
this_line_data[c.base_titles[idx]] = i.base[idx];
}
texsrc ~= <:>
: <spl:foreach var="[]v" list="i.base"><spl:if code="not $[">${" & "}</spl:if>${tex::v}</spl:foreach> \\
: \hline
</>;
}
texsrc ~= <:>
: \end{tabular}
</>;
}
write(<:>
: \documentclass[a4paper]{article}
: \begin{document}
: \title{Bauteilsortiment}
: \author{Kontakt: Clifford Wolf, [email protected]\\
: http://metalab.at/wiki/Bauteilsortiment}
: \maketitle
: \section{Einfuehrung}
: \begin{itemize}
: \item Preis laut Etiketten bzw. dieser Liste in die Kasse
: einwerfen.
: \item Entnommene Bauteile nicht wieder zuruecklegen.
: \item Nicht eingenmaechtig einsortieren.
: \item Geld wechseln bei der Kasse in der Kueche.
: \item Spenden helfen dem Bauteilsortiment beim expandieren.
: \end{itemize}
$texsrc
: \end{document}
</>);
exit;
}
if (argv[0] ~== "invsum")
{
var inv_hash;
var total_sum = 0;
var partcount = 0;
foreach[] line (file_read("inventur.txt") =~ /\n+/Sg)
{
if (line =~ /^(\S+).*\s([0-9]+)\s*$/)
inv_hash[$1] = +$2;
}
foreach[] c (data)
foreach[] i (c.items)
{
var fach = i.base[0];
var title = (c.variables["title"] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
var pricevar = declared c.variables["xprice"] ? "xprice" : "price";
var price = (c.variables[pricevar] =~ e/\[(\d+)\]/Rg i.base[$1]) =~ s/ +/ /Rg;
price =~ s/ EUR//; price =~ s/,/./;
var num = declared inv_hash[fach] ? inv_hash[fach] : "-";
var total = declared inv_hash[fach] ? price*num : "-";
write("$fach\t$total\t$num\t$price\t$title\n");
total_sum += total;
partcount += num;
}
write("****\t$total_sum\t$partcount\n");
exit;
}
help();