phpgroupware-cvs
[Top][All Lists]
Advanced

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

[Phpgroupware-cvs] CVS: property/inc/export GABNr,NONE,1.1 Ecolink,1.8,1


From: Sigurd Nes <address@hidden>
Subject: [Phpgroupware-cvs] CVS: property/inc/export GABNr,NONE,1.1 Ecolink,1.8,1.9 Kemner_kvittering,1.2,1.3
Date: Wed, 07 May 2003 05:02:13 -0400

Update of /cvsroot/phpgroupware/property/inc/export
In directory subversions:/tmp/cvs-serv28670/inc/export

Modified Files:
        Ecolink Kemner_kvittering 
Added Files:
        GABNr 
Log Message:
no message

--- NEW FILE ---
<?php

        class export_conv
        {
                function export_conv()
                {

                        $this->currentapp       = 
$GLOBALS['phpgw_info']['flags']['currentapp'];
                        $this->soXport          = 
CreateObject($this->currentapp.'.soXport');   
                        $this->$config          = 
CreateObject('phpgwapi.config','property');
                        $this->socommon         = 
CreateObject($this->currentapp.'.socommon');
                        
                        $this->$config->read_repository();
                        
                        $this->db = $GLOBALS['phpgw']->db;

                        if 
($GLOBALS['phpgw_info']['server']['db_type']=='pgsql')
                        {
                                $this->join = " JOIN ";
                        }
                        else
                        {
                                $this->join = " LEFT JOIN ";
                        }

                }

                function overfor($download)
                {
                        //Generer batch ID
                        $batchid = $this->soXport->next_batchid();
                
                        $message[]['msg'] = 
$this->OverforGAB($batchid,$download);

                        return $message;
                }               
                
                
                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 . '/GABNr'. 
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 OverforGAB($batchid,$download)
                {
                        //Bestem filnavn
                        
                        $Filnavn = $this->LagFilnavn($batchid);
                        if (!$Filnavn)
                        {
                                $message='LagFilnavn'.lang('Alle løpenr 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øres
                
                        $sql = "SELECT gab_id,location_code FROM 
fm_gab_location GROUP BY gab_id 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'),
                                        'address' => $this->db->f('address'),
                                        'location_code' => 
$this->db->f('location_code')
                                        );
                        }                                                       
                

                        for ($i=0;$i<count($gab_list);$i++)
                        {
                                
$location_data=$this->socommon->read_location_data($gab_list[$i]['location_code']);
                                $gab_list[$i]=$gab_list[$i] + $location_data;
                        }


                        $buffer = 'GABNr'. '    ' .'Adresse'."\r\n";

                        for ($k=0;$k<count($gab_list);$k++)
                        {                               
                                $buffer .=substr($gab_list[$k]['gab_id'],-20). 
'        ' .$gab_list[$k]['street_name']."\r\n";
                                
                                $antall = $antall + 1;
                        }
                
//                      $buffer .= 'antall:'.'  '.$antall;

                        if ($download=='on')
                        {
                                $message = 'Antall GABNr overført:'.$antall . ' 
,Til fil: ' . $Filnavn;
                                $fp = fopen($Filnavn, "wb");
                                fwrite($fp,$buffer);
                                fclose($fp);
                        }
                        else
                        {
                                $message = $buffer;
                        }
                        return $message;
                }
        }
?>

Index: Ecolink
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/export/Ecolink,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -r1.8 -r1.9
*** Ecolink     9 Jan 2003 23:10:24 -0000       1.8
--- Ecolink     7 May 2003 09:02:11 -0000       1.9
***************
*** 375,379 ****
                                        }
                
!                                       //Overfør til t_ecobilagoverf
                
                                        $oRsOverfBilag=$oRsUnderbilag[$i];
--- 375,379 ----
                                        }
                
!                                       //Overfør til fm_ecobilagoverf
                
                                        $oRsOverfBilag=$oRsUnderbilag[$i];
***************
*** 416,423 ****
  
                                
!                                       //Slett post i t_ecobilag
                                        if ($download=='on')
                                        {
!                                               
$this->soXport->delete_from_t_ecobilag($oRsUnderbilag[$i]['id']);               
                                                //Logg transaksjon              
                                                
$this->soXport->log_transaction($batchid,$BilagId);
--- 416,423 ----
  
                                
!                                       //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);

Index: Kemner_kvittering
===================================================================
RCS file: /cvsroot/phpgroupware/property/inc/export/Kemner_kvittering,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -r1.2 -r1.3
*** Kemner_kvittering   31 Mar 2003 21:14:14 -0000      1.2
--- Kemner_kvittering   7 May 2003 09:02:11 -0000       1.3
***************
*** 45,49 ****
                function select_periods_with_invoice_to_transfer()
                {
!                       $sql= "select distinct periode from t_ecobilag where 
budsjettsigndato is not null and (saksigndato is not null or oppsynsigndato is 
not null) and utbetalingsigndato is not null and spvend_code ='20003' ";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $i = 0;
--- 45,49 ----
                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 and spvend_code ='20003' ";
                        $this->db->query($sql,__LINE__,__FILE__);
                        $i = 0;





reply via email to

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