phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] property/inc/export/Agresso, 1.4


From: nomail
Subject: [Phpgroupware-cvs] property/inc/export/Agresso, 1.4
Date: Mon, 13 Sep 2004 13:55:27 +0200

Update of /property/inc/export
Modified Files:
        Branch: 
          Agresso

date: 2004/09/13 11:55:27;  author: sigurdne;  state: Exp;  lines: +49 -62

Log Message:
no message
=====================================================================
Index: property/inc/export/Agresso
diff -u property/inc/export/Agresso:1.3 property/inc/export/Agresso:1.4
--- property/inc/export/Agresso:1.3     Sun Sep 12 11:00:12 2004
+++ property/inc/export/Agresso Mon Sep 13 11:55:27 2004
@@ -9,8 +9,8 @@
                        $this->db                       = $GLOBALS['phpgw']->db;
 
                        $this->soXport = CreateObject('property.soXport');      
-                       $this->$config = 
CreateObject('phpgwapi.config','property');
-                       $this->$config->read_repository();
+                       $this->config = 
CreateObject('phpgwapi.config','property');
+                       $this->config->read_repository();
                        $this->bocommon                 = 
CreateObject($this->currentapp.'.bocommon');
                        
                }
@@ -216,37 +216,31 @@
                        $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,$pre_transfer='')
                {
+
+//                     $download = 'on';
 //                     $pre_transfer=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
 
                        $periode = 
$this->select_periods_with_invoice_to_transfer($pre_transfer);
 //_debug_array($periode);              
+
                        for ($i=0;$i<count($periode);$i++)
                        {
+                               //Generer batch ID
+                               $batchid = $this->soXport->next_batchid();
+
+                               if ($download=='on')
+                               {
+                                       $this->increment_batchid();
+                                       //Lagre melding
+                                       $this->log_start($batchid);
+                               }
+
                                $receipt['message'][]= array('msg' => 
$this->OverforPeriode($batchid,$periode[$i],$download,$pre_transfer));
                        }
 
@@ -337,7 +331,7 @@
                
                        if($antall > 0)
                        {               
-                               $fil_katalog = 
$this->$config->config_data['export_path'];                      
+                               $fil_katalog = 
$this->config->config_data['export_path'];                       
                        
                                if(unlink ($fil_katalog. SEP . $Filnavn))
                                {
@@ -361,38 +355,27 @@
                
                function LagFilnavn ($batchid,$pre_transfer='')
                {       
-                       if(!$pre_transfer)
+                       if($pre_transfer)
                        {
-                               $fil_katalog = 
$this->$config->config_data['export_path'];
-                               //Beregn løpenr
-                               $StartLopeNr = ($batchid % 30) + 70;
-                               $LopeNr = $StartLopeNr;
+                               $fil_katalog = 
$this->config->config_data['export_pre_path'];
                        
-                               do
-                               {
-                                       //Konstruer filnavn
-                                       $Filnavn = $fil_katalog . '/DTF1'. 
sprintf("%2d",$LopeNr) . '10.TXT';
-                       
-                                       //Sjekk om filen eksisterer
-                                       If (!file_exists($Filnavn))
-                                       {
-                                               return $Filnavn;
-                                       }
+                               $Filnavn = $fil_katalog . '/FDVankomst_' . 
$batchid. '.TXT';
                        
-                                       //Genererer nytt løpenr
-                                       $batchid = $batchid + 1;
-                                       $LopeNr = ($batchid % 30) + 70;
+                               //Sjekk om filen eksisterer
+                               If (!file_exists($Filnavn))
+                               {
+                                       return $Filnavn;
                                }
-                               while  ($LopeNr != $StartLopeNr);
+                       
                        }
                        else
                        {
-                               $fil_katalog = 
$this->$config->config_data['export_pre_path'];
+                               $fil_katalog = 
$this->config->config_data['export_path'];
                                $continue = True;
                                $i = 1;
                                do
                                {
-                                       $Filnavn = $fil_katalog . '/bbb_' . 
date("dmY") . '_' . $i;
+                                       $Filnavn = $fil_katalog . '/FDV' . 
date("dmY") . '_' . $i. '.TXT';
                                
                                        //Sjekk om filen eksisterer
                                        If (!file_exists($Filnavn))
@@ -445,9 +428,6 @@
                        for ($k=0;$k<$bilag_count;$k++)
                        {                               
                                $pre_tranfser_bilag[] = 
$oRsBilag[$k]['bilagsnr'];
-                               //Hent leverandørklasse
-                               
-                               $pmlabor_code 
=$this->select_vendor_class($oRsBilag[$k]['spvend_code']);
                                
                                //Bestem belops felt
                                if ($oRsBilag[$k]['splitt']==0)
@@ -507,7 +487,16 @@
                                $Bilagsnr       = 
sprintf("%09s",substr($oRsBilag[$k]['bilagsnr'],-6));// verdi: Bilagsnummer, 
type: i4, plass: 267 - 275
                                $Periode        = 
sprintf("%06s",date(Y,strtotime($oRsBilag[$k]['fakturadato'])) . 
sprintf("%02d",$periode));// verdi: Periode, type: i4, plass: 276 - 281
                                $ESL            = sprintf("%1s",'');// verdi: 
Blank, type: i+C481, plass: 282 - 282
-                               $Forfall        = 
date(Ymd,strtotime($oRsBilag[$k]['forfallsdato']));// verdi: Forfallsdato , 
type: date, plass: 298 - 305
+
+                               if($pre_transfer)
+                               {
+                                       $Forfall        = '20991231';// verdi: 
Forfallsdato , type: date, plass: 298 - 305                              
+                               }
+                               else
+                               {
+                                       $Forfall        = 
date(Ymd,strtotime($oRsBilag[$k]['forfallsdato']));// verdi: Forfallsdato , 
type: date, plass: 298 - 305                              
+                               }
+                               
                                $Fakturanr      = 
sprintf("%-15s",$oRsBilag[$k]['fakturanr']);// verdi: Fakturanr, type: c15, 
plass: 283 - 297
                                $Rab_forf       = sprintf("%-8s",'');// verdi: 
Blank, type: date, plass: 306 - 313
                                $Rabatt         = sprintf("%020s",'');// verdi: 
Blank, type: money, plass: 314 - 333
@@ -622,21 +611,18 @@
                                                
$this->soXport->add_OverfBilag($oRsOverfBilag);
                                        }
                                        
-                                       if ($download=='on' && $pre_transfer)
+                                       
+                                       // Merking utgår : overføre alle kvar 
gong.     
+
+                               /*      if ($download=='on' && $pre_transfer)
                                        {
                                                $this->db->query("update 
fm_ecobilag  set pre_transfer = 1 where id =" . $oRsOverfBilag['id']);
                                        }
+                               */
+
+
                                        //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 .= $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 . 
@@ -710,6 +696,7 @@
                
                function 
pre_transfer($buffer,$Filnavn,$batchid,$pre_tranfser_bilag)
                {                       
+//_debug_array($Filnavn);                      
                        $fp = fopen($Filnavn, "wb");
                        fwrite($fp,$buffer);
                        if(fclose($fp))
@@ -719,11 +706,11 @@
 
 //_debug_array($pre_tranfser_bilag);
 
-                       
if($this->$config->config_data['invoice_export_method']=='ftp')
+                       
if($this->config->config_data['invoice_export_method']=='ftp')
                        {
                                $ftp    = $this->phpftp_connect();      
                                
-                               $basedir = 
$this->$config->config_data['invoice_ftp_basedir'];
+                               $basedir = 
$this->config->config_data['invoice_ftp_basedir'];
                                $newfile = $basedir . '/' . basename($Filnavn);
 //_debug_array($newfile);                      
                                if (ftp_put($ftp,$newfile, $Filnavn, 
FTP_BINARY))
@@ -754,9 +741,9 @@
 
                function phpftp_connect() 
                {
-                       $host = $this->$config->config_data['invoice_ftp_host'];
-                       $user = $this->$config->config_data['invoice_ftp_user'];
-                       $pass = $this->$config->config_data['invoice_ftp_pw'];
+                       $host = $this->config->config_data['invoice_ftp_host'];
+                       $user = $this->config->config_data['invoice_ftp_user'];
+                       $pass = $this->config->config_data['invoice_ftp_pw'];
                        
 //                     echo "connecting to $host with $user and $pass\n <br>";
                        $ftp = ftp_connect($host);




reply via email to

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