fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10681] property: invoice handling


From: Sigurd Nes
Subject: [Fmsystem-commits] [10681] property: invoice handling
Date: Thu, 17 Jan 2013 10:11:37 +0000

Revision: 10681
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10681
Author:   sigurdne
Date:     2013-01-17 10:11:36 +0000 (Thu, 17 Jan 2013)
Log Message:
-----------
property: invoice handling

Modified Paths:
--------------
    trunk/property/inc/class.boinvoice.inc.php
    trunk/property/inc/class.soinvoice.inc.php
    trunk/property/inc/class.uiinvoice.inc.php

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2013-01-16 14:53:06 UTC (rev 
10680)
+++ trunk/property/inc/class.boinvoice.inc.php  2013-01-17 10:11:36 UTC (rev 
10681)
@@ -183,7 +183,7 @@
                        return $invoice;
                }
 
-               function read_invoice_sub($voucher_id='',$paid='')
+               function read_invoice_sub($voucher_id=0,$paid = false)
                {
                        $invoice = $this->so->read_invoice_sub(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
                                'user_lid' => $this->user_lid,'cat_id' => 
$this->cat_id,'voucher_id'=>$voucher_id,'paid' => $paid, 'results' => 
$this->results,'allrows'=>$this->allrows));
@@ -298,7 +298,7 @@
                        return $period_list;
                }
 
-               function tax_code_list($selected='')
+               function tax_code_list($selected='', $tax_codes = array())
                {
                        if(!$selected && $selected !== '0' )
                        {
@@ -308,7 +308,11 @@
                        {
                                $selected = (int)$selected;
                        }
-                       $tax_codes = $this->so->tax_code_list();
+
+                       if(! $tax_codes)
+                       {
+                               $tax_codes = $this->so->tax_code_list();
+                       }
                        
                        foreach ($tax_codes as &$tax_code)
                        {

Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php  2013-01-16 14:53:06 UTC (rev 
10680)
+++ trunk/property/inc/class.soinvoice.inc.php  2013-01-17 10:11:36 UTC (rev 
10681)
@@ -424,8 +424,10 @@
                        }
 
                        $sql = "SELECT 
$table.*,fm_workorder.status,fm_workorder.charge_tenant,org_name,"
-                               . "fm_workorder.claim_issued FROM $table"
+                               . 
"fm_workorder.claim_issued,fm_workorder_status.closed,periodization_id,project_type_id"
+                               . " FROM {$table}"
                                . " {$this->left_join} fm_workorder ON 
fm_workorder.id = $table.pmwrkord_code"
+                               . " {$this->left_join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
                                . " {$this->left_join} fm_project ON 
fm_workorder.project_id = fm_project.id"
                                . " {$this->join} fm_vendor ON 
$table.spvend_code = fm_vendor.id $filtermethod";
 
@@ -445,7 +447,6 @@
 
                        $i = 0;
 
-                       $closed = 
isset($this->config->config_data['workorder_closed_status']) && 
$this->config->config_data['workorder_closed_status'] ? 
$this->config->config_data['workorder_closed_status'] : 'closed';
                        $invoice = array();
                        while ($this->db->next_record())
                        {
@@ -471,7 +472,9 @@
                                                'workorder_id'                  
=> $this->db->f('pmwrkord_code'),
                                                'order_id'                      
        => $this->db->f('pmwrkord_code'),
                                                'status'                        
        => $this->db->f('status'),
-                                               'closed'                        
        => $this->db->f('status') == $closed,
+                                               'closed'                        
        => !!$this->db->f('closed'),
+                                               'project_type_id'               
=> $this->db->f('project_type_id'),
+                                               'periodization_id'              
=> $this->db->f('periodization_id'),
                                                'voucher_id'                    
=> $this->db->f('bilagsnr'),
                                                'voucher_out_id'                
=> $this->db->f('bilagsnr_ut'),
                                                'id'                            
        => $this->db->f('id'),

Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php  2013-01-16 14:53:06 UTC (rev 
10680)
+++ trunk/property/inc/class.uiinvoice.inc.php  2013-01-17 10:11:36 UTC (rev 
10681)
@@ -1755,6 +1755,7 @@
                                }
                        }
 
+                       $content = array();
                        if ($voucher_id)
                        {
                                $this->bo->allrows = true;
@@ -1762,22 +1763,29 @@
                        }
 
                        $sum=0;
-                       $i      =0;
-                       if(is_array($content))
+
+                       $dimb_list                      = 
$this->bo->select_dimb_list();
+                       $tax_code_list          = $this->bo->tax_code_list();
+                       $_link_order            = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.view_order'));
+                       $_link_claim            = 
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.check'));
+                       
+                       foreach ($content as &$entry)
                        {
-                               while(each($content))
-                               {
-                                       $sum                                    
                                = $sum + $content[$i]['amount'];
-                                       $content[$i]['amount']                  
                = number_format($content[$i]['amount'], 2, ',', '');
-                                       $content[$i]['paid']                    
                = $paid;
-                                       $content[$i]['dimb_list']               
                = $this->bo->select_dimb_list($content[$i]['dimb']);
-                                       $content[$i]['tax_code_list']           
        = $this->bo->tax_code_list($content[$i]['tax_code']);
-                                       $content[$i]['link_order']              
                = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiinvoice.view_order'));
-                                       $content[$i]['link_claim']              
                = $GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uitenant_claim.check'));
-                                       $i++;
-                               }
+                               $sum                                            
+= $entry['amount'];
+                               $entry['amount']                        = 
number_format($entry['amount'], 2, ',', '');
+                               $entry['paid']                          = $paid;
+                               $entry['dimb_list']                     = 
$this->bocommon->select_list($entry['dimb'], $dimb_list);
+                               $entry['tax_code_list']         = 
$this->bo->tax_code_list($entry['tax_code'], $tax_code_list);
+                               $entry['link_order']            = $_link_order;
+                               $entry['link_claim']            = $_link_claim;
                        }
 
+                       unset($entry);
+                       unset($_link_order);
+                       unset($_link_claim);
+                       unset($dimb_list);
+                       unset($tax_code_list);
+
                        $uicols = array (
                                array(
                                        'col_name'=>'workorder'         
,'label'=>lang('Workorder'),    'className'=>'centerClasss', 'sortable'=>true,  
'sort_field'=>'pmwrkord_code',  'visible'=>true),
@@ -1826,244 +1834,245 @@
 
                        $j=0;
                        //---- llena DATATABLE-ROWS con los valores del READ
-                       if (isset($content) && is_array($content))
+                       $workorders = array();
+                       foreach($content as $invoices)
                        {
-                               $workorders = array();
-                               foreach($content as $invoices)
+                               for ($i=0;$i<count($uicols);$i++)
                                {
-                                       for ($i=0;$i<count($uicols);$i++)
+                                       $json_row[$uicols[$i]['col_name']] = "";
+
+                                       if($i == 0)
                                        {
-                                               
$json_row[$uicols[$i]['col_name']] = "";
-
-                                               if($i == 0)
+                                               
$json_row[$uicols[$i]['col_name']] .= " <input name='values[counter][".$j."]' 
id='values[counter][".$j."]'  class='myValuesForPHP'  type='hidden' 
value='".$invoices['counter']."'/>";
+                                               
$json_row[$uicols[$i]['col_name']] .= " <input name='values[id][".$j."]' 
id='values[id][".$j."]'  class='myValuesForPHP'  type='hidden' 
value='".$invoices['id']."'/>";
+                                               
$json_row[$uicols[$i]['col_name']] .= " <input 
name='values[workorder_id][".$j."]' id='values[workorder_id][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$invoices['workorder_id']."'/>";
+                                               
$json_row[$uicols[$i]['col_name']] .= " <a target='_blank' 
href='".$invoices['link_order'].'&order_id='.$invoices['workorder_id']."'>".$invoices['workorder_id']."</a>";
+                                       }
+                                       else if(($i == 1))
+                                       {
+                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['project_group'];
+                                       }
+                                       else if(($i == 2))
+                                       {
+                                               
if(!isset($invoices['workorder_id']) || !$invoices['workorder_id'])
                                                {
-                                                       
$json_row[$uicols[$i]['col_name']] .= " <input name='values[counter][".$j."]' 
id='values[counter][".$j."]'  class='myValuesForPHP'  type='hidden' 
value='".$invoices['counter']."'/>";
-                                                       
$json_row[$uicols[$i]['col_name']] .= " <input name='values[id][".$j."]' 
id='values[id][".$j."]'  class='myValuesForPHP'  type='hidden' 
value='".$invoices['id']."'/>";
-                                                       
$json_row[$uicols[$i]['col_name']] .= " <input 
name='values[workorder_id][".$j."]' id='values[workorder_id][".$j."]'  
class='myValuesForPHP'  type='hidden' value='".$invoices['workorder_id']."'/>";
-                                                       
$json_row[$uicols[$i]['col_name']] .= " <a target='_blank' 
href='".$invoices['link_order'].'&order_id='.$invoices['workorder_id']."'>".$invoices['workorder_id']."</a>";
+                                                       //nothing
                                                }
-                                               else if(($i == 1))
+                                               else if(!$invoices['paid'] && 
!array_key_exists($invoices['workorder_id'], $workorders))
                                                {
-                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['project_group'];
-                                               }
-                                               else if(($i == 2))
-                                               {
-                                                       
if($invoices['workorder_id'] == "")
+                                                       $_checked = '';
+                                                       
if($invoices['closed']== 1)
                                                        {
-                                                               //nothing
+                                                               $_checked = 
'checked="checked"';
                                                        }
-                                                       else 
if($invoices['paid']== ""  && !array_key_exists($invoices['workorder_id'], 
$workorders))
+                                                       else 
if($invoices['project_type_id']== 1 && !$invoices['periodization_id']) // 
operation projekts
                                                        {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_orig][".$j."]' id='values[close_order_orig][".$j."]'  
class='myValuesForPHP '  type='hidden' value='".$invoices['closed']."'/>";
-                                                               
if($invoices['closed']== 1)
-                                                               {
-                                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_tmp][".$j."]' id='values[close_order_tmp][".$j."]'  
class='close_order_tmp transfer_idClass'  type='checkbox' value='true' 
checked='checked' />";
-                                                               }
-                                                               else
-                                                               {
-                                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_tmp][".$j."]' id='values[close_order_tmp][".$j."]'  
class='close_order_tmp transfer_idClass'  type='checkbox' value='true'/>";
-                                                               }
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order][".$j."]' id='values[close_order][".$j."]'  
class='myValuesForPHP close_order'  type='hidden' value=''/>";
+                                                               $_checked = 
'checked="checked"';
                                                        }
-                                                       else
+
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_orig][{$j}]' id='values[close_order_orig][{$j}]' 
class='myValuesForPHP ' type='hidden' value='{$invoices['closed']}'/>";
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order_tmp][{$j}]' id='values[close_order_tmp][{$j}]' 
class='close_order_tmp transfer_idClass' type='checkbox' value='true' 
{$_checked}/>";
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[close_order][{$j}]' id='values[close_order][{$j}]' 
class='myValuesForPHP close_order' type='hidden' value=''/>";
+                                               }
+                                               else
+                                               {
+                                                       
if($invoices['closed']== 1)
                                                        {
-                                                               
if($invoices['closed']== 1)
-                                                               {
-                                                                       
$json_row[$uicols[$i]['col_name']]  .= "<b>x</b>";
-                                                               }
+                                                               
$json_row[$uicols[$i]['col_name']]  .= "<b>x</b>";
                                                        }
                                                }
-                                               else if(($i == 3))
+                                       }
+                                       else if(($i == 3))
+                                       {
+                                               if($invoices['charge_tenant'] 
== 1)
                                                {
-                                                       
if($invoices['charge_tenant'] == 1)
+                                                       
if($invoices['claim_issued'] == '')
                                                        {
-                                                               
if($invoices['claim_issued'] == '')
-                                                               {
-                                                                       
$_workorder = execMethod('property.soworkorder.read_single', 
$invoices['workorder_id']);
-                                                                       
$json_row[$uicols[$i]['col_name']] .= " <a target='_blank' 
href='".$invoices['link_claim'].'&project_id='.$_workorder['project_id']."'>".lang('Claim')."</a>";
-                                                                       
unset($_workorder);
-                                                               }
-                                                               else
-                                                               {
-                                                                       
$json_row[$uicols[$i]['col_name']]  .= "<b>x</b>";
-                                                               }
+                                                               $_workorder = 
execMethod('property.soworkorder.read_single', $invoices['workorder_id']);
+                                                               
$json_row[$uicols[$i]['col_name']] .= " <a target='_blank' 
href='".$invoices['link_claim'].'&project_id='.$_workorder['project_id']."'>".lang('Claim')."</a>";
+                                                               
unset($_workorder);
                                                        }
                                                        else
                                                        {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= "<b>-</b>";
+                                                               
$json_row[$uicols[$i]['col_name']]  .= "<b>x</b>";
                                                        }
-
                                                }
-                                               else if(($i == 4))
+                                               else
                                                {
-                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['invoice_id'];
+                                                       
$json_row[$uicols[$i]['col_name']]  .= "<b>-</b>";
                                                }
 
-                                               else if(($i == 5))
+                                       }
+                                       else if(($i == 4))
+                                       {
+                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['invoice_id'];
+                                       }
+
+                                       else if(($i == 5))
+                                       {
+                                               if($invoices['paid'] == true)
                                                {
-                                                       if($invoices['paid'] == 
true)
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']] .= $invoices['budget_account'];
-                                                       }
-                                                       else
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[budget_account][".$j."]' id='values[budget_account][".$j."]'  
class='myValuesForPHP'  type='text' size='7' 
value='".$invoices['budget_account']."'/>";
-                                                       }
+                                                       
$json_row[$uicols[$i]['col_name']] .= $invoices['budget_account'];
                                                }
-
-                                               else if(($i == 6))
+                                               else
                                                {
-                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['amount'];
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[budget_account][".$j."]' id='values[budget_account][".$j."]'  
class='myValuesForPHP'  type='text' size='7' 
value='".$invoices['budget_account']."'/>";
                                                }
+                                       }
 
-                                               else if(($i == 7))
+                                       else if(($i == 6))
+                                       {
+                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['amount'];
+                                       }
+
+                                       else if(($i == 7))
+                                       {
+
+                                               if($invoices['paid'] == true)
                                                {
+                                                       
$json_row[$uicols[$i]['col_name']] .= $invoices['approved_amount'];
+                                               }
+                                               else
+                                               {
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[approved_amount][".$j."]' id='values[approved_amount][".$j."]'  
class='myValuesForPHP'  type='text' size='7' 
value='".$invoices['approved_amount']."'/>";
+                                               }
 
-                                                       if($invoices['paid'] == 
true)
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']] .= $invoices['approved_amount'];
-                                                       }
-                                                       else
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input 
name='values[approved_amount][".$j."]' id='values[approved_amount][".$j."]'  
class='myValuesForPHP'  type='text' size='7' 
value='".$invoices['approved_amount']."'/>";
-                                                       }
 
+                                       }
 
-                                               }
+                                       else if(($i == 8))
+                                       {
+                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['currency'];
+                                       }
 
-                                               else if(($i == 8))
+                                       else if(($i == 9))
+                                       {
+                                               if($invoices['paid'] == true)
                                                {
-                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['currency'];
+                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['dima'];
                                                }
-
-                                               else if(($i == 9))
+                                               else
                                                {
-                                                       if($invoices['paid'] == 
true)
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['dima'];
-                                                       }
-                                                       else
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dima][".$j."]' 
id='values[dima][".$j."]'  class='myValuesForPHP'  type='text' size='7' 
value='".$invoices['dima']."'/>";
-                                                       }
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dima][".$j."]' 
id='values[dima][".$j."]'  class='myValuesForPHP'  type='text' size='7' 
value='".$invoices['dima']."'/>";
                                                }
-                                               else if(($i == 10))
+                                       }
+                                       else if(($i == 10))
+                                       {
+                                               if($invoices['paid'] == true)
                                                {
-                                                       if($invoices['paid'] == 
true)
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['dimb'];
-                                                       }
-                                                       else
-                                                       {
+                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['dimb'];
+                                               }
+                                               else
+                                               {
 
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <select 
name='values[dimb_tmp][".$j."]' id='values[dimb_tmp][".$j."]'  
class='dimb_tmp'><option value=''></option>";
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <select 
name='values[dimb_tmp][".$j."]' id='values[dimb_tmp][".$j."]'  
class='dimb_tmp'><option value=''></option>";
 
-                                                               for($k = 0 ;$k 
< count($invoices['dimb_list']) ; $k++)
+                                                       for($k = 0 ;$k < 
count($invoices['dimb_list']) ; $k++)
+                                                       {
+                                                               
if(isset($invoices['dimb_list'][$k]['selected']) && 
$invoices['dimb_list'][$k]['selected']!="")
                                                                {
-                                                                       
if(isset($invoices['dimb_list'][$k]['selected']) && 
$invoices['dimb_list'][$k]['selected']!="")
-                                                                       {
-                                                                               
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['dimb_list'][$k]['id']."' selected 
>".$invoices['dimb_list'][$k]['name']."</option>";
-                                                                       }
-                                                                       else
-                                                                       {
-                                                                               
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['dimb_list'][$k]['id']."'>".$invoices['dimb_list'][$k]['name']."</option>";
-                                                                       }
+                                                                       
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['dimb_list'][$k]['id']."' selected 
>".$invoices['dimb_list'][$k]['name']."</option>";
                                                                }
-                                                               
$json_row[$uicols[$i]['col_name']]  .="</select>";
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dimb][".$j."]' 
id='values[dimb][".$j."]'  class='myValuesForPHP dimb'  type='hidden' 
value=''/>";
+                                                               else
+                                                               {
+                                                                       
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['dimb_list'][$k]['id']."'>".$invoices['dimb_list'][$k]['name']."</option>";
+                                                               }
+                                                       }
+                                                       
$json_row[$uicols[$i]['col_name']]  .="</select>";
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dimb][".$j."]' 
id='values[dimb][".$j."]'  class='myValuesForPHP dimb'  type='hidden' 
value=''/>";
 
-                                                       }
                                                }
-                                               else if(($i == 11))
+                                       }
+                                       else if(($i == 11))
+                                       {
+                                               if($invoices['paid'] == true)
                                                {
-                                                       if($invoices['paid'] == 
true)
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['dimd'];
-                                                       }
-                                                       else
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dimd][".$j."]' 
id='values[dimd][".$j."]'  class='myValuesForPHP'  type='text' size='4' 
value='".$invoices['dimd']."'/>";
-                                                       }
+                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['dimd'];
                                                }
-                                               else if(($i == 12))
+                                               else
                                                {
-                                                       if($invoices['paid'] == 
true)
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= $invoices['tax_code'];
-                                                       }
-                                                       else
-                                                       {
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[dimd][".$j."]' 
id='values[dimd][".$j."]'  class='myValuesForPHP'  type='text' size='4' 
value='".$invoices['dimd']."'/>";
+                                               }
+                                       }
+                                       else if(($i == 12))
+                                       {
+                                               if($invoices['paid'] == true)
+                                               {
+                                                       
$json_row[$uicols[$i]['col_name']]  .= $invoices['tax_code'];
+                                               }
+                                               else
+                                               {
 
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <select 
name='values[tax_code_tmp][".$j."]' id='values[tax_code_tmp][".$j."]'  
class='tax_code_tmp'><option value=''></option>";
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <select 
name='values[tax_code_tmp][".$j."]' id='values[tax_code_tmp][".$j."]'  
class='tax_code_tmp'><option value=''></option>";
 
-                                                               for($k = 0 ;$k 
< count($invoices['tax_code_list']) ; $k++)
+                                                       for($k = 0 ;$k < 
count($invoices['tax_code_list']) ; $k++)
+                                                       {
+                                                               
if(isset($invoices['tax_code_list'][$k]['selected']) && 
$invoices['tax_code_list'][$k]['selected']!="")
                                                                {
-                                                                       
if(isset($invoices['tax_code_list'][$k]['selected']) && 
$invoices['tax_code_list'][$k]['selected']!="")
-                                                                       {
-                                                                               
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['tax_code_list'][$k]['id']."'  selected 
>".$invoices['tax_code_list'][$k]['id']."</option>";
-                                                                       }
-                                                                       else
-                                                                       {
-                                                                               
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['tax_code_list'][$k]['id']."'>".$invoices['tax_code_list'][$k]['id']."</option>";
-                                                                       }
+                                                                       
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['tax_code_list'][$k]['id']."'  selected 
>".$invoices['tax_code_list'][$k]['id']."</option>";
                                                                }
-                                                               
$json_row[$uicols[$i]['col_name']]  .="</select>";
-                                                               
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[tax_code][".$j."]' 
id='values[tax_code][".$j."]'  class='myValuesForPHP tax_code'  type='hidden' 
value=''/>";
+                                                               else
+                                                               {
+                                                                       
$json_row[$uicols[$i]['col_name']]  .= "<option 
value='".$invoices['tax_code_list'][$k]['id']."'>".$invoices['tax_code_list'][$k]['id']."</option>";
+                                                               }
+                                                       }
+                                                       
$json_row[$uicols[$i]['col_name']]  .="</select>";
+                                                       
$json_row[$uicols[$i]['col_name']]  .= " <input name='values[tax_code][".$j."]' 
id='values[tax_code][".$j."]'  class='myValuesForPHP tax_code'  type='hidden' 
value=''/>";
 
-                                                       }
                                                }
-                                               else if(($i == 13))
+                                       }
+                                       else if(($i == 13))
+                                       {
+                                               if($invoices['remark'] == true)
                                                {
-                                                       if($invoices['remark'] 
== true)
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']] .= " <a 
href=\"javascript:openwindow('".$GLOBALS['phpgw']->link('/index.php', array
-                                                                       (
-                                                                               
'menuaction'=> 'property.uiinvoice.remark',
-                                                                               
'id'            => $invoices['id'],
-                                                                               
'paid'          => $invoices['paid']
-                                                                       )). 
"','550','400')\" >".lang('Remark')."</a>";
-                                                       }
-                                                       else
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= "<b>-</b>";
-                                                       }
+                                                       
$json_row[$uicols[$i]['col_name']] .= " <a 
href=\"javascript:openwindow('".$GLOBALS['phpgw']->link('/index.php', array
+                                                               (
+                                                                       
'menuaction'=> 'property.uiinvoice.remark',
+                                                                       'id'    
        => $invoices['id'],
+                                                                       'paid'  
        => $invoices['paid']
+                                                               )). 
"','550','400')\" >".lang('Remark')."</a>";
                                                }
-                                               else if(($i == 14))
+                                               else
                                                {
-                                                       
if(isset($invoices['external_ref']) && $invoices['external_ref'])
-                                                       {
-                                                               //      
$json_row[$uicols[$i]['col_name']] = " <a target='_blank' 
href='".$baseurl_invoice. $invoices['external_ref']."'>{$lang_picture}</a>";
-                                                               
$json_row[$uicols[$i]['col_name']] = " <a 
href=\"javascript:openwindow('{$baseurl_invoice}{$invoices['external_ref']}','640','800')\"
 >{$lang_picture}</a>";
-                                                       }
-                                                       else
-                                                       {
-                                                               
$json_row[$uicols[$i]['col_name']]  .= "<b>-</b>";
-                                                       }
+                                                       
$json_row[$uicols[$i]['col_name']]  .= "<b>-</b>";
                                                }
-                                               else if($i == 15)
+                                       }
+                                       else if(($i == 14))
+                                       {
+                                               
if(isset($invoices['external_ref']) && $invoices['external_ref'])
                                                {
-                                                       
$json_row[$uicols[$i]['col_name']]  = $invoices['counter'];
+                                                       //      
$json_row[$uicols[$i]['col_name']] = " <a target='_blank' 
href='".$baseurl_invoice. $invoices['external_ref']."'>{$lang_picture}</a>";
+                                                       
$json_row[$uicols[$i]['col_name']] = " <a 
href=\"javascript:openwindow('{$baseurl_invoice}{$invoices['external_ref']}','640','800')\"
 >{$lang_picture}</a>";
                                                }
-                                               else if($i == 16)
+                                               else
                                                {
-                                                       
$json_row[$uicols[$i]['col_name']]  = $invoices['id'];
+                                                       
$json_row[$uicols[$i]['col_name']]  .= "<b>-</b>";
                                                }
-                                               else if($i == 17)
-                                               {
-                                                       
$json_row[$uicols[$i]['col_name']]  = $invoices['external_ref'];
-                                               }
                                        }
-
-                                       if($invoices['workorder_id'])
+                                       else if($i == 15)
                                        {
-                                               
$workorders[$invoices['workorder_id']] = true;
+                                               
$json_row[$uicols[$i]['col_name']]  = $invoices['counter'];
                                        }
+                                       else if($i == 16)
+                                       {
+                                               
$json_row[$uicols[$i]['col_name']]  = $invoices['id'];
+                                       }
+                                       else if($i == 17)
+                                       {
+                                               
$json_row[$uicols[$i]['col_name']]  = $invoices['external_ref'];
+                                       }
+                               }
 
-                                       $datatable['rows']['row'][] = $json_row;
-                                       $j++;
+                               if($invoices['workorder_id'])
+                               {
+                                       $workorders[$invoices['workorder_id']] 
= true;
                                }
+
+                               $datatable['rows']['row'][] = $json_row;
+                               $j++;
                        }
 
+
                        $current_Consult = array ();
                        for($i=0;$i<2;$i++)
                        {




reply via email to

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