fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [6517] merge 6514:6516 from trunk


From: Sigurd Nes
Subject: [Fmsystem-commits] [6517] merge 6514:6516 from trunk
Date: Wed, 27 Oct 2010 13:18:14 +0000

Revision: 6517
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=6517
Author:   sigurdne
Date:     2010-10-27 13:18:13 +0000 (Wed, 27 Oct 2010)
Log Message:
-----------
merge 6514:6516 from trunk

Modified Paths:
--------------
    branches/Version-1_0-branch/property/inc/class.bowo_hour.inc.php
    branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
    branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
    branches/Version-1_0-branch/rental/setup/phpgw_no.lang
    branches/Version-1_0-branch/rental/templates/base/contract_list_partial.php

Property Changed:
----------------
    branches/Version-1_0-branch/


Property changes on: branches/Version-1_0-branch
___________________________________________________________________
Modified: svn:mergeinfo
   - 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513
   + 
/trunk:6439-6441,6443,6445-6447,6449-6464,6466-6468,6470-6474,6476-6477,6479-6480,6483-6488,6490-6491,6493-6494,6496-6501,6503-6504,6506,6508,6510-6511,6513,6515-6516

Modified: branches/Version-1_0-branch/property/inc/class.bowo_hour.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.bowo_hour.inc.php    
2010-10-27 13:13:35 UTC (rev 6516)
+++ branches/Version-1_0-branch/property/inc/class.bowo_hour.inc.php    
2010-10-27 13:18:13 UTC (rev 6517)
@@ -289,7 +289,7 @@
                                }
                                $quantity               = 
str_replace(",",".",$quantity);
 
-                               
$cost=($values['total_cost'][$n]*$values['quantity'][$n]);
+                               $cost=($values['total_cost'][$n]*$quantity);
 
                                $hour[]=array(
                                        'activity_id'           => 
$values['activity_id'][$n],
@@ -325,45 +325,42 @@
 
 //_debug_array($values);
 
-                       if ($values['select']) 
+                       foreach($values['quantity'] as $n => $quantity)
                        {
-                               foreach($values['select'] as $n)
+                               if(!$quantity)
                                {
-                                                                               
                        
-                                       if(!$values['quantity'][$n])
-                                       {
-                                               $values['quantity'][$n]=1;
-                                       }
+                                       continue;
+                               }
+
+                               if ($values['wo_hour_cat'][$n] && 
!$values['cat_per_cent'][$n])
+                               {
+                                       $values['cat_per_cent'][$n] = 100;
+                               }
        
-                                       if ($values['wo_hour_cat'][$n] && 
!$values['cat_per_cent'][$n])
-                                       {
-                                               $values['cat_per_cent'][$n] = 
100;
-                                       }
+                               $quantity               = 
str_replace(",",".",$quantity);
+                               $cost=($values['billperae'][$n]*$quantity);
        
-                                       $values['quantity'][$n]         = 
str_replace(",",".",$values['quantity'][$n]);
-                                       
$cost=($values['billperae'][$n]*$values['quantity'][$n]);
+                               $hour[]= array
+                               (
+                                       'chapter_id'            => 
$values['chapter_id'][$n],
+                                       'activity_id'           => 
$values['activity_id'][$n],
+                                       'activity_num'          => 
$values['activity_num'][$n],
+                                       'hours_descr'           => 
$values['hours_descr'][$n],
+                                       'remark'                        => 
$values['remark'][$n],
+                                       'unit'                          => 
$values['unit'][$n],
+                                       'cost'                          => 
$cost,
+                                       'quantity'                      => 
$quantity,
+                                       'new_grouping'          => 
$values['grouping_descr'][$n],
+                                       'billperae'                     => 
$values['billperae'][$n],
+                                       'ns3420_id'                     => 
$values['ns3420_id'][$n],
+                                       'tolerance'                     => 
$values['tolerance'][$n],
+                                       'building_part'         => 
$values['building_part'][$n],
+                                       'dim_d'                         => 
$values['dim_d'][$n],
+                                       'workorder_id'          => 
$workorder_id,
+                                       'wo_hour_cat'           => 
$values['wo_hour_cat'][$n],
+                                       'cat_per_cent'          => 
$values['cat_per_cent'][$n]
+                               );
        
-                                       $hour[]=array(
-                                               'chapter_id'            => 
$values['chapter_id'][$n],
-                                               'activity_id'           => 
$values['activity_id'][$n],
-                                               'activity_num'          => 
$values['activity_num'][$n],
-                                               'hours_descr'           => 
$values['hours_descr'][$n],
-                                               'remark'                => 
$values['remark'][$n],
-                                               'unit'                  => 
$values['unit'][$n],
-                                               'cost'                  => 
$cost,
-                                               'quantity'              => 
$values['quantity'][$n],
-                                               'new_grouping'          => 
$values['grouping_descr'][$n],
-                                               'billperae'             => 
$values['billperae'][$n],
-                                               'ns3420_id'             => 
$values['ns3420_id'][$n],
-                                               'tolerance'             => 
$values['tolerance'][$n],
-                                               'building_part'         => 
$values['building_part'][$n],
-                                               'dim_d'                 => 
$values['dim_d'][$n],
-                                               'workorder_id'          => 
$workorder_id,
-                                               'wo_hour_cat'           => 
$values['wo_hour_cat'][$n],
-                                               'cat_per_cent'          => 
$values['cat_per_cent'][$n]
-                                       );
-       
-                               }
                        }
 //_debug_array($hour);
 

Modified: branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php
===================================================================
--- branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php    
2010-10-27 13:13:35 UTC (rev 6516)
+++ branches/Version-1_0-branch/property/inc/class.uiwo_hour.inc.php    
2010-10-27 13:18:13 UTC (rev 6517)
@@ -2472,7 +2472,7 @@
                        $workorder_id = phpgw::get_var('workorder_id'); // in 
case of bigint
                        $template_id = phpgw::get_var('template_id', 'int');
 
-                       $values = phpgw::get_var('values');
+                       $values = $_POST['values'] ? phpgw::get_var('values') : 
array();
 
                        if($delete && $hour_id)
                        {
@@ -2486,7 +2486,7 @@
 
                        if($values['add'])
                        {
-                               
$receipt=$this->bo->add_hour_from_template($values,$workorder_id);
+                               $receipt = 
$this->bo->add_hour_from_template($values,$workorder_id);
                        }
 
                        $common_data=$this->common_data($workorder_id);
@@ -2575,12 +2575,12 @@
                        }
                                                                                
                                                                                
                        $uicols = array (
-                               'input_type'    =>      
array('text','text','text','text','text','varchar','select','combo','varchar','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden'),
-                               'type'                  =>      
array('','','','','','text','','','','text','','','',''),                       
        
-                               'name'                  =>      
array('building_part','code,hours_descr','unit','billperae','quantity','select','wo_hour_cat','cat_per_cent','chapter_id','grouping_descr','new_grouping','activity_id','activity_num','remark','ns3420_id','tolerance','cost','dim_d'),
+                               'input_type'    =>      
array('text','text','text','text','text','varchar','combo','varchar','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden','hidden'),
+                               'type'                  =>      
array('','','','','','text','','','text','','','',''),                          
+                               'name'                  =>      
array('building_part','code','hours_descr','unit','billperae','quantity','wo_hour_cat','cat_per_cent','chapter_id','grouping_descr','new_grouping','activity_id','activity_num','remark','ns3420_id','tolerance','cost','dim_d'),
                                'formatter'             =>      
array('','','','','','','','','','','','','','','','','','',''),
-                               'descr'                 =>      
array(lang('Building 
part'),lang('Code'),lang('Description'),lang('Unit'),lang('Bill per 
unit'),lang('Quantity'),lang('Select'),'','','','','','','','','','','',''),
-                               'className'             =>      
array('','','','','rightClasss','','centerClasss','','','','','','','','','','','','')
+                               'descr'                 =>      
array(lang('Building 
part'),lang('Code'),lang('Description'),lang('Unit'),lang('Bill per 
unit'),lang('Quantity'),'','','','','','','','','','','',''),
+                               'className'             =>      
array('','','','','rightClasss','','','','','','','','','','','','','')
                        );
                        
                        $values_combo_box       = 
$this->bocommon->select_category_list(array('format'=>'filter','selected' => 
$this->wo_hour_cat_id,'type' =>'wo_hours','order'=>'id'));
@@ -2658,7 +2658,7 @@
                                                
                                                if 
($uicols['input_type'][$i]=='varchar') 
                                                {
-                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input 
name='values[".$uicols['name'][$i]."][".$j."]' 
id='values[".$uicols['name'][$i]."][".$j."]' size='4' class='myValuesForPHP'/>";
+                                                       
$datatable['rows']['row'][$j]['column'][$i]['value'] = "<input 
name='values[{$uicols['name'][$i]}][{$j}]' 
id='values[{$uicols['name'][$i]}][{$j}]' size='4' class='myValuesForPHP'/>";
                                                }
                                                                                
        
                                                if 
($uicols['input_type'][$i]=='select') 

Modified: branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php
===================================================================
--- branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php 
2010-10-27 13:13:35 UTC (rev 6516)
+++ branches/Version-1_0-branch/rental/inc/model/class.contract.inc.php 
2010-10-27 13:18:13 UTC (rev 6517)
@@ -581,13 +581,29 @@
                         * 2.3 ...ends or starts current year - calculate price
                         * 2.3.1 
                         */
-                       $current_year = date("Y");
-                       $next_year = $current_year + 1;
                        
-                       $timestamp_invoice_start = 
strtotime("{$current_year}-1-1");
-                       $timestamp_invoice_end = 
strtotime("{$current_year}-12-31");
+                       $date_start = phpgw::get_var('date_start');
+                       $date_end = phpgw::get_var('date_end');
+
+                       if(isset($date_start)){
+                               $aDate = split ("/", $date_start);
+                               $date_start = 
$aDate[1]."/".$aDate[0]."/".$aDate[2];
+                               $timestamp_invoice_start = 
strtotime($date_start);
+                       }
                        
+                       if(isset($date_end)){
+                               $aDate = split ("/", $date_end);
+                               $date_end = 
$aDate[1]."/".$aDate[0]."/".$aDate[2];
+                               $timestamp_invoice_end = strtotime($date_end);
+                       }
                        
+                       
+                       if(!isset($timestamp_invoice_start) || 
$timestamp_invoice_start == "" || !isset($timestamp_invoice_end) || 
$timestamp_invoice_end == ""){
+                               $current_year = date("Y");
+                               $timestamp_invoice_start = 
strtotime("{$current_year}-1-1");
+                               $timestamp_invoice_end = 
strtotime("{$current_year}-12-31");
+                       }
+
                        $contract_dates = $this->get_contract_date();
                        if(isset($contract_dates))
                        {
@@ -602,11 +618,6 @@
                                {
                                        return 0; // The contract starts after 
the end of current year
                                }
-                               else if($contract_start < 
$timestamp_invoice_start && (!isset($contract_end) || $contract_end > 
$timestamp_invoice_end))
-                               {
-                                       // The contract is active the whole 
current year
-                                       return 
rental_socontract_price_item::get_instance()->get_total_price($this->get_id());
-                               }
                        }
                        else
                        {
@@ -717,16 +728,18 @@
                                        $invoice_price_item_end                 
                        // the end date to which this price item should be 
calculated
                                );
                                
+                               
+                               $total_price_price_item = 0;
+                               
                                // If the contract price item is of type 
one-time and it's dates are within the invoice period ...
-                               if($contract_price_item->is_one_time()){
+                               if($contract_price_item->is_one_time()){ 
                                        if($contract_price_item_start >= 
$timestamp_invoice_start && $contract_price_item_start <= 
$timestamp_invoice_end){
                                                // ... set the total price of 
the invoice price item to the total price of the contract price item
-                                               
$invoice_price_item->set_total_price($contract_price_item->get_total_price());
+                                               $total_price_price_item = 
$contract_price_item->get_total_price();
                                        }
+                               }else{
+                                       $total_price_price_item = 
$invoice_price_item->get_total_price();
                                }
-                               
-                               // Add this price item's total sum to the tota 
sum of the invoice
-                               $total_price_price_item = 
$invoice_price_item->get_total_price();
                                $total_sum += round($total_price_price_item,2);
                        } // end of looping through the contract price items
                        

Modified: branches/Version-1_0-branch/rental/setup/phpgw_no.lang
===================================================================
--- branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2010-10-27 
13:13:35 UTC (rev 6516)
+++ branches/Version-1_0-branch/rental/setup/phpgw_no.lang      2010-10-27 
13:18:13 UTC (rev 6517)
@@ -507,7 +507,7 @@
 to_the_top     rental  no      Til toppen
 Total sum      rental  no      Totalt beløp
 total_price    rental  no      Total pris
-total_price_current_year       rental  no      Pris inneværende år
+total_price_current_year       rental  no      Pris i budsjettperiode
 type   rental  no      Type
 under_dismissal        rental  no      Under oppsigelse
 under_planning rental  no      Under planlegging

Modified: 
branches/Version-1_0-branch/rental/templates/base/contract_list_partial.php
===================================================================
--- branches/Version-1_0-branch/rental/templates/base/contract_list_partial.php 
2010-10-27 13:13:35 UTC (rev 6516)
+++ branches/Version-1_0-branch/rental/templates/base/contract_list_partial.php 
2010-10-27 13:18:13 UTC (rev 6517)
@@ -147,6 +147,9 @@
 
         var query = document.getElementById('<?php echo $list_id 
?>_ctrl_search_query').value;
 
+               var startDate = 
document.getElementById('start_date_report').value;
+               var endDate = document.getElementById('end_date_report').value;
+        
         var dl = window.open('index.php?menuaction=rental.uicontract.download'+
             '&amp;type='+ctype+
             '&amp;contract_type='+typeoption+
@@ -155,6 +158,8 @@
             '&amp;query='+query+
             '&amp;search_option='+sOption+
             //'&amp;results=100'+
+            '&amp;date_start='+startDate+
+            '&amp;date_end='+endDate+
             '&amp;export=true');
     }
 </script>
@@ -219,17 +224,32 @@
                                ?>
                        </select>
        </fieldset>
+       <fieldset>
+               <!-- export with date limitation -->
+               <h3><?php echo lang('export_to') ?></h3>
+               <div id="export">
+                       <a href="javascript:contract_export('<?php echo 
$list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a>
+                       <label class="toolbar_element_label" 
for="start_date_report" id="label_start_date_report"><?php echo 
lang('date_start') ?></label>
+                       <?php echo 
$GLOBALS['phpgw']->yuical->add_listener('start_date_report', 
$notification_date); ?>
+                       <label class="toolbar_element_label" 
for="end_date_report" id="label_end_date_report"><?php echo lang('date_end') 
?></label>
+                       <?php echo 
$GLOBALS['phpgw']->yuical->add_listener('end_date_report', $notification_date); 
?>
+               </div>
+       </fieldset>
 </form>
 
 <?php
+       }else{
+?>
+
+       <fieldset>
+               <h3><?php echo lang('export_to') ?></h3>
+               <div id="export"><a href="javascript:contract_export('<?php 
echo $list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a></div>
+       </fieldset>
+
+<?php
        }
 ?>
 
-<fieldset>
-       <h3><?php echo lang('export_to') ?></h3>
-       <div id="export"><a href="javascript:contract_export('<?php echo 
$list_id ?>');"><img src="<?php echo RENTAL_TEMPLATE_PATH 
?>images/16x16/mimetypes/x-office-spreadsheet.png"/></a></div>
-</fieldset>
-
 <div id="<?php echo $list_id ?>_paginator" class="paginator"></div>
 <div id="<?php echo $list_id ?>_container" class="datatable_container"></div>
 




reply via email to

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