phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property invoice_paid.php,1.5,1.6 addactivity.ph


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property invoice_paid.php,1.5,1.6 addactivity.php,1.3,1.4 view_workorder.php,1.2,1.3 add_st_hours.php,1.1.1.1,1.2 add_st_hours_list.php,1.1.1.1,1.2 add_wo_template.php,1.1.1.1,1.2 add_wo_template_hours.php,1.1.1.1,1.2 calculate_edithour.php,1.1.1.1,1.2 calculate_listhours.php,1.1.1.1,1.2 edit_wo_template_hours.php,1.1.1.1,1.2 editactivity.php,1.1.1.1,1.2 event_equipment.php,1.1.1.1,1.2 hours_addhour.php,1.1.1.1,1.2 list_wo_template.php,1.1.1.1,1.2 list_wo_template_hours.php,1.1.1.1,1.2 view_detail.php,1.1.1.1,1.2 view_tender.php,1.1.1.1,1.2 list_property_value.php,1.1,1.2 property_value_history.php,1.1,1.2
Date: Mon, 16 Sep 2002 12:05:46 -0400

Update of /cvsroot/phpgroupware/property
In directory subversions:/tmp/cvs-serv12273

Modified Files:
        invoice_paid.php addactivity.php view_workorder.php 
        add_st_hours.php add_st_hours_list.php add_wo_template.php 
        add_wo_template_hours.php calculate_edithour.php 
        calculate_listhours.php edit_wo_template_hours.php 
        editactivity.php event_equipment.php hours_addhour.php 
        list_wo_template.php list_wo_template_hours.php 
        view_detail.php view_tender.php list_property_value.php 
        property_value_history.php 
Log Message:
no message

Index: invoice_paid.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/invoice_paid.php,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -r1.5 -r1.6
*** invoice_paid.php    3 Sep 2002 22:15:38 -0000       1.5
--- invoice_paid.php    16 Sep 2002 16:05:44 -0000      1.6
***************
*** 182,188 ****
  
  
        if ($ab_id)
        {
!               $querymethod = " where (spvend_code ='$ab_id')";
                if($objekt_id)
                {
--- 182,193 ----
  
  
+       if ($edate && $sdate)
+       {
+               $timesearch= " where (overftid > '$sdate'  and  overftid < 
'$edate')";
+       }
+ 
        if ($ab_id)
        {
!               $querymethod = " and (spvend_code ='$ab_id')";
                if($objekt_id)
                {
***************
*** 195,203 ****
                if($objekt_id)
                {
!                       $querymethod =" where (dima like '%$objekt_id%')";
                        $where_1='and';
                }
  
!               $where_1='where';
        }
  
--- 200,208 ----
                if($objekt_id)
                {
!                       $querymethod =" and (dima like '%$objekt_id%')";
                        $where_1='and';
                }
  
!               $where_1='and';
        }
  
***************
*** 261,266 ****
      $groupmethod=" group by bilagsnr";
  
!       $sql = "SELECT DISTINCT bilagsnr, count(bilagsnr) as underbilag, 
sum(belop) as belop,sum(godkjentbelop) as godkjentbelop FROM t_ecobilagoverf 
$querymethod $coordinator $filtermethod $groupmethod  $ordermethod";
        $GLOBALS['phpgw']->db->limit_query($sql ,$start,__LINE__,__FILE__);
        while ($GLOBALS['phpgw']->db->next_record())
        {
--- 266,273 ----
      $groupmethod=" group by bilagsnr";
  
!       $sql = "SELECT DISTINCT bilagsnr, count(bilagsnr) as underbilag, 
sum(belop) as belop,sum(godkjentbelop) as godkjentbelop FROM t_ecobilagoverf 
$timesearch $querymethod $coordinator $filtermethod $groupmethod  $ordermethod";
        $GLOBALS['phpgw']->db->limit_query($sql ,$start,__LINE__,__FILE__);
+ //    echo 'sql: '.$sql .'<BR>';
+ 
        while ($GLOBALS['phpgw']->db->next_record())
        {
***************
*** 364,373 ****
  //                    echo 'bilag_nr: '.$bilag_nr .'<BR>';
                        $GLOBALS['phpgw']->db->query("SELECT 
spvend_code,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
!                       . " 
utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,fakturadato,org_name,"
                        . " forfallsdato,periode,artid,kidnr, "
!                       . " DATEDIFF(day, fakturadato, utbetalingsigndato) AS 
no_of_days "
                        . " from t_ecobilagoverf $join phpgw_addressbook ON 
phpgw_addressbook.id = t_ecobilagoverf.spvend_code WHERE bilagsnr = '$bilag_nr' 
"
                        . " group by 
spvend_code,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
!                       . " 
utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,fakturadato,org_name,"
                        . " forfallsdato,periode,artid,kidnr 
",__LINE__,__FILE__);
  
--- 371,380 ----
  //                    echo 'bilag_nr: '.$bilag_nr .'<BR>';
                        $GLOBALS['phpgw']->db->query("SELECT 
spvend_code,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
!                       . " 
utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,overftid,fakturadato,org_name,"
                        . " forfallsdato,periode,artid,kidnr, "
!                       . " DATEDIFF(day, fakturadato, overftid) AS no_of_days "
                        . " from t_ecobilagoverf $join phpgw_addressbook ON 
phpgw_addressbook.id = t_ecobilagoverf.spvend_code WHERE bilagsnr = '$bilag_nr' 
"
                        . " group by 
spvend_code,oppsynsmannid,saksbehandlerid,budsjettansvarligid,"
!                       . " 
utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,overftid,fakturadato,org_name,"
                        . " forfallsdato,periode,artid,kidnr 
",__LINE__,__FILE__);
  
***************
*** 710,714 ****
                $fakturadato = str_replace(" 12:00AM","",$fakturadato_temp);
  
!               $utbetalingsigndato = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('utbetalingsigndato'));
                if (! $utbetalingsigndato)  $utbetalingsigndato  = '&nbsp;';
  
--- 717,721 ----
                $fakturadato = str_replace(" 12:00AM","",$fakturadato_temp);
  
!               $utbetalingsigndato = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('overftid'));
                if (! $utbetalingsigndato)  $utbetalingsigndato  = '&nbsp;';
  

Index: addactivity.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/addactivity.php,v
retrieving revision 1.3
retrieving revision 1.4
diff -C2 -r1.3 -r1.4
*** addactivity.php     3 Sep 2002 22:15:38 -0000       1.3
--- addactivity.php     16 Sep 2002 16:05:44 -0000      1.4
***************
*** 212,215 ****
--- 212,217 ----
        elseif ($GLOBALS['phpgw']->db->f('unit')=='RS'):
                $unit_sel[7]=' selected';
+       elseif ($GLOBALS['phpgw']->db->f('unit')=='KM'):
+               $unit_sel[8]=' selected';
        endif;
  
***************
*** 221,225 ****
                        . '<option value="KG"' . $unit_sel[5] . '>' . 
lang('KG') . '</option>' . "\n"
                        . '<option value="TON"' . $unit_sel[6] . '>' . 
lang('TON') . '</option>' . "\n"
!                       . '<option value="RS"' . $unit_sel[7] . '>' . 
lang('RS') . '</option>' . "\n";
  
        $t->set_var('unit_list',$unit_list);
--- 223,228 ----
                        . '<option value="KG"' . $unit_sel[5] . '>' . 
lang('KG') . '</option>' . "\n"
                        . '<option value="TON"' . $unit_sel[6] . '>' . 
lang('TON') . '</option>' . "\n"
!                       . '<option value="RS"' . $unit_sel[7] . '>' . 
lang('RS') . '</option>' . "\n"
!                       . '<option value="KM"' . $unit_sel[8] . '>' . 
lang('KM') . '</option>' . "\n";
  
        $t->set_var('unit_list',$unit_list);

Index: view_workorder.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/view_workorder.php,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** view_workorder.php  4 Sep 2002 17:56:09 -0000       1.2
--- view_workorder.php  16 Sep 2002 16:05:44 -0000      1.3
***************
*** 642,646 ****
--- 642,649 ----
                        if (! $activity_id) $activity_id = '&nbsp;';
  
+                       $tolerance  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['tolerance']);
+ 
                        $ns3420_id  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['ns3420_id']);
+                       $ns3420_id= str_replace("-","$tolerance",$ns3420_id);
  
                        $building_part  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['building_part']);
***************
*** 677,681 ****
                        if (! $hours_descr) $hours_descr = '&nbsp;';
  
!                       $hours_descr= str_replace("\n","<br>",$hours_descr);
  
                        $remark = 
$GLOBALS['phpgw']->strip_html($hours[$i]['remark']);
--- 680,684 ----
                        if (! $hours_descr) $hours_descr = '&nbsp;';
  
!                       $hours_descr= 
str_replace("\n","<br>",$hours_descr).$tolerance;
  
                        $remark = 
$GLOBALS['phpgw']->strip_html($hours[$i]['remark']);

Index: add_st_hours.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/add_st_hours.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** add_st_hours.php    28 Aug 2002 16:43:05 -0000      1.1.1.1
--- add_st_hours.php    16 Sep 2002 16:05:44 -0000      1.2
***************
*** 68,116 ****
                                                                                
. '&start=' . $start));
  
- 
-       if ($submit)
-       {
-               $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_wrkorders 
WHERE id ='$wrkorder_id' ");
-               $GLOBALS['phpgw']->db->next_record();
-               $vendor_id = $GLOBALS['phpgw']->db->f('vendor');
- 
- 
-               $employee = $GLOBALS['phpgw']->db->f('coordinator');
-               $id= next_id(fm_wo_hours);
- 
-       //      printf("<br><b>standard_wrkorder_type:</b> 
%s",$standard_wrkorder_type);
- 
- 
-               $db2 = $GLOBALS['phpgw']->db;
- 
-               $sql = "select fm_wo_template.unit as unit,fm_wo_ns3420.descr 
as descr,fm_wo_template.ns3420_id, fm_wo_template.building_part_id as 
building_part from fm_wo_template join fm_wo_ns3420 on fm_wo_template.ns3420_id 
= fm_wo_ns3420.id  where 
fm_wo_template.wo_template_type_id=$standard_wrkorder_type";
- 
-               $db2->query($sql,__LINE__,__FILE__);
- 
- 
-               while ($db2->next_record())
-               {
- 
-               $unit = $db2->f('unit');
-               $descr = $db2->f('descr');
-               $ns3420_id = $db2->f('ns3420_id');
-               $building_part = $db2->f('building_part');
- 
- 
-               $GLOBALS['phpgw']->db->query("INSERT into fm_wo_hours 
(id,wrkorder_id,activity_id,ns3420_id,entry_date,hours_descr,remark,status,"
-                                                       . "employee, unit, 
vendor_id,building_part) VALUES ('$id','$wrkorder_id','0','$ns3420_id','" . 
time() . "','$descr','$remark',"
-                                                       . 
"'open','$employee','$unit','$vendor_id','$building_part')");
- 
- 
- 
-               $id++;
-               $t->set_var('message',lang('Job has been added !'));
- 
-               }
- 
-       }
- 
- 
- 
        if (! $start)
        {
--- 68,71 ----
***************
*** 161,165 ****
        $db2 = $GLOBALS['phpgw']->db;
  
!       $sql = "select id as standard_wrkorder_type, template, descr from 
fm_wo_template_type ";
  
        $db2->query($sql,__LINE__,__FILE__);
--- 116,120 ----
        $db2 = $GLOBALS['phpgw']->db;
  
!       $sql = "select fm_wo_template_type.id as 
standard_wrkorder_type,template, fm_wo_template_type.descr as descr, 
fm_wo_chapter.descr as chapter from fm_wo_template_type $join fm_wo_chapter on 
fm_wo_template_type.chapter_id=fm_wo_chapter.id ";
  
        $db2->query($sql,__LINE__,__FILE__);
***************
*** 192,195 ****
--- 147,151 ----
        
$t->set_var('sort_descr',$GLOBALS['phpgw']->nextmatchs->show_sort_order($sort,'descr',$order,'/property/add_st_hours.php',lang('Description')));
        $t->set_var('lang_select',lang('Select'));
+       $t->set_var('lang_chapter',lang('Chapter'));
        
$t->set_var('cats_action',$GLOBALS['phpgw']->link('/property/add_st_hours.php',"sort=$sort&order=$order&filter=$filter&start=$start&query=$query&cat_id=$cat_id&objekt_id=$objekt_id&bygg_id=$bygg_id"));
        
$t->set_var('cats_list',$c->formated_list('select','all',$cat_id,'True'));
***************
*** 206,209 ****
--- 162,168 ----
                if (! $standard_wrkorder_type)  $standard_wrkorder_type  = 
'&nbsp;';
  
+               $chapter = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('chapter'));
+               if (! $chapter)  $chapter  = '&nbsp;';
+ 
                $template = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('template'));
                if (! $template)  $template  = '&nbsp;';
***************
*** 217,220 ****
--- 176,180 ----
                $t->set_var(array(
                                                'standard_wrkorder_type'        
=> $standard_wrkorder_type,
+                                               'chapter'                       
                => $chapter,
                                                'template'                      
                => $template,
                                                'descr'                         
                => $descr));

Index: add_st_hours_list.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/add_st_hours_list.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** add_st_hours_list.php       28 Aug 2002 16:43:06 -0000      1.1.1.1
--- add_st_hours_list.php       16 Sep 2002 16:05:44 -0000      1.2
***************
*** 19,25 ****
  //    $t->set_block('wrkorderhours_list_t','edit','edithandle');
  
- 
- 
- 
        $fm_wrkorder = CreateObject('property.fm_wrkorder');
  
--- 19,22 ----
***************
*** 33,38 ****
        $t->set_var('lang_standard_hours',lang('Standard hours'));
  
- 
- 
        $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_wrkorders WHERE id 
='$wrkorder_id' ");
        $GLOBALS['phpgw']->db->next_record();
--- 30,33 ----
***************
*** 43,48 ****
        $t->set_var('wrkorder_selected',$wrkorder_selected);
        $t->set_var('lang_wrkorder',lang('Workorder'));
! 
! 
  
        if ($submit)
--- 38,42 ----
        $t->set_var('wrkorder_selected',$wrkorder_selected);
        $t->set_var('lang_wrkorder',lang('Workorder'));
!       $t->set_var('lang_select',lang('Select'));
  
        if ($submit)
***************
*** 51,93 ****
                $errorcount = 0;
  
-               if ($shour && ($shour != 0) && ($shour != 12))
-               {
-                       if ($sampm=='pm') { $shour = $shour + 12; }
-               }
- 
-               if ($shour && ($shour == 12))
-               {
-                       if ($sampm=='am') { $shour = 0; }
-               }
- 
-               if ($ehour && ($ehour != 0) && ($ehour != 12))
-               {
-                       if ($eampm=='pm') { $ehour = $ehour + 12; }
-               }
- 
-               if ($ehour && ($ehour == 12))
-               {
-                       if ($eampm=='am') { $ehour = 0; }
-               }
- 
-               if (checkdate($smonth,$sday,$syear)) { $sdate = 
mktime($shour,$smin,0,$smonth,$sday,$syear); }
-               else
-               {
-                       if ($shour && $smin && $smonth && $sday && $syear)
-                       {
-                               $error[$errorcount++] = lang('You have entered 
an invalid start date !') . '<br>' . $shour . ':' . $smin  . ' ' . $smonth . 
'/' . $sday . '/' . $syear;
-                       }
-               }
- 
-               if (checkdate($emonth,$eday,$eyear)) { $edate = 
mktime($ehour,$emin,0,$emonth,$eday,$eyear); }
-               else
-               {
-                       if ($ehour && $emin && $emonth && $eday && $eyear)
-                       {
-                               $error[$errorcount++] = lang('You have entered 
an invalid end date !') . '<br>' . $ehour . ':' . $emin . ' ' . $emonth . '/' . 
$eday . '/' . $eyear;
-                       }
-               }
- 
- 
        // ---------------------grouping ------------------------------
  
--- 45,48 ----
***************
*** 154,157 ****
--- 109,135 ----
                                $n=$entry[0];
  
+                               if (!$group_exist && !$new_group_descr && 
$grouping_descr_h[$n])
+                               {
+ 
+                                       $GLOBALS['phpgw']->db->query("SELECT 
grouping_id FROM fm_wo_hours WHERE wrkorder_id ='$wrkorder_id' and 
grouping_descr ='$grouping_descr_h[$n]'");
+                                       $GLOBALS['phpgw']->db->next_record();
+                                       $grouping_id= 
$GLOBALS['phpgw']->db->f('grouping_id');
+ 
+                                       if (!$grouping_id)
+                                       {
+ 
+                                               
$GLOBALS['phpgw']->db->query("SELECT max(grouping_id) as grouping_id FROM 
fm_wo_hours WHERE wrkorder_id ='$wrkorder_id'");
+                                               
$GLOBALS['phpgw']->db->next_record();
+                                               $grouping_id= 
$GLOBALS['phpgw']->db->f('grouping_id')+1;
+                                       }
+ 
+                                       $grouping_descr= $grouping_descr_h[$n];
+ 
+                                       $GLOBALS['phpgw']->db->query("SELECT 
max(record) as record FROM fm_wo_hours WHERE wrkorder_id ='$wrkorder_id' and 
grouping_id= '$grouping_id'");
+                                       $GLOBALS['phpgw']->db->next_record();
+                                       $record= 
$GLOBALS['phpgw']->db->f('record')+1;
+ 
+                               }
+ 
                                if (! $quantity[$n])
                                {
***************
*** 174,189 ****
                                $cost = $quantity_value * $billperae_value;
                                $GLOBALS['phpgw']->db->query("INSERT INTO 
fm_wo_hours 
(id,record,wrkorder_id,activity_id,grouping_id,grouping_descr,hours_descr,ns3420_id,building_part,entry_date,start_date,end_date,remark,minutes,status,minperae,"
!                               . "billperae,employee,vendor_id, quantity, 
unit, cost) VALUES 
('$id','$record','$wrkorder_id','$activity_id_h[$n]','$grouping_id','$grouping_descr','$descr_h[$n]','$st_hour_id_h[$n]','$building_part_h[$n]','"
 . time() . "','$sdate','$edate','$remark[$n]','$ae_minutes',"
!                               . 
"'open','60','$billperae_value','$employee','$vendor_id','$quantity_value','$unit_h[$n]','$cost')");
  
                        $id=$id+1;
                        $record=$record+1;
                        }
- 
- 
- 
- 
  // ----------------------- end insert hours----------------
- 
                }
        }
--- 152,162 ----
                                $cost = $quantity_value * $billperae_value;
                                $GLOBALS['phpgw']->db->query("INSERT INTO 
fm_wo_hours 
(id,record,wrkorder_id,activity_id,grouping_id,grouping_descr,hours_descr,ns3420_id,building_part,entry_date,start_date,end_date,remark,minutes,status,minperae,"
!                               . "billperae,employee,vendor_id, quantity, 
unit, cost,tolerance) VALUES 
('$id','$record','$wrkorder_id','$activity_id_h[$n]','$grouping_id','$grouping_descr','$descr_h[$n]','$st_hour_id_h[$n]','$building_part_h[$n]','"
 . time() . "','$sdate','$edate','$remark[$n]','$ae_minutes',"
!                               . 
"'open','60','$billperae_value','$employee','$vendor_id','$quantity_value','$unit_h[$n]','$cost','$tolerance_h[$n]')");
  
                        $id=$id+1;
                        $record=$record+1;
                        }
  // ----------------------- end insert hours----------------
                }
        }
***************
*** 230,239 ****
        $t->set_var('lang_chapter_list',lang('Chapter'));
  
!       
$t->set_var('chapter_list',$fm_wrkorder->select_chapter_list($wrkorder_id));
  
  //----------------------------------------------------------
  // -------------- grouping list ----------------------
  
!       
$t->set_var('grouping_list',$fm_wrkorder->select_grouping_list($wrkorder_id));
  
  
--- 203,212 ----
        $t->set_var('lang_chapter_list',lang('Chapter'));
  
!       
$t->set_var('chapter_list',$fm_wrkorder->select_chapter_list('fm_wo_wrkorders',$wrkorder_id));
  
  //----------------------------------------------------------
  // -------------- grouping list ----------------------
  
!       
$t->set_var('grouping_list',$fm_wrkorder->select_grouping_list('fm_wo_hours',$wrkorder_id,'dummy',''));
  
  
***************
*** 246,252 ****
                $t->set_var('cost',$cost);
                $t->set_var('lang_cost',lang('cost'));
- 
- 
- 
        }
        else
--- 219,222 ----
***************
*** 291,295 ****
  //--------------------------- calculate-----------------------
  
- 
        if ($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
        {
--- 261,264 ----
***************
*** 303,308 ****
        $db2 = $GLOBALS['phpgw']->db;
  
- 
- 
        if ($errorcount) { 
$t->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); }
  
--- 272,275 ----
***************
*** 332,345 ****
        $t->set_var('h_lang_select',lang('Select'));
        $t->set_var('h_lang_edit_activity',lang('Edit activity'));
  
  
  // ------------------------ end header declaration 
----------------------------
  
- 
- 
  // ----------------select  activities
  
        if ($wrkorder_id)
!               {
                $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_wrkorders 
WHERE id ='$wrkorder_id' ");
                $GLOBALS['phpgw']->db->next_record();
--- 299,311 ----
        $t->set_var('h_lang_select',lang('Select'));
        $t->set_var('h_lang_edit_activity',lang('Edit activity'));
+       $t->set_var('check','check.gif');
  
  
  // ------------------------ end header declaration 
----------------------------
  
  // ----------------select  activities
  
        if ($wrkorder_id)
!       {
                $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_wrkorders 
WHERE id ='$wrkorder_id' ");
                $GLOBALS['phpgw']->db->next_record();
***************
*** 352,393 ****
                $t->set_var('wrkorder_descr',$wrkorder_descr);
  
- 
- 
-               $sdate = $GLOBALS['phpgw']->db->f('start_date');
-               $edate = $GLOBALS['phpgw']->db->f('end_date');
- 
-               $sm = CreateObject('phpgwapi.sbox');
- 
- 
-               if (!$sdate)
-               {
-                       $smonth = date('m',time());
-                       $sday = date('d',time());
-                       $syear = date('Y',time());
-               }
-               else
-               {
-                       $smonth = date('m',$sdate);
-                       $sday = date('d',$sdate);
-                       $syear = date('Y',$sdate);
-               }
- 
-               
$t->set_var('start_date_select',$GLOBALS['phpgw']->common->dateformatorder($sm->getYears('syear',$syear),$sm->getMonthText('smonth',$smonth),$sm->getDays('sday',$sday)));
- 
-               if (!$edate)
-               {
-                       $emonth = 0;
-                       $eday = 0;
-                       $eyear = 0;
-               }
-               else
-               {
-                       $emonth = date('m',$edate);
-                       $eday = date('d',$edate);
-                       $eyear = date('Y',$edate);
-               }
- 
-               
$t->set_var('end_date_select',$GLOBALS['phpgw']->common->dateformatorder($sm->getYears('eyear',$eyear),$sm->getMonthText('emonth',$emonth),$sm->getDays('eday',$eday)));
- 
                $GLOBALS['phpgw']->db->query("SELECT org_name FROM 
phpgw_addressbook WHERE id ='$vendor_id' ");
                $GLOBALS['phpgw']->db->next_record();
--- 318,321 ----
***************
*** 396,403 ****
                $t->set_var('vendor_id',$vendor_id);
  
!               }
  
  
!       $GLOBALS['phpgw']->db->query("select remark, fm_wo_template.unit as 
unit,tekst1,tekst2,tekst3,tekst4,tekst5,tekst6, fm_wo_template.ns3420_id, 
fm_wo_template.building_part_id as building_part from fm_wo_template $join 
fm_wo_ns3420 on fm_wo_template.ns3420_id = fm_wo_ns3420.id  where 
fm_wo_template.wo_template_type_id=$standard_wrkorder_type");
  
  
--- 324,333 ----
                $t->set_var('vendor_id',$vendor_id);
  
!       }
  
  
!       $GLOBALS['phpgw']->db->query("select tolerance,remark,record, 
billperae,quantity,cost,dim_d,grouping_id,grouping_descr,fm_wo_template.unit as 
unit,tekst1,tekst2,tekst3,tekst4,tekst5,tekst6,"
!        . " fm_wo_template.ns3420_id, fm_wo_template.building_part_id as 
building_part from fm_wo_template $join fm_wo_ns3420 on 
fm_wo_template.ns3420_id = fm_wo_ns3420.id "
!        . " where fm_wo_template.wo_template_type_id=$standard_wrkorder_type 
order by grouping_id,record");
  
  
***************
*** 412,422 ****
        $t->set_var('lang_st_hour',lang('Standard description'));
  
- 
- 
        $summe=0;
        $sumaes=0;
        $j=0;
  
- 
        while ($GLOBALS['phpgw']->db->next_record())
        {
--- 342,349 ----
***************
*** 425,430 ****
        //      $select = '<input type="checkbox" name="select[' . $j . ']" 
value="False" >';
                $select = '<input type="checkbox" name="select[' . $j . ']" 
value="'. $j . ' ">';
-               $quantity = '<input type="text" name="quantity[' . $j . ']" 
size="5"  >';
  
  
  //            $activity_id = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('activity_id'));
--- 352,368 ----
        //      $select = '<input type="checkbox" name="select[' . $j . ']" 
value="False" >';
                $select = '<input type="checkbox" name="select[' . $j . ']" 
value="'. $j . ' ">';
  
+               $record_temp  = $GLOBALS['phpgw']->db->f('record');
+               if ($record_temp==1)
+               {
+                       $grouping_descr_separator  = 
$GLOBALS['phpgw']->db->f('grouping_descr');
+                       $grouping_descr_separator= '<tr><td><td><td 
align="center"><b>' . $grouping_descr_separator . '</b></td></td></td></tr>';
+ //                    echo 'grouping_descr_separator: 
'.$grouping_descr_separator .'<BR>';
+               }
+               else
+               {
+                       $grouping_descr_separator='';
+               }
+ //            echo 'record: '.$record_temp .'<BR>';
  
  //            $activity_id = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('activity_id'));
***************
*** 441,444 ****
--- 379,386 ----
                $remark = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('remark'));
  
+               $tolerance = $GLOBALS['phpgw']->db->f('tolerance');
+               if (! $tolerance)  $tolerance  = '';
+               $tolerance_h ='<input type="hidden" name="tolerance_h[' . $j . 
']" value="'. $tolerance . '">';
+ 
  
  
***************
*** 446,449 ****
--- 388,392 ----
                $descr = $tekst1;
  
+ //            echo 'tekst1: '.$tekst1 .'<BR>';
                if ($tekst2)
                {
***************
*** 470,474 ****
--- 413,419 ----
                        $descr .="<br>". $tekst6;
                }
+ 
                $descr_h ='<input type="hidden" name="descr_h[' . $j . ']" 
value="'. (str_replace("<br>","",$descr)) . '">';
+               $descr .=$tolerance;
  
                if ($remark)
***************
*** 477,480 ****
--- 422,429 ----
                }
  
+               $grouping_descr = $GLOBALS['phpgw']->db->f('grouping_descr');
+               $grouping_descr_h ='<input type="hidden" 
name="grouping_descr_h[' . $j . ']" value="'. $grouping_descr . '">';
+               $dim_d = $GLOBALS['phpgw']->db->f('dim_d');
+               $dim_d_h ='<input type="hidden" name="dim_d_h[' . $j . ']" 
value="'. $dim_d . '">';
  
                $remark ='<input type="hidden" name="remark[' . $j . ']" 
value="'. $remark . '">';
***************
*** 490,497 ****
                $st_hour_id_h ='<input type="hidden" name="st_hour_id_h[' . $j 
. ']" value="'. $ns3420_id . '">';
  
-               $billperae = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('billperae'));
-               if (! $billperae)  $billperae  = '&nbsp;';
  
!               $billperae ='<input size = 5 type="text" name="billperae[' . $j 
. ']" value="">';
  
                $unit = 
lang($GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('unit')));
--- 439,452 ----
                $st_hour_id_h ='<input type="hidden" name="st_hour_id_h[' . $j 
. ']" value="'. $ns3420_id . '">';
  
  
!               $ns3420_id.=$tolerance;
! 
!               $billperae = $GLOBALS['phpgw']->db->f('billperae');
!               if (! $billperae)  $billperae  = '';
! 
!               $billperae ='<input size = 5 type="text" name="billperae[' . $j 
. ']" value="'. $billperae . '">';
! 
!               $quantity = $GLOBALS['phpgw']->db->f('quantity');
!               $quantity = '<input type="text" name="quantity[' . $j . ']" 
size="5" value="'. $quantity . '">';
  
                $unit = 
lang($GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('unit')));
***************
*** 503,516 ****
  
  
- //            $activity_account = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('activity_account'));
- //            if (! $activity_account)  $activity_account  = '&nbsp;';
- 
- //            $activity_account_h ='<input type="hidden" 
name="activity_account_h[' . $j . ']" value="'. $activity_account . '">';
- 
                $j++;
  
- 
-       //      $status = $GLOBALS['phpgw']->db->f('status');
-               $statusout = lang($status);
                $t->set_var('tr_color',$tr_color);
  
--- 458,463 ----
***************
*** 520,523 ****
--- 467,474 ----
  
                $t->set_var(array('select' => $select,
+                                       'grouping_descr' => $grouping_descr,
+                                       'grouping_descr_h' => $grouping_descr_h,
+                                       'dim_d' => $dim_d,
+                                       'dim_d_h' => $dim_d_h,
                                        'activity_id' => $activity_id,
                                        'activity_id_h' => $activity_id_h,
***************
*** 536,540 ****
                                        'account' => $account,
                                        'account_h' => $account_h,
!                               //      'lang_unit_detail' => $lang_unit_detail,
                                        'org_name' => $org_name));
  
--- 487,492 ----
                                        'account' => $account,
                                        'account_h' => $account_h,
!                                       'tolerance_h' => $tolerance_h,
!                                       'grouping_descr_separator' => 
$grouping_descr_separator,
                                        'org_name' => $org_name));
  
***************
*** 548,554 ****
  // -------------------------- end record declaration 
--------------------------
  
- 
- 
- 
  //    $t->set_var('edithandle','');
  //    $t->set_var('addhandle','');
--- 500,503 ----
***************
*** 559,568 ****
        $t->p('out');
  
- 
- 
- 
  //--------------------------- calkulate-----------------------
- 
- 
  
        $GLOBALS['phpgw']->common->phpgw_footer();
--- 508,512 ----

Index: add_wo_template.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/add_wo_template.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** add_wo_template.php 28 Aug 2002 16:43:06 -0000      1.1.1.1
--- add_wo_template.php 16 Sep 2002 16:05:44 -0000      1.2
***************
*** 30,34 ****
                }
  
!               $GLOBALS['phpgw']->db->query("select count(*) from 
fm_wo_template_type where template='$template'");
                $GLOBALS['phpgw']->db->next_record();
                if ($GLOBALS['phpgw']->db->f(0) != 0)
--- 30,34 ----
                }
  
! /*            $GLOBALS['phpgw']->db->query("select count(*) from 
fm_wo_template_type where template='$template'");
                $GLOBALS['phpgw']->db->next_record();
                if ($GLOBALS['phpgw']->db->f(0) != 0)
***************
*** 36,40 ****
                        $error[$errorcount++] = lang('That template ID has been 
used already !');
                }
! 
                if (! $error)
                {
--- 36,40 ----
                        $error[$errorcount++] = lang('That template ID has been 
used already !');
                }
! */
                if (! $error)
                {

Index: add_wo_template_hours.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/add_wo_template_hours.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** add_wo_template_hours.php   28 Aug 2002 16:43:06 -0000      1.1.1.1
--- add_wo_template_hours.php   16 Sep 2002 16:05:44 -0000      1.2
***************
*** 32,35 ****
--- 32,36 ----
                                . '<input type="hidden" name="wrkorder_id" 
value="' . $wrkorder_id . '">' . "\n";
  
+       $currency = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'];
  
        if ($submit)
***************
*** 37,41 ****
                $errorcount = 0;
  
!               $GLOBALS['phpgw']->db->query("select count(*) from 
fm_wo_template where wo_template_type_id='$id' and ns3420_id = '$ns3420_id' and 
building_part_id = '$building_part'");
                $GLOBALS['phpgw']->db->next_record();
                if ($GLOBALS['phpgw']->db->f(0) != 0)
--- 38,42 ----
                $errorcount = 0;
  
! /*            $GLOBALS['phpgw']->db->query("select count(*) from 
fm_wo_template where wo_template_type_id='$id' and ns3420_id = '$ns3420_id' and 
building_part_id = '$building_part'");
                $GLOBALS['phpgw']->db->next_record();
                if ($GLOBALS['phpgw']->db->f(0) != 0)
***************
*** 43,47 ****
                        $error[$errorcount++] = lang('That Hour ID has been 
used already !');
                }
! 
  
                $GLOBALS['phpgw']->db->query("SELECT max(id) as 
template_hour_id FROM fm_wo_template ");
--- 44,48 ----
                        $error[$errorcount++] = lang('That Hour ID has been 
used already !');
                }
! */
  
                $GLOBALS['phpgw']->db->query("SELECT max(id) as 
template_hour_id FROM fm_wo_template ");
***************
*** 49,61 ****
                $template_hour_id= 
$GLOBALS['phpgw']->db->f('template_hour_id')+1;
  
                if (! $error)
                {
                $remark = addslashes($remark);
  
!               $GLOBALS['phpgw']->db->query("INSERT into fm_wo_template 
(id,wo_template_type_id,ns3420_id,building_part_id,unit,remark) VALUES 
('$template_hour_id','$id','$ns3420_id','$building_part','$unit','$remark')");
  
                }
        }
  
        if ($errorcount) { 
$t->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); }
        if (($submit) && (! $error) && (! $errorcount)) { 
$t->set_var('message',lang('Job has been added !')); }
--- 50,204 ----
                $template_hour_id= 
$GLOBALS['phpgw']->db->f('template_hour_id')+1;
  
+               $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_ns3420 WHERE 
id ='$ns3420_id' ");
+               $GLOBALS['phpgw']->db->next_record();
+ 
+               $tekst1 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst1'));
+               $tekst2 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst2'));
+               $tekst3 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst3'));
+               $tekst4 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst4'));
+               $tekst5 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst5'));
+               $tekst6 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst6'));
+ 
+ 
+               $hours_descr = $tekst1;
+ 
+               if ($tekst2)
+               {
+                       $hours_descr .=" ". $tekst2;
+               }
+ 
+               if ($tekst3)
+               {
+                       $hours_descr .=" ". $tekst3;
+               }
+ 
+               if ($tekst4)
+               {
+                       $hours_descr .="<br>". $tekst4;
+               }
+ 
+               if ($tekst5)
+               {
+                       $hours_descr .="<br>". $tekst5;
+               }
+ 
+               if ($tekst6)
+               {
+                       $hours_descr .="<br>". $tekst6;
+               }
+ 
+               if ($quantity)
+               {
+                       $quantity=str_replace(",",".",$quantity);
+                       $quantity_value="'$quantity'";
+               }
+               else
+               {
+                       $quantity_value='NULL';
+               }
+ 
+               if ($billperae)
+               {
+                       $billperae=str_replace(",",".",$billperae);
+                       $billperae_value="'$billperae'";
+                       if (! $cost)
+                       {
+                               $cost=$quantity*$billperae;
+                               $cost_value = "'$cost'";
+                       }
+               }
+               else
+               {
+                       $billperae_value='NULL';
+                       $cost_value='NULL';
+               }
+ 
+               if ($cost)
+               {
+                       $cost_value = "'$cost'";
+               }
+ 
+       // ---------------------grouping ------------------------------
+ 
+       $t->set_var('group_exist',$group_exist);
+ //    $t->set_var('new_group_descr',$new_group_descr);
+ 
+               if ($group_exist)
+               {
+                       $grouping=group_exist;
+                       $GLOBALS['phpgw']->db->query("SELECT grouping_descr 
FROM fm_wo_template WHERE wo_template_type_id ='$id' and grouping_id = 
'$group_exist'");
+                       $GLOBALS['phpgw']->db->next_record();
+                       $grouping_descr= 
$GLOBALS['phpgw']->db->f('grouping_descr');
+                       $grouping_id=$group_exist;
+                       $grouping_id_value="'$grouping_id'";
+               }
+ 
+               if ($new_group_descr && !($new_group_descr==''))
+               {
+                       $grouping_descr=$new_group_descr;
+                       $GLOBALS['phpgw']->db->query("SELECT grouping_descr, 
grouping_id FROM fm_wo_template WHERE wo_template_type_id ='$id' and 
grouping_descr ='$grouping_descr'");
+                       $GLOBALS['phpgw']->db->next_record();
+                       $grouping_id= $GLOBALS['phpgw']->db->f('grouping_id');
+                       $grouping_id_value="'$grouping_id'";
+ 
+                       if (!$grouping_id)
+                       {
+ 
+                               $GLOBALS['phpgw']->db->query("SELECT 
max(grouping_id) as grouping_id FROM fm_wo_template WHERE wo_template_type_id 
='$id'");
+                               $GLOBALS['phpgw']->db->next_record();
+                               $grouping_id= 
$GLOBALS['phpgw']->db->f('grouping_id')+1;
+                               $grouping_id_value="'$grouping_id'";
+                       }
+               }
+ 
+               if (!$group_exist && !$new_group_descr)
+               {
+                       $grouping_descr= '';
+                       $grouping_id_value='NULL';
+ 
+               }
+               if(!$grouping_id_value)
+               {
+                       $grouping_id_value= 'NULL';
+               }
+       // ---------------------end grouping ------------------------------
+ 
+ 
+               $GLOBALS['phpgw']->db->query("SELECT max(record) as record FROM 
fm_wo_template WHERE wo_template_type_id ='$id' and grouping_id= 
'$grouping_id'");
+               $GLOBALS['phpgw']->db->next_record();
+               $record= $GLOBALS['phpgw']->db->f('record')+1;
+ 
+ 
+ 
+               $employee=$GLOBALS['phpgw_info']['user']['account_id'];
+ 
+ 
                if (! $error)
                {
+ 
                $remark = addslashes($remark);
  
!               $GLOBALS['phpgw']->db->query("INSERT into fm_wo_template 
(id,wo_template_type_id,owner,ns3420_id,building_part_id,unit,remark,"
!               . " record, grouping_id, grouping_descr, billperae, quantity, 
cost, dim_d,hours_descr,tolerance)"
!               . " VALUES 
('$template_hour_id','$id','$employee','$ns3420_id','$building_part','$unit','$remark',"
!               . " '$record', $grouping_id_value, '$grouping_descr', 
$billperae_value, $quantity_value, $cost_value, 
'$dim_d','$hours_descr','$tolerance')");
! 
!               $GLOBALS['phpgw']->db->query("UPDATE  fm_wo_template_type set 
chapter_id='$chapter' WHERE id ='$id'");
! 
  
                }
        }
  
+ 
+       $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_template_type WHERE 
id ='$id' ");
+       $GLOBALS['phpgw']->db->next_record();
+       $template_name = $GLOBALS['phpgw']->db->f('descr');
+       $template_id = $GLOBALS['phpgw']->db->f('id');
+       $template_selected=($template_id . ' [ '  . $template_name .  ' ]');
+       $t->set_var('template_selected',$template_selected);
+ 
+       $t->set_var('lang_template',lang('Template'));
+ 
+ 
        if ($errorcount) { 
$t->set_var('message',$GLOBALS['phpgw']->common->error_list($error)); }
        if (($submit) && (! $error) && (! $errorcount)) { 
$t->set_var('message',lang('Job has been added !')); }
***************
*** 77,80 ****
--- 220,232 ----
        $t->set_var('lang_reset',lang('Clear Form'));
        $t->set_var('lang_select_wrkorder',lang('Select fm_wrkorder'));
+       $t->set_var('lang_quantity',lang('Quantity'));
+       $t->set_var('lang_billperae',lang('Bill per unit'));
+       $t->set_var('currency',$currency);
+       $t->set_var('lang_override_calculation',lang('Overrides the 
calculation'));
+       $t->set_var('lang_grouping',lang('Grouping'));
+       $t->set_var('lang_if_group_exists',lang('If Grouping exists'));
+       $t->set_var('lang_new_grouping',lang('New Grouping'));
+       $t->set_var('lang_if_tender',lang('If tender'));
+ 
  
  
***************
*** 83,88 ****
--- 235,246 ----
        $t->set_var('ns3420_id',$ns3420_id);
        $t->set_var('building_part',$building_part);
+ //    $t->set_var('new_group_descr',$new_group_descr);
  
        $t->set_var('ns3420_descr',$ns3420_descr);
+       $t->set_var('minperae',$minperae);
+       $t->set_var('billperae',$billperae);
+       $t->set_var('quantity',$quantity);
+ //    $t->set_var('cost',$cost);
+       $t->set_var('lang_cost',lang('Cost'));
  
  //---------------Unit -----------------------------
***************
*** 127,130 ****
--- 285,321 ----
  //---------------End Unit -----------------------------
  
+ //---------------tolerance -----------------------------
+       $t->set_var('lang_tolerance',lang('Tolerance'));
+       if ($tolerance=='1'):
+               $tolerance_sel[1]=' selected';
+ 
+       elseif ($tolerance=='2'):
+               $tolerance_sel[2]=' selected';
+ 
+       elseif ($tolerance=='3'):
+               $tolerance_sel[3]=' selected';
+       endif;
+ 
+       $tolerance_list = '<option value="">' . lang('Select') . '</option>' . 
"\n"
+                       . '<option value="1"' . $tolerance_sel[1] . 
'>1</option>' . "\n"
+                       . '<option value="2"' . $tolerance_sel[2] . 
'>2</option>' . "\n"
+                       . '<option value="3"' . $tolerance_sel[3] . 
'>3</option>' . "\n";
+ 
+       $t->set_var('tolerance_list',$tolerance_list);
+ 
+ //---------------End Unit -----------------------------
+ 
+ 
+ // -------------- chapter list ----------------------
+       $t->set_var('lang_chapter_list',lang('Chapter'));
+ 
+       
$t->set_var('chapter_list',$fm_wrkorder->select_chapter_list(fm_wo_template_type,$id));
+ 
+ //----------------------------------------------------------
+ // -------------- grouping list ----------------------
+ 
+       
$t->set_var('grouping_list',$fm_wrkorder->select_grouping_list('fm_wo_template',$id,$grouping_id,''));
+ 
+ //----------------------------------------------------------
  
        $t->set_var('lang_building_part_list',lang('Building part'));
***************
*** 133,136 ****
--- 324,337 ----
  
  //----------------------------------------------------------
+ 
+ // -------------- dim_d list ----------------------
+       $t->set_var('lang_dim_d_list',lang('Dim D'));
+       $t->set_var('lang_select',lang('Select'));
+ 
+       $t->set_var('dim_d_list',$fm_wrkorder->select_dim_d_list($dim_d));
+ 
+ //----------------end dim_d-------------------------------
+ 
+ 
  
        $t->set_var('lang_standard_description',lang('Standard description'));

Index: calculate_edithour.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/calculate_edithour.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** calculate_edithour.php      28 Aug 2002 16:43:07 -0000      1.1.1.1
--- calculate_edithour.php      16 Sep 2002 16:05:44 -0000      1.2
***************
*** 36,76 ****
                $errorcount = 0;
  
-               if ($shour && ($shour != 0) && ($shour != 12))
-               {
-                       if ($sampm=='pm') { $shour = $shour + 12; }
-               }
- 
-               if ($shour && ($shour == 12))
-               {
-                       if ($sampm=='am') { $shour = 0; }
-               }
- 
-               if ($ehour && ($ehour != 0) && ($ehour != 12))
-               {
-                       if ($eampm=='pm') { $ehour = $ehour + 12; }
-               }
- 
-               if ($ehour && ($ehour == 12))
-               {
-                       if ($eampm=='am') { $ehour = 0; }
-               }
- 
-               if (checkdate($smonth,$sday,$syear)) { $sdate = 
mktime($shour,$smin,0,$smonth,$sday,$syear); }
-               else
-               {
-                       if ($shour && $smin && $smonth && $sday && $syear)
-                       {
-                               $error[$errorcount++] = lang('You have entered 
an invalid start date !') . '<br>' . $shour  . ':' . $smin . ' ' . $smonth . 
'/' . $sday . '/' . $syear;
-                       }
-               }
- 
-               if (checkdate($emonth,$eday,$eyear)) { $edate = 
mktime($ehour,$emin,0,$emonth,$eday,$eyear); }
-               else
-               {
-                       if ($ehour && $emin && $emonth && $eday && $eyear)
-                       {
-                               $error[$errorcount++] = lang('You have entered 
an invalid end date !') . '<br>' . $ehour . ':' . $emin . ' ' . $emonth . '/' . 
$eday . '/' . $eyear;
-                       }
-               }
  
  
--- 36,39 ----
***************
*** 149,166 ****
                        {
                                $grouping_descr= '';
!                               $grouping_id=1;
! 
                        }
        // ---------------------end grouping ------------------------------
  
  
                        $employee=$GLOBALS['phpgw_info']['user']['account_id'];
  
!                       $GLOBALS['phpgw']->db->query("update fm_wo_hours set 
grouping_id = '$grouping_id',grouping_descr = 
'$grouping_descr',wrkorder_id='$wrkorder_id',entry_date='" . time() . 
"',start_date='$sdate',end_date='$edate',"
!                                                       . 
"hours_descr='$hours_descr',remark='$remark', building_part='$building_part', 
ns3420_id='$ns3420_id',"
!                                                       . 
"minutes='$ae_minutes',status='$status',employee='$employee',billperae=$billperae_value,
 vendor_id='$vendor_id', 
activity_id='$activity',quantity=$quantity_value,unit='$unit',cost=$cost_value 
where id='$id'");
  
                        $GLOBALS['phpgw']->db->query("UPDATE  fm_wo_wrkorders 
set chapter_id='$chapter' WHERE id ='$wrkorder_id'");
  
                }
        }
--- 112,164 ----
                        {
                                $grouping_descr= '';
!                               $grouping_id='';
                        }
        // ---------------------end grouping ------------------------------
  
+                       if (!$grouping_id==$grouping_orig)
+                       {
+                               $GLOBALS['phpgw']->db->query("SELECT 
max(record) as record FROM fm_wo_hours WHERE wrkorder_id ='$wrkorder_id' and 
grouping_id= '$grouping_id'");
+                               $GLOBALS['phpgw']->db->next_record();
+                               $record= $GLOBALS['phpgw']->db->f('record')+1;
+                               echo 'record: '.$record .'<BR>';
+ 
+                       }
+                       else
+                       {
+                               $record=$record_orig;
+                       }
+ 
+                       if(!$grouping_id)
+                       {
+                               $grouping_id_value= 'NULL';
+                               $record_value= 'NULL';
+                               if($record_orig==1)
+                               {
+                                       $record_delete='True';
+                               }
+                       }
+                       else
+                       {
+                               $grouping_id_value="'$grouping_id'";
+                               $record_value="'$record'";
+                       }
  
                        $employee=$GLOBALS['phpgw_info']['user']['account_id'];
  
! 
!                       $GLOBALS['phpgw']->db->query("update fm_wo_hours set 
grouping_id = $grouping_id_value,grouping_descr = 
'$grouping_descr',wrkorder_id='$wrkorder_id',entry_date='" . time() . 
"',start_date='$sdate',end_date='$edate',"
!                                                       . 
"hours_descr='$hours_descr',remark='$remark', building_part='$building_part', 
ns3420_id='$ns3420_id',record = $record_value,"
!                                                       . 
"minutes='$ae_minutes',status='$status',employee='$employee',billperae=$billperae_value,
 vendor_id='$vendor_id', 
activity_id='$activity',quantity=$quantity_value,unit='$unit',tolerance='$tolerance',cost=$cost_value
 where id='$id'");
  
                        $GLOBALS['phpgw']->db->query("UPDATE  fm_wo_wrkorders 
set chapter_id='$chapter' WHERE id ='$wrkorder_id'");
  
+                       if($record_delete)
+                       {
+                               $GLOBALS['phpgw']->db->query("SELECT 
min(record) as record_min FROM fm_wo_hours WHERE wrkorder_id ='$wrkorder_id' 
and grouping_id= '$grouping_orig'");
+                               $GLOBALS['phpgw']->db->next_record();
+                               $record_min= 
$GLOBALS['phpgw']->db->f('record_min');
+ 
+                               $GLOBALS['phpgw']->db->query("UPDATE  
fm_wo_hours set record='1' WHERE grouping_id='$grouping_orig'and wrkorder_id 
='$wrkorder_id' and record= '$record_min'");
+                       }
                }
        }
***************
*** 230,235 ****
--- 228,235 ----
        $t->set_var('ns3420_id',$ns3420_id);
  
+       $tolerance = $GLOBALS['phpgw']->db->f('tolerance');
        $grouping_id = $GLOBALS['phpgw']->db->f('grouping_id');
        $grouping_descr = $GLOBALS['phpgw']->db->f('grouping_descr');
+       $record = $GLOBALS['phpgw']->db->f(record);
  
  
***************
*** 270,379 ****
        // ------------------- vendor ---------------------------
  
  
-               $t->set_var('lang_select',lang('Select per button !'));
-               $t->set_var('lang_vendor',lang('Customer'));
-               $t->set_var('lang_descr',lang('Description'));
-               $t->set_var('lang_bookable_activities',lang('Bookable 
activities'));
-               $t->set_var('lang_billable_activities',lang('Billable 
activities'));
- 
-               $d = CreateObject('phpgwapi.contacts');
-               $abid = $GLOBALS['phpgw']->db->f('vendor');
- 
-               if (!$abid)
-               {
-                       $t->set_var('name','');
-               }
-               else
-               {
-                       $cols = array('n_given' => 'n_given',
-                                               'n_family' => 'n_family',
-                                               'org_name' => 'org_name');
-                       $vendor = $d->read_single_entry($abid,$cols);
-                       if ($vendor[0]['org_name'] == '')
-                       {
-                               $t->set_var('name',$vendor[0]['n_given'] . ' ' 
. $vendor[0]['n_family']);
-                       }
-                       else
-                       {
-                               $t->set_var('name',$vendor[0]['org_name'] . ' [ 
' . $vendor[0]['n_given'] . ' ' . $vendor[0]['n_family'] . ' ]');
-                       }
-               }
- 
-       $t->set_var('abid',$abid);
-       // ------------------ end vendor-----------------
- 
-       if (!$sdate)
-       {
-               $smonth = date('m',time());
-               $sday = date('d',time());
-               $syear = date('Y',time());
-               $shour = date('H',time());
-               $smin = date('i',time());
-       }
-       else
-       {
-               $smonth = date('m',$sdate);
-               $sday = date('d',$sdate);
-               $syear = date('Y',$sdate);
-               $shour = date('H',$sdate);
-               $smin = date('i',$sdate);
-       }
- 
-       
$t->set_var('start_date_select',$GLOBALS['phpgw']->common->dateformatorder($sm->getYears('syear',$syear),$sm->getMonthText('smonth',$smonth),$sm->getDays('sday',$sday)));
- 
-       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
-       {
-               if ($shour >= 12)
-               {
-                       $amsel = ''; $pmsel = ' checked';
-                       if ($shour > 12) { $shour = $shour - 12; }
-               }
-               if ($shour == 0) { $shour = 12; }
-               $sradio = '<input type="radio" name="sampm" 
value="am"'.$amsel.'>am';
-               $sradio .= '<input type="radio" name="sampm" 
value="pm"'.$pmsel.'>pm';
-               $t->set_var('sradio',$sradio);
-       }
-       else { $t->set_var('sradio',''); }
- 
-       $t->set_var('shour',$shour);
-       $t->set_var('smin',$smin);
- 
-       $edate = $GLOBALS['phpgw']->db->f('end_date');
- 
-       if (!$edate)
-       {
-               $emonth = date('m',time());
-               $eday = date('d',time());
-               $eyear = date('Y',time());
-               $ehour = date('H',time());
-               $emin = date('i',time());
-       }
-       else
-       {
-               $emonth = date('m',$edate);
-               $eday = date('d',$edate);
-               $eyear = date('Y',$edate);
-               $ehour = date('H',$edate);
-               $emin = date('i',$edate);
-       }
- 
-       
$t->set_var('end_date_select',$GLOBALS['phpgw']->common->dateformatorder($sm->getYears('eyear',$eyear),$sm->getMonthText('emonth',$emonth),$sm->getDays('eday',$eday)));
- 
-       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
-       {
-               if ($ehour >= 12)
-               {
-                       $amsel = ''; $pmsel = ' checked';
-                       if ($ehour > 12) { $ehour = $ehour - 12; }
-               }
-               if ($ehour == 0) { $ehour = 12; }
-               $eradio = '<input type="radio" name="eampm" 
value="am"'.$amsel.'>am';
-               $eradio .= '<input type="radio" name="eampm" 
value="pm"'.$pmsel.'>pm';
-               $t->set_var('eradio',$eradio);
-       }
-       else { $t->set_var('eradio',''); }
- 
-       $t->set_var('ehour',$ehour);
-       $t->set_var('emin',$emin);
  
        
$t->set_var('remark',$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('remark')));
--- 270,275 ----
        // ------------------- vendor ---------------------------
  
+       $t->set_var('lang_descr',lang('Description'));
  
  
        
$t->set_var('remark',$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('remark')));
***************
*** 397,400 ****
--- 293,298 ----
                . '<input type="hidden" name="id" value="' . $id . '">' . "\n"
                . '<input type="hidden" name="wrkorder_id" value="' . 
$wrkorder_id . '">' . "\n"
+               . '<input type="hidden" name="record_orig" value="' . $record . 
'">' . "\n"
+               . '<input type="hidden" name="grouping_orig" value="' . 
$grouping_id . '">' . "\n"
                . '<input type="hidden" name="delivery_id" value="' . 
$delivery_id . '">' . "\n"
                . '<input type="hidden" name="invoice_id" value="' . 
$invoice_id . '">' . "\n";
***************
*** 517,522 ****
        $t->set_var('unit_list',$unit_list);
  
  //---------------End Unit -----------------------------
!       
$t->set_var('chapter_list',$fm_wrkorder->select_chapter_list($wrkorder_id));
        $t->set_var('lang_chapter_list',lang('Chapter'));
  
--- 415,441 ----
        $t->set_var('unit_list',$unit_list);
  
+ //---------------tolerance -----------------------------
+       $t->set_var('lang_tolerance',lang('Tolerance'));
+       if ($tolerance=='1'):
+               $tolerance_sel[1]=' selected';
+ 
+       elseif ($tolerance=='2'):
+               $tolerance_sel[2]=' selected';
+ 
+       elseif ($tolerance=='3'):
+               $tolerance_sel[3]=' selected';
+       endif;
+ 
+       $tolerance_list = '<option value="">' . lang('Select') . '</option>' . 
"\n"
+                       . '<option value="1"' . $tolerance_sel[1] . 
'>1</option>' . "\n"
+                       . '<option value="2"' . $tolerance_sel[2] . 
'>2</option>' . "\n"
+                       . '<option value="3"' . $tolerance_sel[3] . 
'>3</option>' . "\n";
+ 
+       $t->set_var('tolerance_list',$tolerance_list);
+ 
+ 
+ 
  //---------------End Unit -----------------------------
!       
$t->set_var('chapter_list',$fm_wrkorder->select_chapter_list('fm_wo_wrkorders',$wrkorder_id));
        $t->set_var('lang_chapter_list',lang('Chapter'));
  
***************
*** 524,528 ****
  // -------------- grouping list ----------------------
  
!       
$t->set_var('grouping_list',$fm_wrkorder->select_grouping_list($wrkorder_id,$grouping_id));
  
  //----------------------------------------------------------
--- 443,447 ----
  // -------------- grouping list ----------------------
  
!       
$t->set_var('grouping_list',$fm_wrkorder->select_grouping_list('fm_wo_hours',$wrkorder_id,$grouping_id,$id));
  
  //----------------------------------------------------------

Index: calculate_listhours.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/calculate_listhours.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** calculate_listhours.php     28 Aug 2002 16:43:07 -0000      1.1.1.1
--- calculate_listhours.php     16 Sep 2002 16:05:44 -0000      1.2
***************
*** 246,251 ****
--- 246,253 ----
  
                $activity_id  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['activity_id']);
+               $tolerance  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['tolerance']);
  
                $ns3420_id  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['ns3420_id']);
+               $ns3420_id= str_replace("-","$tolerance",$ns3420_id);
  
  
***************
*** 283,287 ****
                $hours_descr = 
$GLOBALS['phpgw']->strip_html($hours[$i]['hours_descr']);
  
!               $hours_descr= str_replace("\n","<br>",$hours_descr);
  
  
--- 285,289 ----
                $hours_descr = 
$GLOBALS['phpgw']->strip_html($hours[$i]['hours_descr']);
  
!               $hours_descr= str_replace("\n","<br>",$hours_descr).$tolerance;
  
  
***************
*** 289,293 ****
                if ($remark)
                {
!                       $hours_descr =$hours_descr.'<br>' .lang(Remark).': ' . 
$remark;
                }
                $t->set_var('tr_color',$tr_color);
--- 291,295 ----
                if ($remark)
                {
!                       $hours_descr .='<br>' .lang(Remark).': ' . $remark;
                }
                $t->set_var('tr_color',$tr_color);

Index: edit_wo_template_hours.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/edit_wo_template_hours.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** edit_wo_template_hours.php  28 Aug 2002 16:43:09 -0000      1.1.1.1
--- edit_wo_template_hours.php  16 Sep 2002 16:05:44 -0000      1.2
***************
*** 35,43 ****
                }
  
                if (! $error)
                {
                $remark = addslashes($remark);
  
!               $GLOBALS['phpgw']->db->query("UPDATE fm_wo_template set 
ns3420_id='$ns3420_id',building_part_id='$building_part',unit='$unit',remark='$remark'
 where id='$template_hour_id' ");
  
                }
--- 35,172 ----
                }
  
+               $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_ns3420 WHERE 
id ='$ns3420_id' ");
+               $GLOBALS['phpgw']->db->next_record();
+ 
+               $tekst1 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst1'));
+               $tekst2 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst2'));
+               $tekst3 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst3'));
+               $tekst4 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst4'));
+               $tekst5 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst5'));
+               $tekst6 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst6'));
+ 
+               $hours_descr = $tekst1;
+ 
+               if ($tekst2)
+               {
+                       $hours_descr .=" ". $tekst2;
+               }
+ 
+               if ($tekst3)
+               {
+                       $hours_descr .=" ". $tekst3;
+               }
+ 
+               if ($tekst4)
+               {
+                       $hours_descr .="<br>". $tekst4;
+               }
+ 
+               if ($tekst5)
+               {
+                       $hours_descr .="<br>". $tekst5;
+               }
+ 
+               if ($tekst6)
+               {
+                       $hours_descr .="<br>". $tekst6;
+               }
+ 
+               if ($quantity)
+               {
+                       $quantity=str_replace(",",".",$quantity);
+                       $quantity_value="'$quantity'";
+               }
+               else
+               {
+                       $quantity_value='NULL';
+               }
+ 
+               if ($billperae)
+               {
+                       $billperae=str_replace(",",".",$billperae);
+                       $billperae_value="'$billperae'";
+                       if (! $cost)
+                       {
+                               $cost=$quantity*$billperae;
+                               $cost_value = "'$cost'";
+                       }
+               }
+               else
+               {
+                       $billperae_value='NULL';
+                       $cost_value='NULL';
+               }
+ 
+               if ($cost)
+               {
+                       $cost_value = "'$cost'";
+               }
+ 
+       // ---------------------grouping ------------------------------
+ 
+       $t->set_var('group_exist',$group_exist);
+ //    $t->set_var('new_group_descr',$new_group_descr);
+ 
+               if ($group_exist)
+               {
+                       $grouping=group_exist;
+                       $GLOBALS['phpgw']->db->query("SELECT grouping_descr 
FROM fm_wo_template WHERE wo_template_type_id ='$id' and grouping_id = 
'$group_exist'");
+                       $GLOBALS['phpgw']->db->next_record();
+                       $grouping_descr= 
$GLOBALS['phpgw']->db->f('grouping_descr');
+                       $grouping_id=$group_exist;
+                       $grouping_id_value="'$grouping_id'";
+               }
+ 
+               if ($new_group_descr && !($new_group_descr==''))
+               {
+                       $grouping_descr=$new_group_descr;
+                       $GLOBALS['phpgw']->db->query("SELECT grouping_descr, 
grouping_id FROM fm_wo_template WHERE wo_template_type_id ='$id' and 
grouping_descr ='$grouping_descr'");
+                       $GLOBALS['phpgw']->db->next_record();
+                       $grouping_id= $GLOBALS['phpgw']->db->f('grouping_id');
+                       $grouping_id_value="'$grouping_id'";
+ 
+                       if (!$grouping_id)
+                       {
+ 
+                               $GLOBALS['phpgw']->db->query("SELECT 
max(grouping_id) as grouping_id FROM fm_wo_template WHERE wo_template_type_id 
='$id'");
+                               $GLOBALS['phpgw']->db->next_record();
+                               $grouping_id= 
$GLOBALS['phpgw']->db->f('grouping_id')+1;
+                               $grouping_id_value="'$grouping_id'";
+                       }
+               }
+ 
+               if (!$group_exist && !$new_group_descr)
+               {
+                       $grouping_descr= '';
+                       $grouping_id_value='NULL';
+ 
+               }
+               if(!$grouping_id_value)
+               {
+                       $grouping_id_value= 'NULL';
+               }
+       // ---------------------end grouping ------------------------------
+ 
+               if (!$grouping_orig==!$grouping_orig)
+               {
+                       $GLOBALS['phpgw']->db->query("SELECT max(record) as 
record FROM fm_wo_template WHERE wo_template_type_id ='$id' and grouping_id= 
'$grouping_id'");
+                       $GLOBALS['phpgw']->db->next_record();
+                       $record= $GLOBALS['phpgw']->db->f('record')+1;
+               }
+               else
+               {
+                       $record=$record_orig;
+               }
+ 
                if (! $error)
                {
                $remark = addslashes($remark);
  
! 
!               $GLOBALS['phpgw']->db->query("UPDATE fm_wo_template set 
ns3420_id='$ns3420_id',hours_descr='$hours_descr',building_part_id='$building_part',unit='$unit',remark='$remark',"
!               . " 
quantity=$quantity_value,cost=$cost_value,billperae=$billperae_value,record = 
'$record',grouping_id = $grouping_id_value,grouping_descr = 
'$grouping_descr',tolerance='$tolerance'"
!               . " where id='$template_hour_id' ");
! 
!               $GLOBALS['phpgw']->db->query("UPDATE fm_wo_template_type set 
chapter_id='$chapter' WHERE id ='$id'");
  
                }
***************
*** 54,57 ****
--- 183,196 ----
  
  
+       $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_template_type WHERE 
id ='$id' ");
+       $GLOBALS['phpgw']->db->next_record();
+       $template_name = $GLOBALS['phpgw']->db->f('descr');
+       $template_id = $GLOBALS['phpgw']->db->f('id');
+       $template_selected=($template_id . ' [ '  . $template_name .  ' ]');
+       $t->set_var('template_selected',$template_selected);
+ 
+       $t->set_var('lang_template',lang('Template'));
+ 
+ 
        $GLOBALS['phpgw']->db->query("select * from fm_wo_template where 
id='$template_hour_id' ");
        $GLOBALS['phpgw']->db->next_record();
***************
*** 62,72 ****
  
        $building_part = $GLOBALS['phpgw']->db->f(building_part_id);
!       $t->set_var('building_part',$building_part);
  
!       $t->set_var('unit',$GLOBALS['phpgw']->db->f(unit));
  
        $remark = $GLOBALS['phpgw']->db->f(remark);
        $t->set_var('remark',$remark);
  
        $GLOBALS['phpgw']->db->query("select tekst1 from fm_wo_ns3420 where 
id='$ns3420_id' ");
        $GLOBALS['phpgw']->db->next_record();
--- 201,226 ----
  
        $building_part = $GLOBALS['phpgw']->db->f(building_part_id);
! //    $t->set_var('building_part',$building_part);
  
!       $unit=$GLOBALS['phpgw']->db->f(unit);
! //    $t->set_var('unit',$GLOBALS['phpgw']->db->f(unit));
  
+       $record = $GLOBALS['phpgw']->db->f(record);
        $remark = $GLOBALS['phpgw']->db->f(remark);
        $t->set_var('remark',$remark);
  
+       $grouping_id=$GLOBALS['phpgw']->db->f(grouping_id);
+ 
+       $billperae=$GLOBALS['phpgw']->db->f(billperae);
+       $t->set_var('billperae',$billperae);
+ 
+       $quantity=$GLOBALS['phpgw']->db->f(quantity);
+       $t->set_var('quantity',$quantity);
+ 
+       $dim_d=$GLOBALS['phpgw']->db->f(dim_d);
+ 
+       $tolerance=$GLOBALS['phpgw']->db->f(tolerance);
+ 
+ 
        $GLOBALS['phpgw']->db->query("select tekst1 from fm_wo_ns3420 where 
id='$ns3420_id' ");
        $GLOBALS['phpgw']->db->next_record();
***************
*** 75,82 ****
        $t->set_var('ns3420_descr',$ns3420_descr);
  
  
!       $t->set_var('lang_action',lang('Add template hour'));
        $t->set_var('lang_descr',lang('Short description'));
        $t->set_var('lang_remark',lang('Remark'));
  
  
--- 229,246 ----
        $t->set_var('ns3420_descr',$ns3420_descr);
  
+       $currency = 
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'];
  
!       $t->set_var('lang_action',lang('Edit template hour'));
        $t->set_var('lang_descr',lang('Short description'));
        $t->set_var('lang_remark',lang('Remark'));
+       $t->set_var('lang_quantity',lang('Quantity'));
+       $t->set_var('lang_billperae',lang('Bill per unit'));
+       $t->set_var('currency',$currency);
+       $t->set_var('lang_override_calculation',lang('Overrides the 
calculation'));
+       $t->set_var('lang_grouping',lang('Grouping'));
+       $t->set_var('lang_if_group_exists',lang('If Grouping exists'));
+       $t->set_var('lang_new_grouping',lang('New Grouping'));
+       $t->set_var('lang_if_tender',lang('If tender'));
+ 
  
  
***************
*** 86,93 ****
        $t->set_var('lang_select_wrkorder',lang('Select fm_wrkorder'));
  
! 
! 
! 
! 
  
        $hidden_vars = '<input type="hidden" name="sort" value="' . $sort . 
'">' . "\n"
--- 250,256 ----
        $t->set_var('lang_select_wrkorder',lang('Select fm_wrkorder'));
  
!       $t->set_var('ns3420_descr',$ns3420_descr);
!       $t->set_var('cost',$cost);
!       $t->set_var('lang_cost',lang('Cost'));
  
        $hidden_vars = '<input type="hidden" name="sort" value="' . $sort . 
'">' . "\n"
***************
*** 99,102 ****
--- 262,267 ----
                                . '<input type="hidden" name="id" value="' . 
$id . '">' . "\n"
                                . '<input type="hidden" name="st_descr_orig" 
value="' . $ns3420_id . '">' . "\n"
+                               . '<input type="hidden" name="record_orig" 
value="' . $record . '">' . "\n"
+                               . '<input type="hidden" name="grouping_orig" 
value="' . $grouping_id . '">' . "\n"
                                . '<input type="hidden" 
name="building_part_orig" value="' . $building_part      . '">' . "\n";
  
***************
*** 142,145 ****
--- 307,341 ----
  //---------------End Unit -----------------------------
  
+ //---------------tolerance -----------------------------
+       $t->set_var('lang_tolerance',lang('Tolerance'));
+       if ($tolerance=='1'):
+               $tolerance_sel[1]=' selected';
+ 
+       elseif ($tolerance=='2'):
+               $tolerance_sel[2]=' selected';
+ 
+       elseif ($tolerance=='3'):
+               $tolerance_sel[3]=' selected';
+       endif;
+ 
+       $tolerance_list = '<option value="">' . lang('Select') . '</option>' . 
"\n"
+                       . '<option value="1"' . $tolerance_sel[1] . 
'>1</option>' . "\n"
+                       . '<option value="2"' . $tolerance_sel[2] . 
'>2</option>' . "\n"
+                       . '<option value="3"' . $tolerance_sel[3] . 
'>3</option>' . "\n";
+ 
+       $t->set_var('tolerance_list',$tolerance_list);
+ 
+ 
+ // -------------- chapter list ----------------------
+       $t->set_var('lang_chapter_list',lang('Chapter'));
+ 
+       
$t->set_var('chapter_list',$fm_wrkorder->select_chapter_list(fm_wo_template_type,$id));
+ 
+ //----------------------------------------------------------
+ // -------------- grouping list ----------------------
+ 
+       
$t->set_var('grouping_list',$fm_wrkorder->select_grouping_list('fm_wo_template',$id,$grouping_id,''));
+ 
+ //----------------------------------------------------------
  
        $t->set_var('lang_building_part_list',lang('Building part'));
***************
*** 148,151 ****
--- 344,362 ----
  
  //----------------------------------------------------------
+ 
+       $t->set_var('lang_building_part_list',lang('Building part'));
+ 
+       
$t->set_var('building_part_list',$fm_wrkorder->select_building_part_list_2($building_part));
+ 
+ //----------------------------------------------------------
+ 
+ 
+ // -------------- dim_d list ----------------------
+       $t->set_var('lang_dim_d_list',lang('Dim D'));
+       $t->set_var('lang_select',lang('Select'));
+ 
+       $t->set_var('dim_d_list',$fm_wrkorder->select_dim_d_list($dim_d));
+ 
+ //----------------end dim_d-------------------------------
  
  // -------------- Standard work description list ----------------------

Index: editactivity.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/editactivity.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** editactivity.php    28 Aug 2002 16:43:08 -0000      1.1.1.1
--- editactivity.php    16 Sep 2002 16:05:44 -0000      1.2
***************
*** 139,144 ****
--- 139,147 ----
        elseif ($GLOBALS['phpgw']->db->f('unit')=='RS'):
                $unit_sel[7]=' selected';
+       elseif ($GLOBALS['phpgw']->db->f('unit')=='KM'):
+               $unit_sel[8]=' selected';
        endif;
  
+ 
        $unit_list = '<option value="H"' . $unit_sel[0] . '>' . lang('Hours') . 
'</option>' . "\n"
                        . '<option value="M3"' . $unit_sel[1] . '>' . 
lang('M3') . '</option>' . "\n"
***************
*** 148,152 ****
                        . '<option value="KG"' . $unit_sel[5] . '>' . 
lang('KG') . '</option>' . "\n"
                        . '<option value="TON"' . $unit_sel[6] . '>' . 
lang('TON') . '</option>' . "\n"
!                       . '<option value="RS"' . $unit_sel[7] . '>' . 
lang('RS') . '</option>' . "\n";
  
        $t->set_var('unit_list',$unit_list);
--- 151,156 ----
                        . '<option value="KG"' . $unit_sel[5] . '>' . 
lang('KG') . '</option>' . "\n"
                        . '<option value="TON"' . $unit_sel[6] . '>' . 
lang('TON') . '</option>' . "\n"
!                       . '<option value="RS"' . $unit_sel[7] . '>' . 
lang('RS') . '</option>' . "\n"
!                       . '<option value="KM"' . $unit_sel[8] . '>' . 
lang('KM') . '</option>' . "\n";
  
        $t->set_var('unit_list',$unit_list);

Index: event_equipment.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/event_equipment.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** event_equipment.php 28 Aug 2002 16:43:09 -0000      1.1.1.1
--- event_equipment.php 16 Sep 2002 16:05:44 -0000      1.2
***************
*** 28,31 ****
--- 28,50 ----
  
  
+       //----------------------- equipment_type
+       $GLOBALS['phpgw']->db->query("SELECT id,name, type_descr FROM 
fm_equipment_type order by name asc");
+               while ($GLOBALS['phpgw']->db->next_record())
+               {
+                       $equipment_type_list .= '<option value="' . 
$GLOBALS['phpgw']->db->f('id') . '"';
+                               if ($GLOBALS['phpgw']->db->f('id') == 
$equipment_type_id)
+                               $equipment_type_list .= ' selected';
+                               $equipment_type_list  .= '>'
+                               . $GLOBALS['phpgw']->db->f('id')
+                               . ' ['. 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('name')). '] ' . 
'</option>';
+ 
+               }
+ 
+               $t->set_var('equipment_type_list',$equipment_type_list);
+       //----------------------- end equipment_type
+ 
+ 
+ 
+ 
        if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['currency']))
        {
***************
*** 54,66 ****
        $t->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
        $t->set_var('lang_search',lang('Search'));
!       
$t->set_var('search_action',$GLOBALS['phpgw']->link('/property/event_equipment.php'));
        $t->set_var('lang_category',lang('Category'));
        $t->set_var('lang_all',lang('All'));
! 
  
        
$t->set_var('equipmenturl',$GLOBALS['phpgw']->link('/property/event_equipment.php'));
        $t->set_var('hidden_vars',$hidden_vars);
        $t->set_var('lang_search',lang('Search'));
-       
$t->set_var('searchurl',$GLOBALS['phpgw']->link('/property/event_equipment.php'));
  
        if (! $start)
--- 73,84 ----
        $t->set_var('font',$GLOBALS['phpgw_info']['theme']['font']);
        $t->set_var('lang_search',lang('Search'));
!       
$t->set_var('search_action',$GLOBALS['phpgw']->link('/property/event_equipment.php',"equipment_type_id=$equipment_type_id"));
        $t->set_var('lang_category',lang('Category'));
        $t->set_var('lang_all',lang('All'));
!       $t->set_var('lang_equipment_type',lang('Equipment type'));
  
        
$t->set_var('equipmenturl',$GLOBALS['phpgw']->link('/property/event_equipment.php'));
        $t->set_var('hidden_vars',$hidden_vars);
        $t->set_var('lang_search',lang('Search'));
  
        if (! $start)
***************
*** 69,72 ****
--- 87,99 ----
        }
  
+       if ($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
+       {
+               $join = " JOIN ";
+       }
+       else
+       {
+               $join = " LEFT JOIN ";
+       }
+ 
        if ($order)
        {
***************
*** 89,106 ****
        else { $limit = 15; }
  
-       if ($query)
-       {
-               $querymethod = " where (descr like '%$query%' or equipment_id 
like '%$query%' or type_descr like '%$query%' or objekt_id like '%$query%')";
-       }
  
!       if ($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
        {
!               $join = " JOIN ";
        }
        else
        {
!               $join = " LEFT JOIN ";
        }
  
        if (!$location_code)
        { $location =  '';}
--- 116,132 ----
        else { $limit = 15; }
  
  
! 
!       if ($equipment_type_id)
        {
!               $equipment_type_filter ="where equipment_type_id 
='$equipment_type_id' ";
!               $where_1='and';
        }
        else
        {
!               $where_1='where';
        }
  
+ 
        if (!$location_code)
        { $location =  '';}
***************
*** 108,116 ****
        { $location= ("where location_code like " . "'%$location_code%'");}
  
  
  
        $db2 = $GLOBALS['phpgw']->db;
  
!       $sql = "select * from fm_equipment $join fm_equipment_type on 
fm_equipment.equipment_type_id = fm_equipment_type.equipment_type_id $location 
$querymethod";
        $db2->query($sql,__LINE__,__FILE__);
        $total_records = $db2->num_rows();
--- 134,147 ----
        { $location= ("where location_code like " . "'%$location_code%'");}
  
+       if ($query)
+       {
+               $querymethod = " $where_1 (descr like '%$query%' or 
equipment_id like '%$query%' or type_descr like '%$query%' or objekt_id like 
'%$query%')";
+       }
+ 
  
  
        $db2 = $GLOBALS['phpgw']->db;
  
!       $sql = "select * from fm_equipment $join fm_equipment_type on 
fm_equipment.equipment_type_id = fm_equipment_type.id $equipment_type_filter 
$location $querymethod";
        $db2->query($sql,__LINE__,__FILE__);
        $total_records = $db2->num_rows();

Index: hours_addhour.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/hours_addhour.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** hours_addhour.php   28 Aug 2002 16:43:10 -0000      1.1.1.1
--- hours_addhour.php   16 Sep 2002 16:05:44 -0000      1.2
***************
*** 28,32 ****
        
$t->set_var('search_ns3420_link',$GLOBALS['phpgw']->link('/property/search_ns3420.php','query='));
  
!       $t->set_var('lang_select',lang('Select per button !'));
        $t->set_var('lang_vendor',lang('Vendor'));
        $t->set_var('abid',$abid);
--- 28,32 ----
        
$t->set_var('search_ns3420_link',$GLOBALS['phpgw']->link('/property/search_ns3420.php','query='));
  
!       $t->set_var('lang_select',lang('Select'));
        $t->set_var('lang_vendor',lang('Vendor'));
        $t->set_var('abid',$abid);
***************
*** 37,89 ****
                $errorcount = 0;
  
-               if ($shour && ($shour != 0) && ($shour != 12))
-               {
-                       if ($sampm=='pm') { $shour = $shour + 12; }
-               }
- 
-               if ($shour && ($shour == 12))
-               {
-                       if ($sampm=='am') { $shour = 0; }
-               }
- 
-               if ($ehour && ($ehour != 0) && ($ehour != 12))
-               {
-                       if ($eampm=='pm') { $ehour = $ehour + 12; }
-               }
- 
-               if ($ehour && ($ehour == 12))
-               {
-                       if ($eampm=='am') { $ehour = 0; }
-               }
- 
- /*            $GLOBALS['phpgw']->db->query("SELECT chapter_id from 
fm_wo_hours WHERE wrkorder_id ='$wrkorder_id' order by chapter_id");
-               while ($GLOBALS['phpgw']->db->next_record())
-               {
-                       $chapter_1=$GLOBALS['phpgw']->db->f('chapter_id');
-                       if ($chapter_1!=$chapter)
-                               {
-                                       $error[$errorcount++] = lang('Only one 
chapter is allowed at same order !');
-                                       break;
-                               }
-               }
- */
-               if (checkdate($smonth,$sday,$syear)) { $sdate = 
mktime($shour,$smin,0,$smonth,$sday,$syear); }
-               else
-               {
-                       if ($shour && $smin && $smonth && $sday && $syear)
-                       {
-                               $error[$errorcount++] = lang('You have entered 
an invalid start date !') . '<br>' . $shour . ':' . $smin  . ' ' . $smonth . 
'/' . $sday . '/' . $syear;
-                       }
-               }
- 
-               if (checkdate($emonth,$eday,$eyear)) { $edate = 
mktime($ehour,$emin,0,$emonth,$eday,$eyear); }
-               else
-               {
-                       if ($ehour && $emin && $emonth && $eday && $eyear)
-                       {
-                               $error[$errorcount++] = lang('You have entered 
an invalid end date !') . '<br>' . $ehour . ':' . $emin . ' ' . $emonth . '/' . 
$eday . '/' . $eyear;
-                       }
-               }
- 
                $GLOBALS['phpgw']->db->query("SELECT * FROM fm_wo_ns3420 WHERE 
id ='$ns3420_id' ");
                $GLOBALS['phpgw']->db->next_record();
--- 37,40 ----
***************
*** 167,170 ****
--- 118,122 ----
                        $grouping_descr= 
$GLOBALS['phpgw']->db->f('grouping_descr');
                        $grouping_id=$group_exist;
+                       $grouping_id_value="'$grouping_id'";
                }
  
***************
*** 175,178 ****
--- 127,131 ----
                        $GLOBALS['phpgw']->db->next_record();
                        $grouping_id= $GLOBALS['phpgw']->db->f('grouping_id');
+                       $grouping_id_value="'$grouping_id'";
  
                        if (!$grouping_id)
***************
*** 182,185 ****
--- 135,139 ----
                                $GLOBALS['phpgw']->db->next_record();
                                $grouping_id= 
$GLOBALS['phpgw']->db->f('grouping_id')+1;
+                               $grouping_id_value="'$grouping_id'";
                        }
                }
***************
*** 188,194 ****
                {
                        $grouping_descr= '';
!                       $grouping_id=1;
  
                }
        // ---------------------end grouping ------------------------------
  
--- 142,152 ----
                {
                        $grouping_descr= '';
!                       $grouping_id_value='NULL';
  
                }
+               if(!$grouping_id_value)
+               {
+                       $grouping_id_value= 'NULL';
+               }
        // ---------------------end grouping ------------------------------
  
***************
*** 209,214 ****
  
                $GLOBALS['phpgw']->db->query("INSERT into fm_wo_hours 
(id,record,wrkorder_id,activity_id,grouping_id,grouping_descr,entry_date,start_date,end_date,hours_descr,remark,minutes,status,minperae,"
!                                                       . "billperae,employee, 
quantity, unit, cost,ns3420_id,building_part) VALUES 
('$id','$record','$wrkorder_id','$activity','$grouping_id','$grouping_descr','" 
. time() . "','$sdate','$edate','$hours_descr','$remark','$ae_minutes',"
!                                                       . 
"'$status','$minperae',$billperae_value,'$employee',$quantity_value,'$unit',$cost_value,'$ns3420_id','$building_part')");
  
                $GLOBALS['phpgw']->db->query("UPDATE  fm_wo_wrkorders set 
chapter_id='$chapter' WHERE id ='$wrkorder_id'");
--- 167,172 ----
  
                $GLOBALS['phpgw']->db->query("INSERT into fm_wo_hours 
(id,record,wrkorder_id,activity_id,grouping_id,grouping_descr,entry_date,start_date,end_date,hours_descr,remark,minutes,status,minperae,"
!                                                       . "billperae,employee, 
quantity, unit, cost,ns3420_id,building_part,tolerance) VALUES 
('$id','$record','$wrkorder_id','$activity',$grouping_id_value,'$grouping_descr','"
 . time() . "','$sdate','$edate','$hours_descr','$remark','$ae_minutes',"
!                                                       . 
"'$status','$minperae',$billperae_value,'$employee',$quantity_value,'$unit',$cost_value,'$ns3420_id','$building_part','$tolerance')");
  
                $GLOBALS['phpgw']->db->query("UPDATE  fm_wo_wrkorders set 
chapter_id='$chapter' WHERE id ='$wrkorder_id'");
***************
*** 319,396 ****
        }
  
-       $sm = CreateObject('phpgwapi.sbox');
-       $amsel = ' checked'; $pmsel = '';
- 
- 
-       if (!$sdate)
-       {
-               $smonth = date('m',time());
-               $sday = date('d',time());
-               $syear = date('Y',time());
-               $shour = date('H',time());
-               $smin = date('i',time());
-       }
-       else
-       {
-               $smonth = date('m',$sdate);
-               $sday = date('d',$sdate);
-               $syear = date('Y',$sdate);
-               $shour = date('H',$sdate);
-               $smin = date('i',$sdate);
-       }
- 
-       
$t->set_var('start_date_select',$GLOBALS['phpgw']->common->dateformatorder($sm->getYears('syear',$syear),$sm->getMonthText('smonth',$smonth),$sm->getDays('sday',$sday)));
- 
-       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
-       {
-               if ($shour >= 12)
-               {
-                       $amsel = ''; $pmsel = ' checked';
-                       if ($shour > 12) { $shour = $shour - 12; }
-               }
-               if ($shour == 0) { $shour = 12; }
-               $sradio = '<input type="radio" name="sampm" 
value="am"'.$amsel.'>am';
-               $sradio .= '<input type="radio" name="sampm" 
value="pm"'.$pmsel.'>pm';
-               $t->set_var('sradio',$sradio);
-       }
-       else { $t->set_var('sradio',''); }
- 
-       $t->set_var('shour',$shour);
-       $t->set_var('smin',$smin);
- 
-       if (!$edate)
-       {
-               $emonth = 0;
-               $eday = 0;
-               $eyear = 0;
-       }
-       else
-       {
-               $emonth = date('m',$edate);
-               $emonth = date('m',$edate);
-               $eyear = date('Y',$edate);
-               $ehour = date('H',$edate);
-               $emin = date('i',$edate);
-       }
- 
-       
$t->set_var('end_date_select',$GLOBALS['phpgw']->common->dateformatorder($sm->getYears('eyear',$eyear),$sm->getMonthText('emonth',$emonth),$sm->getDays('eday',$eday)));
- 
-       if 
($GLOBALS['phpgw_info']['user']['preferences']['common']['timeformat'] == '12')
-       {
-               if ($ehour >= 12)
-               {
-                       $amsel = ''; $pmsel = ' checked';
-                       if ($ehour > 12) { $ehour = $ehour - 12; }
-               }
-               if ($ehour == 0) { $ehour = 12; }
-               $eradio = '<input type="radio" name="eampm" 
value="am"'.$amsel.'>am';
-               $eradio .= '<input type="radio" name="eampm" 
value="pm"'.$pmsel.'>pm';
-               $t->set_var('eradio',$eradio);
-       }
-       else { $t->set_var('eradio',''); }
- 
-       $t->set_var('ehour',$ehour);
-       $t->set_var('emin',$emin);
- 
        $t->set_var('remark',$remark);
        $t->set_var('hours_descr',$hours_descr);
--- 277,280 ----
***************
*** 402,406 ****
  
  
!               $t->set_var('hours',$hours);
        $t->set_var('minutes',$minutes);
  
--- 286,291 ----
  
  
!       $t->set_var('hours',$hours);
! 
        $t->set_var('minutes',$minutes);
  
***************
*** 467,480 ****
  //---------------End Unit -----------------------------
  
  
  // -------------- chapter list ----------------------
        $t->set_var('lang_chapter_list',lang('Chapter'));
  
!       
$t->set_var('chapter_list',$fm_wrkorder->select_chapter_list($wrkorder_id));
  
  //----------------------------------------------------------
  // -------------- grouping list ----------------------
  
!       
$t->set_var('grouping_list',$fm_wrkorder->select_grouping_list($wrkorder_id));
  
  //----------------------------------------------------------
--- 352,384 ----
  //---------------End Unit -----------------------------
  
+ //---------------tolerance -----------------------------
+       $t->set_var('lang_tolerance',lang('Tolerance'));
+       if ($tolerance=='1'):
+               $tolerance_sel[1]=' selected';
+ 
+       elseif ($tolerance=='2'):
+               $tolerance_sel[2]=' selected';
+ 
+       elseif ($tolerance=='3'):
+               $tolerance_sel[3]=' selected';
+       endif;
+ 
+       $tolerance_list = '<option value="">' . lang('Select') . '</option>' . 
"\n"
+                       . '<option value="1"' . $tolerance_sel[1] . 
'>1</option>' . "\n"
+                       . '<option value="2"' . $tolerance_sel[2] . 
'>2</option>' . "\n"
+                       . '<option value="3"' . $tolerance_sel[3] . 
'>3</option>' . "\n";
+ 
+       $t->set_var('tolerance_list',$tolerance_list);
+ 
  
  // -------------- chapter list ----------------------
        $t->set_var('lang_chapter_list',lang('Chapter'));
  
!       
$t->set_var('chapter_list',$fm_wrkorder->select_chapter_list('fm_wo_wrkorders',$wrkorder_id));
  
  //----------------------------------------------------------
  // -------------- grouping list ----------------------
  
!       
$t->set_var('grouping_list',$fm_wrkorder->select_grouping_list('fm_wo_hours',$wrkorder_id,$grouping_id,''));
  
  //----------------------------------------------------------

Index: list_wo_template.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/list_wo_template.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** list_wo_template.php        28 Aug 2002 16:43:13 -0000      1.1.1.1
--- list_wo_template.php        16 Sep 2002 16:05:44 -0000      1.2
***************
*** 8,13 ****
        /* $Id$ */
  
!       $GLOBALS['phpgw_info']['flags'] = array('noheader' => True,
!                                       'nonavbar' => True,
                                        'currentapp' => 'property',
                                        'enable_nextmatchs_class' => True);
--- 8,13 ----
        /* $Id$ */
  
!       $GLOBALS['phpgw_info']['flags'] = array('noheader' => False,
!                                       'nonavbar' => False,
                                        'currentapp' => 'property',
                                        'enable_nextmatchs_class' => True);

Index: list_wo_template_hours.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/list_wo_template_hours.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** list_wo_template_hours.php  28 Aug 2002 16:43:13 -0000      1.1.1.1
--- list_wo_template_hours.php  16 Sep 2002 16:05:44 -0000      1.2
***************
*** 8,13 ****
        /* $Id$ */
  
!       $GLOBALS['phpgw_info']['flags'] = array('noheader' => True,
!                                       'nonavbar' => True,
                                        'currentapp' => 'property',
                                        'enable_nextmatchs_class' => True);
--- 8,13 ----
        /* $Id$ */
  
!       $GLOBALS['phpgw_info']['flags'] = array('noheader' => False,
!                                       'nonavbar' => False,
                                        'currentapp' => 'property',
                                        'enable_nextmatchs_class' => True);
***************
*** 20,23 ****
--- 20,26 ----
        
$t->set_block('wo_template_hours_list_t','wo_template_hours_list','list');
  
+       $config = CreateObject('phpgwapi.config');
+       $config->read_repository();
+ 
        if 
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['currency']))
        {
***************
*** 40,44 ****
        $t->set_var('lang_action',lang('Template'));
        $t->set_var('lang_done',lang('Done'));
!       $t->set_var('done_url',$GLOBALS['phpgw']->link('/admin/index.php'));
        $t->set_var('hidden_vars',$hidden_vars);
        $t->set_var('lang_search',lang('Search'));
--- 43,47 ----
        $t->set_var('lang_action',lang('Template'));
        $t->set_var('lang_done',lang('Done'));
!       
$t->set_var('done_url',$GLOBALS['phpgw']->link('/property/list_wo_template.php'));
        $t->set_var('hidden_vars',$hidden_vars);
        $t->set_var('lang_search',lang('Search'));
***************
*** 53,56 ****
--- 56,61 ----
        $t->set_var('template',$template);
  
+       $tax= $config->config_data['fmwrkorder_tax'];
+ //    echo 'tax: '.$tax .'<BR>';
  
        if (! $start)
***************
*** 65,69 ****
        else
        {
!               $ordermethod = " order by fm_wo_ns3420.id asc";
        }
  
--- 70,78 ----
        else
        {
!       //      $ordermethod = " order by fm_wo_ns3420.id asc";
!       //      $ordermethod = "order by grouping_id, record, 
fm_wo_template.id, 
unit,ns3420_id,building_part_id,remark,grouping_descr,billperae,quantity,cost,"
!       //      . " dim_d,hours_descr,fm_wo_ns3420.id";
! 
!       $ordermethod = "order by grouping_id asc, record asc";
        }
  
***************
*** 81,85 ****
        if ($query)
        {
!               $querymethod = " and (ns3420_id like '%$query%' or descr like 
'%$query%' )";
        }
  
--- 90,94 ----
        if ($query)
        {
!               $querymethod = " and (ns3420_id like '%$query%' or 
fm_wo_template.remark like '%$query%' or hours_descr like '%$query%')";
        }
  
***************
*** 94,102 ****
        }
  
  
        $db2 = $GLOBALS['phpgw']->db;
! 
!       $sql = "select fm_wo_template.id as template_hour_id, 
fm_wo_template.unit as unit,tekst1,tekst2,tekst3,tekst4,tekst5,tekst6 
,fm_wo_template.ns3420_id, fm_wo_template.building_part_id as 
building_part,fm_wo_template.remark as remark from fm_wo_template $join 
fm_wo_ns3420 on fm_wo_template.ns3420_id = fm_wo_ns3420.id  where 
fm_wo_template.wo_template_type_id=$id";
! 
  
        $db2->query($sql.$querymethod ,__LINE__,__FILE__);
--- 103,116 ----
        }
  
+       $GLOBALS['phpgw']->db->query("SELECT fm_wo_chapter.descr FROM 
fm_wo_template_type $join fm_wo_chapter  on 
fm_wo_template_type.chapter_id=fm_wo_chapter.id WHERE fm_wo_template_type.id 
='$id' ");
+       $GLOBALS['phpgw']->db->next_record();
+       $chapter= $GLOBALS['phpgw']->db->f('descr');
+       $t->set_var('chapter',$chapter);
  
        $db2 = $GLOBALS['phpgw']->db;
!       $sql = "select fm_wo_template.id as template_hour_id, 
fm_wo_template.unit as unit,tekst1,tekst2,tekst3,tekst4,tekst5,tekst6,"
!       . " fm_wo_template.ns3420_id, fm_wo_template.building_part_id as 
building_part,fm_wo_template.remark as remark, "
!       . " 
record,grouping_id,grouping_descr,billperae,quantity,cost,dim_d,hours_descr,tolerance
 "
!       . " from fm_wo_template $join fm_wo_ns3420 on fm_wo_template.ns3420_id 
= fm_wo_ns3420.id  where fm_wo_template.wo_template_type_id=$id";
  
        $db2->query($sql.$querymethod ,__LINE__,__FILE__);
***************
*** 148,151 ****
--- 162,172 ----
        $t->set_var('lang_unit',lang('Unit'));
        $t->set_var('lang_remark',lang('Remark'));
+       $t->set_var('lang_quantity',lang('Quantity'));
+       $t->set_var('lang_billperae',lang('Cost per unit'));
+       $t->set_var('lang_cost',lang('Cost'));
+       $t->set_var('lang_remark',lang('Remark'));
+       $t->set_var('lang_sum_tax',lang('Sum Tax'));
+       $t->set_var('lang_sum_calculation',lang('Sum'));
+       $t->set_var('lang_sum_total',lang('Sum total'));
  
  // ---------------------------- end header declaration 
-------------------------------------
***************
*** 156,159 ****
--- 177,193 ----
                $tr_color = 
$GLOBALS['phpgw']->nextmatchs->alternate_row_color($tr_color);
  
+               $record  = $GLOBALS['phpgw']->db->f('record');
+               if ($record==1)
+               {
+                       $grouping_descr  = 
$GLOBALS['phpgw']->db->f('grouping_descr');
+                       $grouping_descr= '<tr><td><td><td align="center"><b>' . 
$grouping_descr . '</b></td></td></td></tr>';
+               }
+               else
+               {
+                       $grouping_descr='';
+               }
+ 
+ //    echo 'grouping_descr: '.$grouping_descr .'<BR>';
+ 
                $tekst1 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst1'));
                $tekst2 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst2'));
***************
*** 163,167 ****
--- 197,222 ----
                $tekst6 = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('Tekst6'));
  
+               $cost  = $GLOBALS['phpgw']->db->f('cost');
+               if (! $cost)
+               {
+                       $cost = '';
+               }
+ 
+               $sum_tax= $sum_tax + (round (( $tax * ($cost)/100),2)) ;
+               $sum_cost=$sum_cost+$cost;
+               $sum_total= ($sum_cost + $sum_tax);
  
+               $quantity  = $GLOBALS['phpgw']->db->f('quantity');
+               if (! $quantity)
+               {
+                       $quantity = '&nbsp;';
+               }
+               $billperae  = $GLOBALS['phpgw']->db->f('billperae');
+               if (! $billperae)
+               {
+                       $billperae = '&nbsp;';
+               }
+ 
+               $tolerance  = $GLOBALS['phpgw']->db->f('tolerance');
                $descr = $tekst1;
  
***************
*** 191,194 ****
--- 246,261 ----
                }
  
+               $descr .=$tolerance;
+ 
+ //            $hours_descr  = $GLOBALS['phpgw']->db->f('hours_descr');
+ 
+               $hours_descr= str_replace("\n","<br>",$descr);
+ 
+ //            if($hours_descr && $tolerance)
+ //            {
+ //                    $hours_descr .=$tolerance;
+ //            }
+ 
+ //    echo 'hours_descr: '.$descr .'<BR>';
  
                $building_part = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('building_part'));
***************
*** 199,203 ****
  
                $ns3420_id = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('ns3420_id'));
!               if (! $ns3420_id)  $ns3420_id  = '&nbsp;';
  
  
--- 266,277 ----
  
                $ns3420_id = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('ns3420_id'));
!               if (! $ns3420_id)
!               {
!                       $ns3420_id  = '&nbsp;';
!               }
!               else
!               {
!                       $ns3420_id= str_replace("-","$tolerance",$ns3420_id);
!               }
  
  
***************
*** 217,227 ****
  // --------------------- template declaration for list records 
---------------------------
  
!               $t->set_var(array('descr' => $descr,
                                        'building_part' => $building_part,
!                                       'ns3420_id' => $ns3420_id,
!                                       'billperae' => $billperae,
!                                       'unit' => $unit,
!                                       'remark' => $remark,
!                                       'account' => $account));
  
  
--- 291,306 ----
  // --------------------- template declaration for list records 
---------------------------
  
!               $t->set_var(array('descr'       => $hours_descr,
!                                       'quantity'              => $quantity,
!                                       'hours_descr'   => $hours_descr,
!                                       'grouping_descr'=> $grouping_descr,
                                        'building_part' => $building_part,
!                                       'ns3420_id'     => $ns3420_id,
!                                       'billperae'     => $billperae,
!                                       'unit'                  => $unit,
!                                       'remark'                => $remark,
!                                       'billperae'     => $billperae,
!                                       'unit'                  => $unit,
!                                       'cost'                  => $cost));
  
  
***************
*** 233,236 ****
--- 312,320 ----
  // ------------------------------- end record declaration 
--------------------------------
        }
+ 
+               $t->set_var('sum_cost',round($sum_cost),0);
+               $t->set_var('sum_tax',round($sum_tax,0),0);
+               $t->set_var('sum_total',round($sum_total,0));
+ 
                
$t->set_var('add',$GLOBALS['phpgw']->link('/property/add_wo_template_hours.php'));//,'id='
 . $GLOBALS['phpgw']->db->f('id') . 
"&sort=$sort&order=$order&query=$query&start=$start&filter=$filter"));
  

Index: view_detail.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/view_detail.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** view_detail.php     28 Aug 2002 16:43:14 -0000      1.1.1.1
--- view_detail.php     16 Sep 2002 16:05:44 -0000      1.2
***************
*** 145,150 ****
--- 145,152 ----
                $activity_id  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['activity_id']);
                if (! $activity_id) $activity_id = '&nbsp;';
+               $tolerance  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['tolerance']);
  
                $ns3420_id  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['ns3420_id']);
+               $ns3420_id= str_replace("-","$tolerance",$ns3420_id);
  
                $building_part  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['building_part']);
***************
*** 198,202 ****
                if (! $hours_descr) $hours_descr = '&nbsp;';
  
!               $hours_descr= str_replace("\n","<br>",$hours_descr);
  
                $remark = $GLOBALS['phpgw']->strip_html($hours[$i]['remark']);
--- 200,204 ----
                if (! $hours_descr) $hours_descr = '&nbsp;';
  
!               $hours_descr= str_replace("\n","<br>",$hours_descr).$tolerance;
  
                $remark = $GLOBALS['phpgw']->strip_html($hours[$i]['remark']);

Index: view_tender.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/view_tender.php,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -r1.1.1.1 -r1.2
*** view_tender.php     28 Aug 2002 16:43:14 -0000      1.1.1.1
--- view_tender.php     16 Sep 2002 16:05:44 -0000      1.2
***************
*** 146,150 ****
--- 146,153 ----
                if (! $activity_id) $activity_id = '&nbsp;';
  
+               $tolerance  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['tolerance']);
+ 
                $ns3420_id  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['ns3420_id']);
+               $ns3420_id= str_replace("-","$tolerance",$ns3420_id);
  
                $building_part  = 
$GLOBALS['phpgw']->strip_html($hours[$i]['building_part']);
***************
*** 217,221 ****
                if (! $hours_descr) $hours_descr = '&nbsp;';
  
!               $hours_descr= str_replace("\n","<br>",$hours_descr);
  
                $remark = $GLOBALS['phpgw']->strip_html($hours[$i]['remark']);
--- 220,224 ----
                if (! $hours_descr) $hours_descr = '&nbsp;';
  
!               $hours_descr= str_replace("\n","<br>",$hours_descr).$tolerance;
  
                $remark = $GLOBALS['phpgw']->strip_html($hours[$i]['remark']);

Index: list_property_value.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/list_property_value.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** list_property_value.php     9 Sep 2002 17:46:09 -0000       1.1
--- list_property_value.php     16 Sep 2002 16:05:44 -0000      1.2
***************
*** 61,64 ****
--- 61,65 ----
                $year = $dateparts[$y];
                $new_date = mktime (2,0,0,$month,$day,$year);
+               $new_date= date("M d Y",$new_date);
  
                $new_index=str_replace(",",".",$new_index);
***************
*** 102,108 ****
                $first_value=str_replace(" ","",$first_value);
  
  
                $GLOBALS['phpgw']->db->query("insert into fm_property_value 
(objekt_id, cost_id, index_count, this_index, current_index, 
value,initial_value, date) "
!               . " values ('$objekt_id', '$cost_id','1', '1', 
'1','$first_value','$first_value','$initial_date')");
  
                $GLOBALS['phpgw']->db->query("insert into fm_property_cost 
(objekt_id, cost_id, descr) "
--- 103,111 ----
                $first_value=str_replace(" ","",$first_value);
  
+               $initial_date= date("M d Y",$initial_date);
+ 
  
                $GLOBALS['phpgw']->db->query("insert into fm_property_value 
(objekt_id, cost_id, index_count, this_index, current_index, 
value,initial_value, date) "
!               . " values ('$objekt_id', '$cost_id','1', '0', 
'1','$first_value','$first_value','$initial_date')");
  
                $GLOBALS['phpgw']->db->query("insert into fm_property_cost 
(objekt_id, cost_id, descr) "
***************
*** 225,229 ****
        $sql = "SELECT boei_objekt.objekt_id, fm_property_cost.descr as descr, 
fm_property_value.cost_id,initial_value, boei_objekt.navn, 
boei_bydel.omraade_id, boei_bydel.bydel,"
                . " fm_property_value.value, fm_property_value.date, 
fm_property_value.this_index, "
!               . " fm_property_value.index_count "
                . " FROM boei_objekt $join "
                . " boei_bydel ON boei_objekt.bydel_id = boei_bydel.bydel_id 
$join "
--- 228,232 ----
        $sql = "SELECT boei_objekt.objekt_id, fm_property_cost.descr as descr, 
fm_property_value.cost_id,initial_value, boei_objekt.navn, 
boei_bydel.omraade_id, boei_bydel.bydel,"
                . " fm_property_value.value, fm_property_value.date, 
fm_property_value.this_index, "
!               . " fm_property_value.index_count, fm_property_value.date "
                . " FROM boei_objekt $join "
                . " boei_bydel ON boei_objekt.bydel_id = boei_bydel.bydel_id 
$join "
***************
*** 300,303 ****
--- 303,307 ----
        $t->set_var('lang_w_cost',lang('Labour cost'));
        $t->set_var('lang_initial_value',lang('Initial value'));
+       $t->set_var('lang_date',lang('Date'));
  
  
***************
*** 314,318 ****
                $t->set_var('tr_color',$tr_color);
  
-               $select = '<input type="checkbox" name="select[' . $j . ']" 
value="'. $j . '">';
  
                $omraade_id = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('omraade_id'));
--- 318,321 ----
***************
*** 329,332 ****
--- 332,337 ----
                $cost_descr = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('descr'));
  
+               $date = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('date'));
+               $date = str_replace(" 12:00AM","",$date);
                if(!$this_index)
                {
***************
*** 340,344 ****
--- 345,358 ----
                $value_h ='<input type="hidden" name="value_h[' . $j . ']" 
value="'. $value . '">';
  
+ //            echo 'value: '.intval($value) .'<BR>';
  
+               if(abs($value)>0)
+               {
+                       $select = '<input type="checkbox" name="select[' . $j . 
']" value="'. $j . '">';
+               }
+               else
+               {
+                       $select = '';
+               }
                
$t->set_var('history',$GLOBALS['phpgw']->link('/property/property_value_history.php','objekt_id='
 . $objekt_id . '&cost_id=' . $cost_id 
."&order=$order&query=$query&start=$start&filter=$filter"));
  
***************
*** 357,360 ****
--- 371,375 ----
                        'value' => $value,
                        'value_h' => $value_h,
+                       'date' => $date,
                        'index_count' => $index_count));
  

Index: property_value_history.php
===================================================================
RCS file: /cvsroot/phpgroupware/property/property_value_history.php,v
retrieving revision 1.1
retrieving revision 1.2
diff -C2 -r1.1 -r1.2
*** property_value_history.php  9 Sep 2002 17:46:09 -0000       1.1
--- property_value_history.php  16 Sep 2002 16:05:44 -0000      1.2
***************
*** 81,84 ****
--- 81,85 ----
                $year = $dateparts[$y];
                $new_date = mktime (2,0,0,$month,$day,$year);
+               $new_date= date("M d Y",$new_date);
  
  //----------
***************
*** 204,213 ****
        $t->set_var('lang_num',lang('Activity Code'));
        $t->set_var('lang_prizing',lang('Prizing'));
!       $t->set_var('lang_this_index',lang('Index'));
        $t->set_var('lang_index_count',lang('Index Count'));
        $t->set_var('lang_delete',lang('Delete'));
        $t->set_var('lang_m_cost',lang('Material Cost'));
        $t->set_var('lang_w_cost',lang('Labour Cost'));
!       $t->set_var('lang_value',lang('Total Value'));
        $t->set_var('lang_initial_value',lang('Initial Value'));
        $t->set_var('lang_date',lang('Date'));
--- 205,214 ----
        $t->set_var('lang_num',lang('Activity Code'));
        $t->set_var('lang_prizing',lang('Prizing'));
!       $t->set_var('lang_this_index',lang('Decreasing Index'));
        $t->set_var('lang_index_count',lang('Index Count'));
        $t->set_var('lang_delete',lang('Delete'));
        $t->set_var('lang_m_cost',lang('Material Cost'));
        $t->set_var('lang_w_cost',lang('Labour Cost'));
!       $t->set_var('lang_value',lang('Remainig Value'));
        $t->set_var('lang_initial_value',lang('Initial Value'));
        $t->set_var('lang_date',lang('Date'));
***************
*** 233,237 ****
  
                $value_temp=$value;
!               $value = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('value'));
  
                $value_h ='<input type="hidden" name="value_h" value="'. $value 
. '">';
--- 234,238 ----
  
                $value_temp=$value;
!               $value = $GLOBALS['phpgw']->db->f('value');
  
                $value_h ='<input type="hidden" name="value_h" value="'. $value 
. '">';
***************
*** 241,248 ****
  
                $date = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('date'));
                if ($date)
                {
!                       $date = $date + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
!                       $dateout = 
$GLOBALS['phpgw']->common->show_date($date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        $t->set_var('tr_color',$tr_color);
                        $t->set_var('delete','');
--- 242,253 ----
  
                $date = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('date'));
+ //            echo 'date: '.$date .'<BR>';
+               $date = str_replace(" 12:00AM","",$date);
+ 
+ 
                if ($date)
                {
!       //              $date = $date + (60*60) * 
$GLOBALS['phpgw_info']['user']['preferences']['common']['tz_offset'];
!       //              $dateout = 
$GLOBALS['phpgw']->common->show_date($date,$GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
                        $t->set_var('tr_color',$tr_color);
                        $t->set_var('delete','');
***************
*** 254,258 ****
  
                $current_index = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('current_index'));
!               if ($current_index && $this_index )
                {
                        $old_value= '<input type="hidden" name="old_value" 
value="' . $value . '">';
--- 259,263 ----
  
                $current_index = 
$GLOBALS['phpgw']->strip_html($GLOBALS['phpgw']->db->f('current_index'));
!               if ($GLOBALS['phpgw']->db->f('value') && $current_index)
                {
                        $old_value= '<input type="hidden" name="old_value" 
value="' . $value . '">';
***************
*** 266,269 ****
--- 271,279 ----
                        $diff=$value-$value_temp;
                }
+               if (!$GLOBALS['phpgw']->db->f('value'))
+               {
+                       $diff='';
+               }
+ //            echo 'value: '.$GLOBALS['phpgw']->db->f('value') .'<BR>';
                $t->set_var(array('index_count' => $index_count,
                        'this_index' => $this_index,
***************
*** 272,276 ****
                        'initial_value' => $initial_value,
                        'initial_value_h' => $initial_value_h,
!                       'dateout' => $dateout));
  
  
--- 282,286 ----
                        'initial_value' => $initial_value,
                        'initial_value_h' => $initial_value_h,
!                       'dateout' => $date));
  
  





reply via email to

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