phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] projects/inc/class.soprojecthours.inc.php, 1.36


From: nomail
Subject: [Phpgroupware-cvs] projects/inc/class.soprojecthours.inc.php, 1.36
Date: Mon, 21 Jun 2004 01:02:37 +0200

Update of /projects/inc
Modified Files:
        Branch: 
          class.soprojecthours.inc.php

date: 2004/06/20 23:02:37;  author: ceb;  state: Exp;  lines: +41 -63

Log Message:
update
=====================================================================
Index: projects/inc/class.soprojecthours.inc.php
diff -u projects/inc/class.soprojecthours.inc.php:1.35 
projects/inc/class.soprojecthours.inc.php:1.36
--- projects/inc/class.soprojecthours.inc.php:1.35      Sun May  2 20:56:52 2004
+++ projects/inc/class.soprojecthours.inc.php   Sun Jun 20 23:02:37 2004
@@ -55,24 +55,25 @@
                                }
                                else
                                {
-                               $hours[] = array
-                               (
-                                       'hours_id'              => 
$this->db->f('id'),
-                                       'project_id'    => 
$this->db->f('project_id'),
-                                       'pro_parent'    => 
$this->db->f('pro_parent'),
-                                       'pro_main'              => 
$this->db->f('pro_main'),
-                                       'hours_descr'   => 
$this->db->f('hours_descr'),
-                                       'status'                => 
$this->db->f('status'),
-                                       'minutes'               => 
$this->db->f('minutes'),
-                                       'sdate'                 => 
$this->db->f('start_date'),
-                                       'edate'                 => 
$this->db->f('end_date'),
-                                       'employee'              => 
$this->db->f('employee'),
-                                       'activity_id'   => 
$this->db->f('activity_id'),
-                                       'remark'                => 
$this->db->f('remark'),
-                                       'billable'              => 
$this->db->f('billable'),
-                                       'km_distance'   => 
$this->db->f('km_distance'),
-                                       't_journey'             => 
$this->db->f('t_journey')
-                               );
+                                       $hours[] = array
+                                       (
+                                               'hours_id'              => 
$this->db->f('id'),
+                                               'project_id'    => 
$this->db->f('project_id'),
+                                               'pro_parent'    => 
$this->db->f('pro_parent'),
+                                               'pro_main'              => 
$this->db->f('pro_main'),
+                                               'hours_descr'   => 
$this->db->f('hours_descr'),
+                                               'status'                => 
$this->db->f('status'),
+                                               'minutes'               => 
$this->db->f('minutes'),
+                                               'sdate'                 => 
$this->db->f('start_date'),
+                                               'edate'                 => 
$this->db->f('end_date'),
+                                               'employee'              => 
$this->db->f('employee'),
+                                               'activity_id'   => 
$this->db->f('activity_id'),
+                                               'remark'                => 
$this->db->f('remark'),
+                                               'billable'              => 
$this->db->f('billable'),
+                                               'km_distance'   => 
$this->db->f('km_distance'),
+                                               't_journey'             => 
$this->db->f('t_journey'),
+                                               'surcharge'             => 
$this->db->f('surcharge')
+                                       );
                                }
                        }
                        return $hours;
@@ -147,11 +148,11 @@
                        $values['t_journey']    = $values['t_journey'] + 0.0;
 
                        $this->db->query('INSERT into phpgw_p_hours 
(project_id,activity_id,entry_date,start_date,end_date,hours_descr,remark,billable,minutes,'
-                                                       . 
'status,employee,pro_parent,pro_main,km_distance,t_journey) VALUES (' . 
intval($values['project_id']) . ',' . intval($values['activity_id']) . ','
-                                                       . time() . ',' . 
intval($values['sdate']) . ',' . intval($values['edate']) . ",'" . 
$values['hours_descr'] . "','"
-                                                       . $values['remark'] . 
"','" . (isset($values['billable'])?'N':'Y') . "'," . 
intval($values['w_minutes']) . ",'"
-                                                       . $values['status'] . 
"'," . intval($values['employee']) . ',' . intval($values['pro_parent']) . ','
-                                                       . 
intval($values['pro_main']) . ',' . $values['km_distance'] . ',' . 
$values['t_journey'] . ')',__LINE__,__FILE__); 
+                                                       . 
'status,employee,pro_parent,pro_main,km_distance,t_journey,surcharge) VALUES (' 
. intval($values['project_id']) . ','
+                                                       . 
intval($values['activity_id']) . ',' . time() . ',' . intval($values['sdate']) 
. ',' . intval($values['edate']) . ",'"
+                                                       . 
$values['hours_descr'] . "','" . $values['remark'] . "','" . 
(isset($values['billable'])?'N':'Y') . "'," . intval($values['w_minutes'])
+                                                       . ",'" . 
$values['status'] . "'," . intval($values['employee']) . ',' . 
intval($values['pro_parent']) . ',' . intval($values['pro_main'])
+                                                       . ',' . 
$values['km_distance'] . ',' . $values['t_journey'] . ',' . 
intval($values['surcharge']) . ')',__LINE__,__FILE__); 
                }
 
                function edit_hours($values)
@@ -165,7 +166,7 @@
                                                        . 
intval($values['sdate']) . ',end_date=' . intval($values['edate']) . 
",hours_descr='" . $values['hours_descr'] . "',remark='"
                                                        . $values['remark'] . 
"', billable='" . (isset($values['billable'])?'N':'Y') . "', minutes=" . 
intval($values['w_minutes'])
                                                        . ",status='" . 
$values['status'] . "',employee=" . intval($values['employee']) . ', 
km_distance=' . $values['km_distance']
-                                                       . ', t_journey=' . 
$values['t_journey'] . ' where id=' . 
intval($values['hours_id']),__LINE__,__FILE__);
+                                                       . ', t_journey=' . 
$values['t_journey'] . ', surcharge=' . intval($values['surcharge']) . ' where 
id=' . intval($values['hours_id']),__LINE__,__FILE__);
                }
 
                function delete_hours($values)
@@ -341,10 +342,10 @@
                        $project_array  = $params['project_array'];
                        $hours                  = 
isset($params['hours'])?$params['hours']:True;
                        $action                 = 
$params['action']?$params['action']:'subs';
-                       $no_billable    = 
isset($params['no_billable'])?$params['no_billable']:False;
-                       $is_billable    = 
isset($params['is_billable'])?$params['is_billable']:False;
 
-                       $sql = 'SELECT SUM(minutes) as utime from phpgw_p_hours 
where';
+                       $this->column_array = 
array('id,minutes,billable,surcharge,employee');
+
+                       $sql = 'SELECT id,minutes,billable,surcharge,employee 
from phpgw_p_hours where ' . "status='done' and";
 
                        switch($action)
                        {
@@ -363,23 +364,8 @@
                                        break;
                        }
 
-                       if($no_billable)
-                       {
-                               $select .= " AND billable='N'";
-                       }
-                       else if($is_billable)
-                       {
-                               $select .= " AND billable='Y'";
-                       }
-
                        $this->db->query($sql . $select,__LINE__,__FILE__);
-
-                       if($this->db->next_record())
-                       {
-                               return $this->db->f('utime');
-                               //return $this->format_wh($hours);
-                       }
-                       return False;
+                       return $this->db2hours(True);
                }
 
                function get_project_employees($params = 0)
@@ -426,8 +412,6 @@
                {
                        $project_id             = intval($params['project_id']);
                        $project_array  = $params['project_array'];
-                       $no_billable    = 
isset($params['no_billable'])?$params['no_billable']:False;
-                       $is_billable    = 
isset($params['is_billable'])?$params['is_billable']:False;
 
                        $emps = $this->get_project_employees($params);
 
@@ -440,15 +424,6 @@
                                $select = ' and project_id=' . $project_id;
                        }
 
-                       if($no_billable)
-                       {
-                               $select .= " AND billable='N'";
-                       }
-                       else if($is_billable)
-                       {
-                               $select .= " AND billable='Y'";
-                       }
-
                        for($i=0;$i<count($emps);$i++)
                        {
                                $bemp[$i] = array
@@ -456,7 +431,8 @@
                                        'employee'      => $emps[$i]
                                );
 
-                               $sql = 'SELECT minutes,start_date,end_date from 
phpgw_p_hours where employee=' . $emps[$i] . $select;
+                               $sql = 'SELECT 
id,minutes,start_date,end_date,billable,surcharge from phpgw_p_hours where ' . 
"status='done'" . ' and employee='
+                                               . $emps[$i] . $select;
                                $this->db->query($sql,__LINE__,__FILE__);
 
                                while($this->db->next_record())
@@ -464,8 +440,10 @@
                                        $bemp[$i]['hours'][] = array
                                        (
                                                'minutes'       => 
$this->db->f('minutes'),
+                                               'billable'      => 
$this->db->f('billable'),
                                                'sdate'         => 
$this->db->f('start_date'),
-                                               'edate'         => 
$this->db->f('end_date')
+                                               'edate'         => 
$this->db->f('end_date'),
+                                               'surcharge'     => 
$this->db->f('surcharge')
                                        );
                                }
                        }
@@ -489,13 +467,13 @@
                                        'activity_id'   => 
$this->db->f('activity_id'),
                                        'remark'                => 
$this->db->f('remark'),
                                        'km_distance'   => 
$this->db->f('km_distance'),
-                                       't_journey'             => 
$this->db->f('t_journey') 
+                                       't_journey'             => 
$this->db->f('t_journey'),
+                                       'surcharge'             => 
$this->db->f('surcharge')
                                );
                        }
                        return $track;
                }
 
-
                function list_ttracker()
                {
                        $ordermethod = ' order by project_id,start_date ASC';
@@ -626,10 +604,10 @@
                                //case 'start':
                                case 'apply':
                                        $this->db->query('INSERT into 
phpgw_p_ttracker 
(project_id,activity_id,employee,start_date,end_date,minutes,hours_descr,status,'
-                                                                       
.'remark,t_journey,km_distance,stopped) values(' . $project_id . ',' . 
intval($values['activity_id'])
+                                                                       
.'remark,t_journey,km_distance,stopped,surcharge) values(' . $project_id . ',' 
. intval($values['activity_id'])
                                                                        . ',' . 
$this->account . ',' . intval($values['sdate']) . ',' . 
intval($values['sdate']) . ','
                                                                        . 
intval($values['w_minutes']) . ",'" . $values['hours_descr'] . "','" . 
$values['action'] . "','" . $values['remark']
-                                                                       . "'," 
. $values['t_journey'] . ',' . $values['km_distance'] . 
",'Y')",__LINE__,__FILE__);
+                                                                       . "'," 
. $values['t_journey'] . ',' . $values['km_distance'] . ",'Y'," . 
intval($values['surcharge']) . ')',__LINE__,__FILE__);
 
                                        //return 
$this->db->get_last_insert_id('phpgw_p_ttracker','track_id');
                                        break;
@@ -650,11 +628,11 @@
                                $hour['t_journey']              = 
$hour['t_journey'] + 0.0;
 
                                $this->db->query('INSERT into phpgw_p_hours 
(project_id,activity_id,entry_date,start_date,end_date,hours_descr,remark,minutes,'
-                                                       . 
'status,employee,pro_parent,pro_main,billable,t_journey,km_distance) VALUES (' 
. intval($hour['project_id']) . ','
+                                                       . 
'status,employee,pro_parent,pro_main,billable,t_journey,km_distance,surcharge) 
VALUES (' . intval($hour['project_id']) . ','
                                                        . 
intval($hour['activity_id']) . ',' . time() . ',' . intval($hour['sdate']) . 
',' . intval($hour['edate']) . ",'"
                                                        . $hour['hours_descr'] 
. "','" . $hour['remark'] . "'," . intval($hour['minutes']) . ",'done'," . 
intval($hour['employee'])
                                                        . ',' . 
intval($hour['pro_parent']) . ',' . intval($hour['pro_main']) . ",'Y'," . 
$hour['t_journey'] . ','
-                                                       . $hour['km_distance'] 
. ')',__LINE__,__FILE__);
+                                                       . $hour['km_distance'] 
. ',' . intval($values['surcharge']) . ')',__LINE__,__FILE__);
 
                                $this->db->query('DELETE from phpgw_p_ttracker 
where track_id=' . intval($hour['track_id']),__LINE__,__FILE__);
                        }




reply via email to

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