[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Phpgroupware-cvs] property/class.boinvoice.php, 1.1.1.3
From: |
nomail |
Subject: |
[Phpgroupware-cvs] property/class.boinvoice.php, 1.1.1.3 |
Date: |
Fri, 21 May 2004 15:58:22 -0000 |
Update of /property
Modified Files:
Branch:
class.boinvoice.php
date: 2004/04/23 21:26:33; author: sigurdne; state: Exp; lines: +728 -728
Log Message:
no message
=====================================================================
Index: property/class.boinvoice.php
diff -u property/class.boinvoice.php:1.1.1.2
property/class.boinvoice.php:1.1.1.3
--- property/class.boinvoice.php:1.1.1.2 Fri Apr 23 20:25:23 2004
+++ property/class.boinvoice.php Fri Apr 23 21:26:33 2004
@@ -1,728 +1,728 @@
-<?php
-
/**************************************************************************\
- * phpGroupWare - property
*
- * http://www.phpgroupware.org
*
- *
*
- * Facilities Management
*
- * Written by Sigurd Nes [sigurdne at online.no]
*
- *
------------------------------------------------------------------------ *
- * Copyright 2000 - 2003 Free Software Foundation, Inc
*
- * This program is part of the GNU project, see http://www.gnu.org/
*
- *
------------------------------------------------------------------------ *
- * This program is free software; you can redistribute it and/or modify
it *
- * under the terms of the GNU General Public License as published by the
*
- * Free Software Foundation; either version 2 of the License, or (at
your *
- * option) any later version.
*
-
\**************************************************************************/
-
- /* $Id$ */
-
- class property_boinvoice
- {
- var $db = '';
-
- function property_boinvoice($session=False)
- {
- $this->db = $GLOBALS['phpgw']->db;
- $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
- $this->so =
CreateObject($this->currentapp.'_soinvoice',True);
- $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
- $this->account_id =
$GLOBALS['phpgw_data']['user']['id'];
- $this->fm_session =
CreateObject($this->currentapp.'_session');
-
- if ($session)
- {
- $this->read_sessiondata();
- $this->use_session = True;
- }
-
- $start =
get_var('start',array('POST','GET'));
- $query =
get_var('query',array('POST','GET'));
- $sort =
get_var('sort',array('POST','GET'));
- $order =
get_var('order',array('POST','GET'));
- $filter =
get_var('filter',array('POST','GET'));
- $cat_id =
get_var('cat_id',array('POST','GET'));
- $user_lid =
get_var('user_lid',array('POST','GET'));
- $allrows =
get_var('allrows',array('POST','GET'));
-
- if ($start)
- {
- $this->start=$start;
- }
- else
- {
- $this->start=0;
- }
-
- if(isset($query))
- {
- $this->query = $query;
- }
- if(!empty($filter))
- {
- $this->filter = $filter;
- }
- if(isset($sort))
- {
- $this->sort = $sort;
- }
- if(isset($order))
- {
- $this->order = $order;
- }
- if(isset($cat_id))
- {
- $this->cat_id = $cat_id;
- }
- if(isset($user_lid))
- {
- $this->user_lid = $user_lid;
- }
- if(isset($allrows))
- {
- $this->allrows = $allrows;
- }
- }
-
-
- function save_sessiondata($data)
- {
- if ($this->use_session)
- {
-
$this->fm_session->appsession('session_data','invoice',$data);
- }
- }
-
- function read_sessiondata()
- {
- $data =
$this->fm_session->appsession('session_data',invoice);
-
-// html_print_r($data);
-
- $this->start = $data['start'];
- $this->query = $data['query'];
- $this->filter = $data['filter'];
- $this->sort = $data['sort'];
- $this->order = $data['order'];
- $this->cat_id = $data['cat_id'];
- $this->user_lid = $data['user_lid'];
- $this->sub = $data['sub'];
- $this->allrows = $data['allrows'];
- }
-
- function
read_invoice($paid='',$start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='')
- {
- $invoice = $this->so->read_invoice(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'user_lid' => $this->user_lid,'cat_id' => $this->cat_id, 'paid' =>
$paid,
-
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
-
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'allrows'=>$this->allrows));
-
- $this->total_records = $this->so->total_records;
- $this->end_time = $this->so->end_time;
-
- return $invoice;
- }
-
- function read_invoice_sub($voucher_id='',$paid='')
- {
- $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));
- $this->total_records = $this->so->total_records;
- return $invoice;
- }
-
- function read_remark($id='',$paid='')
- {
- return $remark = $this->so->read_remark($id,$paid);
- }
-
-
- function
read_consume($start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$b_account_class='',$district_id='')
- {
- $invoice = $this->so->read_consume(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
-
'user_lid' => $this->user_lid,'cat_id' => $this->cat_id,
-
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
-
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'b_account_class'
=>$b_account_class,
-
'district_id' => $district_id ));
-
- $this->total_records = $this->so->total_records;
-
- return $invoice;
- }
-
- function update_invoice($values)
- {
-
- foreach($values['counter'] as $n)
- {
- $local_error='';
-
- if($values['voucher_id'][$n])
- {
- $voucher_id=$values['voucher_id'][$n];
-
-
$check_value=array('voucher_id'=>$voucher_id,
- 'sign_orig'
=> $values['sign_orig'][$n],
- 'sign'
=> $values['sign'][$n],
- 'transfer'
=> $values['transfer'][$n],
- 'kreditnota' =>
$values['kreditnota'][$n],
- 'num_days'
=> $values['num_days'][$n]);
-
-
if($this->so->check_for_updates($check_value))
- {
-
- $check_count =
$this->so->check_count($voucher_id);
-
- if
(!($check_count['dima_count'] == $values['invoice_count'][$n]))
- {
- $receipt['error'][] =
array('msg'=>lang('Dima is missing from sub invoice in:'). "
".$values['voucher_id'][$n]);
- $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]);
- $local_error= true;
- }
-
-
-
- $blank_date = '';
- $sign_field='';
- $sign_id='';
- $sign_date_field='';
- $sign_date='';
- $kommma='';
- $wait_for_kreditnota='';
- $user_lid
=strtoupper($GLOBALS['phpgw_info']['user']['account_lid']);
-
- if
(($values['sign'][$n]=='sign_none') && ($values['sign_orig'][$n]=='janitor')):
- $blank_date =
'oppsynsigndato= NULL';
- $sign_field='';
- $sign_id='';
- $sign_date_field='';
- $sign_date='';
- $kommma='';
- elseif
(($values['sign'][$n]=='sign_none') &&
($values['sign_orig'][$n]=='supervisor')):
- $blank_date =
'saksigndato= NULL';
- $sign_field='';
- $sign_id='';
- $sign_date_field='';
- $sign_date='';
- $kommma='';
- elseif
(($values['sign'][$n]=='sign_none') &&
($values['sign_orig'][$n]=='budget_responsible')):
- $blank_date =
'budsjettsigndato= NULL';
- $sign_field='';
- $sign_id='';
- $sign_date_field='';
- $sign_date='';
- $kommma='';
- elseif
($values['sign'][$n]=='sign_janitor' && !$values['sign_orig'][$n]):
- $blank_date = '';
- $sign_field =
'oppsynsmannid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'oppsynsigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- elseif
($values['sign'][$n]=='sign_janitor' && $values['sign_orig'][$n]=='supervisor'):
- $blank_date =
'saksigndato= NULL';
- $sign_field =
'oppsynsmannid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'oppsynsigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- elseif
($values['sign'][$n]=='sign_janitor' &&
$values['sign_orig'][$n]=='budget_responsible'):
- $blank_date =
'budsjettsigndato= NULL';
- $sign_field =
'oppsynsmannid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'oppsynsigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- elseif
($values['sign'][$n]=='sign_supervisor' && !$values['sign_orig'][$n]):
- $blank_date = '';
- $sign_field =
'saksbehandlerid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'saksigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- elseif
($values['sign'][$n]=='sign_supervisor' && $values['sign_orig'][$n]=='janitor'):
- $blank_date =
'oppsynsigndato= NULL';
- $sign_field =
'saksbehandlerid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'saksigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- elseif
($values['sign'][$n]=='sign_supervisor' &&
$values['sign_orig'][$n]=='budget_responsible'):
- $blank_date =
'budsjettsigndato= NULL';
- $sign_field =
'saksbehandlerid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'saksigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- elseif
($values['sign'][$n]=='sign_budget_responsible' &&
$values['sign_orig'][$n]=='janitor'):
- $blank_date =
'oppsynsigndato= NULL';
- $sign_field =
'budsjettansvarligid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'budsjettsigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- elseif
($values['sign'][$n]=='sign_budget_responsible' &&
$values['sign_orig'][$n]=='supervisor'):
- $blank_date =
'saksigndato= NULL';
- $sign_field =
'budsjettansvarligid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'budsjettsigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- elseif
($values['sign'][$n]=='sign_budget_responsible' && !$values['sign_orig'][$n]):
- $blank_date = '';
- $sign_field =
'budsjettansvarligid=';
- $sign_id =
"'$user_lid'";
- $sign_date_field =
'budsjettsigndato=';
- $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
- $kommma=",";
- endif;
-
-
- if($blank_date )
- {
- $kommma_blank=",";
- }
- else
- {
- $kommma_blank='';
- }
-
-
$transfer_sign_field='utbetalingid=';
-
$transfer_date_field='utbetalingsigndato=';
-
- if
(!($values['num_days_orig'][$n]==$values['num_days'][$n]))
- {
- $payment_date =
date($this->bocommon->dateformat,$values['timestamp_voucher_date'][$n]+(24*3600*$values['num_days'][$n]));
-
$GLOBALS['phpgw']->db->query("update fm_ecobilag set forfallsdato=
'$payment_date' where bilagsnr='$voucher_id'");
- }
-
- if ($values['transfer'][$n])
- {
-
-
$transfer_id="'$user_lid',";
- $transfer_date="'" .
date($this->bocommon->datetimeformat) . "'";
- }
- else
- {
- $transfer_id="Null".",";
- $transfer_date="Null";
- }
-
- if ($values['kreditnota'][$n])
- {
- $wait_for_kreditnota=1;
- $transfer_date="Null";
- }
- else
- {
-
$wait_for_kreditnota='NULL';
- }
-
- if (! $local_error)
- {
- $sql= "update
fm_ecobilag set $blank_date $kommma_blank $sign_field $sign_id $kommma
$sign_date_field $sign_date $kommma $transfer_sign_field $transfer_id
$transfer_date_field $transfer_date ,kreditnota=$wait_for_kreditnota where
bilagsnr='$voucher_id'";
-
$GLOBALS['phpgw']->db->begintrans();
-
$GLOBALS['phpgw']->db->query($sql);
-
$GLOBALS['phpgw']->db->committrans();
-
- $receipt['message'][] =
array('msg'=> lang('voucher is updated: ') . $voucher_id);
- }
- }
- }
- }
-
- return $receipt;
- }
-
-
- function update_invoice_sub($values)
- {
- return $this->so->update_invoice_sub($values);
- }
-
- function select_account_class($selected='')
- {
-
- $b_account_class_list=
$this->so->select_account_class();
-
- while (is_array($b_account_class_list) && list(,$class)
= each($b_account_class_list))
- {
- $sel_class = '';
- if ($class['id']==$selected)
- {
- $sel_class = 'selected';
- }
-
- $class_list[] = array
- (
- 'id' => $class['id'],
- 'name' => $class['name'],
- 'selected' => $sel_class
- );
- }
-
- for ($i=0;$i<count($class_list);$i++)
- {
- if ($class_list[$i]['selected'] != 'selected')
- {
- unset($class_list[$i]['selected']);
- }
- }
-
- return $class_list;
- }
-
-
-
- function period_list($selected='')
- {
- for ($i=1; $i<=12; $i++)
- {
- $period_list[$i]['id'] = $i;
- $period_list[$i]['name'] = $i;
- if($i==$selected)
- {
- $period_list[$i]['selected'] =
'selected';
- }
- }
- return $period_list;
- }
-
- function tax_code_list($selected='')
- {
- $tax_codes=$this->so->tax_code_list();
-
- while (is_array($tax_codes) && list(,$code) =
each($tax_codes))
- {
- $sel_code = '';
- if ($code['id']==$selected)
- {
- $sel_code = 'selected';
- }
-
- $tax_code_list[] = array
- (
- 'id' => $code['id'],
- 'selected' => $sel_code
- );
- }
-
- for ($i=0;$i<count($tax_code_list);$i++)
- {
- if ($tax_code_list[$i]['selected'] !=
'selected')
- {
- unset($tax_code_list[$i]['selected']);
- }
- }
-
- return $tax_code_list;
- }
-
- function update_period($voucher_id='',$period='')
- {
- return $this->so->update_period($voucher_id,$period);
- }
-
- function increment_bilagsnr()
- {
-
- return $this->so->increment_bilagsnr();
-
- }
-
- function next_bilagsnr()
- {
- return $this->so->next_bilagsnr();
- }
-
- function check_vendor($vendor_id)
- {
-
- return $this->so->check_vendor($vendor_id);
- }
-
-
- function get_lisfm_ecoart($selected='')
- {
- $arts=$this->so->get_lisfm_ecoart();
-
- while (is_array($arts) && list(,$art) = each($arts))
- {
- $sel_art = '';
- if ($art['id']==$selected)
- {
- $sel_art = 'selected';
- }
-
- $art_list[] = array
- (
- 'id' => $art['id'],
- 'num' => $art['num'],
- 'selected' => $sel_art
- );
- }
-
- for ($i=0;$i<count($art_list);$i++)
- {
- if ($art_list[$i]['selected'] != 'selected')
- {
- unset($art_list[$i]['selected']);
- }
- }
-
- return $art_list;
- }
- //----------
-
- function select_category($format='',$selected='')
- {
- switch($format)
- {
- case 'select':
-
$this->bocommon->xsl_add_file(array('cat_select'));
- break;
- case 'filter':
-
$this->bocommon->xsl_add_file(array('cat_filter'));
- break;
- }
-
- $categories= $this->so->get_type_list();
-
- while (is_array($categories) && list(,$category) =
each($categories))
- {
- $sel_category = '';
- if ($category['id']==$selected)
- {
- $sel_category = 'selected';
- }
-
- $category_list[] = array
- (
- 'cat_id' => $category['id'],
- 'name' => $category['num'],
- 'selected' => $sel_category
- );
- }
-
- for ($i=0;$i<count($category_list);$i++)
- {
- if ($category_list[$i]['selected'] !=
'selected')
- {
- unset($category_list[$i]['selected']);
- }
- }
-
- return $category_list;
- }
-
-
- function
get_invoice_user_list($format='',$selected='',$extra='',$default='')
- {
- if(!$selected && $default)
- {
- $selected = $default;
- }
-
- switch($format)
- {
- case 'select':
-
$this->bocommon->xsl_add_file(array('user_lid_select'));
- break;
- case 'filter':
-
$this->bocommon->xsl_add_file(array('user_lid_filter'));
- break;
- }
-
- if (is_array($extra))
- {
- foreach($extra as $extra_user)
- {
- $users_extra[]=array
- (
- 'account_lid' => $extra_user,
- 'account_firstname' =>
lang($extra_user)
- );
- }
- }
-
- $users= $this->so->get_invoice_user_list();
- if (is_array($users_extra) && is_array($users))
- {
- $users = $users_extra + $users;
- }
-
- while (is_array($users) && list(,$user) = each($users))
- {
- $sel_user = '';
- if ($user['account_lid']==$selected)
- {
- $sel_user = 'selected';
- }
-
- $user_list[] = array
- (
- 'user_lid' => $user['account_lid'],
- 'name' =>
$user['account_lastname'].' '.$user['account_firstname'],
- 'selected' => $sel_user
- );
- }
-
- for ($i=0;$i<count($user_list);$i++)
- {
- if ($user_list[$i]['selected'] != 'selected')
- {
- unset($user_list[$i]['selected']);
- }
- }
-
-//html_print_r($user_list);
- return $user_list;
- }
-
-
-
- function get_type_list($selected='')
- {
- $types=$this->so->get_type_list();
-
- while (is_array($types) && list(,$type) = each($types))
- {
- $sel_type = '';
- if ($type['id']==$selected)
- {
- $sel_type = 'selected';
- }
-
- $type_list[] = array
- (
- 'id' => $type['id'],
- 'num' => $type['num'],
- 'selected' => $sel_type
- );
- }
-
- for ($i=0;$i<count($type_list);$i++)
- {
- if ($type_list[$i]['selected'] != 'selected')
- {
- unset($type_list[$i]['selected']);
- }
- }
-
- return $type_list;
- }
-
- //----------
- function select_dimb_list($selected='')
- {
- $dimbs=$this->so->select_dimb_list();
-
- while (is_array($dimbs) && list(,$dimb) = each($dimbs))
- {
- $sel_dimb = '';
- if ($dimb['id']==$selected)
- {
- $sel_dimb = 'selected';
- }
-
- $dimb_list[] = array
- (
- 'id' => $dimb['id'],
- 'num' => $dimb['num'],
- 'selected' => $sel_dimb
- );
- }
-
- for ($i=0;$i<count($dimb_list);$i++)
- {
- if ($dimb_list[$i]['selected'] != 'selected')
- {
- unset($dimb_list[$i]['selected']);
- }
- }
-
- return $dimb_list;
- }
-
- //-------------------
- function select_dimd_list($selected='')
- {
- $dimds=$this->so->select_dimd_list();
-
- while (is_array($dimds) && list(,$dimd) = each($dimds))
- {
- $sel_dimd = '';
- if ($dimd['id']==$selected)
- {
- $sel_dimd = 'selected';
- }
-
- $dimd_list[] = array
- (
- 'id' => $dimd['id'],
- 'num' => $dimd['num'],
- 'selected' => $sel_dimd
- );
- }
-
- for ($i=0;$i<count($dimd_list);$i++)
- {
- if ($dimd_list[$i]['selected'] != 'selected')
- {
- unset($dimd_list[$i]['selected']);
- }
- }
-
- return $dimd_list;
- }
-
- function select_tax_code_list($selected='')
- {
- $tax_codes=$this->so->select_tax_code_list();
-
- while (is_array($tax_codes) && list(,$tax_code) =
each($tax_codes))
- {
- $sel_tax_code = '';
- if ($tax_code['id']==$selected)
- {
- $sel_tax_code = 'selected';
- }
-
- $tax_code_list[] = array
- (
- 'id' => $tax_code['id'],
- 'num' => $tax_code['num'],
- 'selected' => $sel_tax_code
- );
- }
-
- for ($i=0;$i<count($tax_code_list);$i++)
- {
- if ($tax_code_list[$i]['selected'] !=
'selected')
- {
- unset($tax_code_list[$i]['selected']);
- }
- }
- return $tax_code_list;
- }
-
- function delete($params)
- {
- if (is_array($params))
- {
- $this->so->delete($params[0]);
- }
- else
- {
- $this->so->delete($params);
- }
- }
- }
-?>
+<?php
+
/**************************************************************************\
+ * phpGroupWare - property
*
+ * http://www.phpgroupware.org
*
+ *
*
+ * Facilities Management
*
+ * Written by Sigurd Nes [sigurdne at online.no]
*
+ *
------------------------------------------------------------------------ *
+ * Copyright 2000 - 2003 Free Software Foundation, Inc
*
+ * This program is part of the GNU project, see http://www.gnu.org/
*
+ *
------------------------------------------------------------------------ *
+ * This program is free software; you can redistribute it and/or modify
it *
+ * under the terms of the GNU General Public License as published by the
*
+ * Free Software Foundation; either version 2 of the License, or (at
your *
+ * option) any later version.
*
+
\**************************************************************************/
+
+ /* $Id$ */
+
+ class property_boinvoice
+ {
+ var $db = '';
+
+ function property_boinvoice($session=False)
+ {
+ $this->db = $GLOBALS['phpgw']->db;
+ $this->currentapp = 'property';
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+ $this->so =
CreateObject($this->currentapp.'_soinvoice',True);
+ $this->bocommon =
CreateObject($this->currentapp.'_bocommon');
+ $this->account_id =
$GLOBALS['phpgw_data']['user']['id'];
+ $this->fm_session =
CreateObject($this->currentapp.'_session');
+
+ if ($session)
+ {
+ $this->read_sessiondata();
+ $this->use_session = True;
+ }
+
+ $start =
get_var('start',array('POST','GET'));
+ $query =
get_var('query',array('POST','GET'));
+ $sort =
get_var('sort',array('POST','GET'));
+ $order =
get_var('order',array('POST','GET'));
+ $filter =
get_var('filter',array('POST','GET'));
+ $cat_id =
get_var('cat_id',array('POST','GET'));
+ $user_lid =
get_var('user_lid',array('POST','GET'));
+ $allrows =
get_var('allrows',array('POST','GET'));
+
+ if ($start)
+ {
+ $this->start=$start;
+ }
+ else
+ {
+ $this->start=0;
+ }
+
+ if(isset($query))
+ {
+ $this->query = $query;
+ }
+ if(!empty($filter))
+ {
+ $this->filter = $filter;
+ }
+ if(isset($sort))
+ {
+ $this->sort = $sort;
+ }
+ if(isset($order))
+ {
+ $this->order = $order;
+ }
+ if(isset($cat_id))
+ {
+ $this->cat_id = $cat_id;
+ }
+ if(isset($user_lid))
+ {
+ $this->user_lid = $user_lid;
+ }
+ if(isset($allrows))
+ {
+ $this->allrows = $allrows;
+ }
+ }
+
+
+ function save_sessiondata($data)
+ {
+ if ($this->use_session)
+ {
+
$this->fm_session->appsession('session_data','invoice',$data);
+ }
+ }
+
+ function read_sessiondata()
+ {
+ $data =
$this->fm_session->appsession('session_data',invoice);
+
+// html_print_r($data);
+
+ $this->start = $data['start'];
+ $this->query = $data['query'];
+ $this->filter = $data['filter'];
+ $this->sort = $data['sort'];
+ $this->order = $data['order'];
+ $this->cat_id = $data['cat_id'];
+ $this->user_lid = $data['user_lid'];
+ $this->sub = $data['sub'];
+ $this->allrows = $data['allrows'];
+ }
+
+ function
read_invoice($paid='',$start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='')
+ {
+ $invoice = $this->so->read_invoice(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'user_lid' => $this->user_lid,'cat_id' => $this->cat_id, 'paid' =>
$paid,
+
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
+
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'allrows'=>$this->allrows));
+
+ $this->total_records = $this->so->total_records;
+ $this->end_time = $this->so->end_time;
+
+ return $invoice;
+ }
+
+ function read_invoice_sub($voucher_id='',$paid='')
+ {
+ $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));
+ $this->total_records = $this->so->total_records;
+ return $invoice;
+ }
+
+ function read_remark($id='',$paid='')
+ {
+ return $remark = $this->so->read_remark($id,$paid);
+ }
+
+
+ function
read_consume($start_date='',$end_date='',$vendor_id='',$loc1='',$workorder_id='',$b_account_class='',$district_id='')
+ {
+ $invoice = $this->so->read_consume(array('start' =>
$this->start,'query' => $this->query,'sort' => $this->sort,'order' =>
$this->order,
+
'user_lid' => $this->user_lid,'cat_id' => $this->cat_id,
+
'start_date'=>$start_date,'end_date'=>$end_date,'vendor_id'=>$vendor_id,
+
'loc1'=>$loc1,'workorder_id'=>$workorder_id,'b_account_class'
=>$b_account_class,
+
'district_id' => $district_id ));
+
+ $this->total_records = $this->so->total_records;
+
+ return $invoice;
+ }
+
+ function update_invoice($values)
+ {
+
+ foreach($values['counter'] as $n)
+ {
+ $local_error='';
+
+ if($values['voucher_id'][$n])
+ {
+ $voucher_id=$values['voucher_id'][$n];
+
+
$check_value=array('voucher_id'=>$voucher_id,
+ 'sign_orig'
=> $values['sign_orig'][$n],
+ 'sign'
=> $values['sign'][$n],
+ 'transfer'
=> $values['transfer'][$n],
+ 'kreditnota' =>
$values['kreditnota'][$n],
+ 'num_days'
=> $values['num_days'][$n]);
+
+
if($this->so->check_for_updates($check_value))
+ {
+
+ $check_count =
$this->so->check_count($voucher_id);
+
+ if
(!($check_count['dima_count'] == $values['invoice_count'][$n]))
+ {
+ $receipt['error'][] =
array('msg'=>lang('Dima is missing from sub invoice in:'). "
".$values['voucher_id'][$n]);
+ $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]);
+ $local_error= true;
+ }
+
+
+
+ $blank_date = '';
+ $sign_field='';
+ $sign_id='';
+ $sign_date_field='';
+ $sign_date='';
+ $kommma='';
+ $wait_for_kreditnota='';
+ $user_lid
=strtoupper($GLOBALS['phpgw_info']['user']['account_lid']);
+
+ if
(($values['sign'][$n]=='sign_none') && ($values['sign_orig'][$n]=='janitor')):
+ $blank_date =
'oppsynsigndato= NULL';
+ $sign_field='';
+ $sign_id='';
+ $sign_date_field='';
+ $sign_date='';
+ $kommma='';
+ elseif
(($values['sign'][$n]=='sign_none') &&
($values['sign_orig'][$n]=='supervisor')):
+ $blank_date =
'saksigndato= NULL';
+ $sign_field='';
+ $sign_id='';
+ $sign_date_field='';
+ $sign_date='';
+ $kommma='';
+ elseif
(($values['sign'][$n]=='sign_none') &&
($values['sign_orig'][$n]=='budget_responsible')):
+ $blank_date =
'budsjettsigndato= NULL';
+ $sign_field='';
+ $sign_id='';
+ $sign_date_field='';
+ $sign_date='';
+ $kommma='';
+ elseif
($values['sign'][$n]=='sign_janitor' && !$values['sign_orig'][$n]):
+ $blank_date = '';
+ $sign_field =
'oppsynsmannid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'oppsynsigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ elseif
($values['sign'][$n]=='sign_janitor' && $values['sign_orig'][$n]=='supervisor'):
+ $blank_date =
'saksigndato= NULL';
+ $sign_field =
'oppsynsmannid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'oppsynsigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ elseif
($values['sign'][$n]=='sign_janitor' &&
$values['sign_orig'][$n]=='budget_responsible'):
+ $blank_date =
'budsjettsigndato= NULL';
+ $sign_field =
'oppsynsmannid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'oppsynsigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ elseif
($values['sign'][$n]=='sign_supervisor' && !$values['sign_orig'][$n]):
+ $blank_date = '';
+ $sign_field =
'saksbehandlerid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'saksigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ elseif
($values['sign'][$n]=='sign_supervisor' && $values['sign_orig'][$n]=='janitor'):
+ $blank_date =
'oppsynsigndato= NULL';
+ $sign_field =
'saksbehandlerid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'saksigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ elseif
($values['sign'][$n]=='sign_supervisor' &&
$values['sign_orig'][$n]=='budget_responsible'):
+ $blank_date =
'budsjettsigndato= NULL';
+ $sign_field =
'saksbehandlerid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'saksigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ elseif
($values['sign'][$n]=='sign_budget_responsible' &&
$values['sign_orig'][$n]=='janitor'):
+ $blank_date =
'oppsynsigndato= NULL';
+ $sign_field =
'budsjettansvarligid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'budsjettsigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ elseif
($values['sign'][$n]=='sign_budget_responsible' &&
$values['sign_orig'][$n]=='supervisor'):
+ $blank_date =
'saksigndato= NULL';
+ $sign_field =
'budsjettansvarligid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'budsjettsigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ elseif
($values['sign'][$n]=='sign_budget_responsible' && !$values['sign_orig'][$n]):
+ $blank_date = '';
+ $sign_field =
'budsjettansvarligid=';
+ $sign_id =
"'$user_lid'";
+ $sign_date_field =
'budsjettsigndato=';
+ $sign_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ $kommma=",";
+ endif;
+
+
+ if($blank_date )
+ {
+ $kommma_blank=",";
+ }
+ else
+ {
+ $kommma_blank='';
+ }
+
+
$transfer_sign_field='utbetalingid=';
+
$transfer_date_field='utbetalingsigndato=';
+
+ if
(!($values['num_days_orig'][$n]==$values['num_days'][$n]))
+ {
+ $payment_date =
date($this->bocommon->dateformat,$values['timestamp_voucher_date'][$n]+(24*3600*$values['num_days'][$n]));
+
$GLOBALS['phpgw']->db->query("update fm_ecobilag set forfallsdato=
'$payment_date' where bilagsnr='$voucher_id'");
+ }
+
+ if ($values['transfer'][$n])
+ {
+
+
$transfer_id="'$user_lid',";
+ $transfer_date="'" .
date($this->bocommon->datetimeformat) . "'";
+ }
+ else
+ {
+ $transfer_id="Null".",";
+ $transfer_date="Null";
+ }
+
+ if ($values['kreditnota'][$n])
+ {
+ $wait_for_kreditnota=1;
+ $transfer_date="Null";
+ }
+ else
+ {
+
$wait_for_kreditnota='NULL';
+ }
+
+ if (! $local_error)
+ {
+ $sql= "update
fm_ecobilag set $blank_date $kommma_blank $sign_field $sign_id $kommma
$sign_date_field $sign_date $kommma $transfer_sign_field $transfer_id
$transfer_date_field $transfer_date ,kreditnota=$wait_for_kreditnota where
bilagsnr='$voucher_id'";
+
$GLOBALS['phpgw']->db->begintrans();
+
$GLOBALS['phpgw']->db->query($sql);
+
$GLOBALS['phpgw']->db->committrans();
+
+ $receipt['message'][] =
array('msg'=> lang('voucher is updated: ') . $voucher_id);
+ }
+ }
+ }
+ }
+
+ return $receipt;
+ }
+
+
+ function update_invoice_sub($values)
+ {
+ return $this->so->update_invoice_sub($values);
+ }
+
+ function select_account_class($selected='')
+ {
+
+ $b_account_class_list=
$this->so->select_account_class();
+
+ while (is_array($b_account_class_list) && list(,$class)
= each($b_account_class_list))
+ {
+ $sel_class = '';
+ if ($class['id']==$selected)
+ {
+ $sel_class = 'selected';
+ }
+
+ $class_list[] = array
+ (
+ 'id' => $class['id'],
+ 'name' => $class['name'],
+ 'selected' => $sel_class
+ );
+ }
+
+ for ($i=0;$i<count($class_list);$i++)
+ {
+ if ($class_list[$i]['selected'] != 'selected')
+ {
+ unset($class_list[$i]['selected']);
+ }
+ }
+
+ return $class_list;
+ }
+
+
+
+ function period_list($selected='')
+ {
+ for ($i=1; $i<=12; $i++)
+ {
+ $period_list[$i]['id'] = $i;
+ $period_list[$i]['name'] = $i;
+ if($i==$selected)
+ {
+ $period_list[$i]['selected'] =
'selected';
+ }
+ }
+ return $period_list;
+ }
+
+ function tax_code_list($selected='')
+ {
+ $tax_codes=$this->so->tax_code_list();
+
+ while (is_array($tax_codes) && list(,$code) =
each($tax_codes))
+ {
+ $sel_code = '';
+ if ($code['id']==$selected)
+ {
+ $sel_code = 'selected';
+ }
+
+ $tax_code_list[] = array
+ (
+ 'id' => $code['id'],
+ 'selected' => $sel_code
+ );
+ }
+
+ for ($i=0;$i<count($tax_code_list);$i++)
+ {
+ if ($tax_code_list[$i]['selected'] !=
'selected')
+ {
+ unset($tax_code_list[$i]['selected']);
+ }
+ }
+
+ return $tax_code_list;
+ }
+
+ function update_period($voucher_id='',$period='')
+ {
+ return $this->so->update_period($voucher_id,$period);
+ }
+
+ function increment_bilagsnr()
+ {
+
+ return $this->so->increment_bilagsnr();
+
+ }
+
+ function next_bilagsnr()
+ {
+ return $this->so->next_bilagsnr();
+ }
+
+ function check_vendor($vendor_id)
+ {
+
+ return $this->so->check_vendor($vendor_id);
+ }
+
+
+ function get_lisfm_ecoart($selected='')
+ {
+ $arts=$this->so->get_lisfm_ecoart();
+
+ while (is_array($arts) && list(,$art) = each($arts))
+ {
+ $sel_art = '';
+ if ($art['id']==$selected)
+ {
+ $sel_art = 'selected';
+ }
+
+ $art_list[] = array
+ (
+ 'id' => $art['id'],
+ 'num' => $art['num'],
+ 'selected' => $sel_art
+ );
+ }
+
+ for ($i=0;$i<count($art_list);$i++)
+ {
+ if ($art_list[$i]['selected'] != 'selected')
+ {
+ unset($art_list[$i]['selected']);
+ }
+ }
+
+ return $art_list;
+ }
+ //----------
+
+ function select_category($format='',$selected='')
+ {
+ switch($format)
+ {
+ case 'select':
+
$this->bocommon->xsl_add_file(array('cat_select'));
+ break;
+ case 'filter':
+
$this->bocommon->xsl_add_file(array('cat_filter'));
+ break;
+ }
+
+ $categories= $this->so->get_type_list();
+
+ while (is_array($categories) && list(,$category) =
each($categories))
+ {
+ $sel_category = '';
+ if ($category['id']==$selected)
+ {
+ $sel_category = 'selected';
+ }
+
+ $category_list[] = array
+ (
+ 'cat_id' => $category['id'],
+ 'name' => $category['num'],
+ 'selected' => $sel_category
+ );
+ }
+
+ for ($i=0;$i<count($category_list);$i++)
+ {
+ if ($category_list[$i]['selected'] !=
'selected')
+ {
+ unset($category_list[$i]['selected']);
+ }
+ }
+
+ return $category_list;
+ }
+
+
+ function
get_invoice_user_list($format='',$selected='',$extra='',$default='')
+ {
+ if(!$selected && $default)
+ {
+ $selected = $default;
+ }
+
+ switch($format)
+ {
+ case 'select':
+
$this->bocommon->xsl_add_file(array('user_lid_select'));
+ break;
+ case 'filter':
+
$this->bocommon->xsl_add_file(array('user_lid_filter'));
+ break;
+ }
+
+ if (is_array($extra))
+ {
+ foreach($extra as $extra_user)
+ {
+ $users_extra[]=array
+ (
+ 'account_lid' => $extra_user,
+ 'account_firstname' =>
lang($extra_user)
+ );
+ }
+ }
+
+ $users= $this->so->get_invoice_user_list();
+ if (is_array($users_extra) && is_array($users))
+ {
+ $users = $users_extra + $users;
+ }
+
+ while (is_array($users) && list(,$user) = each($users))
+ {
+ $sel_user = '';
+ if ($user['account_lid']==$selected)
+ {
+ $sel_user = 'selected';
+ }
+
+ $user_list[] = array
+ (
+ 'user_lid' => $user['account_lid'],
+ 'name' =>
$user['account_lastname'].' '.$user['account_firstname'],
+ 'selected' => $sel_user
+ );
+ }
+
+ for ($i=0;$i<count($user_list);$i++)
+ {
+ if ($user_list[$i]['selected'] != 'selected')
+ {
+ unset($user_list[$i]['selected']);
+ }
+ }
+
+//html_print_r($user_list);
+ return $user_list;
+ }
+
+
+
+ function get_type_list($selected='')
+ {
+ $types=$this->so->get_type_list();
+
+ while (is_array($types) && list(,$type) = each($types))
+ {
+ $sel_type = '';
+ if ($type['id']==$selected)
+ {
+ $sel_type = 'selected';
+ }
+
+ $type_list[] = array
+ (
+ 'id' => $type['id'],
+ 'num' => $type['num'],
+ 'selected' => $sel_type
+ );
+ }
+
+ for ($i=0;$i<count($type_list);$i++)
+ {
+ if ($type_list[$i]['selected'] != 'selected')
+ {
+ unset($type_list[$i]['selected']);
+ }
+ }
+
+ return $type_list;
+ }
+
+ //----------
+ function select_dimb_list($selected='')
+ {
+ $dimbs=$this->so->select_dimb_list();
+
+ while (is_array($dimbs) && list(,$dimb) = each($dimbs))
+ {
+ $sel_dimb = '';
+ if ($dimb['id']==$selected)
+ {
+ $sel_dimb = 'selected';
+ }
+
+ $dimb_list[] = array
+ (
+ 'id' => $dimb['id'],
+ 'num' => $dimb['num'],
+ 'selected' => $sel_dimb
+ );
+ }
+
+ for ($i=0;$i<count($dimb_list);$i++)
+ {
+ if ($dimb_list[$i]['selected'] != 'selected')
+ {
+ unset($dimb_list[$i]['selected']);
+ }
+ }
+
+ return $dimb_list;
+ }
+
+ //-------------------
+ function select_dimd_list($selected='')
+ {
+ $dimds=$this->so->select_dimd_list();
+
+ while (is_array($dimds) && list(,$dimd) = each($dimds))
+ {
+ $sel_dimd = '';
+ if ($dimd['id']==$selected)
+ {
+ $sel_dimd = 'selected';
+ }
+
+ $dimd_list[] = array
+ (
+ 'id' => $dimd['id'],
+ 'num' => $dimd['num'],
+ 'selected' => $sel_dimd
+ );
+ }
+
+ for ($i=0;$i<count($dimd_list);$i++)
+ {
+ if ($dimd_list[$i]['selected'] != 'selected')
+ {
+ unset($dimd_list[$i]['selected']);
+ }
+ }
+
+ return $dimd_list;
+ }
+
+ function select_tax_code_list($selected='')
+ {
+ $tax_codes=$this->so->select_tax_code_list();
+
+ while (is_array($tax_codes) && list(,$tax_code) =
each($tax_codes))
+ {
+ $sel_tax_code = '';
+ if ($tax_code['id']==$selected)
+ {
+ $sel_tax_code = 'selected';
+ }
+
+ $tax_code_list[] = array
+ (
+ 'id' => $tax_code['id'],
+ 'num' => $tax_code['num'],
+ 'selected' => $sel_tax_code
+ );
+ }
+
+ for ($i=0;$i<count($tax_code_list);$i++)
+ {
+ if ($tax_code_list[$i]['selected'] !=
'selected')
+ {
+ unset($tax_code_list[$i]['selected']);
+ }
+ }
+ return $tax_code_list;
+ }
+
+ function delete($params)
+ {
+ if (is_array($params))
+ {
+ $this->so->delete($params[0]);
+ }
+ else
+ {
+ $this->so->delete($params);
+ }
+ }
+ }
+?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Phpgroupware-cvs] property/class.boinvoice.php, 1.1.1.3,
nomail <=