DOS accounting system to TWeb

DOS accounting system to TWeb

Postby Otto » Fri Apr 05, 2019 6: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
Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: DOS accounting system to TWeb

Postby Otto » Sat Apr 06, 2019 6: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

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: DOS accounting system to TWeb

Postby Silvio.Falconi » Sat Apr 06, 2019 6:38 am

do you're using DBF ?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7068
Joined: Thu Oct 18, 2012 7:17 pm

Re: DOS accounting system to TWeb

Postby Otto » Sun Apr 07, 2019 7: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

Image


Code: Select all  Expand view  RUN


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
//-----------------------------------
 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: DOS accounting system to TWeb

Postby Jack » Sun Apr 07, 2019 8: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
Jack
 
Posts: 288
Joined: Wed Jul 11, 2007 11:06 am

Re: DOS accounting system to TWeb

Postby Marc Venken » Sun Apr 07, 2019 9: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

Image


Code: Select all  Expand view  RUN


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.04 with Harbour
User avatar
Marc Venken
 
Posts: 1439
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: DOS accounting system to TWeb

Postby Silvio.Falconi » 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 November 2023 - January 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
User avatar
Silvio.Falconi
 
Posts: 7068
Joined: Thu Oct 18, 2012 7:17 pm

Re: DOS accounting system to TWeb

Postby Otto » Sun Apr 07, 2019 3: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: DOS accounting system to TWeb

Postby Otto » Sun Apr 07, 2019 3:02 pm

Silvio,
for me SQL is perfect.
Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: DOS accounting system to TWeb

Postby Otto » Sun Apr 07, 2019 3: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
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: DOS accounting system to TWeb

Postby Otto » Sun Apr 07, 2019 3: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

Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: DOS accounting system to TWeb

Postby Otto » Sun Apr 07, 2019 4:23 pm

Hello,

now the first basic grid from TWeb.
Image

Best regards
Otto
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Re: DOS accounting system to TWeb

Postby Massimo Linossi » Sun Apr 07, 2019 7:17 pm

Hi Otto.
Can we see a little piece of code for making the grid above ?
Thanks a lot
Massimo
User avatar
Massimo Linossi
 
Posts: 498
Joined: Mon Oct 17, 2005 10:38 am
Location: Italy

Re: DOS accounting system to TWeb

Postby Marc Venken » Sun Apr 07, 2019 8: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: Select all  Expand view  RUN

oCn:ImportFromDBF( "c:\fwh\samples\customer.dbf" )
 


viewtopic.php?f=3&t=33908&start=15
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1439
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: DOS accounting system to TWeb

Postby Otto » Sun Apr 07, 2019 9: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: Select all  Expand view  RUN


<?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()   
?>

 
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6336
Joined: Fri Oct 07, 2005 7:07 pm

Next

Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Silvio.Falconi and 55 guests