From cc80e720c725af6c18909e73ba8401cb2753383e Mon Sep 17 00:00:00 2001 From: "kilian (ksmachome)" Date: Thu, 21 Nov 2019 14:09:40 +0100 Subject: [PATCH] v20191121 --- CGI/index.cgi | 104 +----- .../app/coloradio/module/allaudio/index.js | 1 + .../module/invoicejournal/index.js | 306 +++++++++------ .../module/invoicejournal/index.tt | 67 ++-- .../module/invoicejournal/print/invoice.js | 0 .../module/invoicejournal/print/invoice.tt | 20 + .../module/invoicejournal/print/invoice2.js | 17 + .../module/invoicejournal/print/invoice2.tt | 0 CGI/tmpl/skeleton/module.tt | 4 +- CGI/tmpl/skeleton/print.tt | 43 +++ bin/playlist_creator/clr_exportplaylist.pl | 75 ++++ bin/playlist_creator/clr_generateplaylist.pl | 220 +++++++++++ bin/playlist_creator/clr_mixandpack.pl | 39 ++ bin/playlist_creator/clr_playlists.pl | 197 +++++----- htdocs/vendor/jspdf/jspdf.plugin.autotable.js | 117 +++--- .../jspdf/jspdf.plugin.autotable.min.js | 6 +- htdocs/vendor/normalize/normalize.css | 349 ++++++++++++++++++ htdocs/vendor/print/paper.css | 131 +++++++ htdocs/vendor/print/paper.min.css | 1 + 19 files changed, 1311 insertions(+), 386 deletions(-) create mode 100644 CGI/tmpl/app/invoicejournal/module/invoicejournal/print/invoice.js create mode 100644 CGI/tmpl/app/invoicejournal/module/invoicejournal/print/invoice.tt create mode 100644 CGI/tmpl/app/invoicejournal/module/invoicejournal/print/invoice2.js create mode 100644 CGI/tmpl/app/invoicejournal/module/invoicejournal/print/invoice2.tt create mode 100644 CGI/tmpl/skeleton/print.tt create mode 100644 bin/playlist_creator/clr_exportplaylist.pl create mode 100644 bin/playlist_creator/clr_generateplaylist.pl create mode 100644 bin/playlist_creator/clr_mixandpack.pl mode change 100644 => 100755 htdocs/vendor/jspdf/jspdf.plugin.autotable.js mode change 100644 => 100755 htdocs/vendor/jspdf/jspdf.plugin.autotable.min.js create mode 100644 htdocs/vendor/normalize/normalize.css create mode 100755 htdocs/vendor/print/paper.css create mode 100755 htdocs/vendor/print/paper.min.css diff --git a/CGI/index.cgi b/CGI/index.cgi index b1a8baf..ff00aa5 100644 --- a/CGI/index.cgi +++ b/CGI/index.cgi @@ -45,10 +45,6 @@ if ($vars->{filepath} ne ""){ $vars->{page} =~ s/html$/tt/; } - -# my $sess = (); -# my $se = session->new(); -# $p->{sid} = $cgi->cookie($vars->{cookiename}); if ($cgi->request_method() eq "GET"){ my @params = $cgi->param(); foreach my $pp (@params){ @@ -57,103 +53,17 @@ if ($cgi->request_method() eq "GET"){ } -# if ($cgi->request_method() eq "POST"){ - -# my @params = $cgi->param(); -# foreach my $pp (@params){ -# $p->{$pp} = $cgi->param($pp); -# } -# # $vars->{hasposts} = $p; -# # if (exists($p->{'btnlogin'})){ -# # my $ret = $se->checklogin($p->{login},$p->{password}); -# # if ($ret->{sid} ne ""){ -# # $p->{sid} = $ret->{sid}; -# # $cookie = CGI::Cookie->new(-name=>$vars->{cookiename},-value=>$p->{sid},-httponly => 1); -# # }else { -# # $vars->{message} = $ret->{message}; -# # $vars->{messagetype} = $ret->{messagetype}; -# # $vars->{page} = "message.tt"; -# # } -# # } -# # if (exists($p->{'btnregister'})){ - -# # my $ret = $se->registeruser($p); - -# # $vars->{message} = $ret->{message}; -# # $vars->{messagetype} = $ret->{messagetype}; -# # $vars->{page} = $ret->{page}; -# # } -# # if (exists($p->{'btnforgotpassword'})){ -# # my $ret = $se->passwordforgotten($p->{email}); -# # $vars->{message} = $ret->{message}; -# # $vars->{messagetype} = $ret->{messagetype}; -# # $vars->{page} = "message.tt"; -# # } -# # if (exists($p->{'btnvalidateemail'})){ -# # my $ret = $se->validateaccount($p); -# # $vars->{message} = $ret->{message}; -# # $vars->{messagetype} = $ret->{messagetype}; -# # $vars->{page} = "message.tt"; -# # } -# # if (exists($p->{'btnresendcode'})){ -# # my $ret = $se->resendcode($p->{email}); -# # $vars->{message} = $ret->{message}; -# # $vars->{messagetype} = $ret->{messagetype}; -# # $vars->{page} = "message.tt"; -# # } - -# # if (exists($p->{logout})){ -# # $se->deletesession($p->{sid}); -# # $p->{sid} = ""; -# # $cookie = CGI::Cookie->new(-name=>$vars->{cookiename},-value=>"",-httponly => 1); -# # } -# # if (exists($p->{btndeleteprofile})){ -# # my $ret = $se->deleteprofile($p->{deleteprofile}); -# # $vars->{message} = $ret->{message}; -# # $vars->{messagetype} = $ret->{messagetype}; -# # $vars->{page} = "message.tt"; -# # if (exists($ret->{sid})){ -# # $p->{sid} = ""; -# # } -# # $cookie = CGI::Cookie->new(-name=>$vars->{cookiename},-value=>"",-httponly => 1); -# # } -# } - -# # if ($p->{sid} ne ""){ -# # $sess = $se->getsession($p->{sid}); -# # } - -# #$vars->{beforex} = $vars->{page}; -# if (!exists($sess->{id}) || (!exists($p->{sid})) || $p->{sid} eq ""){ -# $skl = "skeleton/index.tt"; -# } -# # if ($vars->{page} eq "deleteprofile.tt") { -# # $skl = "skeleton/login.tt"; -# # } -# # my ($appname) = $ENV{REQUEST_URI} =~ /.*\/module\/(\w+)\/.*/; -# if ($p->{sid} ne ""){ -# $vars->{session} = $sess; -# } -# #SESSION - End -# # #BEGIN - Browser Blocking -# # if (($ENV{HTTP_USER_AGENT} !~ /Chrome/) || ($ENV{HTTP_USER_AGENT} =~ /Edge/) || ($ENV{HTTP_USER_AGENT} =~ /Firefox/)){ -# # $skl = "skeleton/browser.tt"; -# # } -# # #END - Browser Blocking my $ctype = 'text/html'; if ($vars->{suffix} eq ".js"){ $ctype= "text/javascript"; } elsif ($vars->{suffix} eq ".css"){ $ctype = "text/css"; } -#print $cgi->header(-type=>$ctype, -charset=>"utf-8",-cookie => $cookie); print $cgi->header(-type=>$ctype, -charset=>"utf-8"); -# print dirname($ENV{"SCRIPT_FILENAME"}); my $template = Template->new({INCLUDE_PATH => [$Bin.'/CGI/tmpl']}); -#} my @lv = split(/\//,$vars->{filepath}); my $absnum = scalar(@lv)-1; @@ -169,6 +79,9 @@ if ($vars->{page} =~ /^app/){ if ($vars->{page} =~ /module/){ $vars->{module} = basename(dirname($vars->{page})); } +# if ($vars->{page} =~ /print\//){ +# $vars->{print} = basename(dirname($vars->{page})); +# } $vars->{pagename} = basename($vars->{page}); $vars->{pagename} =~ s/\.tt$//; # my ($appname) = $ENV{REQUEST_URI} =~ /.*\/apps\/(\w+)\/.*/; @@ -178,18 +91,13 @@ $vars->{pagename} =~ s/\.tt$//; #$skl ne "skeleton/login.tt" && if ($vars->{page} =~ /module/){ $skl = "skeleton/module.tt"; - if ($vars->{page} !~ /\.tt$/) { - $skl = "skeleton/file.tt"; - } - $vars->{params}= $p; }elsif ($vars->{page} =~ /^app/){ $skl = "skeleton/app.tt"; - if ($vars->{page} !~ /\.tt$/) { +} +if ($vars->{page} !~ /\.tt$/) { $skl = "skeleton/file.tt"; } - $vars->{params}= $p; -} - +$vars->{params}= $p; #END - iFrame - Modules $template->process($skl,$vars) || die "Template process failed: ", $template->error(), "\n"; diff --git a/CGI/tmpl/app/coloradio/module/allaudio/index.js b/CGI/tmpl/app/coloradio/module/allaudio/index.js index a23b1fa..a7c1d00 100644 --- a/CGI/tmpl/app/coloradio/module/allaudio/index.js +++ b/CGI/tmpl/app/coloradio/module/allaudio/index.js @@ -20,6 +20,7 @@ function initpage() { enableTime: true, "locale": "de" }); + } function loadtblaudio() { diff --git a/CGI/tmpl/app/invoicejournal/module/invoicejournal/index.js b/CGI/tmpl/app/invoicejournal/module/invoicejournal/index.js index 4505686..bfd383e 100644 --- a/CGI/tmpl/app/invoicejournal/module/invoicejournal/index.js +++ b/CGI/tmpl/app/invoicejournal/module/invoicejournal/index.js @@ -49,7 +49,7 @@ function initpage() { "locale": "de", }); - + fillchoices(); inittblinvoices(); inittblbookings(); @@ -57,99 +57,99 @@ function initpage() { return false; } -function inittblinvoices(){ - tbl = new Tabulator("#tbl_invoices", { - headerFilterPlaceholder: "filter...", - height: "92vh", - layout: "fitData", - selectable: 1, - // responsiveLayout:"collapse", - columns: [ - { title: "Quartal", field: "bquarter", headerFilter: "input" }, - { - title: "Datum", - field: "invoicedate", - formatter: "datetime", - formatterParams: { - inputFormat: "YYYY-MM-DD", - outputFormat: "DD.MM.YYYY", - invalidPlaceholder: "" - } - }, - { title: "Empfänger", field: "receipient", headerFilter: "input", width: 200 }, - { title: "Sender", field: "sender", headerFilter: "input" }, - { title: "Referenz", field: "reference", headerFilter: "input" }, - { - title: "Status", - field: "status", - headerFilter: "input", - formatter: function(cell, formatterParams) { - var value = cell.getValue(); - //console.log(value.indexOf("bez")); - if (value.indexOf("payed") >= 0) { - return "" + statuslang[value] + ""; - } else if (value.indexOf("overdue") >= 0) { - return "" + statuslang[value] + ""; - } else if (value.indexOf("planned") >= 0) { - return "" + statuslang[value] + ""; - } else { - return "" + statuslang[value] + ""; +function inittblinvoices() { + tbl = new Tabulator("#tbl_invoices", { + headerFilterPlaceholder: "filter...", + height: "92vh", + layout: "fitData", + selectable: 1, + // responsiveLayout:"collapse", + columns: [ + { title: "Quartal", field: "bquarter", headerFilter: "input" }, + { + title: "Datum", + field: "invoicedate", + formatter: "datetime", + formatterParams: { + inputFormat: "YYYY-MM-DD", + outputFormat: "DD.MM.YYYY", + invalidPlaceholder: "" + } + }, + { title: "Empfänger", field: "receipient", headerFilter: "input", width: 200 }, + { title: "Sender", field: "sender", headerFilter: "input" }, + { title: "Referenz", field: "reference", headerFilter: "input" }, + { + title: "Status", + field: "status", + headerFilter: "input", + formatter: function(cell, formatterParams) { + var value = cell.getValue(); + //console.log(value.indexOf("bez")); + if (value.indexOf("payed") >= 0) { + return "" + statuslang[value] + ""; + } else if (value.indexOf("overdue") >= 0) { + return "" + statuslang[value] + ""; + } else if (value.indexOf("planned") >= 0) { + return "" + statuslang[value] + ""; + } else { + return "" + statuslang[value] + ""; + } + } + }, + { + title: "Netto", + field: "netamount", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "€", + symbolAfter: "p", + precision: 2, + } + }, + { + title: "MwSt", + field: "vatamount", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "€", + symbolAfter: "p", + precision: 2, + } + }, { + title: "Brutto", + field: "grossamount", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "€", + symbolAfter: "p", + precision: 2, + } + }, { + title: "Bezahlt", + field: "payedamount", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "€", + symbolAfter: "p", + precision: 2, } } - }, - { - title: "Netto", - field: "netamount", - align: "right", - formatter: "money", - formatterParams: { - decimal: ",", - thousand: ".", - symbol: "€", - symbolAfter: "p", - precision: 2, - } - }, - { - title: "MwSt", - field: "vatamount", - align: "right", - formatter: "money", - formatterParams: { - decimal: ",", - thousand: ".", - symbol: "€", - symbolAfter: "p", - precision: 2, - } - }, { - title: "Brutto", - field: "grossamount", - align: "right", - formatter: "money", - formatterParams: { - decimal: ",", - thousand: ".", - symbol: "€", - symbolAfter: "p", - precision: 2, - } - }, { - title: "Bezahlt", - field: "payedamount", - align: "right", - formatter: "money", - formatterParams: { - decimal: ",", - thousand: ".", - symbol: "€", - symbolAfter: "p", - precision: 2, - } - } - ] -}); -gettbldata(); + ] + }); + gettbldata(); } function inittblfiles() { @@ -185,16 +185,79 @@ function loadtblfilesdata(data) { function inittblbookings() { tblproducts = new Tabulator("#tbl_products", { height: "80vh", - layout: "fitData", + layout: "fitColumns", selectable: 1, columns: [ - { title: "Beschreibung", field: "description" }, - { title: "Anz.", field: "quantity" }, + { title: "Beschreibung", field: "description", formatter: "textarea", width: "400" }, + { + title: "Anz.", + field: "quantity", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "", + symbolAfter: "p", + precision: 0, + } + }, { title: "Einheit", field: "unit" }, - { title: "Einzel-Preis", field: "unitamount" }, - { title: "Netto", field: "netamount" }, - { title: "MwSt.(%)", field: "vatpercent" }, - { title: "MwSt.", field: "vatamount" } + { + title: "Einzel", + field: "unitamount", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "€", + symbolAfter: "p", + precision: 2, + } + }, + { + title: "Netto", + field: "netamount", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "€", + symbolAfter: "p", + precision: 2, + }, + download: false + }, + { + title: "MwSt.(%)", + field: "taxpercent", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "%", + symbolAfter: "p", + precision: 2, + }, + download: false + }, + { + title: "MwSt.", + field: "taxamount", + align: "right", + formatter: "money", + formatterParams: { + decimal: ",", + thousand: ".", + symbol: "€", + symbolAfter: "p", + precision: 2, + }, + download: false + } ] }); return false; @@ -204,16 +267,17 @@ function gettblbookingdata() { var udata = tbl.getSelectedData(); if (udata[0]) { console.log(udata[0]); - req.reqdata("POST", "db.cgi", { "db": parent.app + "/" + mpref.cfg.db, "get": "bookings", "filter": "id_invoice=" + udata[0].id }, loadtblfilesdata); + req.reqdata("POST", "db.cgi", { "db": parent.app + "/" + mpref.cfg.db, "get": "bookings", "filter": "id_invoice=" + udata[0].id }, loadtblbookingdata); } return false; } -function loadtblfilesdata(data) { +function loadtblbookingdata(data) { console.log(data); if (data && data.sqldata) { - tblfiles.setData(data.sqldata); + tblproducts.setData(data.sqldata); } + tblproducts.redraw(true); return false; } @@ -251,9 +315,10 @@ function fillinvoice(data) { } function add() { - //cleanform("invoices"); - //TODO Clean form + cleanform("invoices"); viewinvoicepanel(); + tblproducts.clearData(); + tblproducts.clearData(); return false; } @@ -264,6 +329,7 @@ function remove() { function viewinvoicepanel() { document.getElementById('tbl_invoices').style.display = 'none'; document.getElementById('pnl_invoices').style.display = 'block'; + return false; } @@ -319,4 +385,36 @@ function loadtab(tabname) { } document.getElementById("tab_" + tabname).style.display = "block"; return false; +} + +function geninvoice() { + tblproducts.download("pdf", document.getElementById("reference").value + ".pdf", { + orientation: "portrait", + + jsPDF: { + unit: "mm", + }, + autoTable(doc) { + doc.setFontSize(10); + doc.text("DKS s.à r.l.", 160, 10); + doc.text("8b, rue du Moulin", 160, 15); + doc.text("L-6914 Roodt/Syre", 160, 20); + doc.setFontSize(20); + doc.text("Invoice", 160, 70); + + // styles: { + // fillColor: [100, 255, 255] + // }, + // columnStyles: { + // id: {fillColor: 255} + // }, + return { + margin: { top: 130, bottom: 10, left: 15, right: 10 }, + } + + }, + documentProcessing: function(doc) { + //carry out an action on the doc object + } + }); } \ No newline at end of file diff --git a/CGI/tmpl/app/invoicejournal/module/invoicejournal/index.tt b/CGI/tmpl/app/invoicejournal/module/invoicejournal/index.tt index 62657c4..e01fe65 100644 --- a/CGI/tmpl/app/invoicejournal/module/invoicejournal/index.tt +++ b/CGI/tmpl/app/invoicejournal/module/invoicejournal/index.tt @@ -3,7 +3,7 @@
- + @@ -11,43 +11,38 @@