PRESO !!

Moderator: Enrico Maria Giordano

PRESO !!

Postby solving » Fri Jun 26, 2015 4:41 pm

Salve
ho comprato fivetouch.

funziona bene sia in windows che su tablet (modalita' interprete).
( non sono pronto per generare l'apk per android )

qualcuno del forum Italia che lo usa per scambio info ?

dato che non conosco molto bene la sintassi di harbour rispetto a quella del clipper
posso chiedere eventuali informazioni in questo forum ?

grazie.

il mio primo programma :)

Code: Select all  Expand view

#include "FiveTouch.ch"

FUNCTION Main()

local oDlg,;
      oBtnPre,;
      oBtnInv,;
      oBtnEle,;
      oBtnNtx,;
      oBtnImp,;
      oBtnEnd

LOCAL cDir := "",fDbf,fNtx

PRIVATE xPath := HB_DIRBASE() + "SOLVING\"

cDir := xPath + "
DATI"

SET DELETE ON
SET CENTURY ON
SET ESCAPE ON
SET DATE ITALIAN
SETCANCEL(.T.)

CLOSE ALL

CLEAR SCREEN

* --- Verifica se Non Esiste la Directory
*     viene creata
IF !lIsDir( cDir )
   MakeDir( cDir )
ENDIF

* --- Imposta Variabili
fDbf := cDir + "
\_DATIL.DBF"
fNtx := cDir + "
\_DATIL.NTX"

* --- Crea File se Non Esiste
Crea_File( fDbf, fNtx, 0 )

DEFINE DIALOG oDlg

oDlg:setWindowTitle( "
Gestione Prezzi" )

* --- Definizione Pulsanti
@ 10, 90 BUTTON oBtnPre PROMPT "
Prezzi" OF oDlg ;
         ACTION Vedi_P( fDbf, fNtx )

@ 50, 90 BUTTON oBtnInv PROMPT "
Inventario" OF oDlg ;
         ACTION Inventa( fDbf, fNtx )

@ 90, 90 BUTTON oBtnEle PROMPT "
Elenco" OF oDlg ;
         ACTION Elenco( fDbf, fNtx )

@ 130, 90 BUTTON oBtnNtx PROMPT "
Reindex" OF oDlg ;
          ACTION Crea_File( fDbf, fNtx, 1 )

@ 170, 90 BUTTON oBtnImp PROMPT "
Import File" OF oDlg ;
          ACTION Import(fDbf, fNtx, cDir )

@ 210, 90 BUTTON oBtnEnd PROMPT "
Fine" OF oDlg ;
          ACTION oDlg:End()

ACTIVATE DIALOG oDlg CENTERED

return nil

// ------------------------------- CREA_FILE
FUNCTION Crea_File( fDbf, fNtx, nSw )
LOCAL aDbf := {}

//*** Crea Archivio se non esiste
IF !FILE( fDbf )
   AADD(aDbf,{"
CODICE","C",13,0})
   AADD(aDbf,{"
DESC","C",15,0})
   AADD(aDbf,{"
QTA","N",6,2})
   AADD(aDbf,{"
PRE","N",9,3})
   DBCREATE(fDbf,aDbf)
   FERASE(fNtx)
ENDIF

IF nSw == 1
   FERASE(fNtx)
ENDIF

//*** Crea Indice se non esiste
IF !FILE( fNtx )
   USE( fDbf ) ALIAS Dati NEW
   INDEX ON Dati->CODICE TO ( fNtx )
   CLOSE DATABASES
ENDIF

IF nSw == 1
   MsgInfo("
Reindex Completato" )
ENDIF

RETURN NIL

// ----------------------- IMPORT
FUNCTION Import( fDbf, fNtx, cDir )
LOCAL cPath := "
D:\TX\"
LOCAL cFile := "
_DATIL.DBF"

IF MsgYesNo("
Import Dati  ?","Richiesta Import")
   IF FILE( cPath + cFile )

      FERASE( fDbf )
      FERASE( fNtx )

      COPY FILE(cPath + cFile) TO ( cDir +"
\"+ cFile )

      Crea_File( fDbf, fNtx, 1 )
   ELSE  
      MsgInfo("
Non Trovo " + cPath + cFile )
   ENDIF
ENDIF
RETURN NIL

// ----------------------- VEDI_P
FUNCTION Vedi_P( fDbf, fNtx )
LOCAL oCod, oDlg, cCod := SPACE(13)
LOCAL oBtnEnd, oBtnOk

USE( fDbf ) INDEX ( fNtx ) ALIAS Dati NEW

DEFINE DIALOG oDlg TITLE "
Vedi Prezzi" ;
       SIZE 300, 200

@ 160, 25 BUTTON oBtnEnd PROMPT "
Abbandona" OF oDlg ;
          ACTION oDlg:End()

@ 160, 150 BUTTON oBtnOk PROMPT "
Cerca" OF oDlg ;
           ACTION Prezzo(oDlg, cCod, oCod)

@ 20, 020 SAY oSay PROMPT "
Codice" OF oDlg
@ 60, 020 SAY oSay PROMPT "
Codice" OF oDlg
@ 90, 020 SAY oSay PROMPT "
Desc. " OF oDlg
@ 120,020 SAY oSay PROMPT "
Prezzo" OF oDlg

@ 15, 060 GET oCod VAR cCod OF oDlg
oCod:setFixedSize(130,25)
oCod:setFocus()

ACTIVATE DIALOG oDlg CENTERED

Dati->( DBCLOSEAREA() )
RETURN NIL

// ----------------------- PREZZO
FUNCTION Prezzo( oDlg, cCod, oCod )
LOCAL cBar := "
",;
      cDes := "
",;
      nPre := 0, lOk := .F.

LOCAL oLab1 := QLabel( oDlg ),;
      oLab2 := QLabel( oDlg ),;
      oLab3 := QLabel( oDlg )

cCod := ALLTRIM( cCod )

* --- Vuota Righe
oLab1:setText( SPACE(30)  )
oLab1:move( 65 , 60 )
oLab1:show()

oLab2:setText( SPACE(50)  )
oLab2:move( 65 , 90 )
oLab2:show()

oLab3:setText( SPACE(30)  )
oLab3:move( 65 , 120 )
oLab3:show()

IF !EMPTY( cCod )
   IF Dati->( DBSeek(cCod) )
      cBar := Dati->CODICE    
      cDes := Dati->DESC
      nPre := Dati->PRE
      lOk := .T.  
   ELSE  
      cDes := "
Codice " + cCod + " Non Trovato"
   ENDIF
ELSE
    cDes := "
Codice Vuoto"
ENDIF

IF lOk
   * --- Visualizza Dati
   oLab1:setText( cBar  )
   oLab1:move( 65 , 60 )
   oLab1:show()

   oLab2:setText( cDes  )
   oLab2:move( 65 , 90 )
   oLab2:show()

   oLab3:setText( STR(nPre)  )
   oLab3:move( 65 , 120 )
   oLab3:show()
ELSE
   oLab2:setText( cDes  )
   oLab2:move( 65 , 90 )
   oLab2:show()
ENDIF

oCod:SetText(SPACE(13))
oCod:setFocus()

RETURN NIL

// ----------------------- INVENTA
FUNCTION Inventa( fDbf, fNtx )
LOCAL oDlg
LOCAL oCod, cCod := SPACE(13)
LOCAL oQta, nQta := "
1"
LOCAL oBtnEnd, oBtnOk

USE( fDbf ) INDEX ( fNtx ) ALIAS Dati NEW

DEFINE DIALOG oDlg TITLE "
Inventario" ;
       SIZE 300, 200

@ 160, 25 BUTTON oBtnEnd PROMPT "
Abbandona" OF oDlg ;
          ACTION oDlg:End()

@ 160, 150 BUTTON oBtnOk PROMPT "
Conferma" OF oDlg ;
           ACTION Salva( oDlg, cCod, nQta, oCod, oQta )

@ 20, 020 SAY oSay PROMPT "
Codice" OF oDlg
@ 50, 020 SAY oSay PROMPT "
Q.t…"   OF oDlg
@ 90, 020 SAY oSay PROMPT "
Desc."  OF oDlg
@ 120,020 SAY oSay PROMPT "
Q.t… Attuale" OF oDlg

@ 15, 060 GET oCod VAR cCod OF oDlg
oCod:setFixedSize(130,25)
*oCod:SetMaxLength(20)
oCod:setFocus()

@ 45, 060 GET oQta VAR nQta OF oDlg
oQta:setFixedSize(50,25)
oQta:setInputMask("
0000")

ACTIVATE DIALOG oDlg CENTERED

Dati->( DBCLOSEAREA() )
RETURN NIL

// ----------------------- SALVA
FUNCTION Salva( oDlg, cCod, nV, oCod, oQta )
LOCAL lOk := .F., cDes := "
"

LOCAL oLab1 := QLabel( oDlg ),;
      oLab2 := QLabel( oDlg )
     
cCod := ALLTRIM( cCod )

* --- Vuota Righe
oLab1:setText( SPACE(50)  )
oLab1:move( 65 , 60 )
oLab1:show()

oLab2:setText( SPACE(30)  )
oLab2:move( 85 , 90 )
oLab2:show()

IF !EMPTY( cCod )
   IF Dati->( DBSeek(cCod) )
      cDes := Dati->DESC
      nQta := Dati->QTA    
      lOk := .T.
   ELSE  
      cDes := "
Codice " + cCod + " Non Trovato"
   ENDIF
ELSE
    cDes := "
Codice Vuoto"
ENDIF

IF lOk
   oLab1:setText( cDes  )
   oLab1:move( 65 , 90 )
   oLab1:show()

   oLab2:setText( STR(nQta)  )
   oLab2:move( 85 , 120 )
   oLab2:show()

   IF MsgYesNo("
Memorizzo Dati ?","Conferma")
      Dati->Qta += VAL( nV )
      Dati->( DBCOMMIT() )
   ENDIF

   * --- Vuota le Variabili
   oCod:SetText(SPACE(13))
   oQta:SetText("
1")

   oLab1:setText( SPACE(50))
   oLab1:move( 65 , 90 )
   oLab1:show()

   oLab2:setText( SPACE(10) )
   oLab2:move( 85 , 120 )
   oLab2:show()
ELSE
   oLab1:setText( cDes  )
   oLab1:move( 65 , 90 )
   oLab1:show()
ENDIF

oCod:setFocus()

RETURN NIL

// ------------------------ ELENCO
FUNCTION Elenco( fDbf, fNtx )
local oDlg := QDialog()
local oBrw := QTableView( oDlg )
local oModel := QStandardItemModel( 3, 4, oDlg )
LOCAL nNumRecord := 0, i, oIcon
LOCAL oBtnEnd, oBtnTp, oBtnBt

* --- Dichiaro Button
@ 335, 25 BUTTON oBtnEnd PROMPT "
Abbandona" OF oDlg ;
          ACTION oDlg:End()

@ 335, 150 BUTTON oBtnTp PROMPT "
Inizio" OF oDlg ;
          ACTION Inizio( oBrw )

@ 335, 250 BUTTON oBtnBt PROMPT "
Fine" OF oDlg ;
          ACTION Fine( oBrw )

* --- Imposto Icone nei Pulsanti
*oBtnEnd:SetIcon( QIcon(xPath + "
Exit.png") )
*OBtnEnd:setIconSize(QSize(10,10))

oBtnTp:SetIcon( QIcon(xPath + "
go-top.png") )
*OBtnTp:setIconSize(QSize(65,65))

oBtnBt:SetIcon( QIcon(xPath + "
go-bottom.png") )
*OBtnBt:setIconSize(QSize(65,65))

* --- Apro File
USE( fDbf ) INDEX ( fNtx ) ALIAS Dati NEW
nNumRecord := Dati->( RecCount() )

* --- Imposto Intestazione
oModel:SetHorizontalHeaderItem( 0, QStandardItem( "
Codice" ) )
oModel:SetHorizontalHeaderItem( 1, QStandardItem( "
Descrizione" ) )
oModel:SetHorizontalHeaderItem( 2, QStandardItem( "
Q.tà" ) )
oModel:SetHorizontalHeaderItem( 3, QStandardItem( "
Prezzo" ) )

* --- Carico Dati
For i = 0 TO nNumRecord
    oModel:SetItem( i, 0, QStandardItem( Dati->CODICE ) )
    oModel:SetItem( i, 1, QStandardItem( Dati->DESC ) )
    oModel:SetItem( i, 2, QStandardItem( STR(Dati->QTA) ) )
    oModel:SetItem( i, 3, QStandardItem( STR(Dati->PRE) ) )
    Dati->( DBSKIP() )
NEXT

* --- Chiudo File
Dati->( DBCLOSEAREA() )

* --- Imposto Form Principale
oDlg:SetWindowTitle( "
Elenco" )
oDlg:Resize( 450, 370 )
oDlg:Center()

* --- Imposto Form Browse
oBrw:SetModel( oModel )
oBrw:Resize( 445, 330 )

* --- Imposto Larghezza Colonne della Browse
oBrw:setColumnWidth(0, 90)
oBrw:setColumnWidth(1, 190)
oBrw:setColumnWidth(2, 40)
oBrw:setColumnWidth(3, 50)

* --- Esecuzione
oBrw:show()
oDlg:Exec()

RETURN NIL

* --- Posizione Top del Browse
FUNCTION Inizio( oBrw )
oBrw:scrollToTop()
*oBrw:setCurrentCell(0,0)
oBrw:setFocus()
RETURN NIL

* --- Posizione Bottom del Browse
FUNCTION Fine( oBrw )
oBrw:scrollToBottom()
*oBrw:setCurrentCell(oBrw:rowCount()-1,0)
oBrw:setFocus()
RETURN NIL
solving
 
Posts: 38
Joined: Fri Jun 05, 2009 7:55 am
Location: Sicily ( ct ) - Italy

Re: PRESO !!

Postby solving » Fri Jun 26, 2015 4:59 pm

Se volete usarlo nel tablet cambiate i caratteri \ in /

esempio : \sdcard\download\mia_dir

nel sorgente .prg eseguito dal tablet ho dovuto cambiare in : /sdcard/download/mia_dir

ciao
solving
 
Posts: 38
Joined: Fri Jun 05, 2009 7:55 am
Location: Sicily ( ct ) - Italy

Re: PRESO !!

Postby Antonio Linares » Fri Jun 26, 2015 10:55 pm

Giussepe,

Is it working fine ?
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 35252
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: PRESO !!

Postby solving » Sat Jun 27, 2015 6:37 am

Antonio Linares wrote:Giussepe,

Is it working fine ?


only interpreted ( .prg ) windows and tablet ok !
solving
 
Posts: 38
Joined: Fri Jun 05, 2009 7:55 am
Location: Sicily ( ct ) - Italy

Re: PRESO !!

Postby Antonio Linares » Sat Jun 27, 2015 7:09 am

Giussepe,

I have sent you an email to know if you completed the settings and if your APKs are properly working, thanks
regards, saludos

Antonio Linares
www.fivetechsoft.com
User avatar
Antonio Linares
Site Admin
 
Posts: 35252
Joined: Thu Oct 06, 2005 5:47 pm
Location: Spain

Re: PRESO !!

Postby xfood » Fri Sep 25, 2015 8:15 pm

solving wrote:Se volete usarlo nel tablet cambiate i caratteri \ in /

esempio : \sdcard\download\mia_dir

nel sorgente .prg eseguito dal tablet ho dovuto cambiare in : /sdcard/download/mia_dir

ciao


ciao .. mi chiamo Gaetano e sono di agrigento
se ti va di sentirci... la mia email e xfood@libero.it :D :D :D :D
xfood
 
Posts: 90
Joined: Tue Jun 17, 2008 9:02 pm


Return to All products support

Who is online

Users browsing this forum: No registered users and 3 guests