fmsystem-commits
[Top][All Lists]
Advanced

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

[Fmsystem-commits] [16977] Property: more on budget reporting


From: sigurdne
Subject: [Fmsystem-commits] [16977] Property: more on budget reporting
Date: Mon, 14 Aug 2017 10:45:54 -0400 (EDT)

Revision: 16977
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=16977
Author:   sigurdne
Date:     2017-08-14 10:45:53 -0400 (Mon, 14 Aug 2017)
Log Message:
-----------
Property: more on budget reporting

Modified Paths:
--------------
    trunk/property/inc/class.boinvoice.inc.php
    trunk/property/inc/class.sobudget.inc.php
    trunk/property/inc/class.uiinvoice.inc.php
    trunk/property/inc/class.uiworkorder.inc.php

Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php  2017-08-14 12:03:17 UTC (rev 
16976)
+++ trunk/property/inc/class.boinvoice.inc.php  2017-08-14 14:45:53 UTC (rev 
16977)
@@ -40,6 +40,7 @@
                public $results = 0;
                public $allrows = false;
                public $debug = false;
+               public $b_account;
 
                /**
                 *
@@ -276,12 +277,22 @@
                        $start_date = 
$this->bocommon->date_to_timestamp($start_date);
                        $end_date = 
$this->bocommon->date_to_timestamp($end_date);
 
-                       $invoice = $this->so->read_consume(array('start' => 
$this->start, 'query' => $this->query,
-                               'sort' => $this->sort, 'order' => $this->order,
-                               'user_lid' => $this->user_lid, 'cat_id' => 
$this->cat_id,
-                               'start_date' => $start_date, 'end_date' => 
$end_date, 'vendor_id' => $vendor_id,
-                               'loc1' => $loc1, 'workorder_id' => 
$workorder_id, 'b_account_class' => $b_account_class,
-                               'district_id' => $district_id, 'b_account' => 
$this->b_account, 'ecodimb' => $ecodimb));
+                       $invoice = $this->so->read_consume(array(
+                               'start' => $this->start,
+                               'query' => $this->query,
+                               'sort' => $this->sort,
+                               'order' => $this->order,
+                               'user_lid' => $this->user_lid,
+                               'cat_id' => $this->cat_id,
+                               'start_date' => $start_date,
+                               'end_date' => $end_date,
+                               'vendor_id' => $vendor_id,
+                               'loc1' => $loc1,
+                               'workorder_id' => $workorder_id,
+                               'b_account_class' => $b_account_class,
+                               'district_id' => $district_id,
+                               'b_account' => $this->b_account,
+                               'ecodimb' => $ecodimb));
 
                        $this->total_records = $this->so->total_records;
 

Modified: trunk/property/inc/class.sobudget.inc.php
===================================================================
--- trunk/property/inc/class.sobudget.inc.php   2017-08-14 12:03:17 UTC (rev 
16976)
+++ trunk/property/inc/class.sobudget.inc.php   2017-08-14 14:45:53 UTC (rev 
16977)
@@ -644,7 +644,7 @@
                                $_taxcode[$this->db->f('id')] = 
$this->db->f('percent');
                        }
 
-                       $sql = "SELECT DISTINCT fm_workorder.id AS id, 
fm_location1.mva,project_id,"
+                       $sql = "SELECT DISTINCT fm_workorder.id AS id, 
fm_location1.mva,fm_workorder.project_id,"
                                . " fm_b_account.{$b_account_field} AS 
b_account, district_id, fm_project.ecodimb"
                                . " FROM fm_workorder"
                                . " {$this->join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
@@ -682,6 +682,42 @@
                                        'b_account' => 
$this->db->f('b_account'),
                                );
                        }
+
+                       //In case of missing budget
+
+                       $filtermethod_payment = "WHERE periode >= 
$start_periode AND periode <= $end_periode";
+                       $sql = "SELECT DISTINCT fm_workorder.id AS id, 
fm_location1.mva,fm_workorder.project_id,"
+                               . " fm_b_account.{$b_account_field} AS 
b_account, district_id, fm_project.ecodimb"
+                               . " FROM fm_workorder"
+                               . " {$this->join} fm_workorder_status ON 
fm_workorder.status = fm_workorder_status.id"
+                               . " {$this->join} fm_ecobilagoverf ON 
fm_ecobilagoverf.pmwrkord_code = fm_workorder.id"
+                               . " {$this->join} fm_b_account ON 
fm_workorder.account_id = fm_b_account.id"
+                               . " {$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}"
+                               . " ORDER BY fm_workorder.id ASC";
+
+                       $this->db->query($sql, __LINE__, __FILE__);
+                       while ($this->db->next_record())
+                       {
+                               $_id = $this->db->f('id');
+                               $district_id = $filter_district_id ? 
(int)$this->db->f('district_id') : 0;
+
+                               $projects[$this->db->f('project_id')] = 0;
+                               $projects2[$_id] = $this->db->f('project_id');
+
+                               $_temp_paid_info[$_id] = array
+                                       (
+                                       'actual_cost' => 0,
+                                       'mva' => (int)$this->db->f('mva'),
+                                       'district_id' => $district_id,
+                                       'ecodimb' => 
(int)$this->db->f('ecodimb'),
+                                       'b_account' => 
$this->db->f('b_account'),
+                               );
+                       }
+
+
                        ksort($projects);
 //_debug_array(count($projects2));
 //_debug_array($projects2);
@@ -717,7 +753,7 @@
                                                $_actual_cost = 
round($budget['actual_cost'] / $_taxfactor);
 
                                                //for testing
-                                               if($budget['sum_oblications'])
+                                               if($budget['actual_cost'])
                                                {
                                                        $obligation_orders[] = 
$order_id;
                                                }

Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php  2017-08-14 12:03:17 UTC (rev 
16976)
+++ trunk/property/inc/class.uiinvoice.inc.php  2017-08-14 14:45:53 UTC (rev 
16977)
@@ -160,7 +160,7 @@
                        $district_id = phpgw::get_var('district_id', 'int');
                        $b_account_class = phpgw::get_var('b_account_class', 
'int');
                        $b_account = phpgw::get_var('b_account', 'int');
-                       $b_account_class = $b_account_class ? $b_account_class 
: substr($b_account, 0, 2);
+       //              $b_account_class = $b_account_class ? $b_account_class 
: substr($b_account, 0, 2);
                        $ecodimb = phpgw::get_var('ecodimb');
 
                        $values_combo_box[0] = $this->bo->select_category('', 
$this->cat_id);
@@ -2078,7 +2078,7 @@
                        $district_id = phpgw::get_var('district_id', 'int');
                        $b_account_class = phpgw::get_var('b_account_class', 
'int');
                        $b_account = phpgw::get_var('b_account', 'int');
-                       $b_account_class = $b_account_class ? $b_account_class 
: substr($b_account, 0, 2);
+//                     $b_account_class = $b_account_class ? $b_account_class 
: substr($b_account, 0, 2);
                        $ecodimb = phpgw::get_var('ecodimb');
                        $draw = phpgw::get_var('draw', 'int');
 
@@ -2356,7 +2356,7 @@
                        $b_account_class = phpgw::get_var('b_account_class', 
'int');
                        $b_account = phpgw::get_var('b_account', 'int');
 
-                       $b_account_class = $b_account_class ? $b_account_class 
: substr($b_account, 0, 2);
+               //      $b_account_class = $b_account_class ? $b_account_class 
: substr($b_account, 0, 2);
                        $ecodimb = phpgw::get_var('ecodimb');
 
                        //-- ubica focus del menu derecho
@@ -2417,6 +2417,7 @@
                                                'district_id' => $district_id,
                                                'ecodimb' => $ecodimb,
                                                'b_account_class' => 
$b_account_class,
+                                               'b_account'     => $b_account,
                                                'phpgw_return_as' => 'json'
                                        )),
                                        'allrows' => true,

Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php        2017-08-14 12:03:17 UTC 
(rev 16976)
+++ trunk/property/inc/class.uiworkorder.inc.php        2017-08-14 14:45:53 UTC 
(rev 16977)
@@ -425,6 +425,7 @@
                                                'start_date' => $start_date,
                                                'end_date' => $end_date,
                                                'b_group' => $this->b_group,
+                                               'b_account' => $this->b_account,
                                                'paid' => $this->paid,
                                                'obligation' => 
$this->obligation,
                                                'ecodimb'       => 
$this->ecodimb,
@@ -435,6 +436,7 @@
                                                'start_date' => $start_date,
                                                'end_date' => $end_date,
                                                'b_group' => $this->b_group,
+                                               'b_account' => $this->b_account,
                                                'paid' => $this->paid,
                                                'obligation' => 
$this->obligation,
                                                'ecodimb'       => 
$this->ecodimb,




reply via email to

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