Fixed credit note list display.
authorJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 14 Jun 2010 13:25:07 +0000 (13:25 +0000)
committerJanusz Dobrowolski <janusz@frontaccounting.eu>
Mon, 14 Jun 2010 13:25:07 +0000 (13:25 +0000)
sales/view/view_sales_order.php

index 6f70b4173e6fa9fa9130c0335b14bb2b0222615f..f9d0629c70920f27c789a7333c9a0278213bfcf7 100644 (file)
@@ -162,32 +162,32 @@ if ($_GET['trans_type'] != ST_SALESQUOTE)
        start_table(TABLESTYLE);
        $th = array(_("#"), _("Ref"), _("Date"), _("Total"));
        table_header($th);
+       if(count($inv_numbers)) {
+               $result = get_related_credits($inv_numbers);
 
-       $result = get_related_credits($inv_numbers);
+               $credits_total = 0;
+               $k = 0;
 
-       $credits_total = 0;
-       $k = 0;
+               while ($credits_row = db_fetch($result))
+               {
 
-       while ($credits_row = db_fetch($result))
-       {
+                       alt_table_row_color($k);
 
-               alt_table_row_color($k);
+                       $this_total = $credits_row["ov_freight"] + $credits_row["ov_freight_tax"]  + $credits_row["ov_gst"] + $credits_row["ov_amount"];
+                       $credits_total += $this_total;
 
-               $this_total = $credits_row["ov_freight"] + $credits_row["ov_freight_tax"]  + $credits_row["ov_gst"] + $credits_row["ov_amount"];
-               $credits_total += $this_total;
+                       label_cell(get_customer_trans_view_str($credits_row["type"], $credits_row["trans_no"]));
+                       label_cell($credits_row["reference"]);
+                       label_cell(sql2date($credits_row["tran_date"]));
+                       amount_cell(-$this_total);
+                       end_row();
 
-               label_cell(get_customer_trans_view_str($credits_row["type"], $credits_row["trans_no"]));
-               label_cell($credits_row["reference"]);
-               label_cell(sql2date($credits_row["tran_date"]));
-               amount_cell(-$this_total);
-               end_row();
+               }
 
+               label_row(null, "<font color=red>" . price_format(-$credits_total) . "</font>",
+                       " ", "colspan=4 align=right");
        }
 
-       label_row(null, "<font color=red>" . price_format(-$credits_total) . "</font>",
-               " ", "colspan=4 align=right");
-
-
        end_table();
 
        echo "</td></tr>";