[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [8567] property: more on manual invoice
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [8567] property: more on manual invoice |
Date: |
Fri, 13 Jan 2012 15:36:46 +0000 |
Revision: 8567
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=8567
Author: sigurdne
Date: 2012-01-13 15:36:46 +0000 (Fri, 13 Jan 2012)
Log Message:
-----------
property: more on manual invoice
Modified Paths:
--------------
trunk/property/inc/class.boinvoice.inc.php
trunk/property/inc/class.notify.inc.php
trunk/property/inc/class.soXport.inc.php
trunk/property/inc/class.socommon.inc.php
trunk/property/inc/class.soinvoice.inc.php
trunk/property/inc/class.uiinvoice.inc.php
trunk/property/inc/class.uiworkorder.inc.php
trunk/property/inc/cron/default/Import_fra_basware_X205.php
trunk/property/inc/import/default/Import_fra_BKK
trunk/property/inc/import/default/Import_fra_BKK_csv
trunk/property/inc/import/default/Import_fra_Kemner
trunk/property/inc/import/default/Import_fra_Service
trunk/property/inc/import/default/Import_fra_Service_xml
trunk/property/inc/import/default/efaktura_dnb_xml
trunk/property/inc/import/default/import_fra_Service_xls
trunk/property/templates/base/workorder.xsl
Modified: trunk/property/inc/class.boinvoice.inc.php
===================================================================
--- trunk/property/inc/class.boinvoice.inc.php 2012-01-13 12:56:49 UTC (rev
8566)
+++ trunk/property/inc/class.boinvoice.inc.php 2012-01-13 15:36:46 UTC (rev
8567)
@@ -225,32 +225,21 @@
function tax_code_list($selected='')
{
- $tax_codes=$this->so->tax_code_list();
-
- while (is_array($tax_codes) && list(,$code) =
each($tax_codes))
+ if(!$selected && $selected !== '0' )
{
- $sel_code = '';
- if ($code['id']==$selected)
- {
- $sel_code = 'selected';
- }
-
- $tax_code_list[] = array
- (
- 'id' =>
$code['id'],
- 'selected' =>
$sel_code
- );
+ $selected = '#';
}
-
- for ($i=0;$i<count($tax_code_list);$i++)
+ else
{
- if ($tax_code_list[$i]['selected'] !=
'selected')
- {
- unset($tax_code_list[$i]['selected']);
- }
+ $selected = (int)$selected;
}
-
- return $tax_code_list;
+ $tax_codes = $this->so->tax_code_list();
+
+ foreach ($tax_codes as &$tax_code)
+ {
+ $tax_code['selected'] = (int)$tax_code['id']
=== $selected ? 1 : 0;
+ }
+ return $tax_codes;
}
function update_period($voucher_id='',$period='')
@@ -366,59 +355,42 @@
public function add_invoice($values)
{
+ $buffer = array();
$soXport = CreateObject('property.soXport');
if($values['loc1']=$values['location']['loc1'])
{
$values['dima']=implode('',$values['location']);
+ $values['location_code'] = explode('-',
$values['location']);
}
-
$values['spbudact_code'] =
$values['b_account_id'];
- $values['fakturanr'] =
$values['invoice_num'];
+ $values['fakturanr'] = $values['invoice_id'];
$values['spvend_code'] = $values['vendor_id'];
$values['belop'] =
$values['amount'];
$values['godkjentbelop'] = $values['amount'];
$_dateformat = $this->bocommon->dateformat;
-
- $values['fakturadato'] =
date($_dateformat,phpgwapi_datetime::date_to_timestamp($values['invoice_date']));
- $values['forfallsdato'] =
date($_dateformat,phpgwapi_datetime::date_to_timestamp($values['payment_date']));
- $values['overftid'] =
date($_dateformat,phpgwapi_datetime::date_to_timestamp($values['paid_date']));
- $values['periode'] =
date('Ym',phpgwapi_datetime::date_to_timestamp($values['paid_date']));
+ $values['fakturadato'] =
date($_dateformat,phpgwapi_datetime::date_to_timestamp($values['invoice_date']));
+ $values['forfallsdato'] =
date($_dateformat,phpgwapi_datetime::date_to_timestamp($values['payment_date']));
+ $values['periode'] =
date('Ym',phpgwapi_datetime::date_to_timestamp($values['paid_date']));
$values['kildeid'] = 1;
- //_debug_array($values);die();
+ $values['pmwrkord_code'] = $values['order_id'];
+
+ $values['bilagsnr'] =
execMethod('property.socommon.increment_id','Bilagsnummer');
+ $values['bilagsnr_ut'] =
$values['voucher_out_id'];
+ $values['kostra_id'] =
$soXport->get_kostra_id($values['loc1']);
+ $values['mvakode'] =
(int)$values['tax_code'];
+ $values['project_id'] =
$values['project_group'];
+
+ $values['oppsynsmannid'] =
$values['janitor'];
+ $values['saksbehandlerid'] =
$values['supervisor'];
+ $values['budsjettansvarligid'] =
$values['budget_responsible'];
+
if($values['order_id'] && $order_type =
$soXport->check_order($values['order_id']))
{
if($order_type=='workorder')
{
- $soworkorder =
CreateObject('property.soworkorder');
- $soproject =
CreateObject('property.soproject');
- $workorder =
$soworkorder->read_single($values['order_id']);
- $project =
$soproject->read_single($workorder['project_id']);
-
- $values['spvend_code'] =
$workorder['vendor_id'];
- $values['spbudact_code'] =
$workorder['b_account_id'];
- $values['location_code'] =
$project['location_code'];
- $values['dima']
= str_replace('-','',$project['location_code']);
- $values['vendor_name'] =
$this->get_vendor_name($workorder['vendor_id']);
- $values['pmwrkord_code'] =
$values['order_id'];
- $values['project_id'] =
$workorder['project_id'];
- if(!$values['dimb'])
- {
- $values['dimb']
= $workorder['ecodimb'];
- }
-
- $values =
$this->set_responsible($values,$workorder['user_id'],$workorder['b_account_id']);
-
- if($values['auto_tax'])
- {
- $values['mvakode'] =
$soXport->auto_tax($values['dima']);
- $values['mvakode'] =
$soXport->tax_b_account_override($values['mvakode'],$values['spbudact_code']);
- $values['mvakode'] =
$soXport->tax_vendor_override($values['mvakode'],$values['spvend_code']);
- $values['kostra_id'] =
$soXport->get_kostra_id($values['dima']);
- }
-
$buffer[0]=$values;
}
@@ -426,14 +398,7 @@
{
$sos_agreement =
CreateObject('property.sos_agreement');
$s_agreement =
$sos_agreement->read_single(array('s_agreement_id'=>$values['order_id']));
-
- $values['spvend_code'] =
$s_agreement['vendor_id'];
- $values['spbudact_code'] =
$s_agreement['b_account_id'];
- $values['vendor_name'] =
$this->get_vendor_name($s_agreement['vendor_id']);
- $values['pmwrkord_code'] =
intval($values['order_id']);
$values =
$this->set_responsible($values,$s_agreement['user_id'],$s_agreement['b_account_id']);
-
-
$s_agreement_detail =
$sos_agreement->read(array('allrows'=>true,'s_agreement_id'=>$values['order_id'],'detail'=>true));
$sum_agreement=0;
@@ -442,57 +407,47 @@
$sum_agreement = $sum_agreement
+ $s_agreement_detail[$i]['cost'];
}
-
for
($i=0;$i<count($s_agreement_detail);$i++)
{
- $buffer[$i]=$values;
+ $buffer[$i]
= $values;
+ $buffer[$i]['location_code']
= $s_agreement_detail[$i]['location_code'];
+ $buffer[$i]['dima']
= str_replace('-','',$s_agreement_detail[$i]['location_code']);
+ $buffer[$i]['belop']
= round($values['belop'] / $sum_agreement *
$s_agreement_detail[$i]['cost'],2);
+ $buffer[$i]['godkjentbelop']
= $buffer[$i]['belop'];
+ }
+ }
- $buffer[$i]['location_code']
=$s_agreement_detail[$i]['location_code'];
- $buffer[$i]['dima']
=str_replace('-','',$s_agreement_detail[$i]['location_code']);
+ if($soXport->add($buffer)>0)
+ {
+ $ok = false;
+ $voucher =
$soXport->get_voucher($values['bilagsnr']);
+ foreach ($voucher as &$line)
+ {
+ $line['overftid'] =
date($_dateformat,phpgwapi_datetime::date_to_timestamp($values['paid_date']));
+ $line['ordrebelop'] =
$line['godkjentbelop'];
+ $line['filnavn'] =
'dummy';
+ $line['oppsynsigndato'] = date(
$_dateformat );
+ $line['saksigndato'] = date(
$_dateformat );
+ $line['budsjettsigndato'] =
date( $_dateformat );
+ $line['utbetalingsigndato'] =
date( $_dateformat );
+ $line['utbetalingid'] =
$GLOBALS['phpgw']->accounts->get($this->account_id)->lid;
+ $ok =
$soXport->add_OverfBilag($line);
+ }
-
- $buffer[$i]['belop'] =
round($values['belop'] / $sum_agreement * $s_agreement_detail[$i]['cost'],2);
- $buffer[$i]['godkjentbelop']
=$buffer[$i]['belop'];
-
- if($values['auto_tax'])
- {
- $buffer[$i]['mvakode']
= $soXport->auto_tax($buffer[$i]['dima']);
- $buffer[$i]['mvakode']
=
$soXport->tax_b_account_override($buffer[$i]['mvakode'],$buffer[$i]['spbudact_code']);
- $buffer[$i]['mvakode']
=
$soXport->tax_vendor_override($buffer[$i]['mvakode'],$buffer[$i]['spvend_code']);
-
$buffer[$i]['kostra_id'] = $soXport->get_kostra_id($buffer[$i]['dima']);
- }
+ if($ok)
+ {
+
$soXport->delete_voucher_from_fm_ecobilag($values['bilagsnr']);
}
+
+ $receipt['message'][] =
array('msg'=>lang('Invoice %1 is added',$soXport->voucher_id));
+ $receipt['voucher_id'] =
$soXport->voucher_id;
}
- }
- else
- {
- if($values['auto_tax'])
+ else
{
- $values['mvakode'] =
$soXport->auto_tax($values['loc1']);
- $values['mvakode'] =
$soXport->tax_b_account_override($values['mvakode'],$values['spbudact_code']);
- $values['mvakode'] =
$soXport->tax_vendor_override($values['mvakode'],$values['spvend_code']);
- $values['kostra_id'] =
$soXport->get_kostra_id($values['loc1']);
+ $receipt['error'][] =
array('msg'=>lang('Invoice is NOT added!'));
}
-
- $buffer[0]=$values;
}
-
- if($debug)
- {
- return $buffer;
- }
-
- if($soXport->add($buffer)>0)
- {
- $receipt['message'][] =
array('msg'=>lang('Invoice %1 is added',$soXport->voucher_id));
- $receipt['voucher_id'] = $soXport->voucher_id;
- }
- else
- {
- $receipt['error'][] =
array('msg'=>lang('Invoice is NOT added!'));
- }
return $receipt;
-
}
function add($values,$debug='')
@@ -592,7 +547,6 @@
$buffer[$i]['location_code']
=$s_agreement_detail[$i]['location_code'];
$buffer[$i]['dima']
=str_replace('-','',$s_agreement_detail[$i]['location_code']);
-
$buffer[$i]['belop'] =
round($values['belop'] / $sum_agreement * $s_agreement_detail[$i]['cost'],2);
$buffer[$i]['godkjentbelop']
=$buffer[$i]['belop'];
@@ -666,7 +620,7 @@
}
}
- function set_responsible($values,$user_id='',$b_account_id='')
+ function set_responsible($values, $user_id=0, $b_account_id='')
{
$config =
CreateObject('phpgwapi.config','property');
$config->read();
@@ -677,15 +631,17 @@
if (!$values['budget_responsible'])
{
$criteria_budget_responsible =
array('ecodimb' => $values['dimb'], 'cat_id' => $responsible_responsible);
- $budget_responsible_contact_id =
$responsible->get_responsible($criteria_budget_responsible);
- $budget_responsible_user_id
= $responsible->get_contact_user_id($budget_responsible_contact_id);
- $values['budget_responsible'] =
$GLOBALS['phpgw']->accounts->get($budget_responsible_user_id)->lid;
- $values['budsjettansvarligid'] =
$values['budget_responsible'];
+ if($budget_responsible_contact_id =
$responsible->get_responsible($criteria_budget_responsible))
+ {
+ $budget_responsible_user_id
= $responsible->get_contact_user_id($budget_responsible_contact_id);
+ $values['budget_responsible']
= $GLOBALS['phpgw']->accounts->get($budget_responsible_user_id)->lid;
+ $values['budsjettansvarligid']
= $values['budget_responsible'];
+ }
}
if (!$values['budget_responsible'])
{
- $values['budget_responsible'] =
$this->soXport->get_responsible($b_account_id);
+ $values['budget_responsible'] =
execMethod('property.soXport.get_responsible',$b_account_id);
$values['budsjettansvarligid'] =
$values['budget_responsible'];
}
@@ -693,10 +649,12 @@
if(!$values['supervisor'])
{
$criteria_supervisor
= array('ecodimb' => $values['dimb'], 'cat_id' => $responsible_supervisor);
- $supervisor_contact_id
= $responsible->get_responsible($criteria_supervisor);
- $supervisor_user_id
= $responsible->get_contact_user_id($supervisor_contact_id);
- $values['supervisor']
= $GLOBALS['phpgw']->accounts->get($supervisor_user_id)->lid;
- $values['saksbehandlerid']
= $values['supervisor'];
+ if($supervisor_contact_id =
$responsible->get_responsible($criteria_supervisor))
+ {
+ $supervisor_user_id
= $responsible->get_contact_user_id($supervisor_contact_id);
+ $values['supervisor']
= $GLOBALS['phpgw']->accounts->get($supervisor_user_id)->lid;
+ $values['saksbehandlerid']
= $values['supervisor'];
+ }
}
$values['janitor'] =
$GLOBALS['phpgw']->accounts->get($user_id)->lid;
Modified: trunk/property/inc/class.notify.inc.php
===================================================================
--- trunk/property/inc/class.notify.inc.php 2012-01-13 12:56:49 UTC (rev
8566)
+++ trunk/property/inc/class.notify.inc.php 2012-01-13 15:36:46 UTC (rev
8567)
@@ -130,7 +130,7 @@
{
if(!isset($data['count']))
{
- throw new
Exception("property_notify::get_yui_table_def() - Missing count in input");
+ throw new
Exception("property_notify::get_yui_table_def() - Missing count in input");
}
$content = array();
Modified: trunk/property/inc/class.soXport.inc.php
===================================================================
--- trunk/property/inc/class.soXport.inc.php 2012-01-13 12:56:49 UTC (rev
8566)
+++ trunk/property/inc/class.soXport.inc.php 2012-01-13 15:36:46 UTC (rev
8567)
@@ -53,13 +53,13 @@
}
- function auto_tax($dima='')
+ function auto_tax($loc1='')
{
- if(!$dima)
+ if(!$loc1)
{
return;
}
- $sql = "select mva as tax_code from fm_location1 where
loc1='" . substr($dima,0,4) . "'";
+ $sql = "SELECT mva as tax_code FROM fm_location1 WHERE
loc1='{$loc1}'";
$this->db->query($sql);
$this->db->next_record();
@@ -72,7 +72,7 @@
{
return $mvakode;
}
- $sql = "select mva as tax_code from fm_b_account where
id='$b_account_id'";
+ $sql = "SELECT mva as tax_code FROM fm_b_account where
id='$b_account_id'";
$this->db->query($sql);
$this->db->next_record();
@@ -108,13 +108,13 @@
}
- function get_kostra_id($dima='')
+ function get_kostra_id($loc1='')
{
- if(!$dima)
+ if(!$loc1)
{
return;
}
- $sql = "select kostra_id from fm_location1 where
loc1='" . substr($dima,0,4) . "'";
+ $sql = "SELECT kostra_id FROM fm_location1 WHERE
loc1='{$loc1}'";
$this->db->query($sql);
$this->db->next_record();
@@ -324,7 +324,7 @@
$data['utbetalingid'],
$data['utbetalingsigndato'],
$data['filnavn'],
- date($this->db->datetime_format()),
+ isset($data['overftid']) && $data['overftid'] ?
$data['overftid'] : date($this->db->datetime_format()),
$data['item_type'],
$data['item_id'],
$data['external_ref'],
@@ -345,10 +345,67 @@
.
$this->db->money_format($data['godkjentbelop']) . ","
. $this->db->money_format($data['ordrebelop'])
. ")";
- $this->db->query($sql,__LINE__,__FILE__);
- //echo 'sql ' . $sql.'<br>';
+ return $this->db->query($sql,__LINE__,__FILE__);
}
+
+ function get_voucher($bilagsnr)
+ {
+ $sql= "SELECT fm_ecobilag.* FROM fm_ecobilag WHERE
bilagsnr = {$bilagsnr}";
+ $this->db->query($sql,__LINE__,__FILE__);
+
+ $voucher = array();
+ while ($this->db->next_record())
+ {
+ $voucher[] = array
+ (
+ 'id'
=> $this->db->f('id'),
+ 'bilagsnr'
=> $bilagsnr,
+ 'bilagsnr_ut' =>
$this->db->f('bilagsnr_ut'),
+ 'kidnr'
=> $this->db->f('kidnr'),
+ 'typeid'
=> $this->db->f('typeid'),
+ 'kildeid'
=> $this->db->f('kildeid'),
+ 'project_id' =>
$this->db->f('project_id'),
+ 'pmwrkord_code' =>
$this->db->f('pmwrkord_code'),
+ 'belop'
=> $this->db->f('belop'),
+ 'fakturadato' =>
$this->db->f('fakturadato'),
+ 'periode'
=> $this->db->f('periode'),
+ 'periodization' =>
$this->db->f('periodization'),
+ 'periodization_start' =>
$this->db->f('periodization_start'),
+ 'forfallsdato' =>
$this->db->f('forfallsdato'),
+ 'fakturanr'
=> $this->db->f('fakturanr'),
+ 'spbudact_code' =>
$this->db->f('spbudact_code'),
+ 'regtid'
=> $this->db->f('regtid'),
+ 'artid'
=> $this->db->f('artid'),
+ 'godkjentbelop' =>
$this->db->f('godkjentbelop'),
+ 'spvend_code' =>
$this->db->f('spvend_code'),
+ 'loc1'
=> $this->db->f('loc1'),
+ 'dima'
=> $this->db->f('dima'),
+ 'dimb'
=> $this->db->f('dimb'),
+ 'mvakode'
=> $this->db->f('mvakode'),
+ 'dimd'
=> $this->db->f('dimd'),
+ 'oppsynsmannid' =>
$this->db->f('oppsynsmannid'),
+ 'saksbehandlerid' =>
$this->db->f('saksbehandlerid'),
+ 'budsjettansvarligid' =>
$this->db->f('budsjettansvarligid'),
+ 'oppsynsigndato' =>
$this->db->f('oppsynsigndato'),
+ 'saksigndato' =>
$this->db->f('saksigndato'),
+ 'budsjettsigndato' =>
$this->db->f('budsjettsigndato'),
+ 'merknad'
=> $this->db->f('merknad',true),
+ 'splitt'
=> $this->db->f('splitt'),
+ 'utbetalingid' =>
$this->db->f('utbetalingid'),
+ 'utbetalingsigndato' =>
$this->db->f('utbetalingsigndato'),
+ 'external_ref' =>
$this->db->f('external_ref'),
+ 'kostra_id'
=> $this->db->f('kostra_id'),
+ 'currency'
=> $this->db->f('currency'),
+ 'process_log' =>
$this->db->f('process_log',true),
+ 'process_code' =>
$this->db->f('process_code'),
+ );
+ }
+
+ return $voucher;
+ }
+
+
function delete_from_fm_ecobilag($id)
{
$sql="delete from fm_ecobilag where id=$id";
@@ -549,6 +606,13 @@
$this->db->query($sql,__LINE__,__FILE__);
}
+ function delete_voucher_from_fm_ecobilag($bilagsnr)
+ {
+ $bilagsnr = (int) $bilagsnr;
+ $sql="DELETE FROM fm_ecobilag WHERE bilagsnr =
$bilagsnr";
+ $this->db->query($sql,__LINE__,__FILE__);
+ }
+
//Logg transaksjon
function log_transaction($batchid,$bilagid,$message='')
{
Modified: trunk/property/inc/class.socommon.inc.php
===================================================================
--- trunk/property/inc/class.socommon.inc.php 2012-01-13 12:56:49 UTC (rev
8566)
+++ trunk/property/inc/class.socommon.inc.php 2012-01-13 15:36:46 UTC (rev
8567)
@@ -306,9 +306,14 @@
return $entity;
}
+
function increment_id($name)
{
- $now = time();
+ if(!$name)
+ {
+ throw new
Exception("property_socommon::increment_id() - Missing name");
+ }
+
if($name == 'order') // FIXME: temporary hack
{
$name = 'workorder';
@@ -317,15 +322,24 @@
{
$name = 'workorder';
}
- $this->db->query("SELECT value, start_date FROM
fm_idgenerator WHERE name='{$name}' AND start_date < {$now} ORDER BY start_date
DESC" );
+
+ $this->db->query("SELECT name FROM fm_idgenerator WHERE
name='{$name}'");
$this->db->next_record();
+ if(!$this->db->f('name'))
+ {
+ throw new
Exception("property_socommon::increment_id() - not a valid name: '{$name}'");
+ }
+
+ $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;
}
+
function new_db($db ='' )
{
if(is_object($db))
@@ -399,4 +413,5 @@
}
return $access_location;
}
+
}
Modified: trunk/property/inc/class.soinvoice.inc.php
===================================================================
--- trunk/property/inc/class.soinvoice.inc.php 2012-01-13 12:56:49 UTC (rev
8566)
+++ trunk/property/inc/class.soinvoice.inc.php 2012-01-13 15:36:46 UTC (rev
8567)
@@ -967,18 +967,20 @@
}
- function tax_code_list($selected='')
+ function tax_code_list()
{
- $this->db->query("SELECT * FROM fm_ecomva order by id
asc ");
- $tax_code_list = array();
+ $this->db->query("SELECT * FROM fm_ecomva ORDER BY id
ASC ");
+ $values = array();
while ($this->db->next_record())
{
- $tax_code_list[] = Array(
- 'id' => $this->db->f('id'),
+ $id = $this->db->f('id');
+ $values[] = array
+ (
+ 'id' => $id,
+ 'name' => $id,
);
}
-
- return $tax_code_list;
+ return $values;
}
Modified: trunk/property/inc/class.uiinvoice.inc.php
===================================================================
--- trunk/property/inc/class.uiinvoice.inc.php 2012-01-13 12:56:49 UTC (rev
8566)
+++ trunk/property/inc/class.uiinvoice.inc.php 2012-01-13 15:36:46 UTC (rev
8567)
@@ -3612,7 +3612,7 @@
switch($order_type)
{
case 'workorder':
-
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiworkorder.edit', 'id'=> $order_id));
+
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uiworkorder.edit', 'id'=> $order_id, 'tab' => 'budget'));
break;
case 's_agreement':
$GLOBALS['phpgw']->redirect_link('/index.php',array('menuaction'=>
'property.uis_agreement.view', 'id'=> $order_id));
Modified: trunk/property/inc/class.uiworkorder.inc.php
===================================================================
--- trunk/property/inc/class.uiworkorder.inc.php 2012-01-13 12:56:49 UTC
(rev 8566)
+++ trunk/property/inc/class.uiworkorder.inc.php 2012-01-13 15:36:46 UTC
(rev 8567)
@@ -1927,6 +1927,7 @@
$receipt = array();
$bolocation = CreateObject('property.bolocation');
+ $boinvoice = CreateObject('property.boinvoice');
$referer = parse_url(phpgw::get_var('HTTP_REFERER',
'string' , 'SERVER'));
parse_str($referer['query']); // produce $menuaction
@@ -1953,38 +1954,44 @@
$values['vendor_id'] =
phpgw::get_var('vendor_id');
}
+
if($add_invoice && is_array($values))
{
- $order = false;
if($values['order_id'] &&
!ctype_digit($values['order_id']))
{
$receipt['error'][]=array('msg'=>lang('Please enter an integer for order!'));
unset($values['order_id']);
}
- else if($values['order_id'])
+
+
if(!execMethod('property.soXport.check_order',$values['order_id']))
{
- $order=true;
+
$receipt['error'][]=array('msg'=>lang('Not a valid order!'));
}
if (!$values['amount'])
{
$receipt['error'][] =
array('msg'=>lang('Please - enter an amount!'));
}
- if (!$values['art'])
+ if (!$values['artid'])
{
$receipt['error'][] =
array('msg'=>lang('Please - select type invoice!'));
}
- if (!$values['vendor_id'] && !$order)
+
+ if (!$values['vendor_id'])
{
$receipt['error'][] =
array('msg'=>lang('Please - select Vendor!'));
}
+ else if
(!$boinvoice->check_vendor($values['vendor_id']))
+ {
+ $receipt['error'][] =
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' .
$values['vendor_id']);
+ }
- if (!$values['type'])
+ if (!$values['typeid'])
{
$receipt['error'][] =
array('msg'=>lang('Please - select type order!'));
}
- if (!$values['budget_responsible'] &&
(!isset($order) || !$order))
+ if (!$values['budget_responsible'])
{
$receipt['error'][] =
array('msg'=>lang('Please - select budget responsible!'));
}
@@ -1994,14 +2001,6 @@
$receipt['error'][] =
array('msg'=>lang('Please - enter a invoice num!'));
}
- if(!$order && $values['vendor_id'])
- {
- if
(!$this->bo->check_vendor($values['vendor_id']))
- {
- $receipt['error'][] =
array('msg'=>lang('That Vendor ID is not valid !'). ' : ' .
$values['vendor_id']);
- }
- }
-
if (!$values['payment_date'] &&
!$values['num_days'])
{
$receipt['error'][] =
array('msg'=>lang('Please - select either payment date or number of days from
invoice date !'));
@@ -2022,7 +2021,6 @@
if(!$_receipt['error']) // all ok
{
- unset($values);
$redirect = true;
}
}
@@ -2041,6 +2039,18 @@
if($workorder =
$this->bo->read_single($values['order_id'] ? $values['order_id'] : $order_id))
{
$project =
execMethod('property.boproject.read_single_mini',$workorder['project_id']);
+
+ if(!$add_invoice && !$redirect)
+ {
+ $_criteria = array
+ (
+ 'dimb' => $workorder['ecodimb']
+ );
+ $_responsible
=
$boinvoice->set_responsible($_criteria,$workorder['user_id'],$values['b_account_id']);
+ $values['janitor']
= $_responsible['janitor'];
+ $values['supervisor']
= $_responsible['supervisor'];
+ $values['budget_responsible'] =
$_responsible['budget_responsible'];
+ }
}
if(isset($values['location_data']) &&
$values['location_data'])
@@ -2115,6 +2125,7 @@
$jscal->add_listener('paid_date');
$order_id = isset($values['order_id']) &&
$values['order_id'] ? $values['order_id'] : $order_id;
+
$account_lid =
$GLOBALS['phpgw']->accounts->get($this->account)->lid;
$data = array
(
@@ -2125,21 +2136,23 @@
'action_url'
=> $GLOBALS['phpgw']->link('/index.php',array('menuaction'=>
'property' .'.uiinvoice.add')),
'value_invoice_date'
=> isset($values['invoice_date'])?$values['invoice_date']:'',
'value_payment_date'
=> isset($values['payment_date'])?$values['payment_date']:'',
- 'value_payment_date'
=> isset($values['paid_date'])?$values['paid_date']:'',
+ 'value_paid_date'
=> isset($values['paid_date'])?$values['paid_date']:'',
'vendor_data'
=> $vendor_data,
'ecodimb_data'
=> $ecodimb_data,
'project_group_data'
=> $project_group_data,
- 'value_kid_nr'
=> isset($values['kid_nr'])?$values['kid_nr']:'',
+ 'value_kidnr'
=> isset($values['kidnr'])?$values['kidnr']:'',
'value_invoice_id'
=> isset($values['invoice_id'])?$values['invoice_id']:'',
+ 'value_voucher_out_id'
=> isset($values['voucher_out_id'])?$values['voucher_out_id']:'',
'value_merknad'
=> isset($values['merknad'])?$values['merknad']:'',
'value_num_days'
=> isset($values['num_days'])?$values['num_days']:'',
'value_amount'
=> isset($values['amount'])?$values['amount']:'',
'value_order_id'
=> $order_id,
- 'art_list'
=> array('options' =>
execMethod('property.boinvoice.get_lisfm_ecoart',
isset($values['art'])?$values['art']:'')),
- 'type_list'
=> array('options' =>
execMethod('property.boinvoice.get_type_list',
isset($values['type'])?$values['type']:'')),
- 'janitor_list'
=> array('options_lid' =>
$this->bocommon->get_user_list_right(32,isset($values['janitor'])?$values['janitor']:$account_lid,'.invoice')),
- 'supervisor_list'
=> array('options_lid' =>
$this->bocommon->get_user_list_right(64,isset($values['supervisor'])?$values['supervisor']:$account_lid,'.invoice')),
- 'budget_responsible_list'
=> array('options_lid' =>
$this->bocommon->get_user_list_right(128,isset($values['budget_responsible'])?$values['budget_responsible']:$account_lid,'.invoice')),
+ 'art_list'
=> array('options' => $boinvoice->get_lisfm_ecoart(
isset($values['artid'])?$values['artid']:'')),
+ 'type_list'
=> array('options' => $boinvoice->get_type_list(
isset($values['typeid'])?$values['typeid']:'')),
+ 'tax_code_list'
=> array('options' => $boinvoice->tax_code_list(
isset($values['tax_code'])?$values['tax_code']:'')),
+ 'janitor_list'
=> array('options_lid' =>
$this->bocommon->get_user_list_right(32,isset($values['janitor']) &&
$values['janitor'] ? $values['janitor']:$account_lid,'.invoice')),
+ 'supervisor_list'
=> array('options_lid' =>
$this->bocommon->get_user_list_right(64,isset($values['supervisor']) &&
$values['supervisor'] ? $values['supervisor']:$account_lid,'.invoice')),
+ 'budget_responsible_list'
=> array('options_lid' =>
$this->bocommon->get_user_list_right(128,isset($values['budget_responsible'])
&& $values['budget_responsible'] ?
$values['budget_responsible']:$account_lid,'.invoice')),
'location_data'
=> $location_data,
'b_account_data'
=> $b_account_data,
'redirect'
=> isset($redirect) && $redirect ?
$GLOBALS['phpgw']->link('/index.php', array('menuaction' =>
'property.uiworkorder.edit', 'id' => $order_id , 'tab' => 'budget')) : null,
@@ -2149,11 +2162,12 @@
$GLOBALS['phpgw_info']['flags']['noframework'] = true;
$GLOBALS['phpgw']->xslttpl->set_var('phpgw',array('add_invoice' => $data));
+/*
phpgwapi_yui::load_widget('container');
phpgwapi_yui::load_widget('button');
phpgwapi_yui::load_widget('connection');
phpgwapi_yui::load_widget('loader');
-
+*/
/*
phpgwapi_yui::load_widget('dragdrop');
phpgwapi_yui::load_widget('datatable');
Modified: trunk/property/inc/cron/default/Import_fra_basware_X205.php
===================================================================
--- trunk/property/inc/cron/default/Import_fra_basware_X205.php 2012-01-13
12:56:49 UTC (rev 8566)
+++ trunk/property/inc/cron/default/Import_fra_basware_X205.php 2012-01-13
15:36:46 UTC (rev 8567)
@@ -405,9 +405,9 @@
$buffer[$i]['mvakode'] = $this->mvakode;
- if($buffer[$i]['dima'] &&
$this->auto_tax)
+ if($buffer[$i]['loc1'] &&
$this->auto_tax)
{
- $mvakode =
$this->soXport->auto_tax($buffer[$i]['dima']);
+ $mvakode =
$this->soXport->auto_tax($buffer[$i]['loc1']);
if($mvakode)
{
Modified: trunk/property/inc/import/default/Import_fra_BKK
===================================================================
--- trunk/property/inc/import/default/Import_fra_BKK 2012-01-13 12:56:49 UTC
(rev 8566)
+++ trunk/property/inc/import/default/Import_fra_BKK 2012-01-13 15:36:46 UTC
(rev 8567)
@@ -256,7 +256,7 @@
$omraade=$maalerinfo['district'];
if($invoice_common['auto_tax'])
{
-
$mvakode=$this->soXport->auto_tax($dima);
+
$mvakode=$this->soXport->auto_tax($loc1);
if($mvakode)
{
@@ -307,7 +307,7 @@
{
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spbudact_code']);
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spvend_code']);
- $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+ $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
}
}
return $buffer;
Modified: trunk/property/inc/import/default/Import_fra_BKK_csv
===================================================================
--- trunk/property/inc/import/default/Import_fra_BKK_csv 2012-01-13
12:56:49 UTC (rev 8566)
+++ trunk/property/inc/import/default/Import_fra_BKK_csv 2012-01-13
15:36:46 UTC (rev 8567)
@@ -222,7 +222,7 @@
if($invoice_common['auto_tax'])
{
-
$mvakode=$this->soXport->auto_tax($dima);
+
$mvakode=$this->soXport->auto_tax($loc1);
if($mvakode)
{
@@ -286,7 +286,7 @@
{
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spbudact_code']);
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spvend_code']);
- $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+ $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
}
}
Modified: trunk/property/inc/import/default/Import_fra_Kemner
===================================================================
--- trunk/property/inc/import/default/Import_fra_Kemner 2012-01-13 12:56:49 UTC
(rev 8566)
+++ trunk/property/inc/import/default/Import_fra_Kemner 2012-01-13 15:36:46 UTC
(rev 8567)
@@ -207,10 +207,10 @@
$buffer =
$this->import_new_attrib($buffer,dimb,$this->dimb,$invoice_common);
$bilagsnr++;
- //Finn dima fra Boei
- $gabinfo =
$this->soXport->gabnr_to_objekt($Gnr,$Bnr,$sekjonnr);
- $buffer =
$this->import_new_attrib($buffer,dima,$gabinfo['dima'],$invoice_common);
- $buffer =
$this->import_new_attrib($buffer,loc1,$gabinfo['loc1'],$invoice_common);
+ //Finn dima fra Boei
+ $gabinfo =
$this->soXport->gabnr_to_objekt($Gnr,$Bnr,$sekjonnr);
+ $buffer =
$this->import_new_attrib($buffer,'dima',$gabinfo['dima'],$invoice_common);
+ $buffer =
$this->import_new_attrib($buffer,'loc1',$gabinfo['loc1'],$invoice_common);
//finn boei gateadresse for
kongroll
$boei_gateadresse=$this->soXport->dima_to_address($dima);
$buffer =
$this->import_new_attrib($buffer,boei_gateadresse,$boei_gateadresse,$invoice_common);
@@ -350,7 +350,7 @@
}
- if($name=='dima' &&
$invoice_common['auto_tax']):
+ if($name=='loc1' &&
$invoice_common['auto_tax']):
{
$mvakode=$this->soXport->auto_tax($value);
@@ -363,7 +363,7 @@
$buffer[$this->id]['mvakode'] =
$this->mvakode;
}
}
- elseif($name=='dima' &&
!$invoice_common['auto_tax']):
+ elseif($name=='loc1' &&
!$invoice_common['auto_tax']):
{
$buffer[$this->id]['mvakode'] =
$this->mvakode;
}
@@ -389,7 +389,7 @@
{
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spbudact_code']);
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spvend_code']);
- $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+ $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
}
}
return $buffer;
Modified: trunk/property/inc/import/default/Import_fra_Service
===================================================================
--- trunk/property/inc/import/default/Import_fra_Service 2012-01-13
12:56:49 UTC (rev 8566)
+++ trunk/property/inc/import/default/Import_fra_Service 2012-01-13
15:36:46 UTC (rev 8567)
@@ -185,17 +185,17 @@
}
}
- if($name=='mvakode' &&
$invoice_common['auto_tax'])
- {
- $value =
$this->soXport->auto_tax($buffer[$this->id]['dima']);
- }
-
if($name=='dima')
{
$value = $this->check_dima($value);
$buffer[$this->id]['loc1'] =
$loc1=substr($value,0,4);
}
+ if($name=='mvakode' &&
$invoice_common['auto_tax'])
+ {
+ $value =
$this->soXport->auto_tax($buffer[$this->id]['loc1']);
+ }
+
$buffer[$this->id][$name] = $value;
$buffer[$this->id]['bilagsnr'] =
$this->next_bilagsnr;
$buffer[$this->id]['splitt'] = $this->splitt;
@@ -219,7 +219,7 @@
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spbudact_code']);
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spvend_code']);
}
- $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+ $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
}
return $buffer;
}
@@ -279,4 +279,3 @@
return $receipt;
}
}
-?>
Modified: trunk/property/inc/import/default/Import_fra_Service_xml
===================================================================
--- trunk/property/inc/import/default/Import_fra_Service_xml 2012-01-13
12:56:49 UTC (rev 8566)
+++ trunk/property/inc/import/default/Import_fra_Service_xml 2012-01-13
15:36:46 UTC (rev 8567)
@@ -217,17 +217,17 @@
}
}
- if($name=='mvakode' &&
$invoice_common['auto_tax'])
- {
- $value =
$this->soXport->auto_tax($buffer[$this->id]['dima']);
- }
-
if($name=='dima')
{
$value = $this->check_dima($value);
$buffer[$this->id]['loc1'] =
$loc1=substr($value,0,4);
}
+ if($name=='mvakode' &&
$invoice_common['auto_tax'])
+ {
+ $value =
$this->soXport->auto_tax($buffer[$this->id]['loc1']);
+ }
+
$buffer[$this->id][$name] = $value;
$buffer[$this->id]['bilagsnr'] =
$this->next_bilagsnr;
$buffer[$this->id]['splitt'] = $this->splitt;
@@ -251,7 +251,7 @@
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spbudact_code']);
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spvend_code']);
}
- $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+ $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
}
return $buffer;
}
Modified: trunk/property/inc/import/default/efaktura_dnb_xml
===================================================================
--- trunk/property/inc/import/default/efaktura_dnb_xml 2012-01-13 12:56:49 UTC
(rev 8566)
+++ trunk/property/inc/import/default/efaktura_dnb_xml 2012-01-13 15:36:46 UTC
(rev 8567)
@@ -225,7 +225,7 @@
if($invoice_common['auto_tax'])
{
-
$mvakode=$this->soXport->auto_tax($dima);
+
$mvakode=$this->soXport->auto_tax($loc1);
if($mvakode)
{
@@ -268,7 +268,7 @@
{
$buffer[$i]['mvakode']
= $this->soXport->tax_b_account_override($buffer[$i]['mvakode']
,$buffer[$i]['spbudact_code']);
$buffer[$i]['mvakode']
= $this->soXport->tax_vendor_override($buffer[$i]['mvakode']
,$buffer[$i]['spvend_code']);
- $buffer[$i]['kostra_id']
= $this->soXport->get_kostra_id($buffer[$i]['dima']);
+ $buffer[$i]['kostra_id']
= $this->soXport->get_kostra_id($buffer[$i]['loc1']);
}
$i++;
Modified: trunk/property/inc/import/default/import_fra_Service_xls
===================================================================
--- trunk/property/inc/import/default/import_fra_Service_xls 2012-01-13
12:56:49 UTC (rev 8566)
+++ trunk/property/inc/import/default/import_fra_Service_xls 2012-01-13
15:36:46 UTC (rev 8567)
@@ -179,17 +179,17 @@
}
}
- if($name=='mvakode' &&
$invoice_common['auto_tax'])
- {
- $value =
$this->soXport->auto_tax($buffer[$this->id]['dima']);
- }
-
if($name=='dima')
{
$value = $this->check_dima($value);
$buffer[$this->id]['loc1'] =
$loc1=substr($value,0,4);
}
+ if($name=='mvakode' &&
$invoice_common['auto_tax'])
+ {
+ $value =
$this->soXport->auto_tax($buffer[$this->id]['loc1']);
+ }
+
$buffer[$this->id][$name] = $value;
$buffer[$this->id]['bilagsnr'] =
$this->next_bilagsnr;
$buffer[$this->id]['splitt'] = $this->splitt;
@@ -213,7 +213,7 @@
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_b_account_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spbudact_code']);
$buffer[$this->id]['mvakode'] =
$this->soXport->tax_vendor_override($buffer[$this->id]['mvakode']
,$buffer[$this->id]['spvend_code']);
}
- $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['dima']);
+ $buffer[$this->id]['kostra_id'] =
$this->soXport->get_kostra_id($buffer[$this->id]['loc1']);
}
return $buffer;
}
Modified: trunk/property/templates/base/workorder.xsl
===================================================================
--- trunk/property/templates/base/workorder.xsl 2012-01-13 12:56:49 UTC (rev
8566)
+++ trunk/property/templates/base/workorder.xsl 2012-01-13 15:36:46 UTC (rev
8567)
@@ -872,6 +872,7 @@
<xsl:value-of select="form_action"/>
</xsl:variable>
<form method="post" id="add_invoice"
name="form" action="{$form_action}">
+<!--
<tr>
<td>
<xsl:value-of
select="php:function('lang', 'Auto TAX')"/>
@@ -884,6 +885,7 @@
</input>
</td>
</tr>
+-->
<xsl:call-template
name="location_form"/>
<xsl:call-template
name="b_account_form"/>
<xsl:call-template
name="project_group_form"/>
@@ -896,7 +898,7 @@
<xsl:value-of
select="php:function('lang', 'janitor')"/>
</td>
<td valign="top">
- <select
name="values[oppsynsmannid]" class="forms">
+ <select
name="values[janitor]" class="forms">
<option
value="">
<xsl:value-of select="php:function('lang', 'no janitor')"/>
</option>
@@ -909,7 +911,7 @@
<xsl:value-of
select="php:function('lang', 'supervisor')"/>
</td>
<td valign="top">
- <select
name="values[saksbehandlerid]" class="forms">
+ <select
name="values[supervisor]" class="forms">
<option
value="">
<xsl:value-of select="php:function('lang', 'no supervisor')"/>
</option>
@@ -922,7 +924,7 @@
<xsl:value-of
select="php:function('lang', 'B - responsible')"/>
</td>
<td valign="top">
- <select
name="values[budsjettansvarligid]" class="forms">
+ <select
name="values[budget_responsible]" class="forms">
<option
value="">
<xsl:value-of select="php:function('lang', 'Select B-Responsible')"/>
</option>
@@ -944,6 +946,22 @@
</tr>
<tr>
<td valign="top">
+ <xsl:value-of
select="php:function('lang', 'tax code')"/>
+ </td>
+ <td valign="top">
+ <select
name="values[tax_code]" class="forms" >
+ <xsl:attribute
name="title">
+
<xsl:value-of select="php:function('lang', 'tax code')"/>
+ </xsl:attribute>
+ <option
value="">
+
<xsl:value-of select="php:function('lang', 'select')"/>
+ </option>
+
<xsl:apply-templates select="tax_code_list/options"/>
+ </select>
+ </td>
+ </tr>
+ <tr>
+ <td valign="top">
<xsl:value-of
select="php:function('lang', 'art')"/>
</td>
<td valign="top">
@@ -954,7 +972,7 @@
<option
value="">
<xsl:value-of select="php:function('lang', 'Select Invoice Type')"/>
</option>
-
<xsl:apply-templates select="art_list"/>
+
<xsl:apply-templates select="art_list/options"/>
</select>
</td>
</tr>
@@ -979,7 +997,7 @@
<xsl:value-of
select="php:function('lang', 'voucher id')"/>
</td>
<td>
- <input type="text"
name="values[voucher_id]" value="{value_voucher_id}">
+ <input type="text"
name="values[voucher_out_id]" value="{value_voucher_out_id}">
<xsl:attribute
name="title">
<xsl:value-of select="php:function('lang', 'voucher id')"/>
</xsl:attribute>
@@ -1003,7 +1021,7 @@
<xsl:value-of
select="php:function('lang', 'KID nr')"/>
</td>
<td>
- <input type="text"
name="values[kidnr]" value="{value_kid_nr}" >
+ <input type="text"
name="values[kidnr]" value="{value_kidnr}" >
<xsl:attribute
name="title">
<xsl:value-of
select="php:function('lang', 'Enter Kid nr')"/>
</xsl:attribute>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [8567] property: more on manual invoice,
Sigurd Nes <=