fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [10664] Property: update accounting reporting


From: Sigurd Nes
Subject: [Fmsystem-commits] [10664] Property: update accounting reporting
Date: Fri, 11 Jan 2013 20:25:56 +0000

Revision: 10664
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10664
Author:   sigurdne
Date:     2013-01-11 20:25:55 +0000 (Fri, 11 Jan 2013)
Log Message:
-----------
Property: update accounting reporting

Modified Paths:
--------------
    trunk/property/inc/class.soworkorder.inc.php
    trunk/property/inc/class.uiworkorder.inc.php
    trunk/property/js/yahoo/workorder.edit.js
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php        2013-01-11 14:35:09 UTC 
(rev 10663)
+++ trunk/property/inc/class.soworkorder.inc.php        2013-01-11 20:25:55 UTC 
(rev 10664)
@@ -1618,12 +1618,14 @@
 
                        $this->db->query($sql,__LINE__,__FILE__);
                        $order_budget = array();
+                       $_dummy_year = date('Y');
                        while ($this->db->next_record())
                        {
                                $period = sprintf("%s%02d",
                                                        $this->db->f('year'),
                                                        $this->db->f('month')
                                                );
+                               $_dummy_period = $period;
 
                                $order_budget[$period] = array
                                (
@@ -1681,7 +1683,13 @@
 
                                        if(!$_found)
                                        {
-                                               
$order_budget[$periode]['actual_cost'] += $this->db->f('actual_cost');
+                                               $dummy_year = substr( 
$_dummy_period, 0, 4 );
+                                               $dummy_month = substr( 
$_dummy_period, -2);
+
+                                               
$order_budget[$_dummy_period]['year'] = $_dummy_year;
+                                               
$order_budget[$_dummy_period]['month'] = $_dummy_month;
+
+                                               
$order_budget[$_dummy_period]['actual_cost'] += $this->db->f('actual_cost');
                                        }
                                }
                        }
@@ -1743,6 +1751,8 @@
 //die();
                                $values[] = array
                                (
+                                       'year'                                  
=> $_budget['year'],
+                                       'month'                                 
=> $_budget['month'] > 0 ? sprintf("%02s", $_budget['month']) : '',
                                        'period'                                
=> $period,
                                        'budget'                                
=> $_budget['budget'],
                                        'sum_orders'                    => 
$_sum_orders,
@@ -1758,8 +1768,31 @@
                                array_multisort($sort_period, SORT_ASC, 
$values);
                        }
 
+
+                       foreach ($values as &$entry)
+                       {
+       //                      $entry['year'] = substr( $entry['period'], 0, 4 
);
+       //                      $month = substr( $entry['period'], 4, 2 );
+       //                      $entry['month'] = $month == '00' ? '' : $month;
+                               if($active_period[$entry['period']])
+                               {
+                                       $_diff_start = abs($entry['budget']) > 
0 ? $entry['budget'] : $entry['sum_orders'];
+                                       $entry['diff'] = $_diff_start - 
$entry['sum_oblications'] - $entry['actual_cost'];
+                               }
+                               else
+                               {
+                                       $entry['diff'] =  0;
+                               }
+                               $_deviation = $entry['budget'] - 
$entry['actual_cost'];
+                               $deviation = abs($entry['actual_cost']) > 0 ? 
$_deviation : 0;
+                               $entry['deviation_period'] = $deviation;
+                               $entry['deviation_acc'] += $deviation;
+                               $entry['deviation_percent_period'] = 
$deviation/$entry['budget'] * 100;
+                               $entry['deviation_percent_acc'] = 
$entry['deviation_acc']/$entry['budget'] * 100;
+                               $entry['closed'] = 
$closed_period[$entry['period']];
+                               $entry['active'] = 
$active_period[$entry['period']];
+                       }
                        return $values;
-
                }
 
                /**

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2013-01-11 14:35:09 UTC 
(rev 10663)
+++ trunk/property/inc/class.uiworkorder.inc.php        2013-01-11 20:25:55 UTC 
(rev 10664)
@@ -1785,6 +1785,48 @@
                                );
 
 
+
+//---------
+
+                       $datavalues[] = array
+                               (
+                                       'name'                                  
=> "5",
+                                       'values'                                
=> json_encode($content_budget),
+                                       'total_records'                 => 
count($content_budget),
+                                       'edit_action'                   => "''",
+                                       'is_paginator'                  => 1,
+                                       'footer'                                
=> 0
+                               );
+
+                       $myColumnDefs[] = array
+                               (
+                                       'name'          => "5",
+                                       'values'        =>      
json_encode(array(      array('key' => 
'year','label'=>lang('year'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'month','label'=>lang('month'),'sortable'=>false,'resizeable'=>true),
+                                                                               
                                array('key' => 
'budget','label'=>lang('budget'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
        //                      array('key' => 'sum_orders','label'=> 
lang('order'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                array('key' => 
'sum_oblications','label'=>lang('sum 
orders'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                array('key' => 
'actual_cost','label'=>lang('actual 
cost'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                array('key' => 
'diff','label'=>lang('difference'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                array('key' => 
'deviation_period','label'=>lang('deviation'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                array('key' => 
'deviation_acc','label'=>lang('deviation'). '::' . 
lang('accumulated'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount0'),
+                                                                               
                                array('key' => 
'deviation_percent_period','label'=>lang('deviation') . '::' . 
lang('percent'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+                                                                               
                                array('key' => 
'deviation_percent_acc','label'=>lang('percent'). '::' . 
lang('accumulated'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterAmount2'),
+                                                                               
                                //~ array('key' => 
'closed','label'=>lang('closed'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter'),
+                                                                               
                                //~ array('key' => 'closed_orig','hidden' => 
true),
+                                                                               
                                //~ array('key' => 
'active','label'=>lang('active'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter'),
+                                                                               
                                //~ array('key' => 'active_orig','hidden' => 
true),
+                                                                               
                                //~ array('key' => 'flag_active','hidden' => 
true),
+                                                                               
                                //~ array('key' => 
'delete_year','label'=>lang('Delete'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')
+                                                                               
                        )
+                                                                               
                )
+
+                               );
+
+//---------
+
+
+
                        $link_claim = '';
                        
if(isset($values['charge_tenant'])?$values['charge_tenant']:'')
                        {
@@ -1822,8 +1864,23 @@
                        
                        $value_coordinator = isset($project['coordinator']) ? 
$GLOBALS['phpgw']->accounts->get($project['coordinator'])->__toString() : 
$GLOBALS['phpgw']->accounts->get($this->account)->__toString();
 
+                       $year   = date('Y') -1;
+                       $limit  = $year + 8;
+
+                       while ($year < $limit)
+                       {
+                               $year_list[] = array
+                               (
+                                       'id'    =>  $year,
+                                       'name'  =>  $year
+                               );
+                               $year++;
+                       }
+
+
                        $data = array
                                (
+                                       'year_list'                             
                                => array('options' => $year_list),
                                        'mode'                                  
                                => $mode,
                                        'value_coordinator'                     
                        => $value_coordinator,
                                        'event_data'                            
                        => $event_data,

Modified: trunk/property/js/yahoo/workorder.edit.js
===================================================================
--- trunk/property/js/yahoo/workorder.edit.js   2013-01-11 14:35:09 UTC (rev 
10663)
+++ trunk/property/js/yahoo/workorder.edit.js   2013-01-11 20:25:55 UTC (rev 
10664)
@@ -27,6 +27,20 @@
                }
        };
 
+       var FormatterAmount0 = function(elCell, oRecord, oColumn, oData)
+       {
+               var amount = YAHOO.util.Number.format(oData, {decimalPlaces:0, 
decimalSeparator:",", thousandsSeparator:" "});
+               elCell.innerHTML = "<div align=\"right\">"+amount+"</div>";
+       }       
+       var FormatterAmount2 = function(elCell, oRecord, oColumn, oData)
+       {
+               var amount = YAHOO.util.Number.format(oData, {decimalPlaces:2, 
decimalSeparator:",", thousandsSeparator:" "});
+               elCell.innerHTML = "<div align=\"right\">"+amount+"</div>";
+       }       
+       var FormatterCenter = function(elCell, oRecord, oColumn, oData)
+       {
+               elCell.innerHTML = "<center>"+oData+"</center>";
+       }
 
        var oArgs_invoicehandler_2 = {menuaction:'property.uiinvoice2.index'};
        var sUrl_invoicehandler_2 = phpGWLink('index.php', 
oArgs_invoicehandler_2);
@@ -100,7 +114,7 @@
 
                if(typeof(tableYUI)=='undefined')
                {
-                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[1].parentNode;
+                       tableYUI = 
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[2].parentNode;
                        tableYUI.setAttribute("id","tableYUI");
                }
                else

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2013-01-11 14:35:09 UTC (rev 
10663)
+++ trunk/property/templates/base/workorder.xsl 2013-01-11 20:25:55 UTC (rev 
10664)
@@ -523,6 +523,7 @@
                                                                        
<xsl:call-template name="cat_sub_select"/>
                                                                </td>
                                                        </tr>
+
                                                        <tr>
                                                                <td 
valign="top">
                                                                        
<xsl:value-of select="php:function('lang', 'contract sum')"/>
@@ -562,8 +563,45 @@
                                                                        <input 
type="text" name="values[addition_rs]" value="{value_addition_rs}" 
onMouseout="window.status='';return true;"><xsl:attribute 
name="title"><xsl:value-of 
select="lang_addition_rs_statustext"/></xsl:attribute></input><xsl:text> 
</xsl:text> [ <xsl:value-of select="currency"/> ]
                                                                </td>
                                                        </tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="php:function('lang', 'when')"/>
+                                                               </td>
+                                                               <td>
+                                                                       <table>
+                                                                               
<tr>
+                                                                               
        <td>
+                                                                               
                <select name="values[budget_year]">
+                                                                               
                        <xsl:attribute name="title">
+                                                                               
                                <xsl:value-of select="php:function('lang', 
'year')"/>
+                                                                               
                        </xsl:attribute>
+                                                                               
                        <option value="0">
+                                                                               
                                <xsl:value-of select="php:function('lang', 
'year')"/>
+                                                                               
                        </option>
+                                                                               
                        <xsl:apply-templates select="year_list/options"/>
+                                                                               
                </select>
+                                                                               
        </td>
+                                                                               
        <td>
+                                                                               
                <input type="checkbox" name="values[budget_periodization]" 
value="True">
+                                                                               
                        <xsl:attribute name="title">
+                                                                               
                                <xsl:value-of select="php:function('lang', 
'periodization')"/>
+                                                                               
                        </xsl:attribute>
+                                                                               
                </input>
+                                                                               
        </td>
+                                                                               
</tr>
+                                                                       </table>
+                                                               </td>
+
                                                        <tr>
+                                                               <td 
valign="top">
+                                                                       
<xsl:value-of select="php:function('lang', 'budget')"/>
+                                                               </td>
                                                                <td>
+                                                                       <div 
id="paging_5"/>
+                                                                       <div 
id="datatable-container_5"/>
+                                                               </td>
+                                                       </tr>
+                                                       <tr>
+                                                               <td>
                                                                        
<xsl:choose>
                                                                                
<xsl:when test="link_claim !=''">
                                                                                
        <a href="{link_claim}">




reply via email to

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