batch/1.1/old/loadEntrep.php
2013-06-19 08:24:49 +00:00

415 lines
23 KiB
PHP

#!/usr/bin/php -c/var/www/batch/config/php_batch_sd.ini
<?php
set_time_limit(0);
$link = mysql_connect('localhost', 'root', 'bzh4231*');
if (!$link) {
echo "Erreur mysql ". mysql_errno() .' - '. mysql_error(). "\r\n";
die();
}
mysql_select_db('historiques');
$tabAnn=array( /*'ANN_EN_89','ANN_EN_90','ANN_EN_91','ANN_EN_92','ANN_EN_93','ANN_EN_94','ANN_EN_95','ANN_EN_96',*/'ANN_EN_97','ANN_EN_98',
'ANN_EN_99','ANN_EN_00','ANN_EN_01','ANN_EN_02','ANN_EN_03','ANN_EN_04','ANN_EN_05','ANN_EN_06');
foreach ($tabAnn as $fichier) {
echo date('Y/m/d - H:i:s'). " - Début du traitement du fichier $fichier\r\n";
flush();
$fp=fopen('/home/data/bodacc_histo/'.$fichier, 'r');
if ($fp) {
$nbLignes=$nbEntrep=0;
while (!feof($fp)) {
$nbLignes++;
$buffer = fgets($fp, 4096);
if ($fichier=='ANN_EN_97' && $nbLignes<1300000) continue;
$ANBASE =trim(substr($buffer, 0 , 11 )); // ANBASE P 9 N° ANN. BASE
$NOSAI =trim(substr($buffer, 11 , 11 )); // NOSAI P 9 N° ANNONCE
$ORDRE =trim(substr($buffer, 22 , 5 )); // ORDRE P 3 N° ODRE TRAITEMENT
$NOBOD =trim(substr($buffer, 27 , 5 )); // NOBOD P 3 N°BODACC
$LTBOD =trim(substr($buffer, 32 , 1 )); // LTBOD A LETTRE BODACC
$CODTRI =trim(substr($buffer, 33 , 6 )); // CODTRI A CODE TRIBUNAL BODACC
$JAL =trim(substr($buffer, 39 , 5 )); // JAL P 3 CODE JAL
$DATE =trim(substr($buffer, 44 , 9 )); // DATE P 7 DATE JAL-AAMMJJ
if ((substr($DATE,0,1)*1)==1) $DATE='20'.substr($DATE,1,6);
else $DATE='19'.substr($DATE,0,6);
$NOPAGE =trim(substr($buffer, 53 , 5 )); // NOPAGE P 3 N° PAGE
$CODEVE =trim(substr($buffer, 58 , 5 )); // CODEVE P 3 CODE EVE
$SSCODE =trim(substr($buffer, 63 , 11 )); // SSCODE P 9 SOUS CODE EVT MMD
$DEPT =trim(substr($buffer, 74 , 2 )); // DEPT A DEPT
$NOANN =trim(substr($buffer, 76 , 8 )); // NOANN P 6 N° ANN JAL
$ROLE =trim(substr($buffer, 84 , 1 )); // ROLE A ROLE
$SIREN =trim(substr($buffer, 85 , 11 )); // SIREN P 9 SIREN
$CODLIC =trim(substr($buffer, 96 , 2 )); // CODLIC A CODE LICENCIE
$SIGNAT =trim(substr($buffer, 98 , 5 )); // SIGNAT A SIGNATURE
$NOMTER =trim(substr($buffer, 103 , 2 )); // NOMTER A NOM TERMINAL
$DATSAI =trim(substr($buffer, 105 , 9 )); // DATSAI P 7 DATE SAISIE
if ((substr($DATSAI,0,1)*1)==1) $DATSAI='20'.substr($DATSAI,1,6);
else $DATSAI='19'.substr($DATSAI,0,6);
$TOPRAP =trim(substr($buffer, 114 , 1 )); // TOPRAP A TEMOIN DE RAPP T=TOUS ETAB SIREN
$CHOETA =trim(substr($buffer, 115 , 11 )); // CHOETA P 9 N° ETABL. OU ZEROS
$CHOPDS =trim(substr($buffer, 126 , 5 )); // CHOPDS P 3 POIDS
$CHOCHO =trim(substr($buffer, 131 , 1 )); // CHOCHO A CHOIX 1 A 9
$FLASUR =trim(substr($buffer, 132 , 1 )); // FLASUR A FLAG * SI SURVEIL.
$DATLIE =trim(substr($buffer, 133 , 9 )); // DATLIE P 7 DATE LIEN
if ((substr($DATLIE,0,1)*1)==1) $DATLIE='20'.substr($DATLIE,1,6);
else $DATLIE='19'.substr($DATLIE,0,6);
$REPRO =trim(substr($buffer, 142 , 1 )); // REPRO A TOP
$CHOCOU =trim(substr($buffer, 143 , 1 )); // CHOCOU A LIEN COUPE
$CHOLIE =trim(substr($buffer, 144 , 1 )); // CHOLIE A LIEN CONFIRME
$PAYS =trim(substr($buffer, 145 , 1 )); // PAYS A PAYS
$FILL1 =trim(substr($buffer, 146 , 1 )); // FILL1 A ZONE LIBRE
$FILL2 =trim(substr($buffer, 147 , 1 )); // FILL2 A ZONE LIBRE
$FILL3 =trim(substr($buffer, 148 , 1 )); // FILL3 A ZONE LIBRE
$FILL4 =trim(substr($buffer, 149 , 1 )); // FILL4 A ZONE LIBRE
$FILL5 =trim(substr($buffer, 150 , 1 )); // FILL5 A ZONE LIBRE
$FILL6 =trim(substr($buffer, 151 , 1 )); // FILL6 A ZONE LIBRE
$FILL7 =trim(substr($buffer, 152 , 1 )); // FILL7 A ZONE LIBRE
$FILL8 =trim(substr($buffer, 153 , 1 )); // FILL8 A ZONE LIBRE
$FILL9 =trim(substr($buffer, 154 , 1 )); // FILL9 A ZONE LIBRE
$FILL10 =trim(substr($buffer, 155 , 1 )); // FILL10 A ZONE LIBRE
$FILL11 =trim(substr($buffer, 156 , 1 )); // FILL11 A ZONE LIBRE
$FILL12 =trim(substr($buffer, 157 , 1 )); // FILL12 A ZONE LIBRE
$FILL13 =trim(substr($buffer, 158 , 1 )); // FILL13 A ZONE LIBRE
$FILL14 =trim(substr($buffer, 159 , 1 )); // FILL14 A ZONE LIBRE
$FILL15 =trim(substr($buffer, 160 , 1 )); // FILL15 A ZONE LIBRE
$E1GENT =trim(substr($buffer, 161 , 11 )); // E1GENT P 9 N° ENTREP
$E1GORI =trim(substr($buffer, 172 , 1 )); // E1GORI A ORIG BIL
$E1GSTB =trim(substr($buffer, 173 , 1 )); // E1GSTB A STATUT BIL
$E1GRCD =trim(substr($buffer, 174 , 1 )); // E1GRCD A SIREN DOUTEUX
$E1GSIR =trim(substr($buffer, 175 , 11 )); // E1GSIR P 9 SIREN
$E1GNIC =trim(substr($buffer, 186 , 7 )); // E1GNIC P 5 SIRET
$E1SNIC =trim(substr($buffer, 193 , 7 )); // E1SNIC P 5 SIE:NIC
$E1SREG =trim(substr($buffer, 200 , 2 )); // E1SREG A SIE:REGION
$E1SDEP =trim(substr($buffer, 202 , 2 )); // E1SDEP A SIE:DEPT
$E1SCOM =trim(substr($buffer, 204 , 3 )); // E1SCOM A SIE:LOCAL
$E1TNOM =addslashes(trim(substr($buffer, 207 , 40 ))); // E1TNOM A ENT:NOM RAISON SOC
$E1TSIG =addslashes(trim(substr($buffer, 247 , 20 ))); // E1TSIG A ENT:SIGLE
$E1TDCR =trim(substr($buffer, 267 , 10 )); // E1TDCR P 8 ENT:DT CREAT AAAAMMJJ
$E1TMMI =trim(substr($buffer, 277 , 2 )); // E1TMMI A ENT:MM IMMAT
$E1TCJ =trim(substr($buffer, 279 , 4 )); // E1TCJ A ENT:CAT JUR
$E1TNBR =trim(substr($buffer, 283 , 7 )); // E1TNBR P 5 ENT:NB ETAB
$E1TTEF =trim(substr($buffer, 290 , 2 )); // E1TTEF A ENT:TRANCHE EFF
$E1TEFF =trim(substr($buffer, 292 , 9 )); // E1TEFF P 7 ENT:EFFECTIF
$E1TDEF =trim(substr($buffer, 301 , 4 )); // E1TDEF A ENT:DT MAJ EFF AAAA
$E1TAPE =trim(substr($buffer, 305 , 4 )); // E1TAPE A ENT:APE
$E1TA40 =trim(substr($buffer, 309 , 2 )); // E1TA40 A ENT:APE 40
$E1TDAP =trim(substr($buffer, 311 , 4 )); // E1TDAP A ENT:DT MAJ APE AAAA
$E1TCA =trim(substr($buffer, 315 , 2 )); // E1TCA A ENT:TR CA
$E1TCAX =trim(substr($buffer, 317 , 2 )); // E1TCAX A ENT:TR CA EXPORT
$E1TSEX =trim(substr($buffer, 319 , 1 )); // E1TSEX A ENT:SEXE PP
$E1TRCM =trim(substr($buffer, 320 , 1 )); // E1TRCM A ENT:REPERT
$E1TAPR =trim(substr($buffer, 321 , 5 )); // E1TAPR A ENT:ACT ARTIS
$E1TMOA =trim(substr($buffer, 326 , 1 )); // E1TMOA A ENT:MONOACT
$E1TMOD =trim(substr($buffer, 327 , 1 )); // E1TMOD A ENT:MODAL
$E1TRGP =trim(substr($buffer, 328 , 2 )); // E1TRGP A ENT:REG PPAL
$E1TMNO =trim(substr($buffer, 330 , 1 )); // E1TMNO A ENT:MONOREG
$E1TCMP =trim(substr($buffer, 331 , 1 )); // E1TCMP A ENT:CODE MARCH
$E1TDOM =trim(substr($buffer, 332 , 2 )); // E1TDOM A ENT:DOM ADM
$E1TDEA =trim(substr($buffer, 334 , 4 )); // E1TDEA A ENT:ENR EAE AAAA
$E1TEAE =trim(substr($buffer, 338 , 4 )); // E1TEAE A ENT:APE EAE
$E1TEA1 =trim(substr($buffer, 342 , 4 )); // E1TEA1 A ENT:1R ACTIV SEC
$E1TEA2 =trim(substr($buffer, 346 , 4 )); // E1TEA2 A ENT:2E ACTIV SEC
$E1TEA3 =trim(substr($buffer, 350 , 4 )); // E1TEA3 A ENT:3E ACTIV SEC
$E1TEA4 =trim(substr($buffer, 354 , 4 )); // E1TEA4 A ENT:4E ACTIV SEC
$E1ENOM =addslashes(trim(substr($buffer, 358 , 40 ))); // E1ENOM A ETA:NOM RAISON SOC
$E1EDCR =trim(substr($buffer, 398 , 10 )); // E1EDCR P 8 ETA:DT CREAT AAAAMMJJ
$E1EMMI =trim(substr($buffer, 408 , 2 )); // E1EMMI A ETA:MM IMMAT
$E1ENRU =trim(substr($buffer, 410 , 7 )); // E1ENRU P 5 ETA:N°RUE
$E1EBTQ =addslashes(trim(substr($buffer, 417 , 1 ))); // E1EBTQ A ETA:BTQ
$E1ETVI =addslashes(trim(substr($buffer, 418 , 3 ))); // E1ETVI A ETA:TYPE VOIE INSEE
$E1ETVO =addslashes(trim(substr($buffer, 421 , 3 ))); // E1ETVO A ETA:TYPE VOIE
$E1EVOI =addslashes(trim(substr($buffer, 424 , 33 ))); // E1EVOI A ETA:RUE
$E1EVIL =addslashes(trim(substr($buffer, 457 , 38 ))); // E1EVIL A ETA:COMMUNE
$E1ECPI =trim(substr($buffer, 495 , 7 )); // E1ECPI P 5 ETA:CODPOS INSEE
$E1ECPD =trim(substr($buffer, 502 , 2 )); // E1ECPD A ETA:COD POST DEP
$E1ECPF =trim(substr($buffer, 504 , 3 )); // E1ECPF A ETA:COD POST VIL
$E1EBUR =addslashes(trim(substr($buffer, 507 , 32 ))); // E1EBUR A ETA:BUR DIS
$E1EPAD =addslashes(trim(substr($buffer, 539 , 30 ))); // E1EPAD A ETA:COMPLT ADRESSE
$E1EDIS =addslashes(trim(substr($buffer, 569 , 30 ))); // E1EDIS A ETA:DISTR SPE
$E1EACH =addslashes(trim(substr($buffer, 599 , 38 ))); // E1EACH A ETA:ACHEM POST
$E1EREG =trim(substr($buffer, 637 , 2 )); // E1EREG A ETA:REG
$E1EDEP =trim(substr($buffer, 639 , 2 )); // E1EDEP A ETA:DEP
$E1ECOM =trim(substr($buffer, 641 , 3 )); // E1ECOM A ETA:TOPO LOCAL
$E1ERIV =trim(substr($buffer, 644 , 4 )); // E1ERIV A ETA:RIVOLI
$E1ESEG =trim(substr($buffer, 648 , 1 )); // E1ESEG A ETA:SEGMT VOIE
$E1EARD =trim(substr($buffer, 649 , 1 )); // E1EARD A ETA:ARROND
$E1EARO =trim(substr($buffer, 650 , 1 )); // E1EARO A ETA:DEP OUTMER ARR
$E1ECAN =trim(substr($buffer, 651 , 2 )); // E1ECAN A ETA:CANTON
$E1ECAO =trim(substr($buffer, 653 , 1 )); // E1ECAO A ETA:DEP OUTMER CAN
$E1EDPU =trim(substr($buffer, 654 , 2 )); // E1EDPU A ETA:DEP UNIT URB
$E1ETUR =trim(substr($buffer, 656 , 1 )); // E1ETUR A ETA:TAILLE UNIT URB
$E1EURB =trim(substr($buffer, 657 , 2 )); // E1EURB A ETA:UNIT URB
$E1EILO =trim(substr($buffer, 659 , 8 )); // E1EILO A ETA:ILOT
$E1ETCO =trim(substr($buffer, 667 , 2 )); // E1ETCO A ETA:TR COMMUNE
$E1EEMP =trim(substr($buffer, 669 , 2 )); // E1EEMP A ETA:ZONE EMPLOI
$E1ETEF =trim(substr($buffer, 671 , 2 )); // E1ETEF A ETA:TRANCHE EFF
$E1EEFF =trim(substr($buffer, 673 , 9 )); // E1EEFF P 7 ETA:EFFECTIF
$E1EDEF =trim(substr($buffer, 682 , 4 )); // E1EDEF A ETA:DT MAJ EFF AAAA
$E1EAPE =trim(substr($buffer, 686 , 4 )); // E1EAPE A ETA:APE
$E1EA40 =trim(substr($buffer, 690 , 2 )); // E1EA40 A ETA:APE 40
$E1EDAP =trim(substr($buffer, 692 , 4 )); // E1EDAP A ETA:MAJ APE AAAA
$E1ESIE =trim(substr($buffer, 696 , 1 )); // E1ESIE A ETA:STATUT SIE/ETA
$E1ESAI =trim(substr($buffer, 697 , 1 )); // E1ESAI A ETA:SAISON
$E1EAUX =trim(substr($buffer, 698 , 1 )); // E1EAUX A ETA:AUXIL
$E1EORC =trim(substr($buffer, 699 , 1 )); // E1EORC A ETA:ORI CREAT
$E1ENAT =trim(substr($buffer, 700 , 2 )); // E1ENAT A ETA:NATURE
$E1EMOD =trim(substr($buffer, 702 , 1 )); // E1EMOD A ETA:MODAL
$E1ESIN =trim(substr($buffer, 703 , 2 )); // E1ESIN A ETA:SINGT
$E1ECMP =trim(substr($buffer, 705 , 1 )); // E1ECMP A ETA:MARCH
$E1EORD =trim(substr($buffer, 706 , 1 )); // E1EORD A ETA:ORDINARITE
$E1ETEL =trim(substr($buffer, 707 , 11 )); // E1ETEL A ETA:TEL INSEE
$E1EDEA =trim(substr($buffer, 718 , 4 )); // E1EDEA A ETA:ENR EAE AAAA
$E1EEAE =trim(substr($buffer, 722 , 4 )); // E1EEAE A ETA:APE EAE
$E1EEA1 =trim(substr($buffer, 726 , 4 )); // E1EEA1 A ETA:1R ACTIV SEC
$E1EEA2 =trim(substr($buffer, 730 , 4 )); // E1EEA2 A ETA:2E ACTIV SEC
$E1MMMJ =trim(substr($buffer, 734 , 1 )); // E1MMMJ A MAJ:CODE MAJ MENSUEL
$E1MVM1 =trim(substr($buffer, 735 , 1 )); // E1MVM1 A MAJ:VM1
$E1MVM2 =trim(substr($buffer, 736 , 1 )); // E1MVM2 A MAJ:VM2
$E1MVM3 =trim(substr($buffer, 737 , 1 )); // E1MVM3 A MAJ:VM3
$E1MHMJ =trim(substr($buffer, 738 , 1 )); // E1MHMJ A MAJ:CODE MAJ HEBDO
$E1MMRQ =trim(substr($buffer, 739 , 1 )); // E1MMRQ A MAJ:MARQUE FIN
$E1M299 =trim(substr($buffer, 740 , 8 )); // E1M299 A MAJ:RESERVE
$E1MEVT =trim(substr($buffer, 748 , 2 )); // E1MEVT A MAJ:EVT
$E1MDEV =trim(substr($buffer, 750 , 10 )); // E1MDEV P 8 MAJ:DT EVT AAAAMMJJ
$E1MSTR =trim(substr($buffer, 760 , 1 )); // E1MSTR A MAJ:SITU TRANSF
$E1MNIL =trim(substr($buffer, 761 , 7 )); // E1MNIL P 5 MAJ:NIC LIE TRANSF
$E1MCES =trim(substr($buffer, 768 , 1 )); // E1MCES A MAJ:CAUSE CESS JUR
$E1MTRS =trim(substr($buffer, 769 , 1 )); // E1MTRS A MAJ:TRANSF SIE
$E1MORE =trim(substr($buffer, 770 , 2 )); // E1MORE A MAJ:ORI/DESTIN
$E1MSIP =trim(substr($buffer, 772 , 16 )); // E1MSIP P 14 MAJ:SIRET PREC
$E1MMJS =trim(substr($buffer, 788 , 9 )); // E1MMJS P 7 MAJ:DESC MOD SIREN
$E1MMJT =trim(substr($buffer, 797 , 11 )); // E1MMJT P 9 MAJ:DESC MOD NIC
$E1MIDD =trim(substr($buffer, 808 , 10 )); // E1MIDD P 8 MAJ:DT INSEE AAAAMMJJ
$E1MIDN =trim(substr($buffer, 818 , 9 )); // E1MIDN P 7 MAJ:SEQ INSEE PUR
$E1CTRJ =trim(substr($buffer, 827 , 1 )); // E1CTRJ A COM:TOP RJ
$E1CARJ =trim(substr($buffer, 828 , 11 )); // E1CARJ P 9 COM:ANN RJ
$E1CDRJ =trim(substr($buffer, 839 , 10 )); // E1CDRJ P 8 COM:DT AN RJ AAAAMMJJ
$E1CERJ =trim(substr($buffer, 849 , 5 )); // E1CERJ P 3 COM:EVT RJ
$E1CRRJ =trim(substr($buffer, 854 , 1 )); // E1CRRJ A COM:ROL RJ
$E1CDBI =trim(substr($buffer, 855 , 5 )); // E1CDBI P 3 COM:DER CLOT BILAN
$E1CTBI =trim(substr($buffer, 860 , 1 )); // E1CTBI A COM:TOP BILAN
$E1CTSI =trim(substr($buffer, 861 , 1 )); // E1CTSI A COM:TOP SIEGE ACTIF
$E1CRNC =trim(substr($buffer, 862 , 1 )); // E1CRNC A COM:TOP EXIST RNCS
$E1CDRA =trim(substr($buffer, 863 , 10 )); // E1CDRA P 8 COM:DT RADIA AAAAMMJJ
$E1CDIN =trim(substr($buffer, 873 , 10 )); // E1CDIN P 8 COM:DT MAJ I AAAAMMJJ
$E1CDMB =trim(substr($buffer, 883 , 10 )); // E1CDMB P 8 COM:DT DER B AAAAMMJJ
$E1CTEL =trim(substr($buffer, 893 , 1 )); // E1CTEL A COM:TOP TEL
$E1CFAX =trim(substr($buffer, 894 , 1 )); // E1CFAX A COM:TOP FAX
$E1CWEB =trim(substr($buffer, 895 , 1 )); // E1CWEB A COM:TOP WEB
$E1RTO5 =trim(substr($buffer, 896 , 1 )); // E1RTO5 A TOP5
$E1RTO6 =trim(substr($buffer, 897 , 1 )); // E1RTO6 A TOP6
$E1RTO7 =trim(substr($buffer, 898 , 1 )); // E1RTO7 A TOP7
$E1RTO8 =trim(substr($buffer, 899 , 1 )); // E1RTO8 A TOP8
$E1RTO9 =trim(substr($buffer, 900 , 1 )); // E1RTO9 A TOP9
$E1RF1P =trim(substr($buffer, 901 , 11 )); // E1RF1P P 9 FILLER UN PACKE 9
$E1RF2P =trim(substr($buffer, 912 , 11 )); // E1RF2P P 9 FILLER DEUX PACKE 9
$E1RF3A =addslashes(trim(substr($buffer, 923 , 60 ))); // E1RF3A A FILLER TROIS ALPHA 60
/*
echo "N° ANN. BASE=$ANBASE\r\n";
echo "N° ANNONCE=$NOSAI\r\n";
echo "N° ODRE TRAITEMENT=$ORDRE\r\n";
echo "N°BODACC=$NOBOD\r\n";
echo "LETTRE BODACC=$LTBOD\r\n";
echo "CODE TRIBUNAL BODACC=$CODTRI\r\n";
echo "CODE JAL=$JAL\r\n";
echo "DATE JAL-AAMMJJ=$DATE\r\n";
echo "N° PAGE=$NOPAGE\r\n";
echo "CODE EVE=$CODEVE\r\n";
echo "SOUS CODE EVT MMD=$SSCODE\r\n";
echo "DEPT=$DEPT\r\n";
echo "N° ANN JAL=$NOANN\r\n";
echo "ROLE=$ROLE\r\n";
echo "SIREN=$SIREN\r\n";
echo "CODE LICENCIE=$CODLIC\r\n";
echo "SIGNATURE=$SIGNAT\r\n";
echo "NOM TERMINAL=$NOMTER\r\n";
echo "DATE SAISIE=$DATSAI\r\n";
echo "TEMOIN DE RAPP T=TOUS ETAB SIREN=$TOPRAP\r\n";
echo "N° ETABL. OU ZEROS=$CHOETA\r\n";
echo "POIDS=$CHOPDS\r\n";
echo "CHOIX 1 A 9=$CHOCHO\r\n";
echo "FLAG * SI SURVEIL.=$FLASUR\r\n";
echo "DATE LIEN=$DATLIE\r\n";
echo "TOP=$REPRO\r\n";
echo "LIEN COUPE=$CHOCOU\r\n";
echo "LIEN CONFIRME=$CHOLIE\r\n";
echo "PAYS=$PAYS\r\n";
echo "ZONE LIBRE=$FILL1\r\n";
echo "ZONE LIBRE=$FILL2\r\n";
echo "ZONE LIBRE=$FILL3\r\n";
echo "ZONE LIBRE=$FILL4\r\n";
echo "ZONE LIBRE=$FILL5\r\n";
echo "ZONE LIBRE=$FILL6\r\n";
echo "ZONE LIBRE=$FILL7\r\n";
echo "ZONE LIBRE=$FILL8\r\n";
echo "ZONE LIBRE=$FILL9\r\n";
echo "ZONE LIBRE=$FILL10\r\n";
echo "ZONE LIBRE=$FILL11\r\n";
echo "ZONE LIBRE=$FILL12\r\n";
echo "ZONE LIBRE=$FILL13\r\n";
echo "ZONE LIBRE=$FILL14\r\n";
echo "ZONE LIBRE=$FILL15\r\n";
echo "N° ENTREP=$E1GENT\r\n";
echo "ORIG BIL=$E1GORI\r\n";
echo "STATUT BIL=$E1GSTB\r\n";
echo "SIREN DOUTEUX=$E1GRCD\r\n";
echo "SIREN=$E1GSIR\r\n";
echo "SIRET=$E1GNIC\r\n";
echo "SIE:NIC=$E1SNIC\r\n";
echo "SIE:REGION=$E1SREG\r\n";
echo "SIE:DEPT=$E1SDEP\r\n";
echo "SIE:LOCAL=$E1SCOM\r\n";
echo "ENT:NOM RAISON SOC=$E1TNOM\r\n";
echo "ENT:SIGLE=$E1TSIG\r\n";
echo "ENT:DT CREAT AAAAMMJJ=$E1TDCR\r\n";
echo "ENT:MM IMMAT=$E1TMMI\r\n";
echo "ENT:CAT JUR=$E1TCJ\r\n";
echo "ENT:NB ETAB=$E1TNBR\r\n";
echo "ENT:TRANCHE EFF=$E1TTEF\r\n";
echo "ENT:EFFECTIF=$E1TEFF\r\n";
echo "ENT:DT MAJ EFF AAAA=$E1TDEF\r\n";
echo "ENT:APE=$E1TAPE\r\n";
echo "ENT:APE 40=$E1TA40\r\n";
echo "ENT:DT MAJ APE AAAA=$E1TDAP\r\n";
echo "ENT:TR CA=$E1TCA\r\n";
echo "ENT:TR CA EXPORT=$E1TCAX\r\n";
echo "ENT:SEXE PP=$E1TSEX\r\n";
echo "ENT:REPERT=$E1TRCM\r\n";
echo "ENT:ACT ARTIS=$E1TAPR\r\n";
echo "ENT:MONOACT=$E1TMOA\r\n";
echo "ENT:MODAL=$E1TMOD\r\n";
echo "ENT:REG PPAL=$E1TRGP\r\n";
echo "ENT:MONOREG=$E1TMNO\r\n";
echo "ENT:CODE MARCH=$E1TCMP\r\n";
echo "ENT:DOM ADM=$E1TDOM\r\n";
echo "ENT:ENR EAE AAAA=$E1TDEA\r\n";
echo "ENT:APE EAE=$E1TEAE\r\n";
echo "ENT:1R ACTIV SEC=$E1TEA1\r\n";
echo "ENT:2E ACTIV SEC=$E1TEA2\r\n";
echo "ENT:3E ACTIV SEC=$E1TEA3\r\n";
echo "ENT:4E ACTIV SEC=$E1TEA4\r\n";
echo "ETA:NOM RAISON SOC=$E1ENOM\r\n";
echo "ETA:DT CREAT AAAAMMJJ=$E1EDCR\r\n";
echo "ETA:MM IMMAT=$E1EMMI\r\n";
echo "ETA:N°RUE=$E1ENRU\r\n";
echo "ETA:BTQ=$E1EBTQ\r\n";
echo "ETA:TYPE VOIE INSEE=$E1ETVI\r\n";
echo "ETA:TYPE VOIE=$E1ETVO\r\n";
echo "ETA:RUE=$E1EVOI\r\n";
echo "ETA:COMMUNE=$E1EVIL\r\n";
echo "ETA:CODPOS INSEE=$E1ECPI\r\n";
echo "ETA:COD POST DEP=$E1ECPD\r\n";
echo "ETA:COD POST VIL=$E1ECPF\r\n";
echo "ETA:BUR DIS=$E1EBUR\r\n";
echo "ETA:COMPLT ADRESSE=$E1EPAD\r\n";
echo "ETA:DISTR SPE=$E1EDIS\r\n";
echo "ETA:ACHEM POST=$E1EACH\r\n";
echo "ETA:REG=$E1EREG\r\n";
echo "ETA:DEP=$E1EDEP\r\n";
echo "ETA:TOPO LOCAL=$E1ECOM\r\n";
echo "ETA:RIVOLI=$E1ERIV\r\n";
echo "ETA:SEGMT VOIE=$E1ESEG\r\n";
echo "ETA:ARROND=$E1EARD\r\n";
echo "ETA:DEP OUTMER ARR=$E1EARO\r\n";
echo "ETA:CANTON=$E1ECAN\r\n";
echo "ETA:DEP OUTMER CAN=$E1ECAO\r\n";
echo "ETA:DEP UNIT URB=$E1EDPU\r\n";
echo "ETA:TAILLE UNIT URB=$E1ETUR\r\n";
echo "ETA:UNIT URB=$E1EURB\r\n";
echo "ETA:ILOT=$E1EILO\r\n";
echo "ETA:TR COMMUNE=$E1ETCO\r\n";
echo "ETA:ZONE EMPLOI=$E1EEMP\r\n";
echo "ETA:TRANCHE EFF=$E1ETEF\r\n";
echo "ETA:EFFECTIF=$E1EEFF\r\n";
echo "ETA:DT MAJ EFF AAAA=$E1EDEF\r\n";
echo "ETA:APE=$E1EAPE\r\n";
echo "ETA:APE 40=$E1EA40\r\n";
echo "ETA:MAJ APE AAAA=$E1EDAP\r\n";
echo "ETA:STATUT SIE/ETA=$E1ESIE\r\n";
echo "ETA:SAISON=$E1ESAI\r\n";
echo "ETA:AUXIL=$E1EAUX\r\n";
echo "ETA:ORI CREAT=$E1EORC\r\n";
echo "ETA:NATURE=$E1ENAT\r\n";
echo "ETA:MODAL=$E1EMOD\r\n";
echo "ETA:SINGT=$E1ESIN\r\n";
echo "ETA:MARCH=$E1ECMP\r\n";
echo "ETA:ORDINARITE=$E1EORD\r\n";
echo "ETA:TEL INSEE=$E1ETEL\r\n";
echo "ETA:ENR EAE AAAA=$E1EDEA\r\n";
echo "ETA:APE EAE=$E1EEAE\r\n";
echo "ETA:1R ACTIV SEC=$E1EEA1\r\n";
echo "ETA:2E ACTIV SEC=$E1EEA2\r\n";
echo "MAJ:CODE MAJ MENSUEL=$E1MMMJ\r\n";
echo "MAJ:VM1=$E1MVM1\r\n";
echo "MAJ:VM2=$E1MVM2\r\n";
echo "MAJ:VM3=$E1MVM3\r\n";
echo "MAJ:CODE MAJ HEBDO=$E1MHMJ\r\n";
echo "MAJ:MARQUE FIN=$E1MMRQ\r\n";
echo "MAJ:RESERVE=$E1M299\r\n";
echo "MAJ:EVT=$E1MEVT\r\n";
echo "MAJ:DT EVT AAAAMMJJ=$E1MDEV\r\n";
echo "MAJ:SITU TRANSF=$E1MSTR\r\n";
echo "MAJ:NIC LIE TRANSF=$E1MNIL\r\n";
echo "MAJ:CAUSE CESS JUR=$E1MCES\r\n";
echo "MAJ:TRANSF SIE=$E1MTRS\r\n";
echo "MAJ:ORI/DESTIN=$E1MORE\r\n";
echo "MAJ:SIRET PREC=$E1MSIP\r\n";
echo "MAJ:DESC MOD SIREN=$E1MMJS\r\n";
echo "MAJ:DESC MOD NIC=$E1MMJT\r\n";
echo "MAJ:DT INSEE AAAAMMJJ=$E1MIDD\r\n";
echo "MAJ:SEQ INSEE PUR=$E1MIDN\r\n";
echo "COM:TOP RJ=$E1CTRJ\r\n";
echo "COM:ANN RJ=$E1CARJ\r\n";
echo "COM:DT AN RJ AAAAMMJJ=$E1CDRJ\r\n";
echo "COM:EVT RJ=$E1CERJ\r\n";
echo "COM:ROL RJ=$E1CRRJ\r\n";
echo "COM:DER CLOT BILAN=$E1CDBI\r\n";
echo "COM:TOP BILAN=$E1CTBI\r\n";
echo "COM:TOP SIEGE ACTIF=$E1CTSI\r\n";
echo "COM:TOP EXIST RNCS=$E1CRNC\r\n";
echo "COM:DT RADIA AAAAMMJJ=$E1CDRA\r\n";
echo "COM:DT MAJ I AAAAMMJJ=$E1CDIN\r\n";
echo "COM:DT DER B AAAAMMJJ=$E1CDMB\r\n";
echo "COM:TOP TEL=$E1CTEL\r\n";
echo "COM:TOP FAX=$E1CFAX\r\n";
echo "COM:TOP WEB=$E1CWEB\r\n";
echo "TOP5=$E1RTO5\r\n";
echo "TOP6=$E1RTO6\r\n";
echo "TOP7=$E1RTO7\r\n";
echo "TOP8=$E1RTO8\r\n";
echo "TOP9=$E1RTO9\r\n";
echo "FILLER UN PACKE 9=$E1RF1P\r\n";
echo "FILLER DEUX PACKE 9=$E1RF2P\r\n";
echo "FILLER TROIS ALPHA 60=$E1RF3A\r\n";
*/
if ($ANBASE*1<>0) {
//$txt=trim(addslashes($HATEXT_pre));
$sql ="INSERT INTO entrep VALUES (";
$sql.="$ANBASE,'$fichier',$NOSAI,$ORDRE,$NOBOD,'$LTBOD','$CODTRI',$JAL,$DATE,$NOPAGE,$CODEVE,$SSCODE,'$DEPT',$NOANN,'$ROLE',$SIREN,";
$sql.="'$CODLIC','$SIGNAT','$NOMTER',$DATSAI,'$TOPRAP',$CHOETA,$CHOPDS,'$CHOCHO','$FLASUR',$DATLIE,'$REPRO','$CHOCOU','$CHOLIE','$PAYS','$FILL1',";
$sql.="'$FILL2','$FILL3','$FILL4','$FILL5','$FILL6','$FILL7','$FILL8','$FILL9','$FILL10','$FILL11','$FILL12','$FILL13','$FILL14','$FILL15',$E1GENT,";
$sql.="'$E1GORI','$E1GSTB','$E1GRCD',$E1GSIR,$E1GNIC,$E1SNIC,'$E1SREG','$E1SDEP','$E1SCOM','$E1TNOM','$E1TSIG',$E1TDCR,'$E1TMMI','$E1TCJ',$E1TNBR,";
$sql.="'$E1TTEF',$E1TEFF,'$E1TDEF','$E1TAPE','$E1TA40','$E1TDAP','$E1TCA','$E1TCAX','$E1TSEX','$E1TRCM','$E1TAPR','$E1TMOA','$E1TMOD','$E1TRGP','$E1TMNO',";
$sql.="'$E1TCMP','$E1TDOM','$E1TDEA','$E1TEAE','$E1TEA1','$E1TEA2','$E1TEA3','$E1TEA4','$E1ENOM',$E1EDCR,'$E1EMMI',$E1ENRU,'$E1EBTQ','$E1ETVI','$E1ETVO',";
$sql.="'$E1EVOI','$E1EVIL',$E1ECPI,'$E1ECPD','$E1ECPF','$E1EBUR','$E1EPAD','$E1EDIS','$E1EACH','$E1EREG','$E1EDEP','$E1ECOM','$E1ERIV','$E1ESEG','$E1EARD',";
$sql.="'$E1EARO','$E1ECAN','$E1ECAO','$E1EDPU','$E1ETUR','$E1EURB','$E1EILO','$E1ETCO','$E1EEMP','$E1ETEF',$E1EEFF,'$E1EDEF','$E1EAPE','$E1EA40','$E1EDAP',";
$sql.="'$E1ESIE','$E1ESAI','$E1EAUX','$E1EORC','$E1ENAT','$E1EMOD','$E1ESIN','$E1ECMP','$E1EORD','$E1ETEL','$E1EDEA','$E1EEAE','$E1EEA1','$E1EEA2','$E1MMMJ',";
$sql.="'$E1MVM1','$E1MVM2','$E1MVM3','$E1MHMJ','$E1MMRQ','$E1M299','$E1MEVT',$E1MDEV,'$E1MSTR',$E1MNIL,'$E1MCES','$E1MTRS','$E1MORE',$E1MSIP,$E1MMJS,";
$sql.="$E1MMJT,$E1MIDD,$E1MIDN,'$E1CTRJ',$E1CARJ,$E1CDRJ,$E1CERJ,'$E1CRRJ',$E1CDBI,'$E1CTBI','$E1CTSI','$E1CRNC',$E1CDRA,$E1CDIN,$E1CDMB,";
$sql.="'$E1CTEL','$E1CFAX','$E1CWEB','$E1RTO5','$E1RTO6','$E1RTO7','$E1RTO8','$E1RTO9',$E1RF1P,$E1RF2P,'$E1RF3A');";
$nbEntrep++;
if (!mysql_query($sql)) {
echo "Erreur mysql ". mysql_errno() .' - '. mysql_error(). " - $sql\r\n";
}
if ($nbLignes%100000==0) { echo date('Y/m/d - H:i:s'). " - Fichier $fichier : $nbLignes lignes, $nbEntrep entrep...\r\n";flush();}
}
}
}
fclose($fp);
echo date('Y/m/d - H:i:s'). " - Fichier $fichier : $nbLignes lignes, $nbEntrep entrep chargés.\r\n";
flush();
}
?>