phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc class.uiinvoice.inc.php, 1.14 class.uipr


From: sigurdne
Subject: [Phpgroupware-cvs] property/inc class.uiinvoice.inc.php, 1.14 class.uiproject.inc.php, 1.14 class.menu.inc.php, 1.10 class.uitenant_claim.inc.php, 1.2 class.soinvoice.inc.php, 1.11 class.uiworkorder.inc.php, 1.6 class.soworkorder.inc.php, 1.5 class.soproject.inc.php, 1.18 class.botenant_claim.inc.php, 1.2 class.sotenant_claim.inc.php, 1.2 class.boproject.inc.php, 1.9
Date: Thu, 14 Apr 2005 16:48:00 +0200

Update of property/inc

Modified Files:
     Branch: MAIN
            class.uiinvoice.inc.php lines: +3 -1
            class.uiproject.inc.php lines: +10 -4
            class.menu.inc.php lines: +10 -1
            class.uitenant_claim.inc.php lines: +104 -14
            class.soinvoice.inc.php lines: +21 -7
            class.uiworkorder.inc.php lines: +2 -2
            class.soworkorder.inc.php lines: +12 -2
            class.soproject.inc.php lines: +4 -3
            class.botenant_claim.inc.php lines: +77 -3
            class.sotenant_claim.inc.php lines: +71 -10
            class.boproject.inc.php lines: +2 -1

Log Message:
no message

====================================================
Index: property/inc/class.uiinvoice.inc.php
diff -u property/inc/class.uiinvoice.inc.php:1.13 
property/inc/class.uiinvoice.inc.php:1.14
--- property/inc/class.uiinvoice.inc.php:1.13   Thu Jan 13 16:52:48 2005
+++ property/inc/class.uiinvoice.inc.php        Thu Apr 14 14:48:39 2005
@@ -415,6 +415,7 @@
                                        $content[$i]['link_remark']             
                = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvoice.remark');
                                        $content[$i]['lang_remark_help']        
                = lang('Klick this link to view the remark');
                                        $content[$i]['link_order']              
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiinvoice.view_order');
+                                       $content[$i]['link_claim']              
                        = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.check');
                                        $i++;
                                }
                        }
@@ -549,6 +550,7 @@
                                'lang_vendor'                                   
=> lang('Vendor'),
                                'voucher_id'                                    
=> $voucher_id,
                                'lang_voucher_id'                               
=> lang('Voucher Id'),
+                               'lang_claim'                                    
=> lang('Claim'),
                                'table_done'                                    
=> $table_done
                        );


====================================================
Index: property/inc/class.uiproject.inc.php
diff -u property/inc/class.uiproject.inc.php:1.13 
property/inc/class.uiproject.inc.php:1.14
--- property/inc/class.uiproject.inc.php:1.13   Tue Mar  1 15:04:27 2005
+++ property/inc/class.uiproject.inc.php        Thu Apr 14 14:48:39 2005
@@ -159,7 +159,8 @@
                                                                                
'nextmatchs',
                                                                                
'search_field'));

-                       $lookup = get_var('lookup',array('POST','GET'));
+                       $lookup                         = 
get_var('lookup',array('POST','GET'));
+                       $from                           = 
get_var('from',array('POST','GET'));
                        $start_date             = 
urldecode(get_var('start_date',array('POST','GET')));
                        $end_date                       = 
urldecode(get_var('end_date',array('POST','GET')));

@@ -185,7 +186,7 @@
                                                                
$content[$j]['row'][]= array(
                                                                        
'statustext' => lang('search'),
                                                                        'text'  
        => $project_entry[$uicols['name'][$k]],
-                                                                       'link'  
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&query='
 . $project_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . $lookup 
. '&filter=' . $this->filter)
+                                                                       'link'  
        => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&query='
 . $project_entry['query_location'][$uicols['name'][$k]] . '&lookup=' . $lookup 
. '&from=' . $from . '&filter=' . $this->filter)
                                                                );
                                                        }
                                                        else
@@ -208,7 +209,7 @@
                                                if($lookup && 
$k==($count_uicols_name-1))
                                                {
                                                        $content[$j]['row'][]= 
array(
-                                                       'lookup_action' => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiworkorder.edit&project_id='
 . $project_entry['project_id'])
+                                                       'lookup_action' => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.ui' . 
$from . '.edit&project_id=' . $project_entry['project_id'])
                                                        );
                                                }
                                        }
@@ -279,6 +280,7 @@
                                                                                
                                                        'type_id'       
=>$type_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'from'          =>$from,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        
'start_date'=>$start_date,
@@ -297,6 +299,7 @@
                                                                                
                                                        'type_id'       
=>$type_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'from'          =>$from,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        
'start_date'=>$start_date,
@@ -315,6 +318,7 @@
                                                                                
                                                        'type_id'       
=>$type_id,
                                                                                
                                                        'query'         
=>$this->query,
                                                                                
                                                        'lookup'        
=>$lookup,
+                                                                               
                                                        'from'          =>$from,
                                                                                
                                                        'district_id'   => 
$this->district_id,
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        
'start_date'=>$start_date,
@@ -376,6 +380,7 @@
                                                'filter'                
=>$this->filter,
                                                'status_id'             
=>$this->status_id,
                                                'lookup'                
=>$lookup,
+                                               'from'                  =>$from,
                                                'query'                 
=>$this->query,
                                                'start_date'    =>$start_date,
                                                'end_date'              
=>$end_date
@@ -393,6 +398,7 @@
                                                'filter'                
=>$this->filter,
                                                'status_id'             
=>$this->status_id,
                                                'lookup'                
=>$lookup,
+                                               'from'                  =>$from,
                                                'query'                 
=>$this->query,
                                                'start_date'    =>$start_date,
                                                'end_date'              
=>$end_date,

====================================================
Index: property/inc/class.menu.inc.php
diff -u property/inc/class.menu.inc.php:1.9 property/inc/class.menu.inc.php:1.10
--- property/inc/class.menu.inc.php:1.9 Wed Mar 16 12:11:00 2005
+++ property/inc/class.menu.inc.php     Thu Apr 14 14:48:39 2005
@@ -403,6 +403,15 @@
                                        $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitemplate.index');
                                        $menu['sub_menu'][$i]['name']           
        =       lang('template');
                                        $menu['sub_menu'][$i]['statustext']     
        =       lang('Workorder template');
+
+                                       $i++;
+                                       if($page=='tenant_claim')
+                                       {
+                                               
$menu['sub_menu'][$i]['this']=True;
+                                       }
+                                       $menu['sub_menu'][$i]['link']           
        =       
$GLOBALS['phpgw']->link('/index.php','menuaction='.$currentapp.'.uitenant_claim.index');
+                                       $menu['sub_menu'][$i]['name']           
        =       lang('Tenant claim');
+                                       $menu['sub_menu'][$i]['statustext']     
        =       lang('Tenant claim');
                                }

                                if ($sub == adm_loc && 
$this->acl2->check('.location',16))

====================================================
Index: property/inc/class.uitenant_claim.inc.php
diff -u property/inc/class.uitenant_claim.inc.php:1.1 
property/inc/class.uitenant_claim.inc.php:1.2
--- property/inc/class.uitenant_claim.inc.php:1.1       Tue Apr 12 14:12:20 2005
+++ property/inc/class.uitenant_claim.inc.php   Thu Apr 14 14:48:39 2005
@@ -39,6 +39,7 @@
                var $public_functions = array
                (
                        'index'  => True,
+                       'check'  => True,
                        'view'   => True,
                        'edit'   => True,
                        'delete' => True
@@ -69,6 +70,7 @@
                        $this->sort                     = $this->bo->sort;
                        $this->order            = $this->bo->order;
                        $this->filter           = $this->bo->filter;
+                       $this->status           = $this->bo->status;
                        $this->cat_id           = $this->bo->cat_id;
                        $this->allrows          = $this->bo->allrows;
                }
@@ -82,13 +84,14 @@
                                'sort'                  => $this->sort,
                                'order'                 => $this->order,
                                'filter'                => $this->filter,
+                               'status'                => $this->status,
                                'cat_id'                => $this->cat_id,
                                'this->allrows' => $this->allrows
                        );
                        $this->bo->save_sessiondata($data);
                }

-               function index()
+               function index($project_id='')
                {
                        
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim',
                                                                                
'menu',
@@ -108,7 +111,7 @@
                        $receipt = 
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt');
                        
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt','');

-                       $claim_list = $this->bo->read();
+                       $claim_list = $this->bo->read(array('project_id' => 
$project_id));

                        while (is_array($claim_list) && list(,$claim) = 
each($claim_list))
                        {
@@ -121,6 +124,7 @@
                                $content[] = array
                                (
                                        'claim_id'                              
        => $claim['claim_id'],
+                                       'project_id'                            
=> $claim['project_id'],
                                        'name'                                  
        => $name,
                                        'entry_date'                            
=> $claim['entry_date'],
                                        'category'                              
        => $claim['category'],
@@ -140,12 +144,24 @@

                        $table_header = array
                        (
+                               'lang_project'          => lang('Project'),
                                'lang_name'                     => lang('name'),
                                'lang_time_created'     => lang('time created'),
                                'lang_view'                     => lang('view'),
                                'lang_edit'                     => lang('edit'),
                                'lang_delete'           => lang('delete'),
                                'lang_claim_id'         => lang('claim id'),
+                               'sort_project'          => 
$this->nextmatchs->show_sort_order(array
+                                                                               
(
+                                                                               
        'sort'  => $this->sort,
+                                                                               
        'var'   => 'project_id',
+                                                                               
        'order' => $this->order,
+                                                                               
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitenant_claim.index',
+                                                                               
                                                        'cat_id'        => 
$this->cat_id,
+                                                                               
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'status'        
=>$this->status,
+                                                                               
                                                        'allrows'       
=>$this->allrows)
+                                                                               
)),
                                'sort_name'             => 
$this->nextmatchs->show_sort_order(array
                                                                                
(
                                                                                
        'sort'  => $this->sort,
@@ -154,6 +170,7 @@
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitenant_claim.index',
                                                                                
                                                        'cat_id'        => 
$this->cat_id,
                                                                                
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'status'        
=>$this->status,
                                                                                
                                                        'allrows'       
=>$this->allrows)
                                                                                
)),
                                'sort_claim_id'         => 
$this->nextmatchs->show_sort_order(array
@@ -164,6 +181,7 @@
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitenant_claim.index',
                                                                                
                                                        'cat_id'        => 
$this->cat_id,
                                                                                
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'status'        
=>$this->status,
                                                                                
                                                        'allrows'       
=>$this->allrows)
                                                                                
)),
                                'sort_time_created'     => 
$this->nextmatchs->show_sort_order(array
@@ -174,6 +192,7 @@
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitenant_claim.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'status'        
=>$this->status,
                                                                                
                                                        'allrows'       
=>$this->allrows)
                                                                                
)),
                                'sort_category' => 
$this->nextmatchs->show_sort_order(array
@@ -184,16 +203,29 @@
                                                                                
        'extra'         => array('menuaction'   => 
$this->currentapp.'.uitenant_claim.index',
                                                                                
                                                        'cat_id'        
=>$this->cat_id,
                                                                                
                                                        'query'         
=>$this->query,
+                                                                               
                                                        'status'        
=>$this->status,
                                                                                
                                                        'allrows'       
=>$this->allrows)
                                                                                
)),
                                'lang_category'         => lang('category')
                        );

+                       if ($project_id)
+                       {
+                               $lang_add = lang('add another');
+                               $add_action     = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.edit&project_id='
 . $project_id);
+                       }
+                       else
+                       {
+                               $lang_add = lang('add');
+                               $add_action     = 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&lookup=true&from=tenant_claim');
+
+                       }
+
                        $table_add = array
                        (
-                               'lang_add'                              => 
lang('add'),
+                               'lang_add'                              => 
$lang_add,
                                'lang_add_statustext'   => lang('add a claim'),
-                               'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uitenant_claim.edit')
+                               'add_action'                    => $add_action
                        );

                        $link_data = array
@@ -203,6 +235,7 @@
                                                'order'                 
=>$this->order,
                                                'cat_id'                
=>$this->cat_id,
                                                'filter'                
=>$this->filter,
+                                               'status'        =>$this->status,
                                                'query'                 
=>$this->query
                        );

@@ -236,6 +269,12 @@
                                'select_action'                                 
=> $GLOBALS['phpgw']->link('/index.php',$link_data),
                                'filter_list'                                   
=> $this->nextmatchs->xslt_filter(array('filter' => $this->filter)),
                                'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
+
+                               'status_name'                                   
=> 'status',
+                               'status_list'                                   
=> $this->bo->get_status_list(array('format' => 'filter', 'selected' => 
$this->status,'default' => 'open')),
+                               'lang_no_status'                                
=> lang('Open'),
+                               'lang_filter_statustext'                => 
lang('Select the filter. To show all entries select SHOW ALL'),
+
                                'lang_searchfield_statustext'   => lang('Enter 
the search string. To show all entries, empty this field and press the SUBMIT 
button again'),
                                'lang_searchbutton_statustext'  => lang('Submit 
the search string'),
                                'query'                                         
        => $this->query,
@@ -252,7 +291,30 @@
                }


-               function edit()
+               function check()
+               {
+                       $project_id             = 
get_var('project_id',array('POST','GET'));
+
+                       
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
+
+                       $claim = $this->bo->check_claim_project($project_id);
+                       $total_records  = $this->bo->total_records;
+
+                       if($total_records > 0)
+                       {
+                               $receipt['message'][] = array('msg'=>lang('%1 
claim is already registered for this project',$total_records));
+                               
$GLOBALS['phpgw']->session->appsession('session_data','tenant_claim_receipt',$receipt);
+                               $this->index($project_id);
+                       }
+                       else
+                       {
+                               $this->edit($project_id);
+                       }
+
+                       return;
+               }
+
+               function edit($project_id='')
                {
                        $claim_id       = 
get_var('claim_id',array('POST','GET'));

@@ -264,6 +326,11 @@
                        $values['last_name']            = 
get_var('last_name',array('POST'));
                        $values['first_name']           = 
get_var('first_name',array('POST'));

+                       if($project_id)
+                       {
+                               $values['project_id'] = $project_id;
+                       }
+
                        $this->boproject= 
CreateObject($this->currentapp.'.boproject');

                        
$GLOBALS['phpgw']->xslttpl->add_file(array('tenant_claim'));
@@ -280,7 +347,7 @@
                                        
$receipt['error'][]=array('msg'=>lang('Please select a budget account !'));
                                }

-                               if(!$values['workorder_id'])
+                               if(!$values['workorder'])
                                {
                                        
$receipt['error'][]=array('msg'=>lang('Please select a workorder !'));
                                }
@@ -315,13 +382,16 @@

                        $project_values = 
$this->boproject->read_single($values['project_id']);

+//_debug_array($project_values);
+
                        $table_header_workorder[] = array
                        (
-                               'lang_workorder_id'     => lang('Workorder'),
-                               'lang_budget'           => lang('Budget'),
-                               'lang_calculation'      => lang('Calculation'),
-                               'lang_vendor'   => lang('Vendor'),
-                               'lang_select'   => lang('Select')
+                               'lang_workorder_id'             => 
lang('Workorder'),
+                               'lang_budget'                   => 
lang('Budget'),
+                               'lang_calculation'              => 
lang('Calculation'),
+                               'lang_vendor'                   => 
lang('Vendor'),
+                               'lang_charge_tenant'    => lang('Charge 
tenant'),
+                               'lang_select'                   => 
lang('Select')
                        );

                        $bolocation                     = 
CreateObject($this->currentapp.'.bolocation');
@@ -362,9 +432,10 @@
                        }
                        endif;

-                       if($values['workorder_id'] && 
$project_values['workorder_budget'])
+
+                       if($values['workorder'] && 
$project_values['workorder_budget'])
                        {
-                               foreach ($values['workorder_id'] as 
$workorder_id)
+                               foreach ($values['workorder'] as $workorder_id)
                                {
                                        for 
($i=0;$i<count($project_values['workorder_budget']);$i++)
                                        {
@@ -376,6 +447,19 @@
                                }
                        }

+
+                       for 
($i=0;$i<count($project_values['workorder_budget']);$i++)
+                       {
+                               $claimed= 
$this->bo->check_claim_workorder($project_values['workorder_budget'][$i]['workorder_id']);
+
+                               if($claimed)
+                               {
+                                       
$project_values['workorder_budget'][$i]['claimed'] = $claimed;
+                               }
+                       }
+
+
+
                        $this->cat_id = 
($values['cat_id']?$values['cat_id']:$this->cat_id);
                        
$b_account_data=$this->bocommon->initiate_ui_budget_account_lookup(array(
                                                'b_account_id'          => 
$values['b_account_id'],
@@ -459,6 +543,12 @@

 //------------------

+                               'lang_status'                                   
=> lang('Status'),
+                               'lang_status_statustext'                => 
lang('Select status'),
+                               'status_list'                                   
=> $this->bo->get_status_list(array('format' => 'select', 'selected' => 
$values['status'],'default' => 'open')),
+                               'lang_no_status'                                
=> lang('No status'),
+                               'select_status_name'                    => 
'values[status]',
+
                                'lang_amount'                                   
=> lang('amount'),
                                'lang_amount_statustext'                => 
lang('The total amount to claim'),
                                'value_amount'                                  
=> $values['amount'],

====================================================
Index: property/inc/class.soinvoice.inc.php
diff -u property/inc/class.soinvoice.inc.php:1.10 
property/inc/class.soinvoice.inc.php:1.11
--- property/inc/class.soinvoice.inc.php:1.10   Mon Apr 11 12:01:39 2005
+++ property/inc/class.soinvoice.inc.php        Thu Apr 14 14:48:39 2005
@@ -356,9 +356,10 @@
                                $filtermethod = " WHERE ( bilagsnr= 
'$voucher_id')";
                        }

-                       $sql = "SELECT 
$table.*,fm_workorder.status,fm_workorder.charge_tenant ,org_name FROM (( 
$table $this->left_join "
-                       . "fm_workorder on fm_workorder.id = 
$table.pmwrkord_code ) $this->join "
-                       . "fm_vendor  on $table.spvend_code = fm_vendor.id ) 
$filtermethod ";
+                       $sql = "SELECT 
$table.*,fm_workorder.status,fm_workorder.charge_tenant,org_name,fm_project.claim_issued
 FROM $table "
+                       . " $this->left_join fm_workorder on fm_workorder.id = 
$table.pmwrkord_code  "
+                       . " $this->join fm_project on fm_project.id = 
fm_workorder.project_id"
+                       . " $this->join fm_vendor  on $table.spvend_code = 
fm_vendor.id  $filtermethod ";

                        $this->db2->query($sql,__LINE__,__FILE__);
                        $this->total_records = $this->db2->num_rows();
@@ -369,7 +370,8 @@
                        while ($this->db->next_record())
                        {
                                $invoice[$i]['counter']                         
        = $i;
-                               $invoice[$i]['project_id']                      
= $this->db->f('project_id');
+                               $invoice[$i]['claim_issued']                    
= $this->db->f('claim_issued');
+                               $invoice[$i]['project_id']                      
        = $this->db->f('project_id');
                                $invoice[$i]['workorder_id']                    
= $this->db->f('pmwrkord_code');
                                $invoice[$i]['status']                          
        = $this->db->f('status');
                                if ($this->db->f('status')=='closed')
@@ -941,8 +943,6 @@
                                                        $local_error= true;
                                                }

-
-
                                                if 
(!($check_count['spbudact_code_count'] == $values['invoice_count'][$n]))
                                                {
                                                        $receipt['error'][] = 
array('msg'=>lang('Budget code is missing from sub invoice in :'). " 
".$values['voucher_id'][$n]);
@@ -955,6 +955,12 @@
                                                        $local_error= true;
                                                }

+                                               if 
($this->check_claim($voucher_id))
+                                               {
+                                                       $receipt['error'][] = 
array('msg'=>lang('Tenant claim is not issued for project in voucher 
%1',$voucher_id));
+                                                       $local_error= true;
+                                               }
+
                                                $blank_date = '';
                                                $sign_field='';
                                                $sign_id='';
@@ -1133,5 +1139,13 @@
                        return $allow_transfer;
                }

+               function check_claim($voucher_id='')
+               {
+                       $sql = "SELECT count(*) FROM fm_ecobilag 
$this->left_join fm_workorder on fm_ecobilag.pmwrkord_code = fm_workorder.id "
+                       . " WHERE bilagsnr='$voucher_id' AND 
fm_workorder.charge_tenant=1 AND fm_workorder.claim_issued IS NULL";
+                       $this->db->query($sql,__LINE__,__FILE__);
+                       $this->db->next_record();
+                       return $this->db->f(0);
+               }
        }
 ?>

====================================================
Index: property/inc/class.uiworkorder.inc.php
diff -u property/inc/class.uiworkorder.inc.php:1.5 
property/inc/class.uiworkorder.inc.php:1.6
--- property/inc/class.uiworkorder.inc.php:1.5  Thu Jan 13 16:52:48 2005
+++ property/inc/class.uiworkorder.inc.php      Thu Apr 14 14:48:39 2005
@@ -906,7 +906,7 @@
                        (
                                'done_action'                   => 
$GLOBALS['phpgw']->link('/index.php',$link_data),
                                'add_action'                    => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.edit'),
-                               'search_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&lookup=true'),
+                               'search_action'                 => 
$GLOBALS['phpgw']->link('/index.php','menuaction='.$this->currentapp.'.uiproject.index&lookup=true&from=workorder'),

                                'lang_done_statustext'                  => 
lang('Back to the workorder list'),
                                'lang_add_statustext'                   => 
lang('Adds a new project - then a new workorder'),

====================================================
Index: property/inc/class.soworkorder.inc.php
diff -u property/inc/class.soworkorder.inc.php:1.4 
property/inc/class.soworkorder.inc.php:1.5
--- property/inc/class.soworkorder.inc.php:1.4  Thu Jan 13 16:52:48 2005
+++ property/inc/class.soworkorder.inc.php      Thu Apr 14 14:48:39 2005
@@ -480,6 +480,12 @@

                        $this->db->query("INSERT INTO fm_orders (id,type) 
VALUES (" . $workorder['workorder_id'] . ",'workorder')");

+
+                       if($workorder['charge_tenant'])
+                       {
+                               $this->db->query("UPDATE fm_project set 
charge_tenant = 1 WHERE id =" . $workorder['project_id']);
+                       }
+
                        if($this->db->transaction_commit())
                        {
                                $this->increment_workorder_id();
@@ -498,7 +504,6 @@
                        $historylog     = 
CreateObject($this->currentapp.'.historylog','workorder');
                        $workorder['descr'] = 
$this->db->db_addslashes($workorder['descr']);
                        $workorder['title'] = 
$this->db->db_addslashes($workorder['title']);
-//_debug_array($workorder);

                        $value_set=array(
                                'title'                 => $workorder['title'],
@@ -528,6 +533,11 @@

                        $this->db->query("UPDATE fm_workorder set $value_set 
WHERE id=" . $workorder['workorder_id'] ,__LINE__,__FILE__);

+                       if($workorder['charge_tenant'])
+                       {
+                               $this->db->query("UPDATE fm_project set 
charge_tenant = 1 WHERE id =" . $workorder['project_id']);
+                       }
+
                        if($this->db->transaction_commit())
                        {
                                if ($old_status != $workorder['status'])

====================================================
Index: property/inc/class.soproject.inc.php
diff -u property/inc/class.soproject.inc.php:1.17 
property/inc/class.soproject.inc.php:1.18
--- property/inc/class.soproject.inc.php:1.17   Wed Mar  2 10:29:38 2005
+++ property/inc/class.soproject.inc.php        Thu Apr 14 14:48:39 2005
@@ -407,7 +407,7 @@

                function project_workorder_data($project_id = '')
                {
-                       $this->db->query("SELECT act_mtrl_cost, 
act_vendor_cost, budget, id as workorder_id, vendor_id, 
calculation,rig_addition,addition,deviation from fm_workorder where 
project_id='$project_id'");
+                       $this->db->query("SELECT act_mtrl_cost, 
act_vendor_cost, budget, id as workorder_id, vendor_id, 
calculation,rig_addition,addition,deviation,charge_tenant from fm_workorder 
where project_id='$project_id'");
                        while ($this->db->next_record())
                        {
                                $budget[] = array(
@@ -417,7 +417,8 @@
                                        'calculation'   => 
($this->db->f('calculation')*(1+$this->db->f('addition')/100))+$this->db->f('rig_addition'),
                                        'vendor_id'             => 
$this->db->f('vendor_id'),
                                        'act_mtrl_cost'         => 
$this->db->f('act_mtrl_cost'),
-                                       'act_vendor_cost'       => 
$this->db->f('act_vendor_cost')
+                                       'act_vendor_cost'       => 
$this->db->f('act_vendor_cost'),
+                                       'charge_tenant'         => 
$this->db->f('charge_tenant')
                                        );
                        }
                        return $budget;

====================================================
Index: property/inc/class.botenant_claim.inc.php
diff -u property/inc/class.botenant_claim.inc.php:1.1 
property/inc/class.botenant_claim.inc.php:1.2
--- property/inc/class.botenant_claim.inc.php:1.1       Tue Apr 12 14:12:20 2005
+++ property/inc/class.botenant_claim.inc.php   Thu Apr 14 14:48:39 2005
@@ -52,6 +52,7 @@
                        $sort   = get_var('sort',array('POST','GET'));
                        $order  = get_var('order',array('POST','GET'));
                        $filter = get_var('filter',array('POST','GET'));
+                       $status = get_var('status',array('POST','GET'));
                        $cat_id = get_var('cat_id',array('POST','GET'));
                        $allrows= get_var('allrows',array('POST','GET'));

@@ -72,6 +73,10 @@
                        {
                                $this->filter = $filter;
                        }
+                       if(isset($status))
+                       {
+                               $this->status = $status;
+                       }
                        if(isset($sort))
                        {
                                $this->sort = $sort;
@@ -109,6 +114,7 @@
                        $this->start    = $data['start'];
                        $this->query    = $data['query'];
                        $this->filter   = $data['filter'];
+                       $this->status   = $data['status'];
                        $this->sort             = $data['sort'];
                        $this->order    = $data['order'];
                        $this->cat_id   = $data['cat_id'];
@@ -119,6 +125,59 @@
                        return (!!($has & $needed) == True);
                }

+               function get_status_list($data=0)
+               {
+                       if(is_array($data))
+                       {
+                               $format = 
(isset($data['format'])?$data['format']:'');
+                               $selected = 
(isset($data['selected'])?$data['selected']:$data['default']);
+                       }
+                       else
+                       {
+                               return;
+                       }
+
+                       $GLOBALS['phpgw']->xslttpl->add_file(array('status_' . 
$format));
+
+                       $status[0][id]='closed';
+                       $status[0][name]=lang('Closed');
+                       if($format == "filter")
+                       {
+                               $status[1][id]='all';
+                               $status[1][name]=lang('All');
+                       }
+                       else
+                       {
+                               $status[1][id]='open';
+                               $status[1][name]=lang('Open');
+                       }
+
+                       while (is_array($status) && list(,$entry) = 
each($status))
+                       {
+                               $sel_status = '';
+                               if ($entry['id']==$selected)
+                               {
+                                       $sel_status = 'selected';
+                               }
+
+                               $status_list[] = array
+                               (
+                                       'id'    => $entry['id'],
+                                       'name'          => $entry['name'],
+                                       'selected'      => $sel_status
+                               );
+                       }
+
+                       for ($i=0;$i<count($status_list);$i++)
+                       {
+                               if ($status_list[$i]['selected'] != 'selected')
+                               {
+                                       unset($status_list[$i]['selected']);
+                               }
+                       }
+
+                       return $status_list;
+               }

                function read_category_name($cat_id='')
                {
@@ -166,10 +225,11 @@
                        return $category_list;
                }

-               function read()
+               function read($data=0)
                {
                        $claim = $this->so->read(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
+                                                                               
        'filter' => $this->filter,'status' => $this->status,'cat_id' => 
$this->cat_id,
+                                                                               
        'allrows'=>$this->allrows,'project_id' => $data['project_id']));
                        $this->total_records = $this->so->total_records;

                        for ($i=0; $i<count($claim); $i++)
@@ -179,6 +239,20 @@
                        return $claim;
                }

+               function check_claim_project($project_id)
+               {
+                       $claim = $this->so->check_claim_project($project_id);
+                       $this->total_records = $this->so->total_records;
+                       return $claim;
+               }
+
+               function check_claim_workorder($workorder_id)
+               {
+                       $claim = 
$this->so->check_claim_workorder($workorder_id);
+                       $this->total_records = $this->so->total_records;
+                       return $claim;
+               }
+
                function read_single($claim_id)
                {
                        return $this->so->read_single($claim_id);

====================================================
Index: property/inc/class.sotenant_claim.inc.php
diff -u property/inc/class.sotenant_claim.inc.php:1.1 
property/inc/class.sotenant_claim.inc.php:1.2
--- property/inc/class.sotenant_claim.inc.php:1.1       Tue Apr 12 14:12:20 2005
+++ property/inc/class.sotenant_claim.inc.php   Thu Apr 14 14:48:39 2005
@@ -67,11 +67,14 @@
                        {
                                $start  = 
(isset($data['start'])?$data['start']:0);
                                $filter = 
(isset($data['filter'])?$data['filter']:'none');
+                               $status = 
(isset($data['status'])?$data['status']:'open');
                                $query = 
(isset($data['query'])?$data['query']:'');
                                $sort = 
(isset($data['sort'])?$data['sort']:'DESC');
                                $order = 
(isset($data['order'])?$data['order']:'');
                                $cat_id = 
(isset($data['cat_id'])?$data['cat_id']:0);
-                               $allrows                = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $allrows        = 
(isset($data['allrows'])?$data['allrows']:'');
+                               $project_id     = 
(isset($data['project_id'])?$data['project_id']:'');
+
                        }

                        if ($order)
@@ -89,9 +92,26 @@
                        {
                                $filtermethod .= " $where category='$cat_id' ";
                                $where = 'AND';
+                       }

+                       if ($project_id > 0)
+                       {
+                               $filtermethod .= " $where 
project_id='$project_id' ";
+                               $where = 'AND';
                        }

+                       if ($status == 'closed'):
+                       {
+                               $filtermethod .= " $where 
fm_tenant_claim.status='closed'";
+                               $where = 'AND';
+                       }
+                       elseif($status == ''):
+                       {
+                               $filtermethod .= " $where 
fm_tenant_claim.status='open'";
+                               $where = 'AND';
+                       }
+                       endif;
+
                        if($query)
                        {
                                $query = ereg_replace("'",'',$query);
@@ -119,6 +139,7 @@
                                $claims[] = array
                                (
                                        'claim_id'              => 
$this->db->f('id'),
+                                       'project_id'    => 
$this->db->f('project_id'),
                                        'tenant_id'             => 
$this->db->f('tenant_id'),
                                        'remark'                => 
stripslashes($this->db->f('remark')),
                                        'entry_date'    => 
$this->db->f('entry_date'),
@@ -128,6 +149,43 @@
                        return $claims;
                }

+               function check_claim_project($project_id)
+               {
+                       $sql = "SELECT fm_tenant_claim.*, descr as category 
FROM fm_tenant_claim"
+                        . " $this->join fm_tenant_claim_category on 
fm_tenant_claim.category=fm_tenant_claim_category.id"
+                        . " WHERE project_id = $project_id";
+
+                       $this->db2->query($sql,__LINE__,__FILE__);
+                       $this->total_records = $this->db2->num_rows();
+
+                       $this->db->query($sql . $ordermethod,__LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $claims[] = array
+                               (
+                                       'claim_id'              => 
$this->db->f('id'),
+                                       'project_id'    => 
$this->db->f('project_id'),
+                                       'tenant_id'             => 
$this->db->f('tenant_id'),
+                                       'entry_date'    => 
$this->db->f('entry_date'),
+                                       'category'              => 
$this->db->f('category')
+                               );
+                       }
+                       return $claims;
+               }
+
+               function check_claim_workorder($workorder_id)
+               {
+                       $this->db->query("select * from fm_origin WHERE 
destination ='tenant_claim' AND origin_id='$workorder_id'",__LINE__,__FILE__);
+
+                       while ($this->db->next_record())
+                       {
+                               $claim[] = $this->db->f('destination_id');
+                       }
+
+                       return @implode(",", $claim);
+               }
+
                function read_single($id)
                {
                        $this->db->query("select * from fm_tenant_claim where 
id='$id'",__LINE__,__FILE__);
@@ -143,6 +201,7 @@
                                $claim['amount']                = 
$this->db->f('amount');
                                $claim['b_account_id']  = 
$this->db->f('b_account_id');
                                $claim['cat_id']                = 
(int)$this->db->f('category');
+                               $claim['status']                = 
$this->db->f('status');

                        }

@@ -150,7 +209,7 @@

                        while ($this->db->next_record())
                        {
-                               $claim['workorder_id'][] = 
$this->db->f('origin_id');
+                               $claim['workorder'][] = 
$this->db->f('origin_id');
                        }

                        return $claim;
@@ -171,19 +230,20 @@
                                $claim['cat_id'],
                                $claim['remark'],
                                $this->account,
-                               time()
+                               time(),
+                               $claim['status']
                                );

                        $values_insert  = 
$this->bocommon->validate_db_insert($values_insert);


-                       $this->db->query("INSERT INTO fm_tenant_claim 
(project_id,tenant_id,amount,b_account_id,category,remark,user_id,entry_date) "
+                       $this->db->query("INSERT INTO fm_tenant_claim 
(project_id,tenant_id,amount,b_account_id,category,remark,user_id,entry_date,status)
 "
                                . "VALUES ($values_insert)",__LINE__,__FILE__);

                        $claim_id = 
$this->db->get_last_insert_id('fm_tenant_claim','id');
                        $receipt['claim_id'] = $claim_id;

-                       foreach ($claim['workorder_id'] as $workorder_id)
+                       foreach ($claim['workorder'] as $workorder_id)
                        {
                                $this->db->query("INSERT INTO fm_origin 
(origin,origin_id,destination,destination_id,entry_date,user_id) "
                                . "VALUES ('workorder',"
@@ -193,7 +253,7 @@
                                . time().","
                                . $this->account .")",__LINE__,__FILE__);

-                               $this->db->query("UPDATE fm_workorder set 
claim_id = $claim_id WHERE id=$workorder_id" ,__LINE__,__FILE__);
+                               $this->db->query("UPDATE fm_workorder set 
claim_issued = 1 WHERE id=" . $claim['project_id'] ,__LINE__,__FILE__);
                        }

                        $this->db->transaction_commit();
@@ -214,6 +274,7 @@
                                'b_account_id'          => 
$claim['b_account_id'],
                                'amount'                        => 
$claim['amount'],
                                'category'                      => 
$claim['cat_id'],
+                               'status'                        => 
$claim['status'],
                                'user_id'                       => 
$this->account,
                                'remark'                        => 
$this->db->db_addslashes($claim['remark'])
                                );
@@ -226,9 +287,9 @@

                        $this->db->query("DELETE FROM fm_origin WHERE 
destination ='tenant_claim' AND destination_id=$claim_id",__LINE__,__FILE__);

-                       $this->db->query("UPDATE fm_workorder set claim_id = 
NULL WHERE id=" . $claim['project_id'] ,__LINE__,__FILE__);
+                       $this->db->query("UPDATE fm_workorder set claim_issued 
= NULL WHERE id=" . $claim['project_id'] ,__LINE__,__FILE__);

-                       foreach ($claim['workorder_id'] as $workorder_id)
+                       foreach ($claim['workorder'] as $workorder_id)
                        {
                                $this->db->query("INSERT INTO fm_origin 
(origin,origin_id,destination,destination_id,entry_date,user_id) "
                                . "VALUES ('workorder',"
@@ -238,7 +299,7 @@
                                . time().","
                                . $this->account .")",__LINE__,__FILE__);

-                               $this->db->query("UPDATE fm_workorder set 
claim_id = $claim_id WHERE id=$workorder_id" ,__LINE__,__FILE__);
+                               $this->db->query("UPDATE fm_workorder set 
claim_issued = 1 WHERE id=" . $claim['project_id'] ,__LINE__,__FILE__);
                        }

                        $this->db->transaction_commit();

====================================================
Index: property/inc/class.boproject.inc.php
diff -u property/inc/class.boproject.inc.php:1.8 
property/inc/class.boproject.inc.php:1.9
--- property/inc/class.boproject.inc.php:1.8    Tue Mar  1 15:04:27 2005
+++ property/inc/class.boproject.inc.php        Thu Apr 14 14:48:39 2005
@@ -365,6 +365,7 @@
                                
$project['workorder_budget'][$i]['workorder_id']=$workorder_data[$i]['workorder_id'];
                                
$project['workorder_budget'][$i]['budget']=number_format($workorder_data[$i]['budget'],
 2, ',', '');
                                
$project['workorder_budget'][$i]['calculation']=number_format($workorder_data[$i]['calculation']*$tax,
 2, ',', '');
+                               
$project['workorder_budget'][$i]['charge_tenant'] = 
$workorder_data[$i]['charge_tenant'];
                                $vendor = 
$contacts->read_single(array('actor_id'=>(int)$workorder_data[$i]['vendor_id']));
                                if(is_array($vendor))
                                {






reply via email to

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