| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394 |
- def var iKnr as int no-undo.
- def var aKnr as int init -1 no-undo.
- def var dDatum as date no-undo.
- def var iFaknr as int no-undo.
- def temp-table tExcel
- field Feld as char extent 10.
- def temp-table tOP
- field Knr as int
- field faknr as int
- field Datum as date
- field fakbetr as dec
- field Saldo as dec
- field gfakbetr as dec
- field gSaldo as dec
- field Gemis as log init false
- field Sage as log init false
- field io as log init false
- index top-k1 is primary
- knr
- faknr.
-
- INPUT FROM 'C:\Temp\Huber_OPListe.csv' NO-MAP NO-CONVERT.
- repeat transaction on stop undo, leave:
- create tExcel.
- import delimiter ';' tExcel.
- end.
- input close.
- for each tExcel:
- IF Feld[01] = '' then do:
- delete tExcel.
- next.
- end.
- iKnr = integer(feld[01]) no-error.
- if not error-status:error then do:
- aknr = iKnr.
- next.
- end.
- /*
- FIND FIRST Debst NO-LOCK
- WHERE Debst.Firma = '1000'
- AND Debst.Knr = iKnr NO-ERROR.
- */
- ddatum = date(feld[01]) no-error.
- if error-status:error then next.
- iFaknr = integer(Feld[02]) no-error.
- if error-status:error then next.
-
- create tOP.
- assign tOP.Knr = iKnr
- tOP.Faknr = iFaknr
- tOP.Datum = dDatum
- tOP.Fakbetr = decimal(Feld[06])
- tOP.Saldo = decimal(Feld[07])
- tOp.Sage = true no-error.
- end.
- for each tOP:
- FIND Debop no-lock
- where debop.firma = '1000'
- and debop.knr = top.knr
- and debop.faknr = top.faknr no-error.
- if not available debop then next.
- assign top.gemis = true
- top.gfakbetr = debop.fakbetr
- top.gsaldo = debop.saldo.
- if top.saldo = debop.saldo then top.io = true.
- end.
- for each debop no-lock where debop.firma = '1000':
- find first top
- where top.knr = debop.knr
- and top.faknr = debop.faknr no-error.
- if available top then next.
- create tOP.
- assign tOP.Knr = debop.Knr
- tOP.Faknr = debop.Faknr
- tOP.Datum = debop.fakDat
- tOP.gFakbetr = debop.fakbetr
- tOP.gSaldo = debop.saldo
- top.gemis = true
- top.sage = false.
- end.
-
- Output to 'SAGEOP.csv' no-map no-convert.
- put control 'Knr;Faknr;Datum;S-Fakbetr;S-Saldo;G-Fakbetr;G-Saldo;Gemis;Sage;io' chr(10).
- for each tOP:
- export delimiter ';' tOP.
- end.
- output close.
|