fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [7062] added excel-export of contract price items


From: Erik Holm-Larsen
Subject: [Fmsystem-commits] [7062] added excel-export of contract price items
Date: Wed, 02 Mar 2011 06:54:36 +0000

Revision: 7062
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=7062
Author:   erikhl
Date:     2011-03-02 06:54:35 +0000 (Wed, 02 Mar 2011)
Log Message:
-----------
added excel-export of contract price items

Modified Paths:
--------------
    trunk/rental/inc/class.socontract_price_item.inc.php
    trunk/rental/inc/class.uicontract.inc.php
    trunk/rental/inc/model/class.contract_price_item.inc.php
    trunk/rental/setup/phpgw_no.lang
    trunk/rental/templates/base/contract_list_partial.php

Modified: trunk/rental/inc/class.socontract_price_item.inc.php
===================================================================
--- trunk/rental/inc/class.socontract_price_item.inc.php        2011-03-01 
21:30:34 UTC (rev 7061)
+++ trunk/rental/inc/class.socontract_price_item.inc.php        2011-03-02 
06:54:35 UTC (rev 7062)
@@ -90,6 +90,10 @@
                        $cols = 'COUNT(DISTINCT(id)) AS count';
                        $order = "";
                }
+               else if(isset($filters['export']))
+               {
+                       $cols = 'id, price_item_id, contract_id, area, count, 
agresso_id, title, is_area, price, total_price, is_one_time, date_start, 
date_end';
+               }
                else
                {
                        $cols = '*';
@@ -97,7 +101,7 @@
                
                $tables = "rental_contract_price_item";
                $joins = "";
-               
+
                return "SELECT {$cols} FROM {$tables} {$joins} WHERE 
{$condition} {$order}";
        }
        

Modified: trunk/rental/inc/class.uicontract.inc.php
===================================================================
--- trunk/rental/inc/class.uicontract.inc.php   2011-03-01 21:30:34 UTC (rev 
7061)
+++ trunk/rental/inc/class.uicontract.inc.php   2011-03-02 06:54:35 UTC (rev 
7062)
@@ -67,6 +67,7 @@
                        // Form variables
                        $search_for     = phpgw::get_var('query');
                        $search_type    = phpgw::get_var('search_option');
+                       $include_price_items = phpgw::get_var('price_items');
                        // Create an empty result set
                        $result_objects = array();
                        $result_count = 0;
@@ -178,7 +179,21 @@
                                foreach ($result_objects as $result) {
                                        if(isset($result))
                                        {
-                                               $rows[] = $result->serialize();
+                                               if(isset($include_price_items))
+                                               {
+                                                       //$rows[] = 
$result->serialize();
+                                                       $result_objects_pi = 
rental_socontract_price_item::get_instance()->get(null, null, null, null, null, 
null, array('contract_id' => $result->get_id(),'export'=>'true'));
+                                                       foreach 
($result_objects_pi as $result_pi) {
+                                                               
if(isset($result_pi))
+                                                               {
+                                                                       $rows[] 
= $result_pi->serialize();
+                                                               }
+                                                       }
+                                               }
+                                               else
+                                               {
+                                                       $rows[] = 
$result->serialize();
+                                               }
                                        }
                                }
                                //var_dump("Usage " .memory_get_usage() . " 
bytes after serializing");

Modified: trunk/rental/inc/model/class.contract_price_item.inc.php
===================================================================
--- trunk/rental/inc/model/class.contract_price_item.inc.php    2011-03-01 
21:30:34 UTC (rev 7061)
+++ trunk/rental/inc/model/class.contract_price_item.inc.php    2011-03-02 
06:54:35 UTC (rev 7062)
@@ -187,13 +187,13 @@
                                'contract_id' => $this->get_contract_id(),
                                'area' => $this->get_area(),
                                'count' => $this->get_count(),
-                               //'total_price' => $currency_prefix.' 
'.$this->get_total_price(),
-                               'total_price' => $this->get_total_price(),
+                               'agresso_id' => $this->get_agresso_id(),
                                'title' => $this->get_title(),
-                               'agresso_id' => $this->get_agresso_id(),
                                'is_area' => $this->get_type_text(),
                                //'price' => money_format($currency_prefix.' 
%.2n',$this->get_price()),
                                'price' => $this->get_price(),
+                               //'total_price' => $currency_prefix.' 
'.$this->get_total_price(),
+                               'total_price' => $this->get_total_price(),
                                'is_one_time' => $this->is_one_time(),
                                // We set a format fitting for the 
DateCellEditor here because
                                // this table has inline editing enabled.  The 
DateCellEditor is not

Modified: trunk/rental/setup/phpgw_no.lang
===================================================================
--- trunk/rental/setup/phpgw_no.lang    2011-03-01 21:30:34 UTC (rev 7061)
+++ trunk/rental/setup/phpgw_no.lang    2011-03-02 06:54:35 UTC (rev 7062)
@@ -205,6 +205,8 @@
 executive_officer      rental  no      Saksbehandler
 executive_officer_for  rental  no      Saksbehandler for
 export rental  no      Eksport
+export_contracts       rental  no      Eksporter kontrakter
+export_contract_price_items    rental  no      Eksporter priselementer på 
kontrakter
 Export failed. rental  no      Eksporten feilet.
 Export format  rental  no      Format
 Export generated.      rental  no      Eksporten ble generert.
@@ -416,6 +418,7 @@
 place  rental  no      Sted
 previous       rental  no      Forrige
 price_item     rental  no      Priselement
+price_item_id  rental  no      Priselement ID
 price_item_type_apiece rental  no      Stk.
 price_item_type_area   rental  no      Areal
 price_item_inactive    rental  no      Inaktiv

Modified: trunk/rental/templates/base/contract_list_partial.php
===================================================================
--- trunk/rental/templates/base/contract_list_partial.php       2011-03-01 
21:30:34 UTC (rev 7061)
+++ trunk/rental/templates/base/contract_list_partial.php       2011-03-02 
06:54:35 UTC (rev 7062)
@@ -162,6 +162,35 @@
             '&date_end='+endDate+
             '&export=true');
     }
+
+    function contract_export_price_items(ctype) {
+        var typeselect = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_contract_type');
+        var typeoption = typeselect.options[typeselect.selectedIndex].value;
+
+        var statusselect = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_contract_status');
+        var statusoption = 
statusselect.options[statusselect.selectedIndex].value;
+
+        var sSelect = document.getElementById('<?php echo $list_id 
?>_ctrl_toggle_search_type');
+        var sOption = sSelect.options[sSelect.selectedIndex].value;
+
+        var query = document.getElementById('<?php echo $list_id 
?>_ctrl_search_query').value;
+
+               var startDate = 
document.getElementById('start_date_report').value;
+               var endDate = document.getElementById('end_date_report').value;
+        
+        var dl = window.open('index.php?menuaction=rental.uicontract.download'+
+            '&amp;type='+ctype+
+            '&amp;contract_type='+typeoption+
+            '&amp;contract_status='+statusoption+
+            '<?php echo $url_add_on ?>'+
+            '&amp;query='+query+
+            '&amp;search_option='+sOption+
+            //'&amp;results=100'+
+            '&amp;date_start='+startDate+
+            '&amp;date_end='+endDate+
+            '&amp;price_items=true'+
+            '&amp;export=true');
+    }
 </script>
 <?php
        if($list_form)
@@ -228,7 +257,8 @@
                <!-- export with date limitation -->
                <h3><?php echo lang('export_to') ?></h3>
                <div id="export">
-                       <a href="javascript:contract_export('<?php echo 
$list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a>
+                       <a href="javascript:contract_export('<?php echo 
$list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/16x16/mimetypes/x-office-spreadsheet.png" alt="<?php echo 
lang('export_contracts') ?>" title="<?php echo lang('export_contracts') ?>" 
/></a>
+                       <a href="javascript:contract_export_price_items('<?php 
echo $list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/16x16/mimetypes/x-office-spreadsheet.png" alt="<?php echo 
lang('export_contract_price_items') ?>" title="<?php echo 
lang('export_contract_price_items') ?>" /></a>
                        <label class="toolbar_element_label" 
for="start_date_report" id="label_start_date_report"><?php echo 
lang('date_start') ?></label>
                        <?php echo 
$GLOBALS['phpgw']->yuical->add_listener('start_date_report', 
$notification_date); ?>
                        <label class="toolbar_element_label" 
for="end_date_report" id="label_end_date_report"><?php echo lang('date_end') 
?></label>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]