Merged changes from main trunk up to 2.2.5
[fa-stable.git] / reporting / rep210.php
index f25b792543661359c681f12216a107c2814bde31..27d56cd704a3ad7f51053bda7a44b284f37b04c4 100644 (file)
@@ -90,7 +90,7 @@ function print_remittances()
 
        if ($email == 0)
        {
-               $rep = new FrontReport(_('PURCHASE ORDER'), "PurchaseOrderBulk", user_pagesize());
+               $rep = new FrontReport(_('REMITTANCE'), "RemittanceBulk", user_pagesize());
                $rep->currency = $cur;
                $rep->Font();
                $rep->Info($params, $cols, null, $aligns);
@@ -103,8 +103,6 @@ function print_remittances()
                else
                        $types = array(ST_BANKPAYMENT, ST_SUPPAYMENT, ST_SUPPCREDIT);
                foreach ($types as $j)
-               //for ($j = ST_BANKPAYMENT; $j <= ST_SUPPAYMENT; $j = ($j == ST_BANKPAYMENT ? ST_SUPPAYMENT : 999))
-               //for ($j = $ft; $j <= $tt; $j = ($j == ST_BANKPAYMENT ? ST_SUPPAYMENT : 999))
                {
                        $myrow = get_remittance($j, $i);
                        if (!$myrow)
@@ -126,7 +124,21 @@ function print_remittances()
                        $rep->Header2($myrow, null, $myrow, $baccount, ST_SUPPAYMENT);
                        $result = get_allocations_for_remittance($myrow['supplier_id'], $myrow['type'], $myrow['trans_no']);
 
+                       $linetype = true;
+                       $doctype = ST_SUPPAYMENT;
+                       if ($rep->currency != $myrow['curr_code'])
+                       {
+                               include($path_to_root . "/reporting/includes/doctext2.inc");
+                       }
+                       else
+                       {
+                               include($path_to_root . "/reporting/includes/doctext.inc");
+                       }
+
                        $total_allocated = 0;
+                       $rep->TextCol(0, 4,     $doc_Towards, -2);
+                       $rep->NewLine(2);
+                       
                        while ($myrow2=db_fetch($result))
                        {
                                $rep->TextCol(0, 1,     $systypes_array[$myrow2['type']], -2);
@@ -144,16 +156,6 @@ function print_remittances()
                        }
 
                        $rep->row = $rep->bottomMargin + (15 * $rep->lineHeight);
-                       $linetype = true;
-                       $doctype = ST_SUPPAYMENT;
-                       if ($rep->currency != $myrow['curr_code'])
-                       {
-                               include($path_to_root . "/reporting/includes/doctext2.inc");
-                       }
-                       else
-                       {
-                               include($path_to_root . "/reporting/includes/doctext.inc");
-                       }
 
                        $rep->TextCol(3, 6, $doc_Total_Allocated, -2);
                        $rep->AmountCol(6, 7, $total_allocated, $dec, -2);
@@ -165,6 +167,12 @@ function print_remittances()
                        $rep->Font('bold');
                        $rep->TextCol(3, 6, $doc_Total_Payment, - 2);
                        $rep->AmountCol(6, 7, $myrow['Total'], $dec, -2);
+                       $words = price_in_words($myrow['Total'], ST_SUPPAYMENT);
+                       if ($words != "")
+                       {
+                               $rep->NewLine(2);
+                               $rep->TextCol(1, 7, $myrow['curr_code'] . ": " . $words, - 2);
+                       }       
                        $rep->Font();
                        if ($email == 1)
                        {