changeset 196:de3bb01d602d misc

Reagent discount wasn't working, fixed. Cleanups.
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 13 Feb 2011 23:40:16 +0200
parents c75ca644f2df
children c7c9110b955a
files prices.php
diffstat 1 files changed, 7 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/prices.php	Sun Feb 13 16:30:51 2011 +0200
+++ b/prices.php	Sun Feb 13 23:40:16 2011 +0200
@@ -296,8 +296,8 @@
   $dfactor = 1.0;
   $dstr = "";
 
-  if (getVal($dfield, $dval)) {
-    addVal($dfield, $dval);
+  if (getVal($dfield."_discount", $dval)) {
+    addVal($dfield."_discount", $dval);
 
     if ($dval > 0 && $dval <= 100) {
       $dfactor = $dval / 100.0;
@@ -320,6 +320,7 @@
   echo "<table class=\"pritab\">\n";
 }
 
+
 function printSectionFooter($sec)
 {
   echo "</table>\n<p>\n";
@@ -556,7 +557,7 @@
 
   echo " <tr>".$td1.$name.$td2.$td1.$num.$td2.$td1."<b>".convPrice($price)."</b>".$td2."</tr>\n";
 
-  $s = sprintf("%-55s | %-6d | %s", $name, $num, convPrice($price));
+  $s = sprintf("%-55s | %-6d | %s", $name, $num, convPrice($price));
   if ($header)
     $billText .= str_repeat("-", 75)."\n".$s."\n\n";
   else
@@ -594,7 +595,7 @@
 $billText = "";
 $formText = "";
 
-getDiscount("services_discount", $factor, $str);
+getDiscount("services", $factor, $str);
 
 if ($sections["services1"]) {
 foreach ($services1_prices as $key => $item)
@@ -648,7 +649,7 @@
 // Reagents
 //============================================================================
 if ($sections["reagents"]) {
-  getDiscount("reagent_discount", $factor, $s);
+  getDiscount("reagents", $factor, $s);
   $numReagents = 0;
   $subTotal = 0;
   foreach ($reagent_prices as $fkey => $flist)
@@ -671,7 +672,7 @@
   $name = $sec["name"];
 
   if ($sec["discount"])
-    getDiscount("arrow_discount", $factor, $str);
+    getDiscount($name, $factor, $str);
   else {
     $str = "";
     $factor = 1;