Rerun of implemented Selectable Print Orientation (Portrait, Landscape) for all repor...
[fa-stable.git] / reporting / rep305.php
index 0ebcbb2d080ecf41510be6a9c729dae11ea8ea4d..083d73f537a6adab0c9511cb3e42a0693318dcb8 100644 (file)
@@ -33,7 +33,7 @@ function getTransactions($from, $to)
 {
        $from = date2sql($from);
        $to = date2sql($to);
-       
+
        $sql = "SELECT ".TB_PREF."grn_batch.id batch_no,
                        ".TB_PREF."grn_batch.supplier_id, 
             ".TB_PREF."purch_order_details.*,
@@ -53,7 +53,7 @@ function getTransactions($from, $to)
         AND ".TB_PREF."grn_batch.delivery_date>='$from'
         AND ".TB_PREF."grn_batch.delivery_date<='$to'
         ORDER BY ".TB_PREF."stock_master.stock_id, ".TB_PREF."grn_batch.delivery_date";        
-       
+
     return db_query($sql,"No transactions were returned");
 
 }
@@ -86,12 +86,14 @@ function print_grn_valuation()
        $from = $_POST['PARAM_0'];
        $to = $_POST['PARAM_1'];
        $comments = $_POST['PARAM_2'];
-       $destination = $_POST['PARAM_3'];
+       $orientation = $_POST['PARAM_3'];
+       $destination = $_POST['PARAM_4'];
        if ($destination)
                include_once($path_to_root . "/reporting/includes/excel_report.inc");
        else
                include_once($path_to_root . "/reporting/includes/pdf_report.inc");
 
+       $orientation = ($orientation ? 'L' : 'P');
     $dec = user_price_dec();
 
        $cols = array(0, 75, 225, 260, 295, 330, 370, 410, 455, 515);
@@ -102,7 +104,9 @@ function print_grn_valuation()
     $params =   array(         0 => $comments,
                                    1 => array('text' => _('Period'),'from' => $from, 'to' => $to));
 
-    $rep = new FrontReport(_('GRN Valuation Report'), "GRNValuationReport", user_pagesize());
+    $rep = new FrontReport(_('GRN Valuation Report'), "GRNValuationReport", user_pagesize(), 9, $orientation);
+    if ($orientation == 'L')
+       recalculate_cols($cols);
 
     $rep->Font();
     $rep->Info($params, $cols, $headers, $aligns);
@@ -137,7 +141,7 @@ function print_grn_valuation()
                $rep->TextCol(2, 3, $trans['order_no']);
                $qdec = get_qty_dec($trans['item_code']);
                $rep->TextCol(3, 4, $trans['batch_no']);
-               
+
                if ($trans['quantity_inv'])
                {
                        $suppinv = getSuppInvDetails($trans['grn_item_id']);