[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Fmsystem-commits] [11549] property:remove obsolete
From: |
Sigurd Nes |
Subject: |
[Fmsystem-commits] [11549] property:remove obsolete |
Date: |
Fri, 20 Dec 2013 14:11:23 +0000 |
Revision: 11549
http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11549
Author: sigurdne
Date: 2013-12-20 14:11:22 +0000 (Fri, 20 Dec 2013)
Log Message:
-----------
property:remove obsolete
Removed Paths:
-------------
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_xml
trunk/property/inc/import/default/import_fra_Service_xls
Deleted: trunk/property/inc/import/default/Import_fra_BKK
===================================================================
--- trunk/property/inc/import/default/Import_fra_BKK 2013-12-20 12:31:53 UTC
(rev 11548)
+++ trunk/property/inc/import/default/Import_fra_BKK 2013-12-20 14:11:22 UTC
(rev 11549)
@@ -1,319 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage import
- * @version $Id: Import_fra_BKK,v 1.11 2007/01/26 14:58:55 sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class import_conv
- {
- var $currentrecord = array(); //used for buffering to allow uid
lines to go first
- var $id = -1;
- var $spbudact_code='12304121';
- var $mvakode=0;
- var $kildeid=1;
- var $splitt=0;
- var $type = 'fixed';
- var $header_count = 1;
- var $soXport;
- var $invoice;
- var $meter_table;
-
- var $import = array(
- 'Bestilling' => 'pmwrkord_code',
- 'Fakt. Nr' => 'fakturanr',
- 'M\xE5ler nr' => 'maalernr',
- 'Konto' => 'spbudact_code',
- 'Objekt' => 'dima',
- 'Omr' => 'omraade',
- 'Adresse' => 'merknad',
- 'MVA' => 'mvakode',
- 'Tjeneste'=> 'kostra_id',
- 'Bel\xF8p [kr]' => 'belop'
- );
-
- var $header = array('Fakt. Nr','M\xE5ler
nr','Konto','Objekt','MVA','Bel\xF8p [kr]','Omr','Adresse');
-
- var $import_bkk =
array('boligbyggelag','dato','kundenr','lopenr', 'maalernr' ,
'installasjonsnr',
-
'anleggsid','stedsnavn','kunde_navn','navn','netto','mva');
-
- var $import_bkk_offset = array(
- 'boligbyggelag' => '0',
- 'dato' => '5',
- 'kundenr' => '16',
- 'lopenr' => '25',
- 'maalernr' => '30',
- 'installasjonsnr' => '43',
- 'anleggsid' => '54',
- 'stedsnavn' => '59',
- 'kunde_navn' => '95',
- 'navn' => '126',
- 'netto' => '157',
- 'mva' => '172'
- );
-
- var $import_bkk_len = array(
- 'boligbyggelag' => '5',
- 'dato' => '10',
- 'kundenr' => '8',
- 'lopenr' => '4',
- 'maalernr' => '8',
- 'installasjonsnr' => '9',
- 'anleggsid' => '4',
- 'stedsnavn' => '35',
- 'kunde_navn' => '30',
- 'navn' => '30',
- 'netto' => '14',
- 'mva' => '14'
- );
-
- function import_conv()
- {
- $this->soXport =
CreateObject('property.soXport');
- $this->invoice =
CreateObject('property.boinvoice');
- $this->dateformat =
$GLOBALS['phpgw']->db->date_format();
- $this->datetimeformat =
$GLOBALS['phpgw']->db->datetime_format();
- $this->next_bilagsnr =
$this->invoice->next_bilagsnr();
- $this->config =
CreateObject('phpgwapi.config','property');
- $this->config->read_repository();
- $this->meter_table =
$this->config->config_data['meter_table'];
-
- }
-
- function import($invoice_common,$download)
- {
-
- $tsvfile = $invoice_common['tsvfile'];
- $conv_type = $invoice_common['conv_type'];
-
- if(!$buffer[$this->id]['kidnr'] =
$invoice_common['kid_nr'])
- {
- echo '<b>KID-nummer mangler</b><br><br>';
- return;
- }
- $valid_data= False;
- $buffer = array();
- $buffer = $this->import_start_file($buffer);
- $fp = fopen($tsvfile,'rb');
-//print_r($buffer);
-
-//print_r($header);
-//echo '<br>';
- for ($i = 0; $i < $this->header_count &&
fgets($fp,8000); ++$i);
-
- while ($data = fgets($fp,8000))
- {
-//print_r($data);
- $num = count($this->import_bkk);
-//echo 'data :'.$data.'<br>';
- $buffer = $this->import_start_record($buffer);
-//print_r($buffer);
- for ($c=0; $c<$num; $c++ )
- {
- //Send name/value pairs along with the
buffer
- if ($this->import_bkk[$c] != '' &&
substr($data,5,10) !='')
- {
-//echo 'len :'.$this->import_bkk_len[$this->import_bkk[$c]].'<br>';
-//print_r(fread($data,$this->import_bkk_len[$this->import_bkk[$c]]));
-//print_r($this->import_bkk[$c]);
-
$value=substr($data,$this->import_bkk_offset[$this->import_bkk[$c]],$this->import_bkk_len[$this->import_bkk[$c]]);
- $name=$this->import_bkk[$c];
- if ($name=='installasjonsnr')
- {
- $name='anleggsnr';
-
$value=substr($data,43,9)." ".substr($data,54,4);
- }
- if ($name=='netto')
- {
- $name='belop';
-
$value=(floatval(substr($data,157,14)) + floatval(substr($data,172,14)))/100;
- $valid_data= True;
- }
-//echo 'name :'.$name;
-//echo ' value :'.$value.'<br>';
-//print_r($buffer);
-
- $buffer =
$this->import_new_attrib($buffer,$name,$value,$invoice_common);
- }
- }
- if ($valid_data)
- {
- $buffer =
$this->import_end_record($buffer,$invoice_common);
- $valid_data= False;
- }
- }
- fclose($fp);
-//print_r($buffer);
-
-
-//echo 'download'.$download.'<br>';
-
- if(!$download)
- {
- $buffer =
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
- }
-
- $this->header = array('Fakt. Nr','M\xE5ler
nr','Konto','Objekt','MVA','Tjeneste','Bel\xF8p [kr]','Omr','Adresse');
-
- return $buffer;
- }
-
-
- function import_start_file($buffer)
- {
- return $buffer;
- }
-
- function import_start_record($buffer)
- {
-//print_r($buffer);
- $top=array();
- ++$this->id;
- $this->currentrecord = $top;
- return $buffer;
- }
-
- function import_new_attrib($buffer,$name,$value,$invoice_common)
- {
-
- $value = trim($value);
- // $value = str_replace('\n','<BR>',$value);
- // $value = str_replace('\r','',$value);
-
- $this->currentrecord += array($name => $value);
-//print_r($buffer);
- return $buffer;
- }
-
- function import_end_record($buffer,$invoice_common)
- {
- $buffer[$this->id]='';
- while ( list($name, $value) =
each($this->currentrecord))
- {
- $invoice_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
- if($invoice_common['num_days'])
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
- }
- else
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
- }
-
- if($name=='belop')
- {
- $value = str_replace('kr','',$value);
- $value = str_replace(' ','',$value);
- $value = str_replace(',','.',$value);
-
- if( $invoice_common['art'] == 2 ) //
kreditnota
- {
- $value = -1 * abs($value);
- }
-
- $godkjentbelop=$value;
- }
-
- if($name=='anleggsnr')
- {
- $buffer[$this->id]['merknad'] =
'anleggsnr:' . $value;
-
-
$maalerinfo=$this->soXport->anleggsnr_to_objekt($value,$this->meter_table);
- $dima=$maalerinfo['dima'];
- $loc1=$maalerinfo['loc1'];
-// $maalernr=$maalerinfo['maalernr'];
- $omraade=$maalerinfo['district'];
- if($invoice_common['auto_tax'])
- {
-
$mvakode=$this->soXport->auto_tax($loc1);
-
- if($mvakode)
- {
-
$buffer[$this->id]['mvakode'] = $mvakode;
- }
- else
- {
-
$buffer[$this->id]['mvakode'] = $this->mvakode;
- }
- }
- else
- {
- $buffer[$this->id]['mvakode'] =
$this->mvakode;
- }
-
- }
- if($name=='stedsnavn')
- {
- $buffer[$this->id]['merknad'] .= "\r\n"
. $value;
- }
-
- $buffer[$this->id][$name] = $value;
- $buffer[$this->id]['bilagsnr'] =
$this->next_bilagsnr;
- $buffer[$this->id]['fakturanr'] =
$invoice_common['invoice_num'];
- $buffer[$this->id]['dima'] = $dima;
- $buffer[$this->id]['loc1'] = $loc1;
- $buffer[$this->id]['omraade'] = $omraade;
-// $buffer[$this->id]['maalernr'] = $maalernr;
- $buffer[$this->id]['splitt'] = $this->splitt;
- $buffer[$this->id]['kildeid'] = $this->kildeid;
-// $buffer[$this->id]['mvakode'] = $this->mvakode;
- $buffer[$this->id]['spbudact_code'] =
$this->spbudact_code;
- $buffer[$this->id]['kidnr'] =
$invoice_common['kid_nr'];
- $buffer[$this->id]['typeid'] =
$invoice_common['type'];
- $buffer[$this->id]['fakturadato'] =
$invoice_date;
- $buffer[$this->id]['forfallsdato'] =
$payment_date;
- $buffer[$this->id]['periode'] =
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
- $buffer[$this->id]['regtid'] =
date($this->datetimeformat);
- $buffer[$this->id]['artid'] =
$invoice_common['art'];
- $buffer[$this->id]['godkjentbelop'] =
$godkjentbelop;
- $buffer[$this->id]['spvend_code'] =
$invoice_common['vendor_id'];
- $buffer[$this->id]['dimb'] =
$invoice_common['dim_b'];
- $buffer[$this->id]['oppsynsmannid'] =
$invoice_common['janitor'];
- $buffer[$this->id]['saksbehandlerid'] =
$invoice_common['supervisor'];
- $buffer[$this->id]['budsjettansvarligid'] =
$invoice_common['budget_responsible'];
-
- if($invoice_common['auto_tax'])
- {
- $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]['loc1']);
- }
- }
- return $buffer;
- }
-
- function import_end_file($buffer,$bilagsnr)
- {
- $num = $this->soXport->add($buffer);
- $receipt['message'][]= array('msg' =>
lang('Successfully imported %1 records into your invoice register.',$num).'
'.lang('ID').': '. $bilagsnr);
- return $receipt;
- }
- }
Deleted: trunk/property/inc/import/default/Import_fra_BKK_csv
===================================================================
--- trunk/property/inc/import/default/Import_fra_BKK_csv 2013-12-20
12:31:53 UTC (rev 11548)
+++ trunk/property/inc/import/default/Import_fra_BKK_csv 2013-12-20
14:11:22 UTC (rev 11549)
@@ -1,381 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage import
- * @version $Id: Import_fra_BKK_csv,v 1.8 2007/03/18 16:33:16 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class import_conv
- {
- var $currentrecord = array(); //used for buffering to allow uid
lines to go first
- var $id = -1;
- var $spbudact_code='12304121';
- var $mvakode=0;
- var $kildeid=1;
- var $splitt=0;
- var $type = 'fixed';
- var $header_count = 1;
- var $soXport;
- var $invoice;
- var $meter_table;
- var $bilagsnr_0 = 0;
- var $bilagsnr_1 = 0;
- var $bilagsnr_2 = 0;
-
- var $import = array(
- 'Bestilling' => 'pmwrkord_code',
- 'Fakt. Nr' => 'fakturanr',
- 'Måler nr' => 'maalernr',
- 'Konto' => 'spbudact_code',
- 'Objekt' => 'dima',
- 'Omr' => 'omraade',
- 'Adresse' => 'stedsnavn',
- 'MVA' => 'mvakode',
- 'Tjeneste'=> 'kostra_id',
- 'Belop [kr]' => 'belop'
- );
-
- var $header = array('Fakt. Nr','Måler
nr','Konto','Objekt','MVA','Belop [kr]','Omr','Adresse');
-
- var $import_bkk =
array('kundenr','under_fakturanr','Utskriftsdato','Forfdato','Maalepunktid',
- 'stedsnavn','Girobeloep','maalernr','kunde_navn');
-
-
- var $import_bkk_offset = array(
- 'kundenr' => 0,
- 'under_fakturanr' => 1,
- 'Utskriftsdato' => 2,
- 'Forfdato' => 3,
- 'Maalepunktid' => 4,
- 'stedsnavn' => 8,
- 'Girobeloep' => 14,
- 'maalernr' => 19,
- 'kunde_navn' => 6
- );
-
- function import_conv()
- {
- $this->soXport =
CreateObject('property.soXport');
- $this->invoice =
CreateObject('property.boinvoice');
- $this->config =
CreateObject('phpgwapi.config','property');
- $this->config->read_repository();
- $this->meter_table =
$this->config->config_data['meter_table'];
-
- $this->db = &
$GLOBALS['phpgw']->db;
- $this->join = &
$this->db->join;
- $this->left_join = &
$this->db->left_join;
- $this->like = &
$this->db->like;
- $this->datetimeformat = $this->db->datetime_format();
- $this->dateformat =
$this->db->date_format();
- }
-
- function import($invoice_common,$download)
- {
-
- $tsvfile = $invoice_common['tsvfile'];
- $conv_type = $invoice_common['conv_type'];
-
- if(!$buffer[0]['kidnr'] = $invoice_common['kid_nr'])
- {
- echo '<b>KID-nummer mangler</b><br><br>';
- return;
- }
- $valid_data= False;
- $buffer = array();
- $fp = fopen($tsvfile,'rb');
- $column_header = true;
- $this->id = -1;
- while ($data = fgetcsv($fp,8000,";"))
- {
- $num = count($this->import_bkk);
-
- $this->currentrecord = array();
- for ($c=0; $c<$num; $c++ )
- {
- //Send name/value pairs along with the
buffer
- if ($data[14] && !$column_header)
- {
-
$value=$data[$this->import_bkk_offset[$this->import_bkk[$c]]];
- $name=$this->import_bkk[$c];
- if ($name=='Maalepunktid')
- {
- $name='anleggsnr';
- // $value= '7070575000' .
$value;
- }
- if ($name=='Girobeloep')
- {
- $name='belop';
- $valid_data= True;
- }
-
$this->import_new_attrib($name,$value,$invoice_common);
- }
- }
- if ($valid_data)
- {
- $buffer =
$this->import_end_record($buffer,$invoice_common);
- $valid_data= False;
- }
-
- unset($column_header);
- $this->id++;
- }
-
- fclose($fp);
-
-
- if(!$download)
- {
- $buffer = $this->import_end_file($buffer);
- }
-
- $this->header = array('Fakt. Nr','Måler
nr','Konto','Objekt','MVA','Tjeneste','Belop [kr]','Omr','Adresse');
- return $buffer;
- }
-
-
- function import_new_attrib($name,$value,$invoice_common)
- {
-
- $value = trim($value);
- // $value = str_replace('\n','<BR>',$value);
- // $value = str_replace('\r','',$value);
-
- $this->currentrecord += array($name => $value);
- }
-
- function import_end_record($buffer,$invoice_common)
- {
- $buffer[$this->id]='';
- while ( list($name, $value) =
each($this->currentrecord))
- {
- $invoice_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
- if($invoice_common['num_days'])
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
- }
- else
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
- }
-
- if($name=='belop')
- {
- $value = str_replace('kr','',$value);
- $value = str_replace(' ','',$value);
- $value = str_replace(',','.',$value);
-
-
- if($value < 0)
- {
- $buffer[$this->id]['artid'] =
2;
- $buffer[$this->id]['bilagsnr']
= $this->next_bilagsnr_2() . '_k';
- }
- else
- {
- $buffer[$this->id]['artid'] =
$invoice_common['art'];
- $buffer[$this->id]['bilagsnr']
= $this->next_bilagsnr_1();
- }
-
- if( $invoice_common['art'] == 2 ) //
kreditnota
- {
- $value = -1 * abs($value);
- }
-
- $godkjentbelop=$value;
- }
-
- if($name=='anleggsnr')
- {
- $buffer[$this->id]['merknad'] .=
"\r\nanleggsnr: {$value}";
-
$maalerinfo=$this->anleggsnr_to_objekt($value,$this->meter_table);
- $dima=$maalerinfo['dima'];
- $loc1=$maalerinfo['loc1'];
- $omraade=$maalerinfo['district'];
-
- if($invoice_common['auto_tax'])
- {
-
$mvakode=$this->soXport->auto_tax($loc1);
-
- if($mvakode)
- {
-
$buffer[$this->id]['mvakode'] = $mvakode;
- }
- else
- {
-
$buffer[$this->id]['mvakode'] = $this->mvakode;
- }
- }
- else
- {
- $buffer[$this->id]['mvakode'] =
$this->mvakode;
- }
-
- }
- if($name=='maalernr')
- {
- $buffer[$this->id]['merknad'] .=
"\r\nmaalernr: {$value}";
- }
- if($name=='under_fakturanr')
- {
- $buffer[$this->id]['merknad'] .=
"\r\nFakturanr: {$value}";
- }
- if($name=='kundenr')
- {
- $buffer[$this->id]['merknad'] .=
"\r\nKundenr: {$value}";
- }
- if($name=='kunde_navn')
- {
- $buffer[$this->id]['merknad'] .=
"\r\nKundenavn: {$value}";
- }
- if($name=='stedsnavn')
- {
- $buffer[$this->id]['merknad'] .=
"\r\nAdresse: {$value}";
- }
-
- $buffer[$this->id][$name] = $value;
- $buffer[$this->id]['fakturanr'] =
$invoice_common['invoice_num'];
- $buffer[$this->id]['dima'] = $dima;
- $buffer[$this->id]['loc1'] = $loc1;
- $buffer[$this->id]['omraade'] = $omraade;
- $buffer[$this->id]['splitt'] = $this->splitt;
- $buffer[$this->id]['kildeid'] = $this->kildeid;
- $buffer[$this->id]['spbudact_code'] =
$this->spbudact_code;
- $buffer[$this->id]['kidnr'] =
$invoice_common['kid_nr'];
- $buffer[$this->id]['typeid'] =
$invoice_common['type'];
- $buffer[$this->id]['fakturadato'] =
$invoice_date;
- $buffer[$this->id]['forfallsdato'] =
$payment_date;
- $buffer[$this->id]['periode'] =
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
- $buffer[$this->id]['regtid'] =
date($this->datetimeformat);
-
- $buffer[$this->id]['godkjentbelop'] =
$godkjentbelop;
- $buffer[$this->id]['spvend_code'] =
$invoice_common['vendor_id'];
- $buffer[$this->id]['dimb'] =
$invoice_common['dim_b'];
- $buffer[$this->id]['oppsynsmannid'] =
$invoice_common['janitor'];
- $buffer[$this->id]['saksbehandlerid'] =
$invoice_common['supervisor'];
- $buffer[$this->id]['budsjettansvarligid'] =
$invoice_common['budget_responsible'];
-
- if($invoice_common['auto_tax'])
- {
- $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]['loc1']);
- }
- }
-
- return $buffer;
- }
-
-
- function anleggsnr_to_objekt($anleggsnr,$meter_table)
- {
- $sql = "SELECT
{$meter_table}.maaler_nr,{$meter_table}.loc1,{$meter_table}.loc2,{$meter_table}.loc3,fm_part_of_town.district_id
"
- . " FROM {$meter_table} {$this->join} fm_location1 ON
{$meter_table}.loc1 = fm_location1.loc1 $this->join "
- . " fm_part_of_town ON fm_location1.part_of_town_id =
fm_part_of_town.part_of_town_id WHERE {$meter_table}.maalepunkt_id
{$this->like} '%{$anleggsnr}'";
-// _debug_array($sql);
- $this->db->query($sql);
-
- $this->db->next_record();
- $loc1 = $this->db->f('loc1');
- $loc2 = $this->db->f('loc2');
- // $loc3 = $this->db->f('loc3');
-
- $maalerinfo['loc1']=$loc1;
- $maalerinfo['dima']=$loc1.$loc2;//.$loc3;
- $maalerinfo['maalernr']=$this->db->f('maaler_nr');
- $maalerinfo['district']=$this->db->f('district_id');
- return $maalerinfo;
- }
-
- function import_end_file($buffer)
- {
- $num = $this->soXport->add($buffer);
-
- $_bilagsnr = array();
- if($this->bilagsnr_1)
- {
- $_bilagsnr[] = $this->bilagsnr_1;
- }
- if($this->bilagsnr_2)
- {
- $_bilagsnr[] = $this->bilagsnr_2;
- }
-
- $bilagsnr = max($_bilagsnr);
- $this->db->query("UPDATE fm_idgenerator SET VALUE
={$bilagsnr} WHERE name = 'Bilagsnummer'");
-
- $receipt['message'][]= array('msg' =>
lang('Successfully imported %1 records into your invoice register.',$num).'
'.lang('ID').': '. implode(',', $_bilagsnr));
- return $receipt;
- }
-
- protected function next_bilagsnr_1()
- {
- if ($this->bilagsnr_1)
- {
- return $this->bilagsnr_1;
- }
- else
- {
- if(!$this->bilagsnr_0)
- {
- $this->bilagsnr_0 =
$this->invoice->next_bilagsnr();
- $this->bilagsnr_1 = $this->bilagsnr_0;
- }
- else
- {
- $this->bilagsnr_1 = $this->bilagsnr_0 +
1;
- }
-
- return $this->bilagsnr_1;
- }
- }
-
- protected function next_bilagsnr_2()
- {
- if ($this->bilagsnr_2)
- {
- return $this->bilagsnr_2;
- }
- else
- {
- if(!$this->bilagsnr_0)
- {
- $this->bilagsnr_0 =
$this->invoice->next_bilagsnr();
- $this->bilagsnr_2 = $this->bilagsnr_0;
- }
- else
- {
- $this->bilagsnr_2 = $this->bilagsnr_0 +
1;
- }
-
- return $this->bilagsnr_2;
- }
- }
- }
Deleted: trunk/property/inc/import/default/Import_fra_Kemner
===================================================================
--- trunk/property/inc/import/default/Import_fra_Kemner 2013-12-20 12:31:53 UTC
(rev 11548)
+++ trunk/property/inc/import/default/Import_fra_Kemner 2013-12-20 14:11:22 UTC
(rev 11549)
@@ -1,402 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage import
- * @version $Id: Import_fra_Kemner,v 1.9 2007/01/26 14:58:56 sigurdne
Exp $
- */
-
- /**
- * Description
- * @package property
- */
- class import_conv
- {
- var $currentrecord = array(); //used for buffering to allow uid
lines to go first
- var $id = -1;
- var $spbudact_code='11954111';
- var $dimb=40;
- var $mvakode=0;
- var $kildeid=1;
- var $splitt=0;
- var $type = 'fixed';
- var $header_count = 0;
- var $soXport;
- var $invoice;
-
- var $import = array(
- 'Bilagsnr' => 'bilagsnr',
- 'Ref.' => 'fakturanr',
- 'Gnr/Bnr-seksjon' => 'gid',
- 'Konto' => 'spbudact_code',
- 'Objekt' => 'dima', //objectclass: organizationalPerson
- 'DimB' => 'dimb',
- 'KID' => 'kidnr',
- 'MVA' => 'mvakode',
- 'Tjeneste'=> 'kostra_id',
- 'Bel\xF8p [kr]' => 'belop',
- 'Referanse' => 'referanse',
- 'BOEI Gateadresse' => 'boei_gateadresse',
- );
-
- // var $header =
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Bel\xF8p
[kr]','Referanse','BOEI Gateadresse');
- var $header =
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Bel\xF8p
[kr]','Referanse');
-
- function import_conv()
- {
- $this->soXport =
CreateObject('property.soXport');
- $this->invoice =
CreateObject('property.boinvoice');
- $this->dateformat =
$GLOBALS['phpgw']->db->date_format();
- $this->datetimeformat =
$GLOBALS['phpgw']->db->datetime_format();
- }
-
- function import($invoice_common,$download)
- {
-
- $tsvfile = $invoice_common['tsvfile'];
- $conv_type = $invoice_common['conv_type'];
-
- $Ingen = 0;
- $FilGodkjent = 1;
- $Betalingskrav = 2;
- $Bel\xF8pspost1 = 3;
- $Bel\xF8pspost2 = 4;
- $Spesifikasjon = 5;
- $LinjeNr = 0;
- $ePostNiv\xE5 = $Ingen;
- $errorcount = 0;
- $last_case_merknad='';
- $bilagsnr = $this->invoice->next_bilagsnr();
- $buffer = array();
- $buffer = $this->import_start_file($buffer);
- $fp = fopen($tsvfile,'r');
-
- while ($data = fgets($fp,8000))
- {
-//-----------------------------
-//print_r($buffer);
-
- $LinjeNr = $LinjeNr + 1;
- if (strlen($data) >= 80)
- {
- if ($last_case_merknad &&
substr($data,0,8)!=$last_case_merknad)
- {
- if ($Merknad)
- {
- $buffer =
$this->import_new_attrib($buffer,merknad,$Merknad,$invoice_common);
- }
- $Merknad='';
- $buffer =
$this->import_end_record($buffer,$invoice_common);
- $last_case_merknad='';
- }
- switch(substr($data,0,8))
- {
- Case 'NY000010':
- //Start forsendelse
- if (($LinjeNr == 1) &&
($ePostNiv\xE5 == $Ingen))
- {
- $ePostNiv\xE5 = $FilGodkjent;
- }
- else
- {
- echo lang('Importer_BBS') .
lang('Filen inneholder flere start poster p\xE5 linje nr:') . $LinjeNr .
lang('Importen kan ikke fortsette');
- break 2;
- }
-
- break;
-
- Case 'NY210020':
- //Start betalingskrav
- if ($ePostNiv\xE5 == $FilGodkjent)
- {
- $ePostNiv\xE5 = $Betalingskrav;
- }
- else
- {
- echo lang('Importer_BBS')
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan
ikke fortsette');
- break 2;
- }
-
- $OppdragsNr = substr($data,17,7);
- $OppdragsKonto = substr($data, 24,
11);
- break;
-
- Case 'NY210230':
- break;
-
- Case 'NY212130':
- $buffer =
$this->import_start_record($buffer);
-
-
- //Bel\xF8pspost 1
- if ($ePostNiv\xE5 == $Betalingskrav
Or $ePostNiv\xE5 >= $Bel\xF8pspost2)
- {
- $ePostNiv\xE5 = $Bel\xF8pspost1;
- }
- else
- {
- echo lang('Importer_BBS')
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan
ikke fortsette');
- break 2;
- }
-
- //Lagre eksisterende post
- if (!oRsTmp.EOF && !oRsTmp.BOF)
- {
- if (oRsTmp.EditMode ==
adEditAdd)
- {
- oRsTmp.Update;
- }
- }
-
- //Opprett post
- $TransaksjonsNr = substr($data,
8, 7);
- $Gnr = substr($data, 56, 5);
- $Bnr = substr($data, 61, 4);
- $sekjonnr = substr($data, 69,
3);
-
- $forfall_day = substr($data,
15, 2);
- $forfall_month = substr($data,
17, 2);
- $forfall_year = substr($data,
19, 2);
- // $periode = $forfall_month - 1;
- $periode = $forfall_year .
sprintf("%02d",($forfall_month - 1));
-
- $forfallsdato =
date($this->dateformat,mktime(2,0,0,$forfall_month,$forfall_day,$forfall_year));
- $fakturadato=
date($this->dateformat,mktime(2,0,0,$forfall_month,$forfall_day,$forfall_year)-(86400*30));
-
- $belop =
intval(substr($data,32,17))/100;
-
- if( $invoice_common['art'] == 2
) // kreditnota
- {
- $belop = -1 *
abs($belop);
- }
-
- $kidnr = substr($data, 54, 20);
- $gid =
$Gnr.'/'.$Bnr.'-'.$sekjonnr;
-
- $buffer =
$this->import_new_attrib($buffer,periode,$periode,$invoice_common);
- $buffer =
$this->import_new_attrib($buffer,forfallsdato,$forfallsdato,$invoice_common);
- $buffer =
$this->import_new_attrib($buffer,fakturadato,$fakturadato,$invoice_common);
- $buffer =
$this->import_new_attrib($buffer,belop,$belop,$invoice_common);
- $buffer =
$this->import_new_attrib($buffer,kidnr,$kidnr,$invoice_common);
- $buffer =
$this->import_new_attrib($buffer,gid,$gid,$invoice_common);
- $buffer =
$this->import_new_attrib($buffer,bilagsnr,$bilagsnr,$invoice_common);
- $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 boei gateadresse for
kongroll
-
$boei_gateadresse=$this->soXport->dima_to_address($dima);
- $buffer =
$this->import_new_attrib($buffer,boei_gateadresse,$boei_gateadresse,$invoice_common);
-
- break;
-
- Case 'NY210231':
- break;
-
- Case 'NY212131':
- //Bel\xF8pspost 2
- if ($ePostNiv\xE5 ==
$Bel\xF8pspost1)
- {
- $ePostNiv\xE5 = $Bel\xF8pspost2;
- }
- else
- {
- echo lang('Importer_BBS')
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan
ikke fortsette');
- break 2;
- }
-
- //Sjekk transaksjonsnr
- if ((intval(substr($data, 8, 7)))
<> $TransaksjonsNr)
- {
- echo lang('Importer_BBS')
.lang('Transaksjonsnr p\xE5 bel\xF8pspost 2 stemmer ikke med nr p\xE5
bel\xF8pspost 1. Linjenr:') . $LinjeNr . lang('Importen kan ikke fortsette');
- break 2;
- }
-
- $Navn = substr($data, 15, 10);
- $referanse = substr($data, 50, 25);
- $buffer =
$this->import_new_attrib($buffer,referanse,$referanse,$invoice_common);
- $Merknad = 'Kemner adr:
'.$referanse."\r\n".'BOEI adr: '.$boei_gateadresse."\r\n";
- break;
-
- Case 'NY212149':
- //Spesifikasjonsrecord
- if ($ePostNiv\xE5 >=
$Bel\xF8pspost2)
- {
- $ePostNiv\xE5 = $Spesifikasjon;
- }
- else
- {
- echo lang('Importer_BBS')
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan
ikke fortsette');
- break 2;
- }
-
- //Hent merknad
- $Merknad.=strval(substr($data, 20,
40))."\r\n";
- $last_case_merknad=substr($data,0,8);
-
- break;
-
- Case 'NY210088':
- //Slutt betalingskrav
- if ($ePostNiv\xE5 >= $Betalingskrav
&& $ePostNiv\xE5 <> $Bel\xF8pspost1)
- {
- $ePostNiv\xE5 = $FilGodkjent;
- }
- else
- {
- echo lang('Importer_BBS')
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan
ikke fortsette');
- break 2;
- }
-
- break;
-
- Case 'NY000089':
- //Slutt forsendelse
- if ($ePostNiv\xE5 == $FilGodkjent)
- {
- $ePostNiv\xE5 = $Ingen;
- }
- else
- {
- echo lang('Importer_BBS')
.lang('Formatfeil p\xE5 fil p\xE5 linjenr:') . $LinjeNr . lang('Importen kan
ikke fortsette');
- break 2;
- }
-
- break;
- }
-
- //Filen m\xE5 altid begynne med en gyldig
start record
- if ($LinjeNr == 1 && $ePostNiv\xE5 ==
$Ingen)
- {
- echo lang('Importer_BBS') . lang('Filen
starter ikke med riktig recordtype. Importen kan ikke fortsette');
- break;
- }
- }
-//-----------------------------
- }
- fclose($fp);
-
- if(!$download)
- {
- $buffer =
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
- }
-//print_r($buffer);
- $this->header =
array('Bilagsnr','Ref.','Gnr/Bnr-seksjon','Konto','Objekt','DimB','KID','MVA','Tjeneste','Bel\xF8p
[kr]','Referanse');
- return $buffer;
-
- }
-
-
- function import_start_file($buffer)
- {
- return $buffer;
- }
-
- function import_start_record($buffer)
- {
- $top=array();
- ++$this->id;
- $this->currentrecord = $top;
- return $buffer;
- }
-
- function import_new_attrib($buffer,$name,$value,$invoice_common)
- {
-// $value = trim($value);
-// $value = str_replace('\n','<BR>',$value);
-// $value = str_replace('\r','',$value);
-//echo '<br> '.$name.': => '.$value;
-
- $this->currentrecord += array($name => $value);
- return $buffer;
- }
-
- function import_end_record($buffer,$invoice_common)
- {
- $buffer[$this->id]='';
-
- while ( list($name, $value) =
each($this->currentrecord))
- {
- if($name=='belop')
- {
- $godkjentbelop=$value;
- }
-
-
- if($name=='loc1' &&
$invoice_common['auto_tax']):
- {
-
$mvakode=$this->soXport->auto_tax($value);
-
- if($mvakode)
- {
- $buffer[$this->id]['mvakode'] =
$mvakode;
- }
- else
- {
- $buffer[$this->id]['mvakode'] =
$this->mvakode;
- }
- }
- elseif($name=='loc1' &&
!$invoice_common['auto_tax']):
- {
- $buffer[$this->id]['mvakode'] =
$this->mvakode;
- }
- endif;
-
- $buffer[$this->id][$name] = $value;
- $buffer[$this->id]['fakturanr'] =
$invoice_common['invoice_num'];
- $buffer[$this->id]['splitt'] = $this->splitt;
- $buffer[$this->id]['kildeid'] = $this->kildeid;
-
- $buffer[$this->id]['spbudact_code'] =
$this->spbudact_code;
- $buffer[$this->id]['typeid'] =
$invoice_common['type'];
- $buffer[$this->id]['regtid'] =
date($this->datetimeformat);
- $buffer[$this->id]['artid'] =
$invoice_common['art'];
- $buffer[$this->id]['godkjentbelop'] =
$godkjentbelop;
- $buffer[$this->id]['spvend_code'] =
$invoice_common['vendor_id'];
-// $buffer[$this->id]['dimb'] =
$invoice_common['dim_b'];
- $buffer[$this->id]['oppsynsmannid'] =
$invoice_common['janitor'];
- $buffer[$this->id]['saksbehandlerid'] =
$invoice_common['supervisor'];
- $buffer[$this->id]['budsjettansvarligid'] =
$invoice_common['budget_responsible'];
-
- if($invoice_common['auto_tax'])
- {
- $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]['loc1']);
- }
- }
- return $buffer;
- }
-
- function import_end_file($buffer,$bilagsnr)
- {
- $num = $this->soXport->add($buffer);
- $receipt['message'][]= array('msg' =>
lang('Successfully imported %1 records into your invoice register.',$num).'
'.lang('ID').': '. $bilagsnr);
- return $receipt;
- }
- }
-?>
Deleted: trunk/property/inc/import/default/Import_fra_Service_xml
===================================================================
--- trunk/property/inc/import/default/Import_fra_Service_xml 2013-12-20
12:31:53 UTC (rev 11548)
+++ trunk/property/inc/import/default/Import_fra_Service_xml 2013-12-20
14:11:22 UTC (rev 11549)
@@ -1,311 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage import
- * @version $Id: Import_fra_Service_xml,v 1.18 2007/02/06 08:02:49
sigurdne Exp $
- */
-
- /**
- * Description
- * @package property
- */
-
- class import_conv
- {
- var $currentrecord = array(); //used for buffering to allow uid
lines to go first
- var $id = -1;
- var $kildeid=1;
- var $splitt=0;
- var $type = 'csv';
- var $header_count = 17;
- var $soXport;
- var $invoice;
-
- var $import = array(
- 'Bestilling' => 'pmwrkord_code',
- 'Fakt. Nr' => 'fakturanr',
- 'Konto' => 'spbudact_code',
- 'Objekt' => 'dima',
- 'Fag/Timer/Matr' => 'dimd',
- 'MVA' => 'mvakode',
- 'Tjeneste'=> 'kostra_id',
- 'Bel\xF8p [kr]' => 'belop'
- );
-
- var $header = array('Bestilling','Fakt.
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Bel\xF8p [kr]');
-
- function import_conv()
- {
- $this->db =
clone($GLOBALS['phpgw']->db);
- $this->soXport =
CreateObject('property.soXport');
- $this->invoice =
CreateObject('property.boinvoice');
- $this->dateformat =
$GLOBALS['phpgw']->db->date_format();
- $this->datetimeformat =
$GLOBALS['phpgw']->db->datetime_format();
- $this->next_bilagsnr =
$this->invoice->next_bilagsnr();
- $this->xmltool =
CreateObject('phpgwapi.xmltool');
- }
-
- function import($invoice_common,$download)
- {
- $tsvfile = $invoice_common['tsvfile'];
- $conv_type = $invoice_common['conv_type'];
- $valid_data= False;
- $buffer = array();
- $buffer = $this->import_start_file($buffer);
-
- $xmldata=file_get_contents($tsvfile);
- $this->xmltool->import_xml($xmldata);
- $var_result = $this->xmltool->export_var();
- if(is_array($var_result['Worksheet']['Table']['Row']))
- {
-
$data_temp=$var_result['Worksheet']['Table']['Row'];
- }
- else
- {
-
$data_temp=$var_result['Worksheet'][0]['Table']['Row'];
- }
- $rows = count($data_temp);
-//_debug_array($data_temp);
-// _debug_array($var_result['Worksheet'][0]['Table']['Row']);
-//_debug_array($var_result['Worksheet']['Table']['Row']);
-
- if (isset($data_temp) AND is_array($data_temp))
- {
-
- for ($i = $this->header_count; $i < $rows; ++$i)
- {
- $data=$data_temp[$i]['Cell'];
-
- $num = count($data);
- $buffer =
$this->import_start_record($buffer);
- $valid_data=0;
- for ($c=0; $c<$num; $c++ )
- {
- //Send name/value pairs along
with the buffer
- if
($this->import[$this->header[$c]] != '' && $data[$c]['Data'] != '')
- {
-
-//echo '<br>'.$c.': '.$this->import[$this->header[$c]].' =>
'.$data[$c]['Data'];
- $buffer =
$this->import_new_attrib($buffer,
$this->import[$this->header[$c]],$data[$c]['Data'],$invoice_common);
- $valid_data= True;
- if($data[$c]['Data'])
- {
- $valid_data++;
- }
- }
- }
- if ($valid_data > 0)
- {
- $buffer =
$this->import_end_record($buffer,$invoice_common);
- $valid_data= False;
- }
- }
- }
-
-
- if(!$download)
- {
- $buffer =
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
- }
-
-//print_r($buffer);
- $this->header = array('Bestilling','Fakt.
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Tjeneste','Bel\xF8p [kr]');
- return $buffer;
- }
-
-
- function import_start_file($buffer)
- {
- return $buffer;
- }
-
- function import_start_record($buffer)
- {
- $top=array();
- ++$this->id;
- $this->currentrecord = $top;
- return $buffer;
- }
-
- function import_new_attrib($buffer,$name,$value,$invoice_common)
- {
-
- $value = trim($value);
- $value = str_replace('\n','<BR>',$value);
- $value = str_replace('\r','',$value);
-
- $this->currentrecord += array($name => $value);
-
- return $buffer;
- }
-
- function import_end_record($buffer,$invoice_common)
- {
- $buffer[$this->id]='';
- while ( list($name, $value) =
each($this->currentrecord))
- {
- $invoice_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
- if($invoice_common['num_days'])
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
- }
- else
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
- }
-
- if($name=='belop')
- {
- $value = str_replace('kr','',$value);
- $value = str_replace(' ','',$value);
- $value = str_replace(',','.',$value);
-
- if( $invoice_common['art'] == 2 ) //
kreditnota
- {
- $value = -1 * abs($value);
- }
-
- $godkjentbelop=$value;
- }
- if($name=='pmwrkord_code')
- {
-
if(!$this->soXport->check_order(intval($value)))
- {
- $value='';
- }
- else
- {
-
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value));
- }
- }
- if($name=='spbudact_code')
- {
- $value =
$this->check_spbudact_code($value);
- }
-
- if($name=='fakturanr')
- {
- if($invoice_common['invoice_num'])
- {
-
$value=$invoice_common['invoice_num'];
- }
- }
-
- 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;
- $buffer[$this->id]['kildeid'] = $this->kildeid;
- $buffer[$this->id]['kidnr'] =
$invoice_common['kid_nr'];
- $buffer[$this->id]['typeid'] =
$invoice_common['type'];
- $buffer[$this->id]['fakturadato'] =
$invoice_date;
- $buffer[$this->id]['forfallsdato'] =
$payment_date;
- $buffer[$this->id]['periode'] =
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
- $buffer[$this->id]['regtid'] =
date($this->datetimeformat);
- $buffer[$this->id]['artid'] =
$invoice_common['art'];
- $buffer[$this->id]['godkjentbelop'] =
$godkjentbelop;
- $buffer[$this->id]['spvend_code'] =
$invoice_common['vendor_id'];
- $buffer[$this->id]['dimb'] =
$invoice_common['dim_b'];
- $buffer[$this->id]['oppsynsmannid'] =
$invoice_common['janitor'];
- $buffer[$this->id]['saksbehandlerid'] =
$invoice_common['supervisor'];
- $buffer[$this->id]['budsjettansvarligid'] =
$invoice_common['budget_responsible'];
-
- if($invoice_common['auto_tax'])
- {
- $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]['loc1']);
- }
- return $buffer;
- }
-
- function check_spbudact_code($id)
- {
- $b_account='';
- $this->db->query("select id from fm_b_account where
id='$id'");
- $this->db->next_record();
- if ($this->db->f('id'))
- {
- $b_account = $this->db->f('id');
- }
- else
- {
- $this->db->query("select id from
fm_b_account_convert where old_id='$id'");
- $this->db->next_record();
- $b_account = $this->db->f('id');
- }
-
- return $b_account;
- }
-
- function check_dima($id)
- {
- $loc1=substr($id,0,4);
- $loc2=substr($id,4,2);
-
- $this->db->query("select loc1 from fm_location1 where
loc1='$loc1' AND ((fm_location1.category <> 99) OR (fm_location1.category IS
NULL))");
- $this->db->next_record();
- if ($this->db->f('loc1'))
- {
- $dima = $this->db->f('loc1');
-
- if ($loc2)
- {
- $this->db->query("select location_code
from fm_location2 where loc1='$loc1' AND loc2='$loc2' AND
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
- $this->db->next_record();
- if ($this->db->f('location_code'))
- {
- $dima =
str_replace('-','',$this->db->f('location_code'));
- }
- else
- {
- unset($dima);
- }
- }
- }
-
- return $dima;
- }
-
- function import_end_file($buffer,$bilagsnr)
- {
- $num = $this->soXport->add($buffer);
- $receipt['message'][]= array('msg' =>
lang('Successfully imported %1 records into your invoice register.',$num).'
'.lang('ID').': '. $bilagsnr);
- return $receipt;
- }
- }
-?>
Deleted: trunk/property/inc/import/default/import_fra_Service_xls
===================================================================
--- trunk/property/inc/import/default/import_fra_Service_xls 2013-12-20
12:31:53 UTC (rev 11548)
+++ trunk/property/inc/import/default/import_fra_Service_xls 2013-12-20
14:11:22 UTC (rev 11549)
@@ -1,280 +0,0 @@
-<?php
- /**
- * phpGroupWare - property: a Facilities Management System.
- *
- * @author Sigurd Nes <address@hidden>
- * @copyright Copyright (C) 2003,2004,2005,2006,2007 Free Software
Foundation, Inc. http://www.fsf.org/
- * This file is part of phpGroupWare.
- *
- * phpGroupWare is free software; you can redistribute it and/or modify
- * it under the terms of the GNU General Public License as published by
- * the Free Software Foundation; either version 2 of the License, or
- * (at your option) any later version.
- *
- * phpGroupWare is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with phpGroupWare; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301
USA
- *
- * @license http://www.gnu.org/licenses/gpl.html GNU General Public
License
- * @internal Development of this application was funded by
http://www.bergen.kommune.no/bbb_/ekstern/
- * @package property
- * @subpackage import
- * @version $Id: import_fra_Service_xls 18358 2007-11-27 04:43:37Z
skwashd $
- */
-
- /**
- * Description
- * @package property
- */
-
- class import_conv
- {
- var $currentrecord = array(); //used for buffering to allow uid
lines to go first
- var $id = -1;
- var $kildeid=1;
- var $splitt=0;
- var $type = 'csv';
- var $header_count = 18;
- var $soXport;
- var $invoice;
-
- var $import = array(
- 'Bestilling' => 'pmwrkord_code',
- 'Fakt. Nr' => 'fakturanr',
- 'Konto' => 'spbudact_code',
- 'Objekt' => 'dima',
- 'Fag/Timer/Matr' => 'dimd',
- 'MVA' => 'mvakode',
- 'Tjeneste'=> 'kostra_id',
- 'Belop [kr]' => 'belop'
- );
-
- var $header = array('Bestilling','Fakt.
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Belop [kr]');
-
- function import_conv()
- {
- $this->db =
clone($GLOBALS['phpgw']->db);
- $this->soXport =
CreateObject('property.soXport');
- $this->invoice =
CreateObject('property.boinvoice');
- $this->bocommon =
CreateObject('property.bocommon');
- $this->dateformat =
$GLOBALS['phpgw']->db->date_format();
- $this->datetimeformat =
$GLOBALS['phpgw']->db->datetime_format();
- $this->next_bilagsnr =
$this->invoice->next_bilagsnr();
- }
-
- function import($invoice_common,$download)
- {
- $tsvfile = $invoice_common['tsvfile'];
- $conv_type = $invoice_common['conv_type'];
- $valid_data= False;
- $buffer = array();
- $data = CreateObject('phpgwapi.excelreader');
-
- $data->setOutputEncoding('CP1251');
- $data->read($tsvfile);
-
- $this->id = 0;
- $num = count($this->header)+1;
- $rows = $data->sheets[0]['numRows']+1;
- for ($i=18; $i<$rows; $i++ ) //First data entry on row
18
- {
- $this->currentrecord = array();
-
- $valid_data=0;
- for ($c=1; $c<$num; $c++ )
- {
- //Send name/value pairs along with the
buffer
- if ($data->sheets[0]['cells'][$i][$c]
!= '')
- {
-
$this->import_new_attrib($this->import[$this->header[$c-1]],$data->sheets[0]['cells'][$i][$c],$invoice_common);
-
if($data->sheets[0]['cells'][$i][$c])
- {
- $valid_data++;
- }
- }
- }
- if ($valid_data > 0)
- {
- $buffer =
$this->import_end_record($buffer,$invoice_common);
- $valid_data= False;
- $this->id++;
- }
- }
-
- if(!$download)
- {
- $buffer =
$this->import_end_file($buffer,$invoice_common['bilagsnr']);
- }
-
- $this->header = array('Bestilling','Fakt.
Nr','Konto','Objekt','Fag/Timer/Matr','MVA','Tjeneste','Belop [kr]');
- return $buffer;
- }
-
- function import_new_attrib($name,$value,$invoice_common)
- {
- $value = $this->bocommon->ascii2utf(trim($value));
- $value = str_replace('\n','<BR>',$value);
- $value = str_replace('\r','',$value);
-
- $this->currentrecord += array($name => $value);
- }
-
- function import_end_record($buffer,$invoice_common)
- {
- $buffer[$this->id]=array();
- while ( list($name, $value) =
each($this->currentrecord))
- {
- $invoice_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear']));
-
- if($invoice_common['num_days'])
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['smonth'],$invoice_common['sday'],$invoice_common['syear'])+(86400*$invoice_common['num_days']));
- }
- else
- {
- $payment_date =
date($this->dateformat,mktime(2,0,0,$invoice_common['emonth'],$invoice_common['eday'],$invoice_common['eyear']));
- }
-
- if($name=='belop')
- {
- $value = str_replace('kr','',$value);
- $value = str_replace(' ','',$value);
- $value = str_replace(',','.',$value);
-
- if( $invoice_common['art'] == 2 ) //
kreditnota
- {
- $value = -1 * abs($value);
- }
-
- $godkjentbelop=$value;
- }
- if($name=='pmwrkord_code')
- {
-
if(!$this->soXport->check_order(intval($value)))
- {
- $value='';
- }
- else
- {
-
$buffer[$this->id]['project_id'] = $this->soXport->get_project(intval($value));
- }
- }
- if($name=='spbudact_code')
- {
- $value =
$this->check_spbudact_code($value);
- }
-
- if($name=='fakturanr')
- {
- if($invoice_common['invoice_num'])
- {
-
$value=$invoice_common['invoice_num'];
- }
- }
-
- if($name=='dima')
- {
- $value = $this->check_dima($value);
- $buffer[$this->id]['loc1'] =
$loc1=substr($value,0,4);
- }
-
- if($name=='mvakode')
- {
- if( $invoice_common['auto_tax'])
- {
- $value =
(int)$this->soXport->auto_tax($buffer[$this->id]['loc1']);
- }
- else
- {
- $value = (int) $value;
- }
- }
-
- $buffer[$this->id][$name] = $value;
- $buffer[$this->id]['bilagsnr'] =
$this->next_bilagsnr;
- $buffer[$this->id]['splitt'] = $this->splitt;
- $buffer[$this->id]['kildeid'] = $this->kildeid;
- $buffer[$this->id]['kidnr'] =
$invoice_common['kid_nr'];
- $buffer[$this->id]['typeid'] =
$invoice_common['type'];
- $buffer[$this->id]['fakturadato'] =
$invoice_date;
- $buffer[$this->id]['forfallsdato'] =
$payment_date;
- $buffer[$this->id]['periode'] =
$invoice_common['syear'] . sprintf("%02d",$invoice_common['smonth']);
- $buffer[$this->id]['regtid'] =
date($this->datetimeformat);
- $buffer[$this->id]['artid'] =
$invoice_common['art'];
- $buffer[$this->id]['godkjentbelop'] =
$godkjentbelop;
- $buffer[$this->id]['spvend_code'] =
$invoice_common['vendor_id'];
- $buffer[$this->id]['dimb'] =
$invoice_common['dim_b'];
- $buffer[$this->id]['oppsynsmannid'] =
$invoice_common['janitor'];
- $buffer[$this->id]['saksbehandlerid'] =
$invoice_common['supervisor'];
- $buffer[$this->id]['budsjettansvarligid'] =
$invoice_common['budget_responsible'];
-
- if($invoice_common['auto_tax'])
- {
- $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]['loc1']);
- }
- return $buffer;
- }
-
- function check_spbudact_code($id)
- {
- $b_account='';
- $this->db->query("select id from fm_b_account where
id='$id'");
- $this->db->next_record();
- if ($this->db->f('id'))
- {
- $b_account = $this->db->f('id');
- }
- else
- {
- $this->db->query("select id from
fm_b_account_convert where old_id='$id'");
- $this->db->next_record();
- $b_account = $this->db->f('id');
- }
-
- return $b_account;
- }
-
- function check_dima($id)
- {
- $loc1=substr($id,0,4);
- $loc2=substr($id,4,2);
-
- $this->db->query("select loc1 from fm_location1 where
loc1='$loc1' AND ((fm_location1.category <> 99) OR (fm_location1.category IS
NULL))");
- $this->db->next_record();
- if ($this->db->f('loc1'))
- {
- $dima = $this->db->f('loc1');
-
- if ($loc2)
- {
- $this->db->query("select location_code
from fm_location2 where loc1='$loc1' AND loc2='$loc2' AND
((fm_location2.category <> 99) OR (fm_location2.category IS NULL))");
- $this->db->next_record();
- if ($this->db->f('location_code'))
- {
- $dima =
str_replace('-','',$this->db->f('location_code'));
- }
- else
- {
- unset($dima);
- }
- }
- }
- return $dima;
- }
-
- function import_end_file($buffer,$bilagsnr)
- {
- $num = $this->soXport->add($buffer);
- $receipt['message'][]= array('msg' =>
lang('Successfully imported %1 records into your invoice register.',$num).'
'.lang('ID').': '. $bilagsnr);
- return $receipt;
- }
- }
-?>
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Fmsystem-commits] [11549] property:remove obsolete,
Sigurd Nes <=