cTI0 ;INGAVE INTRA-STAT ;%TI0; [ 04/12/09 15:13:35 ] G 1 ; ; Input van de applicatie : ; R = ^cTI0 (menu);BP;FNR;FNR lev.(19) of US-waarde factuur (29);UMD;UD (applicatie) ; ; Output naar %TI1 : ; R = UKC(maand uit VE of AA);US;UKIL;UGL;UMD;UMDI;UFNR;UFNL;UD ; UDB = node VE of AA ; UQA = aantal decimalen intra-stat ; T0 ;Registratie Intrastat ; T1 ;Nummer document\"xxxxxx[] = nummer verkoopdocument -[] = einde"; T2 ;Documentnummer ; bestaat niet; T3 ;Klant;Leverancier; T4 ;Nr. document; T5 ;Totaal bedrag; T6 ;Nummer document\"xxxxxx[] = nummer aankoopdocument -[] = einde"; T11 ;Registratie aankoop ; T12 ;Registratie aankoop ; T21 ;Registratie verkoop ; T22 ;Registratie verkoop ; T23 ;Registratie verkoop ; ; T0F ;Enregistrement Intrastat ; T1F ;N° du document\"xxxxxx[] = n° du document de vente -[] = fin"; T2F ;N° de document ; n'existe pas; T3F ;Client;Fournisseur; T4F ;N° du document; T5F ;Montant total; T6F ;N° du document\"xxxxxx[] = n° du document d'achat -[] = fin"; T11F ;Enregistrement achats ; T12F ;Enregistrement achats ; T21F ;Enregistrement ventes ; T22F ;Enregistrement ventes ; T23F ;Enregistrement ventes ; ; T0E ;Registratie Intrastat ; T1E ;Nummer document\"xxxxxx[] = nummer verkoopdocument -[] = einde"; T2E ;Documentnummer ; bestaat niet; T3E ;Klant;Leverancier; T4E ;Nr. document; T5E ;Totaal bedrag; T6E ;Nummer document\"xxxxxx[] = nummer aankoopdocument -[] = einde"; T11E ;Registratie aankoop ; T12E ;Registratie aankoop ; T21E ;Registratie verkoop ; T22E ;Registratie verkoop ; T23E ;Registratie verkoop ; ; IC(BTW,DATUM,SWA,LAND) ; Contole of het om een IC-land gaat ; BTW = BTW-nr ; DATUM : dd.mm.jj ; SWA = 1 : vanuit inschrijven inkomende document : test voor IC BTW of niet N R,R1,R2,ISO,CODEL,UI1L,DATIN,DATUIT,K S $ZT="TRAP^cAN000" S R=0 S K=BTW I $L($G(LAND)) S R1=LAND S R=1 G ICA ; Controle via ^BA(5 of het om een geldig BTW-nr gaat I '$L(BTW) G ICZ S R1=$E(BTW,1,2),R2=$$BA39^cAFA10(Q,214) I R2'?2U S R2="BE" I R1'?2U S R1=R2 ; R=3 : BTW-code is ingevuld, maar komt niet voor in BA(5 I $G(SWA) S R=3 ; R=1 land uit de BTW-code = land uit ^_Q_BA(39 ; R=2 land uit de BTW-code'= land uit ^_Q_BA(39 (het gaat dus om een IC-land) I R1?2U,$D(^BA(5,R1,2)) X "S U3="_^(2) S R=R1'=R2+$G(SWA) ; Geen verdere testen wanneer wanneer het BTW-nummer niet ; voorkomt in ^BA(5 of wanneer het land uit de BTW-code = land uit ^_Q_BA(39 I R=(0+$G(SWA))!(R=3) G ICZ ; Controle via ^ISO(0,"ISO.LAND" of het om een EG-lidstaat gaat ; Ophalen UI1 ISO.LAND ICA I R1?1.N S UI1L=R1 G ICA1 S UI1L=$P($G(^BA(5,R1,0)),D,3) ICA1 I '$L(UI1L) S R=0 G ICZ ; Controle of veld EG-lidstaat op ja staat I '$$SIG^cAFA1("ISO.LAND",UI1L,105) S R=0 G ICZ I '$L(DATUM) G ICZ I DATUM?4N.1"."2N S DATUM=$TR(DATUM,".")_"01",DATUM=$$DCO^cAFD1(DATUM) ; Controleren Datum toetreding en uittreding S DATIN=$P(^(0),D,6),DATUIT=$P(^(0),D,7) I '$L(DATIN)&'$L(DATUIT) G ICZ S:$L(DATIN) DATIN=$$DC^cAFD1(DATIN) S:$L(DATUIT) DATUIT=$$DC^cAFD1(DATUIT) S DATUM=$$DC^cAFD1(DATUM) I $L(DATIN),DATIN>DATUM S R=0 G ICZ I $L(DATUIT),DATUM'