Fixed range selection for bulk document printing to avoid unexpected blank page when...
authorJanusz Dobrowolski <janusz@frontaccouting.eu>
Wed, 28 Sep 2011 19:19:25 +0000 (21:19 +0200)
committerJanusz Dobrowolski <janusz@frontaccouting.eu>
Wed, 28 Sep 2011 19:19:25 +0000 (21:19 +0200)
reporting/rep107.php
reporting/rep110.php
reporting/rep112.php
reporting/rep113.php
reporting/rep210.php
reporting/rep409.php

index 99c58a5171d7a0eb3277af3b28b5d01c8f968e1a..620117f775f595b0dfe62d7acd9f1b6b4f3923ff 100644 (file)
@@ -43,14 +43,14 @@ function print_invoices()
        $pay_service = $_POST['PARAM_4'];
        $comments = $_POST['PARAM_5'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
+       if (!$from || !$to) return;
+
        $dec = user_price_dec();
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $tno[0]);
+       $to = max($fno[0], $tno[0]);
 
        $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
 
@@ -69,7 +69,7 @@ function print_invoices()
                $rep->Font();
                $rep->Info($params, $cols, null, $aligns);
        }
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                        if (!exists_customer_trans(ST_SALESINVOICE, $i))
                                continue;
index ad19c6b1d5e0223bf751f15ba7206dae4a4d6dd7..cadfc522faaa708d481783878d95e297ff1d7d3f 100644 (file)
@@ -44,14 +44,14 @@ function print_deliveries()
        $packing_slip = $_POST['PARAM_3'];
        $comments = $_POST['PARAM_4'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
+       if (!$from || !$to) return;
+
        $dec = user_price_dec();
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $tno[0]);
+       $to = max($fno[0], $tno[0]);
 
        $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
 
@@ -74,7 +74,7 @@ function print_deliveries()
                $rep->Info($params, $cols, null, $aligns);
        }
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                        if (!exists_customer_trans(ST_CUSTDELIVERY, $i))
                                continue;
index d2e06c0964a0e4e221f097366220d21d19f9cf02..f04ee1d77f5cd1df851782269101da5492f0504d 100644 (file)
@@ -71,14 +71,14 @@ function print_receipts()
        $currency = $_POST['PARAM_2'];
        $comments = $_POST['PARAM_3'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
+       if (!$from || !$to) return;
+
        $dec = user_price_dec();
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $tno[0]);
+       $to = max($fno[0], $tno[0]);
 
        $cols = array(4, 85, 150, 225, 275, 360, 450, 515);
 
@@ -95,10 +95,10 @@ function print_receipts()
        $rep->Font();
        $rep->Info($params, $cols, null, $aligns);
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
-               if ($fno[0] == $tno[0])
-                       $types = array($fno[1]);
+               if ($from == $to)
+                       $types = array($from);
                else
                        $types = array(ST_BANKDEPOSIT, ST_CUSTPAYMENT);
                foreach ($types as $j)
index 8fb6fd02ec63875f5f20aaaff6a3435fcc17edb7..916032b82aedaae1f526bdb1f51343f1d5b221b9 100644 (file)
@@ -43,14 +43,14 @@ function print_credits()
        $paylink = $_POST['PARAM_4'];
        $comments = $_POST['PARAM_5'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
+       if (!$from || !$to) return;
+
        $dec = user_price_dec();
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $fto[0]);
+       $to = max($fno[0], $fto[0]);
 
        $cols = array(4, 60, 225, 300, 325, 385, 450, 515);
 
@@ -70,7 +70,7 @@ function print_credits()
                $rep->Info($params, $cols, null, $aligns);
        }
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                        if (!exists_customer_trans(ST_CUSTCREDIT, $i))
                                continue;
index 072e8d90721620324d92d69496005342fc4a301c..1b80b72e8368814d54efb411a981ce736be07519 100644 (file)
@@ -71,14 +71,14 @@ function print_remittances()
        $email = $_POST['PARAM_3'];
        $comments = $_POST['PARAM_4'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
+       if (!$from || !$to) return;
+
        $dec = user_price_dec();
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $tno[0]);
+       $to = max($fno[0], $tno[0]);
 
        $cols = array(4, 85, 150, 225, 275, 360, 450, 515);
 
@@ -98,7 +98,7 @@ function print_remittances()
                $rep->Info($params, $cols, null, $aligns);
        }
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                if ($fno[0] == $tno[0])
                        $types = array($fno[1]);
index 2974d647fae7f98d4b654937ad10bf8b76ecb5d3..a4d41c7008f741b7f2ca8ffaee50ded4e054db07 100644 (file)
@@ -37,14 +37,12 @@ function print_workorders()
        $email = $_POST['PARAM_2'];
        $comments = $_POST['PARAM_3'];
 
-       if ($from == null)
-               $from = 0;
-       if ($to == null)
-               $to = 0;
-       $dec = user_price_dec();
+       if (!$from || !$to) return;
 
        $fno = explode("-", $from);
        $tno = explode("-", $to);
+       $from = min($fno[0], $tno[0]);
+       $to = max($fno[0], $tno[0]);
 
        $cols = array(4, 60, 190, 255, 320, 385, 450, 515);
 
@@ -64,7 +62,7 @@ function print_workorders()
                $rep->Info($params, $cols, null, $aligns);
        }
 
-       for ($i = $fno[0]; $i <= $tno[0]; $i++)
+       for ($i = $from; $i <= $to; $i++)
        {
                $myrow = get_work_order($i);
                if ($myrow === false)