From eb6b2232a8dfef6d961a3c7aa854bcd1de513dd6 Mon Sep 17 00:00:00 2001 From: Geno Date: Thu, 19 Nov 2020 23:11:49 +0100 Subject: [PATCH] OrderSprinter 1.5.7 --- gastsystem/index.php | 6 +- gastsystem/install.php | 4 +- printserver/OrderSprinterPrintserver.exe | Bin 266752 -> 266752 bytes spider/install/installer.php | 2 +- webapp/OrderSprinterPrintserver.exe | Bin 266752 -> 266752 bytes webapp/bar.html | 6 +- webapp/bill.html | 2 +- webapp/customer/closingtemplate.txt | 92 +++++ webapp/customer/speisekarte.txt | 2 +- webapp/feedback.html | 2 +- webapp/index.html | 6 +- webapp/install.html | 77 +++- webapp/install/installer.php | 2 +- webapp/kitchen.html | 6 +- webapp/manager.html | 41 ++- webapp/paydesk.html | 2 +- webapp/php/admin.php | 42 ++- webapp/php/closing.php | 28 ++ webapp/php/contenthandler.php | 2 + webapp/php/customers.php | 2 +- webapp/php/debug.php | 2 +- webapp/php/feedback.php | 7 - webapp/php/roomtables.php | 7 +- webapp/php/utilities/basedb.php | 8 + webapp/php/utilities/basetemplater.php | 73 ++++ webapp/php/utilities/clostemplater.php | 442 +++++++++++++++++++++++ webapp/php/utilities/version.php | 18 +- webapp/preferences.html | 2 +- webapp/products.html | 2 +- webapp/rating.html | 2 +- webapp/reports.html | 2 +- webapp/reservation.html | 2 +- webapp/supplydesk.html | 2 +- webapp/tasks.html | 4 +- webapp/timetracking.html | 2 +- webapp/waiter.html | 4 +- 36 files changed, 826 insertions(+), 77 deletions(-) create mode 100644 webapp/customer/closingtemplate.txt create mode 100644 webapp/php/utilities/basetemplater.php create mode 100644 webapp/php/utilities/clostemplater.php diff --git a/gastsystem/index.php b/gastsystem/index.php index d851922..a33f89f 100644 --- a/gastsystem/index.php +++ b/gastsystem/index.php @@ -9,8 +9,8 @@ - - + + @@ -105,7 +105,7 @@
  OrderSprinter
-
1.5.6  
+
1.5.7  
diff --git a/gastsystem/install.php b/gastsystem/install.php index da931ef..671f150 100644 --- a/gastsystem/install.php +++ b/gastsystem/install.php @@ -90,10 +90,10 @@ if (isset($_POST['code'])) { } else { echo ""; echo "Installation Gastsystem"; - echo ''; + echo ''; echo ""; echo "
"; - echo "Installation OrderSprinter-Gastsystem 1.5.6

"; + echo "Installation OrderSprinter-Gastsystem 1.5.7

"; echo "
"; echo "
"; echo "
"; diff --git a/printserver/OrderSprinterPrintserver.exe b/printserver/OrderSprinterPrintserver.exe index 0fa0781296e8a69f087452b01effb0ac04cce1f2..e241f1270b2c7209f83ded535c1e28746e2895a4 100644 GIT binary patch delta 170 zcmZozBG9lzU_uAWJQm^T#-7$5#?~IDtv$@^`We}`TTftqqN8VEX5wOGZseqEX<%ut zYvN>Lu4`fLjAX6^#v*jAX6^#v* "OK","msg" => "Installation successful"); diff --git a/webapp/OrderSprinterPrintserver.exe b/webapp/OrderSprinterPrintserver.exe index 0fa0781296e8a69f087452b01effb0ac04cce1f2..e241f1270b2c7209f83ded535c1e28746e2895a4 100644 GIT binary patch delta 170 zcmZozBG9lzU_uAWJQm^T#-7$5#?~IDtv$@^`We}`TTftqqN8VEX5wOGZseqEX<%ut zYvN>Lu4`fLjAX6^#v*jAX6^#v* - + @@ -13,8 +13,8 @@ - - + + "; +$html .= $txt; +$version = CommonUtils::getConfigValue($pdo, "version", ""); +$html .= "


OrderSprinter $version
"; +$html .= ""; + +echo $html; +} } \ No newline at end of file diff --git a/webapp/php/contenthandler.php b/webapp/php/contenthandler.php index 5c7dc3b..5efbaef 100644 --- a/webapp/php/contenthandler.php +++ b/webapp/php/contenthandler.php @@ -20,6 +20,8 @@ require_once ('workreceipts.php'); require_once ('utilities/Logger.php'); require_once ('utilities/roles.php'); require_once ('utilities/permissions.php'); +require_once ('utilities/basetemplater.php'); +require_once ('utilities/clostemplater.php'); require_once ('guestsync.php'); require_once ('timetracking.php'); require_once ('tasks.php'); diff --git a/webapp/php/customers.php b/webapp/php/customers.php index 4f98e93..bd373af 100644 --- a/webapp/php/customers.php +++ b/webapp/php/customers.php @@ -853,7 +853,7 @@ class Customers { $txt = ""; $txt .= "" . self::$CUS_OVERVIEW[$lang] . ""; $txt .= ''; - $txt .= ''; + $txt .= ''; $txt .= ""; return $txt; } diff --git a/webapp/php/debug.php b/webapp/php/debug.php index a2bd3a4..7de3602 100644 --- a/webapp/php/debug.php +++ b/webapp/php/debug.php @@ -27,7 +27,7 @@ if (isset($_POST["cmd"])) { if (strlen($status) > 150) { $status = substr($status, 0,149); } - $version = "1.5.6"; + $version = "1.5.7"; $arr = array("cmd" => $cmd,"fct" => $fct, "xhr" => $xhr,"errormsg" => $errormsg,"status" => $status,"version" => $version,"phpversion" => $phpversion); } else { diff --git a/webapp/php/feedback.php b/webapp/php/feedback.php index c499fd6..90e7851 100644 --- a/webapp/php/feedback.php +++ b/webapp/php/feedback.php @@ -138,13 +138,6 @@ class Feedback { $status = ''; $phpversion = phpversion(); - if (strlen($xhr) > 900) { - $xhr = substr($xhr, 0, 899); - } - if (strlen($errormsg) > 150) { - $errormsg = substr($errormsg, 0, 149); - } - $arr = array("cmd" => $cmd, "fct" => $fct, "xhr" => $xhr, "errormsg" => $errormsg, "status" => $status, "version" => $version, "phpversion" => $phpversion); $url = "http://www.ordersprinter.de/debug/save.php?cmd=save"; diff --git a/webapp/php/roomtables.php b/webapp/php/roomtables.php index 00ef516..ca9fb41 100644 --- a/webapp/php/roomtables.php +++ b/webapp/php/roomtables.php @@ -224,6 +224,11 @@ class Roomtables { $arrayOfRooms = array(); $showprepinwaiter = CommonUtils::getConfigValue($pdo, 'showprepinwaiter', 1); + $workflowconfig = CommonUtils::getConfigValue($pdo, 'workflowconfig', 0); + $queryprodForTableView = false; + if (($showprepinwaiter == 1) && (($workflowconfig == 0) || ($workflowconfig == 1))) { + $queryprodForTableView = true; + } foreach($dbresult as $zeile) { $roomid = $zeile['id']; @@ -255,7 +260,7 @@ class Roomtables { foreach ($tablesArray as $tableEntry) { $arrayOfProdsAndIdsOfATable = array("prods" => array(), "ids" => ''); - if ($showprepinwaiter == 1) { + if ($queryprodForTableView) { $arrayOfProdsAndIdsOfATable = $queue->getAllPreparedProductsForTableidAsArray($pdo,$tableEntry->id); } $arrayOfProdsOfATable = $arrayOfProdsAndIdsOfATable['prods']; diff --git a/webapp/php/utilities/basedb.php b/webapp/php/utilities/basedb.php index 5b945bb..b404d1d 100644 --- a/webapp/php/utilities/basedb.php +++ b/webapp/php/utilities/basedb.php @@ -1186,6 +1186,14 @@ class Basedb { return; } + public static function loadSampleCusHtmlTemplate($pdo) { + $file = "../customer/closingtemplate.txt"; + $content = file_get_contents($file); + if ($content === false) { + $content = "Keine Vorlage vordefiniert"; + } + return $content; + } public static function loadSampleProdImages($pdo) { $sql = "UPDATE %products% SET prodimageid=?"; CommonUtils::execSql($pdo, $sql, array(null)); diff --git a/webapp/php/utilities/basetemplater.php b/webapp/php/utilities/basetemplater.php new file mode 100644 index 0000000..9610760 --- /dev/null +++ b/webapp/php/utilities/basetemplater.php @@ -0,0 +1,73 @@ +templatelines = $templatelines; + $this->submodules = $submodules; + $this->closing = $closing; + } + + public function createWithTemplate($pdo) { + $seperatedTemplate = Templateutils::separateSubModule($this->templatelines, $this->submodules); + + $alldataitems = $this->getDataItems($pdo); + + $txt = ""; + foreach($alldataitems as $aDataEntry) { + + $subInstances = array(); + foreach($seperatedTemplate["submodulelines"] as $aSubModLineSection) { + $subModClassName = $aSubModLineSection["submodule"]["classname"]; + $refl = new ReflectionClass($subModClassName); + $subInstances[] = $refl->newInstance($aSubModLineSection["foundlines"],$aDataEntry["id"],$this->closing); + } + + foreach($seperatedTemplate["templatelines"] as $aTemplatelLine) { + $responsible = $aTemplatelLine["responsible"]; + $line = $aTemplatelLine["line"]; + + if ($responsible == Templatedefs::$PARSE_SELF) { + $preprocessedLine = Abbreviations::replaceDefsInTextLine($line); + $txt .= $this->parse($pdo,$preprocessedLine,$aDataEntry); + } else if ($responsible == Templatedefs::$PARSE_CONDITIONAL) { + // parse line only if submodule has entries + $whichSubmodule = $aTemplatelLine["submoduleindex"]; + $hasItems = call_user_func(array($subInstances[$whichSubmodule],"hasItems"),$pdo); + if ($hasItems) { + $preprocessedLine = Abbreviations::replaceDefsInTextLine($line); + $txt .= $this->parse($pdo,$preprocessedLine,$aDataEntry); + } + } else { + $whichSubmodule = $aTemplatelLine["submoduleindex"]; + $txt .= call_user_func(array($subInstances[$whichSubmodule],"createWithTemplate"),$pdo); + } + } + } + return $txt; + } + + public function parse($pdo,$text,$data) { + return $text; + } + + public function getDataItems($pdo) { + return array(); + } + + public function hasItems($pdo) { + $items = $this->getDataItems($pdo); + if (count($items) > 0) { + return true; + } else { + return false; + } + } + + public static function getClassName() { + return get_called_class(); + } +} diff --git a/webapp/php/utilities/clostemplater.php b/webapp/php/utilities/clostemplater.php new file mode 100644 index 0000000..0e3fbeb --- /dev/null +++ b/webapp/php/utilities/clostemplater.php @@ -0,0 +1,442 @@ + array( + array("classname" => "ClosProdsReport","delimiter" => "PRODUKTE"), + array("classname" => "ClosOverviewReport","delimiter" => "ZUSAMMENFASSUNG"), + array("classname" => "ClosTaxesReport","delimiter" => "STEUERN"), + array("classname" => "ClosPaymentsReport","delimiter" => "ZAHLUNGSWEGE"), + ), + "ClosProdsReport" => array(), + "ClosOverviewReport" => array(), + "ClosTaxesReport" => array(), + "ClosPaymentsReport" => array( + array("classname" => "ClosSingleReport","delimiter" => "ZAHLUNGSWEG") + ), + "ClosSingleReport" => array() + ); + private static $structure_old = array( + "Templater" => array( + array("classname" => "Reqsection","delimiter" => "SS"), + array("classname" => "Testcasesreport","delimiter" => "TC"), + array("classname" => "Matrixreporter","delimiter" => "MATRIX") + ), + "Reqsection" => array( + array("classname" => "Reqdetails","delimiter" => "RD") + ), + "Reqdetails" => array( + array("classname" => "Reqimgs","delimiter" => "REQIMG") + ), + "Reqimgs" => array(), + "Testcasesreport" => array( + array("classname" => "Stepactionsreport","delimiter" => "TSACTIONS"), + array("classname" => "Stepexpectedreport","delimiter" => "TSEXPECTED"), + array("classname" => "Stepresultsreport","delimiter" => "TSRESULTS") + ), + "Matrixreporter" => array(), + "Stepactionsreport" => array(), + "Stepexpectedreport" => array(), + "Stepresultsreport" => array() + ); + + public static function getSubModules($reporterClass) { + return self::$structure[$reporterClass]; + } +} + + +class ClosTemplater extends Basetemplater { + private $templatelines = array(); + private $closid = null; + private $closing = null; + + function __construct($templatelines, $closid, $closing) { + $submodules = ClosTemplatestructure::getSubModules(self::getClassName()); + + parent::__construct($templatelines,$submodules,$closing); + $this->templatelines = $templatelines; + $this->closid = $closid; + $this->closing = $closing; + } + + public function parse($pdo,$text,$data) { + $currency = CommonUtils::getConfigValue($pdo, "currency", "."); + $text = str_replace("{Einheit}",$currency,$text); + $text = str_replace("{Id}",$data["id"],$text); + $text = str_replace("{Tag}",$data["day"],$text); + $text = str_replace("{Monat}",$data["month"],$text); + $text = str_replace("{Jahr}",$data["year"],$text); + $text = str_replace("{Stunde}",$data["hour"],$text); + $text = str_replace("{Minute}",$data["minute"],$text); + $text = str_replace("{Sekunde}",$data["second"],$text); + $text = str_replace("{Bonanzahl}",$data["ticketcount"],$text); + $text = str_replace("{Bemerkung}",$data["remark"],$text); + $sum = str_replace(".", $data["decpoint"], $data["bruttosum"]); + $text = str_replace("{Bruttosumme}",$sum,$text); + + $imgurl = "contenthandler.php?module=printqueue&command=getLogoAsPng"; + $text = str_replace("{Logo-klein}","",$text); + $text = str_replace("{Logo-gross}","",$text); + $text = str_replace("{Betriebsinfo}",$data["companyinfo"],$text); + + return $text; + } + + public function getDataItems($pdo) { + $decpoint = CommonUtils::getConfigValue($pdo, "decpoint", "."); + $companyinfo = str_replace("\n","
",$this->closing["companyinfo"]); + $clos = $this->closing["closing"]; + $closdate = $clos->closingdate; + $datetimeparts = explode(" ", $closdate); + $dateparts = explode("-",$datetimeparts[0]); + $timeparts = explode(":",$datetimeparts[1]); + return array(array("id" => $this->closid, + "day" => $dateparts[2], + "month" => $dateparts[1], + "year" => $dateparts[0], + "hour" => $timeparts[0], + "minute" => $timeparts[1], + "second" => $timeparts[2], + "ticketcount" => $clos->billcount, + "bruttosum" => $clos->billsum, + "remark" => $clos->remark, + "decpoint" => $decpoint, + "companyinfo" => $companyinfo + )); + } +} + +class Abbreviations { + private static $defs = array(); + + public static function addUserDefinition($txt) { + $parts = explode('=',$txt,2); + $key = explode('#',$parts[0])[1]; + $value = $parts[1]; + self::$defs[] = array("key" => $key,"value" => $value); + } + + public static function replaceDefsInTextLine($txt) { + foreach(self::$defs as $aDef) { + $txt = str_replace($aDef["key"], $aDef["value"], $txt); + } + return $txt; + } +} + +class Templatedefs { + public static $PARSE_SELF = 0; + public static $PARSE_SUBMODULE = 1; + public static $PARSE_CONDITIONAL = 2; +} + +class Templateutils { + + public static function getTemplateAsLineArray($templateTxt) { + $alllines = explode("\n", $templateTxt); + return $alllines; + } + + private static function hasStartDelimiterOfASubModule($line,$submodules) { + $trimmedLine = trim($line); + for ($i=0;$i>" . $submodules[$i]["delimiter"]) { + return array(true,$i); + } + } + return array(false,null); + } + + public static function separateSubModule($alllines,$submodules) { + $outlines = array(); + + $subtemplates = array(); + $conditionalMarkups = array(); // line beginnings + $i=0; + foreach($submodules as $aSubModule) { + $subtemplates[] = array("submodule" => $aSubModule,"foundlines" => array()); + // now store the conditional markup in associative array + $conditionalMarkups[$aSubModule["delimiter"]] = $i++; + } + $activeParsingSubmoduleIndex = null; // index in $subtemplates + $enddelimiter = null; + + $started = false; // general for "is parsing lines for submodule" + $submodulelineAdded = false; + foreach($alllines as $aline) { + $trimmedLine = trim($aline); + $hasStartDel = self::hasStartDelimiterOfASubModule($trimmedLine, $submodules); + + if (CommonUtils::startsWith($trimmedLine,"//")) { + } else if (preg_match("/#\[[a-zA-Z0-9_-]+\]=/i", $trimmedLine)) { + Abbreviations::addUserDefinition($trimmedLine); + + } else if ($trimmedLine === $enddelimiter) { + $started = false; + } else if (($hasStartDel[0]) && !$started) { + // at this point we know there is a startdelimiter in the line + $activeParsingSubmoduleIndex = $hasStartDel[1]; + $started = true; + $enddelimiter = "<<" . $subtemplates[$activeParsingSubmoduleIndex]["submodule"]["delimiter"]; + } else if ($started) { + $subtemplates[$activeParsingSubmoduleIndex]["foundlines"][] = $aline; + if (!$submodulelineAdded) { + $outlines[] = array("responsible" => Templatedefs::$PARSE_SUBMODULE,"line" => $aline, "submoduleindex" => $activeParsingSubmoduleIndex); + $submodulelineAdded = true; + } + } else { + + $lineParts = explode(":",$trimmedLine,3); + if (count($lineParts) >= 3) { + $markPart = $lineParts[1]; + if (array_key_exists($markPart, $conditionalMarkups)) { + $conditionalLine = $lineParts[2]; + $outlines[] = array("responsible" => Templatedefs::$PARSE_CONDITIONAL,"line" => $conditionalLine, "submoduleindex" => $conditionalMarkups[$markPart]); + } else { + $outlines[] = array("responsible" => Templatedefs::$PARSE_SELF,"line" =>$aline); + } + } else { + $outlines[] = array("responsible" => Templatedefs::$PARSE_SELF,"line" =>$aline); + } + $submodulelineAdded = false; + } + } + return array("templatelines" => $outlines, "submodulelines" => $subtemplates); + } + + public static function debugOutput($sepTemp, $className) { + $templatelines = $sepTemp["templatelines"]; + $txt = "Start debugOutput for '$className' - Templatelines:\n"; + foreach($templatelines as $t) { + $isSelf = ($t["responsible"] == Templatedefs::$PARSE_SELF ? true : false ); + switch($t["responsible"]) { + case Templatedefs::$PARSE_SELF: + $txt .= "SELF"; break; + case Templatedefs::$PARSE_CONDITIONAL: + $txt .= "COND"; break; + case Templatedefs::$PARSE_SUBMODULE: + $txt .= "SUB"; break; + default: + $txt .= "Undefined line marup"; break; + } + + $txt .= " " . $t["line"]; + if (!$isSelf) { + $txt .= " " . $t["submoduleindex"]; + } + $txt .= "\r\n
"; + } + return $txt; + } +} + +class ClosProdsReport extends Basetemplater { + private $templatelines = array(); + private $closid = null; + private $closing = null; + + function __construct($templatelines, $closid, $closing) { + $submodules = ClosTemplatestructure::getSubModules(self::getClassName()); + + parent::__construct($templatelines,$submodules,$closing); + $this->templatelines = $templatelines; + $this->closid = $closid; + $this->closing = $closing; + } + + public function parse($pdo,$text,$data) { + $decpoint = CommonUtils::getConfigValue($pdo, "decpoint", "."); + $currency = CommonUtils::getConfigValue($pdo, "currency", "."); + $text = str_replace("{Einheit}",$currency,$text); + $text = str_replace("{Anzahl}",$data["count"],$text); + $text = str_replace("{Steuer}",$data["tax"],$text); + $text = str_replace("{Produktname}",$data["productname"],$text); + + $price = str_replace(".", $decpoint, $data["price"]); + $text = str_replace("{Einzelpreis}",$price,$text); + $sumprice = str_replace(".", $decpoint, $data["sumprice"]); + $text = str_replace("{Gesamtpreis}",$sumprice,$text); + return $text; + } + + public function getDataItems($pdo) { + $decpoint = CommonUtils::getConfigValue($pdo, "decpoint", "."); + $closprods = $this->closing["details"]; + $prods = array(); + foreach($closprods as $aProdEntry) { + $tax = str_replace(".", $decpoint, $aProdEntry["tax"]); + $prods[] = array("id" => $this->closid, + "count" => $aProdEntry["count"], + "productname" => $aProdEntry["productname"], + "price" => $aProdEntry["price"], + "tax" => $tax, + "sumprice" => $aProdEntry["sumprice"] + ); + }; + return $prods; + } +} + +class ClosOverviewReport extends Basetemplater { + private $templatelines = array(); + private $closid = null; + private $closing = null; + + function __construct($templatelines, $closid, $closing) { + $submodules = ClosTemplatestructure::getSubModules(self::getClassName()); + + parent::__construct($templatelines,$submodules,$closing); + $this->templatelines = $templatelines; + $this->closid = $closid; + $this->closing = $closing; + } + + public function parse($pdo,$text,$data) { + $currency = CommonUtils::getConfigValue($pdo, "currency", "."); + $text = str_replace("{Einheit}",$currency,$text); + $text = str_replace("{Brutto}",$data["brutto"],$text); + $text = str_replace("{Netto}",$data["netto"],$text); + $text = str_replace("{Zahlungsweg}",$data["name"],$text); + $text = str_replace("{Vorgang}",$data["status"],$text); + return $text; + } + + public function getDataItems($pdo) { + $decpoint = CommonUtils::getConfigValue($pdo, "decpoint", "."); + $closoverview = $this->closing["overview"]; + $prods = array(); + foreach($closoverview as $entry) { + $brutto = str_replace(".", $decpoint, $entry["sum"]); + $name = $entry["name"]; + $netto = str_replace(".", $decpoint, $entry["netto"]); + $status = $entry["status"]; + $statusTxt = "Verkauf"; + if ($status == "c") { + $statusTxt = "Bareinlage/-auslage"; + } else if ($status == "s") { + $statusTxt = "Stornooperation"; + } + $prods[] = array("id" => $this->closid, + "brutto" => $brutto, + "netto" => $netto, + "name" => $name, + "status" => $statusTxt + ); + }; + return $prods; + } +} + +class ClosTaxesReport extends Basetemplater { + private $templatelines = array(); + private $closid = null; + private $closing = null; + + function __construct($templatelines, $closid, $closing) { + $submodules = ClosTemplatestructure::getSubModules(self::getClassName()); + + parent::__construct($templatelines,$submodules,$closing); + $this->templatelines = $templatelines; + $this->closid = $closid; + $this->closing = $closing; + } + + public function parse($pdo,$text,$data) { + $currency = CommonUtils::getConfigValue($pdo, "currency", "."); + $text = str_replace("{Einheit}",$currency,$text); + $text = str_replace("{Brutto}",$data["bruttosum"],$text); + $text = str_replace("{Netto}",$data["nettosum"],$text); + $text = str_replace("{Steuer}",$data["tax"],$text); + return $text; + } + + public function getDataItems($pdo) { + $decpoint = CommonUtils::getConfigValue($pdo, "decpoint", "."); + $closoverview = $this->closing["taxessum"]; + $p = array(); + foreach($closoverview as $entry) { + $tax = str_replace(".", $decpoint, $entry["t"]); + $bruttosum = str_replace(".", $decpoint, $entry["bruttosum"]); + $nettosum = str_replace(".", $decpoint, $entry["nettosum"]); + $p[] = array("id" => $this->closid, + "tax" => $tax, + "bruttosum" => $bruttosum, + "nettosum" => $nettosum + ); + }; + return $p; + } +} + +class ClosPaymentsReport extends Basetemplater { + private $templatelines = array(); + private $closid = null; + private $closing = null; + + function __construct($templatelines, $closid, $closing) { + $submodules = ClosTemplatestructure::getSubModules(self::getClassName()); + + parent::__construct($templatelines,$submodules,$closing); + $this->templatelines = $templatelines; + $this->closid = $closid; + $this->closing = $closing; + } + + public function parse($pdo,$text,$data) { + $currency = CommonUtils::getConfigValue($pdo, "currency", "."); + $text = str_replace("{Einheit}",$currency,$text); + $text = str_replace("{Zahlungsweg}",$data["payment"],$text); + return $text; + } + + public function getDataItems($pdo) { + $payments = $this->closing["paymenttaxessum"]; + $p = array(); + foreach($payments as $entry) { + $p[] = array("payment" => $entry["payment"], + "id" => $entry["paymenttaxessum"]); + } + return $p; + } +} + +class ClosSingleReport extends Basetemplater { + private $templatelines = array(); + private $payment = null; + private $closing = null; + + function __construct($templatelines, $payment, $closing) { + $submodules = ClosTemplatestructure::getSubModules(self::getClassName()); + + parent::__construct($templatelines,$submodules,$closing); + $this->templatelines = $templatelines; + $this->payment = $payment; + $this->closing = $closing; + } + + public function parse($pdo,$text,$data) { + $currency = CommonUtils::getConfigValue($pdo, "currency", "."); + $text = str_replace("{Einheit}",$currency,$text); + $text = str_replace("{Brutto}",$data["bruttosum"],$text); + $text = str_replace("{Netto}",$data["nettosum"],$text); + $text = str_replace("{Steuer}",$data["tax"],$text); + return $text; + } + + public function getDataItems($pdo) { + $decpoint = CommonUtils::getConfigValue($pdo, "decpoint", "."); + $payments = $this->payment; + foreach($payments as $entry) { + $tax = str_replace(".", $decpoint, $entry["t"]); + $bruttosum = str_replace(".", $decpoint, $entry["bruttosum"]); + $nettosum = str_replace(".", $decpoint, $entry["nettosum"]); + $p[] = array("id" => "dummy", + "tax" => $tax, + "bruttosum" => $bruttosum, + "nettosum" => $nettosum + ); + } + return $p; + } +} \ No newline at end of file diff --git a/webapp/php/utilities/version.php b/webapp/php/utilities/version.php index 1c85c6c..da6bee2 100644 --- a/webapp/php/utilities/version.php +++ b/webapp/php/utilities/version.php @@ -92,6 +92,11 @@ class Version { return $rect; } + public static function getDefaultClosTemplate($pdo) { + $r = Basedb::loadSampleCusHtmlTemplate($pdo); + return $r; + } + private static function updateNettoValuesOfBill($pdo) { $sql = "SELECT %bill%.id as billid,IF(status='s',-1,1)*ROUND(SUM(price/(1 + %queue%.tax/100.0)),6) as netto FROM %queue%,%billproducts%,%bill% WHERE %billproducts%.billid=%bill%.id AND %billproducts%.queueid=%queue%.id AND (status is null OR status=? OR status=?) GROUP by billid"; $stmt = $pdo->prepare(DbUtils::substTableAlias($sql)); @@ -974,6 +979,16 @@ class Version { } } + public static function upd_1506_1507($pdo, $prefix, $dbname) { + try { + $closTemplate = self::getDefaultClosTemplate($pdo); + self::insertOrUpdateConfigItem($pdo, 'clostemplate', $closTemplate); + return array(true); + } catch (PDOException $e) { + return array(false,$e); + } + } + public static $updateOrder = array( "1.3.0" => array("upd_1300_1301","1.3.1"), "1.3.1" => array("upd_1301_1302","1.3.2"), @@ -1027,7 +1042,8 @@ class Version { "1.5.2" => array("upd_1502_1503","1.5.3"), "1.5.3" => array("upd_1503_1504","1.5.4"), "1.5.4" => array("upd_1504_1505","1.5.5"), - "1.5.5" => array("upd_1505_1506","1.5.6") + "1.5.5" => array("upd_1505_1506","1.5.6"), + "1.5.6" => array("upd_1506_1507","1.5.7") ); // RE;* also for install process no check is required diff --git a/webapp/preferences.html b/webapp/preferences.html index be49d36..610ee16 100644 --- a/webapp/preferences.html +++ b/webapp/preferences.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/products.html b/webapp/products.html index fb53359..ad64918 100644 --- a/webapp/products.html +++ b/webapp/products.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/rating.html b/webapp/rating.html index 24793c1..ba9048c 100644 --- a/webapp/rating.html +++ b/webapp/rating.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reports.html b/webapp/reports.html index 9d8a46f..0da3a28 100644 --- a/webapp/reports.html +++ b/webapp/reports.html @@ -7,7 +7,7 @@ - + diff --git a/webapp/reservation.html b/webapp/reservation.html index 4eee9a4..5e34e4f 100644 --- a/webapp/reservation.html +++ b/webapp/reservation.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/supplydesk.html b/webapp/supplydesk.html index 0c7547f..9f4debb 100644 --- a/webapp/supplydesk.html +++ b/webapp/supplydesk.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/tasks.html b/webapp/tasks.html index 0156282..f0c95a7 100644 --- a/webapp/tasks.html +++ b/webapp/tasks.html @@ -5,7 +5,7 @@ - + @@ -13,7 +13,7 @@ - + diff --git a/webapp/timetracking.html b/webapp/timetracking.html index bee99b2..3f3a447 100644 --- a/webapp/timetracking.html +++ b/webapp/timetracking.html @@ -5,7 +5,7 @@ - + diff --git a/webapp/waiter.html b/webapp/waiter.html index 77c15e1..9f69f46 100644 --- a/webapp/waiter.html +++ b/webapp/waiter.html @@ -4,8 +4,8 @@ - - + +