FiveTech Support Forums

FiveWin / Harbour / xBase community
Board index FiveWin for Harbour/xHarbour DOS accounting system to TWeb
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
DOS accounting system to TWeb
Posted: Fri Apr 05, 2019 06:21 PM
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
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: DOS accounting system to TWeb
Posted: Sat Apr 06, 2019 06:34 AM
Hello,
I changed the start menu and canceled description. For expert mode - and accounting is done by experts - this is not necessary.
Regards
Otto

Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: DOS accounting system to TWeb
Posted: Sat Apr 06, 2019 06:38 AM

do you're using DBF ?

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 07:57 AM
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




Code (fw): Select all Collapse
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
//-----------------------------------
Posts: 300
Joined: Wed Jul 11, 2007 11:06 AM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 08:32 AM

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

Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 09:33 AM
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




Code (fw): Select all Collapse
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 ?
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 7317
Joined: Thu Oct 18, 2012 07:17 PM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 12:40 PM

I not remember good now But I founded the possibility to use also dbf with a Web System not was tweb

Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)

I use : FiveWin for Harbour March-April 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 03:01 PM

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

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 03:02 PM

Silvio,
for me SQL is perfect.
Best regards
Otto

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 03:04 PM

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

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 03:44 PM
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

Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 04:23 PM
Hello,

now the first basic grid from TWeb.


Best regards
Otto
Posts: 512
Joined: Mon Oct 17, 2005 10:38 AM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 07:17 PM

Hi Otto.
Can we see a little piece of code for making the grid above ?
Thanks a lot
Massimo

Posts: 1487
Joined: Tue Jun 14, 2016 07:51 AM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 08:51 PM
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 (fw): Select all Collapse
oCn:ImportFromDBF( "c:\fwh\samples\customer.dbf" )


viewtopic.php?f=3&t=33908&start=15
Marc Venken

Using: FWH 23.08 with Harbour
Posts: 6983
Joined: Fri Oct 07, 2005 07:07 PM
Re: DOS accounting system to TWeb
Posted: Sun Apr 07, 2019 09:42 PM
Hello Massimo,

Please read this post:

viewtopic.php?f=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 (fw): Select all Collapse
<?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()    
?>