fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [17164] property: list orders within project, allow n


From: sigurdne
Subject: [Fmsystem-commits] [17164] property: list orders within project, allow negative numbers for budget, and show both directions on obligations
Date: Wed, 18 Oct 2017 09:36:13 -0400 (EDT)

Revision: 17164
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=17164
Author:   sigurdne
Date:     2017-10-18 09:36:13 -0400 (Wed, 18 Oct 2017)
Log Message:
-----------
property: list orders within project, allow negative numbers for budget, and 
show both directions on obligations

Modified Paths:
--------------
    trunk/property/inc/class.sobudget.inc.php
    trunk/property/inc/class.soproject.inc.php
    trunk/property/inc/class.uibudget.inc.php
    trunk/property/inc/class.uiproject.inc.php
    trunk/property/js/portico/project.edit.js
    trunk/property/setup/phpgw_no.lang
    trunk/property/templates/base/project.xsl
    trunk/property/templates/base/workorder.xsl

Modified: trunk/property/inc/class.sobudget.inc.php
===================================================================
--- trunk/property/inc/class.sobudget.inc.php   2017-10-18 08:24:54 UTC (rev 
17163)
+++ trunk/property/inc/class.sobudget.inc.php   2017-10-18 13:36:13 UTC (rev 
17164)
@@ -539,11 +539,11 @@
 
                        if ($direction == 'income')
                        {
-                               $filtermethod_direction = "fm_b_account.id 
{$this->like} '3%'";
+                               $filtermethod_direction = "AND fm_b_account.id 
{$this->like} '3%'";
                        }
-                       else
+                       else if($direction == 'expenses')
                        {
-                               $filtermethod_direction = "fm_b_account.id NOT 
{$this->like} '3%'";
+                               $filtermethod_direction = "AND fm_b_account.id 
NOT {$this->like} '3%'";
                        }
 
                        /* 0 => cancelled, 1 => obligation , 2 => paid */
@@ -653,7 +653,7 @@
                                . " {$this->join} fm_project ON  
fm_workorder.project_id = fm_project.id"
                                . " {$_join_district}"
                                . " {$this->join} fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.id"
-                               . " {$filtermethod_order}{$filtermethod} 
{$querymethod} {$where} {$filtermethod_direction}"
+                               . " {$filtermethod_order}{$filtermethod} 
{$querymethod} {$filtermethod_direction}"
                                . " ORDER BY fm_workorder.id ASC";
 
 //                     _debug_array($sql);
@@ -695,7 +695,7 @@
                                . " {$this->join} fm_project ON  
fm_workorder.project_id = fm_project.id"
                                . " {$_join_district}"
                                . " {$this->join} fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.id"
-                               . " {$filtermethod_payment}{$filtermethod} 
{$querymethod} {$where} {$filtermethod_direction}"
+                               . " {$filtermethod_payment}{$filtermethod} 
{$querymethod} {$filtermethod_direction}"
                                . " ORDER BY fm_workorder.id ASC";
 
                        $this->db->query($sql, __LINE__, __FILE__);
@@ -829,7 +829,7 @@
                                . " FROM fm_tts_tickets"
                                . " {$this->join} fm_b_account ON 
fm_tts_tickets.b_account_id = fm_b_account.id "
                                . " {$this->join} fm_location1 ON 
fm_tts_tickets.loc1 = fm_location1.loc1 "
-                               . " {$this->join} fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.id $filtermethod $filtermethod2 
$querymethod  {$where} {$filtermethod_direction} GROUP BY 
fm_b_account.{$b_account_field},district_id,fm_tts_tickets.ecodimb";
+                               . " {$this->join} fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.id $filtermethod $filtermethod2 
$querymethod {$filtermethod_direction} GROUP BY 
fm_b_account.{$b_account_field},district_id,fm_tts_tickets.ecodimb";
 
                        //_debug_array($sql);die();
                        $this->db->query($sql . $ordermethod, __LINE__, 
__FILE__);
@@ -855,7 +855,7 @@
                                . " FROM fm_tts_tickets"
                                . " {$this->join} fm_b_account ON 
fm_tts_tickets.b_account_id = fm_b_account.id "
                                . " {$this->join} fm_location1 ON 
fm_tts_tickets.loc1 = fm_location1.loc1 "
-                               . " {$this->join} fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.id {$filtermethod} 
{$querymethod} {$where} {$filtermethod_direction} GROUP BY 
fm_b_account.{$b_account_field},district_id,fm_tts_tickets.ecodimb";
+                               . " {$this->join} fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.id {$filtermethod} 
{$querymethod} {$filtermethod_direction} GROUP BY 
fm_b_account.{$b_account_field},district_id,fm_tts_tickets.ecodimb";
 
 
                        $sql = str_replace('budget', 'actual_cost', $sql);
@@ -927,13 +927,13 @@
                        if ($details)
                        {
                                $sql = "SELECT budget_cost,b_account_id as 
b_account_field,district_id,ecodimb FROM fm_budget"
-                                       . " {$this->join} fm_b_account ON 
fm_budget.b_account_id =fm_b_account.id WHERE year={$year} AND revision = 
'$revision' $filtermethod {$where} {$filtermethod_direction}"
+                                       . " {$this->join} fm_b_account ON 
fm_budget.b_account_id =fm_b_account.id WHERE year={$year} AND revision = 
'$revision' $filtermethod {$filtermethod_direction}"
                                        . " GROUP BY 
budget_cost,b_account_id,district_id,ecodimb";
                        }
                        else
                        {
                                $sql = "SELECT sum(budget_cost) as budget_cost 
,fm_b_account.category as b_account_field,district_id,ecodimb FROM fm_budget"
-                                       . " $this->join fm_b_account ON 
fm_budget.b_account_id =fm_b_account.id WHERE year={$year} AND revision = 
'$revision' $filtermethod  {$where} {$filtermethod_direction}"
+                                       . " $this->join fm_b_account ON 
fm_budget.b_account_id =fm_b_account.id WHERE year={$year} AND revision = 
'$revision' $filtermethod {$filtermethod_direction}"
                                        . " GROUP BY 
fm_b_account.category,district_id,ecodimb";
                        }
                        //_debug_array($sql);
@@ -986,7 +986,7 @@
                                . " FROM fm_s_agreement"
                                . " {$this->join} fm_s_agreement_budget ON 
fm_s_agreement.id = fm_s_agreement_budget.agreement_id"
                                . " $this->join fm_b_account ON 
fm_s_agreement_budget.budget_account = fm_b_account.id "
-                               . " WHERE $filtermethod $querymethod {$where} 
{$filtermethod_direction} GROUP BY 
fm_b_account.{$b_account_field},fm_s_agreement_budget.ecodimb";
+                               . " WHERE $filtermethod $querymethod 
{$filtermethod_direction} GROUP BY 
fm_b_account.{$b_account_field},fm_s_agreement_budget.ecodimb";
 
                        //_debug_array($sql);die();
                        $this->db->query($sql . $ordermethod, __LINE__, 
__FILE__);
@@ -1014,7 +1014,7 @@
                                . " {$this->join} fm_b_account ON 
fm_ecobilagoverf.spbudact_code =fm_b_account.id"
                                . " {$this->join} fm_s_agreement ON 
fm_ecobilagoverf.pmwrkord_code = fm_s_agreement.id"
                                . " {$this->join} fm_s_agreement_budget ON 
fm_s_agreement.id = fm_s_agreement_budget.agreement_id"
-                               . " WHERE periode >= $start_periode AND periode 
<= $end_periode AND {$filtermethod} {$where} {$filtermethod_direction}"
+                               . " WHERE periode >= $start_periode AND periode 
<= $end_periode AND {$filtermethod} {$filtermethod_direction}"
                                . " GROUP BY fm_b_account.{$b_account_field}, 
ecodimb, periode";
 //_debug_array($sql);
                        $this->db->query($sql, __LINE__, __FILE__);
@@ -1073,7 +1073,7 @@
                                . " {$this->join} fm_b_account ON 
fm_ecobilag.spbudact_code =fm_b_account.id"
                                . " {$this->join} fm_s_agreement ON 
fm_ecobilag.pmwrkord_code = fm_s_agreement.id"
                                . " {$this->join} fm_s_agreement_budget ON 
fm_s_agreement.id = fm_s_agreement_budget.agreement_id"
-                               . " {$filtermethod} {$where} 
{$filtermethod_direction}"
+                               . " {$filtermethod} {$filtermethod_direction}"
                                . " GROUP BY fm_b_account.{$b_account_field}, 
ecodimb, periode";
 //_debug_array($sql);
                        $this->db->query($sql, __LINE__, __FILE__);

Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php  2017-10-18 08:24:54 UTC (rev 
17163)
+++ trunk/property/inc/class.soproject.inc.php  2017-10-18 13:36:13 UTC (rev 
17164)
@@ -1082,7 +1082,14 @@
                        $this->db->next_record();
                        $this->total_records = (int)$this->db->f('cnt');
 
-                       $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $results);
+                       if($results < 0)
+                       {
+                               $this->db->query($sql, __LINE__, __FILE__);
+                       }
+                       else
+                       {
+                               $this->db->limit_query($sql, $start, __LINE__, 
__FILE__, $results);
+                       }
 
                        $_orders = array();
 
@@ -1104,6 +1111,7 @@
                                        'budget' => 0,
                                        'obligation' => 0,
                                        'actual_cost' => 0,
+                                       'year'  => $year ? $year : ''
                                );
                                $_orders[] = $this->db->f('workorder_id');
                        }

Modified: trunk/property/inc/class.uibudget.inc.php
===================================================================
--- trunk/property/inc/class.uibudget.inc.php   2017-10-18 08:24:54 UTC (rev 
17163)
+++ trunk/property/inc/class.uibudget.inc.php   2017-10-18 13:36:13 UTC (rev 
17164)
@@ -433,6 +433,12 @@
                                        'id' => 'income',
                                        'name' => lang('income'),
                                        'selected' => $this->direction == 
'income' ? 1 : 0
+                               ),
+                               array
+                                       (
+                                       'id' => 'both',
+                                       'name' => lang('both'),
+                                       'selected' => $this->direction == 
'both' ? 1 : 0
                                )
                        );
                        $combos[] = array

Modified: trunk/property/inc/class.uiproject.inc.php
===================================================================
--- trunk/property/inc/class.uiproject.inc.php  2017-10-18 08:24:54 UTC (rev 
17163)
+++ trunk/property/inc/class.uiproject.inc.php  2017-10-18 13:36:13 UTC (rev 
17164)
@@ -1776,36 +1776,58 @@
                                (
                                array('key' => 'workorder_id', 'label' => 
lang('Workorder'), 'sortable' => true,
                                        'formatter' => 'formatLink', 
'value_footer' => lang('Sum')),
+                               array('key' => 'year', 'label' => lang('year'), 
'sortable' => true),
                                array('key' => 'title', 'label' => 
lang('title'), 'sortable' => true),
                                array('key' => 'b_account_id', 'label' => 
lang('Budget account'), 'sortable' => true,
                                        'className' => 'right'),
-                               array('key' => 'budget', 'label' => 
lang('budget'), 'sortable' => false, 'className' => 'right',
+                               array('key' => 'budget', 'label' => 
lang('budget'), 'sortable' => true, 'className' => 'right',
                                        'formatter' => 
'JqueryPortico.FormatterAmount0'),
-                               array('key' => 'cost', 'label' => lang('cost'), 
'sortable' => false, 'className' => 'right',
+                               array('key' => 'cost', 'label' => lang('cost'), 
'sortable' => true, 'className' => 'right',
                                        'formatter' => 
'JqueryPortico.FormatterAmount0'),
-                               array('key' => 'addition_percentage', 'label' 
=> '%', 'sortable' => false, 'className' => 'right'),
-                               array('key' => 'obligation', 'label' => 
lang('sum orders'), 'sortable' => false,
+                               array('key' => 'addition_percentage', 'label' 
=> '%', 'sortable' => true, 'className' => 'right'),
+                               array('key' => 'obligation', 'label' => 
lang('sum orders'), 'sortable' => true,
                                        'className' => 'right', 'formatter' => 
'JqueryPortico.FormatterAmount0'),
-                               array('key' => 'actual_cost', 'label' => 
lang('actual cost'), 'sortable' => false,
+                               array('key' => 'actual_cost', 'label' => 
lang('actual cost'), 'sortable' => true,
                                        'className' => 'right', 'formatter' => 
'JqueryPortico.FormatterAmount0'),
-                               array('key' => 'diff', 'label' => 
lang('difference'), 'sortable' => false, 'className' => 'right',
+                               array('key' => 'diff', 'label' => 
lang('difference'), 'sortable' => true, 'className' => 'right',
                                        'formatter' => 
'JqueryPortico.FormatterAmount0'),
-                               array('key' => 'vendor_name', 'label' => 
lang('Vendor'), 'sortable' => false),
+                               array('key' => 'vendor_name', 'label' => 
lang('Vendor'), 'sortable' => true),
                                array('key' => 'status', 'label' => 
lang('Status'), 'sortable' => true),
                                array('key' => 'send_order', 'label' => 
lang('send workorder'), 'sortable' => false,
                                        'className' => 'center')
                        );
 
+                       $order_data = $this->bo->get_orders(array(
+                               'start' => 0,
+                               'project_id' => $id,
+                               'year' => date('Y'),
+                               'order' => 'workorder_id',
+                               'sort' => 'desc',
+                               'results' => -1,
+                               'query' => '',
+                               )
+                       );
+                       foreach ($order_data as & $_order_entry)
+                       {
+                               $_order_entry['send_order'] = '';
+                               if (isset($_order_entry['mail_recipients'][0]) 
&& $_order_entry['mail_recipients'][0])
+                               {
+                                       $_title = implode(';', 
$_order_entry['mail_recipients']);
+                                       $_order_entry['send_order'] = "<input 
type='checkbox' name='values[send_order][]' 
value='{$_order_entry['workorder_id']}' title='{$_title}'>";
+                               }
+                       }
+
                        $datatable_def[] = array
                                (
                                'container' => 'datatable-container_1',
-                               'requestUrl' => 
json_encode(self::link(array('menuaction' => 'property.uiproject.get_orders',
-                                               'project_id' => $id, 'year' => 
date('Y'), 'phpgw_return_as' => 'json'))),
-                               'data' => json_encode(array()),
+//                             'requestUrl' => 
json_encode(self::link(array('menuaction' => 'property.uiproject.get_orders',
+//                                             'project_id' => $id, 'year' => 
date('Y'), 'phpgw_return_as' => 'json'))),
+                               'requestUrl' => "''",
+                               'data' => json_encode($order_data),
                                'ColumnDefs' => $orders_def,
                                'config' => array(
                        //              array('disableFilter' => true),
-                       //              array('disablePagination' => true)
+                                       array('disablePagination' => true)
                                )
                        );
 
@@ -2256,20 +2278,10 @@
                                return $this->jquery_results($result_data);
                        }
 
-                       $year = phpgw::get_var('year', 'int');
-                       $draw = phpgw::get_var('draw', 'int');
-                       $order = phpgw::get_var('order');
-                       $columns = phpgw::get_var('columns');
-                       $search = phpgw::get_var('search');
-
                        $values = $this->bo->get_orders(array(
-                               'start' => phpgw::get_var('start', 'int', 
'REQUEST', 0),
                                'project_id' => $project_id,
-                               'year' => $year,
-                               'order' => 
$columns[$order[0]['column']]['data'],
-                               'sort' => $order[0]['dir'],
-                               'results' => phpgw::get_var('length', 'int', 
'REQUEST', 0),
-                               'query' => $search['value'],
+                               'year' =>phpgw::get_var('year', 'int'),
+                               'results' => -1,
                                )
                        );
                        foreach ($values as & $_order_entry)
@@ -2287,7 +2299,7 @@
                        $result_data = array('results' => $values);
 
                        $result_data['total_records'] = $total_records;
-                       $result_data['draw'] = $draw;
+                       $result_data['draw'] = phpgw::get_var('draw', 'int');
 
                        return $this->jquery_results($result_data);
                }

Modified: trunk/property/js/portico/project.edit.js
===================================================================
--- trunk/property/js/portico/project.edit.js   2017-10-18 08:24:54 UTC (rev 
17163)
+++ trunk/property/js/portico/project.edit.js   2017-10-18 13:36:13 UTC (rev 
17164)
@@ -79,7 +79,7 @@
                        i : 0;
        };
 
-       var columns = ["3", "4", "6", "7", "8"];
+       var columns = ["4", "5", "7", "8", "9"];
 
        columns.forEach(function (col)
        {
@@ -171,7 +171,7 @@
 
        $("#order_time_span").change(function ()
        {
-               var oArgs1 = {menuaction: 'property.uiproject.get_orders', 
project_id: project_id, year: $(this).val()};
+               var oArgs1 = {menuaction: 'property.uiproject.get_orders', 
project_id: project_id, year: $(this).val(), results: -1};
                var requestUrl1 = phpGWLink('index.php', oArgs1, true);
                JqueryPortico.updateinlineTableHelper(oTable1, requestUrl1);
 

Modified: trunk/property/setup/phpgw_no.lang
===================================================================
--- trunk/property/setup/phpgw_no.lang  2017-10-18 08:24:54 UTC (rev 17163)
+++ trunk/property/setup/phpgw_no.lang  2017-10-18 13:36:13 UTC (rev 17164)
@@ -2242,4 +2242,5 @@
 deadline for start     property        no      Frist for oppstart
 deadline for execution property        no      Frist for ferdigstillelse
 outside contract       property        no      Utenfor rammeavtale
-refund property        no      Refusjon
\ No newline at end of file
+refund property        no      Refusjon
+both   property        no      Begge
\ No newline at end of file

Modified: trunk/property/templates/base/project.xsl
===================================================================
--- trunk/property/templates/base/project.xsl   2017-10-18 08:24:54 UTC (rev 
17163)
+++ trunk/property/templates/base/project.xsl   2017-10-18 13:36:13 UTC (rev 
17164)
@@ -521,7 +521,7 @@
                                                        <label for="name">
                                                                <xsl:value-of 
select="php:function('lang', 'move')"/>
                                                        </label>
-                                                       <input type="text" 
data-validation="number" data-validation-allowing="float" 
data-validation-decimal-separator="{$decimal_separator}" 
name="values[new_project_id]" value="">
+                                                       <input type="text" 
data-validation="number" name="values[new_project_id]" value="">
                                                                <xsl:attribute 
name="title">
                                                                        
<xsl:value-of select="php:function('lang', 'move budget and orders to another 
project')"/>
                                                                </xsl:attribute>
@@ -540,7 +540,7 @@
                                                </label>
                                                <div class="pure-custom">
                                                        <div>
-                                                               <input 
data-validation="number" data-validation-allowing="float" 
data-validation-decimal-separator="{$decimal_separator}" type="text" 
name="values[budget]" value="{value_budget}">
+                                                               <input 
data-validation="number" data-validation-allowing="float,negative" 
data-validation-decimal-separator="{$decimal_separator}" type="text" 
name="values[budget]" value="{value_budget}">
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="php:function('lang', 'Enter the budget')"/>
                                                                        
</xsl:attribute>
@@ -694,7 +694,7 @@
                                                                <label 
for="name">
                                                                        
<xsl:value-of select="lang_reserve"/>
                                                                </label>
-                                                               <input 
data-validation="number" data-validation-allowing="float" 
data-validation-decimal-separator="{$decimal_separator}" type="text" 
name="values[reserve]" value="{value_reserve}">
+                                                               <input 
data-validation="number" data-validation-allowing="float,negative" 
data-validation-decimal-separator="{$decimal_separator}" type="text" 
name="values[reserve]" value="{value_reserve}">
                                                                        
<xsl:attribute name="title">
                                                                                
<xsl:value-of select="lang_reserve_statustext"/>
                                                                        
</xsl:attribute>

Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2017-10-18 08:24:54 UTC (rev 
17163)
+++ trunk/property/templates/base/workorder.xsl 2017-10-18 13:36:13 UTC (rev 
17164)
@@ -926,7 +926,7 @@
                                                <label for="name">
                                                        <xsl:value-of 
select="php:function('lang', 'contract sum')"/>
                                                </label>
-                                               <input type="text" 
data-validation="number" data-validation-allowing="float" 
data-validation-decimal-separator="{$decimal_separator}" 
id="field_contract_sum" name="values[contract_sum]" 
value="{value_contract_sum}">
+                                               <input type="text" 
data-validation="number" data-validation-allowing="float,negative" 
data-validation-decimal-separator="{$decimal_separator}" 
id="field_contract_sum" name="values[contract_sum]" 
value="{value_contract_sum}">
                                                        <xsl:attribute 
name="data-validation">
                                                                
<xsl:text>budget</xsl:text>
                                                        </xsl:attribute>
@@ -954,7 +954,7 @@
                                                <label for="name">
                                                        <xsl:value-of 
select="lang_budget"/>
                                                </label>
-                                               <input type="text" 
data-validation="number"  
data-validation-decimal-separator="{$decimal_separator}" id='field_budget' 
name="values[budget]" value="{value_budget}">
+                                               <input type="text" 
data-validation="number" data-validation-allowing="float,negative" 
data-validation-decimal-separator="{$decimal_separator}" id='field_budget' 
name="values[budget]" value="{value_budget}">
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_budget_statustext"/>
                                                        </xsl:attribute>
@@ -972,7 +972,7 @@
                                                <label for="name">
                                                        <xsl:value-of 
select="lang_addition_rs"/>
                                                </label>
-                                               <input type="text" 
data-validation="number" data-validation-allowing="float" 
data-validation-decimal-separator="{$decimal_separator}" 
name="values[addition_rs]" value="{value_addition_rs}">
+                                               <input type="text" 
data-validation="number" data-validation-allowing="float,negative" 
data-validation-decimal-separator="{$decimal_separator}" 
name="values[addition_rs]" value="{value_addition_rs}">
                                                        <xsl:attribute 
name="title">
                                                                <xsl:value-of 
select="lang_addition_rs_statustext"/>
                                                        </xsl:attribute>




reply via email to

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