the new web APP is SQL.
The old desktop DOS accounting had DBF support only.
As a first step to convert my DOS program to a web program I wrote an upload program which exports the dbf files to SQL. Uploading and creating the new tables is handled from Fivewin.
Code: Select all
function f_konto()
local aFibu := {}
local cTable := "konto"
local oRs
local aCols := { { "KTONR", "C", 9, 0 },;
{ "KURZ", "C", 7, 0 },;
{ "NAME", "C", 25, 0 },;
{ "BRANCH", "C", 20, 0 },;
{ "STRA", "C", 25, 0 },;
{ "PLZ", "C", 9, 0 },;
{ "ORT", "C", 9, 0 },;
{ "SAMMEL", "C", 2, 0 },;
{ "MWSTSATZ", "N", 2, 0 },;
{ "STEUER", "C", 1, 0 },;
{ "FW_CODE", "C", 2, 0 },;
{ "KASSA", "C", 3, 0 },;
{ "SKONTO", "C", 4, 0 },;
{ "ZIEL", "C", 3, 0 },;
{ "BA_BLZ", "C", 5, 0 },;
{ "BA_KTO", "C", 13, 0 },;
{ "BA_BEZ", "C", 15, 0 },;
{ "MKZ", "C", 1, 0 },;
{ "VZ", "C", 1, 0 },;
{ "KONTOART", "C", 1, 0 },;
{ "SAMMELZEIC", "N", 1, 0 },;
{ "FIL", "C", 1, 0 },;
{ "SALDO", "N", 14, 2 },;
{ "BUDGET", "N", 14, 2 },;
{ "VERGLEICH", "N", 14, 2 },;
{ "GL1", "C", 10, 0 },;
{ "GL2", "C", 10, 0 },;
{ "GL3", "C", 10, 0 },;
{ "GL4", "C", 10, 0 } }
LOCAL cDBF := "c:\TWeb\fibu dbf files\konto.DBF"
*----------------------------------------------------------
use( cDBF ) new ALIAS TMPDBF
oCn := maria_Connect( "???.???.???.???", "fibu", "root", "password" )
IF oCn == nil
? "Connect fail"
RETURN NIL
ENDIF
IF oCn:TableExists( cTable )
oCn:DropTable( cTable )
ENDIF
IF oCn:CreateTable( cTable, aCols, .T., "utf8" )
? cTable + " Created"
do while .not. eof()
AADD(aFibu, { field->KTONR,field->KURZ,field->NAME,field->BRANCH,field->STRA,field->PLZ,field->ORT,field->SAMMEL,field->MWSTSATZ,field->STEUER,field->FW_CODE,field->KASSA,field->SKONTO,field->ZIEL,field->BA_BLZ,field->BA_KTO,field->BA_BEZ,field->MKZ,field->VZ,field->KONTOART,field->SAMMELZEIC,field->FIL,field->SALDO,field->BUDGET,field->VERGLEICH,field->GL1,field->GL2,field->GL3,field->GL4 } )
SKIP
enddo
oCn:Insert( cTable, ;
"KTONR,KURZ,NAME,BRANCH,STRA,PLZ,ORT,SAMMEL,MWSTSATZ,STEUER,FW_CODE,KASSA,SKONTO,ZIEL,BA_BLZ,BA_KTO,BA_BEZ,MKZ,VZ,KONTOART,SAMMELZEIC,FIL,SALDO,BUDGET,VERGLEICH,GL1,GL2,GL3,GL4", aFibu )
oRs := oCn:RowSet( cTable )
XBROWSER oRs SETUP oBrw:nRowHeight := 30
oRs:Close()
ELSE
? "Failed to create " + cTable
ENDIF
oCn:Close()
select TMPDBF
close
return nil
//-----------------------------------