fmsystem-commits
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Fmsystem-commits] [11728] property: remove obselete


From: Sigurd Nes
Subject: [Fmsystem-commits] [11728] property: remove obselete
Date: Fri, 21 Feb 2014 10:19:58 +0000

Revision: 11728
          http://svn.sv.gnu.org/viewvc/?view=rev&root=fmsystem&revision=11728
Author:   sigurdne
Date:     2014-02-21 10:19:58 +0000 (Fri, 21 Feb 2014)
Log Message:
-----------
property: remove obselete

Removed Paths:
-------------
    trunk/property/inc/export/default/Agresso
    trunk/property/inc/export/default/Ecolink
    trunk/property/inc/export/default/GABNr
    trunk/property/inc/export/default/Kemner_kvittering

Deleted: trunk/property/inc/export/default/Agresso
===================================================================
--- trunk/property/inc/export/default/Agresso   2014-02-21 10:13:37 UTC (rev 
11727)
+++ trunk/property/inc/export/default/Agresso   2014-02-21 10:19:58 UTC (rev 
11728)
@@ -1,1151 +0,0 @@
-<?php
-       /**
-       * phpGroupWare - property: a Facilities Management System.
-       *
-       * @author Sigurd Nes <address@hidden>
-       * @copyright Copyright (C) 
2003,2004,2005,2006,2007,2008,2009,2010,2011,2012 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 export
-       * @version $Id$
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class export_conv
-       {
-               //var $fil_katalog='c:/temp'; //On windows use 
"//computername/share/filename" or "\\\\computername\share\filename" to check 
files on network shares.
-
-               protected $old_files_deleted;
-               protected $debug;
-               protected $orders_affected = array();
-               protected $db;
-               protected $db2;
-               protected $soXport;
-               protected $config;
-
-               function __construct()
-               {
-                       $this->db               = & $GLOBALS['phpgw']->db;
-                       $this->join     = & $this->db->join;
-                       $this->db2              = clone($this->db);
-                       $this->soXport  = CreateObject('property.soXport');
-                       $this->config   = 
CreateObject('admin.soconfig',$GLOBALS['phpgw']->locations->get_id('property', 
'.invoice'));
-               }
-
-               function 
select_periods_with_invoice_to_transfer($pre_transfer='')
-               {
-                       if($pre_transfer)
-                       {
-                               $sql= "SELECT DISTINCT periode from fm_ecobilag 
WHERE utbetalingsigndato IS NULL";
-                       }
-                       else
-                       {
-                               $sql= "SELECT DISTINCT periode from fm_ecobilag 
WHERE budsjettsigndato is not null and (saksigndato is not null or 
oppsynsigndato is not null) and utbetalingsigndato is not null";
-                       }
-
-                       $periode = array();
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       while ($this->db->next_record())
-                       {
-                               $periode[]      = $this->db->f('periode');
-                       }
-
-                       return $periode;
-               }
-
-               function log_end($batchid)
-               {
-                       $tid=date($this->soXport->datetimeformat);
-                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','End transfer','$tid')";
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-               function log_error($batchid,$error_desr)
-               {
-                       $tid=date($this->soXport->datetimeformat);
-                       $sql= "insert into fm_ecologg 
(batchid,ecobilagid,status,melding,tid) values 
('$batchid',NULL,0,'$error_desr','$tid')";
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-               function increment_batchid()
-               {
-
-                       $this->db->query("update fm_idgenerator  set value = 
value + 1 where name = 'Ecobatchid'",__LINE__,__FILE__);
-                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'",__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $bilagsnr = $this->db->f('value');
-                       return $bilagsnr;
-
-               }
-
-               function next_batchid()
-               {
-
-                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'",__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $batchid = $this->db->f('value')+1;
-
-                       return $batchid;
-               }
-
-               //Lagre start melding
-               function log_start($batchid)
-               {
-                       $tid=date($this->soXport->datetimeformat);
-                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','Start transfer','$tid')";
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-               function get_vendor_info($vendor_id='')
-               {
-                       $sql = "select org_nr,konto_nr from fm_vendor where 
id='$vendor_id'";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->db->next_record();
-
-                       $vendor_info= array(
-                               'org_nr' => $this->db->f('org_nr'),
-                               'konto_nr' => $this->db->f('konto_nr')
-                               );
-
-                       return $vendor_info;
-               }
-
-               function get_order_title($order_id='')
-               {
-                       $sql = "select type from fm_orders where 
id='$order_id'";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->db->next_record();
-
-                       switch($this->db->f('type'))
-                       {
-                               case 'workorder':
-                                       $sql2 = "select title from fm_workorder 
where id='$order_id'";
-                                       
$this->db->query($sql2,__LINE__,__FILE__);
-                                       $this->db->next_record();
-                                       $order_title = $this->db->f('title');
-                                       break;
-                               case 's_agreement':
-                                       $sql2 = "select descr as title from 
fm_s_agreement where id='$order_id'";
-                                       
$this->db->query($sql2,__LINE__,__FILE__);
-                                       $this->db->next_record();
-                                       $order_title = $this->db->f('title');
-                                       break;
-                       }
-
-                       return $order_title;
-               }
-
-
-               function select_invoice_rollback($day,$month,$year,$Filnavn)
-               {
-
-                       switch($GLOBALS['phpgw_info']['server']['db_type'])
-                       {
-                               case 'mssql':
-                                       $datepart_year          = 
"datepart(year,overftid)";
-                                       $datepart_month         = 
"datepart(month,overftid)";
-                                       $datepart_day           = 
"datepart(day,overftid)";
-                                       break;
-                               case 'mysql':
-                                       $datepart_year          = 
"YEAR(overftid)";
-                                       $datepart_month         = 
"MONTH(overftid)";
-                                       $datepart_day           = 
"DAYOFMONTH(overftid)";
-                                       break;
-                               case 'pgsql':
-                               case 'postgres':
-                                       $datepart_year          = 
"date_part('year',overftid)";
-                                       $datepart_month         = 
"date_part('month',overftid)";
-                                       $datepart_day           = 
"date_part('day',overftid)";
-                                       break;
-                       }
-
-
-               $sql = "SELECT * FROM fm_ecobilagoverf WHERE filnavn='$Filnavn' 
and $datepart_year=$year and $datepart_month=$month and $datepart_day= $day";
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $i = 0;
-                       while ($this->db->next_record())
-                       {
-                               $invoice_roleback[$i]['id']     = 
$this->db->f('id');
-                               $invoice_roleback[$i]['bilagsnr']       = 
$this->db->f('bilagsnr');
-                               $invoice_roleback[$i]['kidnr']  = 
$this->db->f('kidnr');
-                               $invoice_roleback[$i]['typeid'] = 
$this->db->f('typeid');
-                               $invoice_roleback[$i]['kildeid']        = 
$this->db->f('kildeid');
-                               $invoice_roleback[$i]['pmwrkord_code']  = 
$this->db->f('pmwrkord_code');
-                               $invoice_roleback[$i]['belop']  = 
$this->db->f('belop');
-                               $invoice_roleback[$i]['fakturadato']    = 
$this->db->f('fakturadato');
-                               $invoice_roleback[$i]['periode']        = 
$this->db->f('periode');
-                               $invoice_roleback[$i]['forfallsdato']   = 
$this->db->f('forfallsdato');
-                               $invoice_roleback[$i]['fakturanr']      = 
$this->db->f('fakturanr');
-                               $invoice_roleback[$i]['spbudact_code']  = 
$this->db->f('spbudact_code');
-                               $invoice_roleback[$i]['regtid'] = 
$this->db->f('regtid');
-                               $invoice_roleback[$i]['artid']  = 
$this->db->f('artid');
-                               $invoice_roleback[$i]['godkjentbelop']  = 
$this->db->f('godkjentbelop');
-                               $invoice_roleback[$i]['spvend_code']    = 
$this->db->f('spvend_code');
-                               $invoice_roleback[$i]['dima']   = 
$this->db->f('dima');
-                               $invoice_roleback[$i]['loc1']   = 
$this->db->f('loc1');
-                               $invoice_roleback[$i]['dimb']   = 
$this->db->f('dimb');
-                               $invoice_roleback[$i]['mvakode']        = 
$this->db->f('mvakode');
-                               $invoice_roleback[$i]['dimd']   = 
$this->db->f('dimd');
-                               $invoice_roleback[$i]['project_id']     = 
$this->db->f('project_id');
-                               $invoice_roleback[$i]['kostra_id']      = 
$this->db->f('kostra_id');
-                               $invoice_roleback[$i]['item_type']      = 
$this->db->f('item_type');
-                               $invoice_roleback[$i]['item_id']        = 
$this->db->f('item_id');
-
-                               if($this->db->f('oppsynsmannid'))
-                               {
-                                       $invoice_roleback[$i]['oppsynsmannid']  
= $this->db->f('oppsynsmannid');
-                               }
-                               if($this->db->f('saksbehandlerid'))
-                               {
-                                       
$invoice_roleback[$i]['saksbehandlerid']        = 
$this->db->f('saksbehandlerid');
-                               }
-
-                               $invoice_roleback[$i]['budsjettansvarligid']    
= $this->db->f('budsjettansvarligid');
-
-                               if($this->db->f('oppsynsigndato'))
-                               {
-                                       $invoice_roleback[$i]['oppsynsigndato'] 
= $this->db->f('oppsynsigndato');
-                               }
-                               if($this->db->f('saksigndato'))
-                               {
-                                       $invoice_roleback[$i]['saksigndato']    
= $this->db->f('saksigndato');
-                               }
-
-                               $invoice_roleback[$i]['budsjettsigndato']       
= $this->db->f('budsjettsigndato');
-                               $invoice_roleback[$i]['merknad']        = 
$this->db->f('merknad');
-                               $invoice_roleback[$i]['splitt'] = 
$this->db->f('splitt');
-                               $invoice_roleback[$i]['ordrebelop']     = 
$this->db->f('ordrebelop');
-                               $invoice_roleback[$i]['utbetalingid']   = 
$this->db->f('utbetalingid');
-                               $invoice_roleback[$i]['utbetalingsigndato']     
= $this->db->f('utbetalingsigndato');
-                               $i++;
-                       }
-                       return $invoice_roleback;
-           }
-
-
-               //rollback function
-               function bilag_update_overf($BilagOverf)
-               {
-                       $values= array(
-                               $BilagOverf['project_id'],
-                               $BilagOverf['kostra_id'],
-                               $BilagOverf['pmwrkord_code'],
-                               $BilagOverf['bilagsnr'],
-                               $BilagOverf['splitt'],
-                               $BilagOverf['kildeid'],
-                               $BilagOverf['kidnr'],
-                               $BilagOverf[typeid],
-                               $BilagOverf['fakturadato'],
-                               $BilagOverf['forfallsdato'],
-                               $BilagOverf['regtid'],
-                               $BilagOverf['artid'],
-                               $BilagOverf['spvend_code'],
-                               $BilagOverf['dimb'],
-                               $BilagOverf['oppsynsmannid'],
-                               $BilagOverf['saksbehandlerid'],
-                               $BilagOverf['budsjettansvarligid'],
-                               $BilagOverf['fakturanr'],
-                               $BilagOverf['spbudact_code'],
-                               $BilagOverf['dima'],
-                               $BilagOverf['loc1'],
-                               $BilagOverf['dimd'],
-                               $BilagOverf['mvakode'],
-                               $BilagOverf['periode'],
-                               
$this->db->db_addslashes($BilagOverf['merknad']),
-                               $BilagOverf['utbetalingid'],
-                               $BilagOverf['oppsynsigndato'],
-                               $BilagOverf['saksigndato'],
-                               $BilagOverf['budsjettsigndato'],
-                               $BilagOverf['utbetalingsigndato'],
-                               $BilagOverf['item_type'],
-                               $BilagOverf['item_id'],
-                               );
-
-                       $values = $this->db->validate_insert($values);
-
-                       $sql= "INSERT INTO fm_ecobilag 
(project_id,kostra_id,pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
-                       . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
-                       . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
-                       . " 
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,item_type,item_id,belop,godkjentbelop)"
-                       . " values ($values,"
-                       . $this->db->money_format($BilagOverf['belop']) . ","
-                       . $this->db->money_format($BilagOverf['godkjentbelop']) 
. ")";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-               function 
overfor($download,$pre_transfer='',$force_period_year='')
-               {
-
-//                     $download = 'on';
-//                     $download = False;
-                       $pre_transfer=True;
-//                     $this->debug=True;
-
-                       //Generer batch ID
-                       $batchid = $this->soXport->next_batchid();
-                       if ($download=='on')
-                       {
-                               $this->increment_batchid();
-                               //Lagre melding
-                               $this->log_start($batchid);
-                       }
-
-                       //Velg ut alle perioder som har bilag som skal overføres
-                       if ($pre_transfer)
-                       {
-                               $periodes = 
$this->select_periods_with_invoice_to_transfer($pre_transfer);
-
-                               foreach ($periodes as $periode)
-                               {
-                                       
$this->OverforPeriode($batchid,$periode,$download,$pre_transfer);
-                               }
-                       }
-
-                       $pre_transfer=False;
-
-                       $periodes = 
$this->select_periods_with_invoice_to_transfer($pre_transfer);
-
-                       foreach ($periodes as $periode)
-                       {
-                               
$this->OverforPeriode($batchid,$periode,$download,$pre_transfer,$force_period_year);
-                       }
-
-                       //Lagre melding
-                       if ($download=='on' || $pre_transfer)
-                       {
-                               $this->log_end($batchid); //Lagre melding
-                       }
-
-                       if (!$download=='on')
-                       {
-                               $GLOBALS['phpgw_info']['flags']['noheader'] = 
true;
-                               $GLOBALS['phpgw_info']['flags']['nofooter'] = 
true;
-                               $GLOBALS['phpgw_info']['flags']['xslt_app'] = 
false;
-                               $GLOBALS['phpgw_info']['flags']['noframework'] 
= true;
-                               echo '&nbsp<a 
href="'.$GLOBALS['phpgw']->link('/index.php',array('menuaction'=> 
'property.uiXport.export')) . '">' . lang('Back') . '</a></br>';
-                               $GLOBALS['phpgw']->common->phpgw_exit();
-                       }
-
-                       return $receipt;
-               }
-
-               function errorhandler($batchid,$error_desr)
-               {
-                       $this->db->transaction_abort();
-
-                       $meld = $error_desr;
-
-                       phpgwapi_cache::message_set($error_desr, 'error'); 
-                       //Vis feilmelding
-//                     echo $meld;
-
-                       //Lagre feilmelding
-                       $this->log_error($batchid,$error_desr);
-               }
-
-               function RullTilbake($Filnavn,$Dato)
-               {
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $dateformat = str_replace(".","",$dateformat);
-                       $dateformat = str_replace("-","",$dateformat);
-                       $dateformat = str_replace("/","",$dateformat);
-                       $y=strpos($dateformat,'y');
-                       $d=strpos($dateformat,'d');
-                       $m=strpos($dateformat,'m');
-
-                       $dateparts = explode('/', $Dato);
-                       $day = $dateparts[$d];
-                       $month = $dateparts[$m];
-                       $year = $dateparts[$y];
-        /*             $date1 = mktime (2,0,0,$month,$day,$year);
-                       if ($date1)
-                       {
-                               $Dato=$date1;
-                       }
-
-                       $Dato= date("M d Y",$Dato);
-       */
-
-                       
$BilagOverf=$this->select_invoice_rollback($day,$month,$year,$Filnavn);
-                       $this->db->transaction_begin();
-
-                       for ($i=0;$i<count($BilagOverf);$i++)
-                       {
-                               $this->bilag_update_overf($BilagOverf[$i]);
-
-
-                               if($BilagOverf[$i]['pmwrkord_code'])
-                               {
-                                       
$orders_affected[$BilagOverf[$i]['pmwrkord_code']] = true;
-
-                                       $Belop = sprintf("%01.2f", 
$BilagOverf[$i]['ordrebelop'])*100;
-
-                                       if ($BilagOverf[$i]['dimd'] % 2 == 0)
-                                       {
-                                               
$actual_cost_field='act_mtrl_cost';
-                                       }
-                                       else
-                                       {
-                                               
$actual_cost_field='act_vendor_cost';
-                                       }
-
-                                       $operator='-';
-
-                                       
$this->soXport->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
-                               }
-
-                               //Slett fra avviks tabell
-                       //      
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
-
-                               //Slett fra arkiv
-                               
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
-
-                               $antall = $antall + 1;
-                       }
-
-                       if($antall > 0)
-                       {
-                               $fil_katalog = 
$this->config->config_data['export']['path'];
-
-                               if(unlink ($fil_katalog. '/' . $Filnavn))
-                               {
-                                       $this->db->transaction_commit();
-                                       $receipt['message'][]= array('msg' => 
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
-                                       $receipt['message'][]= array('msg' => 
lang('File %1 is deleted',$Filnavn));
-                               }
-                               else
-                               {
-                                       $this->db->transaction_abort();
-                                       $receipt['message'][]= array('msg' => 
'Noe gikk galt!');
-                               }
-                       }
-                       else
-                       {
-                               $receipt['error'][]= array('msg' => lang('Sorry 
- None hits'));
-                       }
-                       return $receipt;
-               }
-
-
-               function LagFilnavn ($batchid,$pre_transfer='')
-               {
-                       if($pre_transfer)
-                       {
-                               $fil_katalog = 
$this->config->config_data['export']['pre_path'];
-
-                               // Slett gamle filer
-
-                               if(!$this->old_files_deleted)
-                               {
-                                       for ($i=0;$i<13;$i++)
-                                       {
-                                               @unlink($fil_katalog . '/FDA_' 
. $i. '.TXT');
-                                       }
-                                
-                                       $this->old_files_deleted= True;
-                               }
-
-
-                               $i = 1;
-                               do
-                               {
-                                       $Filnavn = $fil_katalog . '/FDA_' . $i. 
'.TXT';
-
-                                       //Sjekk om filen eksisterer
-                                       If (!file_exists($Filnavn))
-                                       {
-                                               return $Filnavn;
-                                       }
-
-                                       $i++;
-                               }
-                               while  ($i < 13);
-
-                       }
-                       else
-                       {
-                               $fil_katalog = 
$this->config->config_data['export']['path'];
-                               $continue = True;
-                               $i = 1;
-                               do
-                               {
-                                       $Filnavn = $fil_katalog . '/FDB' . 
date("dmy") . '_' . sprintf("%02s",$i) . '.TXT';
-
-                                       //Sjekk om filen eksisterer
-                                       If (!file_exists($Filnavn))
-                                       {
-                                               return $Filnavn;
-                                       }
-
-                                       $i++;
-                               }
-                               while  ($continue);
-                       }
-
-
-                       //Ingen løpenr er ledige, gi feilmelding
-                       return False;
-               }
-
-
-               private function 
get_vouchers_to_transfer($periode,$pre_transfer=false)
-               {
-                       if($pre_transfer)
-                       {
-                               $sql= "SELECT sum(belop) as belop, fakturanr, 
bilagsnr FROM fm_ecobilag WHERE periode='{$periode}' AND utbetalingsigndato IS 
NULL GROUP BY bilagsnr, fakturanr";
-                       }
-                       else
-                       {
-                               $sql="SELECT sum(belop) as belop, fakturanr, 
bilagsnr FROM fm_ecobilag WHERE periode='{$periode}' AND budsjettsigndato IS 
NOT NULL AND ( saksigndato IS NOT NULL OR oppsynsigndato IS NOT NULL ) AND 
utbetalingsigndato IS NOT NULL group by bilagsnr, fakturanr";
-                       }
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $values = array();
-                       while ($this->db->next_record())
-                       {
-                               $values[] = array
-                               (
-                                       'belop'         => 
$this->db->f('belop'),
-                                       'bilagsnr'      => 
$this->db->f('bilagsnr'),
-                                       'fakturanr' => 
$this->db->f('fakturanr'),
-                               );
-                       }
-
-
-                       foreach ($values as &$entry)
-                       {
-                               $sql= "SELECT fm_ecobilag.*,fm_ecouser.initials 
as saksbehandler FROM fm_ecobilag {$this->join} fm_ecouser ON 
fm_ecobilag.budsjettansvarligid=fm_ecouser.lid"
-                               . " WHERE bilagsnr='{$entry['bilagsnr']}' AND 
fakturanr = '{$entry['fakturanr']}'";
-
-                               $this->db->query($sql,__LINE__,__FILE__);
-                               $this->db->next_record();
-
-                               $entry['id']                                    
= $this->db->f('id');
-                               $entry['kidnr']                                 
= $this->db->f('kidnr');
-                               $entry['typeid']                                
= $this->db->f('typeid');
-                               $entry['kildeid']                               
= $this->db->f('kildeid');
-                               $entry['pmwrkord_code']                 = 
$this->db->f('pmwrkord_code');
-                               $entry['fakturadato']                   = 
$this->db->f('fakturadato');
-                               $entry['periode']                               
= $this->db->f('periode');
-                               $entry['forfallsdato']                  = 
$this->db->f('forfallsdato');
-                               $entry['fakturanr']                             
= $this->db->f('fakturanr');
-                               $entry['spbudact_code']                 = 
$this->db->f('spbudact_code');
-                               $entry['regtid']                                
= $this->db->f('regtid');
-                               $entry['artid']                                 
= $this->db->f('artid');
-                               $entry['godkjentbelop']                 = 
$entry['belop'];
-                               $entry['spvend_code']                   = 
$this->db->f('spvend_code');
-                               $entry['dima']                                  
= $this->db->f('dima');
-                               $entry['dimb']                                  
= $this->db->f('dimb');
-                               $entry['mvakode']                               
= $this->db->f('mvakode');
-                               $entry['dimd']                                  
= $this->db->f('dimd');
-                               $entry['dime']                                  
= $this->db->f('dime');
-                               $entry['oppsynsmannid']                 = 
$this->db->f('oppsynsmannid');
-                               $entry['saksbehandlerid']               = 
$this->db->f('saksbehandlerid');
-                               $entry['budsjettansvarligid']   = 
$this->db->f('budsjettansvarligid');
-                               $entry['oppsynsigndato']                = 
$this->db->f('oppsynsigndato');
-                               $entry['saksigndato']                   = 
$this->db->f('saksigndato');
-                               $entry['budsjettsigndato']              = 
$this->db->f('budsjettsigndato');
-                               $entry['merknad']                               
= $this->db->f('merknad');
-                               $entry['line_text']                             
= $this->db->f('line_text');
-                               $entry['splitt']                                
= $this->db->f('splitt');
-                               $entry['utbetalingid']                  = 
$this->db->f('utbetalingid');
-                               $entry['utbetalingsigndato']    = 
$this->db->f('utbetalingsigndato');
-                               $entry['saksbehandler']                 = 
$this->db->f('saksbehandler');
-                               $entry['invoice_line']                          
= $this->get_invoice($entry['bilagsnr'], $entry['fakturanr']);
-
-                       }
-
-                       return $values;
-               }
-
-
-               //Velg ut alle underbilag
-
-               private function get_invoice($bilagsnr, $fakturanr)
-               {
-                       if(!$fakturanr)
-                       {
-                               throw new Exception('Mangler fakturanr');
-                       }
-
-                       $sql= "SELECT fm_ecobilag.* 
,fm_part_of_town.district_id"
-                       . " FROM (fm_location1 {$this->join} fm_part_of_town ON 
fm_location1.part_of_town_id = fm_part_of_town.part_of_town_id)"
-                       . " {$this->join} fm_ecobilag ON fm_location1.loc1 = 
fm_ecobilag.loc1"
-                       . " WHERE bilagsnr='$bilagsnr' AND fakturanr = 
'{$fakturanr}'";
-
-                       $this->db2->query($sql,__LINE__,__FILE__);
-
-                       $values = array();
-                       while ($this->db2->next_record())
-                       {
-                               $values[] = array
-                               (
-                                       'id'                                    
=> $this->db2->f('id'),
-                                       'bilagsnr'                              
=> $this->db2->f('bilagsnr'),
-                                       'kidnr'                                 
=> $this->db2->f('kidnr'),
-                                       'typeid'                                
=> $this->db2->f('typeid'),
-                                       'kildeid'                               
=> $this->db2->f('kildeid'),
-                                       'pmwrkord_code'                 => 
$this->db2->f('pmwrkord_code'),
-                                       'belop'                                 
=> $this->db2->f('belop'),
-                                       'fakturadato'                   => 
$this->db2->f('fakturadato'),
-                                       'periode'                               
=> $this->db2->f('periode'),
-                                       'forfallsdato'                  => 
$this->db2->f('forfallsdato'),
-                                       'fakturanr'                             
=> $this->db2->f('fakturanr'),
-                                       'spbudact_code'                 => 
$this->db2->f('spbudact_code'),
-                                       'regtid'                                
=> $this->db2->f('regtid'),
-                                       'artid'                                 
=> $this->db2->f('artid'),
-                                       'godkjentbelop'                 => 
$this->db2->f('godkjentbelop'),
-                                       'spvend_code'                   => 
$this->db2->f('spvend_code'),
-                                       'dima'                                  
=> $this->db2->f('dima'),
-                                       'loc1'                                  
=> $this->db2->f('loc1'),
-                                       'dimb'                                  
=> $this->db2->f('dimb'),
-                                       'mvakode'                               
=> $this->db2->f('mvakode'),
-                                       'dimd'                                  
=> $this->db2->f('dimd'),
-                                       'dime'                                  
=> $this->db2->f('dime'),
-                                       'project_id'                    => 
$this->db2->f('project_id'),
-                                       'kostra_id'                             
=> $this->db2->f('kostra_id'),
-                                       'oppsynsmannid'                 => 
$this->db2->f('oppsynsmannid'),
-                                       'saksbehandlerid'               => 
$this->db2->f('saksbehandlerid'),
-                                       'budsjettansvarligid'   => 
$this->db2->f('budsjettansvarligid'),
-                                       'oppsynsigndato'                => 
$this->db2->f('oppsynsigndato'),
-                                       'saksigndato'                   => 
$this->db2->f('saksigndato'),
-                                       'budsjettsigndato'              => 
$this->db2->f('budsjettsigndato'),
-                                       'merknad'                               
=> $this->db2->f('merknad'),
-                                       'line_text'                             
=> $this->db2->f('line_text'),
-                                       'splitt'                                
=> $this->db2->f('splitt'),
-                                       'utbetalingid'                  => 
$this->db2->f('utbetalingid'),
-                                       'utbetalingsigndato'    => 
$this->db2->f('utbetalingsigndato'),
-                                       'district_id'                   => 
$this->db2->f('district_id'),
-                                       'item_type'                             
=> $this->db2->f('item_type'),
-                                       'item_id'                               
=> $this->db2->f('item_id')
-                               );
-
-                       }
-
-                       return $values;
-               }
-
-
-               function 
OverforPeriode($batchid,$periode,$download,$pre_transfer='',$force_period_year='')
-               {
-                       $BilagId = 'NULL';
-
-                       //Bestem filnavn
-
-
-                       $Filnavn = $this->LagFilnavn($batchid,$pre_transfer);
-                       if (!$Filnavn)
-                       {
-                               $message='LagFilnavn: Alle loepenr for filnavn 
er i bruk';
-                               $this->errorhandler($batchid,$message);
-                               phpgwapi_cache::message_set($message, 'error'); 
-                               return false;
-                       }
-
-                       //Test om filen kan opprettes og skrives til
-                       if (@fopen($Filnavn, "wb"))
-                       {
-                               unlink($Filnavn);
-                       }
-                       else
-                       {
-                               phpgwapi_cache::message_set('kan ikke lagre til 
fil: '. $Filnavn, 'error'); 
-                               return false;
-                       }
-
-                       //Velg ut alle hoved bilag som skal overføres
-
-                       $this->db->transaction_begin();
-
-                       $oRsBilag =  
$this->get_vouchers_to_transfer($periode,$pre_transfer);
-
-                       $buffer = '';
-
-                       foreach($oRsBilag as $invoice)
-                       {
-
-                               $tranfser_bilag[] = $invoice['bilagsnr'];
-
-                               //Bestem belops felt
-                               if ($invoice['splitt']==0)
-                               {
-                                       //Bilaget er ikke splittet
-                                       if ($invoice['godkjentbelop'] <> 
$invoice['belop'])
-                                       {
-                                               $BelopFelt = 'godkjentbelop';
-                                               //Logg til avviks tabell
-                                               if ($download=='on' && 
!$pre_transfer)
-                                               {
-//                                                     
$this->soXport->log_to_deviation_table($invoice);
-                                               }
-                                       }
-                                       else
-                                       {
-                                               $BelopFelt = 'belop';
-                                       }
-                               }
-
-                               //Bilaget er splittet
-                               if ($invoice['godkjentbelop'] == 
$invoice['belop'])
-                               {
-                                       $BelopFelt = 'godkjentbelop';
-                               }
-                               else
-                               {
-                                        //Ikke lovlig
-                                       $message = lang('Avvik mellom 
fakturabelop og godkjent belop pa splittet faktura!');
-                                       $this->errorhandler($batchid,$message);
-                                       return $message;
-                               }
-
-                               $Belop_motpost =$invoice[$BelopFelt] *100; 
-
-                               //Skriv hovedbilag
-
-                               $Buntnr         = 
sprintf("%-12s",basename($Filnavn,".TXT"));// verdi: MMDDFL, type: c12, plass: 
1 - 12
-                               $Forsystem      = 'BI';// verdi: BI, type: c2, 
plass: 13 - 14
-
-                               $Transtype      = 'GL';// verdi: GL, type: c2, 
plass: 17 - 18
-                               $Firmakode      = sprintf("%-2s",'BB');// 
verdi: Firmakode, type: c2, plass: 19 - 20
-
-                               $Valuteringsdato= 
date(Ymd,strtotime($invoice['fakturadato']));// verdi: Dato, type: date, plass: 
251 - 258
-                               $Bilagsdato     = 
date(Ymd,strtotime($invoice['fakturadato'])) ;// verdi: Dato, type: date, 
plass: 259 - 266
-                               $Bilagsnr       = 
sprintf("%-9s",substr($invoice['bilagsnr'],-8));// verdi: Bilagsnummer, type: 
i4, plass: 267 - 275
-               //              $_periode       = 
sprintf("%06s",date(Y,strtotime($invoice['fakturadato'])) . 
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
-                               $ESL            = sprintf("%1s",'');// verdi: 
Blank, type: i+C481, plass: 282 - 282
-
-                               if($pre_transfer)
-                               {
-                                       if(abs(date('m',time()) - $periode) >1)
-                                       {
-                                               $temp_period = date('m',time()) 
-1;
-
-                                               if($temp_period == 0)
-                                               {
-                                                       $temp_period =1;
-                                               }
-
-                                               $temp_year = date('Y',time());
-                                       }
-                                       else
-                                       {
-                                               $temp_period = $periode;
-                                               $temp_year = 
date('Y',strtotime($invoice['fakturadato']));
-                                       }
-
-                                       $_periode       = 
sprintf("%06s",$temp_year . sprintf("%02d",$temp_period));// verdi: Periode, 
type: i4, plass: 276 - 281
-                                       $Bilagsart      = 
sprintf("%2s",'FF');// verdi: , type: c2, plass: 15 - 16
-                                       $Forfall        = '20991231';// verdi: 
Forfallsdato , type: date, plass: 298 - 305
-                               }
-                               else
-                               {
-                                       $_periode       = $periode;
-
-                                       $Bilagsart      = 
sprintf("%2s",'FD');// verdi: , type: c2, plass: 15 - 16
-                                       $Forfall        = 
date(Ymd,strtotime($invoice['forfallsdato']));// verdi: Forfallsdato , type: 
date, plass: 298 - 305
-                               }
-
-                               $Rab_forf       = sprintf("%-8s",'');// verdi: 
Blank, type: date, plass: 306 - 313
-                               $Rabatt         = sprintf("%020s",'');// verdi: 
Blank, type: money, plass: 314 - 333
-                               $Avt_Kon        = sprintf("%-8s",'');// verdi: 
Blank, type: c8, plass: 334 - 341
-
-                               $Kid            = 
sprintf("%-27s",$invoice['kidnr']);// verdi: Kid, type: c27, plass: 351 - 377
-                               $Bet_overforing = sprintf("%-2s",'');// verdi: 
Blank, type: c2, plass: 378 - 379
-                               $Status         = 'N';// verdi: N, type: c1, 
plass: 380 - 380
-                               $Resk_type      = 'P';// verdi: Blank, type: 
c1, plass: 381 - 381
-                               $Resk_nr        = 
sprintf("%-9s",$invoice['spvend_code']);// verdi: Blank., type: i4, plass: 382 
- 390
-                               $Forskudd       = '0';// verdi: 0, type: i1, 
plass: 391 - 391
-                               $Fakturaref     = '000000000';// verdi: 0, 
type: i4, plass: 392 - 400
-                               $Fakturaref     = '000000000';// verdi: 0, 
type: i4, plass: 401 - 409
-                               $Inkassokode    = sprintf("%-6s",'');// verdi: 
Blank, type: c6, plass: 410 - 415
-                               $Bet_mottager   = sprintf("%-8s",'');// verdi: 
Blank, type: c8, plass: 416 - 423
-                               $Att_ansvarlig  = 
sprintf("%-6s",utf8_decode($invoice['saksbehandler']));// verdi: Blank, type: 
c6, plass: 424 - 429
-
-                               $vendor_info = 
$this->get_vendor_info($invoice['spvend_code']);
-
-                               if(!$vendor_info['org_nr'])
-                               {
-                                       $message = 'mangler org_nr for 
reskontronr: ' . $invoice['spvend_code'];
-                                       $this->errorhandler($batchid,$message);
-                                       return $message;
-                               }
-
-                               if(!$vendor_info['konto_nr'])
-                               {
-                                       $message = 'mangler konto for 
reskontronr: ' . $invoice['spvend_code'];
-                                       $this->errorhandler($batchid,$message);
-                                       return $message;
-                               }
-
-                               $Resk_navn      = 
sprintf("%-50s",$vendor_info['org_nr']);// verdi: Fødselsnr, type: c50, plass: 
430 - 479
-                               $Postadresse    = sprintf("%-160s",'');// 
verdi: Blank, type: c160, plass: 480 - 639
-                               $Stat_Provins   = sprintf("%-50s",'');// verdi: 
Blank, type: c50, plass: 640 - 689
-                               $Sted           = sprintf("%-50s",'');// verdi: 
Blank, type: c50, plass: 690 - 739
-                               $Bank_Postgiro_kontonr = 
sprintf("%-35s",str_replace(" ","",$vendor_info['konto_nr']));// verdi: 
konto_nr, type: c35, plass: 740 - 774
-                               $Betalingsmate  = sprintf("%-2s",'');// verdi: 
Blank, type: c2, plass: 775 - 776
-                               $Mva_reg_nr     = sprintf("%-25s",'');// verdi: 
Blank, type: c25, plass: 777 - 801
-                               $Postnummer     = sprintf("%-15s",'');// verdi: 
Blank, type: c15, plass: 802 - 816
-                               $Val_dok        = sprintf("%-3s",'');// verdi: 
Blank, type: c3, plass: 817 - 819
-
-
-                               $underbilag_count= 
count($invoice['invoice_line']);
-                               $last_record = $underbilag_count - 1;
-
-                               //Velg ut alle underbilag
-                               foreach($invoice['invoice_line'] as $_key => 
$invoice_line)
-                               {
-
-                                       $BilagId = $invoice_line['id'];
-
-                                       $Belop = $invoice_line[$BelopFelt]*100;
-                                       $Belop_ = $Belop;
-
-                                       if($Belop < 0)
-                                       {
-                                               $Belop = abs($Belop);
-                                               $Belop = 
sprintf("%019s",$Belop);
-                                               $Belop = '-' . $Belop;
-                                       }
-                                       else
-                                       {
-                                               $Belop = 
sprintf("%019s",$Belop);
-                                               $Belop = '+' . $Belop;
-                                       }
-
-
-                                       if($invoice_line['pmwrkord_code'])
-                                       {
-
-                                               
$orders_affected[$BilagOverf[$i]['pmwrkord_code']] = true;
-
-                                               //Oppdater beløp på arbeidsordre
-                                               if ($download=='on' && 
!$pre_transfer)
-                                               {
-                                                       if 
($invoice_line['dimd'] % 2 == 0)
-                                                       {
-                                                               
$actual_cost_field='act_mtrl_cost';
-                                                       }
-                                                       else
-                                                       {
-                                                               
$actual_cost_field='act_vendor_cost';
-                                                       }
-                                                       $operator='+';
-
-                                                       if(!$this->debug)
-                                                       {
-                                                               
$this->soXport->correct_actual_cost($invoice_line['pmwrkord_code'],$Belop_,$actual_cost_field,$operator);
-                                                       }
-                                               }
-                                       }
-
-                                       //Overfør til fm_ecobilagoverf
-                                       $invoice_line['filnavn']= 
basename($Filnavn);
-                                       
$invoice_line['ordrebelop']=$invoice_line[$BelopFelt];
-
-                                       //dersom det mangler budsjett konto - 
kun aktuelt for ikke godkjent - sett konto til 2899999
-
-                                       if(!$invoice_line['spbudact_code'] && 
$pre_transfer)
-                                       {
-                                               $invoice_line['spbudact_code'] 
= 12304361;
-                                       }
-
-
-                                       //dersom ikke gyldig objekt - kun 
aktuelt for ikke godkjent - sett objekt til 9999
-
-                                       if(!($invoice_line['kostra_id']>0) && 
$pre_transfer)
-                                       {
-                                               $invoice_line['kostra_id'] = 
26550;
-                                               $invoice_line['mvakode'] = 0;
-                                               $invoice_line['dima'] = 9999;
-                                       }
-
-                                       $Konto          = 
sprintf("%08s",$invoice_line['spbudact_code']);// verdi: Art, type: c8, plass: 
21 - 28
-                                       $Dim_1          = 
sprintf("%8s",$invoice_line['district_id']);// verdi: Ansvarssted, type: c8, 
plass: 29 - 36
-                                       $Dim_2          = 
sprintf("%-8s",$invoice_line['kostra_id']);// verdi: Tjeneste, type: c8, plass: 
37 - 44
-
-                                       if($pre_transfer)
-                                       {
-                                               $Dim_3          = 
sprintf("%-8s",substr($invoice_line['dima'],0,4));// verdi: Objekt, type: c8, 
plass: 45 - 52
-                                       }
-                                       else
-                                       {
-                                               $Dim_3          = 
sprintf("%-8s",substr($invoice_line['dima'],0,6));// verdi: Objekt-bygg, type: 
c8, plass: 45 - 52
-                                       }
-
-
-                                       $Dim_4          = sprintf("%-8s",'');// 
verdi: Ressurs, type: c8, plass: 53 - 60
-                                       $Dim_5          = 
sprintf("%-12s",$invoice_line['project_id']);// verdi: Prosjekt, type: c12, 
plass: 61 - 72
-                                       $Dim_6          = 
sprintf("%-4s",$invoice_line['dimd']);// verdi: Blank, type: c4, plass: 73 - 76
-                                       $Dim_7          = sprintf("%-4s",'');// 
verdi: Blank, type: c4, plass: 77 - 80
-
-                                       
$Avgiftskode=sprintf("%-2s",$invoice_line['mvakode']);// verdi: Avgiftskode, 
type: c2, plass: 81 - 82
-
-                                       $Avgiftssystem  = sprintf("%2s",'');// 
verdi: Blank, type: c2, plass: 83 - 84
-                                       $Valutakode     ='NOK';// verdi: NOK, 
type: c3, plass: 85 - 87
-                                       $Debet_Kredit   = sprintf("%2s",'');// 
verdi: Blank, type: i2, plass: 88 - 89
-                                       $Valutabelop    = $Belop;// verdi: 
Beløp, type: money, plass: 90 - 109
-                                       $Belop_i_firmavaluta=$Belop;// verdi: 
Beløp, type: money, plass: 110 - 129
-                                       $Antall         = sprintf("%11s",'');// 
verdi: Blank, type: i4, plass: 130 - 140
-                                       $Belop2         = sprintf("%20s",'');// 
verdi: Blank, type: f8, plass: 141 - 160
-                                       $Belop3         = sprintf("%20s",'');// 
verdi: Blank, type: money, plass: 161 - 180
-
-                               //      $Belop4 (også kalt "money3" )blir brukt 
for identifisere overføring på tvers av filer.
-                                       $Belop4         = 
sprintf("%20s",$batchid);// verdi: Blank, type: money, plass: 181 - 200 - 
batch_id høyre justert
-
-
-                                       if($invoice_line['pmwrkord_code'])
-                                       {
-                                               $Tekst  = 
sprintf("%-50s",substr(utf8_decode($this->get_order_title($invoice_line['pmwrkord_code'])),0,50));//sprintf("%-50s",substr($invoice_line['merknad'],0,50));//
 verdi: Tekst, type: text (50), plass: 201 - 250
-                                       }
-                                       else
-                                       {
-                                               $Tekst  = 
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));// 
verdi: Tekst, type: text (50), plass: 201 - 250
-                                       }
-
-                                       $Fakturanr      = 
sprintf("%-15s",substr(utf8_decode($invoice_line['fakturanr']), 0, 15));// 
verdi: Fakturanr, type: c15, plass: 283 - 297
-
-                                       $Ordrenummer    = 
sprintf("%-9s",$invoice_line['pmwrkord_code']);// verdi: Infodoc ordrenr, type: 
i4, plass: 342 - 350
-
-
-                                       //Kopier verdier
-                                       if ($download=='on' && !$pre_transfer 
&& !$this->debug)
-                                       {
-                                               
$this->soXport->add_OverfBilag($invoice_line);
-                                       }
-
-                                       //Skriv til fil
-
-                                       $buffer .= $Buntnr . $Forsystem . 
$Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 . 
$Dim_4 . 
-                                       $Dim_5 . $Dim_6 . $Dim_7 . $Avgiftskode 
. $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop . 
-                                       $Belop_i_firmavaluta . $Antall . 
$Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato . 
-                                       $Bilagsnr . $_periode . $ESL . 
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer . 
-                                       $Kid . $Bet_overforing . $Status . 
$Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref . 
-                                       $Inkassokode . $Bet_mottager . 
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted . 
-                                       $Bank_Postgiro_kontonr . $Betalingsmate 
. $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
-
-                                       if($_key==$last_record)
-                                       {
-                                               $Konto          = 
sprintf("%-8s",'2327010');// verdi: Art, type: c8, plass: 21 - 28
-                                               $Dim_1          = 
sprintf("%-8s",'');// verdi: Ansvarssted, type: c8, plass: 29 - 36
-                                               $Dim_2          = 
sprintf("%-8s",'');// verdi: Tjeneste, type: c8, plass: 37 - 44
-                                               $Dim_3          = 
sprintf("%-8s",'');// verdi: Objekt, type: c8, plass: 45 - 52
-                                               $Dim_4          = 
sprintf("%-8s",'');// verdi: Ressurs, type: c8, plass: 53 - 60
-                                               $Dim_5          = 
sprintf("%-12s",'');// verdi: Prosjekt, type: c12, plass: 61 - 72
-                                               $Dim_6          = 
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 73 - 76
-                                               $Dim_7          = 
sprintf("%-4s",'');// verdi: Blank, type: c4, plass: 77 - 80
-                                       //      $Fakturanr      = 
sprintf("%-15s",'');// verdi: Fakturanr, type: c15, plass: 283 - 297
-                                               $Ordrenummer    = 
sprintf("%-9s",'');// verdi: Infodoc ordrenr, type: i4, plass: 342 - 350
-                                               $Tekst          = 
sprintf("%-50s",'');//sprintf("%-50s",substr($invoice_line['merknad'],0,50));// 
verdi: Tekst, type: text (50), plass: 201 - 250
-
-                                               if($Belop_motpost < 0)
-                                               {
-                                                       $Belop_motpost = 
sprintf("%019s",abs($Belop_motpost));
-                                                       $Belop_motpost = '+' . 
$Belop_motpost;
-                                               }
-                                               else
-                                               {
-                                                       $Belop_motpost = 
sprintf("%019s",$Belop_motpost);
-                                                       $Belop_motpost = '-' . 
$Belop_motpost;
-
-                                               }
-
-                                               $Transtype      = 'AP';// 
verdi: GL, type: c2, plass: 17 - 18
-                                               $Valutabelop    = 
$Belop_motpost;// verdi: Beløp, type: money, plass: 90 - 109
-                                               
$Belop_i_firmavaluta=$Belop_motpost;// verdi: Beløp, type: money, plass: 110 - 
129
-
-                                               $buffer .= $Buntnr . $Forsystem 
. $Bilagsart . $Transtype . $Firmakode . $Konto . $Dim_1 . $Dim_2 . $Dim_3 . 
$Dim_4 . 
-                                               $Dim_5 . $Dim_6 . $Dim_7 . 
$Avgiftskode . $Avgiftssystem . $Valutakode . $Debet_Kredit . $Valutabelop . 
-                                               $Belop_i_firmavaluta . $Antall 
. $Belop2 . $Belop3 . $Belop4 . $Tekst . $Valuteringsdato . $Bilagsdato . 
-                                               $Bilagsnr . $_periode . $ESL . 
$Fakturanr . $Forfall . $Rab_forf . $Rabatt . $Avt_Kon . $Ordrenummer . 
-                                               $Kid . $Bet_overforing . 
$Status . $Resk_type . $Resk_nr . $Forskudd . $Fakturaref . $Fakturaref . 
-                                               $Inkassokode . $Bet_mottager . 
$Att_ansvarlig . $Resk_navn . $Postadresse . $Stat_Provins . $Sted . 
-                                               $Bank_Postgiro_kontonr . 
$Betalingsmate . $Mva_reg_nr . $Postnummer . $Val_dok ."\r\n";
-                                       }
-
-                                       //Slett post i fm_ecobilag
-                                       if ($download=='on' && !$pre_transfer 
&& !$this->debug)
-                                       {
-                                               
$this->soXport->delete_from_fm_ecobilag($invoice_line['id']);
-                                               //Logg transaksjon
-                                               
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice transferred'));
-                                       }
-
-                                       $BilagId = 'NULL';
-
-                                       $antall = $antall + 1;
-                               }
-                       }
-
-                       //Fullfør transaksjon
-
-                       if ($download=='on' && !$pre_transfer && !$this->debug):
-                       {
-                               $fp = fopen($Filnavn, "wb");
-                               fwrite($fp,$buffer);
-
-                               if(fclose($fp))
-                               {
-                                       $file_written=True;
-                               }
-
-                               if($file_written && 
$this->config->config_data['common']['method']!='ftp'):
-                               {
-                                       $transfer_ok = True;
-                               }
-                               elseif($file_written):
-                               {
-                                       $transfer_ok = 
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
-                               }
-                               endif;
-
-                               if($transfer_ok)
-                               {
-                                       $this->db->transaction_commit();
-                                       $message = 'Godkjent: periode: 
'.$_periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' . 
$Filnavn;
-                                       phpgwapi_cache::message_set($message, 
'message'); 
-                               }
-                               else
-                               {
-                                       $this->db->transaction_abort();
-                                       $message = 'Noe gikk galt med 
overforing av godkjendte fakturaer!';
-                                       phpgwapi_cache::message_set($message, 
'error'); 
-                               }
-                       }
-                       elseif($download=='on' && $pre_transfer && 
!$this->debug):
-                       {
-
-                               $fp = fopen($Filnavn, "wb");
-                               fwrite($fp,$buffer);
-
-                               if(fclose($fp))
-                               {
-                                       $file_written=True;
-                               }
-
-                               if($file_written && 
$this->config->config_data['common']['method']!='ftp'):
-                               {
-                                       $transfer_ok = True;
-                               }
-                               elseif($file_written):
-                               {
-                                       $transfer_ok = 
$this->transfer($buffer,$Filnavn,$batchid,$tranfser_bilag);
-                               }
-                               endif;
-
-                               if($transfer_ok)
-                               {
-                                       
$this->soXport->update_actual_cost_from_archive($this->orders_affected);
-
-                                       $this->db->transaction_commit();
-                                       $message = 'Ankomstregistrering: 
periode: '.$periode.' antall bilag/underbilag overfort:'.$antall . ' , fil: ' . 
$Filnavn;
-                                       phpgwapi_cache::message_set($message, 
'message'); 
-                               }
-                               else
-                               {
-                                       $this->db->transaction_abort();
-                                       $message = 'Noe gikk galt med 
ankomstregistrering!';
-                                       phpgwapi_cache::message_set($message, 
'error'); 
-                               }
-                       }
-                       else:
-                       {
-                               $this->db->transaction_abort();
-
-                               _debug_array($Filnavn);
-                               $fp = fopen($Filnavn, "wb");
-                               fwrite($fp,$buffer);
-
-                               if(fclose($fp))
-                               {
-                                       $file_written=True;
-                               }
-
-                               echo "<pre>{$buffer}</pre>";
-                       }
-                       endif;
-               }
-
-               function transfer($buffer,$Filnavn,$batchid,$tranfser_bilag)
-               {
-
-                       
if($this->config->config_data['common']['method']=='ftp')
-                       {
-                               $ftp    = $this->phpftp_connect();
-
-                               $basedir = 
$this->config->config_data['common']['remote_basedir'];
-                               if($basedir)
-                               {
-                                       $newfile = $basedir . '/' . 
basename($Filnavn);
-                               }
-                               else
-                               {
-                                       $newfile = basename($Filnavn);
-                               }
-
-                               if (ftp_put($ftp,$newfile, $Filnavn, 
FTP_BINARY))
-                               {
-                                       for 
($i=0;$i<count($tranfser_bilag);$i++)
-                                       {
-                                               
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Invoice 
pre_transferred %1',basename($Filnavn)));
-                                       }
-                                       $transfer_ok = True;
-                               }
-                               else
-                               {
-                                       for 
($i=0;$i<count($tranfser_bilag);$i++)
-                                       {
-                                               
$this->soXport->log_transaction($batchid,$tranfser_bilag[$i],lang('Failed to 
pre_transfere %1 to agresso',basename($Filnavn)));
-                                       }
-                                       $transfer_ok = False;
-                               }
-                               if(!$transfer_ok)
-                               {
-                                       unlink($Filnavn);
-                               }
-
-                               ftp_quit($ftp);
-                       }
-                       return  $transfer_ok;
-               }
-
-               function phpftp_connect() 
-               {
-                       $host                           = 
$this->config->config_data['common']['host'];
-                       $user                           = 
$this->config->config_data['common']['user'];
-                       $password                       = 
$this->config->config_data['common']['password'];
-
-//                     echo "connecting to $host with $user and $pass\n <br>";
-                       $ftp = ftp_connect($host);
-                       if($ftp) 
-                       {
-                               if (ftp_login($ftp,$user,$password)) 
-                               {
-                                       return $ftp;
-                               }
-                       }
-               }
-       }

Deleted: trunk/property/inc/export/default/Ecolink
===================================================================
--- trunk/property/inc/export/default/Ecolink   2014-02-21 10:13:37 UTC (rev 
11727)
+++ trunk/property/inc/export/default/Ecolink   2014-02-21 10:19:58 UTC (rev 
11728)
@@ -1,662 +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 export
-       * @version $Id$
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class export_conv
-       {
-               //var $fil_katalog='c:/temp'; //On windows use 
"//computername/share/filename" or "\\\\computername\share\filename" to check 
files on network shares.
-               function export_conv()
-               {
-                       $this->currentapp               = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
-       //              $this->db                       = $GLOBALS['phpgw']->db;
-
-                       $this->soXport = CreateObject('property.soXport');      
-                       $this->config = 
CreateObject('phpgwapi.config','property');
-                       $this->config->read_repository();
-                       $this->bocommon                 = 
CreateObject($this->currentapp.'.bocommon');
-                       $this->db               = $this->bocommon->new_db();    
                
-               }
-
-               function select_periods_with_invoice_to_transfer()
-               {
-                       $sql= "SELECT DISTINCT periode from fm_ecobilag where 
budsjettsigndato is not null and (saksigndato is not null or oppsynsigndato is 
not null) and utbetalingsigndato is not null ";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       while ($this->db->next_record())
-                       {
-                               $periode[]      = $this->db->f('periode');
-                       }
-                       return $periode;
-               }
-
-               function log_end($batchid)
-               {
-                       $tid=date($this->soXport->datetimeformat);
-                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','End transfer','$tid')";
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-               function log_error($batchid,$error_desr)
-               {
-                       $tid=date($this->datetimeformat);
-                       $sql= "insert into fm_ecologg 
(batchid,ecobilagid,status,melding,tid) values 
('$batchid',NULL,0,'$error_desr','$tid')";
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-               function increment_batchid()
-               {
-
-                       $this->db->query("update fm_idgenerator  set value = 
value + 1 where name = 'Ecobatchid'");
-                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'");
-                       $this->db->next_record();
-                       $bilagsnr = $this->db->f('value');
-                       return $bilagsnr;
-
-               }
-
-               function next_batchid()
-               {
-
-                       $this->db->query("select value from fm_idgenerator  
where name = 'Ecobatchid'");
-                       $this->db->next_record();
-                       $batchid = $this->db->f('value')+1;
-
-                       return $batchid;
-               }
-
-               //Lagre start melding
-               function log_start($batchid)
-               {
-                       $tid=date($this->soXport->datetimeformat);
-                       $sql= "insert into fm_ecologg (batchid,melding,tid) 
values ('$batchid','Start transfer','$tid')";
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-               function select_invoice_roleback($day,$month,$year,$Filnavn)
-               {
-
-                       switch($GLOBALS['phpgw_info']['server']['db_type'])
-                       {
-                               case 'mssql':
-                                       $datepart_year          = 
"datepart(year,overftid)";
-                                       $datepart_month         = 
"datepart(month,overftid)";
-                                       $datepart_day           = 
"datepart(day,overftid)";
-                                       break;
-                               case 'mysql':
-                                       $datepart_year          = 
"YEAR(overftid)";
-                                       $datepart_month         = 
"MONTH(overftid)";
-                                       $datepart_day           = 
"DAYOFMONTH(overftid)";
-                                       break;
-                               case 'pgsql':
-                                       $datepart_year          = 
"date_part('year',overftid)";
-                                       $datepart_month         = 
"date_part('month',overftid)";
-                                       $datepart_day           = 
"date_part('day',overftid)";
-                                       break;
-                               case 'postgres':
-                                       $datepart_year          = 
"date_part('year',overftid)";
-                                       $datepart_month         = 
"date_part('month',overftid)";
-                                       $datepart_day           = 
"date_part('day',overftid)";
-                                       break;
-                       }
-
-
-                       $sql="select * from fm_ecobilagoverf where 
filnavn='$Filnavn' and $datepart_year=$year and $datepart_month=$month and 
$datepart_day= $day";
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       $i = 0;
-                       while ($this->db->next_record())
-                       {
-                               $invoice_roleback[$i]['id']     = 
$this->db->f('id');
-                               $invoice_roleback[$i]['bilagsnr']       = 
$this->db->f('bilagsnr');
-                               $invoice_roleback[$i]['kidnr']  = 
$this->db->f('kidnr');
-                               $invoice_roleback[$i]['typeid'] = 
$this->db->f('typeid');
-                               $invoice_roleback[$i]['kildeid']        = 
$this->db->f('kildeid');
-                               $invoice_roleback[$i]['pmwrkord_code']  = 
$this->db->f('pmwrkord_code');
-                               $invoice_roleback[$i]['belop']  = 
$this->db->f('belop');
-                               $invoice_roleback[$i]['fakturadato']    = 
$this->db->f('fakturadato');
-                               $invoice_roleback[$i]['periode']        = 
$this->db->f('periode');
-                               $invoice_roleback[$i]['forfallsdato']   = 
$this->db->f('forfallsdato');
-                               $invoice_roleback[$i]['fakturanr']      = 
$this->db->f('fakturanr');
-                               $invoice_roleback[$i]['spbudact_code']  = 
$this->db->f('spbudact_code');
-                               $invoice_roleback[$i]['regtid'] = 
$this->db->f('regtid');
-                               $invoice_roleback[$i]['artid']  = 
$this->db->f('artid');
-                               $invoice_roleback[$i]['godkjentbelop']  = 
$this->db->f('godkjentbelop');
-                               $invoice_roleback[$i]['spvend_code']    = 
$this->db->f('spvend_code');
-                               $invoice_roleback[$i]['dima']   = 
$this->db->f('dima');
-                               $invoice_roleback[$i]['loc1']   = 
$this->db->f('loc1');
-                               $invoice_roleback[$i]['dimb']   = 
$this->db->f('dimb');
-                               $invoice_roleback[$i]['mvakode']        = 
$this->db->f('mvakode');
-                               $invoice_roleback[$i]['dimd']   = 
$this->db->f('dimd');
-                               if($this->db->f('oppsynsmannid'))
-                               {
-                                       $invoice_roleback[$i]['oppsynsmannid']  
= $this->db->f('oppsynsmannid');
-                               }
-                               if($this->db->f('saksbehandlerid'))
-                               {
-                                       
$invoice_roleback[$i]['saksbehandlerid']        = 
$this->db->f('saksbehandlerid');
-                               }
-
-                               $invoice_roleback[$i]['budsjettansvarligid']    
= $this->db->f('budsjettansvarligid');
-
-                               if($this->db->f('oppsynsigndato'))
-                               {
-                                       $invoice_roleback[$i]['oppsynsigndato'] 
= $this->db->f('oppsynsigndato');
-                               }
-                               if($this->db->f('saksigndato'))
-                               {
-                                       $invoice_roleback[$i]['saksigndato']    
= $this->db->f('saksigndato');
-                               }
-
-                               $invoice_roleback[$i]['budsjettsigndato']       
= $this->db->f('budsjettsigndato');
-                               $invoice_roleback[$i]['merknad']        = 
$this->db->f('merknad');
-                               $invoice_roleback[$i]['splitt'] = 
$this->db->f('splitt');
-                               $invoice_roleback[$i]['ordrebelop']     = 
$this->db->f('ordrebelop');
-                               $invoice_roleback[$i]['utbetalingid']   = 
$this->db->f('utbetalingid');
-                               $invoice_roleback[$i]['utbetalingsigndato']     
= $this->db->f('utbetalingsigndato');
-                               $i++;
-                       }
-                       return $invoice_roleback;
-               }
-
-
-               //roleback function
-               function bilag_update_overf($BilagOverf)
-               {
-                       $values= array(
-                               $BilagOverf['pmwrkord_code'],
-                               $BilagOverf['bilagsnr'],
-                               $BilagOverf['splitt'],
-                               $BilagOverf['kildeid'],
-                               $BilagOverf['kidnr'],
-                               $BilagOverf[typeid],
-                               $BilagOverf['fakturadato'],
-                               $BilagOverf['forfallsdato'],
-                               $BilagOverf['regtid'],
-                               $BilagOverf['artid'],
-                               $BilagOverf['spvend_code'],
-                               $BilagOverf['dimb'],
-                               $BilagOverf['oppsynsmannid'],
-                               $BilagOverf['saksbehandlerid'],
-                               $BilagOverf['budsjettansvarligid'],
-                               $BilagOverf['fakturanr'],
-                               $BilagOverf['spbudact_code'],
-                               $BilagOverf['dima'],
-                               $BilagOverf['loc1'],
-                               $BilagOverf['dimd'],
-                               $BilagOverf['mvakode'],
-                               $BilagOverf['periode'],
-                               $BilagOverf['merknad'],
-                               $BilagOverf['utbetalingid'],
-                               $BilagOverf['oppsynsigndato'],
-                               $BilagOverf['saksigndato'],
-                               $BilagOverf['budsjettsigndato'],
-                               $BilagOverf['utbetalingsigndato'],
-                               );
-                       
-                       $values = $this->db->validate_insert($values);
-
-                       $sql= "INSERT INTO fm_ecobilag 
(pmwrkord_code,bilagsnr,splitt,kildeid,kidnr,typeid,"
-                       . " 
fakturadato,forfallsdato,regtid,artid,spvend_code,dimb,oppsynsmannid,"
-                       . " 
saksbehandlerid,budsjettansvarligid,fakturanr,spbudact_code,dima,loc1,dimd,mvakode,"
-                       . " 
periode,merknad,utbetalingid,oppsynsigndato,saksigndato,budsjettsigndato,utbetalingsigndato,belop,godkjentbelop)"
-                       . " values ($values,"
-                       . $this->db->money_format($BilagOverf['belop']) . ","
-                       . $this->db->money_format($BilagOverf['godkjentbelop']) 
. ")";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-
-               //Oppdater beløp på arbeidsordre operator="-" ved tilbakerulling
-               function 
correct_actual_cost($pmwrkord_code,$Belop,$actual_cost_field,$operator)
-               {
-                       $Belop=$Belop/100;
-
-                       $sql="update fm_workorder set 
$actual_cost_field=$actual_cost_field $operator $Belop where 
id='$pmwrkord_code'";
-                       $this->db->query($sql,__LINE__,__FILE__);
-               }
-
-               // Hent leverandørklasse
-
-               function select_vendor_class($spvend_code)
-               {
-                       $sql= "select klasse from fm_vendor where 
id=$spvend_code";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       $this->db->next_record();
-                       $pmlabor_code = $this->db->f('klasse');
-
-                       return $pmlabor_code;
-               }
-
-               function overfor($download)
-               {
-                       //Generer batch ID
-                       $batchid = $this->soXport->next_batchid();
-                       if ($download=='on')
-                       {
-                               $this->increment_batchid();
-                               //Lagre melding
-                               $this->log_start($batchid);
-                       }
-
-                       //Velg ut alle perioder som har bilag som skal overføres
-
-                       $periode = 
$this->select_periods_with_invoice_to_transfer();
-               
-                       for ($i=0;$i<count($periode);$i++)
-                       {
-                               $receipt['message'][]= array('msg' => 
$this->OverforPeriode($batchid,$periode[$i],$download));
-                       }
-
-                       //Lagre melding
-                       if ($download=='on')
-                       {
-                               $this->log_end($batchid); //Lagre melding
-                       }
-
-                       return $receipt;
-               }
-               
-               function errorhandler($error_desr)
-               {
-                       $meld = $error_desr;
-               
-                       //Vis feilmelding
-//                     echo $meld;
-               
-                       //Lagre feilmelding
-                       $this->log_error($batchid,$error_desr);
-               }
-               
-               function RullTilbake($Filnavn,$Dato)
-               {                                                               
-                       $dateformat = 
strtolower($GLOBALS['phpgw_info']['user']['preferences']['common']['dateformat']);
-                       $dateformat = str_replace(".","",$dateformat);
-                       $dateformat = str_replace("-","",$dateformat);
-                       $dateformat = str_replace("/","",$dateformat);
-                       $y=strpos($dateformat,'y');
-                       $d=strpos($dateformat,'d');
-                       $m=strpos($dateformat,'m');
-       
-                       $dateparts = explode('/', $Dato);
-                       $day = $dateparts[$d];
-                       $month = $dateparts[$m];
-                       $year = $dateparts[$y];
-        /*             $date1 = mktime (2,0,0,$month,$day,$year);
-                       if ($date1)
-                       {
-                               $Dato=$date1;
-                       }
-       
-                       $Dato= date("M d Y",$Dato);
-       */
-                       
-                       
$BilagOverf=$this->select_invoice_roleback($day,$month,$year,$Filnavn);
-                       $this->db->transaction_begin();
-
-                       for ($i=0;$i<count($BilagOverf);$i++)
-                       {
-                               $this->bilag_update_overf($BilagOverf[$i]);
-                               
-               
-                               if($BilagOverf[$i]['pmwrkord_code'])
-                               {
-                                       if ($BilagOverf[$i]['artid']==1)
-                                       {
-                                               $Belop = sprintf("%01.2f", 
$BilagOverf[$i]['ordrebelop'])*100;
-                                       }
-                                       else
-                                       {
-                                               $Belop = sprintf("%01.2f", 
-$BilagOverf[$i]['ordrebelop'])*100;
-                                       }
-                               
-                                       if ($BilagOverf[$i]['dimd'] % 2 == 0)
-                                       {
-                                               
$actual_cost_field='act_mtrl_cost';
-                                       }
-                                       else
-                                       {
-                                               
$actual_cost_field='act_vendor_cost';
-                                       }
-               
-                                       $operator='-';
-
-                                       
$this->correct_actual_cost($BilagOverf[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
-                               }
-               
-                               //Slett fra avviks tabell
-                       //      
$this->soXport->delete_avvik($BilagOverf[$i]['bilagsnr']);
-               
-                               //Slett fra arkiv
-                               
$this->soXport->delete_invoice($BilagOverf[$i]['bilagsnr']);
-               
-                               $antall = $antall + 1;
-                       }
-               
-                       if($antall > 0)
-                       {               
-                               $fil_katalog = 
$this->config->config_data['export_path'];                       
-                       
-                               if(unlink ($fil_katalog. '/' . $Filnavn))
-                               {
-                                       $this->db->transaction_commit();
-                                       $receipt['message'][]= array('msg' => 
$antall . ' ' . lang('bilag/underbilag rullet tilbake'));
-                                       $receipt['message'][]= array('msg' => 
lang('File %1 is deleted',$Filnavn));
-                               }
-                               else
-                               {
-                                       $this->db->transaction_abort();
-                                       $receipt['message'][]= array('msg' => 
'Noe gikk galt!');
-                               }                                               
        
-                       }
-                       else
-                       {
-                               $receipt['error'][]= array('msg' => lang('Sorry 
- None hits'));
-                       }
-                       return $receipt;
-               }
-                               
-               
-               function LagFilnavn ($batchid)
-               {       
-                       $fil_katalog = 
$this->config->config_data['export_path'];
-                       //Beregn løpenr
-                       $StartLopeNr = ($batchid % 30) + 70;
-                       $LopeNr = $StartLopeNr;
-               
-                       do
-                       {
-                               //Konstruer filnavn
-                               $Filnavn = $fil_katalog . '/DTF1'. 
sprintf("%2d",$LopeNr) . '10.TXT';
-               
-                               //Sjekk om filen eksisterer
-                               If (!file_exists($Filnavn))
-                               {
-                                       return $Filnavn;
-                               }
-               
-                               //Genererer nytt løpenr
-                               $batchid = $batchid + 1;
-                               $LopeNr = ($batchid % 30) + 70;
-                       }
-                       while  ($LopeNr != $StartLopeNr);
-               
-                       //Ingen løpenr er ledige, gi feilmelding
-                       return False;
-               }
-               
-               function OverforPeriode($batchid,$periode,$download)
-               {
-                       $BilagId = 'NULL';
-       
-                       //Bestem filnavn
-                       
-                       $Filnavn = $this->LagFilnavn($batchid);
-                       if (!$Filnavn)
-                       {
-                               $message='LagFilnavn'.lang('Alle løpenr for 
filnavn er i bruk!');
-                               $this->errorhandler($message);
-                               return $message;
-                       }
-
-                       //Test om filen kan opprettes og skrives til
-                       if (@fopen($Filnavn, "wb"))
-                       {
-                               unlink($Filnavn);
-                       }
-                       else
-                       {
-                               $message='kan ikke lagre til fil: '. $Filnavn 
.'<br>';
-                               return $message;
-                       }
-                       
-                       //Velg ut alle hoved bilag som skal overføres
-               
-                       $oRsBilag=$this->soXport->hoved_bilag($periode);
-                                                                       
-                       $this->db->transaction_begin();
-
-                       $bilag_count= count($oRsBilag);
-                       for ($k=0;$k<$bilag_count;$k++)
-                       {                               
-                               //Hent leverandørklasse
-                               
-                               $pmlabor_code 
=$this->select_vendor_class($oRsBilag[$k]['spvend_code']);
-                               
-                               //Bestem belops felt
-                               if ($oRsBilag[$k]['splitt']==0)
-                               {
-                                       //Bilaget er ikke splittet
-                                       if ($oRsBilag[$k]['godkjentbelop'] <> 
$oRsBilag[$k]['belop'])
-                                       {
-                                               $BelopFelt = 'godkjentbelop';   
                
-                                               //Logg til avviks tabell
-                                               if ($download=='on')
-                                               {
-//                                                     
$this->soXport->log_to_deviation_table($oRsBilag[$k]);
-                                               }
-                                       }
-                                       else
-                                       {
-                                               $BelopFelt = 'belop';
-                                       }
-                               }
-                               
-                               //Bilaget er splittet
-                               if ($oRsBilag[$k]['godkjentbelop'] == 
$oRsBilag[$k]['belop'])
-                               {
-                                       $BelopFelt = 'godkjentbelop';
-                               }
-                               else
-                               {
-                                        //Ikke lovlig
-                                       $message = lang('Avvik mellom 
fakturabeløp og godkjent beløp på splittet faktura!');
-                                       $this->errorhandler($message);
-                                       return $message;
-                               }
-               
-                               //Formater beløp
-                               if ($oRsBilag[$k]['artid'] == 2)
-                               {
-                                       $Belop = sprintf("%01.2f", 
$oRsBilag[$k][$BelopFelt]);
-                               }
-                               else
-                               {
-                                       $Belop = sprintf("%01.2f", 
-$oRsBilag[$k][$BelopFelt]);
-               
-                               }
-               
-                               $Belop =$Belop *100; 
-               //              $Belop = substr($Belop,0,strlen($Belop) - 3) + 
substr($Belop, -2);
-               
-                               //Skriv hovedbilag
-
-                               $periode_aar    = $periode;
-                               $f1per          = 
$periode_aar;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f1bilnr        = 
substr($oRsBilag[$k]['bilagsnr'],-6);
-                               $f1bildat       = 
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f1bilart       = $oRsBilag[$k]['artid'];
-                               $f1belop        = $Belop;                       
                                
-                               $f1fordat       = 
date(ymd,strtotime($oRsBilag[$k]['forfallsdato']));
-                               $f1tekst        = '';                           
                                
-                               $f1iper         = 
substr($periode_aar,2,2);//date(m,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f1dime         = $oRsBilag[$k]['spvend_code']; 
                                
-        
-                               $f3per          = 
$periode_aar;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f3bilnr        = 
substr($oRsBilag[$k]['bilagsnr'],-6);
-                               $f3rkonto       = $oRsBilag[$k]['spvend_code'];
-                               $f3pnr          = 
substr($oRsBilag[$k]['bilagsnr'],-6);
-                               $f3klasse       = $pmlabor_code;                
                
-                               $f3bildat       = 
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f3bilart       = $oRsBilag[$k]['artid'];
-                               $f3belopr       = $Belop;                       
                                
-                               $f3fordat       = 
date(ymd,strtotime($oRsBilag[$k]['forfallsdato']));
-                               $f3sakb         = 
$oRsBilag[$k]['saksbehandler'];
-                               $f3idkode       = $oRsBilag[$k]['kidnr'];
-                               $f3tekst        = '';
-               
-                               $buffer .= 'F3 7       1'. $f3per . $f3bilnr . 
sprintf("%6s",$f3rkonto) . sprintf("%6s",$f3pnr)
-                               . '     0'. sprintf("%-4s",$f3klasse). '   ' . 
sprintf("%6s",$f3bildat).sprintf("%2s",$f3bilart)
-                               . 'NOK       1000   
10005'.sprintf("%14s",$f3belopr).'               '.sprintf("%6s",$f3fordat)
-                               . sprintf("%6s",$f3fordat).'     0     0    0   
          001               '
-                               . sprintf("%-8s",$f3sakb).'       0     0     0 
    0     0 01  0           0'
-                               . sprintf("%-28s",$f3idkode).'  0'."\r\n"
-                               .'F112       
1'.sprintf("%4s",$f1per).sprintf("%6s",$f1bilnr).'    2001    2001     0        
   0     0'
-                               . 
sprintf("%2s",$f1bilart).'0'.sprintf("%6s",$f1bildat).sprintf("%6s",$f1fordat)
-                               .'NOK     1000   1000'.sprintf("%6s",$f1dime).' 
    0     0     0     0     0     0     0 0'
-                               . 
sprintf("%15s",$f1belop).sprintf("%15s",$f1tekst).sprintf("%2s",$f1iper).'0101  
            0'
-                               . sprintf("%6s",$f1bilnr).'  0                  
                               '."\r\n";
-               
-               
-                               //Velg ut alle underbilag
-                               
$oRsUnderbilag=$this->soXport->select_underbilag($oRsBilag[$k]['bilagsnr']);    
        
-
-                               $underbilag_count= count($oRsUnderbilag);
-                               for ($i=0;$i<$underbilag_count;$i++)
-                               {
-                                       $BilagId = $oRsUnderbilag[$i]['id'];
-                               
-                                       if ($oRsUnderbilag[$i]['artid'] == 2)
-                                       {               
-                                               $Belop = sprintf("%01.2f", 
-$oRsUnderbilag[$i][$BelopFelt]);
-                                       }
-                                       else
-                                       {
-                                               $Belop = sprintf("%01.2f", 
$oRsUnderbilag[$i][$BelopFelt]);
-                                       }
-                                       
-                                       $Belop =$Belop *100; 
-
-                                       //$Belop = 
substr($Belop,0,strlen($Belop) - 3) + substr($Belop, -2);
-
-       
-                                       if($oRsUnderbilag[$i]['pmwrkord_code'])
-                                       {
-                                               //Hent DIM C
-                                               $dimc = 
$this->soXport->select_dimc($oRsUnderbilag[$i]['pmwrkord_code']);
-               
-                                               //Oppdater beløp på arbeidsordre
-                                               if ($download=='on')
-                                               {
-                                                       if 
($oRsUnderbilag[$i]['dimd'] % 2 == 0)
-                                                       {
-                                                               
$actual_cost_field='act_mtrl_cost';
-                                                       }
-                                                       else
-                                                       {
-                                                               
$actual_cost_field='act_vendor_cost';
-                                                       }
-                                                       $operator='+';
-                                                       
$this->correct_actual_cost($oRsUnderbilag[$i]['pmwrkord_code'],$Belop,$actual_cost_field,$operator);
-                                               }
-                                       }
-                                       else
-                                       {
-                                               $dimc = '';
-                                       }
-               
-                                       //Overfør til fm_ecobilagoverf
-               
-                                       $oRsOverfBilag=$oRsUnderbilag[$i];
-                                       $oRsOverfBilag['filnavn']= 
basename($Filnavn);
-                                       
$oRsOverfBilag['ordrebelop']=$oRsUnderbilag[$i][$BelopFelt];
-                                       
$oRsOverfBilag['dima']=substr($oRsOverfBilag['dima'],0,6);
-               
-                                       //Kopier verdier
-                                       if ($download=='on')
-                                       {
-                                               
$this->soXport->add_OverfBilag($oRsOverfBilag);
-                                       }
-                                       //Skriv til fil
-                                       
-                                       $f1kto          = 
$oRsOverfBilag['spbudact_code'];
-                                       $f1dima         = 
substr($oRsOverfBilag['dima'],0,6);
-                                       $f1dimb         = 
$oRsOverfBilag['dimb'];
-                                       $f1dimc         = $dimc;
-                                       $f1dimd         = 
$oRsOverfBilag['dimd'];
-                                       $f1avgkod       = 
$oRsOverfBilag['mvakode'];
-                                       $f1belop        = $Belop;
-                                       $f1tekst        = 
'';//$oRsOverfBilag['merknad'];
-                                       
-                                       $buffer .='F1 2       1'. 
sprintf("%4s",$f1per).sprintf("%6s",$f1bilnr).sprintf("%8s",$f1kto).'       0'
-                                       
.sprintf("%6s",$f1dima).sprintf("%6s",$f1dimb).sprintf("%6s",$f1dimc).sprintf("%6s",$f1dimd).sprintf("%2s",$f1bilart).'0'
-                                       
.sprintf("%6s",$f1bildat).sprintf("%6s",$f1fordat).'NOK     1000   
1000'.sprintf("%6s",$f1dime).'     0     0     0     0     0     0     0'
-                                       
.sprintf("%2s",$f1avgkod).sprintf("%15s",$f1belop).sprintf("%15s",$f1tekst).sprintf("%2s",$f1iper).'0101
              0'
-                                       .sprintf("%6s",$f1bilnr).'  0           
                                      '."\r\n";
-
-                               
-                                       //Slett post i fm_ecobilag
-                                       if ($download=='on')
-                                       {
-                                               
$this->soXport->delete_from_fm_ecobilag($oRsUnderbilag[$i]['id']);              
-                                               //Logg transaksjon              
-                                               
$this->soXport->log_transaction($batchid,$BilagId,lang('Invoice transferred'));
-                                       }
-               
-                                       $BilagId = 'NULL';
-               
-                                       $antall = $antall + 1;
-                               }
-                       }
-                               
-                       $f9per  = $periode_aar;
-                       $buffer .='F999       1'.sprintf("%4s",$f9per).'        
      0            0            0            0              0            0      
      0            0              0              0     0     0     0     0     
0     0     0     0     0                                               
'."\r\n";
-                                       
-                       //Fullfør transaksjon
-                       //g_db.SluttTransaksjon
-                       
-               
-                       if ($download=='on')
-                       {
-                               $message = 'periode: '.$periode_aar.' antall 
bilag/underbilag overført:'.$antall . ' , fil: ' . $Filnavn;
-                               $fp = fopen($Filnavn, "wb");
-                               fwrite($fp,$buffer);
-                               if(fclose($fp))
-                               {
-                                       $this->db->transaction_commit();
-
-                               }
-                               else
-                               {
-                                       $this->db->transaction_abort();
-                                       $message = 'Noe gikk galt!';            
                
-                               }
-                       }
-                       else
-                       {
-                               $message = $buffer;
-                       }
-
-                       return $message;
-               }
-       }
-?>

Deleted: trunk/property/inc/export/default/GABNr
===================================================================
--- trunk/property/inc/export/default/GABNr     2014-02-21 10:13:37 UTC (rev 
11727)
+++ trunk/property/inc/export/default/GABNr     2014-02-21 10:19:58 UTC (rev 
11728)
@@ -1,175 +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 export
-       * @version $Id$
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class export_conv
-       {
-               function export_conv()
-               {
-                       $this->soXport          = 
CreateObject('property.soXport');     
-                       $this->config           = 
CreateObject('phpgwapi.config','property');
-                       $this->socommon         = 
CreateObject('property.socommon');
-                       $this->solocation       = 
CreateObject('property.solocation');
-                       $this->config->read_repository();
-                       
-                       $this->db    = $this->socommon->new_db();
-
-                       $this->join                     = $this->socommon->join;
-
-               }
-
-               function overfor($download)
-               {
-                       //Generer batch ID
-                       $batchid = $this->soXport->next_batchid();
-               
-                       $receipt['message'][]= array('msg' => 
$this->OverforGAB($batchid,$download));
-
-                       return $receipt;
-               }               
-               
-               
-               function LagFilnavn ($batchid)
-               {       
-                       $fil_katalog = 
$this->config->config_data['export_path'];
-                       //Beregn l\xF8penr
-                       $StartLopeNr = ($batchid % 30) + 70;
-                       $LopeNr = $StartLopeNr;
-               
-                       do
-                       {
-                               //Konstruer filnavn
-                               $Filnavn = $fil_katalog . '/GABNr'. 
sprintf("%2d",$LopeNr) . '10.TXT';
-               
-                               //Sjekk om filen eksisterer
-                               If (!file_exists($Filnavn))
-                               {
-                                       return $Filnavn;
-                               }
-               
-                               //Genererer nytt l\xF8penr
-                               $batchid = $batchid + 1;
-                               $LopeNr = ($batchid % 30) + 70;
-                       }
-                       while  ($LopeNr != $StartLopeNr);
-               
-                       //Ingen l\xF8penr er ledige, gi feilmelding
-                       return False;
-               }
-               
-               function OverforGAB($batchid,$download)
-               {
-                       //Bestem filnavn
-                       
-                       $Filnavn = $this->LagFilnavn($batchid);
-                       if (!$Filnavn)
-                       {
-                               $message='LagFilnavn'.lang('Alle l\xF8penr for 
filnavn er i bruk!');
-                               return $message;
-                       }
-
-                       //Test om filen kan opprettes og skrives til
-                       if (@fopen($Filnavn, "wb"))
-                       {
-                               unlink($Filnavn);
-                       }
-                       else
-                       {
-                               $message='kan ikke lagre til fil: '. $Filnavn;
-                               return $message;
-                       }
-                       
-                       //Velg ut alle GABNr som skal overf\xF8res
-               
-                       $sql = "SELECT 
loc1_name,gab_id,fm_gab_location.loc1,fm_gab_location.address FROM 
fm_gab_location $this->join fm_location1 on fm_gab_location.loc1 = 
fm_location1.loc1 WHERE owner = 'yes' AND ((fm_location1.category <> 99) OR 
(fm_location1.category IS NULL)) GROUP BY 
gab_id,fm_gab_location.loc1,loc1_name, fm_gab_location.address ORDER by gab_id 
asc";
-
-                       $this->db->query($sql,__LINE__,__FILE__);
-
-                       while ($this->db->next_record())
-                       {
-                               $gab_list[] = array
-                               (
-                                       'gab_id' => $this->db->f('gab_id'),
-                                       'location_code' => $this->db->f('loc1'),
-                                       'address' => $this->db->f('address'),
-                                       'loc1_name' => 
$this->db->f('loc1_name'),
-                                       );
-                       }                                                       
                
-
-                       $cols_extra=array(0=>'loc1_name');
-                       
-                       $gab_count = count($gab_list);
-                       
-/*                     for ($i=0;$i<$gab_count;$i++)
-                       {
-                               
$location_data=$this->solocation->read_single($gab_list[$i]['location_code']);
-                               for ($j=0;$j<count($cols_extra);$j++)
-                               {
-                                       $gab_list[$i][$cols_extra[$j]] = 
$location_data[$cols_extra[$j]];
-                               }
-
-                       }
-*/
-                       $buffer = 'GABNr'. '    ' .'Objekt'.'   '.'Adresse' . 
"\r\n";
-
-                       $check_gab_id=array();
-                       
-                       for ($k=0;$k<$gab_count;$k++)
-                       {                               
-                               if (!$check_gab_id[$gab_list[$k]['gab_id']])
-                               {
-                                       
$check_gab_id[$gab_list[$k]['gab_id']]=True;
-                               
-                                       $buffer 
.=substr($gab_list[$k]['gab_id'],-20). '        ' 
.$gab_list[$k]['location_code']. '    ' .$gab_list[$k]['address']."\r\n";
-                               
-                                       $antall = $antall + 1;
-                               }
-                       }
-               
-//                     $buffer .= 'antall:'.'  '.$antall;
-
-                       if ($download=='on')
-                       {
-                               $message = 'Antall GABNr overf\xF8rt:'.$antall 
. ' ,Til fil: ' . $Filnavn;
-                               $fp = fopen($Filnavn, "wb");
-                               fwrite($fp,$buffer);
-                               fclose($fp);
-                       }
-                       else
-                       {
-                               $message = $buffer;
-                       }
-                       return $message;
-               }
-       }
-?>

Deleted: trunk/property/inc/export/default/Kemner_kvittering
===================================================================
--- trunk/property/inc/export/default/Kemner_kvittering 2014-02-21 10:13:37 UTC 
(rev 11727)
+++ trunk/property/inc/export/default/Kemner_kvittering 2014-02-21 10:19:58 UTC 
(rev 11728)
@@ -1,249 +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 export
-       * @version $Id$
-       */
-
-       /**
-        * Description
-        * @package property
-        */
-
-       class export_conv
-       {
-               //var $fil_katalog='c:/temp'; //On windows use 
"//computername/share/filename" or "\\\\computername\share\filename" to check 
files on network shares.
-               function export_conv()
-               {
-
-                       $this->soXport = CreateObject('property.soXport');      
-                       $this->config = 
CreateObject('phpgwapi.config','property');
-                       $this->config->read_repository();                       
-                       $this->socommon                 = 
CreateObject('property.socommon');
-                       $this->db    = $this->socommon->new_db();
-                       $this->join                     = $this->socommon->join;
-
-               }
-
-               function overfor($download)
-               {
-                       //Generer batch ID
-                       $batchid = $this->soXport->next_batchid();
-
-                       //Velg ut alle perioder som har bilag som skal 
overf\xF8res
-
-                       $periode = 
$this->select_periods_with_invoice_to_transfer();
-               
-
-                       for ($i=0;$i<count($periode);$i++)
-                       {
-                               $receipt['message'][]= array('msg' => 
$this->OverforPeriode($batchid,$periode[$i],$download));
-                       }
-
-
-                       return $receipt;
-               }               
-
-               function select_periods_with_invoice_to_transfer()
-               {
-                       $sql= "SELECT DISTINCT periode from fm_ecobilag where 
budsjettsigndato is not null and (saksigndato is not null or oppsynsigndato is 
not null) and utbetalingsigndato is not null ";
-                       $this->db->query($sql,__LINE__,__FILE__);
-                       while ($this->db->next_record())
-                       {
-                               $periode[]      = $this->db->f('periode');
-                       }
-                       return $periode;
-               }
-
-               function errorhandler($error_desr)
-               {
-                       $meld = $error_desr;
-               
-                       //Vis feilmelding
-                       echo $meld;
-
-               }
-               
-               
-               function LagFilnavn ($batchid)
-               {       
-                       $fil_katalog = 
$this->config->config_data['export_path'];
-                       //Beregn l\xF8penr
-                       $StartLopeNr = ($batchid % 30) + 70;
-                       $LopeNr = $StartLopeNr;
-               
-                       do
-                       {
-                               //Konstruer filnavn
-                               $Filnavn = $fil_katalog . '/kemner_kvitt'. 
sprintf("%2d",$LopeNr) . '10.TXT';
-               
-                               //Sjekk om filen eksisterer
-                               If (!file_exists($Filnavn))
-                               {
-                                       return $Filnavn;
-                               }
-               
-                               //Genererer nytt l\xF8penr
-                               $batchid = $batchid + 1;
-                               $LopeNr = ($batchid % 30) + 70;
-                       }
-                       while  ($LopeNr != $StartLopeNr);
-               
-                       //Ingen l\xF8penr er ledige, gi feilmelding
-                       return False;
-               }
-               
-               function OverforPeriode($batchid,$periode,$download)
-               {
-//     echo 'periode :' . $periode . '<BR>';           
-                       $BilagId = 'NULL';
-                       $sum=0;
-                       //Bestem filnavn
-                       
-                       $Filnavn = $this->LagFilnavn($batchid);
-                       if (!$Filnavn)
-                       {
-                               $message='LagFilnavn'.lang('Alle l\xF8penr for 
filnavn er i bruk!');
-                               $this->errorhandler($message);
-                               return $message;
-                       }
-
-                       //Test om filen kan opprettes og skrives til
-                       if (@fopen($Filnavn, "wb"))
-                       {
-                               unlink($Filnavn);
-                       }
-                       else
-                       {
-                               $message='kan ikke lagre til fil: '. $Filnavn 
.'<br>';
-                               return $message;
-                       }
-                       
-                       //Velg ut alle hoved bilag som skal overf\xF8res
-               
-                       $oRsBilag=$this->soXport->hoved_bilag($periode);
-                                                                       
-                       $buffer = 'kidnr'. '    ' .'belop'.'    '.'dato'."\r\n";
-
-                       for ($k=0;$k<count($oRsBilag);$k++)
-                       {                               
-               
-               
-                               //Bestem belops felt
-                               if ($oRsBilag[$k]['splitt']==0)
-                               {
-                                       //Bilaget er ikke splittet
-                                       if ($oRsBilag[$k]['godkjentbelop'] <> 
$oRsBilag[$k]['belop'])
-                                       {
-                                               $BelopFelt = 'godkjentbelop';   
                
-                                               //Logg til avviks tabell
-                                               if ($download=='on')
-                                               {
-//                                                     
$this->soXport->log_to_deviation_table($oRsBilag[$k]);
-                                               }
-                                       }
-                                       else
-                                       {
-                                               $BelopFelt = 'belop';
-                                       }
-                               }
-                               
-                               //Bilaget er splittet
-                               if ($oRsBilag[$k]['godkjentbelop'] == 
$oRsBilag[$k]['belop'])
-                               {
-                                       $BelopFelt = 'godkjentbelop';
-                               }
-                               else
-                               {
-                                        //Ikke lovlig
-                                       $message = lang('Avvik mellom 
fakturabel\xF8p og godkjent bel\xF8p p\xE5 splittet faktura!');
-                                       $this->errorhandler($message);
-                                       return $message;
-                               }
-               
-                               //Formater bel\xF8p
-                               if ($oRsBilag[$k]['artid'] == 1)
-                               {
-                                       $Belop = sprintf("%01.2f", 
$oRsBilag[$k][$BelopFelt]);
-       //      echo 'Belop :' . $Belop . '<BR>';               
-                               }
-                               else
-                               {
-                                       $Belop = sprintf("%01.2f", 
-$oRsBilag[$k][$BelopFelt]);
-               
-                               }
-               
-                               $Belop =$Belop *100; 
-               //              $Belop = substr($Belop,0,strlen($Belop) - 3) + 
substr($Belop, -2);
-               //echo 'Belop :' . $Belop . '<BR>';             
-               
-                               //Skriv hovedbilag
-
-                               $f1per          = 
$periode;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f1bilnr        = 
substr($oRsBilag[$k]['bilagsnr'],-6);
-                               $f1bildat       = 
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f1bilart       = $oRsBilag[$k]['artid'];
-                               $f1belop        = $Belop;                       
                                
-                               $f1fordat       = 
date(ymd,strtotime($oRsBilag[$k]['forfallsdato']));
-                               $f1tekst        = '';                           
                                
-                               $f1iper         = 
substr($periode,2,2);//date(m,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f1dime         = $oRsBilag[$k]['spvend_code']; 
                                
-        
-                               $f3per          = 
$periode;//date(ym,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f3bilnr        = 
substr($oRsBilag[$k]['bilagsnr'],-6);
-                               $f3rkonto       = $oRsBilag[$k]['spvend_code'];
-                               $f3pnr          = 
substr($oRsBilag[$k]['bilagsnr'],-6);
-                               $f3klasse       = $pmlabor_code;                
                
-                               $f3bildat       = 
date(ymd,strtotime($oRsBilag[$k]['fakturadato']));
-                               $f3bilart       = $oRsBilag[$k]['artid'];
-                               $f3belopr       = $Belop;                       
                                
-                               $f3fordat       = 
date(dmY,strtotime($oRsBilag[$k]['forfallsdato']));
-                               $f3sakb         = 
$oRsBilag[$k]['saksbehandler'];
-                               $f3idkode       = $oRsBilag[$k]['kidnr'];
-                               $f3tekst        = '';
-               
-                               $buffer .=substr($f3idkode,-20). '      ' 
.sprintf("%010s",$f3belopr).' 
'.substr($f3fordat,0,2).'.'.substr($f3fordat,2,2).'.'.substr($f3fordat,-4)."\r\n";
-                               $sum = $sum + $Belop;
-                               
-                               $antall = $antall + 1;
-                       }
-               
-                       $buffer .= sprintf("%20s",'Sum:').'     
'.sprintf("%010s",$sum);
-
-                       if ($download=='on')
-                       {
-                               $message = 'Periode: '.$periode.' antall 
bilag/underbilag overf\xF8rt:'.$antall . ' , fil: ' . $Filnavn . '<br>';
-                               $fp = fopen($Filnavn, "wb");
-                               fwrite($fp,$buffer);
-                               fclose($fp);
-                       }
-                       else
-                       {
-                               $message = $buffer;
-                       }
-                       return $message;
-               }
-       }
-?>




reply via email to

[Prev in Thread] Current Thread [Next in Thread]