Page 1 of 4

DOS accounting system to TWeb

Posted: Fri Apr 05, 2019 6:21 pm
by Otto
Hello,
today I started converting my DOS accounting system to TWeb.
I also had a WINDOWS accounting but this was not accepted by the power users.
Therefore I try to copy the screens from the DOS program.
From time to time I will post here about the progress.

Best regards and a nice weekend to all
Otto
Image

Re: DOS accounting system to TWeb

Posted: Sat Apr 06, 2019 6:34 am
by Otto
Hello,
I changed the start menu and canceled description. For expert mode - and accounting is done by experts - this is not necessary.
Regards
Otto

Image

Re: DOS accounting system to TWeb

Posted: Sat Apr 06, 2019 6:38 am
by Silvio.Falconi
do you're using DBF ?

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 7:57 am
by Otto
Hello,
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.

Best regards
Otto

Image

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
//-----------------------------------
 

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 8:32 am
by Jack
Hi Otto,
Great job .
1) Is it possible to use TWEB with MS SQL database ?
2) Could we say that TWEB is a php code generator ?

Thanks ,

Philippe

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 9:33 am
by Marc Venken
Otto wrote:Hello,
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.

Best regards
Otto

Image

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
//-----------------------------------
 
There are functions to convert dbf to sql ? Is it not easier to use ?

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 12:40 pm
by Silvio.Falconi
I not remember good now But I founded the possibility to use also dbf with a Web System not was tweb

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 3:01 pm
by Otto
Hello Philippe,

I do not know if it is working with MS SQL. But I think as an advice if you work with FIVEWIN MySQL - as nearly all of us are using it - is the best option if you need community help too.
TWeb is php code a framework.

The creator of TWeb Carles says:
“I am a son of Harbor and FWH. Tweb was born with the same philosophy of work.
Obviously Windows will exist many years. Obviously Internet is here and we have to take advantage of it.”


Best regards
Otto

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 3:02 pm
by Otto
Silvio,
for me SQL is perfect.
Best regards
Otto

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 3:04 pm
by Otto
Hello Marc,
The code I posted converts dbf file to SQL and creates SQL tables and uploads the data to the server.
I think this can’t be easier.
Best regards
Otto

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 3:44 pm
by Otto
Hello,
we will start the reprogramming of our accounting software with the reporting part.
We are currently reaching certain limits with the DOS software in the DOSBOX printing the reports.
-------------------------------------------------------------------------------------------------------------------
Therefore we upload a current data status with the posted source code before we execute report queries to the sever.

We did some tests.
The upload for a small company with the data of one year takes about 10 - 12 sec.

Kind regards
Otto

Image

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 4:23 pm
by Otto
Hello,

now the first basic grid from TWeb.
Image

Best regards
Otto

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 7:17 pm
by Massimo Linossi
Hi Otto.
Can we see a little piece of code for making the grid above ?
Thanks a lot
Massimo

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 8:51 pm
by Marc Venken
Otto wrote:Hello Marc,
The code I posted converts dbf file to SQL and creates SQL tables and uploads the data to the server.
I think this can’t be easier.
Best regards
Otto
From post of Mr. Rao

This opens the dbf file, creates a table with the same structure and copies the data. By default, it creates the table with the same name as the dbf. If we want a different table name, we can give that as the second paramter.

Example:

Code: Select all

oCn:ImportFromDBF( "c:\fwh\samples\customer.dbf" )
 
http://forums.fivetechsupport.com/viewt ... 8&start=15

Re: DOS accounting system to TWeb

Posted: Sun Apr 07, 2019 9:42 pm
by Otto
Hello Massimo,

Please read this post:

http://forums.fivetechsupport.com/viewt ... =6&t=35444

I took test_grid_update.php from the Tweb.examples.

\tweb.examples\test_grid_update.php

The only thing I did was to change the SERVERNAME and ceredentials and the table.
Then I changed inside the code the fieldnames to my names.

@Mark, thank you for the info. I will try the function tomorrow.

Best regards
Otto

Code: Select all


<?php 
include ( 'config.php' );
include( TWEB_PATH . "core.php" );
include( TWEB_PATH . "core.grid.php" );

$oWeb = new TWeb( 'Test TGrid - Updated' );
    
$oWeb->Activate();

    $oWnd = new TWindow();
    
        $o = new TBar( $oWnd, 'mybtnbar' );
            $o->AddButton( null, 'Load' , 'TGrid_Load()'    , 'images/db.png' );
            $o->AddButton( null, 'Save' , 'TGrid_Save()'    , 'images/save.png' );
            
        $o = new TGrid( $oWnd, 'mygrid', 60, 10 );
            $o->lSingle = false;
            $o->cTitle  = 'Customer';
            $o->SetRight( 10 );
            $o->SetBottom( 40 );            
            $o->lForceFitColumns = true;            
        
            //$oCol = $o->AddCol( 'id'     , 'Id'        , 100 );        
            $oCol = $o->AddCol( 'KTONR'  , 'KTONR'     , 100, 'C' );        
            $oCol = $o->AddCol( 'NAME'   , 'Name'      , 100, 'C');        
            $oCol = $o->AddCol( 'SALDO'  , 'Saldo'     , 100, 'C');                                         
        
    $oWnd->Activate();
    
$oWeb->End()    
?>