fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16155] fix download from tts


From: sigurdne
Subject: [Fmsystem-commits] [16155] fix download from tts
Date: Thu, 12 Jan 2017 03:57:09 -0500 (EST)

Revision: 16155
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16155
Author:   sigurdne
Date:     2017-01-12 03:57:09 -0500 (Thu, 12 Jan 2017)
Log Message:
-----------
fix download from tts

Modified Paths:
--------------
    trunk/property/inc/class.bocondition_survey.inc.php
    trunk/property/inc/class.socondition_survey.inc.php
    trunk/property/inc/class.uicondition_survey.inc.php
    trunk/property/inc/class.uitts.inc.php
    trunk/property/inc/class.uiwo_hour.inc.php
    trunk/property/setup/phpgw_no.lang
    trunk/property/templates/base/tenant_claim.xsl

Modified: trunk/property/inc/class.bocondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.bocondition_survey.inc.php 2017-01-12 07:15:27 UTC 
(rev 16154)
+++ trunk/property/inc/class.bocondition_survey.inc.php 2017-01-12 08:57:09 UTC 
(rev 16155)
@@ -441,4 +441,11 @@
                                }
                        }
                }
+
+               function get_export_data($id)
+               {
+                       $condition_survey = $this->read_single(array('id' => 
(int)$id));
+                       $values =  $this->so->get_export_data($id);
+                       return array('condition_survey' => $condition_survey, 
'values' => $values);
+               }
        }
\ No newline at end of file

Modified: trunk/property/inc/class.socondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.socondition_survey.inc.php 2017-01-12 07:15:27 UTC 
(rev 16154)
+++ trunk/property/inc/class.socondition_survey.inc.php 2017-01-12 08:57:09 UTC 
(rev 16155)
@@ -689,4 +689,58 @@
                                $this->_db->transaction_commit();
                        }
                }
+
+               function get_export_data($id)
+               {
+                       $condition_survey_id = (int) $id;
+
+                       $sql = "SELECT DISTINCT 
fm_request.location_code,fm_request.id as request_id,fm_request_status.descr as 
status,"
+                               . 
"fm_request.building_part,fm_building_part.descr as building_part_text, 
fm_request.start_date,fm_request.entry_date,fm_request.closed_date,"
+                               . 
"fm_request.in_progress_date,fm_request.delivered_date,fm_request.title as 
title,fm_request.descr,"
+                               . "max(fm_request_condition.degree) as 
condition_degree,"
+                               . "max(fm_request_condition.consequence) as 
consequence,"
+                               . "max(fm_request_condition.probability) as 
probability,"
+                               . "fm_request_condition_type.name as 
condition_type_name,"
+                               . "fm_request_condition_type.priority_key as 
priority_key,"
+                               . "(fm_request.amount_investment * multiplier) 
as amount_investment,"
+                               . "(fm_request.amount_operation * multiplier) 
as amount_operation,"
+                               . "(fm_request.amount_potential_grants * 
multiplier) as amount_potential_grants,fm_request.score,"
+                               . "recommended_year,start_date AS 
planned_year,fm_request.coordinator,"
+                               . 
"fm_location1.loc1_name,loc1_name,loc2_name,loc3_name,fm_request.address "
+                               . "FROM (((((((((( fm_request  LEFT JOIN 
fm_request_status ON fm_request.status = fm_request_status.id) "
+                               . "LEFT JOIN fm_request_planning ON 
fm_request.id = fm_request_planning.request_id) "
+                               . "LEFT JOIN fm_request_consume ON 
fm_request.id = fm_request_consume.request_id) "
+                               . "LEFT JOIN fm_request_condition ON 
fm_request.id = fm_request_condition.request_id) "
+                               . "JOIN  fm_location1 ON (fm_request.loc1 = 
fm_location1.loc1)) "
+                               . "JOIN  fm_request_condition_type ON 
(fm_request_condition.condition_type = fm_request_condition_type.id) "
+                               . "JOIN  fm_building_part ON 
(fm_request.building_part = fm_building_part.id)) "
+                               . "JOIN  fm_part_of_town ON 
(fm_location1.part_of_town_id = fm_part_of_town.id)) "
+                               . "JOIN   fm_owner ON (fm_location1.owner_id = 
fm_owner.id)) "
+                               . "LEFT JOIN  fm_location2 ON 
(fm_location2.loc1 = fm_location1.loc1 AND  fm_location2.loc2 = 
fm_request.loc2)) "
+                               . "LEFT JOIN  fm_location3 ON 
(fm_location3.loc2 = fm_location2.loc2 AND  fm_location3.loc3 = 
fm_request.loc3) AND (fm_location3.loc1 = fm_location2.loc1 AND  
fm_location3.loc3 = fm_request.loc3)) "
+                               . "WHERE fm_request.condition_survey_id = 
{$condition_survey_id} "
+                               . "GROUP BY 
fm_request.location_code,fm_location1.loc1_name,fm_request_status.descr,building_part,fm_building_part.descr,"
+                               . 
"fm_request_condition_type.name,fm_request.entry_date,fm_request.closed_date,fm_request.in_progress_date,"
+                               . 
"fm_request.delivered_date,title,priority_key,"
+                               . 
"fm_request.descr,amount_investment,amount_operation,amount_potential_grants,score,recommended_year,start_date,coordinator,fm_location2.loc2_name,fm_location3.loc3_name,fm_request.multiplier,fm_request.id,fm_request_status.descr,fm_request.address"
+                               . " ORDER BY fm_request.building_part ASC";
+//                     _debug_array($sql);die();
+                       $this->_db->query($sql);
+                       $values = array();
+                       while ($this->_db->next_record())
+                       {
+                               $values[] = $this->_db->Record;
+                       }
+                       foreach ($values as &$value)
+                       {
+                               $value['risk'] = $value['consequence'] * 
$value['probability'];
+                               $value['score'] = $value['risk'] * 
$value['priority_key'];
+                               $value['amount_total'] = 
$value['amount_investment'] + $value['amount_operation'];
+                               $value['percentage_investment'] = 
($value['amount_investment'] / $value['amount_total']) * 100;
+                               $value['percentage_grants'] = 
($value['amount_potential_grants'] / $value['amount_investment']) * 100;
+                       }
+
+                       return $values;
+               }
+
        }
\ No newline at end of file

Modified: trunk/property/inc/class.uicondition_survey.inc.php
===================================================================
--- trunk/property/inc/class.uicondition_survey.inc.php 2017-01-12 07:15:27 UTC 
(rev 16154)
+++ trunk/property/inc/class.uicondition_survey.inc.php 2017-01-12 08:57:09 UTC 
(rev 16155)
@@ -52,6 +52,7 @@
                        'get_summation' => true,
                        'view_file' => true,
                        'import' => true,
+                       'export'        => true,
                        'download' => true,
                        'summation' => true,
                        'handle_multi_upload_file' => true,
@@ -306,7 +307,18 @@
                                'parameters' => json_encode($parameters)
                        );
 
+                       $data['datatable']['actions'][] = array
+                               (
+                               'my_name' => 'export_survey',
+                               'text' => lang('export'),
+                               'action' => 
$GLOBALS['phpgw']->link('/index.php', array
+                                       (
+                                       'menuaction' => 
'property.uicondition_survey.export'
+                               )),
+                               'parameters' => json_encode($parameters)
+                       );
 
+
                        if ($GLOBALS['phpgw']->acl->check('.admin', 
PHPGW_ACL_DELETE, 'property'))
                        {
                                $data['datatable']['actions'][] = array
@@ -913,6 +925,260 @@
                        }
                }
 
+
+               public function export()
+               {
+                       $id = phpgw::get_var('id', 'int', 'REQUEST');
+                       $data = $this->bo->get_export_data($id);
+
+                       $filename = 'tilstandsanalyse';
+
+                       $names = array(
+                               'request_id',
+                               'building_part',
+                               'building_part_text',
+                               'title',
+                               'descr',
+                               'Bilde nr',
+                               'Hjemmel',
+                               'condition_degree',
+                               'condition_type_name',
+                               'consequence',
+                               'probability',
+                               'risk',
+                               'score',
+                               'recommended_year',
+                               'amount_total',
+                               'percentage_investment',
+                               'percentage_grants',
+                               'amount_operation',
+                               'amount_investment',
+                               'amount_potential_grants'
+                       );
+
+                       $descr = array(
+                               'ID',
+                               'Bygningsdel',
+                               'Bygningsdel tekst',
+                               'Tilstandbeskrivelse',
+                               'Tiltak',
+                               'Bildenummer fotoserie',
+                               'Hjemmel/ krav',
+                               'Tilstandsgrad 0-3',
+                               'Konsekvenstype',
+                               'Konsekvensgrad 0-3',
+                               'Sannsynlighet 0-3',
+                               'Risiko=KGXS',
+                               'Score=TGxKTxR',
+                               'Anbefales utført innen',
+                               'Kalkyle netto TOTALT (V+U)',
+                               'Andel U',
+                               'Andel off. tilskudd av U',
+                               'Andel Vedlikeholds-kostnad (V)',
+                               'Andel Utviklings- kostnad (U)',
+                               'Andel off. tilskudd potensiale (av U)'
+                       );
+                       $this->excel_out($data, $names, $descr, $input_type = 
array(), $filename);
+               }
+
+               function excel_out( $data, $names, $descr, $input_type = 
array(), $filename = '' )
+               {
+                       $condition_survey = $data['condition_survey'];
+//                     _debug_array($condition_survey);die();
+
+                       phpgw::import_class('phpgwapi.phpexcel');
+                       if ($filename)
+                       {
+                               $filename_arr = explode('.', str_replace(' ', 
'_', basename($filename)));
+                               $filename = $filename_arr[0] . '.xlsx';
+                       }
+                       else
+                       {
+                               $filename = str_replace(' ', '_', 
$GLOBALS['phpgw_info']['user']['account_lid']) . '.xlsx';
+                       }
+
+                       $browser = CreateObject('phpgwapi.browser');
+                       $browser->content_header($filename, 
'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet');
+
+                       $cacheMethod = 
PHPExcel_CachedObjectStorageFactory::cache_to_phpTemp;
+                       $cacheSettings = array('memoryCacheSize' => '32MB');
+                       PHPExcel_Settings::setCacheStorageMethod($cacheMethod, 
$cacheSettings);
+
+                       $objPHPExcel = new PHPExcel();
+
+
+                       
$objPHPExcel->getProperties()->setCreator($GLOBALS['phpgw_info']['user']['fullname'])
+                               
->setLastModifiedBy($GLOBALS['phpgw_info']['user']['fullname'])
+                               ->setTitle("Download from 
{$GLOBALS['phpgw_info']['server']['system_name']}")
+                               ->setSubject("Office 2007 XLSX Document")
+                               ->setDescription("document for Office 2007 
XLSX, generated using PHP classes.")
+                               ->setKeywords("office 2007 openxml php")
+                               ->setCategory("downloaded file");
+
+                       // Set active sheet index to the first sheet, so Excel 
opens this as the first sheet
+                       $objPHPExcel->setActiveSheetIndex(0);
+//                     $sheet = $objPHPExcel->getActiveSheet();
+//                     $sheet->getRowDimension('1');
+
+                       
$objPHPExcel->getActiveSheet()->getStyle('A1:T14')->getFill()->applyFromArray(array(
+                               'type' => PHPExcel_Style_Fill::FILL_SOLID,
+                               'startcolor' => array(
+                                       'rgb' => '99cc33'
+                               )
+                       ));
+                       
$objPHPExcel->getActiveSheet()->getStyle('A15:T15')->getFill()->applyFromArray(array(
+                               'type' => PHPExcel_Style_Fill::FILL_SOLID,
+                               'startcolor' => array(
+                                       'rgb' => 'ffff66'
+                               )
+                       ));
+
+                       $i = 0;
+                       $row = 1;
+                       //heading
+                       $lang = array
+                               (
+                               'id' => 'Tilstandsanalyse #',
+                               'title' => 'Navn',
+                               'descr' => 'Beskrivelse',
+                               'location_code' => 'Objekt',
+                               //                      'status_id' => 'Status',
+                               //                      'cat_id' => 'Kategori',
+                               'vendor_id' => 'Leverandør ID',
+                               'vendor_name' => 'Utført av',
+                               //                      'coordinator_id' => 
'Koordinator',
+                               'report_date' => 'Analyse dato',
+                               'multiplier' => 'Multiplikator',
+                       );
+                       
PHPExcel_Shared_Font::setAutoSizeMethod(PHPExcel_Shared_Font::AUTOSIZE_METHOD_EXACT);
+//                     _debug_array($condition_survey);die();
+                       foreach ($lang as $key => $translation)
+                       {
+                               if (isset($condition_survey[$key]))
+                               {
+                                       
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow(1, $row, 
$translation);
+                                       
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow(2, $row, 
$condition_survey[$key]);
+                                       
$objPHPExcel->getActiveSheet()->getStyle("B{$row}")->getAlignment()->applyFromArray(
+                                               array(
+                                                       'horizontal' => 
PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
+                                                       'vertical' => 
PHPExcel_Style_Alignment::VERTICAL_CENTER,
+                                                       //      'justify'   => 
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY,
+                                                       'rotation' => 0,
+                                                       'wrap' => false
+                                               )
+                                       );
+                                       
$objPHPExcel->getActiveSheet()->getStyle("C{$row}")->getAlignment()->applyFromArray(
+                                               array(
+                                                       'horizontal' => 
PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
+                                                       'vertical' => 
PHPExcel_Style_Alignment::VERTICAL_CENTER,
+                                                       //      'justify'   => 
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY,
+                                                       'rotation' => 0,
+                                                       'wrap' => false
+                                               )
+                                       );
+                                       $row++;
+                               }
+                       }
+                       foreach (range('B', 'C', 'D') as $columnID)
+                       {
+                               
$objPHPExcel->getActiveSheet()->getColumnDimension($columnID)->setAutoSize(true);
+                       }
+
+                       $count_uicols_name = count($names);
+                       $_first_row = 15;
+
+                       $text_format = array();
+                       //overskrifter
+                       $m = 0;
+                       $col = 'A';
+                       
$objPHPExcel->getActiveSheet()->getRowDimension($_first_row)->setRowHeight(210);
+                       for ($k = 0; $k < $count_uicols_name; $k++)
+                       {
+                               if (!isset($input_type[$k]) || $input_type[$k] 
!= 'hidden')
+                               {
+                                       if (preg_match('/^loc/i', $names[$k]))
+                                       {
+                                               $text_format[$m] = true;
+                                       }
+                                       
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($m, 
$_first_row, $descr[$k]);
+                                       if ($m > 0)
+                                       {
+                                               
$objPHPExcel->getActiveSheet()->getStyle("{$col}{$_first_row}")->getAlignment()->setTextRotation(90);
+                                       }
+                                       $m++;
+                                       $col++;
+                                       /*
+                                         
$objPHPExcel->getActiveSheet()->getStyle("D{$_first_row}")->getAlignment()->applyFromArray(
+                                         array(
+                                         'horizontal' => 
PHPExcel_Style_Alignment::HORIZONTAL_CENTER,
+                                         'vertical'   => 
PHPExcel_Style_Alignment::VERTICAL_CENTER,
+                                         //    'justify'   => 
PHPExcel_Style_Alignment::VERTICAL_JUSTIFY,
+                                         'rotation'   => 90,
+                                         'wrap'       => false
+                                         )
+                                         );
+                                        */
+                               }
+                       }
+                       //data
+                       $j = 0;
+                       if (isset($data['values']) && is_array($data['values']))
+                       {
+                               foreach ($data['values'] as $entry)
+                               {
+                                       $m = 0;
+                                       foreach ($names as $name)
+                                       {
+                                               $content[$j][$m] = 
str_replace("\r\n", " ", $entry[$name]);
+                                               $m++;
+                                       }
+                                       $j++;
+                               }
+
+                               $line = $_first_row;
+
+                               foreach ($content as $row)
+                               {
+                                       $col = 'A';
+
+                                       $line++;
+                                       $rows = count($row);
+                                       for ($i = 0; $i < $rows; $i++)
+                                       {
+                                               if (isset($text_format[$i]))
+                                               {
+                                                       
$objPHPExcel->setActiveSheetIndex(0)->setCellValueExplicitByColumnAndRow($i, 
$line, $row[$i], PHPExcel_Cell_DataType::TYPE_STRING);
+                                               }
+                                               else
+                                               {
+                                                       
$objPHPExcel->setActiveSheetIndex(0)->setCellValueByColumnAndRow($i, $line, 
$row[$i]);
+                                               }
+                                               
$objPHPExcel->getActiveSheet()->getStyle("{$col}{$line}")->getAlignment()->applyFromArray(
+                                                       array(
+                                                               'horizontal' => 
PHPExcel_Style_Alignment::HORIZONTAL_LEFT,
+                                                               'vertical' => 
PHPExcel_Style_Alignment::VERTICAL_CENTER,
+                                                               'rotation' => 0,
+                                                               'wrap' => true
+                                                       )
+                                               );
+                                               
$objPHPExcel->getActiveSheet()->getRowDimension($line)->setRowHeight(100);
+
+
+                                               $col++;
+                                       }
+                               }
+                       }
+
+                       // Save Excel 2007 file
+//                     $objWriter = 
PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel5');
+                       $objWriter = 
PHPExcel_IOFactory::createWriter($objPHPExcel, 'Excel2007');
+                       $objWriter->setUseDiskCaching(true, 
$GLOBALS['phpgw_info']['server']['temp_dir']);
+                       $objWriter->setOffice2003Compatibility(true);
+//                     echo "Peak memory usage: " . 
(memory_get_peak_usage(true) / 1024 / 1024) . " MB";
+//                     die();
+
+                       $objWriter->save('php://output');
+               }
                public function import()
                {
                        $id = phpgw::get_var('id', 'int', 'REQUEST');

Modified: trunk/property/inc/class.uitts.inc.php
===================================================================
--- trunk/property/inc/class.uitts.inc.php      2017-01-12 07:15:27 UTC (rev 
16154)
+++ trunk/property/inc/class.uitts.inc.php      2017-01-12 08:57:09 UTC (rev 
16155)
@@ -122,11 +122,7 @@
                        $this->_category_acl = 
isset($this->bo->config->config_data['acl_at_tts_category']) ? 
$this->bo->config->config_data['acl_at_tts_category'] : false;
                }
 
-               /**
-                * Fetch data from $this->bo based on parametres
-                * @return array
-                */
-               public function query()
+               function get_params()
                {
                        $search = phpgw::get_var('search');
                        $order = phpgw::get_var('order');
@@ -163,6 +159,16 @@
                                'check_date_type' => 
phpgw::get_var('check_date_type', 'int'),
                        );
 
+                       return $params;
+               }
+               /**
+                * Fetch data from $this->bo based on parametres
+                * @return array
+                */
+               public function query()
+               {
+                       $params = $this->get_params();
+
                        $values = $this->bo->read($params);
 
                        if ($values)
@@ -196,7 +202,7 @@
                        $result_data['sum_budget'] = $this->bo->sum_budget;
                        $result_data['sum_actual_cost'] = 
$this->bo->sum_actual_cost;
                        $result_data['sum_difference'] = 
$this->bo->sum_difference;
-                       $result_data['draw'] = $draw;
+                       $result_data['draw'] = phpgw::get_var('draw', 'int');
 
                        $link_data = array
                                (
@@ -274,43 +280,14 @@
 
                function download( $external = '' )
                {
-                       $start_date = urldecode($this->start_date);
-                       $end_date = urldecode($this->end_date);
-
-                       $search = phpgw::get_var('search');
-                       $order = phpgw::get_var('order');
-                       $draw = phpgw::get_var('draw', 'int');
-                       $columns = phpgw::get_var('columns');
-
-                       $params = array(
-                               'start' => 0,
-                               'results' => -1,
-                               'query' => $search['value'],
-                               'order' => 
$columns[$order[0]['column']]['data'],
-                               'sort' => $order[0]['dir'],
-                               'dir' => $order[0]['dir'],
-                               'cat_id' => phpgw::get_var('cat_id', 'int', 
'REQUEST', 0),
-                               'allrows' => phpgw::get_var('length', 'int') == 
-1 ? true : false,
-                               'status_id' => $this->bo->status_id,
-                               'user_id' => $this->bo->user_id,
-                               'reported_by' => $this->bo->reported_by,
-                               'cat_id' => $this->bo->cat_id,
-                               'vendor_id' => $this->bo->vendor_id,
-                               'district_id' => $this->bo->district_id,
-                               'part_of_town_id' => $this->bo->part_of_town_id,
-                               'allrows' => true,
-                               'start_date' => $start_date,
-                               'end_date' => $end_date,
-                               'location_code' => $this->bo->location_code,
-                               'p_num' => $this->bo->p_num,
-                               'building_part' => $this->bo->building_part,
-                               'b_account' => $this->bo->b_account,
-                               'ecodimb' => $this->bo->ecodimb,
-                               'branch_id' => phpgw::get_var('branch_id'),
-                               'order_dim1' => phpgw::get_var('order_dim1'),
-                               'external' => $external,
-                               'download' => true
-                       );
+                       $params = $this->get_params();
+                       $params['start'] = 0;
+                       $params['results'] = -1;
+                       $params['start_date'] = urldecode($this->start_date);
+                       $params['end_date'] = urldecode($this->end_date);
+                       $params['download'] = true;
+                       $params['allrows'] = true;
+                       $params['external'] = $external;
 //                     _debug_array($params); die();
                        $list = $this->bo->read($params);
 

Modified: trunk/property/inc/class.uiwo_hour.inc.php
===================================================================
--- trunk/property/inc/class.uiwo_hour.inc.php  2017-01-12 07:15:27 UTC (rev 
16154)
+++ trunk/property/inc/class.uiwo_hour.inc.php  2017-01-12 08:57:09 UTC (rev 
16155)
@@ -59,7 +59,7 @@
                        'edit_deviation' => true,
                        'pdf_order' => true,
                        'import_calculation' => true,
-                       'send_all_orders'       => true
+       //              'send_all_orders'       => true
                );
 
                function __construct()

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2017-01-12 07:15:27 UTC (rev 16154)
+++ trunk/property/setup/phpgw_no.lang  2017-01-12 08:57:09 UTC (rev 16155)
@@ -1206,7 +1206,7 @@
 open JasperReport %1 in new window     property        no      Åpne 
JasperReport %1 i nytt vindu
 open view in new window        property        no      Åpne visning i nytt 
vindu
 operation      property        no      Drift
-O&M    property        no      D/V
+o&m    property        no      D/V
 Operations and Maintenance     no      Drift og vedlikehold
 order  property        no      Bestilling
 order approval revoked property        no      Bestillingsgodkjenning opphevet
@@ -2072,4 +2072,5 @@
 make relation  property        no      Opprett kopling
 request for approval   property        no      Anmodning om godkjenning
 approval from %1 is required for order %2      property        no      
Godkjenning fra %1 er påkrevd for ordre %2
-missing recipient for order %1 property        no      Mangler mottaker for 
ordre %1
\ No newline at end of file
+missing recipient for order %1 property        no      Mangler mottaker for 
ordre %1
+export property        no      Eksport
\ No newline at end of file

Modified: trunk/property/templates/base/tenant_claim.xsl
===================================================================
--- trunk/property/templates/base/tenant_claim.xsl      2017-01-12 07:15:27 UTC 
(rev 16154)
+++ trunk/property/templates/base/tenant_claim.xsl      2017-01-12 08:57:09 UTC 
(rev 16155)
@@ -1,33 +1,32 @@
 
 <!-- $Id$ -->
 <xsl:template match="data">
-               <xsl:choose>
-                       <xsl:when test="edit">
-                               <xsl:apply-templates select="edit"/>
-                       </xsl:when>
-                       <xsl:when test="view">
-                               <xsl:apply-templates select="view"/>
-                       </xsl:when>
-               </xsl:choose>
+       <xsl:choose>
+               <xsl:when test="edit">
+                       <xsl:apply-templates select="edit"/>
+               </xsl:when>
+               <xsl:when test="view">
+                       <xsl:apply-templates select="view"/>
+               </xsl:when>
+       </xsl:choose>
 </xsl:template>
 
 <!-- add / edit -->
 <xsl:template xmlns:php="http://php.net/xsl"; match="edit">
-               <script type="text/javascript">
-                       self.name="first_Window";
-                       function tenant_lookup()
-                       {
-                               Window1=window.open('<xsl:value-of 
select="tenant_link"/>',"Search","left=50,top=100,width=800,height=700,toolbar=no,scrollbars=yes,resizable=yes");
-                       }
-               </script>
+       <script type="text/javascript">
+               function tenant_lookup()
+               {
+                       TINY.box.show({iframe:'<xsl:value-of 
select="tenant_link"/>', 
boxid:"frameless",width:750,height:450,fixed:false,maskid:"darkmask",maskopacity:40,
 mask:true, animate:true, close: true});
+               }
+       </script>
        <dl>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="msgbox_data != ''">
+               <xsl:choose>
+                       <xsl:when test="msgbox_data != ''">
                                <dt>
-                                                                               
<xsl:call-template name="msgbox"/>
+                                       <xsl:call-template name="msgbox"/>
                                </dt>
-                                                       </xsl:when>
-                                               </xsl:choose>
+                       </xsl:when>
+               </xsl:choose>
        </dl>
        <xsl:variable name="edit_url">
                <xsl:value-of select="edit_url"/>
@@ -36,89 +35,89 @@
                <div id="tab-content">
                        <xsl:value-of disable-output-escaping="yes" 
select="tabs"/>
                        <div id="general">
-                                               <xsl:choose>
-                                                       <xsl:when 
test="value_claim_id!=''">
+                               <xsl:choose>
+                                       <xsl:when test="value_claim_id!=''">
                                                <div class="pure-control-group">
                                                        <label>
-                                                                               
<xsl:value-of select="lang_claim_id"/>
+                                                               <xsl:value-of 
select="lang_claim_id"/>
                                                        </label>
-                                                                               
<xsl:value-of select="value_claim_id"/>
+                                                       <xsl:value-of 
select="value_claim_id"/>
                                                </div>
-                                                       </xsl:when>
-                                               </xsl:choose>
+                                       </xsl:when>
+                               </xsl:choose>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_project_id"/>
+                                               <xsl:value-of 
select="lang_project_id"/>
                                        </label>
-                                                               <xsl:value-of 
select="value_project_id"/>
+                                       <xsl:value-of 
select="value_project_id"/>
                                </div>
-                                               <xsl:for-each 
select="value_origin">
+                               <xsl:for-each select="value_origin">
                                        <div class="pure-control-group">
                                                <label>
-                                                                       
<xsl:value-of select="descr"/>
+                                                       <xsl:value-of 
select="descr"/>
                                                </label>
-                                                                       
<xsl:for-each select="data">
-                                                                               
<a href="{link}" title="{//lang_origin_statustext}">
-                                                                               
        <xsl:value-of select="id"/>
-                                                                               
</a>
-                                                                               
<xsl:text> </xsl:text>
-                                                                       
</xsl:for-each>
+                                               <xsl:for-each select="data">
+                                                       <a href="{link}" 
title="{//lang_origin_statustext}">
+                                                               <xsl:value-of 
select="id"/>
+                                                       </a>
+                                                       <xsl:text> </xsl:text>
+                                               </xsl:for-each>
                                        </div>
-                                               </xsl:for-each>
+                               </xsl:for-each>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_name"/>
+                                               <xsl:value-of 
select="lang_name"/>
                                        </label>
-                                                               <xsl:value-of 
select="value_name"/>
+                                       <xsl:value-of select="value_name"/>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_descr"/>
+                                               <xsl:value-of 
select="lang_descr"/>
                                        </label>
-                                                               <xsl:value-of 
select="value_descr"/>
+                                       <xsl:value-of select="value_descr"/>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_category"/>
+                                               <xsl:value-of 
select="lang_category"/>
                                        </label>
                                        <xsl:for-each select="cat_list_project" 
data-validation="required">
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="selected='selected' or selected = 1">
-                                                                               
        <xsl:value-of select="name"/>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                       </xsl:for-each>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="selected='selected' or selected = 1">
+                                                               <xsl:value-of 
select="name"/>
+                                                       </xsl:when>
+                                               </xsl:choose>
+                                       </xsl:for-each>
                                </div>
-                                               <xsl:call-template 
name="location_view"/>
-                                               <xsl:choose>
-                                                       <xsl:when 
test="contact_phone !=''">
+                               <xsl:call-template name="location_view"/>
+                               <xsl:choose>
+                                       <xsl:when test="contact_phone !=''">
                                                <div class="pure-control-group">
                                                        <label>
-                                                                               
<xsl:value-of select="lang_contact_phone"/>
+                                                               <xsl:value-of 
select="lang_contact_phone"/>
                                                        </label>
-                                                                               
<xsl:value-of select="contact_phone"/>
+                                                       <xsl:value-of 
select="contact_phone"/>
                                                </div>
-                                                       </xsl:when>
-                                               </xsl:choose>
+                                       </xsl:when>
+                               </xsl:choose>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_power_meter"/>
+                                               <xsl:value-of 
select="lang_power_meter"/>
                                        </label>
-                                                               <xsl:value-of 
select="value_power_meter"/>
+                                       <xsl:value-of 
select="value_power_meter"/>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_charge_tenant"/>
+                                               <xsl:value-of 
select="lang_charge_tenant"/>
                                        </label>
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="charge_tenant='1'">
-                                                                               
<b>X</b>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
+                                       <xsl:choose>
+                                               <xsl:when 
test="charge_tenant='1'">
+                                                       <b>X</b>
+                                               </xsl:when>
+                                       </xsl:choose>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_budget"/>
+                                               <xsl:value-of 
select="lang_budget"/>
                                        </label>
                                        <xsl:value-of select="value_budget"/>
                                        <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
@@ -125,7 +124,7 @@
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_reserve"/>
+                                               <xsl:value-of 
select="lang_reserve"/>
                                        </label>
                                        <xsl:value-of select="value_reserve"/>
                                        <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
@@ -132,16 +131,16 @@
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_reserve_remainder"/>
+                                               <xsl:value-of 
select="lang_reserve_remainder"/>
                                        </label>
                                        <xsl:value-of 
select="value_reserve_remainder"/>
                                        <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
-                                                               <xsl:text> 
</xsl:text> ( <xsl:value-of select="value_reserve_remainder_percent"/>
-                                                               <xsl:text> % 
)</xsl:text>
+                                       <xsl:text> </xsl:text> ( <xsl:value-of 
select="value_reserve_remainder_percent"/>
+                                       <xsl:text> % )</xsl:text>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_actual_cost"/>
+                                               <xsl:value-of 
select="lang_actual_cost"/>
                                        </label>
                                        <xsl:value-of 
select="sum_workorder_actual_cost"/>
                                        <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
@@ -165,106 +164,106 @@
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_coordinator"/>
+                                               <xsl:value-of 
select="lang_coordinator"/>
                                        </label>
-                                                       <xsl:for-each 
select="user_list">
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="selected">
-                                                                               
        <xsl:value-of select="name"/>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                       </xsl:for-each>
+                                       <xsl:for-each select="user_list">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="selected">
+                                                               <xsl:value-of 
select="name"/>
+                                                       </xsl:when>
+                                               </xsl:choose>
+                                       </xsl:for-each>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_status"/>
+                                               <xsl:value-of 
select="lang_status"/>
                                        </label>
-                                                       <xsl:for-each 
select="status_list">
-                                                               <xsl:choose>
-                                                                       
<xsl:when test="selected">
-                                                                               
        <xsl:value-of select="name"/>
-                                                                       
</xsl:when>
-                                                               </xsl:choose>
-                                                       </xsl:for-each>
+                                       <xsl:for-each select="status_list">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="selected">
+                                                               <xsl:value-of 
select="name"/>
+                                                       </xsl:when>
+                                               </xsl:choose>
+                                       </xsl:for-each>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="php:function('lang', 'entry date')" />
+                                               <xsl:value-of 
select="php:function('lang', 'entry date')" />
                                        </label>
-                                                               <xsl:value-of 
select="value_entry_date"/>
+                                       <xsl:value-of 
select="value_entry_date"/>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_start_date"/>
+                                               <xsl:value-of 
select="lang_start_date"/>
                                        </label>
-                                                               <xsl:value-of 
select="value_start_date"/>
+                                       <xsl:value-of 
select="value_start_date"/>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_end_date"/>
+                                               <xsl:value-of 
select="lang_end_date"/>
                                        </label>
-                                                               <xsl:value-of 
select="value_end_date"/>
+                                       <xsl:value-of select="value_end_date"/>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <xsl:value-of 
select="lang_status"/>
+                                               <xsl:value-of 
select="lang_status"/>
                                        </label>
-                                                               
<xsl:call-template name="status_select"/>
+                                       <xsl:call-template 
name="status_select"/>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                                                               <a 
href="javascript:tenant_lookup()" 
onMouseover="window.status='{lang_tenant_statustext}';return true;" 
onMouseout="window.status='';return true;">
-                                                                       
<xsl:value-of select="lang_tenant"/>
-                                                               </a>
+                                               <a 
href="javascript:tenant_lookup()">
+                                                       <xsl:value-of 
select="lang_tenant"/>
+                                               </a>
                                        </label>
-                                                               <input 
type="hidden" name="tenant_id" value="{value_tenant_id}"/>
-                                                               <input 
size="{size_last_name}" type="text" name="last_name" value="{value_last_name}" 
onClick="tenant_lookup();" readonly="readonly">
-                                                                       
<xsl:attribute name="title">
-                                                                               
<xsl:value-of select="lang_tenant_statustext"/>
-                                                                       
</xsl:attribute>
-                                                               </input>
-                                                               <input 
size="{size_first_name}" type="text" name="first_name" 
value="{value_first_name}" onClick="tenant_lookup();" readonly="readonly">
-                                                                       
<xsl:attribute name="title">
-                                                                               
<xsl:value-of select="lang_tenant_statustext"/>
-                                                                       
</xsl:attribute>
-                                                               </input>
+                                       <input type="hidden" name="tenant_id" 
value="{value_tenant_id}"/>
+                                       <input size="{size_last_name}" 
type="text" name="last_name" value="{value_last_name}" 
onClick="tenant_lookup();" readonly="readonly">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_tenant_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
+                                       <input size="{size_first_name}" 
type="text" name="first_name" value="{value_first_name}" 
onClick="tenant_lookup();" readonly="readonly">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_tenant_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
                                </div>
-                   <xsl:call-template name="b_account_form"/>
+                               <xsl:call-template name="b_account_form"/>
                                <div class="pure-control-group">
                                        <label>
-                           <xsl:value-of select="lang_amount"/>
+                                               <xsl:value-of 
select="lang_amount"/>
                                        </label>
-                           <input type="text" name="values[amount]" 
value="{value_amount}" onMouseout="window.status='';return true;">
-                               <xsl:attribute name="title">
-                                   <xsl:value-of 
select="lang_amount_statustext"/>
-                               </xsl:attribute>
-                           </input>
-                           <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
+                                       <input type="text" 
name="values[amount]" value="{value_amount}">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_amount_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
+                                       <xsl:text> </xsl:text> [ <xsl:value-of 
select="currency"/> ]
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                           <xsl:value-of select="lang_category"/>
+                                               <xsl:value-of 
select="lang_category"/>
                                        </label>
-                           <xsl:call-template name="cat_select"/>
+                                       <xsl:call-template name="cat_select"/>
                                </div>
                                <div class="pure-control-group">
                                        <label>
-                           <xsl:value-of select="lang_remark"/>
+                                               <xsl:value-of 
select="lang_remark"/>
                                        </label>
-                           <textarea cols="60" rows="6" name="values[remark]">
-                               <xsl:attribute name="title">
-                                   <xsl:value-of 
select="lang_remark_statustext"/>
-                               </xsl:attribute>
-                               <xsl:value-of select="value_remark"/>
-                           </textarea>
+                                       <textarea cols="60" rows="6" 
name="values[remark]">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="lang_remark_statustext"/>
+                                               </xsl:attribute>
+                                               <xsl:value-of 
select="value_remark"/>
+                                       </textarea>
                                </div>
-                   <xsl:choose>
-                       <xsl:when test="value_claim_id!=''">
+                               <xsl:choose>
+                                       <xsl:when test="value_claim_id!=''">
                                                <div class="pure-control-group">
                                                        <label>
-                                   <xsl:value-of select="php:function('lang', 
'files')"/>
+                                                               <xsl:value-of 
select="php:function('lang', 'files')"/>
                                                        </label>
-                                   <div id="paging_1"> </div>
+                                                       <div id="paging_1"> 
</div>
                                                        <!--div 
id="datatable-container_1"/-->
                                                        <div 
class="pure-custom" style="width: 100%;">
                                                                <xsl:for-each 
select="datatable_def">
@@ -281,41 +280,41 @@
                                                                </xsl:for-each>
                                                        </div>
                                                </div>
-                           <xsl:call-template name="file_upload"/>
-                       </xsl:when>
-                   </xsl:choose>
+                                               <xsl:call-template 
name="file_upload"/>
+                                       </xsl:when>
+                               </xsl:choose>
                                <br></br>
                                <div class="pure-control-group">
-                           <xsl:variable name="lang_save">
-                               <xsl:value-of select="lang_save"/>
-                           </xsl:variable>
+                                       <xsl:variable name="lang_save">
+                                               <xsl:value-of 
select="lang_save"/>
+                                       </xsl:variable>
                                        <input type="submit" class="pure-button 
pure-button-primary" name="values[save]" value="{$lang_save}" 
onMouseout="window.status='';return true;">
-                               <xsl:attribute name="onMouseover">
-                                   <xsl:text>window.status='</xsl:text>
-                                   <xsl:value-of 
select="lang_save_statustext"/>
-                                   <xsl:text>'; return true;</xsl:text>
-                               </xsl:attribute>
-                           </input>
-                           <xsl:variable name="lang_apply">
-                               <xsl:value-of select="lang_apply"/>
-                           </xsl:variable>
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                       <xsl:value-of 
select="lang_save_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <xsl:variable name="lang_apply">
+                                               <xsl:value-of 
select="lang_apply"/>
+                                       </xsl:variable>
                                        <input type="submit" class="pure-button 
pure-button-primary" name="values[apply]" value="{$lang_apply}" 
onMouseout="window.status='';return true;">
-                               <xsl:attribute name="onMouseover">
-                                   <xsl:text>window.status='</xsl:text>
-                                   <xsl:value-of 
select="lang_apply_statustext"/>
-                                   <xsl:text>'; return true;</xsl:text>
-                               </xsl:attribute>
-                           </input>
-                           <xsl:variable name="lang_cancel">
-                               <xsl:value-of select="lang_cancel"/>
-                           </xsl:variable>
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                       <xsl:value-of 
select="lang_apply_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
+                                       <xsl:variable name="lang_cancel">
+                                               <xsl:value-of 
select="lang_cancel"/>
+                                       </xsl:variable>
                                        <input type="submit" class="pure-button 
pure-button-primary" name="values[cancel]" value="{$lang_cancel}" 
onMouseout="window.status='';return true;">
-                               <xsl:attribute name="onMouseover">
-                                   <xsl:text>window.status='</xsl:text>
-                                   <xsl:value-of 
select="lang_cancel_statustext"/>
-                                   <xsl:text>'; return true;</xsl:text>
-                               </xsl:attribute>
-                           </input>
+                                               <xsl:attribute 
name="onMouseover">
+                                                       
<xsl:text>window.status='</xsl:text>
+                                                       <xsl:value-of 
select="lang_cancel_statustext"/>
+                                                       <xsl:text>'; return 
true;</xsl:text>
+                                               </xsl:attribute>
+                                       </input>
                                </div>
                                <br></br>
                                <fieldset style="border: 1px solid #000;">
@@ -338,8 +337,8 @@
                                </fieldset>
                        </div>
                </div>
-           </form>
-           <script type="text/javascript">
+       </form>
+       <script type="text/javascript">
                var property_js = <xsl:value-of select="property_js"/>;
                var base_java_url = <xsl:value-of select="base_java_url"/>;
                var datatable = new Array();
@@ -346,27 +345,27 @@
                var myColumnDefs = new Array();
 
                <xsl:for-each select="datatable">
-                   datatable[<xsl:value-of select="name"/>] = [
-                   {
-                   values:<xsl:value-of select="values"/>,
-                   total_records: <xsl:value-of select="total_records"/>,
-                   edit_action:  <xsl:value-of select="edit_action"/>,
-                   is_paginator:  <xsl:value-of select="is_paginator"/>,
-                   <xsl:if test="rows_per_page">
-                       rows_per_page: "<xsl:value-of select="rows_per_page"/>",
-                   </xsl:if>
-                   <xsl:if test="initial_page">
-                       initial_page: "<xsl:value-of select="initial_page"/>",
-                   </xsl:if>
-                   footer:<xsl:value-of select="footer"/>
-                   }
-                   ]
+                       datatable[<xsl:value-of select="name"/>] = [
+                       {
+                       values:<xsl:value-of select="values"/>,
+                       total_records: <xsl:value-of select="total_records"/>,
+                       edit_action:  <xsl:value-of select="edit_action"/>,
+                       is_paginator:  <xsl:value-of select="is_paginator"/>,
+                       <xsl:if test="rows_per_page">
+                               rows_per_page: "<xsl:value-of 
select="rows_per_page"/>",
+                       </xsl:if>
+                       <xsl:if test="initial_page">
+                               initial_page: "<xsl:value-of 
select="initial_page"/>",
+                       </xsl:if>
+                       footer:<xsl:value-of select="footer"/>
+                       }
+                       ]
                </xsl:for-each>
 
                <xsl:for-each select="myColumnDefs">
-                   myColumnDefs[<xsl:value-of select="name"/>] = <xsl:value-of 
select="values"/>
+                       myColumnDefs[<xsl:value-of select="name"/>] = 
<xsl:value-of select="values"/>
                </xsl:for-each>
-           </script>
+       </script>
 </xsl:template>
 
 <!-- New template-->
@@ -379,338 +378,338 @@
        <div id="tab-content">
                <xsl:value-of disable-output-escaping="yes" select="tabs"/>
                <div id="general">
-    <div align="left">
+                       <div align="left">
                                <form method="post" class="pure-form 
pure-form-aligned" name="form">
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_claim_id"/>
+                                                       <xsl:value-of 
select="lang_claim_id"/>
                                                </label>
-                   <xsl:value-of select="value_claim_id"/>
+                                               <xsl:value-of 
select="value_claim_id"/>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_project_id"/>
+                                                       <xsl:value-of 
select="lang_project_id"/>
                                                </label>
-                   <xsl:value-of select="value_project_id"/>
+                                               <xsl:value-of 
select="value_project_id"/>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_name"/>
+                                                       <xsl:value-of 
select="lang_name"/>
                                                </label>
-                   <xsl:value-of select="value_name"/>
+                                               <xsl:value-of 
select="value_name"/>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_descr"/>
+                                                       <xsl:value-of 
select="lang_descr"/>
                                                </label>
-                   <xsl:value-of select="value_descr"/>
+                                               <xsl:value-of 
select="value_descr"/>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_category"/>
+                                                       <xsl:value-of 
select="lang_category"/>
                                                </label>
-               <xsl:for-each select="cat_list_project">
-                   <xsl:choose>
-                       <xsl:when test="selected='selected' or selected = 1">
-                               <xsl:value-of select="name"/>
-                       </xsl:when>
-                   </xsl:choose>
-               </xsl:for-each>
+                                               <xsl:for-each 
select="cat_list_project">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="selected='selected' or selected = 1">
+                                                                       
<xsl:value-of select="name"/>
+                                                               </xsl:when>
+                                                       </xsl:choose>
+                                               </xsl:for-each>
                                        </div>
-           <xsl:call-template name="location_view"/>
-           <xsl:choose>
-               <xsl:when test="contact_phone !=''">
+                                       <xsl:call-template 
name="location_view"/>
+                                       <xsl:choose>
+                                               <xsl:when test="contact_phone 
!=''">
                                                        <div 
class="pure-control-group">
                                                                <label>
-                           <xsl:value-of select="lang_contact_phone"/>
+                                                                       
<xsl:value-of select="lang_contact_phone"/>
                                                                </label>
-                           <xsl:value-of select="contact_phone"/>
+                                                               <xsl:value-of 
select="contact_phone"/>
                                                        </div>
-               </xsl:when>
-           </xsl:choose>
+                                               </xsl:when>
+                                       </xsl:choose>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_power_meter"/>
+                                                       <xsl:value-of 
select="lang_power_meter"/>
                                                </label>
-                   <xsl:value-of select="value_power_meter"/>
+                                               <xsl:value-of 
select="value_power_meter"/>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_charge_tenant"/>
+                                                       <xsl:value-of 
select="lang_charge_tenant"/>
                                                </label>
-                   <xsl:choose>
-                       <xsl:when test="charge_tenant='1'">
-                           <b>X</b>
-                       </xsl:when>
-                   </xsl:choose>
+                                               <xsl:choose>
+                                                       <xsl:when 
test="charge_tenant='1'">
+                                                               <b>X</b>
+                                                       </xsl:when>
+                                               </xsl:choose>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_budget"/>
+                                                       <xsl:value-of 
select="lang_budget"/>
                                                </label>
-                   <xsl:value-of select="value_budget"/>
-                   <xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+                                               <xsl:value-of 
select="value_budget"/>
+                                               <xsl:text> </xsl:text> [ 
<xsl:value-of select="currency"/> ]
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_reserve"/>
+                                                       <xsl:value-of 
select="lang_reserve"/>
                                                </label>
-                   <xsl:value-of select="value_reserve"/>
-                   <xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+                                               <xsl:value-of 
select="value_reserve"/>
+                                               <xsl:text> </xsl:text> [ 
<xsl:value-of select="currency"/> ]
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_reserve_remainder"/>
+                                                       <xsl:value-of 
select="lang_reserve_remainder"/>
                                                </label>
-                   <xsl:value-of select="value_reserve_remainder"/>
-                   <xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
-                   <xsl:text> </xsl:text> ( <xsl:value-of 
select="value_reserve_remainder_percent"/>
-                   <xsl:text> % )</xsl:text>
+                                               <xsl:value-of 
select="value_reserve_remainder"/>
+                                               <xsl:text> </xsl:text> [ 
<xsl:value-of select="currency"/> ]
+                                               <xsl:text> </xsl:text> ( 
<xsl:value-of select="value_reserve_remainder_percent"/>
+                                               <xsl:text> % )</xsl:text>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_actual_cost"/>
+                                                       <xsl:value-of 
select="lang_actual_cost"/>
                                                </label>
-                   <xsl:value-of select="sum_workorder_actual_cost"/>
-                   <xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+                                               <xsl:value-of 
select="sum_workorder_actual_cost"/>
+                                               <xsl:text> </xsl:text> [ 
<xsl:value-of select="currency"/> ]
                                        </div>
                                        <div class="pure-control-group">
-               <xsl:choose>
-                   <xsl:when test="sum_workorder_budget=''">
+                                               <xsl:choose>
+                                                       <xsl:when 
test="sum_workorder_budget=''">
                                                                <label>
-                           <xsl:value-of select="lang_no_workorders"/>
+                                                                       
<xsl:value-of select="lang_no_workorders"/>
                                                                </label>
-                   </xsl:when>
-                   <xsl:otherwise>
-                               <xsl:apply-templates 
select="table_header_workorder"/>
-                               <xsl:apply-templates select="workorder_budget"/>
+                                                       </xsl:when>
+                                                       <xsl:otherwise>
+                                                               
<xsl:apply-templates select="table_header_workorder"/>
+                                                               
<xsl:apply-templates select="workorder_budget"/>
                                                                <div 
class="pure-control-group">
                                                                        <label>
-                                       <xsl:value-of select="lang_sum"/>
+                                                                               
<xsl:value-of select="lang_sum"/>
                                                                        </label>
                                                                        <label>
-                                       <xsl:value-of 
select="sum_workorder_budget"/>
+                                                                               
<xsl:value-of select="sum_workorder_budget"/>
                                                                        </label>
                                                                        <label>
-                                       <xsl:value-of 
select="sum_workorder_calculation"/>
+                                                                               
<xsl:value-of select="sum_workorder_calculation"/>
                                                                        </label>
-                                   <td>
-                                   </td>
-                                   <td>
-                                   </td>
-                                   <td>
-                                   </td>
+                                                                       <td>
+                                                                       </td>
+                                                                       <td>
+                                                                       </td>
+                                                                       <td>
+                                                                       </td>
                                                                </div>
-                   </xsl:otherwise>
-               </xsl:choose>
+                                                       </xsl:otherwise>
+                                               </xsl:choose>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_coordinator"/>
+                                                       <xsl:value-of 
select="lang_coordinator"/>
                                                </label>
-               <xsl:for-each select="user_list">
-                   <xsl:choose>
-                       <xsl:when test="selected">
-                               <xsl:value-of select="name"/>
-                       </xsl:when>
-                   </xsl:choose>
-               </xsl:for-each>
+                                               <xsl:for-each 
select="user_list">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="selected">
+                                                                       
<xsl:value-of select="name"/>
+                                                               </xsl:when>
+                                                       </xsl:choose>
+                                               </xsl:for-each>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_status"/>
+                                                       <xsl:value-of 
select="lang_status"/>
                                                </label>
-               <xsl:for-each select="status_list">
-                   <xsl:choose>
-                       <xsl:when test="selected">
-                               <xsl:value-of select="name"/>
-                       </xsl:when>
-                   </xsl:choose>
-               </xsl:for-each>
+                                               <xsl:for-each 
select="status_list">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="selected">
+                                                                       
<xsl:value-of select="name"/>
+                                                               </xsl:when>
+                                                       </xsl:choose>
+                                               </xsl:for-each>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="php:function('lang', 'entry date')" />
+                                                       <xsl:value-of 
select="php:function('lang', 'entry date')" />
                                                </label>
-                   <xsl:value-of select="value_entry_date"/>
+                                               <xsl:value-of 
select="value_entry_date"/>
                                        </div>
 
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_start_date"/>
+                                                       <xsl:value-of 
select="lang_start_date"/>
                                                </label>
-                   <xsl:value-of select="value_start_date"/>
+                                               <xsl:value-of 
select="value_start_date"/>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_end_date"/>
+                                                       <xsl:value-of 
select="lang_end_date"/>
                                                </label>
-                   <xsl:value-of select="value_end_date"/>
+                                               <xsl:value-of 
select="value_end_date"/>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_status"/>
+                                                       <xsl:value-of 
select="lang_status"/>
                                                </label>
-               <xsl:for-each select="status_list">
-                   <xsl:choose>
-                       <xsl:when test="selected='selected' or selected = 1">
-                               <xsl:value-of select="name"/>
-                       </xsl:when>
-                   </xsl:choose>
-               </xsl:for-each>
+                                               <xsl:for-each 
select="status_list">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="selected='selected' or selected = 1">
+                                                                       
<xsl:value-of select="name"/>
+                                                               </xsl:when>
+                                                       </xsl:choose>
+                                               </xsl:for-each>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_tenant"/>
+                                                       <xsl:value-of 
select="lang_tenant"/>
                                                </label>
-                   <input size="{size_last_name}" type="text" name="last_name" 
value="{value_last_name}" readonly="readonly">
-                   </input>
-                   <input size="{size_first_name}" type="text" 
name="first_name" value="{value_first_name}" readonly="readonly">
-                   </input>
+                                               <input size="{size_last_name}" 
type="text" name="last_name" value="{value_last_name}" readonly="readonly">
+                                               </input>
+                                               <input size="{size_first_name}" 
type="text" name="first_name" value="{value_first_name}" readonly="readonly">
+                                               </input>
                                        </div>
-           <xsl:call-template name="b_account_view"/>
+                                       <xsl:call-template 
name="b_account_view"/>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_amount"/>
+                                                       <xsl:value-of 
select="lang_amount"/>
                                                </label>
-                   <xsl:value-of select="value_amount"/>
-                   <xsl:text> </xsl:text> [ <xsl:value-of select="currency"/> ]
+                                               <xsl:value-of 
select="value_amount"/>
+                                               <xsl:text> </xsl:text> [ 
<xsl:value-of select="currency"/> ]
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_category"/>
+                                                       <xsl:value-of 
select="lang_category"/>
                                                </label>
-               <xsl:for-each select="cat_list">
-                   <xsl:choose>
-                       <xsl:when test="selected='selected' or selected = 1">
-                               <xsl:value-of select="name"/>
-                       </xsl:when>
-                   </xsl:choose>
-               </xsl:for-each>
+                                               <xsl:for-each select="cat_list">
+                                                       <xsl:choose>
+                                                               <xsl:when 
test="selected='selected' or selected = 1">
+                                                                       
<xsl:value-of select="name"/>
+                                                               </xsl:when>
+                                                       </xsl:choose>
+                                               </xsl:for-each>
                                        </div>
                                        <div class="pure-control-group">
                                                <label>
-                   <xsl:value-of select="lang_remark"/>
+                                                       <xsl:value-of 
select="lang_remark"/>
                                                </label>
-                   <textarea cols="60" rows="6" name="values[remark]" 
onMouseout="window.status='';return true;">
-                       <xsl:attribute name="onMouseover">
-                           <xsl:text>window.status='</xsl:text>
-                           <xsl:value-of select="lang_remark_statustext"/>
-                           <xsl:text>'; return true;</xsl:text>
-                       </xsl:attribute>
-                       <xsl:value-of select="value_remark"/>
-                   </textarea>
+                                               <textarea cols="60" rows="6" 
name="values[remark]" onMouseout="window.status='';return true;">
+                                                       <xsl:attribute 
name="onMouseover">
+                                                               
<xsl:text>window.status='</xsl:text>
+                                                               <xsl:value-of 
select="lang_remark_statustext"/>
+                                                               <xsl:text>'; 
return true;</xsl:text>
+                                                       </xsl:attribute>
+                                                       <xsl:value-of 
select="value_remark"/>
+                                               </textarea>
                                        </div>
                                </form>
                                <div class="pure-control-group">
-                   <xsl:variable name="done_action">
-                       <xsl:value-of select="done_action"/>
-                   </xsl:variable>
-                   <xsl:variable name="lang_done">
-                       <xsl:value-of select="lang_done"/>
-                   </xsl:variable>
-                   <form method="post" action="{$done_action}">
+                                       <xsl:variable name="done_action">
+                                               <xsl:value-of 
select="done_action"/>
+                                       </xsl:variable>
+                                       <xsl:variable name="lang_done">
+                                               <xsl:value-of 
select="lang_done"/>
+                                       </xsl:variable>
+                                       <form method="post" 
action="{$done_action}">
                                                <input type="submit" 
class="pure-button pure-button-primary forms" name="done" value="{$lang_done}" 
onMouseover="window.status='Back to the list.';return true;" 
onMouseout="window.status='';return true;"/>
-                   </form>
+                                       </form>
                                </div>
                        </div>
                </div>
-    </div>
+       </div>
 </xsl:template>
 
 <!-- New template-->
 <xsl:template match="table_header_workorder">
-    <tr class="th">
-       <td class="th_text" width="4%" align="right">
-           <xsl:value-of select="lang_workorder_id"/>
-       </td>
-       <td class="th_text" width="10%" align="right">
-           <xsl:value-of select="lang_budget"/>
-       </td>
-       <td class="th_text" width="5%" align="right">
-           <xsl:value-of select="lang_calculation"/>
-       </td>
-       <td class="th_text" width="10%" align="right">
-           <xsl:value-of select="lang_vendor"/>
-       </td>
-       <td class="th_text" width="10%" align="right">
-           <xsl:value-of select="lang_charge_tenant"/>
-       </td>
-       <td class="th_text" width="10%" align="right">
-           <xsl:value-of select="lang_select"/>
-       </td>
-    </tr>
+       <tr class="th">
+               <td class="th_text" width="4%" align="right">
+                       <xsl:value-of select="lang_workorder_id"/>
+               </td>
+               <td class="th_text" width="10%" align="right">
+                       <xsl:value-of select="lang_budget"/>
+               </td>
+               <td class="th_text" width="5%" align="right">
+                       <xsl:value-of select="lang_calculation"/>
+               </td>
+               <td class="th_text" width="10%" align="right">
+                       <xsl:value-of select="lang_vendor"/>
+               </td>
+               <td class="th_text" width="10%" align="right">
+                       <xsl:value-of select="lang_charge_tenant"/>
+               </td>
+               <td class="th_text" width="10%" align="right">
+                       <xsl:value-of select="lang_select"/>
+               </td>
+       </tr>
 </xsl:template>
 
 <!-- New template-->
 <xsl:template match="workorder_budget">
-    <xsl:variable name="workorder_link">
-       <xsl:value-of select="//workorder_link"/>&amp;id=<xsl:value-of 
select="workorder_id"/>
-    </xsl:variable>
-    <xsl:variable name="workorder_id">
-       <xsl:value-of select="workorder_id"/>
-    </xsl:variable>
-    <tr>
-       <xsl:attribute name="class">
-           <xsl:choose>
-               <xsl:when test="@class">
-                   <xsl:value-of select="@class"/>
-               </xsl:when>
-               <xsl:when test="position() mod 2 = 0">
-                   <xsl:text>row_off</xsl:text>
-               </xsl:when>
-               <xsl:otherwise>
-                   <xsl:text>row_on</xsl:text>
-               </xsl:otherwise>
-           </xsl:choose>
-       </xsl:attribute>
-       <td align="right">
-           <a href="{$workorder_link}" target="_blank">
+       <xsl:variable name="workorder_link">
+               <xsl:value-of select="//workorder_link"/>&amp;id=<xsl:value-of 
select="workorder_id"/>
+       </xsl:variable>
+       <xsl:variable name="workorder_id">
                <xsl:value-of select="workorder_id"/>
-           </a>
-       </td>
-       <td align="right">
-           <xsl:value-of select="budget"/>
-       </td>
-       <td align="right">
-           <xsl:value-of select="calculation"/>
-       </td>
-       <td align="left">
-           <xsl:value-of select="vendor_name"/>
-       </td>
-       <td align="center">
-           <xsl:choose>
-               <xsl:when test="charge_tenant='1'">
-                   <b>x</b>
-               </xsl:when>
-           </xsl:choose>
-           <xsl:choose>
-               <xsl:when test="claimed!=''">
-                   <b>
-                       <xsl:text>[</xsl:text>
-                       <xsl:value-of select="claimed"/>
-                       <xsl:text>]</xsl:text>
-                   </b>
-               </xsl:when>
-           </xsl:choose>
-       </td>
-       <td align="center">
-           <xsl:choose>
-               <xsl:when test="selected = 1">
-                   <input type="checkbox" name="values[workorder][]" 
value="{$workorder_id}" checked="checked" onMouseout="window.status='';return 
true;">
-                       <xsl:attribute name="title">
-                           <xsl:value-of 
select="//lang_select_workorder_statustext"/>
-                       </xsl:attribute>
-                   </input>
-               </xsl:when>
-               <xsl:otherwise>
-                   <input type="checkbox" name="values[workorder][]" 
value="{$workorder_id}" onMouseout="window.status='';return true;">
-                       <xsl:attribute name="title">
-                           <xsl:value-of 
select="//lang_select_workorder_statustext"/>
-                       </xsl:attribute>
-                   </input>
-               </xsl:otherwise>
-           </xsl:choose>
-       </td>
-    </tr>
+       </xsl:variable>
+       <tr>
+               <xsl:attribute name="class">
+                       <xsl:choose>
+                               <xsl:when test="@class">
+                                       <xsl:value-of select="@class"/>
+                               </xsl:when>
+                               <xsl:when test="position() mod 2 = 0">
+                                       <xsl:text>row_off</xsl:text>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <xsl:text>row_on</xsl:text>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </xsl:attribute>
+               <td align="right">
+                       <a href="{$workorder_link}" target="_blank">
+                               <xsl:value-of select="workorder_id"/>
+                       </a>
+               </td>
+               <td align="right">
+                       <xsl:value-of select="budget"/>
+               </td>
+               <td align="right">
+                       <xsl:value-of select="calculation"/>
+               </td>
+               <td align="left">
+                       <xsl:value-of select="vendor_name"/>
+               </td>
+               <td align="center">
+                       <xsl:choose>
+                               <xsl:when test="charge_tenant='1'">
+                                       <b>x</b>
+                               </xsl:when>
+                       </xsl:choose>
+                       <xsl:choose>
+                               <xsl:when test="claimed!=''">
+                                       <b>
+                                               <xsl:text>[</xsl:text>
+                                               <xsl:value-of select="claimed"/>
+                                               <xsl:text>]</xsl:text>
+                                       </b>
+                               </xsl:when>
+                       </xsl:choose>
+               </td>
+               <td align="center">
+                       <xsl:choose>
+                               <xsl:when test="selected = 1">
+                                       <input type="checkbox" 
name="values[workorder][]" value="{$workorder_id}" checked="checked" 
onMouseout="window.status='';return true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="//lang_select_workorder_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </xsl:when>
+                               <xsl:otherwise>
+                                       <input type="checkbox" 
name="values[workorder][]" value="{$workorder_id}" 
onMouseout="window.status='';return true;">
+                                               <xsl:attribute name="title">
+                                                       <xsl:value-of 
select="//lang_select_workorder_statustext"/>
+                                               </xsl:attribute>
+                                       </input>
+                               </xsl:otherwise>
+                       </xsl:choose>
+               </td>
+       </tr>
 </xsl:template>




reply via email to

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