fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9187] invoice handling


From: Sigurd Nes
Subject: [Fmsystem-commits] [9187] invoice handling
Date: Thu, 19 Apr 2012 20:12:43 +0000

Revision: 9187
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9187
Author:   sigurdne
Date:     2012-04-19 20:12:42 +0000 (Thu, 19 Apr 2012)
Log Message:
-----------
invoice handling

Modified Paths:
--------------
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.uiinvoice2.inc.php
    trunk/property/js/portico/ajax_invoice.js
    trunk/property/js/yahoo/invoice2.index.js
    trunk/property/templates/base/invoice2.xsl

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2012-04-19 13:34:45 UTC (rev 
9186)
+++ trunk/property/inc/class.soinvoice.inc.php  2012-04-19 20:12:42 UTC (rev 
9187)
@@ -441,6 +441,20 @@
                        $invoice = array();
                        while ($this->db->next_record())
                        {
+                               $status_line = 'O';
+                               if($this->db->f('budsjettsigndato'))
+                               {
+                                       $status_line = 'C';
+                               }
+                               else if($this->db->f('saksigndato'))
+                               {
+                                       $status_line = 'B';
+                               }
+                               else if($this->db->f('oppsynsigndato'))
+                               {
+                                       $status_line = 'A';
+                               }
+
                                $invoice[] = array
                                        (
                                                'counter'                       
        => $i,
@@ -471,7 +485,8 @@
                                                'budget_responsible'    => 
$this->db->f('budsjettansvarligid'),
                                                'budsjettsigndato'              
=> $this->db->f('budsjettsigndato'),
                                                'transfer_time'                 
=> $this->db->f('overftid'),
-                                               'line_text'                     
        => $this->db->f('line_text',true)
+                                               'line_text'                     
        => $this->db->f('line_text',true),
+                                               'status_line'                   
=> $status_line
                                        );
 
                                $i++;
@@ -1879,6 +1894,18 @@
                                        }
 
                                        $table = 'fm_ecobilag';
+
+                                       $this->db->query("SELECT belop FROM 
{$table} WHERE id={$id}",__LINE__,__FILE__);
+                                       $this->db->next_record();
+                                       $amount = $this->db->f('belop');
+                                       $new_amount = $amount - $split_amount;
+                                       
+                                       if($new_amount < 0)
+                                       {
+                                               
phpgwapi_cache::message_set(lang('negative sum'), 'error');
+                                               continue;
+                                       }
+
                                        $metadata = $this->db->metadata($table);
                                        $sql ="SELECT * FROM {$table} WHERE id= 
{$id}";
                                        
$this->db->query($sql,__LINE__,__FILE__);
@@ -1886,9 +1913,10 @@
 
                                        $value_set = array();
 
+                                       $skip_values = 
array('id','pmwrkord_code', 'spbudact_code', 'dima', 'dimb', 'loc1', 'mvakode', 
'dimd', 'merknad', 
'line_text','oppsynsmannid','saksbehandlerid','oppsynsigndato','saksigndato','budsjettsigndato');
                                        foreach($metadata as $_field)
                                        {
-                                               if($_field->name != 'id')
+                                               if(!in_array($_field->name, 
$skip_values))
                                                {
                                                        
$value_set[$_field->name] = $this->db->f($_field->name,true);
                                                }
@@ -1899,10 +1927,6 @@
 
                                        $new_id = 
$this->db->get_last_insert_id($table,'id');
 
-                                       $this->db->query("SELECT belop FROM 
{$table} WHERE id={$id}",__LINE__,__FILE__);
-                                       $this->db->next_record();
-                                       $amount = $this->db->f('belop');
-                                       $new_amount = $amount - $split_amount;
 
                                        $value_set= array
                                        (

Modified: trunk/property/inc/class.uiinvoice2.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice2.inc.php 2012-04-19 13:34:45 UTC (rev 
9186)
+++ trunk/property/inc/class.uiinvoice2.inc.php 2012-04-19 20:12:42 UTC (rev 
9187)
@@ -27,9 +27,9 @@
        */
 
        phpgw::import_class('phpgwapi.yui');
-       phpgw::import_class('registration.uicommon');
+//     phpgw::import_class('registration.uicommon');
 
-       class property_uiinvoice2 extends registration_uicommon
+       class property_uiinvoice2
        {
                var $cat_id;
                var $start;
@@ -61,8 +61,9 @@
 
                function __construct()
                {
-                       parent::__construct();
+//                     parent::__construct();
                
+                       $GLOBALS['phpgw_info']['flags']['xslt_app'] = true;
                        $this->account_id                       = 
$GLOBALS['phpgw_info']['user']['account_id'];
                        $this->bo                                       = 
CreateObject('property.boinvoice',true);
                        $this->bocommon                         = 
CreateObject('property.bocommon');
@@ -74,9 +75,52 @@
                        $this->status_id                        = 
$this->bo->status_id;
                        $this->allrows                          = 
$this->bo->allrows;
                
-                       self::set_active_menu('property::invoice::invoice2');
+//                     self::set_active_menu('property::invoice::invoice2');
+                       $GLOBALS['phpgw_info']['flags']['menu_selection'] = 
'property::invoice::invoice2';
                }
 
+               public function add_javascript($app, $pkg, $name)
+               {
+                       return $GLOBALS['phpgw']->js->validate_file($pkg, 
str_replace('.js', '', $name), $app);
+               }
+               /**
+               * A more flexible version of xslttemplate.add_file
+               */
+               public function add_template_file($tmpl)
+               {
+                       if(is_array($tmpl))
+                       {
+                               foreach($tmpl as $t)
+                               {
+                                       $this->add_template_file($t);
+                               }
+                               return;
+                       }
+                       foreach(array_reverse($this->tmpl_search_path) as $path)
+                       {
+                               $filename = $path . '/' . $tmpl . '.xsl';
+                               if (file_exists($filename))
+                               {
+                                       
$GLOBALS['phpgw']->xslttpl->xslfiles[$tmpl] = $filename;
+                                       return;
+                               }
+                       }
+                       echo "Template $tmpl not found in search path: ";
+                       print_r($this->tmpl_search_path);
+                       die;
+               }
+
+               public function link($data)
+               {
+                       return $GLOBALS['phpgw']->link('/index.php', $data);
+               }
+
+               public function redirect($link_data)
+               {
+                       $GLOBALS['phpgw']->redirect_link('/index.php', 
$link_data);
+               }
+
+
                function update_voucher()
                {
                        $receipt = array();
@@ -116,6 +160,11 @@
 
                        if(phpgw::get_var('phpgw_return_as') == 'json')
                        {
+                               if( $receipt = 
phpgwapi_cache::session_get('phpgwapi', 'phpgw_messages'))
+                               {
+                                       
phpgwapi_cache::session_clear('phpgwapi', 'phpgw_messages');
+                                       $result['receipt'] = $receipt;
+                               }
                                return $result;
                        }
                        else
@@ -168,118 +217,119 @@
                        $myColumnDefs = array();
                        $datavalues = array();
                        $myButtons      = array();
-                       $myColumnDefs[0] = array
-                       (
-                               'name'          => "0",
-                               'values'        =>      json_encode(array(      
array('key' => 'value_email',   'label'=>lang('email'), 
'sortable'=>true,'resizeable'=>true),
-                                                                               
                        array('key' => 
'value_select','label'=>lang('select'),'sortable'=>false,'resizeable'=>true)))
-                       );      
 
-
-                       $content_email = 
$this->bocommon->get_vendor_email(isset($ticket['vendor_id'])?$ticket['vendor_id']:0);
-
                        $datavalues[] = array
                        (
                                'name'                          => "0",
                                'values'                        => 
json_encode(array()),
                                'total_records'         => 0,
                                'permission'            => "''",
-                               'is_paginator'          => 0,
+                               'is_paginator'          => 1,
                                'edit_action'           => "''",
                                'footer'                        => 0
                        );
 
-                       $datatable_old = array
+                       $datatable = array
                        (
-                                       'source' => 
self::link(array('menuaction' => 'property.uiinvoice2.query', 'voucher_id' => 
$voucher_id,'line_id' => $line_id,'phpgw_return_as' => 'json')),
-                                       'field' => array(
-                                               array(
-                                               'key' => 'id',
-                                               'hidden' => true
-                                               ),
-                                               array(
-                                                               'key' => 
'approve_line',
-                                                               'label' => 
lang('select'),
-                                                               'sortable' => 
false,
-                                                               'formatter' => 
'FormatterCenter',
-                                               ),
-                                               array(
-                                                       'key'   =>      
'amount',
-                                                       'label' =>      
lang('amount'),
-                                                       'sortable'      =>      
true
-                                               ),
-                                               array(
-                                                       'key' => 
'approved_amount',
-                                                       'label' => 
lang('approved amount'),
-                                                       'sortable'      => true,
-       //                                              'formatter' => 
'FormatterRight',
-                                               ),
-                                               array(
-                                                               'key' => 
'split',
-                                                               'label' => 
lang('split line'),
-                                                               'sortable' => 
false,
-                                                               'formatter' => 
'FormatterCenter',
-                                               ),
-                                               array(
-                                                               'key' => 
'budget_account',
-                                                               'label' => 
lang('budget account'),
-                                                               'sortable' => 
false,
-                                                               'formatter' => 
'FormatterCenter',
-                                               ),
-                                                       array(
-                                                               'key' => 'dima',
-                                                               'label' => 
lang('dim a'),
-                                                               'sortable' => 
false,
-                                                               'formatter' => 
'FormatterCenter',
-                                               ),
-                                               array(
-                                                               'key' => 'dimb',
-                                                               'label' => 
lang('dim b'),
-                                                               'sortable' => 
false,
-                                                               'formatter' => 
'FormatterCenter',
-                                               ),
-                                                       array(
-                                                               'key' => 
'order_id',
-                                                               'label' => 
lang('order'),
-                                                               'sortable' => 
false,
-                                                               'formatter' => 
'FormatterCenter',
-                                               ),
-                                                       array(
-                                                               'key' => 
'project_group',
-                                                               'label' => 
lang('project group'),
-                                                               'sortable' => 
false,
-                                                               'formatter' => 
'FormatterCenter',
-                                               ),
-                                                       array(
-                                                               'key' => 
'line_text',
-                                                               'label' => 
lang('invoice line text'),
-                                                               'sortable' => 
false,
-                                                               'formatter' => 
'FormatterCenter',
-                                               ),
-                                               array(
-                                                       'key' => 'actions',
-                                                       'hidden' => true
-                                               ),
-                                               array(
-                                                       'key' => 'labels',
-                                                       'hidden' => true
-                                               ),
-                                               array(
-                                                       'key' => 'ajax',
-                                                       'hidden' => true
-                                               ),array(
-                                                       'key' => 'parameters',
-                                                       'hidden' => true
-                                               )                               
        
-                                       )
-                               );
+                               array
+                               (
+                               'key' => 'id',
+                               'hidden' => true
+                               ),
+                               array
+                               (
+                                       'key' => 'approve_line',
+                                       'label' => lang('select'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'status_line',
+                                       'label' => lang('status'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key'   =>      'amount',
+                                       'label' =>      lang('amount'),
+                                       'formatter' => 'FormatterRight',
+                                       'sortable'      =>      true
+                               ),
+                               array
+                               (
+                                       'key' => 'approved_amount',
+                                       'label' => lang('approved amount'),
+                                       'sortable'      => true,
+                                       'formatter' => 'FormatterRight',
+                               ),
+                               array
+                               (
+                                       'key' => 'split',
+                                       'label' => lang('split line'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'budget_account',
+                                       'label' => lang('budget account'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'dima',
+                                       'label' => lang('dim a'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'dimb',
+                                       'label' => lang('dim b'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'order_id',
+                                       'label' => lang('order'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterRight',
+                               ),
+                               array
+                               (
+                                       'key' => 'project_group',
+                                       'label' => lang('project group'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterRight',
+                               ),
+                               array
+                               (
+                                       'key' => 'line_text',
+                                       'label' => lang('invoice line text'),
+                                       'sortable' => false,
+                                       'formatter' => 'FormatterCenter',
+                               ),
+                               array
+                               (
+                                       'key' => 'approved_amount_hidden',
+                                       'hidden' => true
+                               )
+                       );
 
+                       $myColumnDefs[0] = array
+                       (
+                               'name'          => "0",
+                               'values'        =>      json_encode($datatable)
+                       );      
 
-
                        $data = array
                        (
                                'td_count'                                      
        => '""',
-                               'base_java_url'                                 
=> "{menuaction:'property.uiinvoice2.update_voucher'}",
+                               'base_java_url'                                 
=> "{menuaction:'property.uiinvoice2.query'}",
                                'property_js'                                   
=> 
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
                                'datatable'                                     
        => $datavalues,
                                'myColumnDefs'                                  
=> $myColumnDefs,
@@ -313,36 +363,44 @@
                                'datatable_old'                                 
=> array()//$datatable_old;
                        );
 //_debug_array($data);die();                   
-                       
$GLOBALS['phpgw']->css->add_external_file('/phpgwapi/js/yahoo/layout/assets/skins/sam/layout.css');
+                       $GLOBALS['phpgw_info']['flags']['noframework']  = true;
+
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/layout/assets/skins/sam/layout.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/datatable/assets/skins/sam/datatable.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/paginator/assets/skins/sam/paginator.css');
+                       
$GLOBALS['phpgw']->css->add_external_file('phpgwapi/js/yahoo/container/assets/skins/sam/container.css');
+
                        phpgwapi_yui::load_widget('layout');
+                       phpgwapi_yui::load_widget('dragdrop');
+                       phpgwapi_yui::load_widget('datatable');
+                       phpgwapi_yui::load_widget('menu');
+                       phpgwapi_yui::load_widget('connection');
+                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('tabview');
                        phpgwapi_yui::load_widget('paginator');
-                       phpgwapi_yui::load_widget('loader');
+                       phpgwapi_yui::load_widget('animation');
 
 
-
                        self::add_javascript('controller', 'controller', 
'jquery.js');
                        self::add_javascript('property', 'portico', 
'ajax_invoice.js');
                        self::add_javascript('property', 'yahoo', 
'invoice2.index.js');
 
+
 //                     self::render_template_xsl(array('invoice2', 'common'), 
$data);
-                       self::render_template_xsl(array('invoice2'), $data);
-                       $GLOBALS['phpgw_info']['flags']['noframework']  = true;
+//                     self::render_template_xsl(array('invoice2'), $data);
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('invoice2'));
+                       
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('data' => $data));
                }
        
 
                public function query()
                {
-                       $this->bo->start = phpgw::get_var('startIndex');
-                       $this->bo->order = phpgw::get_var('sort');
-                       $this->bo->sort = phpgw::get_var('dir');
-                       $this->bo->results = phpgw::get_var('results');
                        $line_id =      phpgw::get_var('line_id', 'int');
-//_debug_array($_REQUEST); die();
                        if ( ! $voucher_id = 
phpgw::get_var('voucher_id_filter') )
                        {
                                $voucher_id = phpgw::get_var('voucher_id');
                        }
-
                        $values = $this->bo->read_invoice_sub($voucher_id);
 
                        foreach($values as &$entry)
@@ -355,17 +413,12 @@
 
                                $entry['approve_line'] = "<input 
id=\"approve_line\" type =\"radio\" {$_checked} name=\"values[approve]\" 
value=\"{$entry['id']}\">";
                                $entry['split'] = "<input type =\"text\" 
name=\"values[split_amount][{$entry['id']}]\" value=\"\" size=\"8\">";
-                               
-                       //      $entry['line_text'] = "<input type =\"text\" 
name=\"values[line_text][{$entry['id']}]\" value=\"{$entry['line_text']}\" 
size=\"20\">";
+                               $entry['approved_amount_hidden'] = 
$entry['approved_amount'];
                                $entry['approved_amount'] = "<input type 
=\"text\" name=\"values[approved_amount][{$entry['id']}]\" 
value=\"{$entry['approved_amount']}\" size=\"8\">";
                                $results['results'][]= $entry;
                        }
-                       $results['total_records'] = $this->bo->total_records;
-                       $results['start'] = $this->bo->start;
-                       $results['sort'] = 'id';
-                       $results['dir'] = $this->bo->sort ? $this->bo->sort : 
'ASC';
-                                       
-                       return $this->yui_results($results);
+
+                       return json_encode($values);
                }
 
                public function get_vouchers()

Modified: trunk/property/js/portico/ajax_invoice.js
===================================================================
--- trunk/property/js/portico/ajax_invoice.js   2012-04-19 13:34:45 UTC (rev 
9186)
+++ trunk/property/js/portico/ajax_invoice.js   2012-04-19 20:12:42 UTC (rev 
9187)
@@ -191,6 +191,10 @@
                $("#close_order").html( '' );
                $("#close_order_orig").val( '' );
                $("#park_order").html( '' );
+
+               base_java_url['voucher_id_filter'] = $(this).val();
+               execute_async(myDataTable_0);
+
                document.getElementById('image_content').src = '';
        });
 
@@ -203,8 +207,7 @@
 
 
        $("#voucher_form").live("submit", function(e){
-//             e.preventDefault();
-return;
+               e.preventDefault();
                var line_id = $("#line_id").val();
                var voucher_id_orig = $("#voucher_id").val();
                if(!line_id)
@@ -230,12 +233,15 @@
                                {
                                        $(submitBnt).val("Lagret");
                                /*
-                                       var oArgs = 
{menuaction:'property.uiinvoice2.get_vouchers'};
-                                       var requestUrl = phpGWLink('index.php', 
oArgs, true);
-                                       requestUrl = requestUrl + 
"&voucher_id_filter=" + $("#voucher_id").val();
-                                       
execute_async(datatable-container,requestUrl);
+                                               var oArgs = 
{menuaction:'property.uiinvoice2.get_vouchers'};
+                                               var requestUrl = 
phpGWLink('index.php', oArgs, true);
+                                               requestUrl = requestUrl + 
"&voucher_id_filter=" + $("#voucher_id").val();
+                                               
execute_async(myDataTable_0,requestUrl);
                                */
 
+                                               
base_java_url['voucher_id_filter'] = $("#voucher_id").val();
+                                               base_java_url['line_id'] = 
line_id;
+                                               execute_async(myDataTable_0);
                                        }
                                        else
                                        {
@@ -248,16 +254,35 @@
                                                
$(submitBnt).addClass("not_active");
                                }, 1000);
 
+                                       var htmlString = "";
+                                       if(typeof(data['receipt']['error']) != 
'undefined')
+                                       {
+                                               for ( var i = 0; i < 
data['receipt']['error'].length; ++i )
+                                               {
+                                                       htmlString += "<div 
class=\"error\">";
+                                                       htmlString += 
data['receipt']['error'][i]['msg'];
+                                                       htmlString += '</div>';
+                                               }
+                                       
+                                       }
+                                       if(typeof(data['receipt']['message']) 
!= 'undefined')
+                                       {
+                                               for ( var i = 0; i < 
data['receipt']['message'].length; ++i )
+                                               {
+                                                       htmlString += "<div 
class=\"msg_good\">";
+                                                       htmlString += 
data['receipt']['message'][i]['msg'];
+                                                       htmlString += '</div>';
+                                               }
+                                       
+                                       }
+                                       $("#receipt").html(htmlString);
+                                       
                                        update_form_values(line_id, 
voucher_id_orig);
                                }
                        }
                });
        });
 
-
-
-
-
 //-------------
 
 
@@ -841,7 +866,7 @@
                                        $("#close_order_orig").val( 
voucher[0].closed );
 //---------
 
-                                       
if(data['generic']['dimb_list']['options'] != 'undefined')
+                                       
if(typeof(data['generic']['dimb_list']['options']) != 'undefined')
                                        {
                                                var htmlString = "";
 
@@ -858,7 +883,7 @@
 
                                                $("#dim_b").html( htmlString );
                                        }
-                                       
if(data['generic']['tax_code_list']['options'] != 'undefined')
+                                       
if(typeof(data['generic']['tax_code_list']['options']) != 'undefined')
                                        {
                                                var htmlString = "";
 
@@ -878,7 +903,7 @@
                                                $("#tax_code").html( htmlString 
);
                                        }
 
-                                       
if(data['generic']['period_list']['options'] != 'undefined')
+                                       
if(typeof(data['generic']['period_list']['options']) != 'undefined')
                                        {
                                                var htmlString = "";
 
@@ -895,7 +920,7 @@
 
                                                $("#period").html( htmlString );
                                        }
-                                       
if(data['generic']['periodization_list']['options'] != 'undefined')
+                                       
if(typeof(data['generic']['periodization_list']['options']) != 'undefined')
                                        {
                                                var htmlString = "";
 
@@ -912,7 +937,7 @@
 
                                                $("#periodization").html( 
htmlString );
                                        }
-                                       
if(data['generic']['periodization_start_list']['options'] != 'undefined')
+                                       
if(typeof(data['generic']['periodization_start_list']['options']) != 
'undefined')
                                        {
                                                var htmlString = "";
 
@@ -930,7 +955,7 @@
                                                $("#periodization_start").html( 
htmlString );
                                        }
 
-                                       
if(data['generic']['process_code_list']['options'] != 'undefined')
+                                       
if(typeof(data['generic']['process_code_list']['options']) != 'undefined')
                                        {
                                                var htmlString = "";
 
@@ -947,7 +972,7 @@
                                                $("#process_code").html( 
htmlString );
                                        }
 
-                                       if(data['generic']['approved_list'] != 
'undefined')
+                                       
if(typeof(data['generic']['approved_list']) != 'undefined')
                                        {
                                                for ( var i = 0; i < 
data['generic']['approved_list'].length; ++i )
                                                {
@@ -978,7 +1003,7 @@
                                                }
                                        }
 
-                                       
if(data['generic']['approve_list']['options'] != 'undefined')
+                                       
if(typeof(data['generic']['approve_list']['options']) != 'undefined')
                                        {
                                                var htmlString = "";
 
@@ -986,7 +1011,7 @@
 
                                                $.each(obj, function(i) {
                                                        var selected = '';
-                                                       if(obj[i].selected != 
'undefined' && obj[i].selected == 1)
+                                                       
if(typeof(obj[i].selected) != 'undefined' && obj[i].selected == 1)
                                                        {
                                                                selected = ' 
selected';
                                                        }

Modified: trunk/property/js/yahoo/invoice2.index.js
===================================================================
--- trunk/property/js/yahoo/invoice2.index.js   2012-04-19 13:34:45 UTC (rev 
9186)
+++ trunk/property/js/yahoo/invoice2.index.js   2012-04-19 20:12:42 UTC (rev 
9187)
@@ -1,10 +1,52 @@
 var    myPaginator_0, myDataTable_0
 
-this.myParticularRenderEvent = function()
-{
-}
+       this.myParticularRenderEvent = function()
+       {
+               this.addFooterDatatable(myPaginator_0,myDataTable_0);
+       }
 
 
+
+/********************************************************************************/
+       this.addFooterDatatable = function(paginator,datatable)
+       {
+               //call getSumPerPage(name of column) in property.js
+               tmp_sum1 = getTotalSum('amount',2,paginator,datatable);
+               tmp_sum2 = 
getTotalSum('approved_amount_hidden',2,paginator,datatable);
+
+               if(typeof(tableYUI)=='undefined')
+               {
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[0].parentNode;
+                       tableYUI.setAttribute("id","tableYUI");
+               }
+               else
+               {
+                       tableYUI.deleteTFoot();
+               }
+
+               //Create ROW
+               newTR = document.createElement('tr');
+
+               td_sum('Sum');
+               td_empty(2);
+               td_sum(tmp_sum1);
+               td_sum(tmp_sum2);
+               td_empty(7);
+
+               myfoot = tableYUI.createTFoot();
+               myfoot.setAttribute("id","myfoot");
+               myfoot.appendChild(newTR);
+       }
+
+       var FormatterRight = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<div align=\"right\">"+oData+"</div>";
+       }       
+
+
+ 
/********************************************************************************/
+
+
 YAHOO.util.Event.addListener(window, "load", function()
 {
        loader = new YAHOO.util.YUILoader();
@@ -82,7 +124,7 @@
 YAHOO.INVOICE.BorderLayout = function()
 {
 
-       if(invoice_layout_config != 'undefined')
+       if(typeof (invoice_layout_config) != 'undefined')
        {
                this.config = invoice_layout_config.length == 0 ? {} : 
invoice_layout_config;
        }
@@ -181,43 +223,3 @@
                elCell.innerHTML = "<center>"+oData+"</center>";
        }
 
-       this.execute_async = function(datatable, incoming_url)
-       {
-               if(typeof(incoming_url) != 'undefined')
-               {
-                       base_java_url = incoming_url;
-               }
-
-               ds = phpGWLink('index.php',base_java_url,true);
-               
-               var callback =
-               {
-                       success: function(o)
-                       {
-                               eval("values_ds ="+o.responseText);
-                               if(values_ds=="")
-                               {
-                                       update_datatable(datatable);
-                               }
-                               else
-                               {
-                                       eval("values_ds ="+values_ds);
-                                       update_datatable(datatable);
-                               }
-
-                       },
-                       failure: function(o) {window.alert('Server or your 
connection is dead.')},
-                       timeout: 10000,
-                       cache: false
-               }
-               try
-               {
-                       YAHOO.util.Connect.asyncRequest('POST',ds,callback);
-               }
-               catch(e_async)
-               {
-                  alert(e_async.message);
-               }
-       }
-
-

Modified: trunk/property/templates/base/invoice2.xsl
===================================================================
--- trunk/property/templates/base/invoice2.xsl  2012-04-19 13:34:45 UTC (rev 
9186)
+++ trunk/property/templates/base/invoice2.xsl  2012-04-19 20:12:42 UTC (rev 
9187)
@@ -19,6 +19,7 @@
 
 <!-- separate tabs and  inline tables-->
 
+
 <xsl:template match="data" xmlns:php="http://php.net/xsl";>
 <style type="text/css">
 #box { width: 200px; height: 5px; background: blue; }
@@ -80,9 +81,11 @@
 
 <xsl:template name="invoice" xmlns:php="http://php.net/xsl";>
        <!-- loads translations into array for use with javascripts -->
+       <!--
        <script type="text/javascript">
                var lang = <xsl:value-of select="php:function('js_lang', 
'edit')"/>;
        </script>
+       -->
                <script type="text/javascript">
                        var invoice_layout_config = <xsl:value-of 
select="invoice_layout_config"/>;
                </script>
@@ -122,9 +125,10 @@
                                </xsl:when>
                        </xsl:choose>
 
+                               <div id="receipt"></div>
                                <div class="body">
                                        <div id="voucher_details">
-                                               <xsl:call-template 
name="yui_phpgw_i18n"/>
+                                               <!--<xsl:call-template 
name="yui_phpgw_i18n"/>-->
                                                <table align = "center" 
width="95%">
                                                        <xsl:apply-templates 
select="filter_form" />
                                                        <xsl:apply-templates 
select="filter_invoice" />
@@ -241,7 +245,6 @@
                                <select id="voucher_id_filter" 
name="voucher_id_filter">
                                        <xsl:apply-templates 
select="voucher_list/options"/>
                                </select>
-                               <input type="text" name="refresch_voucher_id" 
id="refresch_voucher_id" value=""/>
                        </form>
                        <form id="update_table_dummy" method='POST' action='' 
></form>
                </td>




reply via email to

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