Import til Kassekladde i C5 Igen Igen Igen
Jeg har brug for hjælp til import af en kommafil til finanskassekladde.Det der driller mig er at den nogen gange skal splite en linje i kommafilen i 3 linjer i finanskassekladden.
Jeg har lavet det sådanne indtil videre.
STR 255 &slet34
STR 255 &slet35
STR 255 &slet36
STR 255 &slet37
STR 255 &slet38
STR 255 &slet39
STR 255 &slet40
STR 255 &slet41
STR 255 &slet42
STR 255 &slet43
STR 255 &slet44
STR 255 &slet45
STR 255 &slet46
STR 255 &slet47
STR 255 &slet48
STR 255 &slet49
STR 255 &slet50
STR 255 &slet51
STR 255 &slet52
STR 255 &slet53
STR 255 &slet54
STR 255 &slet55
STR 255 &slet56
STR 255 &slet57
STR 255 &slet58
STR 255 &slet59
STR 255 &slet60
STR 255 &slet61
STR 255 &fragt
STR 255 &fragt2
STR 255 &Total
STR 255 &total2
SET &Filnavn = #GetFile( "Import til "+FilePName(FinKladde)+":","Order.CSV")
IF NOT &FilNavn OR NOT #FileExists(&FilNavn) THEN
RETURN 0
ENDIF
WINDOW 40,5 AT 20,5
PRINT "Skriver...........: FinKladde" AT 1,1
PRINT "Fra...............: "+&FilNavn AT 1,2
TTSBEGIN FinKladde
INTRODUCE FinKladde
READ &FilNavn AS Comma INTO (
&Order_id,
Tekst,
&slet3,
&slet4,
&slet5,
&slet6,
&slet7,
&slet8,
&slet9,
&slet10,
&slet11,
&slet12,
&slet13,
&slet14,
&slet15,
&Dato,
&slet17,
&slet18,
&slet19,
&slet20,
&slet21,
&slet22,
&slet23,
&slet24,
&slet25,
&slet26,
&slet27,
&slet28,
&slet29,
&slet30,
&slet31,
&slet32,
&slet33,
&slet34,
&slet35,
&slet36,
&slet37,
&slet38,
&slet39,
&slet40,
&slet41,
&slet42,
&slet43,
&slet44,
&slet45,
&slet46,
&slet47,
&slet48,
&slet49,
&slet50,
&slet51,
&slet52,
&slet53,
&slet54,
&slet55,
&slet56,
&slet57,
&slet58,
&slet59,
&slet60,
&slet61,
&fragt,
&Total,
)
SET &Order_id = SysInfo(5031,&Order_id)
SET Tekst = SysInfo(5031,Tekst)
SET &slet3 = SysInfo(5031,&slet3)
SET &slet4 = SysInfo(5031,&slet4)
SET &slet5 = SysInfo(5031,&slet5)
SET &slet6 = SysInfo(5031,&slet6)
SET &slet7 = SysInfo(5031,&slet7)
SET &slet8 = SysInfo(5031,&slet8)
SET &slet9 = SysInfo(5031,&slet9)
SET &slet10 = SysInfo(5031,&slet10)
SET &slet11 = SysInfo(5031,&slet11)
SET &slet12 = SysInfo(5031,&slet12)
SET &slet13 = SysInfo(5031,&slet13)
SET &slet14 = SysInfo(5031,&slet14)
SET &slet15 = SysInfo(5031,&slet15)
SET &Dato = SysInfo(5031,&Dato)
SET &slet17 = SysInfo(5031,&slet17)
SET &slet18 = SysInfo(5031,&slet18)
SET &slet19 = SysInfo(5031,&slet19)
SET &slet20 = SysInfo(5031,&slet20)
SET &slet21 = SysInfo(5031,&slet21)
SET &slet22 = SysInfo(5031,&slet22)
SET &slet23 = SysInfo(5031,&slet23)
SET &slet24 = SysInfo(5031,&slet24)
SET &slet25 = SysInfo(5031,&slet25)
SET &slet26 = SysInfo(5031,&slet26)
SET &slet27 = SysInfo(5031,&slet27)
SET &slet28 = SysInfo(5031,&slet28)
SET &slet29 = SysInfo(5031,&slet29)
SET &slet30 = SysInfo(5031,&slet30)
SET &slet31 = SysInfo(5031,&slet31)
SET &slet32 = SysInfo(5031,&slet32)
SET &slet33 = SysInfo(5031,&slet33)
SET &slet34 = SysInfo(5031,&slet34)
SET &slet35 = SysInfo(5031,&slet35)
SET &slet36 = SysInfo(5031,&slet36)
SET &slet37 = SysInfo(5031,&slet37)
SET &slet38 = SysInfo(5031,&slet38)
SET &slet39 = SysInfo(5031,&slet39)
SET &slet40 = SysInfo(5031,&slet40)
SET &slet41 = SysInfo(5031,&slet41)
SET &slet42 = SysInfo(5031,&slet42)
SET &slet43 = SysInfo(5031,&slet43)
SET &slet44 = SysInfo(5031,&slet44)
SET &slet45 = SysInfo(5031,&slet45)
SET &slet46 = SysInfo(5031,&slet46)
SET &slet47 = SysInfo(5031,&slet47)
SET &slet48 = SysInfo(5031,&slet48)
SET &slet49 = SysInfo(5031,&slet49)
SET &slet50 = SysInfo(5031,&slet50)
SET &slet51 = SysInfo(5031,&slet51)
SET &slet52 = SysInfo(5031,&slet52)
SET &slet53 = SysInfo(5031,&slet53)
SET &slet54 = SysInfo(5031,&slet54)
SET &slet55 = SysInfo(5031,&slet55)
SET &slet56 = SysInfo(5031,&slet56)
SET &slet57 = SysInfo(5031,&slet57)
SET &slet58 = SysInfo(5031,&slet58)
SET &slet59 = SysInfo(5031,&slet59)
SET &slet60 = SysInfo(5031,&slet60)
SET &slet61 = SysInfo(5031,&slet61)
SET &fragt = SysInfo(5031,&fragt)
SET &Total = SysInfo(5031,&Total)
SET &Counter = &Counter + 1
SET &nr = &nr + 1
{Hvis der er fragt på linjen skal den lave 3 linjer i kassekladden}
{1. linje med omsætning konto 1010}
{2. Linje med fragt konto 1070}
{3. Linje total i debet på konto 15300}
{Hvis der ikke er fragt skal den lave en linje med 15300 som modkonto}
If (Str2num(strrem(strdel(&fragt,1,4),"."))/100) > 0 then
{Kt. 1010 Start}
SET Navn = "faktura"
SET Linienr = &nr+1
SET Bilag = str2num(&Order_id)
SET Dato = str2date(&dato,123)
SET &fragt2 = strdel(&fragt,1,4)
SET &total2 = strdel(&total,1,4)
SET BeløbVAL = (Str2num(strrem(&total2,"."))/-100)-(Str2num(strrem(&fragt2,"."))/-100)
SET Kontotype = 0
SET Konto = "1010"
SET Modkonto = ""
SET Posttype = 0
SET Moms = "salg"
SET Valuta = "DKK"
SET Valutakurs = 100
SET LøbeNummer = 0
INSERT FinKladde
SET &Counter = &Counter + 1
{Kt. 1070 Start}
SET Navn = "faktura"
SET Linienr = &nr+1
SET Bilag = str2num(&Order_id)
SET Dato = str2date(&dato,123)
SET &fragt2 = strdel(&fragt,1,4)
SET &total2 = strdel(&total,1,4)
SET BeløbVAL = Str2num(strrem(&fragt2,"."))/-100
SET Kontotype = 0
SET Konto = "1070"
SET Modkonto = ""
SET Posttype = 0
SET Moms = ""
SET Valuta = "DKK"
SET Valutakurs = 100
SET LøbeNummer = 0
INSERT FinKladde
SET &Counter = &Counter + 1
SET Navn = "faktura"
SET Linienr = &nr+1
SET Bilag = str2num(&Order_id)
SET Dato = str2date(&dato,123)
SET &fragt2 = strdel(&fragt,1,4)
SET &total2 = strdel(&total,1,4)
SET BeløbVAL = Str2num(strrem(&total2,"."))/100
SET Kontotype = 0
SET Konto = "15300"
SET Modkonto = ""
SET Posttype = 0
SET Moms = ""
SET Valuta = "DKK"
SET Valutakurs = 100
SET LøbeNummer = 0
INSERT FinKladde
SET &Counter = &Counter + 1
Else
{Kt. 1010 Start}
SET Navn = "faktura"
SET Linienr = &nr+1
SET Bilag = str2num(&Order_id)
SET Dato = str2date(&dato,123)
SET &fragt2 = strdel(&fragt,1,4)
SET &total2 = strdel(&total,1,4)
SET BeløbVAL = (Str2num(strrem(&total2,"."))/-100)-(Str2num(strrem(&fragt2,"."))/-100)
SET Kontotype = 0
SET Konto = "1010"
SET Modkonto = "15300"
SET Posttype = 0
SET Moms = "salg"
SET Valuta = "DKK"
SET Valutakurs = 100
SET LøbeNummer = 0
INSERT FinKladde
ENDIF
#ADD(&InsErr,(LøbeNummer == 0))
END
TTSCOMMIT FinKladde
IF &InsErr THEN
SET Box(2,StrFmt("@SYS64094",Int2Str(&InsErr)),0)
ENDIF
PAUSE