#include "fivewin.ch"
FUNCTION Main()
LOCAL dFechope:= CTOD(""),dFechprese:=CTOD(""),dFechpago:=CTOD(""),cNumcup:= Space(2),cNumcomer:=Space(8), ;
cNumtarj:= Space(4),cMoneda:=Space(3),nTotalbrut:=0,nTotaldesc:=0,nTotalnet:=0,cEntpag:=Space(25), ;
cCtabanc:=Space(7),cNumliq:=Space(6),cTipoLiq:=Space(15),cEstcuotas:=Space(1),cNumaut:=Space(6),cTarjeta:=Space(15)
SET DATE TO FRENCH
SET DECIMALS TO 2
SET FIXED ON
IF !file("Operacio.dbf" )
dbCreate( "Operacio.dbf", { { "fechope","C", 8, 0 }, ;
{ "fechprese","C", 8, 0 }, ;
{ "fechpago","C", 8, 0 }, ;
{ "numcup", "C", 2, 0 }, ;
{ "numcomer","C", 8, 0 }, ;
{ "numtarj","C", 4, 0 }, ;
{ "moneda","C", 3, 0 }, ;
{ "totalbrut","C", 12, 0 }, ;
{ "totaldesc","C", 12, 0 }, ;
{ "totalnet","C", 12, 0 }, ;
{ "entpag","C", 25, 0 }, ;
{ "ctabanc","C", 7, 0 }, ;
{ "numliq","C", 6, 0 }, ;
{ "tipoliq","C", 15, 0 }, ;
{ "estcuotas","C", 1, 0 }, ;
{ "numaut","C", 6, 0 }, ;
{ "tarjeta","C", 15, 0 } } )
ENDIF
IF !file("Operacio2.dbf" )
dbCreate( "Operacio2.dbf", { { "fechope","D", 8, 0 }, ;
{ "fechprese","D", 8, 0 }, ;
{ "fechpago","D", 8, 0 }, ;
{ "numcup", "C", 2, 0 }, ;
{ "numcomer","C", 8, 0 }, ;
{ "numtarj","C", 4, 0 }, ;
{ "moneda","C", 3, 0 }, ;
{ "totalbrut","N", 12, 2 }, ;
{ "totaldesc","N", 12, 2 }, ;
{ "totalnet","N", 12, 2 }, ;
{ "entpag","C", 25, 0 }, ;
{ "ctabanc","C", 7, 0 }, ;
{ "numliq","C", 6, 0 }, ;
{ "tipoliq","C", 15, 0 }, ;
{ "estcuotas","C", 1, 0 }, ;
{ "numaut","C", 6, 0 }, ;
{ "tarjeta","C", 15, 0 } } )
ENDIF
USE Operacio ALIAS "Ope" NEW
APPEND FROM operacio.csv DELIMITED WITH BLANK
USE Operacio2 ALIAS "Ope2" NEW
Ope->(DbGotop())
WHILE !Ope->(EOF())
Ope2->(DBAppend())
dFechope := CTOD(Ope->fechope)
Ope2->fechope := dFechope
dFechprese := CTOD(Ope->fechprese)
Ope2->fechprese := dFechprese
dFechpago := CTOD(Ope->fechpago)
Ope2->fechpago := dFechpago
cNumcup := Ope->numcup
Ope2->numcup := cNumcup
cNumcomer := Ope->numcomer
Ope2->numcomer := cNumcomer
cNumtarj := Ope->numtarj
Ope2->numtarj := cNumtarj
cMoneda := Ope->moneda
Ope2->moneda := cMoneda
nTotalbrut := Val(Ope->totalbrut)
Ope2->totalbrut := nTotalBrut
nTotaldesc := Val(Ope->totaldesc)
Ope2->totaldesc := nTotaldesc
nTotalnet := Val(Ope->totalnet)
Ope2->totalnet := nTotalnet
cEntpag := SubStr(Ope->Entpag,1,5) + " " + SubStr(Ope->entpag,6)
Ope2->entpag := cEntpag
cCtabanc := Ope->ctabanc
Ope2->ctabanc := cCtabanc
cNumliq := Ope->numliq
Ope2->numliq := cNumliq
cTipoliq := Ope->tipoliq
Ope2->tipoliq := cTipoliq
cEstcuotas := Ope->estcuotas
Ope2->estcuotas := cEstCuotas
cNumaut := Ope->numaut
Ope2->numaut := cNumaut
cTarjeta := SubStr(Ope->tarjeta,1,4) + " " + SubStr(Ope->tarjeta,5)
Ope2->tarjeta := cTarjeta
Ope->( dbskip() )
END
DbCloseAll()
FERASE("Operacio.dbf")
FRENAME("operacio2.dbf","operacio.dbf")
USE Operacio ALIAS "Ope" NEW
XBROWSER "Ope" TITLE "Listado operaciones con tarjeta" COLUMNS "fechope" ,"Numcup", "totalbrut", "totalnet","tarjeta", "estcuotas"
Return Nil