phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/class.bopricebook.php, 1.1.1.3


From: nomail
Subject: [Phpgroupware-cvs] property/class.bopricebook.php, 1.1.1.3
Date: Fri, 21 May 2004 16:26:53 -0000

Update of /property
Modified Files:
        Branch: 
          class.bopricebook.php

date: 2004/04/23 21:26:33;  author: sigurdne;  state: Exp;  lines: +565 -565

Log Message:
no message
=====================================================================
Index: property/class.bopricebook.php
diff -u property/class.bopricebook.php:1.1.1.2 
property/class.bopricebook.php:1.1.1.3
--- property/class.bopricebook.php:1.1.1.2      Fri Apr 23 20:25:23 2004
+++ property/class.bopricebook.php      Fri Apr 23 21:26:33 2004
@@ -1,565 +1,565 @@
-<?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.                                            
   *
-       
\**************************************************************************/
-
-       class property_bopricebook
-       {
-               var $start;
-               var $query;
-               var $filter;
-               var $sort;
-               var $order;
-               var $cat_id;
-
-               var $public_functions = array
-               (
-                       'read'                          => True,
-                       'read_single'           => True,
-                       'save'                          => True,
-                       'delete'                        => True,
-                       'check_perms'           => True
-               );
-
-               var $soap_functions = array(
-                       'list' => array(
-                               'in'  => 
array('int','int','struct','string','int'),
-                               'out' => array('array')
-                       ),
-                       'read' => array(
-                               'in'  => array('int','struct'),
-                               'out' => array('array')
-                       ),
-                       'save' => array(
-                               'in'  => array('int','struct'),
-                               'out' => array()
-                       ),
-                       'delete' => array(
-                               'in'  => array('int','struct'),
-                               'out' => array()
-                       )
-               );
-
-               function property_bopricebook($session=False)
-               {
-                       $this->currentapp       = 'property'; 
//$GLOBALS['phpgw_info']['flags']['currentapp'];
-                       $this->so               = 
CreateObject($this->currentapp.'_sopricebook');
-                       $this->socommon = 
CreateObject($this->currentapp.'_socommon');
-                       $this->bocommon = 
CreateObject($this->currentapp.'_bocommon');
-                       $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'));
-                       $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($allrows))
-                       {
-                               $this->allrows = $allrows;
-                       }
-               }
-
-               function save_sessiondata($data)
-               {
-                       if ($this->use_session)
-                       {
-                               
$this->fm_session->appsession('session_data','pricebook',$data);
-                       }
-               }
-
-               function read_sessiondata()
-               {
-                       $data = 
$this->fm_session->appsession('session_data','pricebook');
-
-                       //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'];
-               }
-
-
-               function select_status_list($format='',$selected='')
-               {
-                       switch($format)
-                       {
-                               case 'select':
-                                       
$this->bocommon->xsl_add_file(array('status_select'));
-                                       break;
-                               case 'filter':
-                                       
$this->bocommon->xsl_add_file(array('status_filter'));
-                                       break;
-                       }
-
-                       $status_entries= $this->so->select_status_list();
-
-                       while (is_array($status_entries) && list(,$status) = 
each($status_entries))
-                       {
-                               $sel_status = '';
-                               if ($status['id']==$selected)
-                               {
-                                       $sel_status = 'selected';
-                               }
-
-                               $status_list[] = array
-                               (
-                                       'id'            => $status['id'],
-                                       'name'          => $status['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()
-               {
-                       $pricebook = $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));
-                       $this->total_records = $this->so->total_records;
-                       return $pricebook;
-               }
-
-               function read_agreement()
-               {
-                       $agreement = $this->so->read_agreement(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
-                       $this->total_records = $this->so->total_records;
-                       return $agreement;
-               }
-
-               function read_activity_prize($activity_id,$vendor_id)
-               {
-                       $pricebook = 
$this->so->read_activity_prize(array('start' => $this->start,'query' => 
$this->query,'sort' => $this->sort,'order' => $this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows,'activity_id'=>$activity_id,'vendor_id'=>$vendor_id));
-                       $this->total_records = $this->so->total_records;
-                       return $pricebook;
-               }
-
-
-               function read_activities_pr_aggreement()
-               {
-                       $pricebook = 
$this->so->read_activities_pr_aggreement(array('start' => $this->start,'query' 
=> $this->query,'sort' => $this->sort,'order' => $this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
-                       $this->total_records = $this->so->total_records;
-                       return $pricebook;
-               }
-
-               function read_vendor_pr_activity($activity_id)
-               {
-                       $pricebook = 
$this->so->read_vendor_pr_activity(array('start' => $this->start,'query' => 
$this->query,'sort' => $this->sort,'order' => $this->order,
-                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows,'activity_id'=>$activity_id));
-                       $this->total_records = $this->so->total_records;
-                       return $pricebook;
-               }
-
-               function add_activity_vendor($values)
-               {
-                       return $this->so->add_activity_vendor($values);
-               }
-
-               function read_single_activity($id='')
-               {
-                       return $this->so->read_single_activity($id);
-               }
-
-               function read_single_agreement($id='')
-               {
-                       return $this->so->read_single_agreement($id);
-               }
-
-
-               function read_category_name($cat_id)
-               {
-                       return $this->so->read_category_name($cat_id);
-               }
-
-               function update_pricebook($values)
-               {
-
-//html_print_r($values);
-                       
$date_array=$this->bocommon->date_array($values['date']);
-
-                       $date = mktime 
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
-//                     $date= date($this->bocommon->dateformat,$date);
-
-                       $new_index=str_replace(",",".",$values['new_index']);
-
-                       while(address@hidden($values['update']))
-                       {
-                               $n=$entry[0];
-
-                               if(!$values['old_total_cost'][$n])
-                               {
-                                       
$new_total_cost=($values['old_m_cost'][$n]+$values['old_w_cost'][$n])*$new_index;
-                               }
-                               else
-                               {
-                                       
$new_total_cost=$values['old_total_cost'][$n]*$new_index;
-                               }
-
-                               if(!$values['old_m_cost'][$n])
-                               {
-                                       $new_m_cost=0;
-                               }
-                               else
-                               {
-                                       
$new_m_cost=$values['old_m_cost'][$n]*$new_index;
-                               }
-
-                               if(!$values['old_w_cost'][$n])
-                               {
-                                       $new_w_cost=0;
-                               }
-                               else
-                               {
-                                       
$new_w_cost=$values['old_w_cost'][$n]*$new_index;
-                               }
-
-                               $update[]=array(
-                                       'new_m_cost'            => $new_m_cost,
-                                       'new_w_cost'            => $new_w_cost,
-                                       'new_total_cost'        => 
$new_total_cost,
-                                       'activity_id'           => 
$values['activity_id'][$n],
-                                       'vendor_id'                     => 
$values['vendor_id'][$n],
-                                       'new_index'                     => 
$new_index,
-                                       'new_date'                      => 
$date,
-                               );
-
-                       }
-//html_print_r($update);
-
-                       if($update)
-                       {
-                               $receipt =      
$this->so->update_pricebook($update);
-                       }
-                       else
-                       {
-                                       $receipt['message'][] = 
array('msg'=>lang('Nothing to do!'));
-                       }
-
-                       return $receipt;
-
-               }
-
-               function add_activity_first_prize($values)
-               {
-
-                       
$date_array=$this->bocommon->date_array($values['date']);
-
-                       $date = mktime 
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
-//                     $date= date($this->bocommon->dateformat,$date);
-
-                       $m_cost                 = 
str_replace(",",".",$values['m_cost']);
-                       $w_cost                 = 
str_replace(",",".",$values['w_cost']);
-                       $total_cost             = $m_cost + $w_cost;
-                       $activity_id    = $values['activity_id'][0];
-                       $vendor_id              = $values['vendor_id'][0];
-
-                       $receipt = 
$this->so->add_activity_first_prize($m_cost,$w_cost,$total_cost,$activity_id,$vendor_id,$date);
-
-                       return $receipt;
-               }
-
-               function get_vendor_list($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;
-                       }
-
-                       $vendors= $this->so->get_vendor_list();
-
-                       while (is_array($vendors) && list(,$vendor_entry) = 
each($vendors))
-                       {
-                               $sel_vendor_entry = '';
-                               if ($vendor_entry['id']==$selected)
-                               {
-                                       $sel_vendor_entry = 'selected';
-                               }
-
-                               $vendor_list[] = array
-                               (
-                                       'cat_id'        => $vendor_entry['id'],
-                                       'name'          => 
$vendor_entry['name'],
-                                       'selected'      => $sel_vendor_entry
-                               );
-                       }
-
-                       for ($i=0;$i<count($vendor_list);$i++)
-                       {
-                               if ($vendor_list[$i]['selected'] != 'selected')
-                               {
-                                       unset($vendor_list[$i]['selected']);
-                               }
-                       }
-
-                       return $vendor_list;
-               }
-
-               function get_dim_d_list($selected='')
-               {
-                       $this->bocommon->xsl_add_file(array('dim_d_select'));
-
-                       $dim_ds= $this->so->get_dim_d_list();
-
-                       while (is_array($dim_ds) && list(,$dim_d_entry) = 
each($dim_ds))
-                       {
-                               $sel_dim_d_entry = '';
-                               if ($dim_d_entry['id']==$selected)
-                               {
-                                       $sel_dim_d_entry = 'selected';
-                               }
-
-                               $dim_d_list[] = array
-                               (
-                                       'id'            => $dim_d_entry['id'],
-                                       'name'          => $dim_d_entry['name'],
-                                       'selected'      => $sel_dim_d_entry
-                               );
-                       }
-
-                       for ($i=0;$i<count($dim_d_list);$i++)
-                       {
-                               if ($dim_d_list[$i]['selected'] != 'selected')
-                               {
-                                       unset($dim_d_list[$i]['selected']);
-                               }
-                       }
-
-                       return $dim_d_list;
-               }
-
-               function get_unit_list($selected='')
-               {
-                       $this->bocommon->xsl_add_file(array('unit_select'));
-
-                       $units= $this->so->get_unit_list();
-
-                       while (is_array($units) && list(,$unit_entry) = 
each($units))
-                       {
-                               $sel_unit_entry = '';
-                               if ($unit_entry['id']==$selected)
-                               {
-                                       $sel_unit_entry = 'selected';
-                               }
-
-                               $unit_list[] = array
-                               (
-                                       'id'            => $unit_entry['id'],
-                                       'name'          => $unit_entry['name'],
-                                       'selected'      => $sel_unit_entry
-                               );
-                       }
-
-                       for ($i=0;$i<count($unit_list);$i++)
-                       {
-                               if ($unit_list[$i]['selected'] != 'selected')
-                               {
-                                       unset($unit_list[$i]['selected']);
-                               }
-                       }
-
-                       return $unit_list;
-               }
-
-               function get_branch_list($selected='')
-               {
-                       $this->bocommon->xsl_add_file(array('branch_select'));
-
-                       $branches= $this->so->get_branch_list();
-
-                       while (is_array($branches) && list(,$branch_entry) = 
each($branches))
-                       {
-                               $sel_branch_entry = '';
-                               if ($branch_entry['id']==$selected)
-                               {
-                                       $sel_branch_entry = 'selected';
-                               }
-
-                               $branch_list[] = array
-                               (
-                                       'id'            => $branch_entry['id'],
-                                       'name'          => 
$branch_entry['name'],
-                                       'selected'      => $sel_branch_entry
-                               );
-                       }
-
-                       for ($i=0;$i<count($branch_list);$i++)
-                       {
-                               if ($branch_list[$i]['selected'] != 'selected')
-                               {
-                                       unset($branch_list[$i]['selected']);
-                               }
-                       }
-
-                       return $branch_list;
-               }
-
-               function get_agreement_list($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;
-                       }
-
-                       $agreements= $this->so->get_agreement_list();
-
-                       while (is_array($agreements) && list(,$agreement_entry) 
= each($agreements))
-                       {
-                               $sel_agreement_entry = '';
-                               if ($agreement_entry['id']==$selected)
-                               {
-                                       $sel_agreement_entry = 'selected';
-                               }
-
-                               $agreement_list[] = array
-                               (
-                                       'cat_id'        => 
$agreement_entry['id'],
-                                       'name'          => 
$agreement_entry['name'],
-                                       'selected'      => $sel_agreement_entry
-                               );
-                       }
-
-                       for ($i=0;$i<count($agreement_list);$i++)
-                       {
-                               if ($agreement_list[$i]['selected'] != 
'selected')
-                               {
-                                       unset($agreement_list[$i]['selected']);
-                               }
-                       }
-
-                       return $agreement_list;
-               }
-
-
-               function check_activity_num($num='',$agreement_id='')
-               {
-                       return 
$this->so->check_activity_num($num,$agreement_id);
-               }
-
-               function save_activity($values,$action='')
-               {
-                       if ($action=='edit')
-                       {
-                               $receipt = $this->so->edit_activity($values);
-                       }
-                       else
-                       {
-                               
$values['activity_id']=$this->socommon->next_id('fm_activities');
-                               $receipt = $this->so->add_activity($values);
-                       }
-                       return $receipt;
-               }
-
-               function check_agreement_num($num='')
-               {
-                       return $this->so->check_agreement_num($num);
-               }
-
-               function save_agreement($values,$action='')
-               {
-                       if ($action=='edit')
-                       {
-                               $receipt = $this->so->edit_agreement($values);
-                       }
-                       else
-                       {
-                               
$values['agreement_id']=$this->socommon->next_id('fm_agreement');
-                               $receipt = $this->so->add_agreement($values);
-                       }
-                       return $receipt;
-               }
-
-               function delete_activity_vendor($activity_id,$vendor_id)
-               {
-                       
$this->so->delete_activity_vendor($activity_id,$vendor_id);
-               }
-
-               function delete_activity($activity_id)
-               {
-                       $this->so->delete_activity($activity_id);
-               }
-
-               function 
delete_prize_index($activity_id,$vendor_id,$index_count)
-               {
-                       
$this->so->delete_prize_index($activity_id,$vendor_id,$index_count);
-               }
-
-               function delete_agreement($agreement_id)
-               {
-                       $this->so->delete_agreement($agreement_id);
-               }
-       }
-?>
+<?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.                                            
   *
+       
\**************************************************************************/
+
+       class property_bopricebook
+       {
+               var $start;
+               var $query;
+               var $filter;
+               var $sort;
+               var $order;
+               var $cat_id;
+
+               var $public_functions = array
+               (
+                       'read'                          => True,
+                       'read_single'           => True,
+                       'save'                          => True,
+                       'delete'                        => True,
+                       'check_perms'           => True
+               );
+
+               var $soap_functions = array(
+                       'list' => array(
+                               'in'  => 
array('int','int','struct','string','int'),
+                               'out' => array('array')
+                       ),
+                       'read' => array(
+                               'in'  => array('int','struct'),
+                               'out' => array('array')
+                       ),
+                       'save' => array(
+                               'in'  => array('int','struct'),
+                               'out' => array()
+                       ),
+                       'delete' => array(
+                               'in'  => array('int','struct'),
+                               'out' => array()
+                       )
+               );
+
+               function property_bopricebook($session=False)
+               {
+                       $this->currentapp       = 'property'; 
//$GLOBALS['phpgw_info']['flags']['currentapp'];
+                       $this->so               = 
CreateObject($this->currentapp.'_sopricebook');
+                       $this->socommon = 
CreateObject($this->currentapp.'_socommon');
+                       $this->bocommon = 
CreateObject($this->currentapp.'_bocommon');
+                       $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'));
+                       $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($allrows))
+                       {
+                               $this->allrows = $allrows;
+                       }
+               }
+
+               function save_sessiondata($data)
+               {
+                       if ($this->use_session)
+                       {
+                               
$this->fm_session->appsession('session_data','pricebook',$data);
+                       }
+               }
+
+               function read_sessiondata()
+               {
+                       $data = 
$this->fm_session->appsession('session_data','pricebook');
+
+                       //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'];
+               }
+
+
+               function select_status_list($format='',$selected='')
+               {
+                       switch($format)
+                       {
+                               case 'select':
+                                       
$this->bocommon->xsl_add_file(array('status_select'));
+                                       break;
+                               case 'filter':
+                                       
$this->bocommon->xsl_add_file(array('status_filter'));
+                                       break;
+                       }
+
+                       $status_entries= $this->so->select_status_list();
+
+                       while (is_array($status_entries) && list(,$status) = 
each($status_entries))
+                       {
+                               $sel_status = '';
+                               if ($status['id']==$selected)
+                               {
+                                       $sel_status = 'selected';
+                               }
+
+                               $status_list[] = array
+                               (
+                                       'id'            => $status['id'],
+                                       'name'          => $status['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()
+               {
+                       $pricebook = $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));
+                       $this->total_records = $this->so->total_records;
+                       return $pricebook;
+               }
+
+               function read_agreement()
+               {
+                       $agreement = $this->so->read_agreement(array('start' => 
$this->start,'query' => $this->query,'sort' => $this->sort,'order' => 
$this->order,
+                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
+                       $this->total_records = $this->so->total_records;
+                       return $agreement;
+               }
+
+               function read_activity_prize($activity_id,$vendor_id)
+               {
+                       $pricebook = 
$this->so->read_activity_prize(array('start' => $this->start,'query' => 
$this->query,'sort' => $this->sort,'order' => $this->order,
+                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows,'activity_id'=>$activity_id,'vendor_id'=>$vendor_id));
+                       $this->total_records = $this->so->total_records;
+                       return $pricebook;
+               }
+
+
+               function read_activities_pr_aggreement()
+               {
+                       $pricebook = 
$this->so->read_activities_pr_aggreement(array('start' => $this->start,'query' 
=> $this->query,'sort' => $this->sort,'order' => $this->order,
+                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows));
+                       $this->total_records = $this->so->total_records;
+                       return $pricebook;
+               }
+
+               function read_vendor_pr_activity($activity_id)
+               {
+                       $pricebook = 
$this->so->read_vendor_pr_activity(array('start' => $this->start,'query' => 
$this->query,'sort' => $this->sort,'order' => $this->order,
+                                                                               
        'filter' => $this->filter,'cat_id' => 
$this->cat_id,'allrows'=>$this->allrows,'activity_id'=>$activity_id));
+                       $this->total_records = $this->so->total_records;
+                       return $pricebook;
+               }
+
+               function add_activity_vendor($values)
+               {
+                       return $this->so->add_activity_vendor($values);
+               }
+
+               function read_single_activity($id='')
+               {
+                       return $this->so->read_single_activity($id);
+               }
+
+               function read_single_agreement($id='')
+               {
+                       return $this->so->read_single_agreement($id);
+               }
+
+
+               function read_category_name($cat_id)
+               {
+                       return $this->so->read_category_name($cat_id);
+               }
+
+               function update_pricebook($values)
+               {
+
+//html_print_r($values);
+                       
$date_array=$this->bocommon->date_array($values['date']);
+
+                       $date = mktime 
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
+//                     $date= date($this->bocommon->dateformat,$date);
+
+                       $new_index=str_replace(",",".",$values['new_index']);
+
+                       while(address@hidden($values['update']))
+                       {
+                               $n=$entry[0];
+
+                               if(!$values['old_total_cost'][$n])
+                               {
+                                       
$new_total_cost=($values['old_m_cost'][$n]+$values['old_w_cost'][$n])*$new_index;
+                               }
+                               else
+                               {
+                                       
$new_total_cost=$values['old_total_cost'][$n]*$new_index;
+                               }
+
+                               if(!$values['old_m_cost'][$n])
+                               {
+                                       $new_m_cost=0;
+                               }
+                               else
+                               {
+                                       
$new_m_cost=$values['old_m_cost'][$n]*$new_index;
+                               }
+
+                               if(!$values['old_w_cost'][$n])
+                               {
+                                       $new_w_cost=0;
+                               }
+                               else
+                               {
+                                       
$new_w_cost=$values['old_w_cost'][$n]*$new_index;
+                               }
+
+                               $update[]=array(
+                                       'new_m_cost'            => $new_m_cost,
+                                       'new_w_cost'            => $new_w_cost,
+                                       'new_total_cost'        => 
$new_total_cost,
+                                       'activity_id'           => 
$values['activity_id'][$n],
+                                       'vendor_id'                     => 
$values['vendor_id'][$n],
+                                       'new_index'                     => 
$new_index,
+                                       'new_date'                      => 
$date,
+                               );
+
+                       }
+//html_print_r($update);
+
+                       if($update)
+                       {
+                               $receipt =      
$this->so->update_pricebook($update);
+                       }
+                       else
+                       {
+                                       $receipt['message'][] = 
array('msg'=>lang('Nothing to do!'));
+                       }
+
+                       return $receipt;
+
+               }
+
+               function add_activity_first_prize($values)
+               {
+
+                       
$date_array=$this->bocommon->date_array($values['date']);
+
+                       $date = mktime 
(2,0,0,$date_array['month'],$date_array['day'],$date_array['year']);
+//                     $date= date($this->bocommon->dateformat,$date);
+
+                       $m_cost                 = 
str_replace(",",".",$values['m_cost']);
+                       $w_cost                 = 
str_replace(",",".",$values['w_cost']);
+                       $total_cost             = $m_cost + $w_cost;
+                       $activity_id    = $values['activity_id'][0];
+                       $vendor_id              = $values['vendor_id'][0];
+
+                       $receipt = 
$this->so->add_activity_first_prize($m_cost,$w_cost,$total_cost,$activity_id,$vendor_id,$date);
+
+                       return $receipt;
+               }
+
+               function get_vendor_list($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;
+                       }
+
+                       $vendors= $this->so->get_vendor_list();
+
+                       while (is_array($vendors) && list(,$vendor_entry) = 
each($vendors))
+                       {
+                               $sel_vendor_entry = '';
+                               if ($vendor_entry['id']==$selected)
+                               {
+                                       $sel_vendor_entry = 'selected';
+                               }
+
+                               $vendor_list[] = array
+                               (
+                                       'cat_id'        => $vendor_entry['id'],
+                                       'name'          => 
$vendor_entry['name'],
+                                       'selected'      => $sel_vendor_entry
+                               );
+                       }
+
+                       for ($i=0;$i<count($vendor_list);$i++)
+                       {
+                               if ($vendor_list[$i]['selected'] != 'selected')
+                               {
+                                       unset($vendor_list[$i]['selected']);
+                               }
+                       }
+
+                       return $vendor_list;
+               }
+
+               function get_dim_d_list($selected='')
+               {
+                       $this->bocommon->xsl_add_file(array('dim_d_select'));
+
+                       $dim_ds= $this->so->get_dim_d_list();
+
+                       while (is_array($dim_ds) && list(,$dim_d_entry) = 
each($dim_ds))
+                       {
+                               $sel_dim_d_entry = '';
+                               if ($dim_d_entry['id']==$selected)
+                               {
+                                       $sel_dim_d_entry = 'selected';
+                               }
+
+                               $dim_d_list[] = array
+                               (
+                                       'id'            => $dim_d_entry['id'],
+                                       'name'          => $dim_d_entry['name'],
+                                       'selected'      => $sel_dim_d_entry
+                               );
+                       }
+
+                       for ($i=0;$i<count($dim_d_list);$i++)
+                       {
+                               if ($dim_d_list[$i]['selected'] != 'selected')
+                               {
+                                       unset($dim_d_list[$i]['selected']);
+                               }
+                       }
+
+                       return $dim_d_list;
+               }
+
+               function get_unit_list($selected='')
+               {
+                       $this->bocommon->xsl_add_file(array('unit_select'));
+
+                       $units= $this->so->get_unit_list();
+
+                       while (is_array($units) && list(,$unit_entry) = 
each($units))
+                       {
+                               $sel_unit_entry = '';
+                               if ($unit_entry['id']==$selected)
+                               {
+                                       $sel_unit_entry = 'selected';
+                               }
+
+                               $unit_list[] = array
+                               (
+                                       'id'            => $unit_entry['id'],
+                                       'name'          => $unit_entry['name'],
+                                       'selected'      => $sel_unit_entry
+                               );
+                       }
+
+                       for ($i=0;$i<count($unit_list);$i++)
+                       {
+                               if ($unit_list[$i]['selected'] != 'selected')
+                               {
+                                       unset($unit_list[$i]['selected']);
+                               }
+                       }
+
+                       return $unit_list;
+               }
+
+               function get_branch_list($selected='')
+               {
+                       $this->bocommon->xsl_add_file(array('branch_select'));
+
+                       $branches= $this->so->get_branch_list();
+
+                       while (is_array($branches) && list(,$branch_entry) = 
each($branches))
+                       {
+                               $sel_branch_entry = '';
+                               if ($branch_entry['id']==$selected)
+                               {
+                                       $sel_branch_entry = 'selected';
+                               }
+
+                               $branch_list[] = array
+                               (
+                                       'id'            => $branch_entry['id'],
+                                       'name'          => 
$branch_entry['name'],
+                                       'selected'      => $sel_branch_entry
+                               );
+                       }
+
+                       for ($i=0;$i<count($branch_list);$i++)
+                       {
+                               if ($branch_list[$i]['selected'] != 'selected')
+                               {
+                                       unset($branch_list[$i]['selected']);
+                               }
+                       }
+
+                       return $branch_list;
+               }
+
+               function get_agreement_list($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;
+                       }
+
+                       $agreements= $this->so->get_agreement_list();
+
+                       while (is_array($agreements) && list(,$agreement_entry) 
= each($agreements))
+                       {
+                               $sel_agreement_entry = '';
+                               if ($agreement_entry['id']==$selected)
+                               {
+                                       $sel_agreement_entry = 'selected';
+                               }
+
+                               $agreement_list[] = array
+                               (
+                                       'cat_id'        => 
$agreement_entry['id'],
+                                       'name'          => 
$agreement_entry['name'],
+                                       'selected'      => $sel_agreement_entry
+                               );
+                       }
+
+                       for ($i=0;$i<count($agreement_list);$i++)
+                       {
+                               if ($agreement_list[$i]['selected'] != 
'selected')
+                               {
+                                       unset($agreement_list[$i]['selected']);
+                               }
+                       }
+
+                       return $agreement_list;
+               }
+
+
+               function check_activity_num($num='',$agreement_id='')
+               {
+                       return 
$this->so->check_activity_num($num,$agreement_id);
+               }
+
+               function save_activity($values,$action='')
+               {
+                       if ($action=='edit')
+                       {
+                               $receipt = $this->so->edit_activity($values);
+                       }
+                       else
+                       {
+                               
$values['activity_id']=$this->socommon->next_id('fm_activities');
+                               $receipt = $this->so->add_activity($values);
+                       }
+                       return $receipt;
+               }
+
+               function check_agreement_num($num='')
+               {
+                       return $this->so->check_agreement_num($num);
+               }
+
+               function save_agreement($values,$action='')
+               {
+                       if ($action=='edit')
+                       {
+                               $receipt = $this->so->edit_agreement($values);
+                       }
+                       else
+                       {
+                               
$values['agreement_id']=$this->socommon->next_id('fm_agreement');
+                               $receipt = $this->so->add_agreement($values);
+                       }
+                       return $receipt;
+               }
+
+               function delete_activity_vendor($activity_id,$vendor_id)
+               {
+                       
$this->so->delete_activity_vendor($activity_id,$vendor_id);
+               }
+
+               function delete_activity($activity_id)
+               {
+                       $this->so->delete_activity($activity_id);
+               }
+
+               function 
delete_prize_index($activity_id,$vendor_id,$index_count)
+               {
+                       
$this->so->delete_prize_index($activity_id,$vendor_id,$index_count);
+               }
+
+               function delete_agreement($agreement_id)
+               {
+                       $this->so->delete_agreement($agreement_id);
+               }
+       }
+?>




reply via email to

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