fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [9107] invoice handling


From: Sigurd Nes
Subject: [Fmsystem-commits] [9107] invoice handling
Date: Mon, 09 Apr 2012 17:14:14 +0000

Revision: 9107
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9107
Author:   sigurdne
Date:     2012-04-09 17:14:14 +0000 (Mon, 09 Apr 2012)
Log Message:
-----------
invoice handling

Modified Paths:
--------------
    trunk/property/inc/class.bocommon.inc.php
    trunk/property/inc/class.boinvoice.inc.php
    trunk/property/inc/class.menu.inc.php
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/setup/phpgw_no.lang

Added Paths:
-----------
    trunk/property/inc/class.uiinvoice2.inc.php
    trunk/property/js/portico/ajax_invoice.js
    trunk/property/templates/base/common.xsl
    trunk/property/templates/base/invoice2.xsl

Modified: trunk/property/inc/class.bocommon.inc.php
===================================================================
--- trunk/property/inc/class.bocommon.inc.php   2012-04-09 17:07:12 UTC (rev 
9106)
+++ trunk/property/inc/class.bocommon.inc.php   2012-04-09 17:14:14 UTC (rev 
9107)
@@ -428,6 +428,13 @@
                                                );
                                }
                        }
+
+                       foreach ($user_list as &$user)
+                       {
+                               $user['id'] = $user['lid'];
+                               $user['name'] = ltrim("{$user['lastname']}, 
{$user['firstname']}",', ');
+                       }
+
                        return $user_list;
                }
 

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2012-04-09 17:07:12 UTC (rev 
9106)
+++ trunk/property/inc/class.boinvoice.inc.php  2012-04-09 17:14:14 UTC (rev 
9107)
@@ -240,15 +240,21 @@
 
                function period_list($selected='')
                {
+                       $year = date('Y');
+                       $period_list = array();
                        for ($i=1; $i<=12; $i++)
                        {
-                               $period_list[$i]['id'] = $i;
-                               $period_list[$i]['name'] = $i;
-                               if($i==$selected)
-                               {
-                                       $period_list[$i]['selected'] = 
'selected';
-                               }
+                               $period = sprintf("%s%02d",$year,$i);
+                               $period_list[] = array
+                               (
+                                       'id'    => $period,
+                                       'name'  => $period
+                               );
                        }
+                       foreach ($period_list as &$_period)
+                       {
+                               $_period['selected'] = $_period['id'] == 
$selected ? 1 : 0;
+                       }
                        return $period_list;
                }
 
@@ -789,6 +795,11 @@
 
                public function forward($data)
                {
-                       return $this->so->forward($data);               
+                       return $this->so->forward($data);
                }
+
+               public function get_vouchers($data)
+               {
+                       return $this->so->get_vouchers($data);
+               }
        }

Modified: trunk/property/inc/class.menu.inc.php
===================================================================
--- trunk/property/inc/class.menu.inc.php       2012-04-09 17:07:12 UTC (rev 
9106)
+++ trunk/property/inc/class.menu.inc.php       2012-04-09 17:14:14 UTC (rev 
9107)
@@ -813,7 +813,7 @@
                                                        'text'  =>      
lang('Add')
                                                );
                                }
-                               if ( $acl->check('.invoice', PHPGW_ACL_ADD, 
'property') )
+//                             if ( $acl->check('.invoice', PHPGW_ACL_ADD, 
'property') )
                                {
                                        $children['invoice2'] = array
                                                (

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2012-04-09 17:07:12 UTC (rev 
9106)
+++ trunk/property/inc/class.soinvoice.inc.php  2012-04-09 17:14:14 UTC (rev 
9107)
@@ -1225,21 +1225,31 @@
 
                function read_single_voucher($bilagsnr = 0, $id = 0)
                {
+                       $table = 'fm_ecobilag';
+
                        $bilagsnr =(int)$bilagsnr;
                        $id = (int)$id;
+
                        if($bilagsnr)
                        {
-                               $sql = "SELECT * from fm_ecobilag WHERE 
bilagsnr ='$bilagsnr'";
+                               $filtermethod= "WHERE bilagsnr ='$bilagsnr'";
                        }
                        else if ($id)
                        {
-                               $sql = "SELECT * from fm_ecobilag WHERE id 
='$id'";
+                               $filtermethod= " WHERE {$table}.id ='{$id}'";
                        }
                        else
                        {
                                return array();
                        }                       
 
+                       $sql = "SELECT {$table}.*,fm_workorder_status.descr as 
status, fm_workorder.charge_tenant,org_name,"
+                               . "fm_workorder.claim_issued, 
fm_workorder_status.closed FROM {$table}"
+                               . " {$this->left_join} fm_workorder ON 
fm_workorder.id = {$table}.pmwrkord_code"
+                               . " {$this->left_join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
+                               . " {$this->left_join} fm_project ON 
fm_workorder.project_id = fm_project.id"
+                               . " {$this->join} fm_vendor ON 
$table.spvend_code = fm_vendor.id {$filtermethod}";
+
                        $this->db->query($sql,__LINE__,__FILE__);
 
                        $values = array();
@@ -1247,16 +1257,18 @@
                        {
                                $values[] = array
                                        (
+                                               'voucher_id'                    
=> $this->db->f('bilagsnr'),
                                                'id'                            
        => $this->db->f('id'),
                                                'art'                           
        => $this->db->f('artid'),
                                                'type'                          
        => $this->db->f('typeid'),
                                                'dim_a'                         
        => $this->db->f('dima'),
                                                'dim_b'                         
        => $this->db->f('dimb'),
                                                'dim_d'                         
        => $this->db->f('dimd'),
-                                               'tax'                           
        => $this->db->f('mvakode'),
+                                               'tax_code'                      
        => $this->db->f('mvakode'),
                                                'invoice_id'                    
=> $this->db->f('fakturanr'),
                                                'kid_nr'                        
        => $this->db->f('kidnr'),
                                                'vendor_id'                     
        => $this->db->f('spvend_code'),
+                                               'vendor'                        
        => $this->db->f('org_name', true),
                                                'janitor'                       
        => $this->db->f('oppsynsmannid'),
                                                'supervisor'                    
=> $this->db->f('saksbehandlerid'),
                                                'budget_responsible'    => 
$this->db->f('budsjettansvarligid'),
@@ -1277,6 +1289,14 @@
                                                'oppsynsigndato'                
=> $this->db->f('oppsynsigndato'),
                                                'saksigndato'                   
=> $this->db->f('saksigndato'),
                                                'budsjettsigndato'              
=> $this->db->f('budsjettsigndato'),
+                                               'charge_tenant'                 
=> $this->db->f('charge_tenant'),
+                                               'external_ref'                  
=> $this->db->f('external_ref'),
+                                               'status'                        
        => $this->db->f('status'),
+                                               'closed'                        
        => $this->db->f('closed'),
+                                               'parked'                        
        => $this->db->f('kreditnota'),
+                                               'period'                        
        => $this->db->f('periode'),
+                                               'periodization'                 
=> $this->db->f('periodization'),
+                                               'periodization_start'   => 
$this->db->f('periodization_start'),
                                        );
                        }
 
@@ -1732,4 +1752,87 @@
 
                        return false;
                }
+
+               public function get_vouchers($data)
+               {
+                       $filtermethod = '';
+                       $querymethod = '';
+                       $where = 'WHERE';
+
+                       if($data['janitor_lid'])
+                       {
+                               $data['janitor_lid'] = 
ltrim($data['janitor_lid'],'*');
+                               $filtermethod = "$where oppsynsmannid = 
'{$data['janitor_lid']}'";
+                               $where = 'AND';
+                       }
+
+                       if($data['supervisor_lid'])
+                       {
+                               if( stripos($data['supervisor_lid'],'*') === 0)
+                               {
+                                       $data['supervisor_lid'] = 
ltrim($data['supervisor_lid'],'*');
+                                       $filtermethod .= " $where 
oppsynsigndato IS NOT NULL";
+                                       $where = 'AND';
+                               }
+
+                               $filtermethod .= " $where saksbehandlerid = 
'{$data['supervisor_lid']}'";
+                               $where = 'AND';
+                       }
+
+                       if($data['budget_responsible_lid'])
+                       {
+                               if( 
stripos($data['budget_responsible_lid'],'*') === 0)
+                               {
+                                       $data['budget_responsible_lid'] = 
ltrim($data['budget_responsible_lid'],'*');
+                                       $filtermethod .= " $where saksigndato 
IS NOT NULL";
+                                       $where = 'AND';
+                               }
+                               $filtermethod .= " $where budsjettansvarligid = 
'{$data['budget_responsible_lid']}'";
+                               $where = 'AND';
+                       }
+
+                       if($data['query'])
+                       {
+                               $query = (int) $data['query'];
+                               $querymethod = " $where (bilagsnr = {$query} OR 
bilagsnr_ut = {$query})";
+                               $where = 'AND';
+                       }
+
+                       $sql = "SELECT DISTINCT bilagsnr,bilagsnr_ut, org_name, 
currency, kreditnota, fm_ecoart.descr as type, sum(godkjentbelop) as 
godkjentbelop FROM fm_ecobilag"
+                       ." {$this->join} fm_vendor ON fm_vendor.id = 
fm_ecobilag.spvend_code"
+                       ." {$this->join} fm_ecoart ON fm_ecoart.id = 
fm_ecobilag.artid"
+                       ." $filtermethod $querymethod"
+                       ." GROUP BY bilagsnr,bilagsnr_ut, org_name, currency, 
kreditnota, fm_ecoart.descr";
+
+                       $lang_voucer = lang('voucher id');
+                       $lang_vendor = lang('vendor');
+                       $lang_currency = lang('currency');
+                       $lang_parked = lang('parked');
+                       $lang_type = lang('type');
+                       $lang_approved_amount = lang('approved amount');
+                       
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $values = array();
+
+                       while($this->db->next_record())
+                       {
+                               $id = $this->db->f('bilagsnr_ut') ? 
$this->db->f('bilagsnr_ut') : $this->db->f('bilagsnr');
+                               $name = sprintf("{$lang_voucer}:% 8s | 
{$lang_vendor}:% 20s | {$lang_currency}:% 3s | {$lang_parked}: % 1s | 
{$lang_type}: % 12s | {$lang_approved_amount}: % 19s",
+                                                       $id,
+                                                       
trim(strtoupper($this->db->f('org_name',true))),
+                                                       
$this->db->f('currency'),
+                                                       
$this->db->f('kreditnota') ? 'X' : '',
+                                                       $this->db->f('type'),
+                                                       
number_format($this->db->f('godkjentbelop'), 2, ',', ' ')
+                                               );
+
+                               $values[] = array
+                               (
+                                       'id'    => $id,
+                                       'name'  => $name
+                               );
+                       }
+                       return $values;
+               }
+
        }

Added: trunk/property/inc/class.uiinvoice2.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice2.inc.php                         (rev 0)
+++ trunk/property/inc/class.uiinvoice2.inc.php 2012-04-09 17:14:14 UTC (rev 
9107)
@@ -0,0 +1,345 @@
+<?php
+       /**
+       * phpGroupWare - registration
+       *
+       * @author Sigurd Nes <address@hidden>
+       * @copyright Copyright (C) 2011,2012 Free Software Foundation, Inc. 
http://www.fsf.org/
+       * This file is part of phpGroupWare.
+       *
+       * phpGroupWare is free software; you can redistribute it and/or modify
+       * it under the terms of the GNU General Public License as published by
+       * the Free Software Foundation; either version 2 of the License, or
+       * (at your option) any later version.
+       *
+       * phpGroupWare is distributed in the hope that it will be useful,
+       * but WITHOUT ANY WARRANTY; without even the implied warranty of
+       * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+       * GNU General Public License for more details.
+       *
+       * You should have received a copy of the GNU General Public License
+       * along with phpGroupWare; if not, write to the Free Software
+       * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301 
 USA
+       *
+       * @license http://www.gnu.org/licenses/gpl.html GNU General Public 
License
+       * @internal Development of this application was funded by 
http://www.bergen.kommune.no/
+       * @package registration
+       * @version $Id: class.uicheck_list.inc.php 8628 2012-01-21 10:42:05Z 
vator $
+       */
+
+       phpgw::import_class('phpgwapi.yui');
+       phpgw::import_class('registration.uicommon');
+/*
+       include_class('registration', 'check_list', 'inc/model/');
+       include_class('registration', 'date_generator', 'inc/component/');
+       include_class('registration', 'status_checker', 'inc/helper/');
+       include_class('registration', 'date_helper', 'inc/helper/');
+*/     
+       class property_uiinvoice2 extends registration_uicommon
+       {
+               var $cat_id;
+               var $start;
+               var $query;
+               var $sort;
+               var $order;
+               var $filter;
+               var $currentapp;
+               var $type_id;
+               var $location_code;
+       
+               private $so_control_area;
+               private $so_control;
+               private $so_check_list;
+               private $so_control_item;
+               private $so_check_item;
+               private $so_procedure;
+
+               var $public_functions = array
+               (
+                       'index'                                                 
        => true,
+                       'query'                                                 
        => true,
+                       'edit'                                                  
        => true,
+                       'get_vouchers'                                          
=> true,
+                       'get_single_voucher'                            => true
+               );
+
+               function __construct()
+               {
+                       parent::__construct();
+               
+                       $this->account_id                       = 
$GLOBALS['phpgw_info']['user']['account_id'];
+                       $this->bo                                       = 
CreateObject('property.boinvoice',true);
+                       $this->bocommon                         = 
CreateObject('property.bocommon');
+                       $this->start                            = 
$this->bo->start;
+                       $this->query                            = 
$this->bo->query;
+                       $this->sort                                     = 
$this->bo->sort;
+                       $this->order                            = 
$this->bo->order;
+                       $this->filter                           = 
$this->bo->filter;
+                       $this->status_id                        = 
$this->bo->status_id;
+                       $this->allrows                          = 
$this->bo->allrows;
+               
+                       self::set_active_menu('property::invoice::invoice2');
+               }
+
+               function index()
+               {
+                       $voucher_id     = phpgw::get_var('voucher_id', 'int');
+                       
+                       if($values = phpgw::get_var('values'))
+                       {
+                               $values['pending_users'] = 
isset($values['pending_users']) && $values['pending_users'] ? 
array_unique($values['pending_users']) : array();
+                               $values['pending_users_orig'] = 
isset($values['pending_users_orig']) && $values['pending_users_orig'] ? 
array_unique($values['pending_users_orig']) : array();
+                               
+                               $receipt = $this->bo->approve_users($values);
+                               $GLOBALS['phpgw']->redirect_link('/index.php', 
array('menuaction' => 'registration.uipending.index'));
+                       }
+                       else
+                       {
+                               if(phpgw::get_var('phpgw_return_as') == 'json')
+                               {
+                                       return $this->query();
+                               }
+
+                               $status_list = array
+                               (
+                                       array
+                                       (
+                                               'id'    => 0,
+                                               'name'  => lang('Select status')
+                                       ),
+                                       array
+                                       (
+                                               'id'    => 1,
+                                               'name'  => lang('approved')
+                                       ),
+                                       array
+                                       (
+                                               'id'    => 2,
+                                               'name'  => lang('pending')
+                                       ),
+                               );
+
+
+
+                               $janitor_list                           = 
$this->bocommon->get_user_list_right(32,$janitor,'.invoice');
+                               $supervisor_list                        = 
$this->bocommon->get_user_list_right(64,$supervisor,'.invoice');
+                               $budget_responsible_list        = 
$this->bocommon->get_user_list_right(128,$budget_responsible,'.invoice');
+
+                               $userlist_default = array();
+                               $userlist_default[] = array('id'=> '*' . 
$GLOBALS['phpgw']->accounts->get($this->account_id)->lid, 'name'=>lang('mine 
vouchers'));
+                               $userlist_default[] = 
array('id'=>'','name'=>lang('no user'));
+
+                               $voucher_list = array('id' => '', 'name' => 
lang('select'));
+
+                               foreach($userlist_default as $default)
+                               {
+                                       $janitor_list = 
array_merge(array($default), $janitor_list);
+                                       $supervisor_list = 
array_merge(array($default), $supervisor_list);
+                                       $budget_responsible_list = 
array_merge(array($default), $budget_responsible_list);
+                               }
+
+                               $data = array(
+                                       'filter_form'                           
=> array
+                                       (
+                                               'janitor_list'                  
        => array('options' => $janitor_list),
+                                               'supervisor_list'               
        => array('options' => $supervisor_list),
+                                               'budget_responsible_list'       
=> array('options' => $budget_responsible_list),
+                                       ),
+                                       'filter_invoice'                        
        => array
+                                       (
+                                               'voucher_list'                  
        => array('options' => $voucher_list),
+                                       ),
+                                       'voucher_info'                          
        => $this->get_single_voucher($voucher_id),
+                                       'datatable' => array(
+                                               'source' => 
self::link(array('menuaction' => 'registration.uipending.query', 
'phpgw_return_as' => 'json')),
+                                               'field' => array(
+                                                       array(
+                                                               'key' => 'id',
+                                                               'hidden' => true
+                                                       ),
+                                                       array(
+                                                               'key' => 
'reg_id',
+                                                               'label' => 
lang('id'),
+                                                               'sortable'      
=> true,
+                                                               'formatter' => 
'formatLinkPending'
+                                                       ),
+                                                       array(
+                                                               'key'   =>      
'reg_lid',
+                                                               'label' =>      
lang('user'),
+                                                               'sortable'      
=>      true
+                                                       ),
+                                                       array(
+                                                               'key' => 
'reg_dla',
+                                                               'label' => 
lang('time'),
+                                                               'sortable'      
=> true
+                                                       ),
+                                                       array(
+                                                               'key' => 
'reg_approved',
+                                                               'label' => 
lang('approved'),
+                                                               'sortable'      
=> true,
+                                                               'formatter' => 
'FormatterCenter'
+                                                       ),
+                                                       array(
+                                                               'key' => 
'location_code',
+                                                               'label' => 
lang('location'),
+                                                               'sortable'      
=> false
+                                                       ),
+
+                                                       array(
+                                                                       'key' 
=> 'checked',
+                                                                       'label' 
=> lang('approve'),
+                                                                       
'sortable' => false,
+                                                                       
'formatter' => 'formatterCheckPending',
+                                                                       
'className' => 'mychecks'
+                                                       ),
+                                                       array(
+                                                               'key' => 
'actions',
+                                                               'hidden' => true
+                                                       ),
+                                                       array(
+                                                               'key' => 
'labels',
+                                                               'hidden' => true
+                                                       ),
+                                                       array(
+                                                               'key' => 'ajax',
+                                                               'hidden' => true
+                                                       ),array(
+                                                               'key' => 
'parameters',
+                                                               'hidden' => true
+                                                       )                       
                
+                                               )
+                                       )
+                               );
+//_debug_array($data);die();                   
+                               phpgwapi_yui::load_widget('paginator');
+
+                               self::add_javascript('registration', 'yahoo', 
'pending.index.js');
+                               self::add_javascript('controller', 
'controller', 'jquery.js');
+                               self::add_javascript('property', 'portico', 
'ajax_invoice.js');
+
+                               self::render_template_xsl(array('invoice2', 
'common'), $data);
+                       }       
+               }
+       
+
+               public function query()
+               {
+                       $status_id = phpgw::get_var('status_id');
+
+                       $this->bo->start = phpgw::get_var('startIndex');
+               
+                       $user_list = $this->bo->read(array('user_id' => 
$user_id, 'role_id' =>$role_id, 
'type_id'=>$type_id,'lookup_tenant'=>$lookup_tenant,
+                                                                               
                   'lookup'=>$lookup,'allrows'=>$this->allrows,'dry_run' 
=>$dry_run));
+                       
+                       foreach($user_list as &$user)
+                       {
+                               $reg_info = 
unserialize(base64_decode($user['reg_info']));
+                               $user['location_code'] = 
$reg_info['location_code'];
+                               $results['results'][]= $user;
+                       }
+                       $results['total_records'] = $this->bo->total_records;
+                       $results['start'] = $this->start;
+                       $results['sort'] = 'location_code';
+                       $results['dir'] = $this->bo->sort ? $this->bo->sort : 
'ASC';
+                                       
+                       array_walk($results['results'], array($this, 
'add_links'), array($type));
+                                               
+                       return $this->yui_results($results);
+               }
+
+               public function get_vouchers()
+               {
+                       $janitor_lid                    = 
phpgw::get_var('janitor_lid', 'string');
+                       $supervisor_lid                 = 
phpgw::get_var('supervisor_lid', 'string');
+                       $budget_responsible_lid = 
phpgw::get_var('budget_responsible_lid', 'string');
+                       $query                                  = 
phpgw::get_var('query', 'string');
+
+                       $vouchers = $this->bo->get_vouchers(array('janitor_lid' 
=> $janitor_lid, 'supervisor_lid' => $supervisor_lid, 'budget_responsible_lid' 
=>$budget_responsible_lid, 'query' => $query ));
+
+                       return $vouchers;
+               }
+               public function get_single_voucher($voucher_id = 0)
+               {
+                       $voucher_id     = $voucher_id ? $voucher_id : 
phpgw::get_var('voucher_id', 'int');
+                       $voucher_info = array();
+                       
+                       $voucher = $this->bo->read_single_voucher($voucher_id);
+                       $dateformat = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat'];
+
+                       $custom_config  = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
+                       $baseurl_invoice = 
isset($custom_config->config_data['common']['baseurl_invoice']) && 
$custom_config->config_data['common']['baseurl_invoice'] ? 
$custom_config->config_data['common']['baseurl_invoice'] : '';
+
+                       $_last_period_last_year = (string)(date('Y') -1) . '12';
+                       $period_list = $this->bo->period_list();
+                       $periodization_start_list = $period_list;
+                       array_unshift($period_list,array ('id'=> 
$_last_period_last_year,'name'=> $_last_period_last_year));
+
+                       $period_list = 
$this->bocommon->select_list(isset($voucher[0]['period']) ? 
$voucher[0]['period'] : '', $period_list);
+                       $periodization_start_list = 
$this->bocommon->select_list(isset($voucher[0]['period']) ? 
$voucher[0]['period'] : '', $periodization_start_list);
+
+                       array_unshift($period_list,array ('id'=> 0,'name'=> 
lang('select')));
+                       array_unshift($periodization_start_list,array ('id'=> 
0,'name'=> lang('select')));
+
+                       $voucher_info['generic']['period_list']['options'] = 
$period_list;
+                       
$voucher_info['generic']['periodization_start_list']['options'] = 
$periodization_start_list;
+                       
+                       if(count($voucher))
+                       {
+                               $voucher_info['generic']['approved_amount'] = 0;
+                               $voucher_info['generic']['amount'] = 0;
+                               foreach ($voucher as $line)
+                               {
+                                       
$voucher_info['generic']['approved_amount'] += $line['approved_amount'];
+                                       $voucher_info['generic']['amount']  += 
$line['amount']; 
+                               }
+
+                               $voucher_info['generic']['approved_amount'] = 
number_format($voucher_info['generic']['approved_amount'], 2, ',', ' ');
+                               $voucher_info['generic']['amount'] = 
number_format($voucher_info['generic']['amount'], 2, ',', ' ');
+                               
$voucher_info['generic']['dimb_list']['options']                = 
$this->bo->select_dimb_list($voucher[0]['dim_b']);
+                               
$voucher_info['generic']['tax_code_list']['options']    = 
$this->bo->tax_code_list($voucher[0]['tax_code']);
+                               
$voucher_info['generic']['periodization_list']['options'] = 
execMethod('property.bogeneric.get_list', array('type'=>'periodization', 
'selected' => $voucher[0]['periodization'] ));
+
+
+                               $voucher[0]['invoice_date'] = 
$voucher[0]['invoice_date'] ?  $GLOBALS['phpgw']->common->show_date( strtotime( 
$voucher[0]['invoice_date'] ), $dateformat ) : '';
+                               $voucher[0]['payment_date'] = 
$voucher[0]['payment_date'] ?  $GLOBALS['phpgw']->common->show_date( strtotime( 
$voucher[0]['payment_date'] ), $dateformat ) : '';
+                               $voucher[0]['oppsynsigndato'] = 
$voucher[0]['oppsynsigndato'] ?  $GLOBALS['phpgw']->common->show_date( 
strtotime( $voucher[0]['oppsynsigndato'] ), $dateformat ) : '';
+                               $voucher[0]['saksigndato'] = 
$voucher[0]['saksigndato'] ?  $GLOBALS['phpgw']->common->show_date( strtotime( 
$voucher[0]['saksigndato'] ), $dateformat) : '';
+                               $voucher[0]['budsjettsigndato'] = 
$voucher[0]['budsjettsigndato'] ?  $GLOBALS['phpgw']->common->show_date( 
strtotime( $voucher[0]['budsjettsigndato'] ),$dateformat ) : '';
+
+                               if($voucher[0]['remark'])
+                               {
+                                       $voucher[0]['remark_link']= " <a 
href=\"javascript:openwindow('".$GLOBALS['phpgw']->link('/index.php', array
+                                               (
+                                                       'menuaction'=> 
'property.uiinvoice.remark',
+                                                       'id'            => 
$voucher[0]['id'],
+                                               )). "','550','400')\" 
>".lang('Remark')."</a>";
+                               }
+                               if($voucher[0]['order_id'])
+                               {
+                                       $voucher[0]['order_link']= 
$GLOBALS['phpgw']->link('/index.php', array
+                                               (
+                                                       'menuaction'    => 
'property.uiinvoice.view_order',
+                                                       'order_id'              
=> $voucher[0]['order_id']
+                                               ));
+                               }
+
+                               if($voucher[0]['external_ref'])
+                               {
+                                       $voucher[0]['external_ref'] = " <a 
href=\"javascript:openwindow('{$baseurl_invoice}{$voucher[0]['external_ref']}','640','800')\"
 >" . lang('invoice id') . '</a>';
+                               }
+
+                       }
+                       else
+                       {
+                               
$voucher_info['generic']['dimb_list']['options']                = 
$this->bo->select_dimb_list();
+                               
$voucher_info['generic']['tax_code_list']['options']    = 
$this->bo->tax_code_list();
+                               
$voucher_info['generic']['periodization_list']['options'] = 
execMethod('property.bogeneric.get_list', array('type'=>'periodization'));
+                       }
+                       array_unshift 
($voucher_info['generic']['dimb_list']['options'],array 
('id'=>'','name'=>lang('select')));
+                       array_unshift 
($voucher_info['generic']['periodization_list']['options'],array('id' => '0', 
'name' => lang('none')));
+
+                       $voucher_info['voucher'] = $voucher;
+//_debug_array($voucher_info);
+
+                       return $voucher_info;
+               }
+       }

Added: trunk/property/js/portico/ajax_invoice.js
===================================================================
--- trunk/property/js/portico/ajax_invoice.js                           (rev 0)
+++ trunk/property/js/portico/ajax_invoice.js   2012-04-09 17:14:14 UTC (rev 
9107)
@@ -0,0 +1,970 @@
+$(document).ready(function(){
+       
+       // When janitor is selected, vouchers are fetched from db and voucer 
select list is populated
+       $("#janitor_lid").change(function () {
+//             var janitor_lid = $(this).val();
+               var janitor_lid = $("#janitor_lid").val();
+               var supervisor_lid = $("#supervisor_lid").val();
+               var budget_responsible_lid = $("#budget_responsible_lid").val();
+               var query = $("#query").val();
+
+               var oArgs = {menuaction:'property.uiinvoice2.get_vouchers'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+      
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&janitor_lid=" + janitor_lid + 
"&supervisor_lid=" + supervisor_lid + "&budget_responsible_lid=" + 
budget_responsible_lid + "&query=" + query,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       htmlString  = "<option>" + data.length 
+ " bilag funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
bilag</option>"
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                       } 
+                       });
+               
+    });
+
+       $("#supervisor_lid").change(function () {
+//             var janitor_lid = $(this).val();
+               var janitor_lid = $("#janitor_lid").val();
+               var supervisor_lid = $("#supervisor_lid").val();
+               var budget_responsible_lid = $("#budget_responsible_lid").val();
+               var query = $("#query").val();
+
+               var oArgs = {menuaction:'property.uiinvoice2.get_vouchers'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+      
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&janitor_lid=" + janitor_lid + 
"&supervisor_lid=" + supervisor_lid + "&budget_responsible_lid=" + 
budget_responsible_lid + "&query=" + query,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       htmlString  = "<option>" + data.length 
+ " bilag funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
bilag</option>"
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                       } 
+                       });
+               
+    });
+
+       $("#budget_responsible_lid").change(function () {
+               var janitor_lid = $("#janitor_lid").val();
+               var supervisor_lid = $("#supervisor_lid").val();
+               var budget_responsible_lid = $("#budget_responsible_lid").val();
+               var query = $("#query").val();
+
+               var oArgs = {menuaction:'property.uiinvoice2.get_vouchers'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+      
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&janitor_lid=" + janitor_lid + 
"&supervisor_lid=" + supervisor_lid + "&budget_responsible_lid=" + 
budget_responsible_lid + "&query=" + query,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       htmlString  = "<option>" + data.length 
+ " bilag funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
bilag</option>"
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                       } 
+                       });
+               
+    });
+
+
+//     $("#queryForm").submit(function(e){
+       $("#search").click(function(e){
+               var janitor_lid = $("#janitor_lid").val();
+               var supervisor_lid = $("#supervisor_lid").val();
+               var budget_responsible_lid = $("#budget_responsible_lid").val();
+               var query = $("#query").val();
+               var oArgs = {menuaction:'property.uiinvoice2.get_vouchers'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               var htmlString = "";
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&janitor_lid=" + janitor_lid + 
"&supervisor_lid=" + supervisor_lid + "&budget_responsible_lid=" + 
budget_responsible_lid + "&query=" + query,
+                       success: function(data) {
+                               if( data != null)
+                               {
+                                       htmlString  = "<option>" + data.length 
+ " bilag funnet</option>"
+                                       var obj = data;
+
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                               else
+                               {
+                                       htmlString  += "<option>Ingen 
bilag</option>"
+                                       $("#voucher_id_filter").html( 
htmlString );
+                               }
+                       }
+                       });
+       });
+
+
+
+
+       $("#voucher_id_filter").change(function () {
+               var voucher_id = $(this).val();
+               var oArgs = 
{menuaction:'property.uiinvoice2.get_single_voucher'};
+               var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&voucher_id=" + voucher_id,
+                       success: function(data) {
+                               var voucher = data['voucher'];
+                               if( voucher != null && voucher.length > 0)
+                               {
+                                       $("#voucher_id").val( voucher_id );
+               
+                                       $("#voucher_id_text").html( voucher_id 
);
+                                       $("#order_id").val( voucher[0].order_id 
);
+
+                                       if(voucher[0].order_id)
+                                       {
+                                               var oArgs_order = 
{menuaction:'property.uiinvoice.view_order', order_id: voucher[0].order_id};
+                                               var requestUrl_order = 
phpGWLink('index.php', oArgs_order);
+                                               var htmlString_order  =  " <a 
target= \"_blank\" href=\"" + requestUrl_order + "\" title=\"" + 
voucher[0].status + "\" > Bestilling</a>";
+                                               $("#order_text").html( 
htmlString_order );
+                                       }
+                                       else
+                                       {
+                                               $("#order_text").html( 
'Bestilling' );
+                                       }
+
+                                       $("#project_group").val( 
voucher[0].project_group );
+
+                                       if(voucher[0].external_ref)
+                                       {
+                                               
$("#invoice_id_text").html(voucher[0].external_ref );
+                                       }
+                                       else
+                                       {
+                                               
$("#invoice_id_text").html('FakturaNr');
+                                       }
+
+                                       $("#invoice_id").html( 
voucher[0].invoice_id );
+                                       $("#kid_nr").html( voucher[0].kid_nr );
+                                       $("#vendor").html( voucher[0].vendor );
+                                       $("#janitor").html( voucher[0].janitor 
);
+                                       $("#supervisor").html( 
voucher[0].supervisor );
+                                       $("#budget_responsible").html( 
voucher[0].budget_responsible );
+                                       $("#invoice_date").html( 
voucher[0].invoice_date );
+                                       $("#payment_date").html( 
voucher[0].payment_date );
+                                       $("#b_account_id").val( 
voucher[0].b_account_id );
+                                       $("#dim_a").val( voucher[0].dim_a );
+                                       $("#amount").html( 
data['generic'].amount );
+                                       $("#approved_amount").html( 
data['generic'].approved_amount );
+                                       $("#currency").html( 
voucher[0].currency );
+                                       $("#oppsynsigndato").html( 
voucher[0].oppsynsigndato );
+                                       $("#saksigndato").html( 
voucher[0].saksigndato );
+                                       $("#budsjettsigndato").html( 
voucher[0].budsjettsigndato );
+                                       if(voucher[0].merknad)
+                                       {
+                                               var oArgs_remark = 
{menuaction:'property.uiinvoice.remark', id: voucher[0].id};
+                                               var requestUrl_remark = 
phpGWLink('index.php', oArgs_remark);
+
+                                               var htmlString  =  " <a 
href=\"javascript:openwindow('" +requestUrl_remark + "','550','400')\" > 
Remark</a>";
+
+                                               $("#remark").html( htmlString );
+                                       }
+//---------
+                                       var checked_park_invoice = "";
+                                       var park_invoice_status = "";
+                                       if(voucher[0].parked)
+                                       {
+                                               checked_park_invoice = "checked 
= \"checked\"";
+                                               var park_invoice_status = " X";
+                                       }
+                                       var htmlString_park_invoice = "<input 
type=\"checkbox\" name=\"values[park_invoice]\" value=\"1\" title=\"park 
invoice\"" + checked_park_invoice + "></input>" + park_invoice_status;
+                                       $("#park_order").html( 
htmlString_park_invoice );
+//---------
+                                       var checked_close_order = "";
+                                       var close_order_status = " " + 
voucher[0].status;
+                                       if(voucher[0].closed)
+                                       {
+                                               checked_close_order = "checked 
= \"checked\"";
+                                       }
+                                       var htmlString_close_order = "<input 
type=\"checkbox\" name=\"values[close_order]\" value=\"1\" title=\"close 
order\"" + checked_close_order + "></input>" + close_order_status;
+                                       $("#close_order").html( 
htmlString_close_order );
+//---------
+
+                                       
if(data['generic']['dimb_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               var obj = 
data['generic']['dimb_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].dim_b)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#dim_b").html( htmlString );
+                                       }
+                                       
if(data['generic']['tax_code_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               htmlString  = 
"<option>Velg</option>"
+
+                                               var obj = 
data['generic']['tax_code_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].tax_code)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#tax_code").html( htmlString 
);
+                                       }
+
+                                       
if(data['generic']['period_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               var obj = 
data['generic']['period_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].period)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#period").html( htmlString );
+                                       }
+                                       
if(data['generic']['periodization_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               var obj = 
data['generic']['periodization_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].periodization)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#periodization").html( 
htmlString );
+                                       }
+                                       
if(data['generic']['periodization_start_list']['options'] != 'undefined')
+                                       {
+                                               var htmlString = "";
+
+                                               var obj = 
data['generic']['periodization_start_list']['options'];
+
+                                               $.each(obj, function(i) {
+                                                       var selected = '';
+                                                       if(obj[i].id == 
voucher[0].periodization_start)
+                                                       {
+                                                               selected = ' 
selected';
+                                                       }
+                                                       htmlString  += "<option 
value='" + obj[i].id + "'" + selected + ">" + obj[i].name + "</option>";
+                                               });
+
+                                               $("#periodization_start").html( 
htmlString );
+                                       }
+                               }
+                               else
+                               {
+                                       $("#voucher_id").val( '' );
+                                       $("#voucher_id_text").html( '' );
+                                       $("#order_id").val( '' );
+                                       $("#project_group").val( '' );
+                                       $("#invoice_id").html( '' );
+                                       $("#kid_nr").html( '' );
+                                       $("#vendor").html('' );
+                                       $("#janitor").html( '' );
+                                       $("#supervisor").html( '' );
+                                       $("#budget_responsible").html( '' );
+                                       $("#invoice_date").html( '' );
+                                       $("#payment_date").html( '' );
+                                       $("#b_account_id").val( '' );
+                                       $("#amount").html( '' );
+                                       $("#approved_amount").html( '' );
+                                       $("#currency").html( '' );
+                                       $("#oppsynsigndato").html( '' );
+                                       $("#saksigndato").html( '' );
+                                       $("#budsjettsigndato").html( '' );
+                                       $("#remark").html( '' );
+                                       $("#dim_a").val('' );
+                                       $("#dim_b").html( 
"<option>Velg</option>" );
+                                       $("#period").html( 
"<option>Velg</option>" );
+                                       $("#periodization").html( 
"<option>Velg</option>" );
+                                       $("#periodization_start").html( 
"<option>Velg</option>" );
+                                       $("#tax_code").html( 
"<option>0</option>" );
+                                       $("#order_text").html( 'Bestilling' );
+                                       $("#invoice_id_text").html('FakturaNr');
+                               }
+                       }
+                       });
+    });
+
+
+       // When control area is selected, controls are fetched from db and 
control select list is populated
+       $("#control_area").change(function () {
+                var control_area_id = $(this).val();
+                if(control_area_id == '')
+                        control_area_id = "all";
+                       
+               var oArgs = 
{menuaction:'controller.uicontrol_group.get_control_groups_by_control_area', 
phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               //var requestUrl = 
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
+        
+               var htmlString = "";
+        
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&control_area_id=" + control_area_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Velg 
kontrollgruppe</option>"
+                                       var obj = jQuery.parseJSON(data);
+                                       
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].group_name + "</option>";
+                                       });
+                                                                               
                         
+                                       $("#control_group").html( htmlString );
+                                       }else {
+                                               htmlString  += "<option>Ingen 
kontrollgrupper</option>"
+                                               $("#control_group").html( 
htmlString );
+                                       }
+                       } 
+                       });
+               
+    });
+
+       // When control area is selected, controls are fetched from db and 
control select list is populated
+/*     $("#control_group").change(function () {
+                var control_group_id = $(this).val();
+               var oArgs = 
{menuaction:'controller.uicontrol_group.get_control_area_by_control_group', 
phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+
+               //var requestUrl = 
"index.php?menuaction=controller.uicontrol_group.get_control_groups_by_control_area&phpgw_return_as=json"
+        
+               var htmlString = "";
+        
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&control_group_id=" + 
control_group_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Ingen 
kontrollområde</option>"
+                                       var obj = jQuery.parseJSON(data);
+                                       
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].group_name + "</option>";
+                                       });
+                                                                               
                         
+                                       $("#control_group_id").html( htmlString 
);
+                                       }else {
+                                               htmlString  += "<option>Ingen 
kontrollområder</option>"
+                                               $("#control_group_id").html( 
htmlString );
+                                       }
+                       } 
+                       });
+               
+    });
+*/
+
+       // file: add_component_to_control.xsl
+       // When component category is selected, corresponding component types 
are fetched from db and component type select list is populated
+       $("#ifc").change(function () {
+                var ifc_id = $(this).val();
+               
+                var oArgs = 
{menuaction:'controller.uicheck_list_for_component.get_component_types_by_category',
 phpgw_return_as:'json'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+               //var requestUrl = 
"index.php?menuaction=controller.uicheck_list_for_component.get_component_types_by_category&phpgw_return_as=json"
+        
+               var htmlString = "";
+        
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&ifc=" + ifc_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Velg 
type</option>"
+                                       var obj = jQuery.parseJSON(data);
+                                       
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].name + "</option>";
+                                       });
+                                                                               
                         
+                                       $("#bim_type_id").html( htmlString );
+                                       }else {
+                                               htmlString  += "<option>Ingen 
typer</option>"
+                                               $("#bim_type_id").html( 
htmlString );
+                                       }
+                       } 
+                       });
+               
+    });
+
+       // file: control.xsl
+       // When control area is selected, procedures are fetched from db and 
procedure select list is populated
+       $("#control_area_id").change(function () {
+                var control_area_id = $(this).val();
+               
+                var oArgs = 
{menuaction:'controller.uiprocedure.get_procedures'};
+                var requestUrl = phpGWLink('index.php', oArgs, true);
+               //var requestUrl = 
"index.php?menuaction=controller.uiprocedure.get_procedures&phpgw_return_as=json"
+        
+               var htmlString = "";
+        
+               $.ajax({
+                       type: 'POST',
+                       dataType: 'json',
+                       url: requestUrl + "&control_area_id=" + control_area_id,
+                       success: function(data) {
+                               if( data != null){
+                                       htmlString  = "<option>Velg 
prosedyre</option>"
+                                       var obj = jQuery.parseJSON(data);
+                                       
+                                       $.each(obj, function(i) {
+                                               htmlString  += "<option 
value='" + obj[i].id + "'>" + obj[i].title + "</option>";
+                                       });
+                                                                               
                         
+                                       $("#procedure_id").html( htmlString );
+                                       }
+                                       else
+                                       {
+                                               htmlString  += "<option>Ingen 
prosedyrer</option>"
+                                       $("#procedure_id").html( htmlString );  
                 
+                                       }
+                       } 
+                       });
+    });
+               
+       $("#frm_save_control_groups").submit(function(e){
+               var thisForm = $(this);
+               var num_checked = $(this).find("input:checked").length;
+       
+               if(num_checked == 0){
+                       e.preventDefault();             
+                       $(thisForm).before("<div style='margin: 10px 
0;text-align: center;width: 200px;' class='input_error_msg'>Du må velge en 
eller flere grupper</div>");
+               }
+       });
+
+       $("#frm_control_items").submit(function(e){
+               var thisForm = $(this);
+               var num_checked = $(this).find("input:checked").length;
+       
+               if(num_checked == 0){
+                       e.preventDefault();             
+                       $(thisForm).before("<div style='margin: 10px 
0;text-align: center;width: 200px;' class='input_error_msg'>Du må velge en 
eller flere punkter</div>");
+               }
+       });
+
+       $("#frm_save_control_details input").focus(function(e){
+               
$("#frm_save_control_details").find(".focus").removeClass("focus");
+               $(this).addClass("focus");
+       });
+
+       $("#frm_save_control_details input").focus(function(e){
+               
$("#frm_save_control_details").find(".focus").removeClass("focus");
+               $(this).addClass("focus");
+       });
+
+       $("#frm_save_control_details select").focus(function(e){
+               
$("#frm_save_control_details").find(".focus").removeClass("focus");
+               $(this).addClass("focus");
+       });
+
+       $("#frm_save_control_details").submit(function(e){
+       
+               var thisForm = $(this);
+
+               var $required_input_fields = $(this).find(".required");
+               var status = true;
+                       
+           $required_input_fields.each(function() {
+           
+               if($(this).val() == ''){
+                       var nextElem = $(this).next();
+               
+                       if( !$(nextElem).hasClass("input_error_msg") )
+                               $(this).after("<div class='input_error_msg'>Du 
må fylle ut dette feltet</div>");
+                                       
+                       status = false;
+               }else{
+                       var nextElem = $(this).next();
+
+                       if( $(nextElem).hasClass("input_error_msg") )
+                               $(nextElem).remove();
+               }
+           });
+
+           if( status ){
+               var saved_control_area_id = 
$(thisForm).find("input[name='saved_control_area_id']").val();
+               var new_control_area_id = $("#control_area_id").val();
+
+               if(saved_control_area_id != '' & saved_control_area_id != 
new_control_area_id)
+               {
+                       var answer = confirm("Du har endret kontrollområde til 
kontrollen. " +
+                                                                "Hvis du 
lagrer vil kontrollgrupper og kontrollpunkter til kontrollen bli slettet.")
+                       if (!answer){
+                               e.preventDefault();
+                       }
+               }
+           }else{
+               e.preventDefault();
+           }
+           
+       });
+
+       // file: view_check_lists_for_location.xsl
+       // Fetches info about a check list on hover status image icon
+       $('a.view_check_list').bind('contextmenu', function(){
+               var thisA = $(this);
+               var divWrp = $(this).parent();
+       
+               var add_param = $(thisA).find("span").text();
+       
+               var oArgs = 
{menuaction:'controller.uicheck_list.get_cases_for_check_list'};
+               var baseUrl = phpGWLink('index.php', oArgs, true);
+               var requestUrl = baseUrl + add_param
+       
+               //var requestUrl = 
"http://portico/pe/index.php?menuaction=controller.uicheck_list.get_cases_for_check_list";
 + add_param;
+       
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl,
+                       dataType: 'json',
+                 success: function(data) {
+                         if(data){
+                               var obj = jQuery.parseJSON(data);
+
+                               // Show info box with info about check list
+                                 var infoBox = $(divWrp).find("#info_box");
+                                 $(infoBox).show();
+                                
+                                 var htmlStr = "<h5>Åpne saker</h5><ul>";
+                       
+                                 $.each(obj, function(i) {
+                                       htmlStr += "<li><label>" + (parseInt(i) 
+ 1) + ": Tittel</label><span>" + obj[i].control_item.title + "</span>";
+                                       htmlStr += "<ul>";
+                                        
+                                       $(obj[i].cases_array).each(function(j) {
+                                               htmlStr += "<li>" + "Sak " + 
(parseInt(j) + 1) + ":  " + obj[i].cases_array[j].descr + "</li>";
+                                       });
+                                       htmlStr += "</ul></li>";
+                                       });
+                                
+                                 htmlStr += "</ul>";
+                       
+                                 $(infoBox).html( htmlStr ); 
+                         }
+                 }
+                  });
+       
+               return false;
+       });
+
+       $("a.view_check_list").mouseout(function(){
+               var infoBox = $(this).parent().find("#info_box");
+       
+               $(infoBox).hide();
+       });
+
+       $(".frm_save_check_item").live("submit", function(e){
+               e.preventDefault();
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
+                       success: function(data) {
+                               if(data){
+                               var obj = jQuery.parseJSON(data);
+                       
+                                 if(obj.status == "saved"){
+                                       var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                       $(submitBnt).val("Lagret");
+                                                
+                                               // Changes text on save button 
back to original
+                                               window.setTimeout(function() {
+                                               $(submitBnt).val('Oppdater 
måling');
+                                               
$(submitBnt).addClass("not_active");
+                                                        }, 1000);              
                         
+                                       }
+                               }
+                               }
+                       });
+       });
+
+       $(".frm_save_control_item").live("click", function(e){
+               e.preventDefault();
+               var thisForm = $(this);
+               var liWrp = $(this).parent();
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+       
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
+                       success: function(data) {
+                               if(data){
+                               var obj = jQuery.parseJSON(data);
+                                
+                                 if(obj.status == "saved"){
+                                       $(liWrp).fadeOut('3000', function() {
+                                               $(liWrp).addClass("hidden");
+                                       });
+                                       }
+                               }
+                               }
+                       });
+       });
+
+       $("#frm_update_check_list").live("submit", function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+       
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&phpgw_return_as=json&" + 
$(thisForm).serialize(),
+                       success: function(data) {
+                               if(data){
+                               var obj = jQuery.parseJSON(data);
+                       
+                               if(obj.status == "updated"){
+                                       var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                       $(submitBnt).val("Lagret");
+                                                
+                                       // Changes text on save button back to 
original
+                                       window.setTimeout(function() {
+                                                       $(submitBnt).val('Lagre 
sjekkpunkt');
+                                                       
$(submitBnt).addClass("not_active");
+                                       }, 1000);
+                                       }
+                               }
+                               }
+               });
+       });
+
+       $(".frm_register_case").live("submit", function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               var requestUrl = $(thisForm).attr("action");
+       
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&" + $(thisForm).serialize(),
+                       success: function(data) {
+                               if(data){
+                               var jsonObj = jQuery.parseJSON(data);
+                       
+                               if(jsonObj.status == "saved"){
+                                       var submitBnt = 
$(thisForm).find("input[type='submit']");
+                                       $(submitBnt).val("Lagret");
+                                        
+                                       clear_form( thisForm );
+                                                        
+                                       // Changes text on save button back to 
original
+                                       window.setTimeout(function() {
+                                                       
$(submitBnt).val('Registrer sak');
+                                                       
$(submitBnt).addClass("not_active");
+                                       }, 1000);
+                                       }
+                               }
+                               }
+               });
+       });
+
+       $(".frm_update_case").live("submit", function(e){
+               e.preventDefault();
+
+               var thisForm = $(this);
+               var clickRow = $(this).closest("li");
+               var checkItemRow = $(this).closest("li.check_item_case");
+               var requestUrl = $(thisForm).attr("action");
+                       
+               $.ajax({
+                       type: 'POST',
+                       url: requestUrl + "&" + $(thisForm).serialize(),
+                       success: function(data) {
+                               if(data){
+                               var jsonObj = jQuery.parseJSON(data);
+               
+                               if(jsonObj.status == "saved"){
+                                       var type = 
$(checkItemRow).find(".control_item_type").text();
+                               
+                                       if(type == "control_item_type_1"){
+                                       
+                                       }else if(type == "control_item_type_2"){
+                                               var measurement_text = 
$(thisForm).find("input[name='measurement']").val();
+                                               $(clickRow).find(".case_info 
.measurement").text(measurement_text);
+                                       }
+                               
+                                       // Text from forms textarea
+                                       var desc_text = 
$(thisForm).find("textarea").val();
+                                       // Puts new text into description tag 
in case_info                                                              
+                                       $(clickRow).find(".case_info 
.case_descr").text(desc_text);
+                                                                       
+                                       $(clickRow).find(".case_info").show();
+                                       
$(clickRow).find(".frm_update_case").hide();
+                                       }
+                               }
+                       }
+               });
+       });
+
+       $("a.quick_edit").live("click", function(e){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+                                                               
+               $(clickRow).find(".case_info").hide();
+               $(clickRow).find(".frm_update_case").show();
+       
+               return false;
+       });
+
+       $(".frm_update_case .cancel").live("click", function(e){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+                       
+       
+               $(clickRow).find(".case_info").show();
+               $(clickRow).find(".frm_update_case").hide();
+       
+               return false;
+       });
+
+       // Delete a case item from list
+       $(".delete_case").live("click", function(){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+               var clickItem = $(this).closest("ul");
+               var checkItemRow = $(this).parents("li.check_item_case");
+       
+               var url = $(clickElem).attr("href");
+
+               // Sending request for deleting a control item list
+               $.ajax({
+                       type: 'POST',
+                       url: url,
+                       success: function(data) {
+                               var obj = jQuery.parseJSON(data);
+                       
+                               if(obj.status == "deleted"){
+                                       if( $(clickItem).children("li").length 
> 1){
+                                               $(clickRow).fadeOut(300, 
function(){
+                                                       $(clickRow).remove();
+                                               });
+                                       
+                                               var next_row = 
$(clickRow).next();
+                                       
+                                               // Updating order numbers for 
rows below deleted row 
+                                               while( $(next_row).length > 0){
+                                                       
update_order_nr_for_row(next_row, "-");
+                                                       next_row = 
$(next_row).next();
+                                               }
+                                       }else{
+                                               $(checkItemRow).fadeOut(300, 
function(){
+                                                       
$(checkItemRow).remove();
+                                               });
+                                       }
+                               }
+                       }
+               });
+
+               return false;
+       });
+
+       // Closes a case
+       $(".close_case").live("click", function(){
+               var clickElem = $(this);
+               var clickRow = $(this).closest("li");
+               var clickItem = $(this).closest("ul");
+               var checkItemRow = $(this).parents("li.check_item_case");
+       
+               var url = $(clickElem).attr("href");
+
+               // Sending request for deleting a control item list
+               $.ajax({
+                       type: 'POST',
+                       url: url,
+                       success: function(data) {
+                               var obj = jQuery.parseJSON(data);
+                       
+                               if(obj.status == "closed"){
+                                       if( $(clickItem).children("li").length 
> 1){
+                                               $(clickRow).fadeOut(300, 
function(){
+                                                       $(clickRow).remove();
+                                               });
+                                       
+                                               var next_row = 
$(clickRow).next();
+                                       
+                                               // Updating order numbers for 
rows below deleted row 
+                                               while( $(next_row).length > 0){
+                                                       
update_order_nr_for_row(next_row, "-");
+                                                       next_row = 
$(next_row).next();
+                                               }
+                                       }else{
+                                               $(checkItemRow).fadeOut(300, 
function(){
+                                                       
$(checkItemRow).remove();
+                                               });
+                                       }
+                               }
+                       }
+               });
+
+               return false;
+       });
+
+       $("#frm_update_check_list").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               $(submitBnt).removeClass("not_active");
+       });
+
+       $("#frm_add_check_list").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               $(submitBnt).removeClass("not_active");
+       });
+
+       $(".frm_save_check_item").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               $(submitBnt).removeClass("not_active");
+       });
+
+       $(".frm_register_case").live("click", function(e){
+               var thisForm = $(this);
+               var submitBnt = $(thisForm).find("input[type='submit']");
+               $(submitBnt).removeClass("not_active");
+       });
+
+       $("#control_details input").focus(function(e){
+               var wrpElem = $(this).parents("dd");
+               $(wrpElem).find(".help_text").fadeIn(300);
+       });
+
+       $("#control_details input").focusout(function(e){
+               var wrpElem = $(this).parents("dd");
+               $(wrpElem).find(".help_text").fadeOut(300);
+       });
+
+       $("#control_details select").focus(function(e){
+               var wrpElem = $(this).parents("dd");
+               $(wrpElem).find(".help_text").fadeIn(300);
+       });
+
+       $("#control_details select").focusout(function(e){
+               var wrpElem = $(this).parents("dd");
+               $(wrpElem).find(".help_text").fadeOut(300);
+       });
+
+});
+
+function clear_form( form ){
+       // Clear form
+       $(form).find(':input').each(function() {
+        switch(this.type) {
+                  case 'select-multiple':
+                  case 'select-one':
+                  case 'text':
+                         $(this).val('');
+                         break;
+                  case 'textarea':
+                         $(this).val('');
+                         break;
+                  case 'checkbox':
+                  case 'radio':
+                         this.checked = false;
+        }
+    });
+}
+
+//Updates order number for hidden field and number in front of row
+function update_order_nr_for_row(element, sign){
+
+       var span_order_nr = $(element).find("span.order_nr");
+       var order_nr = $(span_order_nr).text();
+
+       if(sign == "+")
+               var updated_order_nr = parseInt(order_nr) + 1;
+       else
+               var updated_order_nr = parseInt(order_nr) - 1;
+
+       // Updating order number in front of row
+       $(span_order_nr).text(updated_order_nr);
+}

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2012-04-09 17:07:12 UTC (rev 9106)
+++ trunk/property/setup/phpgw_no.lang  2012-04-09 17:14:14 UTC (rev 9107)
@@ -1163,6 +1163,7 @@
 owner type     property        no      Eiertype
 paid   property        no      Betalt
 paid percent   property        no      Prosentvis betalt
+park invoice   property        no      Parker faktura
 part of town   property        no      Bydel
 part of town id        property        no      Bydel
 payment date   property        no      Forfallsdato

Added: trunk/property/templates/base/common.xsl
===================================================================
--- trunk/property/templates/base/common.xsl                            (rev 0)
+++ trunk/property/templates/base/common.xsl    2012-04-09 17:14:14 UTC (rev 
9107)
@@ -0,0 +1,535 @@
+<!-- $Id: common.xsl 8307 2011-12-15 08:59:28Z vator $ -->
+<xsl:template name="common" xmlns:php="http://php.net/xsl";>
+
+
+<script type="text/javascript">
+
+<![CDATA[
+
+/**
+ * Javascript for the controller module.  Holds datasource init functions and 
form helpers.
+ *
+ * Functions and objects within this file are kept in the YAHOO.controller 
namespace.
+ */
+
+       YAHOO.namespace('controller');
+
+       // Holds data source setup funtions
+       YAHOO.controller.setupDatasource = new Array();
+
+       //Holds all data sources
+       YAHOO.controller.datatables = new Array();
+
+       counter = 0;
+       // Adds data source setup funtions
+       function setDataSource(source_url, column_defs, form_id, filter_ids, 
container_id, paginator_id, datatable_id,rel_id, editor_action, 
disable_left_click) {
+               YAHOO.controller.setupDatasource.push(
+                       function() {
+                               this.url = source_url;
+                               this.columns = column_defs;
+                               this.form = form_id;
+                               this.filters = filter_ids;
+                               this.container = container_id;
+                               this.paginator = paginator_id;
+                               this.tid = datatable_id;
+                               this.related_datatable = rel_id;
+                               this.editor_action = editor_action;
+                               if(disable_left_click) {
+                                       this.disable_left_click = true;
+                               } else {
+                                       this.disable_left_click = false;
+                               }
+                       }
+               );
+       }
+       
+       // Reloads all data sources that are necessary based on the selected 
related datatable
+       function reloadDataSources(selected_datatable){
+                               
+               //... hooks into  the regular callback function 
(onDataReturnInitializeTable) call to set empty payload array
+               var loaded =  function  ( sRequest , oResponse , oPayload ) {
+                       var payload = new Array();
+                       this.onDataReturnInitializeTable( sRequest , oResponse 
, payload );
+               }
+               
+               //... refresh the selected data tables
+               
selected_datatable.getDataSource().sendRequest('',{success:loaded, 
scope:selected_datatable});
+               
+               //... traverse all datatables and refresh related (to the 
selected) data tables
+               for(var i=0; i<YAHOO.controller.datatables.length; i++){
+                       var datatable = YAHOO.controller.datatables[i];
+
+                       for(var j=0;j<selected_datatable.related.length;j++){
+                               var curr_related = 
selected_datatable.related[j];
+                       
+                               if(datatable.tid == curr_related){
+                                       
datatable.getDataSource().sendRequest('',{success:loaded,scope: datatable});
+                               }
+                       }
+               }
+       }
+
+       var highlightEditableCell = function(oArgs) {
+               var elCell = oArgs.target;
+               if(YAHOO.util.Dom.hasClass(elCell, "yui-dt-editable")) {
+                       this.highlightCell(elCell);
+               }
+       };
+
+       // Wraps data sources setup logic
+       function dataSourceWrapper(source_properties,pag) {
+
+               this.properties = source_properties;
+               this.paginator = pag;
+
+               //... prepare base url
+               this.url = this.properties.url;
+               if(this.url[length-1] != '&') {
+                       this.url += '&';
+               }
+
+               //... set up a new data source
+               this.source = new YAHOO.util.DataSource(this.url);
+
+               this.source.responseType = YAHOO.util.DataSource.TYPE_JSON;
+               this.source.connXhrMode = "queueRequests";
+
+               this.source.responseSchema = {
+                       resultsList: "ResultSet.Result",
+                       fields: this.properties.columns,
+                       metaFields : {
+                               totalRecords: "ResultSet.totalRecords"
+                       }
+               };
+       
+               //... set up a new data table
+               
+               ]]>
+               
+               this.table = new YAHOO.widget.DataTable(
+                       this.properties.container,
+                       this.properties.columns,
+                       this.source,
+                       {
+                               paginator: this.paginator,
+                               dynamicData: true,
+                               MSG_EMPTY: '<xsl:value-of 
select="php:function('lang', 'DATATABLE_MSG_EMPTY')"/>',
+                               MSG_ERROR: '<xsl:value-of 
select="php:function('lang', 'DATATABLE_MSG_ERROR')"/>',
+                               MSG_LOADING: '<xsl:value-of 
select="php:function('lang', 'DATATABLE_MSG_LOADING')"/>'
+                       }
+               );
+               
+               <![CDATA[
+
+               //... set table properties
+               this.table.related = this.properties.related_datatable;
+               this.table.tid = this.properties.tid;
+               this.table.container_id = this.properties.container;
+               this.table.editor_action = this.properties.editor_action;
+
+               //... push the data table on a stack
+               YAHOO.controller.datatables.push(this.table);
+
+               //... ?
+               this.table.handleDataReturnPayload = function(oRequest, 
oResponse, oPayload) {
+                       if(oPayload){
+                               oPayload.totalRecords = 
oResponse.meta.totalRecords;
+                               return oPayload;
+                       }
+               }
+
+               //... create context menu for each record after the table has 
loaded the data
+               this.table.doAfterLoadData = function() {
+                       onContextMenuBeforeShow = function(p_sType, p_aArgs)
+                       {
+                               var oTarget = this.contextEventTarget;
+                               if (this.getRoot() == this)
+                               {
+                                       if(oTarget.tagName != "TD")
+                                       {
+                                               oTarget = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "td");
+                                       }
+                                       oSelectedTR = 
YAHOO.util.Dom.getAncestorByTagName(oTarget, "tr");
+                                       oSelectedTR.style.backgroundColor  = 
'#AAC1D8' ;
+                                       oSelectedTR.style.color = "black";
+                                       YAHOO.util.Dom.addClass(oSelectedTR, 
prefixSelected);
+                               }
+                       }
+
+                       onContextMenuHide = function(p_sType, p_aArgs)
+                       {
+                               if (this.getRoot() == this && oSelectedTR)
+                               {
+                                       oSelectedTR.style.backgroundColor  = "" 
;
+                                       oSelectedTR.style.color = "";
+                                       YAHOO.util.Dom.removeClass(oSelectedTR, 
prefixSelected);
+                               }
+                       }
+                       
+                       var records = this.getRecordSet();
+                       
+                       var validRecords = 0;
+                       for(var i=0; i<records.getLength(); i++) {
+                               var record = records.getRecord(i);
+                               
+                               if(record == null)
+                               {
+                                       continue;
+                               }
+                               else
+                               {
+                                       validRecords++;
+                               }
+                                       
+                               // use a global counter to create unique names 
(even for the same datatable) for all context menues on the page
+                               var menuName = this.container_id + "_cm_" + 
counter;
+                               counter++;
+
+                               //... add menu items with label and handler 
function for click events
+                               var labels = record.getData().labels;
+                                
+                               //create a context menu that triggers on the 
HTML row element
+                               record.menu = new 
YAHOO.widget.ContextMenu(menuName,{trigger:this.getTrEl(validRecords -1 
),itemdata: labels, lazyload: true});
+
+                               //... subscribe handler for click events
+                               
record.menu.clickEvent.subscribe(onContextMenuClick, this);
+                               record.menu.subscribe("beforeShow", 
onContextMenuBeforeShow);
+                               record.menu.subscribe("hide", 
onContextMenuHide);
+
+                               //... render the menu on the related table row
+                               
record.menu.render(this.getTrEl(validRecords-1));
+                       }
+
+                       
+               }
+
+               //... calback methods for handling ajax calls
+               var ajaxResponseSuccess = function(o){
+                       reloadDataSources(this.args);
+               };
+
+               var ajaxResponseFailure = function(o){
+                       reloadDataSources(this.args);
+               };
+
+               //...create a handler for context menu clicks
+               var onContextMenuClick = function(eventString, args, table) {
+                       //... the argument holds the selected index number in 
the context menu
+                       var task = args[1];
+                       
+                       //... only act on a data table
+                       if(table instanceof YAHOO.widget.DataTable) {
+                               //... retrieve the record based on the selected 
table row
+                               var row = 
table.getTrEl(this.contextEventTarget);
+                               var record = table.getRecord(row);
+                               var requestUrl = "";
+
+                               if(record.getData().parameters[task.index]){
+                                       var parameter_id = 
record.getData().parameters[0];
+                                        
+                                       var parameter_value = 
YAHOO.util.Dom.get(parameter_id).value;                           
+                                       requestUrl = record.getData().actions[ 
task.index ] + "&" + parameter_id + "=" + parameter_value;
+                               }
+
+                               //... check whether this action should be an 
AJAX call
+                               if( record.getData().ajax[task.index] ) {
+                                       
+                                       var alertStatus = false;
+
+                                       // Check if confirm box should be 
displayed before request is executed
+                                       if( record.getData().alert != null )
+                                               alertStatus = 
record.getData().alert[0];
+
+                                       if( alertStatus ){
+                                               // Display confirm box with 
message
+                                               var alertMessage = 
record.getData().alert[1];
+                                               var answer = confirm( 
alertMessage );
+                                               
+                                               // Abort request if user clicks 
the abort button
+                                               if (!answer){
+                                                       return false;
+                                               }
+                                       }
+                                       
+                                       if(requestUrl){
+                                               var request = 
YAHOO.util.Connect.asyncRequest(
+                                                       'GET',
+                                                       requestUrl,
+                                                       {
+                                                               success: 
ajaxResponseSuccess,
+                                                               success: 
ajaxResponseFailure,
+                                                               args: table
+                                                       });
+                                       }       
+                               } else {
+                                       
+                                       window.location = requestUrl;
+                               }
+                       }
+               };
+
+               // Handle mouseover and click events for inline editing
+               this.table.subscribe("cellMouseoverEvent", 
highlightEditableCell);
+               this.table.subscribe("cellMouseoutEvent", 
this.table.onEventUnhighlightCell);
+               this.table.subscribe("cellClickEvent", 
this.table.onEventShowCellEditor);
+
+               this.table.subscribe("editorSaveEvent", function(oArgs) {
+                       var field = oArgs.editor.getColumn().field;
+                       var value = oArgs.newData;
+                       var id = oArgs.editor.getRecord().getData().id;
+                       var action = oArgs.editor.getDataTable().editor_action;
+
+                       // Translate to unix time if the editor is a calendar.
+                       if (oArgs.editor._sType == 'date') {
+                               var selectedDate = 
oArgs.editor.calendar.getSelectedDates()[0];
+                               //alert("selDate1: " + selectedDate);
+                               // Make sure we're at midnight GMT
+                               selectedDate = selectedDate.toString().split(" 
");
+                               //for(var e=0;e<selectedDate.length;e++){
+                               //      alert("element " + e + ": " + 
selectedDate[e]);
+                               //}
+                               if(selectedDate[3] == "00:00:00"){
+                               //      alert("seldate skal byttes!");
+                                       selectedDate = 
selectedDate.slice(0,3).join(" ") + " " + selectedDate[5] + " 00:00:00 GMT"; 
+                               }
+                               else{
+                                       selectedDate = 
selectedDate.slice(0,4).join(" ") + " 00:00:00 GMT";
+                               }
+                               //selectedDate = 
selectedDate.toString().split(" ").slice(0, 4).join(" ") + " 00:00:00 GMT";
+                               //alert("selDate2: " + selectedDate);
+                               var value = Math.round(Date.parse(selectedDate) 
/ 1000);
+                               //alert("selDate3 value: " + value);
+                       }
+
+                       var request = YAHOO.util.Connect.asyncRequest(
+                                       'GET',
+                                       'index.php?menuaction=' + action + 
"&amp;field=" + field + "&amp;value=" + value + "&amp;id=" + id,
+                                       {
+                                               success: ajaxResponseSuccess,
+                                               failure: ajaxResponseFailure,
+                                               args:oArgs.editor.getDataTable()
+                                       }
+                               );
+               });
+
+               // Don't set the row to be left-clickable if the table is 
editable by inline editors.
+               // In that case we use cellClickEvents instead
+               var table_should_be_clickable = true;
+               for (i in this.properties.columns) {
+                       if (this.properties.columns[i].editor) {
+                               table_should_be_clickable = false;
+                       }
+               }
+
+               if (table_should_be_clickable && 
!this.properties.disable_left_click) {
+                       //... create a handler for regular clicks on a table row
+                       this.table.subscribe("rowClickEvent", function(e,obj) {
+                               YAHOO.util.Event.stopEvent(e);
+
+                               //... trigger first action on row click
+                               var row = obj.table.getTrEl(e.target);
+                               if(row) {
+                                       var record = obj.table.getRecord(row);
+
+                                       //... check whether this action should 
be an AJAX call
+                                       if(record.getData().ajax[0]) {
+                                               var request = 
YAHOO.util.Connect.asyncRequest(
+                                                       'GET',
+                                                       //... execute first 
action
+                                                       
record.getData().actions[0],
+                                                       {
+                                                               success: 
ajaxResponseSuccess,
+                                                               failure: 
ajaxResponseFailure,
+                                                               args:obj.table
+                                                       }
+                                               );
+                                       } else {
+                                               //... execute first action
+                                               window.location = 
record.getData().actions[0];
+                                       }
+                               }
+                       },this);
+
+                       //... highlight rows on mouseover.  This too only 
happens if the table is
+                       // not editable.
+                       this.table.subscribe("rowMouseoverEvent", 
this.table.onEventHighlightRow);
+                       this.table.subscribe("rowMouseoutEvent", 
this.table.onEventUnhighlightRow);
+               }
+
+
+               //... create context menues when the table renders
+               this.table.subscribe("renderEvent",this.table.doAfterLoadData);
+
+               //... listen for form submits and filter changes
+               
YAHOO.util.Event.addListener(this.properties.form,'submit',formListener,this,true);
+               YAHOO.util.Event.addListener(this.properties.filters, 
'change',formListener,this,true);
+       }
+
+
+       // Set up data sources when the document has loaded
+       YAHOO.util.Event.addListener(window, "load", function() {
+               var i = 0; 
+               while(YAHOO.controller.setupDatasource.length > 0){
+                       //... create a variable name, assign set up function to 
that variable and instantiate properties
+                       variableName = "YAHOO.controller.datasource" + i;
+                       eval(variableName + " = 
YAHOO.controller.setupDatasource.shift()");
+                       var source_properties = eval("new " + variableName + 
"()");
+
+]]>
+                       // ... create a paginator for this datasource
+
+                       var pag = new YAHOO.widget.Paginator({
+                               rowsPerPage: 10,
+                               alwaysVisible: true,
+                               rowsPerPageOptions: [5, 10, 25, 50, 100, 200],
+                               firstPageLinkLabel: "&lt;&lt; <xsl:value-of 
select="php:function('lang', 'first')"/>",
+                               previousPageLinkLabel: "&lt; <xsl:value-of 
select="php:function('lang', 'previous')"/>",
+                               nextPageLinkLabel: "<xsl:value-of 
select="php:function('lang', 'next')"/> &gt;",
+                               lastPageLinkLabel: "<xsl:value-of 
select="php:function('lang', 'last')"/> &gt;&gt;",
+                               template                        : 
"{RowsPerPageDropdown}<xsl:value-of select="php:function('lang', 
'elements_pr_page')"/>.{CurrentPageReport}<br/>  {FirstPageLink} 
{PreviousPageLink} {PageLinks} {NextPageLink} {LastPageLink}",
+                               pageReportTemplate      : "<xsl:value-of 
select="php:function('lang', 'shows_from')"/> {startRecord} <xsl:value-of 
select="php:function('lang', 'to')"/> {endRecord} <xsl:value-of 
select="php:function('lang', 'of_total')"/> {totalRecords}.",
+                               containers: [source_properties.paginator]
+                       });
+                       
+<![CDATA[
+                       
+                       pag.render();
+
+                       //... send data source properties and paginator to 
wrapper function
+                       this.wrapper = new dataSourceWrapper(source_properties, 
pag);
+                       i+=1;
+/*
+                       <?php
+                               $populate = phpgw::get_var('populate_form');
+                               if(isset($populate)){?>
+                                       var qs = 
YAHOO.controller.serializeForm(source_properties.form);
+                                       this.wrapper.source.liveData = 
this.wrapper.url + qs + '&';
+                                       this.wrapper.source.sendRequest('', 
{success: function(sRequest, oResponse, oPayload) {
+                                               
this.wrapper.table.onDataReturnInitializeTable(sRequest, oResponse, 
this.wrapper.paginator);
+                                       }, scope: this});
+                       <?php }
+                       ?>
+*/
+                       // XXX: Create generic column picker for all datasources
+
+                       // Shows dialog, creating one when necessary
+                       var newCols = true;
+                       var showDlg = function(e) {
+                               YAHOO.util.Event.stopEvent(e);
+
+                               if(newCols) {
+                                       // Populate Dialog
+                                       // Using a template to create elements 
for the SimpleDialog
+                                       var allColumns = 
this.wrapper.table.getColumnSet().keys;
+                                       var elPicker = 
YAHOO.util.Dom.get("dt-dlg-picker");
+                                       var elTemplateCol = 
document.createElement("div");
+                                       YAHOO.util.Dom.addClass(elTemplateCol, 
"dt-dlg-pickercol");
+                                       var elTemplateKey = 
elTemplateCol.appendChild(document.createElement("span"));
+                                       YAHOO.util.Dom.addClass(elTemplateKey, 
"dt-dlg-pickerkey");
+                                       var elTemplateBtns = 
elTemplateCol.appendChild(document.createElement("span"));
+                                       YAHOO.util.Dom.addClass(elTemplateBtns, 
"dt-dlg-pickerbtns");
+                                       var onclickObj = {fn:handleButtonClick, 
obj:this, scope:false };
+
+                                       // Create one section in the 
SimpleDialog for each Column
+                                       var elColumn, elKey, elButton, 
oButtonGrp;
+
+                                       for(var 
i=0,l=allColumns.length;i<l;i++) {
+                                               var oColumn = allColumns[i];
+                                               if(oColumn.label != 
'unselectable') { // We haven't marked the column as unselectable for the user
+                                                       // Use the template
+                                                       elColumn = 
elTemplateCol.cloneNode(true);
+
+                                                       // Write the Column key
+                                                       elKey = 
elColumn.firstChild;
+                                                       elKey.innerHTML = 
oColumn.label;
+
+                                                       // Create a ButtonGroup
+                                                       oButtonGrp = new 
YAHOO.widget.ButtonGroup({
+                                                               id: 
"buttongrp"+i,
+                                                               name: 
oColumn.getKey(),
+                                                               container: 
elKey.nextSibling
+                                                       });
+                                                       oButtonGrp.addButtons([
+                                                               { label: "Vis", 
value: "Vis", checked: ((!oColumn.hidden)), onclick: onclickObj},
+                                                               { label: 
"Skjul", value: "Skjul", checked: ((oColumn.hidden)), onclick: onclickObj}
+                                                       ]);
+
+                                                       
elPicker.appendChild(elColumn);
+                                               }
+                                       }
+
+                                       newCols = false;
+                               }
+
+                               myDlg.show();
+                       };
+
+                       var storeColumnsUrl = YAHOO.controller.storeColumnsUrl;
+                       var hideDlg = function(e) {
+                               this.hide();
+                               // After we've hidden the dialog we send a post 
call to store the columns the user has selected
+                               var postData = 'values[save]=1';
+                               var allColumns = 
wrapper.table.getColumnSet().keys;
+                               for(var i=0; i < allColumns.length; i++) {
+                                       if(!allColumns[i].hidden){
+                                               postData += 
'&values[columns][]=' + allColumns[i].getKey();
+                                       }
+                               }
+
+                               YAHOO.util.Connect.asyncRequest('POST', 
storeColumnsUrl, null, postData);
+                       };
+
+                       var handleButtonClick = function(e, oSelf) {
+                               var sKey = this.get("name");
+                               if(this.get("value") === "Skjul") {
+                                       // Hides a Column
+                                       wrapper.table.hideColumn(sKey);
+                               } else {
+                                       // Shows a Column
+                                       wrapper.table.showColumn(sKey);
+                               }
+                       };
+
+                       // Create the SimpleDialog
+                       YAHOO.util.Dom.removeClass("dt-dlg", "inprogress");
+                       var myDlg = new YAHOO.widget.SimpleDialog("dt-dlg", {
+                               width: "30em",
+                               visible: false,
+                               modal: false, // modal: true doesn't work for 
some reason - the dialog becomes unclickable
+                               buttons: [
+                                       {text:"Lukk", handler:hideDlg}
+                               ],
+                               fixedcenter: true,
+                               constrainToViewport: true
+                       });
+                       myDlg.render();
+
+                       // Nulls out myDlg to force a new one to be created
+                       wrapper.table.subscribe("columnReorderEvent", 
function(){
+                               newCols = true;
+                               YAHOO.util.Event.purgeElement("dt-dlg-picker", 
true);
+                               YAHOO.util.Dom.get("dt-dlg-picker").innerHTML = 
"";
+                       }, this, true);
+
+                       // Hook up the SimpleDialog to the link
+                       YAHOO.util.Event.addListener("dt-options-link", 
"click", showDlg, this, true);
+               }
+       });
+
+       /*
+        * Listen for events in form. Serialize all form elements. Stop
+        * the original request and send new request.
+        */
+       function formListener(event){
+               YAHOO.util.Event.stopEvent(event);
+               var qs = YAHOO.portico.serializeForm(this.properties.form);
+               this.source.liveData = this.url + qs + '&';
+               this.source.sendRequest('', {success: function(sRequest, 
oResponse, oPayload) {
+                       this.table.onDataReturnInitializeTable(sRequest, 
oResponse, this.paginator);
+               }, scope: this});
+       }
+
+]]>
+
+</script>
+</xsl:template>

Added: trunk/property/templates/base/invoice2.xsl
===================================================================
--- trunk/property/templates/base/invoice2.xsl                          (rev 0)
+++ trunk/property/templates/base/invoice2.xsl  2012-04-09 17:14:14 UTC (rev 
9107)
@@ -0,0 +1,529 @@
+<!-- $Id: pending_vouchers.xsl 8854 2012-02-14 07:54:40Z vator $ -->
+
+<func:function name="phpgw:conditional">
+       <xsl:param name="test"/>
+       <xsl:param name="true"/>
+       <xsl:param name="false"/>
+
+       <func:result>
+               <xsl:choose>
+                       <xsl:when test="$test">
+                               <xsl:value-of select="$true"/>
+                       </xsl:when>
+                       <xsl:otherwise>
+                               <xsl:value-of select="$false"/>
+                       </xsl:otherwise>
+               </xsl:choose>
+       </func:result>
+</func:function>
+
+<!-- separate tabs and  inline tables-->
+
+<xsl:template match="data" xmlns:php="http://php.net/xsl";>
+<div class="yui-navset yui-navset-top" id="pending_for_approval_tabview">
+       <div class="identifier-header">
+               <h1><xsl:value-of select="php:function('lang', 
'invoice')"/></h1>
+       </div>
+       <xsl:call-template name="invoice" />
+</div>
+       
+</xsl:template>
+
+<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>
+
+       <!-- IMPORTANT!!! Loads YUI javascript -->
+       <xsl:call-template name="common"/>
+
+       <div class="yui-content">
+               <div id="voucher_details">
+                       <xsl:call-template name="yui_phpgw_i18n"/>
+                       <table>
+                               <xsl:apply-templates select="filter_form" />
+                               <xsl:apply-templates select="filter_invoice" />
+                               <xsl:call-template name="voucher_fields" />
+                               <tr>
+                                       <td colspan = '6'>
+                                               <xsl:apply-templates 
select="paging"/>
+                                               <xsl:apply-templates 
select="datatable"/>
+                                       </td>
+                               </tr>
+                               <xsl:apply-templates 
select="form/list_actions"/>
+                       </table>
+               </div>
+       </div>
+</xsl:template>
+
+<xsl:template match="filter_form" xmlns:php="http://php.net/xsl";>
+               <xsl:call-template name="filter_list"/>
+</xsl:template>
+
+<xsl:template name="filter_list" xmlns:php="http://php.net/xsl";>
+       <tr>
+       <td colspan = '6'>
+       <table>
+       <tr>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'janitor')" 
/>
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 
'supervisor')" />
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'budget 
responsible')" />
+               </td>
+               <td>
+                       <xsl:value-of select="php:function('lang', 'voucher 
id')" />
+               </td>
+       </tr>
+         <tr id="filters">
+               <td>
+                 <select id="janitor_lid" name="janitor_lid">
+                       <xsl:apply-templates select="janitor_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="supervisor_lid" name="supervisor_lid">
+                       <xsl:apply-templates select="supervisor_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                 <select id="budget_responsible_lid" 
name="budget_responsible_lid">
+                       <xsl:apply-templates 
select="budget_responsible_list/options"/>
+                 </select>
+               </td>           
+               <td>
+                       <input type="text" name="query" id="query"/>
+               </td>
+               <td>
+                       <xsl:variable name="lang_search"><xsl:value-of 
select="php:function('lang', 'Search')" /></xsl:variable>
+                       <input type="button" id = "search" name="search" 
value="{$lang_search}" title = "{$lang_search}" />
+               </td>                   
+         </tr>
+         </table>
+         </td>
+         </tr>
+</xsl:template>
+
+<xsl:template match="filter_invoice" xmlns:php="http://php.net/xsl";>
+       <tr>
+               <td colspan='4'>
+                       <form id="invoice_queryForm">
+                               <xsl:attribute name="method">
+                                       <xsl:value-of 
select="phpgw:conditional(not(method), 'GET', method)"/>
+                               </xsl:attribute>
+
+                               <xsl:attribute name="action">
+                                       <xsl:value-of 
select="phpgw:conditional(not(action), '', action)"/>
+                               </xsl:attribute>
+                                       <!-- When janitor area is chosen, an 
ajax request is executed. The operation fetches vouchers from db and populates 
the voucher list.
+                                        The ajax opearation is handled in 
ajax_invoice.js --> 
+                               <select id="voucher_id_filter" 
name="voucher_id_filter">
+                                       <xsl:apply-templates 
select="voucher_list/options"/>
+                               </select>
+                       </form>
+               
+                       <form id="update_table_dummy" method='POST' action='' 
></form>
+               </td>
+       </tr>
+
+</xsl:template>
+
+<xsl:template name="voucher_fields" xmlns:php="http://php.net/xsl";>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'voucher')" />
+                       </td>
+                       <td>
+                               <input type="hidden" name="voucher_id" 
id="voucher_id" value="{voucher_info/voucher/voucher_id} "/>
+                               <div id= 'voucher_id_text'>
+                                 <xsl:value-of 
select="voucher_info/voucher/voucher_id"/>                      
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'vendor')" />
+                       </td>
+                       <td>
+                               <div id="vendor">
+                                       <xsl:value-of 
select="voucher_info/voucher/vendor"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <div id="invoice_id_text">
+                                       <xsl:value-of 
select="php:function('lang', 'invoice number')" />
+                               </div>
+                       </td>
+                       <td>
+                               <div id="invoice_id">
+                                       <xsl:value-of 
select="voucher_info/voucher/invoice_id"/>
+                               </div>
+
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 'kid 
nr')" />
+                       </td>
+                       <td>
+                               <div id="kid_nr">
+                                       <xsl:value-of 
select="voucher_info/voucher/kid_nr"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'amount')" />
+                       </td>
+                       <td>
+                               <div id="amount">
+                                       <xsl:value-of 
select="voucher_info/voucher/amount"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'approved amount')" />
+                       </td>
+                       <td>
+                               <div id="approved_amount">
+                                       <xsl:value-of 
select="voucher_info/voucher/approved_amount"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'currency')" />
+                       </td>
+                       <td>
+                               <div id="currency">
+                                       <xsl:value-of 
select="voucher_info/voucher/currency"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'invoice date')" />
+                       </td>
+                       <td>
+                               <div id="invoice_date">
+                                       <xsl:value-of 
select="voucher_info/voucher/invoice_date"/>
+                               </div>
+
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'payment date')" />
+                       </td>
+                       <td>
+                               <div id="payment_date">
+                                       <xsl:value-of 
select="voucher_info/voucher/payment_date"/>
+                               </div>
+
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'janitor')" />
+                       </td>
+                       <td>
+                               <div id="janitor">
+                                       <xsl:value-of 
select="voucher_info/voucher/janitor"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'supervisor')" />
+                       </td>
+                       <td>
+                               <div id="supervisor">
+                                       <xsl:value-of 
select="voucher_info/voucher/supervisor"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'budget responsible')" />
+                       </td>
+                       <td>
+                               <div id="budget_responsible">
+                                       <xsl:value-of 
select="voucher_info/voucher/budget_responsible"/>
+                               </div>
+
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <div id = 'order_text'>
+                                       <xsl:choose>
+                                               <xsl:when 
test="voucher_info/voucher/order_link  != ''">
+                                                       <a 
href="{voucher_info/voucher/order_link}" target="_blank" 
title="{voucher_info/voucher/status}">
+                                                       <xsl:value-of 
select="php:function('lang', 'order')" />
+                                                       </a>
+                                               </xsl:when>
+                                               <xsl:otherwise>
+                                                       <xsl:value-of 
select="php:function('lang', 'order')" />
+                                               </xsl:otherwise>
+                                       </xsl:choose>
+
+                               </div>
+                       </td>
+                       <td>
+                               <input type="text" name="order_id" 
id="order_id" value="{voucher_info/voucher/order_id}"/>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'close order')" />
+                       </td>
+                       <td>
+                               <div id="close_order">
+                                       <input type="checkbox" 
name="values[close_order]" value="1">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'close order')"/>
+                                               </xsl:attribute>
+                                               <xsl:if 
test="voucher_info/voucher/pref_close_order = '1' or 
voucher_info/voucher/closed = '1'">
+                                                       <xsl:attribute 
name="checked">
+                                                               
<xsl:text>checked</xsl:text>
+                                                       </xsl:attribute>
+                                               </xsl:if>
+                                       </input>
+                                       <xsl:text> </xsl:text>
+                                       <xsl:value-of 
select="voucher_info/voucher/status"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'park invoice')" />
+                       </td>
+                       <td>
+                               <div id="park_order">
+                                       <input type="checkbox" 
name="values[park_invoice]" value="1">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="php:function('lang', 'park invoice')"/>
+                                               </xsl:attribute>
+                                               <xsl:if 
test="voucher_info/voucher/parked = '1'">
+                                                       <xsl:attribute 
name="checked">
+                                                               
<xsl:text>checked</xsl:text>
+                                                       </xsl:attribute>
+                                               </xsl:if>
+                                       </input>
+                                       <xsl:if 
test="voucher_info/voucher/parked = '1'">
+                                               <xsl:text> X</xsl:text>
+                                       </xsl:if>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 'dim 
b')" />
+                       </td>
+                       <td>
+                               <select id="dim_b" name="dim_b">
+                                       <xsl:apply-templates 
select="voucher_info/generic/dimb_list/options"/>
+                               </select>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                                       <xsl:value-of 
select="php:function('lang', 'dim a')" />
+                       </td>
+                       <td>
+                               <input type="text" name="dim_a" id="dim_a" 
value="{voucher_info/voucher/dim_a}"/>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 'tax 
code')" />
+                       </td>
+                       <td>
+                               <select id="tax_code" name="tax_code">
+                                       <xsl:apply-templates 
select="voucher_info/generic/tax_code_list/options"/>
+                               </select>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'project group')" />
+                       </td>
+                       <td>
+                               <input type="text" name="project_group" 
id="project_group" value="{voucher_info/voucher/project_group}"/>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'budget account')" />
+                       </td>
+                       <td>
+                               <input type="text" name="b_account_id" 
id="b_account_id" value="{voucher_info/voucher/b_account_id}"/>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'period')" />
+                       </td>
+                       <td>
+                               <select id="period" name="period">
+                                       <xsl:apply-templates 
select="voucher_info/generic/period_list/options"/>
+                               </select>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'periodization')" />
+                       </td>
+                       <td>
+                               <select id="periodization" name="periodization">
+                                       <xsl:apply-templates 
select="voucher_info/generic/periodization_list/options"/>
+                               </select>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'periodization start')" />
+                       </td>
+                       <td>
+                               <select id="periodization_start" 
name="periodization_start">
+                                       <xsl:apply-templates 
select="voucher_info/generic/periodization_start_list/options"/>
+                               </select>
+                       </td>
+               </tr>
+
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'oppsynsigndato')" />
+                       </td>
+                       <td>
+                               <div id="oppsynsigndato">
+                                       <xsl:value-of 
select="voucher_info/voucher/oppsynsigndato"/>
+                               </div>
+
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'saksigndato')" />
+                       </td>
+                       <td>
+                               <div id="saksigndato">
+                                       <xsl:value-of 
select="voucher_info/voucher/saksigndato"/>
+                               </div>
+
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'budsjettsigndato')" />
+                       </td>
+                       <td>
+                               <div id="budsjettsigndato">
+                                       <xsl:value-of 
select="voucher_info/voucher/budsjettsigndato"/>
+                               </div>
+                       </td>
+               </tr>
+               <tr>
+                       <td>
+                               <xsl:value-of select="php:function('lang', 
'remark')" />
+                       </td>
+                       <td>
+                               <div id="remark">
+                                       <xsl:value-of 
select="voucher_info/voucher/remark_link"/>
+                               </div>
+                       </td>
+               </tr>
+
+<!--
+            merknad
+                    [art] => 1
+                    [type] => 1
+                    [dim_a] => 
+                    [dim_b] => 0
+                    [dim_d] => 441
+                    [tax] => 
+
+                    [project_id] => 
+                    [merknad] => 
+                    [b_account_id] => 12304262
+                    [kostra_id] => 
+
+                    [process_code] => 
+                    [process_log] => 
+ 
+-->
+</xsl:template>
+
+<xsl:template match="datatable" xmlns:php="http://php.net/xsl";>
+       <div id="data_paginator"/>
+       <div class="error_msg" style="margin-left:20px;">Du må velge bruker for 
godkjenning</div>
+       <div id="datatable-container"/>
+       
+       <xsl:call-template name="datasource-definition" />
+       <xsl:variable name="label_submit"><xsl:value-of 
select="php:function('lang', 'save')" /></xsl:variable>
+       <xsl:variable name="label_checkAll"><xsl:value-of 
select="php:function('lang', 'invert_checkboxes')" /></xsl:variable>
+       <div><input type="button" id="select_all" value="{$label_checkAll}" 
onclick="checkAll('mychecks')"/></div>
+       
+       <form action="#" name="voucher_form" id="voucher_form" method="post">
+               <div class="voucher_submit"><input type="submit" 
name="values[save_voucher]" id="save_voucher" value="{$label_submit}" 
onclick="return onSave()"/></div>
+       </form>
+</xsl:template>
+
+
+<xsl:template name="datasource-definition" xmlns:php="http://php.net/xsl";>
+       <script>
+               YAHOO.namespace('portico');
+        
+               YAHOO.portico.columnDefs = [
+                               <xsl:for-each select="//datatable/field">
+                                       {
+                                               key: "<xsl:value-of 
select="key"/>",
+                                               <xsl:if test="label">
+                                               label: "<xsl:value-of 
select="label"/>",
+                                               </xsl:if>
+                                               sortable: <xsl:value-of 
select="phpgw:conditional(not(sortable = 0), 'true', 'false')"/>,
+                                               <xsl:if test="hidden">
+                                               hidden: true,
+                                               </xsl:if>
+                                               <xsl:if test="formatter">
+                                               formatter: <xsl:value-of 
select="formatter"/>,
+                                               </xsl:if>
+                                               className: "<xsl:value-of 
select="className"/>"
+                                       }<xsl:value-of 
select="phpgw:conditional(not(position() = last()), ',', '')"/>
+                               </xsl:for-each>
+                       ];
+
+               var main_source = '<xsl:value-of select="source"/>';
+               var main_columnDefs = YAHOO.portico.columnDefs;
+               var main_form = 'invoice_queryForm';
+               var main_filters = ['voucher_id_filter', 
'responsibility_roles_list'];
+               var main_container = 'datatable-container';
+               var main_table_id = 'datatable';
+               var main_pag = 'data_paginator';
+               var related_table = new Array('vouchers_table');
+       
+               setDataSource(main_source, main_columnDefs, main_form, 
main_filters, main_container, main_pag, main_table_id, related_table ); 
+               
+       </script>
+        
+</xsl:template>
+
+<!-- options for use with select-->
+<xsl:template match="options">
+       <option value="{id}">
+               <xsl:if test="selected != 0">
+                       <xsl:attribute name="selected" value="selected"/>
+               </xsl:if>
+               <xsl:value-of disable-output-escaping="yes" select="name"/>
+       </option>
+</xsl:template>
+




reply via email to

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