[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10666] property: workorder periodizing
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10666] property: workorder periodizing |
Date: |
Sun, 13 Jan 2013 19:48:17 +0000 |
Revision: 10666
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10666
Author: sigurdne
Date: 2013-01-13 19:48:15 +0000 (Sun, 13 Jan 2013)
Log Message:
-----------
property: workorder periodizing
Modified Paths:
--------------
trunk/property/inc/class.boworkorder.inc.php
trunk/property/inc/class.sobudget.inc.php
trunk/property/inc/class.soproject.inc.php
trunk/property/inc/class.soworkorder.inc.php
trunk/property/inc/class.uibudget.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/js/yahoo/workorder.edit.js
trunk/property/setup/setup.inc.php
trunk/property/setup/tables_current.inc.php
trunk/property/setup/tables_update.inc.php
trunk/property/templates/base/workorder.xsl
Modified: trunk/property/inc/class.boworkorder.inc.php
===================================================================
--- trunk/property/inc/class.boworkorder.inc.php 2013-01-12 15:52:12 UTC
(rev 10665)
+++ trunk/property/inc/class.boworkorder.inc.php 2013-01-13 19:48:15 UTC
(rev 10666)
@@ -82,7 +82,8 @@
$b_account =
phpgw::get_var('b_account');
$district_id = phpgw::get_var('district_id',
'int');
$criteria_id = phpgw::get_var('criteria_id',
'int');
- $this->allrows =
phpgw::get_var('allrows', 'bool');
+ $this->allrows = phpgw::get_var('allrows',
'bool');
+ $this->obligation = phpgw::get_var('obligation',
'bool');
$this->start = $start ? $start : 0;
$this->criteria_id = isset($criteria_id) &&
$criteria_id ? $criteria_id : '';
@@ -462,7 +463,8 @@
'wo_hour_cat_id' => $this->wo_hour_cat_id,
'start_date'=>$start_date,'end_date'=>$end_date,'allrows'=>$data['allrows'],
'b_group'=>$this->b_group,'ecodimb'=>$this->ecodimb,
'paid'=>$this->paid,'b_account' => $this->b_account,
- 'district_id' =>
$this->district_id,'dry_run'=>$data['dry_run'], 'criteria' =>
$this->get_criteria($this->criteria_id)));
+ 'district_id' =>
$this->district_id,'dry_run'=>$data['dry_run'], 'criteria' =>
$this->get_criteria($this->criteria_id),
+ 'obligation' => $this->obligation) );
$this->total_records = $this->so->total_records;
Modified: trunk/property/inc/class.sobudget.inc.php
===================================================================
--- trunk/property/inc/class.sobudget.inc.php 2013-01-12 15:52:12 UTC (rev
10665)
+++ trunk/property/inc/class.sobudget.inc.php 2013-01-13 19:48:15 UTC (rev
10666)
@@ -529,7 +529,7 @@
$year = isset($data['year']) ?
(int)$data['year'] : '';
$grouping = isset($data['grouping']) ?
$data['grouping'] : '';
$revision = isset($data['revision']) ?
$data['revision'] : 1;
- $year = isset($data['year']) ?
$data['year'] : '';
+ $year = isset($data['year']) &&
$data['year'] ? (int)$data['year'] : 0;
$cat_id = isset($data['cat_id']) ?
$data['cat_id'] : '';
$details = isset($data['details']) ?
$data['details'] : '';
$dimb_id = isset($data['dimb_id']) &&
$data['dimb_id'] ? (int)$data['dimb_id'] : 0;
@@ -567,6 +567,9 @@
$filtermethod .= " WHERE (fm_workorder.start_date >=
$start_date AND fm_workorder.start_date <= $end_date";
$filtermethod .= " OR fm_workorder_status.closed IS
NULL AND fm_workorder.start_date < $start_date)";
+ $filtermethod = " WHERE (fm_workorder_budget.year =
$year OR fm_workorder_status.closed IS NULL)";
+
+
$where = 'AND';
$cat_ids = array();
@@ -651,17 +654,20 @@
$_taxcode[$this->db->f('id')] =
$this->db->f('percent');
}
- $sql = "SELECT fm_workorder.id,
fm_workorder_status.closed, fm_workorder.budget,
combined_cost,fm_location1.mva,fm_workorder.start_date,"
+ $sql = "SELECT fm_workorder.id,
fm_workorder_status.closed, sum(fm_workorder_budget.budget) AS budget,
sum(fm_workorder_budget.combined_cost) AS combined_cost,"
+ . " fm_location1.mva,fm_workorder.start_date,"
. "
fm_orders_actual_cost_view.actual_cost,pending_cost,
fm_b_account.{$b_account_field} as {$b_account_field}, district_id,
fm_workorder.ecodimb"
. " FROM fm_workorder"
. " {$this->join} fm_workorder_status ON
fm_workorder.status = fm_workorder_status.id"
+ . " {$this->join} fm_workorder_budget ON
(fm_workorder.id = fm_workorder_budget.order_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"
. " {$this->left_join}
fm_orders_actual_cost_view ON fm_workorder.id =
fm_orders_actual_cost_view.order_id"
. " {$this->left_join}
fm_orders_pending_cost_view ON fm_workorder.id =
fm_orders_pending_cost_view.order_id"
. " {$_join_district}"
. " {$this->join} fm_part_of_town ON
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id"
- . " {$filtermethod} {$querymethod} {$where}
{$filtermethod_direction}";
+ . " {$filtermethod} {$querymethod} {$where}
{$filtermethod_direction}"
+ . " GROUP BY fm_workorder.id,
fm_workorder_status.closed,fm_location1.mva,fm_workorder.start_date,fm_orders_actual_cost_view.actual_cost,pending_cost,
fm_b_account.{$b_account_field}, district_id, fm_workorder.ecodimb";
//_debug_array($sql);
//die();
Modified: trunk/property/inc/class.soproject.inc.php
===================================================================
--- trunk/property/inc/class.soproject.inc.php 2013-01-12 15:52:12 UTC (rev
10665)
+++ trunk/property/inc/class.soproject.inc.php 2013-01-13 19:48:15 UTC (rev
10666)
@@ -701,24 +701,31 @@
$sql_filter_period = 'AND
periode IN (' . implode(',', $_year_arr) . ')';
- $sql_workder = 'SELECT
fm_workorder.id, budget, combined_cost, billable_hours, closed,
sum(fm_orders_paid_or_pending_view.amount) AS actual_cost'
+ $sql_workder = "SELECT
fm_workorder.id, sum(fm_workorder_budget.budget) AS budget,
sum(fm_workorder_budget.combined_cost) AS combined_cost,"
+ . " billable_hours, closed,
sum(fm_orders_paid_or_pending_view.amount) AS actual_cost"
. " FROM fm_workorder"
. " {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
+ // . " {$this->join}
fm_workorder_budget ON (fm_workorder.id = fm_workorder_budget.order_id AND year
= '{$filter_year}')"
+ . " {$this->join}
fm_workorder_budget ON (fm_workorder.id = fm_workorder_budget.order_id )"
. " {$this->left_join}
fm_orders_paid_or_pending_view ON (fm_workorder.id =
fm_orders_paid_or_pending_view.order_id {$sql_filter_period})"
- . " WHERE project_id =
'{$project['project_id']}' {$sql_workder_date_filter} "
- . " GROUP BY fm_workorder.id,
budget, combined_cost, billable_hours, closed";
+ . " WHERE project_id =
'{$project['project_id']}' {$sql_workder_date_filter} OR (project_id =
'{$project['project_id']}' AND fm_workorder_status.closed IS NULL)"
+ . " GROUP BY fm_workorder.id,
billable_hours, closed";
//_debug_array($sql_workder);
}
else
{
- $sql_workder = 'SELECT
fm_workorder.id, budget, combined_cost, billable_hours, closed, actual_cost,
pending_cost'//, contract_sum, addition, calculation, budget'
+ $sql_workder = "SELECT
fm_workorder.id, sum(fm_workorder_budget.budget) AS budget,
sum(fm_workorder_budget.combined_cost) AS combined_cost,"
+ . " billable_hours, closed,
actual_cost, pending_cost"
. " FROM fm_workorder"
. " {$this->join}
fm_workorder_status ON fm_workorder.status = fm_workorder_status.id"
+ . " {$this->join}
fm_workorder_budget ON (fm_workorder.id = fm_workorder_budget.order_id)"
. " {$this->left_join}
fm_orders_pending_cost_view ON fm_workorder.id =
fm_orders_pending_cost_view.order_id"
- . " WHERE project_id =
'{$project['project_id']}' {$sql_workder_date_filter}";
+ . " WHERE project_id =
'{$project['project_id']}' {$sql_workder_date_filter}"
+ . " GROUP BY fm_workorder.id,
billable_hours, closed, actual_cost, pending_cost";
+
}
-//_debug_array($sql_workder);
+//~ _debug_array($sql_workder);
$this->db->query($sql_workder,__LINE__,__FILE__);
@@ -821,39 +828,40 @@
if ($this->db->next_record())
{
$project = array
- (
- 'project_id'
=> $this->db->f('id'),
- 'project_type_id'
=> $this->db->f('project_type_id'),
- 'title'
=> $this->db->f('title'),
- 'name'
=> $this->db->f('name'),
- 'location_code'
=> $this->db->f('location_code'),
- 'key_fetch'
=> $this->db->f('key_fetch'),
- 'key_deliver'
=> $this->db->f('key_deliver'),
- 'other_branch'
=> $this->db->f('other_branch'),
- 'key_responsible'
=> $this->db->f('key_responsible'),
- 'descr'
=> $this->db->f('descr', true),
- 'status'
=> $this->db->f('status'),
- 'budget'
=> (int)$this->db->f('budget'),
- // 'planned_cost'
=> (int)$this->db->f('planned_cost'),
- 'reserve'
=> (int)$this->db->f('reserve'),
- 'tenant_id'
=> $this->db->f('tenant_id'),
- 'user_id'
=> $this->db->f('user_id'),
- 'coordinator'
=> $this->db->f('coordinator'),
- 'access'
=> $this->db->f('access'),
- 'start_date'
=> $this->db->f('start_date'),
- 'end_date'
=> $this->db->f('end_date'),
- 'cat_id'
=> $this->db->f('category'),
- 'grants'
=> (int)$this->grants[$this->db->f('user_id')],
- 'p_num'
=> $this->db->f('p_num'),
- 'p_entity_id'
=> $this->db->f('p_entity_id'),
- 'p_cat_id'
=> $this->db->f('p_cat_id'),
- 'contact_phone'
=> $this->db->f('contact_phone'),
- 'project_group'
=> $this->db->f('project_group'),
- 'ecodimb'
=> $this->db->f('ecodimb'),
- 'b_account_id'
=> $this->db->f('account_group'),
- 'contact_id'
=> $this->db->f('contact_id'),
- 'inherit_location'
=> $this->db->f('inherit_location')
- );
+ (
+ 'project_id' =>
$this->db->f('id'),
+ 'project_type_id' =>
$this->db->f('project_type_id'),
+ 'title'
=> $this->db->f('title'),
+ 'name'
=> $this->db->f('name'),
+ 'location_code' =>
$this->db->f('location_code'),
+ 'key_fetch'
=> $this->db->f('key_fetch'),
+ 'key_deliver' =>
$this->db->f('key_deliver'),
+ 'other_branch' =>
$this->db->f('other_branch'),
+ 'key_responsible' =>
$this->db->f('key_responsible'),
+ 'descr'
=> $this->db->f('descr', true),
+ 'status'
=> $this->db->f('status'),
+ 'budget'
=> (int)$this->db->f('budget'),
+ // 'planned_cost' =>
(int)$this->db->f('planned_cost'),
+ 'reserve'
=> (int)$this->db->f('reserve'),
+ 'tenant_id'
=> $this->db->f('tenant_id'),
+ 'user_id'
=> $this->db->f('user_id'),
+ 'coordinator' =>
$this->db->f('coordinator'),
+ 'access'
=> $this->db->f('access'),
+ 'start_date' =>
$this->db->f('start_date'),
+ 'end_date'
=> $this->db->f('end_date'),
+ 'cat_id'
=> $this->db->f('category'),
+ 'grants'
=> (int)$this->grants[$this->db->f('user_id')],
+ 'p_num'
=> $this->db->f('p_num'),
+ 'p_entity_id' =>
$this->db->f('p_entity_id'),
+ 'p_cat_id'
=> $this->db->f('p_cat_id'),
+ 'contact_phone' =>
$this->db->f('contact_phone'),
+ 'project_group' =>
$this->db->f('project_group'),
+ 'ecodimb'
=> $this->db->f('ecodimb'),
+ 'b_account_id' =>
$this->db->f('account_group'),
+ 'contact_id' =>
$this->db->f('contact_id'),
+ 'inherit_location' =>
$this->db->f('inherit_location'),
+ 'periodization_id' =>
$this->db->f('periodization_id')
+ );
if ( isset($values['attributes']) &&
is_array($values['attributes']) )
{
@@ -2485,6 +2493,7 @@
for ($i=0;$i<count($workorder_id);$i++)
{
+ $this->db->query("DELETE FROM
fm_workorder_budget WHERE order_id='{$workorder_id[$i]}'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_wo_hours WHERE
workorder_id='{$workorder_id[$i]}'",__LINE__,__FILE__);
$this->db->query("DELETE FROM
fm_workorder_history WHERE
history_record_id='{$workorder_id[$i]}'",__LINE__,__FILE__);
}
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2013-01-12 15:52:12 UTC
(rev 10665)
+++ trunk/property/inc/class.soworkorder.inc.php 2013-01-13 19:48:15 UTC
(rev 10666)
@@ -138,6 +138,7 @@
$start_date = isset($data['start_date']) &&
$data['start_date'] ? (int)$data['start_date'] : 0;
$end_date = isset($data['end_date']) &&
$data['end_date'] ? (int)$data['end_date'] : 0;
$allrows = isset($data['allrows']) ?
$data['allrows'] : '';
+ $obligation = isset($data['obligation']) ?
$data['obligation'] : '';
$wo_hour_cat_id = isset($data['wo_hour_cat_id']) ?
$data['wo_hour_cat_id'] : '';
$b_group = isset($data['b_group']) ?
$data['b_group'] : '';
$ecodimb = isset($data['ecodimb']) ?
$data['ecodimb'] : '';
@@ -598,8 +599,18 @@
$end_date = $end_date + 3600 * 16 +
phpgwapi_datetime::user_timezone();
$start_date = $start_date - 3600 * 8 +
phpgwapi_datetime::user_timezone();
- $filtermethod .= " $where
fm_workorder.start_date >= $start_date AND fm_workorder.start_date <= $end_date
";
+ $filtermethod .= " $where
(fm_workorder.start_date >= $start_date AND fm_workorder.start_date <=
$end_date";
+ if($obligation)
+ {
+ $filtermethod .= " OR
fm_workorder_status.closed IS NULL)";
+ }
+ else
+ {
+ $filtermethod .= ')';
+ }
+
$where= 'AND';
+
}
$querymethod = '';
@@ -735,10 +746,13 @@
. " {$this->join} fm_workorder_status ON
fm_workorder.status = fm_workorder_status.id"
. ' WHERE fm_workorder.id IN (' . implode(',',
$_order_list ) .') GROUP BY fm_workorder.id, closed';
*/
- $sql_cost = "SELECT fm_workorder.id as
order_id,closed, actual_cost, pending_cost"
+ $sql_cost = "SELECT fm_workorder.id as
order_id,closed, actual_cost, pending_cost,"
+ . " sum(fm_workorder_budget.budget) AS budget,
sum(fm_workorder_budget.combined_cost) AS combined_cost"
. " FROM fm_workorder {$this->left_join}
fm_orders_pending_cost_view ON fm_workorder.id =
fm_orders_pending_cost_view.order_id"
. " {$this->join} fm_workorder_status ON
fm_workorder.status = fm_workorder_status.id"
- . ' WHERE fm_workorder.id IN (' . implode(',',
$_order_list ) .')';
+ . " {$this->join} fm_workorder_budget ON
(fm_workorder.id = fm_workorder_budget.order_id)"
+ . ' WHERE fm_workorder.id IN (' . implode(',',
$_order_list ) .')'
+ . " GROUP BY fm_workorder.id,closed,
actual_cost, pending_cost";
unset($_order_list);
$this->db->query($sql_cost,__LINE__,__FILE__);
@@ -747,6 +761,8 @@
$_actual_cost_arr[$this->db->f('order_id')] = array
(
'actual_cost' =>
$this->db->f('actual_cost') + (float)$this->db->f('pending_cost'),
+ 'budget' =>
$this->db->f('budget'),
+ 'combined_cost' =>
$this->db->f('combined_cost'),
'closed' =>
!!$this->db->f('closed')
);
}
@@ -767,6 +783,9 @@
if
(isset($_actual_cost_arr[$workorder['workorder_id']]))
{
+ $workorder['budget'] =
$_actual_cost_arr[$workorder['workorder_id']]['budget'];
+ $workorder['combined_cost'] =
$_actual_cost_arr[$workorder['workorder_id']]['combined_cost'];
+
$_combined_cost =
$workorder['combined_cost'];
// $_pending_cost =
round($this->db2->f('pending_cost'));
@@ -836,50 +855,60 @@
if ($this->db->next_record())
{
$workorder = array
- (
- 'id'
=> $this->db->f('id'),
- 'workorder_id'
=> $this->db->f('id'), // FIXME
- 'project_id'
=> $this->db->f('project_id'),
- 'title'
=> $this->db->f('title'),
- 'name'
=> $this->db->f('name'),
- 'key_fetch'
=> $this->db->f('key_fetch'),
- 'key_deliver'
=> $this->db->f('key_deliver'),
- 'key_responsible'
=> $this->db->f('key_responsible'),
- 'charge_tenant'
=> $this->db->f('charge_tenant'),
- 'descr'
=> stripslashes($this->db->f('descr')),
- 'status'
=> $this->db->f('status'),
- 'budget'
=> (int)$this->db->f('budget'),
- 'calculation'
=> $this->db->f('calculation'),
- 'b_account_id'
=> (int)$this->db->f('account_id'),
- 'addition_percentage' =>
(int)$this->db->f('addition'),
- 'addition_rs'
=> (int)$this->db->f('rig_addition'),
- // 'act_mtrl_cost'
=> $this->db->f('act_mtrl_cost'),
- // 'act_vendor_cost'
=> $this->db->f('act_vendor_cost'),
- 'user_id'
=> $this->db->f('user_id'),
- 'vendor_id'
=> $this->db->f('vendor_id'),
- // 'coordinator'
=> $this->db->f('coordinator'),
- 'access'
=> $this->db->f('access'),
- 'start_date'
=> $this->db->f('start_date'),
- 'end_date'
=> $this->db->f('end_date'),
- 'cat_id'
=> $this->db->f('category'),
- 'chapter_id'
=> $this->db->f('chapter_id'),
- 'chapter'
=> $this->db->f('chapter'),
- 'deviation'
=> $this->db->f('deviation'),
- 'ecodimb'
=> $this->db->f('ecodimb'),
- 'location_code'
=> $this->db->f('location_code'),
- 'p_num'
=> $this->db->f('p_num'),
- 'p_entity_id'
=> $this->db->f('p_entity_id'),
- 'p_cat_id'
=> $this->db->f('p_cat_id'),
- 'contact_phone'
=> $this->db->f('contact_phone'),
- 'tenant_id'
=> $this->db->f('tenant_id'),
- 'cat_id'
=> $this->db->f('category'),
- 'grants'
=> (int)$this->grants[$this->db->f('user_id')],
- 'billable_hours'
=> $this->db->f('billable_hours'),
- 'contract_sum'
=> $this->db->f('contract_sum'),
- 'approved'
=> $this->db->f('approved'),
- 'mail_recipients'
=> explode(',', trim($this->db->f('mail_recipients'),',')),
- 'actual_cost'
=> $this->db->f('actual_cost')
- );
+ (
+ 'id'
=> $this->db->f('id'),
+ 'workorder_id' =>
$this->db->f('id'), // FIXME
+ 'project_id' =>
$this->db->f('project_id'),
+ 'title'
=> $this->db->f('title'),
+ 'name'
=> $this->db->f('name'),
+ 'key_fetch'
=> $this->db->f('key_fetch'),
+ 'key_deliver' =>
$this->db->f('key_deliver'),
+ 'key_responsible' =>
$this->db->f('key_responsible'),
+ 'charge_tenant' =>
$this->db->f('charge_tenant'),
+ 'descr'
=> stripslashes($this->db->f('descr')),
+ 'status'
=> $this->db->f('status'),
+ 'calculation' =>
$this->db->f('calculation'),
+ 'b_account_id' =>
(int)$this->db->f('account_id'),
+ 'addition_percentage' =>
(int)$this->db->f('addition'),
+ 'addition_rs' =>
(int)$this->db->f('rig_addition'),
+ // 'act_mtrl_cost' =>
$this->db->f('act_mtrl_cost'),
+ // 'act_vendor_cost' =>
$this->db->f('act_vendor_cost'),
+ 'user_id'
=> $this->db->f('user_id'),
+ 'vendor_id'
=> $this->db->f('vendor_id'),
+ // 'coordinator' =>
$this->db->f('coordinator'),
+ 'access'
=> $this->db->f('access'),
+ 'start_date' =>
$this->db->f('start_date'),
+ 'end_date'
=> $this->db->f('end_date'),
+ 'cat_id'
=> $this->db->f('category'),
+ 'chapter_id' =>
$this->db->f('chapter_id'),
+ 'chapter'
=> $this->db->f('chapter'),
+ 'deviation'
=> $this->db->f('deviation'),
+ 'ecodimb'
=> $this->db->f('ecodimb'),
+ 'location_code' =>
$this->db->f('location_code'),
+ 'p_num'
=> $this->db->f('p_num'),
+ 'p_entity_id' =>
$this->db->f('p_entity_id'),
+ 'p_cat_id'
=> $this->db->f('p_cat_id'),
+ 'contact_phone' =>
$this->db->f('contact_phone'),
+ 'tenant_id'
=> $this->db->f('tenant_id'),
+ 'cat_id'
=> $this->db->f('category'),
+ 'grants'
=> (int)$this->grants[$this->db->f('user_id')],
+ 'billable_hours' =>
$this->db->f('billable_hours'),
+ 'approved'
=> $this->db->f('approved'),
+ 'mail_recipients' =>
explode(',', trim($this->db->f('mail_recipients'),',')),
+ 'actual_cost' =>
$this->db->f('actual_cost')
+ );
+
+ $sql = "SELECT periodization_id,"
+ . " sum(fm_workorder_budget.budget) AS
budget, sum(fm_workorder_budget.combined_cost) AS combined_cost,"
+ . "
sum(fm_workorder_budget.contract_sum) AS contract_sum"
+ . " FROM fm_workorder {$this->join}
fm_project ON fm_workorder.project_id = fm_project.id"
+ . " {$this->join} fm_workorder_budget
ON fm_workorder.id = fm_workorder_budget.order_id"
+ . " WHERE fm_workorder.id =
'{$workorder_id}' GROUP BY periodization_id";
+
+ $this->db->query($sql,__LINE__,__FILE__);
+ $this->db->next_record();
+ $workorder['budget'] =
(int)$this->db->f('budget');
+ $workorder['contract_sum'] =
$this->db->f('contract_sum');
}
//_debug_array($workorder);
@@ -1116,6 +1145,7 @@
$workorder['contract_sum'] =
str_replace(array(' ',','),array('','.'),$workorder['contract_sum']);
+ $combined_cost = 0;
if ( abs((int)$workorder['contract_sum']) > 0)
{
$addition = 1 +
((int)$workorder['addition_percentage']/100);
@@ -1164,13 +1194,22 @@
$this->db->query("INSERT INTO fm_orders (id,type)
VALUES ({$id},'workorder')");
+
+/*
$this->db->query("SELECT periodization_id FROM
fm_project WHERE id = {$workorder['project_id']}",__LINE__,__FILE__);
$this->db->next_record();
$periodization_id = $this->db->f('periodization_id');
-
+*/
+ $periodization_id =
isset($workorder['budget_periodization']) && $workorder['budget_periodization']
? (int) $workorder['budget_periodization'] : 0;
// $this->_update_project_budget($workorder['project_id'],
date('Y', $workorder['start_date']), $periodization_id, $combined_cost);
- $this->_update_order_budget($id, date('Y',
$workorder['start_date']), $periodization_id,
$workorder['budget'],$combined_cost);
+ if($combined_cost)
+ {
+ $this->_update_order_budget($id,
$workorder['budget_year'], $periodization_id, $workorder['budget'],
$workorder['contract_sum'], $combined_cost);
+ }
+
+
+
/*
if($workorder['charge_tenant'])
{
@@ -1222,14 +1261,12 @@
$workorder['title'] =
$this->db->db_addslashes($workorder['title']);
$workorder['billable_hours'] =
(float)str_replace(',','.', $workorder['billable_hours']);
- $this->db->query("SELECT
status,budget,calculation,billable_hours,approved,combined_cost FROM
fm_workorder WHERE id = {$workorder['id']}",__LINE__,__FILE__);
+ $this->db->query("SELECT
status,calculation,billable_hours,approved FROM fm_workorder WHERE id =
{$workorder['id']}",__LINE__,__FILE__);
$this->db->next_record();
$old_status =
$this->db->f('status');
- $old_budget =
$this->db->f('budget');
$old_billable_hours =
$this->db->f('billable_hours');
$old_approved = $this->db->f('approved');
- $old_combined_cost = $this->db->f('combined_cost');
if
(isset($GLOBALS['phpgw_info']['user']['preferences']['common']['currency']))
{
@@ -1243,14 +1280,14 @@
$addition = 1 +
((int)$workorder['addition_percentage']/100);
$combined_cost =
(int)$workorder['contract_sum'] * $addition;
}
- else if ($this->db->f('calculation') > 0)
+/* else if ($this->db->f('calculation') > 0)
{
$calculation = $this->db->f('calculation');
$config =
CreateObject('phpgwapi.config','property');
$config->read_repository();
$tax = 1+(($config->config_data['fm_tax'])/100);
$combined_cost = $calculation * $tax;
- }
+ }*/
else
{
$combined_cost = (int)$workorder['budget'];
@@ -1279,7 +1316,7 @@
'end_date' =>
$workorder['end_date'],
'descr' =>
$workorder['descr'],
'budget' =>
(int)$workorder['budget'],
- 'combined_cost' => $combined_cost,
+// 'combined_cost' => $combined_cost,
'key_deliver' =>
$workorder['key_deliver'],
'key_fetch' =>
$workorder['key_fetch'],
'account_id' =>
$workorder['b_account_id'],
@@ -1291,7 +1328,7 @@
'ecodimb' =>
$workorder['ecodimb'],
'category' =>
$workorder['cat_id'],
'billable_hours' =>
$workorder['billable_hours'],
- 'contract_sum' =>
$workorder['contract_sum'],
+// 'contract_sum' =>
$workorder['contract_sum'],
'approved' =>
$workorder['approved'],
'mail_recipients' =>
isset($workorder['vendor_email']) && is_array($workorder['vendor_email']) ?
implode(',', $workorder['vendor_email']) : '',
);
@@ -1343,15 +1380,45 @@
$value_set_invoice =
$this->db->validate_update($value_set_invoice);
$this->db->query("UPDATE fm_ecobilag SET
{$value_set_invoice} WHERE pmwrkord_code = '{$workorder['id']}'"
,__LINE__,__FILE__);
+ if($workorder['delete_b_period'])
+ {
+ $this->db->query("SELECT sum(budget) AS budget
FROM fm_workorder_budget WHERE order_id =
'{$workorder['id']}'",__LINE__,__FILE__);
+ $this->db->next_record();
+ $old_budget =
$this->db->f('budget');
+
$this->delete_period_from_budget($workorder['id'],
$workorder['delete_b_period']);
+
+ $this->db->query("SELECT sum(budget) AS budget
FROM fm_workorder_budget WHERE order_id =
'{$workorder['id']}'",__LINE__,__FILE__);
+ $this->db->next_record();
+ $new_budget =
$this->db->f('budget');
+
+ $historylog->add('B', $workorder['id'],
$new_budget, $old_budget);
+
+ }
+
+/*
$this->db->query("SELECT periodization_id FROM
fm_project WHERE id = {$workorder['project_id']}",__LINE__,__FILE__);
$this->db->next_record();
$periodization_id = $this->db->f('periodization_id');
-
+*/
+ $periodization_id =
isset($workorder['budget_periodization']) && $workorder['budget_periodization']
? (int) $workorder['budget_periodization'] : 0;
// $this->_update_project_budget($workorder['project_id'],
date('Y', $workorder['start_date']), $periodization_id,
$combined_cost,$old_combined_cost);
- $this->_update_order_budget($workorder['id'], date('Y',
$workorder['start_date']), $periodization_id,
$workorder['budget'],$combined_cost);
+ if($combined_cost)
+ {
+ $this->db->query("SELECT sum(budget) AS budget
FROM fm_workorder_budget WHERE order_id =
'{$workorder['id']}'",__LINE__,__FILE__);
+ $this->db->next_record();
+ $old_budget =
$this->db->f('budget');
+ $this->_update_order_budget($workorder['id'],
$workorder['budget_year'], $periodization_id, $workorder['budget'],
$workorder['contract_sum'], $combined_cost);
+ $this->db->query("SELECT sum(budget) AS budget
FROM fm_workorder_budget WHERE order_id =
'{$workorder['id']}'",__LINE__,__FILE__);
+ $this->db->next_record();
+ $new_budget =
$this->db->f('budget');
+
+ $historylog->add('B', $workorder['id'],
$new_budget, $old_budget);
+ }
+
+
/* if($workorder['charge_tenant'])
{
$this->db->query("UPDATE fm_project set
charge_tenant = 1 WHERE id =" . $workorder['project_id']);
@@ -1439,10 +1506,6 @@
}
}
- if ($old_budget != $workorder['budget'])
- {
- $historylog->add('B', $workorder['id'],
$workorder['budget'], $old_budget);
- }
if (isset($workorder['new_project_id']) &&
$workorder['new_project_id'] && ($workorder['new_project_id'] !=
$workorder['project_id']))
{
@@ -1473,12 +1536,12 @@
{
$this->db->transaction_begin();
$this->interlink->delete_at_target('property',
'.project.workorder', $workorder_id, $this->db);
- $this->db->query("DELETE FROM fm_workorder WHERE id='"
. $workorder_id . "'",__LINE__,__FILE__);
+ $this->db->query("DELETE FROM fm_workorder_budget WHERE
order_id='{$workorder_id}'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_workorder_history
WHERE history_record_id='" . $workorder_id . "'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_wo_hours WHERE
workorder_id='" . $workorder_id . "'",__LINE__,__FILE__);
$this->db->query("DELETE FROM fm_orders WHERE id='" .
$workorder_id . "'",__LINE__,__FILE__);
+ $this->db->query("DELETE FROM fm_workorder WHERE id='"
. $workorder_id . "'",__LINE__,__FILE__);
$this->db->transaction_commit();
-
}
public function get_user_list()
@@ -1610,6 +1673,7 @@
$closed_period = array();
$active_period = array();
+ $_dummy_period = '';
$sql = "SELECT fm_workorder_budget.budget,
fm_workorder_budget.combined_cost, year, month, closed"
. " FROM fm_workorder {$this->join} fm_workorder_status
ON fm_workorder.status = fm_workorder_status.id"
@@ -1618,7 +1682,6 @@
$this->db->query($sql,__LINE__,__FILE__);
$order_budget = array();
- $_dummy_year = date('Y');
while ($this->db->next_record())
{
$period = sprintf("%s%02d",
@@ -1642,8 +1705,7 @@
$active_period[$period] = true;
}
-
- if ( $order_budget )
+// if ( $order_budget )
{
$sql = "SELECT order_id, periode, amount AS
actual_cost"
. " FROM fm_workorder {$this->join}
fm_orders_paid_or_pending_view ON fm_workorder.id =
fm_orders_paid_or_pending_view.order_id"
@@ -1656,6 +1718,7 @@
if(!$periode)
{
$periode = date('Ym');
+ $_dummy_period = $_dummy_period
? $_dummy_period : $periode;
}
$year = substr( $periode, 0, 4 );
@@ -1683,12 +1746,8 @@
if(!$_found)
{
- $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]['year'] = substr( $_dummy_period, 0, 4 );
+
$order_budget[$_dummy_period]['month'] = substr( $_dummy_period, -2);
$order_budget[$_dummy_period]['actual_cost'] += $this->db->f('actual_cost');
}
}
@@ -1795,7 +1854,25 @@
return $values;
}
+
/**
+ * Delete entries from periodized workorder budget
+ *
+ * @return void
+ */
+
+ function delete_period_from_budget($order_id, $data)
+ {
+ foreach($data as $entry)
+ {
+ $when = explode('_', $entry);
+ $sql = "DELETE FROM fm_workorder_budget WHERE
order_id = {$order_id} AND year = " . (int) $when[0] . ' AND month = ' . (int)
$when[1];
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+ }
+
+
+ /**
* Recalculate actual cost from payment history for all
workorders
*
* @return void
@@ -1859,7 +1936,12 @@
$tax = 1+(($config->config_data['fm_tax'])/100);
// $this->db->query("UPDATE fm_project_budget SET
order_amount = 0",__LINE__,__FILE__);
+/**
+ * FIXME: won't work for periodized order that last several years
+ *
+ **/
+/*
foreach ($orders as $id => $dummy)
{
$this->db->query("SELECT project_id,
start_date, combined_cost, budget,calculation,contract_sum,addition,ecodimb
FROM fm_workorder WHERE id = {$id}",__LINE__,__FILE__);
@@ -1905,9 +1987,9 @@
}
// $this->_update_project_budget($project_id,
date('Y', $start_date), $periodization_id, $combined_cost);
- $this->_update_order_budget($id, date('Y',
$start_date), $periodization_id, $budget, $combined_cost);
+ $this->_update_order_budget($id, date('Y',
$start_date), $periodization_id, $budget, $contract_sum, $combined_cost);
}
-
+*/
$config = CreateObject('phpgwapi.config','property');
$config->read_repository();
@@ -1984,19 +2066,25 @@
**/
public function update_order_budget($order_id)
{
- $this->db->query("SELECT fm_workorder.start_date,
periodization_id, fm_workorder.budget, combined_cost"
+ $this->db->query("SELECT fm_workorder_budget.year,
periodization_id,"
+ . " sum(fm_workorder_budget.budget) AS budget,
sum(fm_workorder_budget.combined_cost) AS combined_cost,"
+ . " sum(fm_workorder_budget.contract_sum) AS
contract_sum"
. " FROM fm_workorder {$this->join} fm_project ON
fm_workorder.project_id = fm_project.id"
- . " WHERE fm_workorder.id =
'{$order_id}'",__LINE__,__FILE__);
- $this->db->next_record();
- $start_date =
$this->db->f('start_date');
- $periodization_id =
(int)$this->db->f('periodization_id');
- $budget =
$this->db->f('budget');
- $combined_cost = $this->db->f('combined_cost');
+ . " {$this->join} fm_workorder_budget ON
fm_workorder.id = fm_workorder_budget.order_id"
+ . " WHERE fm_workorder.id = '{$order_id}' GROUP BY
year, periodization_id",__LINE__,__FILE__);
- $this->_update_order_budget($order_id, date('Y',
$start_date), $periodization_id, $budget,$combined_cost);
+ while($this->db->next_record())
+ {
+ $start_date =
$this->db->f('start_date');
+ $periodization_id =
(int)$this->db->f('periodization_id');
+ $budget =
$this->db->f('budget');
+ $contract_sum =
$this->db->f('contract_sum');
+ $combined_cost =
$this->db->f('combined_cost');
+ $this->_update_order_budget($order_id,
date('Y', $start_date), $periodization_id, $budget, $contract_sum,
$combined_cost);
+ }
}
- private function _update_order_budget($order_id, $year,
$periodization_id, $budget, $combined_cost = 0)
+ private function _update_order_budget($order_id, $year,
$periodization_id, $budget, $contract_sum, $combined_cost = 0)
{
$order_id = $order_id;//might be bigint
$year = $year ? (int) $year : date('Y');
@@ -2030,7 +2118,7 @@
);
}
- $sql = "DELETE FROM fm_workorder_budget WHERE order_id
= '{$order_id}'";
+ $sql = "DELETE FROM fm_workorder_budget WHERE order_id
= '{$order_id}' AND year = {$year}";
$this->db->query($sql,__LINE__,__FILE__);
foreach ($periodization_outline as $outline)
@@ -2039,18 +2127,22 @@
{
$partial_budget = $budget *
$outline['dividend'] / $outline['divisor'];
$partial_cost = $combined_cost *
$outline['dividend'] / $outline['divisor'];
+ $partial_contract = $contract_sum *
$outline['dividend'] / $outline['divisor'];
+
}
else
{
$partial_budget = $budget *
$outline['value'] / 100;
$partial_cost = $combined_cost *
$outline['value'] / 100;
+ $partial_contract = $contract_sum *
$outline['value'] / 100;
+
}
- $this->_update_budget($order_id, $year,
$outline['month'], $partial_budget, $partial_cost);
+ $this->_update_budget($order_id, $year,
$outline['month'], $partial_budget, $partial_contract, $partial_cost);
}
}
- private function _update_budget($order_id, $year, $month,
$budget,$combined_cost)
+ private function _update_budget($order_id, $year, $month,
$budget,$contract_sum,$combined_cost)
{
$month = (int) $month;
$budget = (int) $budget;
@@ -2061,7 +2153,7 @@
$this->db->query($sql,__LINE__,__FILE__);
if ($this->db->next_record())
{
- $sql = "UPDATE fm_workorder_budget SET budget =
'{$budget}', combined_cost = '{$combined_cost}', modified_date = {$now} WHERE
order_id = '{$order_id}' AND year = {$year} AND month = {$month}";
+ $sql = "UPDATE fm_workorder_budget SET budget =
'{$budget}', contract_sum ='{$contract_sum}', combined_cost =
'{$combined_cost}', modified_date = {$now} WHERE order_id = '{$order_id}' AND
year = {$year} AND month = {$month}";
$this->db->query($sql,__LINE__,__FILE__);
}
else
@@ -2072,6 +2164,7 @@
'year' =>
$year,
'month' =>
$month,
'budget' =>
$budget,
+ 'contract_sum' =>
$contract_sum,
'combined_cost' =>
$combined_cost,
'user_id' =>
$this->account,
'entry_date' => $now,
@@ -2080,6 +2173,8 @@
$cols = implode(',', array_keys($value_set));
$values =
$this->db->validate_insert(array_values($value_set));
+//_debug_array($values);die();
+
$this->db->query("INSERT INTO
fm_workorder_budget ({$cols}) VALUES ({$values})",__LINE__,__FILE__);
}
}
Modified: trunk/property/inc/class.uibudget.inc.php
===================================================================
--- trunk/property/inc/class.uibudget.inc.php 2013-01-12 15:52:12 UTC (rev
10665)
+++ trunk/property/inc/class.uibudget.inc.php 2013-01-13 19:48:15 UTC (rev
10666)
@@ -1346,7 +1346,7 @@
'budget_cost'
=> number_format($entry['budget_cost'], 0, ',', ' '),
'obligation_ex'
=> $entry['obligation'],
'obligation'
=> number_format($entry['obligation'], 0, ',', ' '),
- 'link_obligation'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiworkorder.index', 'filter'=>'all', 'paid'=>1, 'district_id'=>
$entry['district_id'], 'b_group'=> $entry['grouping'], 'b_account'
=>$entry['b_account'], 'start_date'=> $start_date, 'end_date'=> $end_date,
'ecodimb' => $entry['ecodimb'], 'status_id' => 'all')),
+ 'link_obligation'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiworkorder.index', 'filter'=>'all', 'paid'=>1, 'district_id'=>
$entry['district_id'], 'b_group'=> $entry['grouping'], 'b_account'
=>$entry['b_account'], 'start_date'=> $start_date, 'end_date'=> $end_date,
'ecodimb' => $entry['ecodimb'], 'status_id' => 'all', 'obligation' => true)),
'actual_cost_ex'
=> $entry['actual_cost'],
'actual_cost'
=> number_format($entry['actual_cost'], 0, ',', ' '),
'link_actual_cost'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiinvoice.consume', 'district_id'=> $entry['district_id'],
'b_account_class'=> $entry['grouping'], 'b_account' =>$entry['b_account'],
'start_date'=> $start_date, 'end_date'=> $end_date, 'ecodimb' =>
$entry['ecodimb'], 'submit_search'=>true)),
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2013-01-12 15:52:12 UTC
(rev 10665)
+++ trunk/property/inc/class.uiworkorder.inc.php 2013-01-13 19:48:15 UTC
(rev 10666)
@@ -104,6 +104,7 @@
$this->b_account =
$this->bo->b_account;
$this->district_id =
$this->bo->district_id;
$this->criteria_id =
$this->bo->criteria_id;
+ $this->obligation =
$this->bo->obligation;
}
function save_sessiondata()
@@ -246,7 +247,8 @@
'b_group'
=> $this->b_group,
'paid'
=> $this->paid,
'district_id' =>
$this->district_id,
- 'criteria_id' =>
$this->criteria_id
+ 'criteria_id' =>
$this->criteria_id,
+ 'obligation' =>
$this->obligation
));
$datatable['config']['allow_allrows'] = false;
@@ -262,6 +264,7 @@
."b_account:'{$this->b_account}',"
."ecodimb:'{$this->ecodimb}',"
."filter:'{$this->filter}',"
+ ."obligation:'{$this->obligation}',"
."status_id:'{$this->status_id}',"
."second_display:1,"
."criteria_id:'{$this->criteria_id}',"
@@ -1361,10 +1364,7 @@
if($id)
{
$record_history =
$this->bo->read_record_history($id);
- $content_budget = $this->bo->get_budget($id);
//_debug_array($content_budget);die();
-
-
}
else
{
@@ -1787,7 +1787,28 @@
//---------
+ $content_budget = $this->bo->get_budget($id);
+ $lang_delete = lang('Check to delete period');
+ $lang_close = lang('Check to close period');
+ $lang_active = lang('Check to activate period');
+
+ foreach($content_budget as & $b_entry)
+ {
+ $checked = $b_entry['closed'] ?
'checked="checked"' : '';
+ $checked2 = $b_entry['active'] ?
'checked="checked"' : '';
+
+ $b_entry['flag_active'] = $b_entry['active'];
+ $b_entry['delete_period'] = "<input
type='checkbox' name='values[delete_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' title='{$lang_delete}'>";
+ $b_entry['closed'] = "<input type='checkbox'
name='values[closed_b_period][]' value='{$b_entry['year']}_{$b_entry['month']}'
title='{$lang_close}' $checked>";
+ $b_entry['closed_orig'] = "<input
type='checkbox' name='values[closed_orig_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' $checked>";
+ $b_entry['active'] = "<input type='checkbox'
name='values[active_b_period][]' value='{$b_entry['year']}_{$b_entry['month']}'
title='{$lang_active}' $checked2>";
+ $b_entry['active_orig'] = "<input
type='checkbox' name='values[active_orig_b_period][]'
value='{$b_entry['year']}_{$b_entry['month']}' $checked2>";
+
+ }
+ unset($b_entry);
+
+
$datavalues[] = array
(
'name'
=> "5",
@@ -1816,8 +1837,8 @@
//~ 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')
+
array('key' => 'flag_active','hidden' => true),
+
array('key' =>
'delete_period','label'=>lang('Delete'),'sortable'=>false,'resizeable'=>true,'formatter'=>'FormatterCenter')
)
)
@@ -1877,186 +1898,194 @@
$year++;
}
+ if(isset($receipt['error']) && $receipt['error'])
+ {
+ $year_list = $this->bocommon->select_list(
$_POST['values']['budget_year'], $year_list );
+ }
+ $sogeneric =
CreateObject('property.sogeneric');
+ $sogeneric->get_location_info('periodization',false);
+ $periodization_data =
$sogeneric->read_single(array('id' =>
(int)$project['periodization_id']),array());
+
$data = array
- (
- 'year_list'
=> array('options' => $year_list),
- 'mode'
=> $mode,
- 'value_coordinator'
=> $value_coordinator,
- 'event_data'
=> $event_data,
- 'link_claim'
=> $link_claim,
- 'lang_claim'
=> lang('claim'),
- 'suppressmeter'
=> isset($config->config_data['project_suppressmeter'])
&& $config->config_data['project_suppressmeter'] ? 1 : '',
- 'suppresscoordination'
=> $suppresscoordination,
- 'property_js'
=>
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
- 'datatable'
=> $datavalues,
- 'myColumnDefs'
=> $myColumnDefs,
- 'myButtons'
=> $myButtons,
- 'tabs'
=>
self::_generate_tabs(array(),array('documents' => $id?false:true, 'history' =>
$id?false:true),$selected_tab),
- 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
- 'value_origin'
=> isset($values['origin']) ? $values['origin'] : '',
- 'value_origin_type'
=> isset($origin)?$origin:'',
- 'value_origin_id'
=> isset($origin_id)?$origin_id:'',
+ (
+ 'periodization_data'
=> $periodization_data,
+ 'year_list'
=> array('options' => $year_list),
+ 'mode'
=> $mode,
+ 'value_coordinator'
=> $value_coordinator,
+ 'event_data'
=> $event_data,
+ 'link_claim'
=> $link_claim,
+ 'lang_claim'
=> lang('claim'),
+ 'suppressmeter'
=> isset($config->config_data['project_suppressmeter']) &&
$config->config_data['project_suppressmeter'] ? 1 : '',
+ 'suppresscoordination'
=> $suppresscoordination,
+ 'property_js'
=>
json_encode($GLOBALS['phpgw_info']['server']['webserver_url']."/property/js/yahoo/property2.js"),
+ 'datatable'
=> $datavalues,
+ 'myColumnDefs'
=> $myColumnDefs,
+ 'myButtons'
=> $myButtons,
+ 'tabs'
=> self::_generate_tabs(array(),array('documents' =>
$id?false:true, 'history' => $id?false:true),$selected_tab),
+ 'msgbox_data'
=> $GLOBALS['phpgw']->common->msgbox($msgbox_data),
+ 'value_origin'
=> isset($values['origin']) ? $values['origin'] : '',
+ 'value_origin_type'
=> isset($origin)?$origin:'',
+ 'value_origin_id'
=> isset($origin_id)?$origin_id:'',
+ 'calculate_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiwo_hour.index')),
+ 'lang_calculate'
=> lang('Calculate Workorder'),
+ 'lang_calculate_statustext'
=> lang('Calculate workorder by adding items from vendors prizebook or
adding general hours'),
- 'calculate_action'
=>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiwo_hour.index')),
- 'lang_calculate'
=> lang('Calculate Workorder'),
- 'lang_calculate_statustext'
=> lang('Calculate workorder by adding items from vendors
prizebook or adding general hours'),
+ 'send_action'
=>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uiwo_hour.view',
'from'=>'index')),
+ 'lang_send'
=> $this->bo->order_sent_adress ? lang('ReSend
Workorder') :lang('Send Workorder'),
+ 'lang_send_statustext'
=> lang('send this workorder to vendor'),
- 'send_action'
=>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>'property.uiwo_hour.view',
'from'=>'index')),
- 'lang_send'
=> $this->bo->order_sent_adress ? lang('ReSend
Workorder') :lang('Send Workorder'),
- 'lang_send_statustext'
=> lang('send this workorder to vendor'),
+ 'project_link'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.edit')),
+ 'b_group_data'
=> $b_group_data,
+ 'b_account_data'
=> $b_account_data,
- 'project_link'
=>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiproject.edit')),
- 'b_group_data'
=> $b_group_data,
- 'b_account_data'
=> $b_account_data,
+ 'lang_start_date_statustext'
=> lang('Select the estimated end date for the Project'),
+ 'lang_start_date'
=> lang('Workorder start date'),
+ 'value_start_date'
=> $values['start_date'],
- 'lang_start_date_statustext'
=> lang('Select the estimated end date for the Project'),
- 'lang_start_date'
=> lang('Workorder start date'),
- 'value_start_date'
=> $values['start_date'],
+ 'lang_end_date_statustext'
=> lang('Select the estimated end date for the Project'),
+ 'lang_end_date'
=> lang('Workorder end date'),
+ 'value_end_date'
=> $values['end_date'],
- 'lang_end_date_statustext'
=> lang('Select the estimated end date for the Project'),
- 'lang_end_date'
=> lang('Workorder end date'),
- 'value_end_date'
=> $values['end_date'],
+ 'lang_copy_workorder'
=> lang('Copy workorder ?'),
+ 'lang_copy_workorder_statustext'
=> lang('Choose Copy Workorder to copy this workorder to a new workorder'),
- 'lang_copy_workorder'
=> lang('Copy workorder ?'),
- 'lang_copy_workorder_statustext'
=> lang('Choose Copy Workorder to copy this workorder to a new
workorder'),
+ 'lang_contact_phone'
=> lang('Contact phone'),
+ 'contact_phone'
=>
(isset($project['contact_phone'])?$project['contact_phone']:''),
- 'lang_contact_phone'
=> lang('Contact phone'),
- 'contact_phone'
=>
(isset($project['contact_phone'])?$project['contact_phone']:''),
+ 'lang_charge_tenant'
=> lang('Charge tenant'),
+ 'lang_charge_tenant_statustext'
=> lang('Choose charge tenant if the tenant i to pay for this project'),
+ 'charge_tenant'
=>
(isset($values['charge_tenant'])?$values['charge_tenant']:''),
- 'lang_charge_tenant'
=> lang('Charge tenant'),
- 'lang_charge_tenant_statustext'
=> lang('Choose charge tenant if the tenant i to pay for this project'),
- 'charge_tenant'
=>
(isset($values['charge_tenant'])?$values['charge_tenant']:''),
+ 'lang_power_meter'
=> lang('Power meter'),
+ 'lang_power_meter_statustext'
=> lang('Enter the power meter'),
+ 'value_power_meter'
=> (isset($project['power_meter'])?$project['power_meter']:''),
- 'lang_power_meter'
=> lang('Power meter'),
- 'lang_power_meter_statustext'
=> lang('Enter the power meter'),
- 'value_power_meter'
=>
(isset($project['power_meter'])?$project['power_meter']:''),
+ 'lang_addition_rs'
=> lang('Rig addition'),
+ 'lang_addition_rs_statustext'
=> lang('Enter any round sum addition per order'),
+ 'value_addition_rs'
=> (isset($values['addition_rs'])?$values['addition_rs']:''),
- 'lang_addition_rs'
=> lang('Rig addition'),
- 'lang_addition_rs_statustext'
=> lang('Enter any round sum addition per order'),
- 'value_addition_rs'
=>
(isset($values['addition_rs'])?$values['addition_rs']:''),
+ 'lang_addition_percentage'
=> lang('Percentage addition'),
+ 'lang_addition_percentage_statustext' =>
lang('Enter any persentage addition per unit'),
+ 'value_addition_percentage'
=>
(isset($values['addition_percentage'])?$values['addition_percentage']:''),
- 'lang_addition_percentage'
=> lang('Percentage addition'),
- 'lang_addition_percentage_statustext'
=> lang('Enter any persentage addition per unit'),
- 'value_addition_percentage'
=>
(isset($values['addition_percentage'])?$values['addition_percentage']:''),
+ 'lang_budget'
=> lang('Budget'),
+ 'value_budget'
=> isset($receipt['error']) && $receipt['error'] ?
$_POST['values']['budget'] : '',
+ 'lang_budget_statustext'
=> lang('Enter the budget'),
- 'lang_budget'
=> lang('Budget'),
- 'value_budget'
=> (isset($values['budget'])?$values['budget']:''),
- 'lang_budget_statustext'
=> lang('Enter the budget'),
-
- 'lang_incl_tax'
=> lang('incl tax'),
- 'lang_calculation'
=> lang('Calculation'),
- 'value_calculation'
=>
(isset($values['calculation'])?$values['calculation']:''),
- 'value_sum_estimated_cost'
=> $sum_estimated_cost,
+ 'lang_incl_tax'
=> lang('incl tax'),
+ 'lang_calculation'
=> lang('Calculation'),
+ 'value_calculation'
=> (isset($values['calculation'])?$values['calculation']:''),
+ 'value_sum_estimated_cost'
=> $sum_estimated_cost,
- 'value_contract_sum'
=> $values['contract_sum'],
+ 'value_contract_sum'
=> isset($receipt['error']) && $receipt['error'] ?
$_POST['values']['contract_sum'] : '',
- 'actual_cost'
=>
(isset($values['actual_cost'])?$values['actual_cost']:''),
- 'lang_actual_cost'
=> lang('Actual cost'),
- 'ecodimb_data'
=> $ecodimb_data,
- 'vendor_data'
=> $vendor_data,
- 'location_data'
=> $location_data,
- 'location_template_type'
=> $location_template_type,
- 'form_action'
=> $mode == 'edit' ?
$GLOBALS['phpgw']->link('/index.php',$link_data) :
$GLOBALS['phpgw']->link('/home.php'),//avoid accidents
- 'done_action'
=>
$GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiworkorder.index')),
- 'lang_year'
=> lang('Year'),
- 'lang_save'
=> lang('save'),
- 'lang_done'
=> lang('done'),
- 'lang_title'
=> lang('Title'),
- 'value_title'
=> $values['title'],
- 'lang_project_name'
=> lang('Project name'),
- 'value_project_name'
=> (isset($project['name'])?$project['name']:''),
+ 'actual_cost'
=> (isset($values['actual_cost'])?$values['actual_cost']:''),
+ 'lang_actual_cost'
=> lang('Actual cost'),
+ 'ecodimb_data'
=> $ecodimb_data,
+ 'vendor_data'
=> $vendor_data,
+ 'location_data'
=> $location_data,
+ 'location_template_type'
=> $location_template_type,
+ 'form_action'
=> $mode == 'edit' ?
$GLOBALS['phpgw']->link('/index.php',$link_data) :
$GLOBALS['phpgw']->link('/home.php'),//avoid accidents
+ 'done_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property.uiworkorder.index')),
+ 'lang_year'
=> lang('Year'),
+ 'lang_save'
=> lang('save'),
+ 'lang_done'
=> lang('done'),
+ 'lang_title'
=> lang('Title'),
+ 'value_title'
=> $values['title'],
+ 'lang_project_name'
=> lang('Project name'),
+ 'value_project_name'
=> (isset($project['name'])?$project['name']:''),
- 'lang_project_id'
=> lang('Project ID'),
- 'value_project_id'
=> $values['project_id'],
+ 'lang_project_id'
=> lang('Project ID'),
+ 'value_project_id'
=> $values['project_id'],
- 'lang_workorder_id'
=> lang('Workorder ID'),
- 'value_workorder_id'
=> (isset($id)?$id:''),
+ 'lang_workorder_id'
=> lang('Workorder ID'),
+ 'value_workorder_id'
=> (isset($id)?$id:''),
- 'lang_title_statustext'
=> lang('Enter Workorder title'),
+ 'lang_title_statustext'
=> lang('Enter Workorder title'),
- 'lang_other_branch'
=> lang('Other branch'),
- 'lang_other_branch_statustext'
=> lang('Enter other branch if not found in the list'),
- 'value_other_branch'
=>
(isset($project['other_branch'])?$project['other_branch']:''),
+ 'lang_other_branch'
=> lang('Other branch'),
+ 'lang_other_branch_statustext'
=> lang('Enter other branch if not found in the list'),
+ 'value_other_branch'
=> (isset($project['other_branch'])?$project['other_branch']:''),
- 'lang_descr_statustext'
=> lang('Enter a short description of the workorder'),
- 'lang_descr'
=> lang('Description'),
- 'value_descr'
=> $values['descr'],
+ 'lang_descr_statustext'
=> lang('Enter a short description of the workorder'),
+ 'lang_descr'
=> lang('Description'),
+ 'value_descr'
=> $values['descr'],
- 'lang_remark_statustext'
=> lang('Enter a remark to add to the history of the order'),
- 'lang_remark'
=> lang('remark'),
- 'value_remark'
=> (isset($values['remark'])?$values['remark']:''),
+ 'lang_remark_statustext'
=> lang('Enter a remark to add to the history of the order'),
+ 'lang_remark'
=> lang('remark'),
+ 'value_remark'
=> (isset($values['remark'])?$values['remark']:''),
- 'lang_done_statustext'
=> lang('Back to the list'),
- 'lang_save_statustext'
=> lang('Save the workorder'),
- // 'lang_no_cat'
=> lang('Select category'),
- // 'lang_cat_statustext'
=> lang('Select the category the project belongs to. To
do not use a category select NO CATEGORY'),
- // 'select_name'
=> 'values[cat_id]',
- // 'value_cat_id'
=>
(isset($values['cat_id'])?$values['cat_id']:''),
- // 'cat_list'
=> $categories['cat_list'],
+ 'lang_done_statustext'
=> lang('Back to the list'),
+ 'lang_save_statustext'
=> lang('Save the workorder'),
+ // 'lang_no_cat'
=> lang('Select category'),
+ // 'lang_cat_statustext'
=> lang('Select the category the project belongs to. To do not
use a category select NO CATEGORY'),
+ // 'select_name'
=> 'values[cat_id]',
+ // 'value_cat_id'
=> (isset($values['cat_id'])?$values['cat_id']:''),
+ // 'cat_list'
=> $categories['cat_list'],
- 'lang_cat_sub'
=> lang('category'),
- 'cat_sub_list'
=> $this->bocommon->select_list($values['cat_id'] ?
$values['cat_id']: $project['cat_id'], $cat_sub),
- 'cat_sub_name'
=> 'values[cat_id]',
- 'lang_cat_sub_statustext'
=> lang('select sub category'),
+ 'lang_cat_sub'
=> lang('category'),
+ 'cat_sub_list'
=> $this->bocommon->select_list($values['cat_id'] ?
$values['cat_id']: $project['cat_id'], $cat_sub),
+ 'cat_sub_name'
=> 'values[cat_id]',
+ 'lang_cat_sub_statustext'
=> lang('select sub category'),
- 'sum_workorder_budget'
=>
(isset($values['sum_workorder_budget'])?$values['sum_workorder_budget']:''),
- 'workorder_budget'
=>
(isset($values['workorder_budget'])?$values['workorder_budget']:''),
+ 'sum_workorder_budget'
=>
(isset($values['sum_workorder_budget'])?$values['sum_workorder_budget']:''),
+ 'workorder_budget'
=>
(isset($values['workorder_budget'])?$values['workorder_budget']:''),
- 'lang_coordinator'
=> lang('Coordinator'),
- 'lang_sum'
=> lang('Sum'),
- 'select_user_name'
=> 'values[coordinator]',
- 'user_list'
=> array('options' => $user_list),
- 'status_list'
=>
$this->bo->select_status_list('select',$values['status']),
- 'status_name'
=> 'values[status]',
- 'lang_no_status'
=> lang('Select status'),
- 'lang_status'
=> lang('Status'),
- 'lang_status_statustext'
=> lang('What is the current status of this workorder ?'),
- 'lang_confirm_status'
=> lang('Confirm status'),
- 'lang_confirm_statustext'
=> lang('Confirm status to the history'),
+ 'lang_coordinator'
=> lang('Coordinator'),
+ 'lang_sum'
=> lang('Sum'),
+ 'select_user_name'
=> 'values[coordinator]',
+ 'user_list'
=> array('options' => $user_list),
+ 'status_list'
=> $this->bo->select_status_list('select',$values['status']),
+ 'status_name'
=> 'values[status]',
+ 'lang_no_status'
=> lang('Select status'),
+ 'lang_status'
=> lang('Status'),
+ 'lang_status_statustext'
=> lang('What is the current status of this workorder ?'),
+ 'lang_confirm_status'
=> lang('Confirm status'),
+ 'lang_confirm_statustext'
=> lang('Confirm status to the history'),
- 'branch_list'
=>
$boproject->select_branch_p_list($project['project_id']),
- 'lang_branch'
=> lang('branch'),
- 'lang_branch_statustext'
=> lang('Select the branches for this project'),
+ 'branch_list'
=> $boproject->select_branch_p_list($project['project_id']),
+ 'lang_branch'
=> lang('branch'),
+ 'lang_branch_statustext'
=> lang('Select the branches for this project'),
- 'key_responsible_list'
=> $boproject->select_branch_list($project['key_responsible']),
- 'lang_key_responsible'
=> lang('key responsible'),
+ 'key_responsible_list'
=> $boproject->select_branch_list($project['key_responsible']),
+ 'lang_key_responsible'
=> lang('key responsible'),
- 'key_fetch_list'
=>
$this->bo->select_key_location_list((isset($values['key_fetch'])?$values['key_fetch']:'')),
- 'lang_no_key_fetch'
=> lang('Where to fetch the key'),
- 'lang_key_fetch'
=> lang('key fetch location'),
- 'lang_key_fetch_statustext'
=> lang('Select where to fetch the key'),
+ 'key_fetch_list'
=>
$this->bo->select_key_location_list((isset($values['key_fetch'])?$values['key_fetch']:'')),
+ 'lang_no_key_fetch'
=> lang('Where to fetch the key'),
+ 'lang_key_fetch'
=> lang('key fetch location'),
+ 'lang_key_fetch_statustext'
=> lang('Select where to fetch the key'),
- 'key_deliver_list'
=>
$this->bo->select_key_location_list((isset($values['key_deliver'])?$values['key_deliver']:'')),
- 'lang_no_key_deliver'
=> lang('Where to deliver the key'),
- 'lang_key_deliver'
=> lang('key deliver location'),
- 'lang_key_deliver_statustext'
=> lang('Select where to deliver the key'),
+ 'key_deliver_list'
=>
$this->bo->select_key_location_list((isset($values['key_deliver'])?$values['key_deliver']:'')),
+ 'lang_no_key_deliver'
=> lang('Where to deliver the key'),
+ 'lang_key_deliver'
=> lang('key deliver location'),
+ 'lang_key_deliver_statustext'
=> lang('Select where to deliver the key'),
- 'value_approved'
=> isset($values['approved']) ? $values['approved'] :
'',
- 'need_approval'
=> $need_approval,
- 'lang_ask_approval'
=> lang('Ask for approval'),
- 'lang_ask_approval_statustext'
=> lang('Check this to send a mail to your supervisor for approval'),
- 'value_approval_mail_address'
=> $supervisor_email,
- 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
- 'link_view_file'
=>
$GLOBALS['phpgw']->link('/index.php',$link_file_data),
- 'link_to_files'
=>
(isset($config->config_data['files_url'])?$config->config_data['files_url']:''),
- 'files'
=> isset($values['files'])?$values['files']:'',
- 'lang_files'
=> lang('files'),
- 'lang_filename'
=> lang('Filename'),
- 'lang_file_action'
=> lang('Delete file'),
- 'lang_view_file_statustext'
=> lang('click to view file'),
- 'lang_file_action_statustext'
=> lang('Check to delete file'),
- 'lang_upload_file'
=> lang('Upload file'),
- 'lang_file_statustext'
=> lang('Select file to upload'),
- 'value_billable_hours'
=> $values['billable_hours'],
- 'base_java_url'
=>
"{menuaction:'property.bocommon.get_vendor_email',phpgw_return_as:'json'}",
- 'base_java_notify_url'
=>
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:'{$id}'}",
- 'edit_action'
=>
$GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'property.uiworkorder.edit', 'id' => $id)),
- 'lang_edit_statustext'
=> lang('Edit this entry '),
- 'lang_edit'
=> lang('Edit'),
- 'value_extra_mail_address'
=> $value_extra_mail_address,
- 'lean'
=> $_lean ? 1 : 0
- );
+ 'value_approved'
=> isset($values['approved']) ? $values['approved'] : '',
+ 'need_approval'
=> $need_approval,
+ 'lang_ask_approval'
=> lang('Ask for approval'),
+ 'lang_ask_approval_statustext'
=> lang('Check this to send a mail to your supervisor for approval'),
+ 'value_approval_mail_address'
=> $supervisor_email,
+ 'currency'
=>
$GLOBALS['phpgw_info']['user']['preferences']['common']['currency'],
+ 'link_view_file'
=> $GLOBALS['phpgw']->link('/index.php',$link_file_data),
+ 'link_to_files'
=>
(isset($config->config_data['files_url'])?$config->config_data['files_url']:''),
+ 'files'
=> isset($values['files'])?$values['files']:'',
+ 'lang_files'
=> lang('files'),
+ 'lang_filename'
=> lang('Filename'),
+ 'lang_file_action'
=> lang('Delete file'),
+ 'lang_view_file_statustext'
=> lang('click to view file'),
+ 'lang_file_action_statustext'
=> lang('Check to delete file'),
+ 'lang_upload_file'
=> lang('Upload file'),
+ 'lang_file_statustext'
=> lang('Select file to upload'),
+ 'value_billable_hours'
=> $values['billable_hours'],
+ 'base_java_url'
=>
"{menuaction:'property.bocommon.get_vendor_email',phpgw_return_as:'json'}",
+ 'base_java_notify_url'
=>
"{menuaction:'property.notify.update_data',location_id:{$location_id},location_item_id:'{$id}'}",
+ 'edit_action'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction' =>
'property.uiworkorder.edit', 'id' => $id)),
+ 'lang_edit_statustext'
=> lang('Edit this entry '),
+ 'lang_edit'
=> lang('Edit'),
+ 'value_extra_mail_address'
=> $value_extra_mail_address,
+ 'lean'
=> $_lean ? 1 : 0
+ );
$appname
= lang('Workorder');
Modified: trunk/property/js/yahoo/workorder.edit.js
===================================================================
--- trunk/property/js/yahoo/workorder.edit.js 2013-01-12 15:52:12 UTC (rev
10665)
+++ trunk/property/js/yahoo/workorder.edit.js 2013-01-13 19:48:15 UTC (rev
10666)
@@ -2,6 +2,9 @@
var myPaginator_1, myDataTable_1;
var myPaginator_2, myDataTable_2;
var myPaginator_3, myDataTable_3;
+var myPaginator_4, myDataTable_4;
+var myPaginator_5, myDataTable_5;
+
var lightbox;
var vendor_id;
@@ -72,6 +75,8 @@
this.myParticularRenderEvent = function()
{
this.addFooterDatatable(myPaginator_2,myDataTable_2);
+ this.addFooterDatatable5(myPaginator_5,myDataTable_5);
+
}
this.showlightbox_manual_invoide = function(workorder_id)
@@ -136,6 +141,66 @@
myfoot.appendChild(newTR);
}
+ this.getTotalSum_active =
function(name_column,round,paginator,datatable)
+ {
+ if(!paginator.getPageRecords())
+ {
+ return '0,00';
+ }
+ begin = end = 0;
+ end = datatable.getRecordSet().getLength();
+
+ tmp_sum = 0;
+ for(i = begin; i < end; i++)
+ {
+
if(datatable.getRecordSet().getRecords(0)[i].getData('flag_active'))
+ {
+ tmp_sum = tmp_sum +
parseFloat(datatable.getRecordSet().getRecords(0)[i].getData(name_column));
+ }
+ }
+
+ return tmp_sum = YAHOO.util.Number.format(tmp_sum,
{decimalPlaces:round, decimalSeparator:",", thousandsSeparator:" "});
+ }
+
+
+ this.addFooterDatatable5 = function(paginator,datatable)
+ {
+ tmp_sum1 = getTotalSum_active('budget',0,paginator,datatable);
+ // tmp_sum2 =
getTotalSum_active('sum_orders',0,paginator,datatable);
+ tmp_sum3 =
getTotalSum_active('sum_oblications',0,paginator,datatable);
+ tmp_sum4 =
getTotalSum_active('actual_cost',0,paginator,datatable);
+ tmp_sum5 = getTotalSum_active('diff',0,paginator,datatable);
+ tmp_sum6 =
getTotalSum_active('deviation',0,paginator,datatable);
+
+ if(typeof(tableYUI0)=='undefined')
+ {
+ tableYUI0 =
YAHOO.util.Dom.getElementsByClassName("yui-dt-data","tbody")[1].parentNode;
+ tableYUI0.setAttribute("id","tableYUI0");
+ }
+ else
+ {
+ tableYUI0.deleteTFoot();
+ }
+
+ //Create ROW
+ newTR = document.createElement('tr');
+
+ td_sum('Sum');
+ td_empty(1);
+ td_sum(tmp_sum1);
+// td_sum(tmp_sum2);
+ td_sum(tmp_sum3);
+ td_sum(tmp_sum4);
+ td_sum(tmp_sum5);
+ td_sum(tmp_sum6);
+ td_empty(9);
+
+ myfoot = tableYUI0.createTFoot();
+ myfoot.setAttribute("id","myfoot");
+ myfoot.appendChild(newTR);
+ }
+
+
/********************************************************************************/
/********************************************************************************/
Modified: trunk/property/setup/setup.inc.php
===================================================================
--- trunk/property/setup/setup.inc.php 2013-01-12 15:52:12 UTC (rev 10665)
+++ trunk/property/setup/setup.inc.php 2013-01-13 19:48:15 UTC (rev 10666)
@@ -12,7 +12,7 @@
*/
$setup_info['property']['name'] = 'property';
- $setup_info['property']['version'] = '0.9.17.661';
+ $setup_info['property']['version'] = '0.9.17.662';
$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 2013-01-12 15:52:12 UTC (rev
10665)
+++ trunk/property/setup/tables_current.inc.php 2013-01-13 19:48:15 UTC (rev
10666)
@@ -556,7 +556,9 @@
'year' => array('type' => 'int','precision' =>
4,'nullable' => False),
'month' => array('type' => 'int','precision' =>
2,'nullable' => False,'default' => 0),
'budget' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' =>
'0.00'),
+ 'contract_sum' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' =>
'0.00'),
'combined_cost' => array('type' =>
'decimal','precision' => '20','scale' => '2','nullable' => True,'default' =>
'0.00'),
+ 'active' => array('type' => 'int','precision'
=> 2,'nullable' => True),
'user_id' => array('type' => 'int','precision'
=> 4,'nullable' => True),
'entry_date' => array('type' =>
'int','precision' => 4,'nullable' => True),
'modified_date' => array('type' =>
'int','precision' => 4,'nullable' => True)
Modified: trunk/property/setup/tables_update.inc.php
===================================================================
--- trunk/property/setup/tables_update.inc.php 2013-01-12 15:52:12 UTC (rev
10665)
+++ trunk/property/setup/tables_update.inc.php 2013-01-13 19:48:15 UTC (rev
10666)
@@ -7215,3 +7215,39 @@
return $GLOBALS['setup_info']['property']['currentver'];
}
}
+
+ /**
+ * Update property version from 0.9.17.661 to 0.9.17.662
+ * Add year and active-flag to project_buffer_budget
+ */
+ $test[] = '0.9.17.661';
+ function property_upgrade0_9_17_661()
+ {
+ $GLOBALS['phpgw_setup']->oProc->m_odb->transaction_begin();
+
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder_budget','active',array(
+ 'type' => 'int',
+ 'precision' => 2,
+ 'nullable' => true,
+ 'default' => 1
+ )
+ );
+
+
$GLOBALS['phpgw_setup']->oProc->AddColumn('fm_workorder_budget','contract_sum',
array(
+ 'type' => 'decimal',
+ 'precision' => '20',
+ 'scale' => '2',
+ 'nullable' => True,
+ 'default' => '0.00'
+ )
+ );
+
+ $GLOBALS['phpgw_setup']->oProc->query('UPDATE
fm_workorder_budget SET active = 1',__LINE__,__FILE__);
+
+ if($GLOBALS['phpgw_setup']->oProc->m_odb->transaction_commit())
+ {
+ $GLOBALS['setup_info']['property']['currentver'] =
'0.9.17.662';
+ return $GLOBALS['setup_info']['property']['currentver'];
+ }
+ }
Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2013-01-12 15:52:12 UTC (rev
10665)
+++ trunk/property/templates/base/workorder.xsl 2013-01-13 19:48:15 UTC (rev
10666)
@@ -580,13 +580,19 @@
<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>
+
<xsl:choose>
+
<xsl:when test="periodization_data/id !=''">
+
<td>
+
<input type="checkbox"
name="values[budget_periodization]" value="{periodization_data/id}"
checked='checked'>
+
<xsl:attribute name="title">
+
<xsl:value-of
select="php:function('lang', 'periodization')"/>
+
<xsl:text>::</xsl:text>
+
<xsl:value-of
select="periodization_data/descr"/>
+
</xsl:attribute>
+
</input>
+
</td>
+
</xsl:when>
+
</xsl:choose>
</tr>
</table>
</td>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10666] property: workorder periodizing,
Sigurd Nes <=