[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [9278] property: actual cost
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [9278] property: actual cost |
Date: |
Fri, 04 May 2012 11:56:58 +0000 |
Revision: 9278
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=9278
Author: sigurdne
Date: 2012-05-04 11:56:57 +0000 (Fri, 04 May 2012)
Log Message:
-----------
property: actual cost
Modified Paths:
--------------
trunk/property/inc/class.soXport.inc.php
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.soworkorder.inc.php
trunk/property/inc/export/default/Agresso
trunk/property/inc/export/default/Basware_X114
trunk/property/js/portico/ajax_workorder_edit.js
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php 2012-05-04 10:48:44 UTC (rev
9277)
+++ trunk/property/inc/class.soXport.inc.php 2012-05-04 11:56:57 UTC (rev
9278)
@@ -760,6 +760,30 @@
}
+ public function
update_actual_cost_from_archive($orders_affected)
+ {
+ $orders = array();
+ if($orders_affected)
+ {
+ $sql = 'SELECT order_id, actual_cost FROM
fm_orders_actual_cost_view WHERE order_id IN (' . implode(','
array_keys($orders_affected)) . ')';
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ while ($this->db->next_record())
+ {
+ $orders[] = array
+ (
+ 'order_id' =>
$this->db->f('order_id'),
+ 'actual_cost' =>
$this->db->f('actual_cost')
+ );
+ }
+
+ foreach ($orders as $order)
+ {
+ $this->db->query("UPDATE fm_workorder
SET actual_cost = '{$order['actual_cost']}' WHERE id =
'{$order['order_id']}'",__LINE__,__FILE__);
+ }
+ }
+ }
+
// Oppdater beløp på arbeidsordre
// operator="-" ved tilbakerulling
public function correct_actual_cost($order_id, $amount,
$actual_cost_field, $operator)
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2012-05-04 10:48:44 UTC (rev
9277)
+++ trunk/property/inc/class.soproject.inc.php 2012-05-04 11:56:57 UTC (rev
9278)
@@ -663,11 +663,9 @@
$project['actual_cost'] = 0;
$project['billable_hours'] = 0;
- $sql_workder = 'SELECT contract_sum,
addition, calculation, budget,'
- . '
fm_orders_actual_cost_view.actual_cost,'
+ $sql_workder = 'SELECT contract_sum,
addition, calculation, budget, actual_cost,'
. ' billable_hours,closed'
. " FROM fm_workorder {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
- . " {$this->left_join}
fm_orders_actual_cost_view ON fm_workorder.id =
fm_orders_actual_cost_view.order_id"
. " WHERE project_id =
'{$project['project_id']}'";
$this->db->query($sql_workder);
@@ -846,11 +844,10 @@
{
$project_id = (int) $project_id;
$budget = array();
- $this->db->query("SELECT fm_workorder.title,
fm_orders_actual_cost_view.actual_cost, fm_workorder.budget, fm_workorder.id as
workorder_id,fm_workorder.contract_sum,"
+ $this->db->query("SELECT fm_workorder.title,
fm_workorder.actual_cost, fm_workorder.budget, fm_workorder.id as
workorder_id,fm_workorder.contract_sum,"
. " fm_workorder.vendor_id,
fm_workorder.calculation,fm_workorder.rig_addition,fm_workorder.addition,fm_workorder.deviation,fm_workorder.charge_tenant,"
. " fm_workorder_status.descr as status,
fm_workorder.account_id as b_account_id"
. " FROM fm_workorder {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
- . " {$this->left_join}
fm_orders_actual_cost_view ON fm_workorder.id =
fm_orders_actual_cost_view.order_id"
. " WHERE project_id={$project_id}");
while ($this->db->next_record())
@@ -1832,18 +1829,15 @@
$table = 'fm_workorder';
$status_table = 'fm_workorder_status';
$title_field = 'fm_workorder.title';
+ $actual_cost = ',actual_cost';
$join_method = "{$this->join}
{$status_table} ON {$table}.status = {$status_table}.id";
if($paid)
{
$join_method .= "
{$this->join} fm_orders_actual_cost_view ON fm_workorder.id =
fm_orders_actual_cost_view.order_id";
+ $actual_cost =
',fm_orders_actual_cost_view.actual_cost';
}
- else
- {
- $join_method .= "
{$this->left_join} fm_orders_actual_cost_view ON fm_workorder.id =
fm_orders_actual_cost_view.order_id";
- }
- $actual_cost =
',fm_orders_actual_cost_view.actual_cost';
$this->_update_status_workorder($execute, $status_new, $ids);
$sql = "SELECT {$table}.id,
$status_table.descr as status ,{$title_field},start_date {$actual_cost} FROM
{$table}"
. " {$join_method}"
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2012-05-04 10:48:44 UTC
(rev 9277)
+++ trunk/property/inc/class.soworkorder.inc.php 2012-05-04 11:56:57 UTC
(rev 9278)
@@ -274,9 +274,6 @@
$joinmethod .= " {$this->join}
fm_workorder_status ON (fm_workorder.status = fm_workorder_status.id))";
$paranthesis .='(';
- $joinmethod .= " {$this->left_join}
fm_orders_actual_cost_view ON (fm_workorder.id =
fm_orders_actual_cost_view.order_id))";
- $paranthesis .='(';
-
$cols .= ',fm_vendor.org_name';
$cols_return[] = 'org_name';
$uicols['input_type'][] = 'hidden';
@@ -303,8 +300,7 @@
$uicols['classname'][] = 'rightClasss';
$uicols['sortable'][] = true;
-// $cols .= ',fm_workorder.act_mtrl_cost +
fm_workorder.act_vendor_cost as actual_cost';
-// $cols .=
',fm_orders_actual_cost_view.actual_cost';
+ $cols .= ',fm_workorder.actual_cost';
$cols_return[] = 'actual_cost';
$uicols['input_type'][] = 'text';
$uicols['name'][] =
'actual_cost';
@@ -315,7 +311,7 @@
$uicols['datatype'][] = '';
$uicols['formatter'][] =
'myFormatCount2';
$uicols['classname'][] = 'rightClasss';
- $uicols['sortable'][] = false;
+ $uicols['sortable'][] = true;
$joinmethod .= " {$this->left_join} fm_vendor
ON (fm_workorder.vendor_id = fm_vendor.id))";
$paranthesis .='(';
@@ -418,7 +414,7 @@
$ordermethod = " ORDER BY
fm_workorder.id {$sort}";
break;
case 'actual_cost':
- $order_field =
',fm_orders_actual_cost_view.actual_cost';
+ $order_field =
',fm_workorder.actual_cost';
break;
case 'address':
if(isset($GLOBALS['phpgw']->config->config_data['location_at_workorder']) &&
$GLOBALS['phpgw']->config->config_data['location_at_workorder'])
@@ -508,7 +504,7 @@
{
$filtermethod .= " $where
fm_wo_hours_category.id=$wo_hour_cat_id ";
$where= 'AND';
- $group_method = " group by
fm_project.id,{$location_table}.location_code,fm_workorder.id,workorder_id,title,fm_workorder.status,fm_workorder.entry_date,user_lid,fm_workorder.vendor_id,project_owner,{$location_table}.address,fm_vendor.org_name,fm_workorder.combined_cost,fm_orders_actual_cost_view.actual_cost,fm_workorder.act_vendor_cost";
+ $group_method = " group by
fm_project.id,{$location_table}.location_code,fm_workorder.id,workorder_id,title,fm_workorder.status,fm_workorder.entry_date,user_lid,fm_workorder.vendor_id,project_owner,{$location_table}.address,fm_vendor.org_name,fm_workorder.combined_cost,fm_workorder.actual_cost,fm_workorder.act_vendor_cost";
}
if ($b_group)
Modified: trunk/property/inc/export/default/Agresso
===================================================================
--- trunk/property/inc/export/default/Agresso 2012-05-04 10:48:44 UTC (rev
9277)
+++ trunk/property/inc/export/default/Agresso 2012-05-04 11:56:57 UTC (rev
9278)
@@ -38,6 +38,7 @@
var $old_files_deleted;
var $debug;
+ protected $orders_affected = array();
function export_conv()
{
@@ -390,6 +391,8 @@
if($BilagOverf[$i]['pmwrkord_code'])
{
+
$orders_affected[$BilagOverf[$i]['pmwrkord_code']] = true;
+
$Belop = sprintf("%01.2f",
$BilagOverf[$i]['ordrebelop'])*100;
if ($BilagOverf[$i]['dimd'] % 2 == 0)
@@ -698,6 +701,8 @@
if($oRsUnderbilag[$i]['pmwrkord_code'])
{
+
$orders_affected[$BilagOverf[$i]['pmwrkord_code']] = true;
+
//Oppdater beløp på arbeidsordre
if ($download=='on' &&
!$pre_transfer)
{
@@ -916,6 +921,8 @@
if($transfer_ok)
{
+
$this->soXport->update_actual_cost_from_archive($this->orders_affected);
+
$this->db->transaction_commit();
$message = 'Ankomstregistrering:
periode: '.$periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' .
$Filnavn;
}
Modified: trunk/property/inc/export/default/Basware_X114
===================================================================
--- trunk/property/inc/export/default/Basware_X114 2012-05-04 10:48:44 UTC
(rev 9277)
+++ trunk/property/inc/export/default/Basware_X114 2012-05-04 11:56:57 UTC
(rev 9278)
@@ -42,6 +42,7 @@
var $client_code = 14;
protected $connection = false;
protected $global_lock = false;
+ protected $orders_affected = array();
function __construct()
{
@@ -456,6 +457,8 @@
if($line['pmwrkord_code'])
{
+
$orders_affected[$line['pmwrkord_code']] = true;
+
$Belop = sprintf("%01.2f",
$line['ordrebelop'])*100;
if ($line['dimd'] % 2 == 0)
@@ -732,6 +735,8 @@
if($line['order_id'])
{
+ $orders_affected[$line['order_id']] =
true;
+
//Oppdater beløp på arbeidsordre
if ($download=='on')
{
@@ -891,6 +896,8 @@
if($transfer_ok)
{
+
$this->soXport->update_actual_cost_from_archive($this->orders_affected);
+
if ( !$this->global_lock )
{
$this->db->transaction_commit();
Modified: trunk/property/js/portico/ajax_workorder_edit.js
===================================================================
--- trunk/property/js/portico/ajax_workorder_edit.js 2012-05-04 10:48:44 UTC
(rev 9277)
+++ trunk/property/js/portico/ajax_workorder_edit.js 2012-05-04 11:56:57 UTC
(rev 9278)
@@ -80,6 +80,10 @@
});
$("#workorder_cancel").live("submit", function(e){
+ if($("#lean").val() == 0)
+ {
+ return;
+ }
e.preventDefault();
parent.closeJS_remote();
// parent.hide_popupBox();
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2012-05-04 10:48:44 UTC (rev 9277)
+++ trunk/property/setup/setup.inc.php 2012-05-04 11:56:57 UTC (rev 9278)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.644';
+ $setup_info['property']['version'] = '0.9.17.645';
$setup_info['property']['app_order'] = 8;
$setup_info['property']['enable'] = 1;
$setup_info['property']['app_group'] = 'office';
Modified: trunk/property/setup/tables_current.inc.php
===================================================================
--- trunk/property/setup/tables_current.inc.php 2012-05-04 10:48:44 UTC (rev
9277)
+++ trunk/property/setup/tables_current.inc.php 2012-05-04 11:56:57 UTC (rev
9278)
@@ -505,6 +505,7 @@
'deviation' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True),
'act_mtrl_cost' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' =>
'0.00'),
'act_vendor_cost' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' =>
'0.00'),
+ 'actual_cost' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' =>
'0.00'),
'addition' => array('type' => 'int','precision'
=> '4','nullable' => True),
'rig_addition' => array('type' =>
'int','precision' => '4','nullable' => True),
'account_id' => array('type' =>
'varchar','precision' => '20','nullable' => True),
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2012-05-04 10:48:44 UTC (rev
9277)
+++ trunk/property/setup/tables_update.inc.php 2012-05-04 11:56:57 UTC (rev
9278)
@@ -6303,7 +6303,7 @@
'ecodimb' =>
$GLOBALS['phpgw_setup']->oProc->f('ecodimb'),
'user_id' =>
$GLOBALS['phpgw_setup']->oProc->f('account_id'),
'role_id' =>
$GLOBALS['phpgw_setup']->oProc->f('responsibility_id') == 2 ? 3 : 2,
- 'default_user' =>
$GLOBALS['phpgw_setup']->oProc->f('responsibility_id') == 2 ? 1 : '',
+ 'default_user' =>
$GLOBALS['phpgw_setup']->oProc->f('responsibility_id') == 2 ? 1 : '',
'active_from' =>
$GLOBALS['phpgw_setup']->oProc->f('active_from'),
'active_to' =>
$GLOBALS['phpgw_setup']->oProc->f('active_to'),
'created_on' =>
$GLOBALS['phpgw_setup']->oProc->f('created_on'),
@@ -6350,3 +6350,48 @@
}
}
+ /**
+ * Update property version from 0.9.17.643 to 0.9.17.644
+ * Add view on fm_ecobilag
+ */
+ $test[] = '0.9.17.644';
+ function property_upgrade0_9_17_644()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+ $GLOBALS['phpgw_setup']->oProc->query("DELETE FROM fm_cache");
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder','actual_cost',array(
+ 'type' => 'decimal',
+ 'precision' => '20',
+ 'scale' => '2',
+ 'nullable' => true,
+ 'default' => '0.00'
+ )
+ );
+
+ $sql = 'SELECT order_id, actual_cost FROM
fm_orders_actual_cost_view';
+ $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+ $orders = array();
+ while ($GLOBALS['phpgw_setup']->oProc->next_record())
+ {
+ $orders[] = array
+ (
+ 'order_id' =>
$GLOBALS['phpgw_setup']->oProc->f('order_id'),
+ 'actual_cost' =>
$GLOBALS['phpgw_setup']->oProc->f('actual_cost')
+ );
+ }
+ foreach ($orders as $order)
+ {
+ $GLOBALS['phpgw_setup']->oProc->query("UPDATE
fm_workorder SET actual_cost = '{$order['actual_cost']}' WHERE id =
'{$order['order_id']}'",__LINE__,__FILE__);
+ }
+
+ $GLOBALS['phpgw_setup']->oProc->query($sql,__LINE__,__FILE__);
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.645';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
+
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [9278] property: actual cost,
Sigurd Nes <=