[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [10682] property: invoice handling
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [10682] property: invoice handling |
Date: |
Thu, 17 Jan 2013 15:51:40 +0000 |
Revision: 10682
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=10682
Author: sigurdne
Date: 2013-01-17 15:51:39 +0000 (Thu, 17 Jan 2013)
Log Message:
-----------
property: invoice handling
Modified Paths:
--------------
trunk/property/inc/class.sowo_hour.inc.php
trunk/property/inc/class.soworkorder.inc.php
trunk/property/inc/export/default/Basware_X114
Modified: trunk/property/inc/class.sowo_hour.inc.php
===================================================================
--- trunk/property/inc/class.sowo_hour.inc.php 2013-01-17 10:11:36 UTC (rev
10681)
+++ trunk/property/inc/class.sowo_hour.inc.php 2013-01-17 15:51:39 UTC (rev
10682)
@@ -741,16 +741,32 @@
}
$this->db->transaction_begin();
- $this->db->query("UPDATE fm_workorder SET calculation =
'$calculation' WHERE id=$id",__LINE__,__FILE__);
+ $this->db->query("UPDATE fm_workorder SET calculation =
'{$calculation}' WHERE id = '{$id}'",__LINE__,__FILE__);
if($calculation > 0)
{
- $config =
CreateObject('phpgwapi.config','property');
+ $soworkorder =
CreateObject('property.soworkorder');
+ $config =
CreateObject('phpgwapi.config','property');
$config->read();
$tax = 1+(($config->config_data['fm_tax'])/100);
$calculation = $calculation * $tax;
- $this->db->query("UPDATE fm_workorder SET
combined_cost = '$calculation' WHERE id=$id",__LINE__,__FILE__);
+ $this->db->query("UPDATE fm_workorder SET
combined_cost = '{$calculation}' WHERE id = '{$id}'",__LINE__,__FILE__);
+
+ $this->db->query("SELECT sum(budget) AS budget,
sum(contract_sum) as contract_sum FROM fm_workorder_budget WHERE order_id =
'{$id}'",__LINE__,__FILE__);
+ $this->db->next_record();
+ $budget =
$this->db->f('budget');
+ $contract_sum = $this->db->f('contract_sum');
+
+ $this->db->query("SELECT periodization_id"
+ . " FROM fm_workorder {$this->join} fm_project
ON (fm_workorder.project_id = fm_project.id)"
+ . " WHERE fm_workorder.id =
'{$id}'",__LINE__,__FILE__);
+
+ $this->db->next_record();
+
+ $periodization_id =
$this->db->f('periodization_id');
+
+ $soworkorder->_update_order_budget($id,
date('Y'), $periodization_id, $budget , $contract_sum, $calculation);
}
$this->db->transaction_commit();
Modified: trunk/property/inc/class.soworkorder.inc.php
===================================================================
--- trunk/property/inc/class.soworkorder.inc.php 2013-01-17 10:11:36 UTC
(rev 10681)
+++ trunk/property/inc/class.soworkorder.inc.php 2013-01-17 15:51:39 UTC
(rev 10682)
@@ -2142,9 +2142,8 @@
}
}
- private function _update_order_budget($order_id, $year,
$periodization_id, $budget, $contract_sum, $combined_cost = 0)
+ public 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');
$periodization_id = (int) $periodization_id;
Modified: trunk/property/inc/export/default/Basware_X114
===================================================================
--- trunk/property/inc/export/default/Basware_X114 2013-01-17 10:11:36 UTC
(rev 10681)
+++ trunk/property/inc/export/default/Basware_X114 2013-01-17 15:51:39 UTC
(rev 10682)
@@ -664,12 +664,7 @@
if($get_bilagsnr_ut)
{
- $this->db->query("UPDATE fm_idgenerator
SET value = value + 1 WHERE name = 'bilagsnr_ut'");
- $this->db->query("SELECT value FROM
fm_idgenerator WHERE name = 'bilagsnr_ut'");
- $this->db->next_record();
- $bilagsnr_ut = $this->db->f('value');
-
- $this->db->query("UPDATE fm_ecobilag
SET bilagsnr_ut = {$bilagsnr_ut} WHERE bilagsnr = '$voucher_id'");
+ $bilagsnr_ut =
$this->increment_voucher_id();
}
}
@@ -986,7 +981,19 @@
return $message;
}
+ protected function increment_voucher_id()
+ {
+ $name = 'bilagsnr_ut';
+ $now = time();
+ $this->db->query("SELECT value, start_date FROM
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date
DESC");
+ $this->db->next_record();
+ $next_id = $this->db->f('value') +1;
+ $start_date = (int)$this->db->f('start_date');
+ $this->db->query("UPDATE fm_idgenerator SET value =
$next_id WHERE name = '{$name}' AND start_date = {$start_date}");
+ return $next_id;
+ }
+
protected function _delete_from_fm_ecobilag($bilagsnr)
{
$bilagsnr = (int) $bilagsnr;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [10682] property: invoice handling,
Sigurd Nes <=