Preparation for Excel Writer continued
[fa-stable.git] / reporting / rep105.php
index 7a0222a7741f2c99a633edf757137426e707a461..d19c438c81e6962d0d47121dabdfa2cfe4eae873 100644 (file)
@@ -26,7 +26,6 @@ include_once($path_to_root . "/inventory/includes/db/items_category_db.inc");
 
 //----------------------------------------------------------------------------------------------------
 
-// trial_inquiry_controls();
 print_order_status_list();
 
 //----------------------------------------------------------------------------------------------------
@@ -72,14 +71,23 @@ function print_order_status_list()
 {
        global $path_to_root;
 
-       include_once($path_to_root . "/reporting/includes/pdf_report.inc");
-
        $from = $_POST['PARAM_0'];
        $to = $_POST['PARAM_1'];
        $category = $_POST['PARAM_2'];
        $location = $_POST['PARAM_3'];
        $backorder = $_POST['PARAM_4'];
        $comments = $_POST['PARAM_5'];
+       $destination = $_POST['PARAM_6'];
+       if ($destination)
+       {
+               include_once($path_to_root . "/reporting/includes/excel_report.inc");
+               $filename = "OrderStatusListing.xml";
+       }       
+       else
+       {
+               include_once($path_to_root . "/reporting/includes/pdf_report.inc");
+               $filename = "OrderStatusListing.pdf";
+       }
 
        if ($category == reserved_words::get_all_numeric())
                $category = 0;
@@ -117,7 +125,7 @@ function print_order_status_list()
        $cols2 = $cols;
        $aligns2 = $aligns;
 
-       $rep = new FrontReport(_('Order Status Listing'), "OrderStatusListing.pdf", user_pagesize());
+       $rep = new FrontReport(_('Order Status Listing'), $filename, user_pagesize());
        $rep->Font();
        $rep->Info($params, $cols, $headers, $aligns, $cols2, $headers2, $aligns2);
 
@@ -145,8 +153,8 @@ function print_order_status_list()
                        $rep->TextCol(1, 2,     get_customer_name($myrow['debtor_no']));
                        $rep->TextCol(2, 3,     get_branch_name($myrow['branch_code']));
                        $rep->TextCol(3, 4,     $myrow['customer_ref']);
-                       $rep->TextCol(4, 5,     sql2date($myrow['ord_date']));
-                       $rep->TextCol(5, 6,     sql2date($myrow['delivery_date']));
+                       $rep->DateCol(4, 5,     $myrow['ord_date'], true);
+                       $rep->DateCol(5, 6,     $myrow['delivery_date'], true);
                        $rep->TextCol(6, 7,     $myrow['from_stk_loc']);
                        $rep->NewLine(2);
                        $orderno = $myrow['order_no'];
@@ -154,9 +162,9 @@ function print_order_status_list()
                $rep->TextCol(0, 1,     $myrow['stk_code']);
                $rep->TextCol(1, 2,     $myrow['description']);
                $dec = get_qty_dec($myrow['stk_code']);
-               $rep->TextCol(2, 3,     number_format2($myrow['quantity'], $dec));
-               $rep->TextCol(3, 4,     number_format2($myrow['qty_sent'], $dec));
-               $rep->TextCol(4, 5,     number_format2($myrow['quantity'] - $myrow['qty_sent'], $dec));
+               $rep->AmountCol(2, 3, $myrow['quantity'], $dec);
+               $rep->AmountCol(3, 4, $myrow['qty_sent'], $dec);
+               $rep->AmountCol(4, 5, $myrow['quantity'] - $myrow['qty_sent'], $dec);
                if ($myrow['quantity'] - $myrow['qty_sent'] > 0)
                {
                        $rep->Font('italic');